Skip to content

Commit

Permalink
Merge pull request #76 from Pi4J/docs/update-boardinfohelper-throttle…
Browse files Browse the repository at this point in the history
…dstates

Update Documentation for BoardInfoHelper to Include Throttled States Methods
  • Loading branch information
dariuszzbyrad authored Dec 31, 2024
2 parents 9ef6a15 + 1b03410 commit 18a3378
Showing 1 changed file with 16 additions and 3 deletions.
19 changes: 16 additions & 3 deletions content/documentation/board-info.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,16 +61,25 @@ var pi4j = Pi4J.newAutoContext();
// performed. You can use this info in case you need board-specific
// functionality.
// OPTIONAL

// Display board information
console.println("Board model: " + pi4j.boardInfo().getBoardModel().getLabel());
console.println("Operating system: " + pi4j.boardInfo().getOperatingSystem());
console.println("Java versions: " + pi4j.boardInfo().getJavaInfo());
// This info is also available directly from the BoardInfoHelper,
// and with some additional realtime data.

// Access additional info via BoardInfoHelper
console.println("Board model: " + BoardInfoHelper.current().getBoardModel().getLabel());
console.println("Raspberry Pi model with RP1 chip (Raspberry Pi 5): " + BoardInfoHelper.usesRP1());
console.println("OS is 64-bit: " + BoardInfoHelper.is64bit());
console.println("JVM memory used (MB): " + BoardInfoHelper.getJvmMemory().getUsedInMb());
console.println("Board temperature (°C): " + BoardInfoHelper.getBoardReading().getTemperatureInCelsius());

// Access throttled states
var throttledStates = BoardInfoHelper.getBoardReading().getThrottledStates();
console.println("Throttled states: ");
throttledStates.forEach(state -> console.println(" - " + state.name()));

console.println("Throttled states description: " + BoardInfoHelper.getBoardReading().getThrottledStatesDescription());
```

### Example Output
Expand All @@ -80,10 +89,14 @@ console.println("Board temperature (°C): " + BoardInfoHelper.getBoardReading().
[main] INFO com.pi4j.util.Console - Operating system: Name: Linux, version: 6.1.21-v8+, architecture: aarch64
[main] INFO com.pi4j.util.Console - Java versions: Version: 22, runtime: 22+36, vendor: Azul Systems, Inc., vendor version: Zulu22.28+91-CA


[main] INFO com.pi4j.util.Console - Board model: Raspberry Pi 4 Model B
[main] INFO com.pi4j.util.Console - Raspberry Pi model with RP1 chip (Raspberry Pi 5): false
[main] INFO com.pi4j.util.Console - OS is 64-bit: true
[main] INFO com.pi4j.util.Console - JVM memory used (MB): 10.910163879394531
[main] INFO com.pi4j.util.Console - Board temperature (°C): 61.3

[main] INFO com.pi4j.util.Console - Throttled states:
[main] INFO com.pi4j.util.Console - - UNDERVOLTAGE_DETECTED
[main] INFO com.pi4j.util.Console - - SOFT_TEMPERATURE_LIMIT_ACTIVE
[main] INFO com.pi4j.util.Console - Throttled states description: Under-voltage detected, Soft temperature limit active
```

0 comments on commit 18a3378

Please sign in to comment.