Skip to content

Commit

Permalink
Add check for temperature threshold. Must be between 45 and 70.
Browse files Browse the repository at this point in the history
  • Loading branch information
easmith5 committed Oct 26, 2019
1 parent ce0bd25 commit 9187957
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions recipes-core/init/files/init_auto_shutdown/init-auto-shutdown
Original file line number Diff line number Diff line change
Expand Up @@ -53,12 +53,25 @@ def check_temp(temp_sensor):
return temp

#set the i2c mux channel, since all the device is under SENSOR_IIC_BUS, just need to set once at the b
print("Starting Zynq+ temperature monitoring. Automatic shutdown will occur at %.2f C." %TEMP_THRESHOLD)
logging.basicConfig(filename="/etc/init.d/init_auto_shutdown/temp.log", level=logging.INFO)
i2c = I2C("/dev/i2c-1")
i2c.transfer(TCA9548_U93_ADDR, [I2C.Message([SENSOR_IIC_BUS])]) # SENSOR_IIC_BUS is selected
i2c.close()

#Get and Check Temperature threshold
if (TEMP_THRESHOLD > 70.0):
print("Temperature Threshold set to %.2f. This is too high!!" %TEMP_THRESHOLD)
print("Starting Zynq+ temperature monitoring. Automatic shutdown will occur at 60 C")

elif (TEMP_THRESHOLD < 45.0):
print("Temperature Threshold set to %.2f. This is too low!!" %TEMP_THRESHOLD)
print("Starting Zynq+ temperature monitoring. Automatic shutdown will occur at 60 C")

else:
print("Starting Zynq+ temperature monitoring. Automatic shutdown will occur at %.2f C." %TEMP_THRESHOLD)

logging.basicConfig(filename="/etc/init.d/init_auto_shutdown/temp.log", level=logging.INFO)


temp_zynq = float(25)

while temp_zynq < TEMP_THRESHOLD:
Expand Down

0 comments on commit 9187957

Please sign in to comment.