Skip to content

Commit

Permalink
Reduce debug from this, 30second period check is fine and logged a bu…
Browse files Browse the repository at this point in the history
…g with pi4j - Pi4J/pi4j-v1#554
  • Loading branch information
piemmm committed Jul 23, 2023
1 parent a4f4c9d commit 32d42ea
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions src/main/java/org/prowl/distribbs/utils/Hardware.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import com.pi4j.io.spi.SpiDevice;
import com.pi4j.io.spi.SpiFactory;
import com.pi4j.io.spi.SpiMode;
import com.pi4j.system.SystemInfo;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

Expand Down Expand Up @@ -147,11 +148,11 @@ public void run() {
LOG.info("Thermal monitor starting");
while (true) {
try {
Thread.sleep(10000);
Thread.sleep(30000);
} catch (InterruptedException e) {
}
try {
float currentTemp = 0;// SystemInfo.getCpuTemperature();
float currentTemp = SystemInfo.getCpuTemperature();
//LOG.debug("CPU thermals:" + currentTemp);
if (currentTemp > MAX_CPU_TEMP) {
gpioFan1.high();
Expand All @@ -161,11 +162,13 @@ public void run() {
gpioFan2.low();
}
} catch (UnsupportedOperationException e) {
LOG.warn("CPU Does not support temperature measurement");
LOG.warn("CPU Does not support temperature measurement:" + e.getMessage());
break;
// } catch (InterruptedException e) {
} catch (Throwable e) {
e.printStackTrace();
} catch (IOException e) {
LOG.warn("CPU Does not support temperature measurement:" + e.getMessage());
break;
} catch(Throwable e) {
LOG.error(e.getMessage(), e);
}
}
LOG.info("Thermal monitor exiting");
Expand Down

0 comments on commit 32d42ea

Please sign in to comment.