Skip to content

Commit

Permalink
Merge branch 'develop' into release/2.6
Browse files Browse the repository at this point in the history
  • Loading branch information
eitch committed Jun 17, 2024
2 parents 5e8cbc4 + 4878aee commit a257c29
Show file tree
Hide file tree
Showing 19 changed files with 124 additions and 177 deletions.
2 changes: 1 addition & 1 deletion libraries/pi4j-library-gpiod/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>com.pi4j</groupId>
<artifactId>pi4j-library</artifactId>
<version>2.6.0-SNAPSHOT</version>
<version>2.6.1-SNAPSHOT</version>
<relativePath>../pi4j-library/pom.xml</relativePath>
</parent>

Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,15 @@
package com.pi4j.library.gpiod.internal;

import com.pi4j.boardinfo.definition.BoardModel;
import com.pi4j.boardinfo.util.BoardInfoHelper;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.io.Closeable;
import java.util.*;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;

public class GpioDContext implements Closeable {

Expand All @@ -31,6 +36,11 @@ public GpioDContext() {
}

public synchronized void initialize() {
if (BoardInfoHelper.current().getBoardModel() == BoardModel.UNKNOWN) {
logger.warn("Can't initialize GpioD context, board model is unknown");
return;
}

// already initialized
if (this.gpioChip != null)
return;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@
* #L%
*/

import com.pi4j.boardinfo.definition.BoardModel;
import com.pi4j.boardinfo.util.BoardInfoHelper;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

Expand Down Expand Up @@ -252,7 +254,12 @@ public static void loadLibraryFromClasspath(String path) throws IOException {
}
Files.copy(source, target, StandardCopyOption.REPLACE_EXISTING);
}

// Finally, load the library
System.load(target.toAbsolutePath().toString());
if (BoardInfoHelper.current().getBoardModel() == BoardModel.UNKNOWN) {
logger.warn("Can't load the library, board model is unknown");
} else {
System.load(target.toAbsolutePath().toString());
}
}
}
2 changes: 1 addition & 1 deletion libraries/pi4j-library-linuxfs/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<parent>
<artifactId>pi4j-library</artifactId>
<groupId>com.pi4j</groupId>
<version>2.6.0-SNAPSHOT</version>
<version>2.6.1-SNAPSHOT</version>
<relativePath>../pi4j-library/pom.xml</relativePath>
</parent>

Expand Down
2 changes: 1 addition & 1 deletion libraries/pi4j-library-pigpio/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<parent>
<artifactId>pi4j-library</artifactId>
<groupId>com.pi4j</groupId>
<version>2.6.0-SNAPSHOT</version>
<version>2.6.1-SNAPSHOT</version>
<relativePath>../pi4j-library/pom.xml</relativePath>
</parent>

Expand Down
2 changes: 1 addition & 1 deletion libraries/pi4j-library/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<artifactId>pi4j-parent</artifactId>
<groupId>com.pi4j</groupId>
<version>2.6.0-SNAPSHOT</version>
<version>2.6.1-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
Expand Down
2 changes: 1 addition & 1 deletion pi4j-core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<parent>
<groupId>com.pi4j</groupId>
<artifactId>pi4j-parent</artifactId>
<version>2.6.0-SNAPSHOT</version>
<version>2.6.1-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

Expand Down
2 changes: 1 addition & 1 deletion pi4j-distribution/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<artifactId>pi4j-parent</artifactId>
<groupId>com.pi4j</groupId>
<version>2.6.0-SNAPSHOT</version>
<version>2.6.1-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

Expand Down
2 changes: 1 addition & 1 deletion pi4j-test/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<artifactId>pi4j-parent</artifactId>
<groupId>com.pi4j</groupId>
<version>2.6.0-SNAPSHOT</version>
<version>2.6.1-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

Expand Down
10 changes: 7 additions & 3 deletions pi4j-test/src/main/java/com/pi4j/test/About.java
Original file line number Diff line number Diff line change
Expand Up @@ -105,12 +105,16 @@ public void enumeratePlatforms(Context context) {
* @param context a {@link com.pi4j.context.Context} object.
* @throws Pi4JException if any.
*/
public void describeDeafultPlatform(Context context) throws Pi4JException {
public void describeDefaultPlatform(Context context) throws Pi4JException {
logger.info("=====================================================");
logger.info("DEFAULT (RUNTIME) PLATFORM ");
logger.info("=====================================================");
logger.info(" " + context.platform().name() + " [" + context.platform().id() + "]");
context.platform().describe().print(System.out);
if (context.platform() == null) {
logger.warn(" NOT DEFINED");
} else {
logger.info(" {}} [{}}]", context.platform().name(), context.platform().id());
context.platform().describe().print(System.out);
}
}

// public void enumeratePlatformProviders() throws Pi4JException {
Expand Down
2 changes: 1 addition & 1 deletion pi4j-test/src/main/java/com/pi4j/test/Main.java
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ public static void main(String[] args) {
About about = new About();
about.enumerateProviders(pi4j);
about.enumeratePlatforms(pi4j);
about.describeDeafultPlatform(pi4j);
about.describeDefaultPlatform(pi4j);
for(var ioType : IOType.values()){
about.enumerateProviders(pi4j, ioType);
}
Expand Down
2 changes: 1 addition & 1 deletion plugins/pi4j-plugin-gpiod/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>com.pi4j</groupId>
<artifactId>pi4j-plugin</artifactId>
<version>2.6.0-SNAPSHOT</version>
<version>2.6.1-SNAPSHOT</version>
<relativePath>../pi4j-plugin/pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
Expand Down
2 changes: 1 addition & 1 deletion plugins/pi4j-plugin-linuxfs/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>com.pi4j</groupId>
<artifactId>pi4j-plugin</artifactId>
<version>2.6.0-SNAPSHOT</version>
<version>2.6.1-SNAPSHOT</version>
<relativePath>../pi4j-plugin/pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
Expand Down
2 changes: 1 addition & 1 deletion plugins/pi4j-plugin-mock/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<artifactId>pi4j-plugin</artifactId>
<groupId>com.pi4j</groupId>
<version>2.6.0-SNAPSHOT</version>
<version>2.6.1-SNAPSHOT</version>
<relativePath>../pi4j-plugin/pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
Expand Down
Loading

0 comments on commit a257c29

Please sign in to comment.