File tree Expand file tree Collapse file tree 1 file changed +17
-7
lines changed
photon-core/src/main/java/org/photonvision/common/hardware/metrics Expand file tree Collapse file tree 1 file changed +17
-7
lines changed Original file line number Diff line number Diff line change @@ -25,13 +25,7 @@ public class SystemMonitorRaspberryPi extends SystemMonitor {
2525
2626 @ Override
2727 public String getCpuThrottleReason () {
28- int state = 0 ;
29- String output = vcgencmd ("get_throttled" );
30- try {
31- state = Integer .decode (output );
32- } catch (NumberFormatException e ) {
33- logger .warn ("Could not parse return value: " + output );
34- }
28+ int state = getThrottleState ();
3529 if ((state & 0x01 ) != 0 ) {
3630 return "LOW VOLTAGE" ;
3731 } else if ((state & 0x08 ) != 0 ) {
@@ -44,6 +38,22 @@ public String getCpuThrottleReason() {
4438 return "None" ;
4539 }
4640
41+ @ Override
42+ public boolean isThermallyThrottling () {
43+ return (getThrottleState () & 0x08 ) != 0 ;
44+ }
45+
46+ private int getThrottleState () {
47+ int state = 0 ;
48+ String output = vcgencmd ("get_throttled" );
49+ try {
50+ state = Integer .decode (output );
51+ } catch (NumberFormatException e ) {
52+ logger .warn ("Could not parse return value: " + output );
53+ }
54+ return state ;
55+ }
56+
4757 @ Override
4858 public double getGpuMem () {
4959 String output = vcgencmd ("get_mem gpu" );
You can’t perform that action at this time.
0 commit comments