mirror of
https://github.com/markqvist/Reticulum.git
synced 2025-12-17 01:14:21 -05:00
Added support for CPU temperature reporting from RNode devices
This commit is contained in:
parent
5836d7f8ba
commit
aa37172293
5 changed files with 48 additions and 3 deletions
|
|
@ -73,6 +73,7 @@ class KISS():
|
||||||
CMD_STAT_PHYPRM = 0x26
|
CMD_STAT_PHYPRM = 0x26
|
||||||
CMD_STAT_BAT = 0x27
|
CMD_STAT_BAT = 0x27
|
||||||
CMD_STAT_CSMA = 0x28
|
CMD_STAT_CSMA = 0x28
|
||||||
|
CMD_STAT_TEMP = 0x29
|
||||||
CMD_BLINK = 0x30
|
CMD_BLINK = 0x30
|
||||||
CMD_RANDOM = 0x40
|
CMD_RANDOM = 0x40
|
||||||
CMD_FB_EXT = 0x41
|
CMD_FB_EXT = 0x41
|
||||||
|
|
@ -444,6 +445,7 @@ class RNodeInterface(Interface):
|
||||||
self.bitrate = 0
|
self.bitrate = 0
|
||||||
self.st_alock = st_alock
|
self.st_alock = st_alock
|
||||||
self.lt_alock = lt_alock
|
self.lt_alock = lt_alock
|
||||||
|
self.cpu_temp = None
|
||||||
self.platform = None
|
self.platform = None
|
||||||
self.display = None
|
self.display = None
|
||||||
self.mcu = None
|
self.mcu = None
|
||||||
|
|
@ -487,6 +489,7 @@ class RNodeInterface(Interface):
|
||||||
self.r_csma_cw_max = None
|
self.r_csma_cw_max = None
|
||||||
self.r_current_rssi = None
|
self.r_current_rssi = None
|
||||||
self.r_noise_floor = None
|
self.r_noise_floor = None
|
||||||
|
self.r_temperature = None
|
||||||
|
|
||||||
self.r_battery_state = RNodeInterface.BATTERY_STATE_UNKNOWN
|
self.r_battery_state = RNodeInterface.BATTERY_STATE_UNKNOWN
|
||||||
self.r_battery_percent = 0
|
self.r_battery_percent = 0
|
||||||
|
|
@ -1358,6 +1361,22 @@ class RNodeInterface(Interface):
|
||||||
bat_percent = 0
|
bat_percent = 0
|
||||||
self.r_battery_state = command_buffer[0]
|
self.r_battery_state = command_buffer[0]
|
||||||
self.r_battery_percent = bat_percent
|
self.r_battery_percent = bat_percent
|
||||||
|
elif (command == KISS.CMD_STAT_TEMP):
|
||||||
|
if (byte == KISS.FESC):
|
||||||
|
escape = True
|
||||||
|
else:
|
||||||
|
if (escape):
|
||||||
|
if (byte == KISS.TFEND):
|
||||||
|
byte = KISS.FEND
|
||||||
|
if (byte == KISS.TFESC):
|
||||||
|
byte = KISS.FESC
|
||||||
|
escape = False
|
||||||
|
command_buffer = command_buffer+bytes([byte])
|
||||||
|
if (len(command_buffer) == 1):
|
||||||
|
temp = command_buffer[0]-120
|
||||||
|
if temp >= -30 and temp <= 90: self.r_temperature = temp
|
||||||
|
else: self.r_temperature = None
|
||||||
|
self.cpu_temp = self.r_temperature
|
||||||
elif (command == KISS.CMD_RANDOM):
|
elif (command == KISS.CMD_RANDOM):
|
||||||
self.r_random = byte
|
self.r_random = byte
|
||||||
elif (command == KISS.CMD_PLATFORM):
|
elif (command == KISS.CMD_PLATFORM):
|
||||||
|
|
|
||||||
|
|
@ -64,6 +64,7 @@ class KISS():
|
||||||
CMD_STAT_PHYPRM = 0x26
|
CMD_STAT_PHYPRM = 0x26
|
||||||
CMD_STAT_BAT = 0x27
|
CMD_STAT_BAT = 0x27
|
||||||
CMD_STAT_CSMA = 0x28
|
CMD_STAT_CSMA = 0x28
|
||||||
|
CMD_STAT_TEMP = 0x29
|
||||||
CMD_BLINK = 0x30
|
CMD_BLINK = 0x30
|
||||||
CMD_RANDOM = 0x40
|
CMD_RANDOM = 0x40
|
||||||
CMD_FB_EXT = 0x41
|
CMD_FB_EXT = 0x41
|
||||||
|
|
@ -213,6 +214,7 @@ class RNodeInterface(Interface):
|
||||||
self.bitrate = 0
|
self.bitrate = 0
|
||||||
self.st_alock = st_alock
|
self.st_alock = st_alock
|
||||||
self.lt_alock = lt_alock
|
self.lt_alock = lt_alock
|
||||||
|
self.cpu_temp = None
|
||||||
self.platform = None
|
self.platform = None
|
||||||
self.display = None
|
self.display = None
|
||||||
self.mcu = None
|
self.mcu = None
|
||||||
|
|
@ -257,6 +259,7 @@ class RNodeInterface(Interface):
|
||||||
|
|
||||||
self.r_battery_state = RNodeInterface.BATTERY_STATE_UNKNOWN
|
self.r_battery_state = RNodeInterface.BATTERY_STATE_UNKNOWN
|
||||||
self.r_battery_percent = 0
|
self.r_battery_percent = 0
|
||||||
|
self.r_temperature = None
|
||||||
self.r_framebuffer = b""
|
self.r_framebuffer = b""
|
||||||
self.r_framebuffer_readtime = 0
|
self.r_framebuffer_readtime = 0
|
||||||
self.r_framebuffer_latency = 0
|
self.r_framebuffer_latency = 0
|
||||||
|
|
@ -985,6 +988,22 @@ class RNodeInterface(Interface):
|
||||||
bat_percent = 0
|
bat_percent = 0
|
||||||
self.r_battery_state = command_buffer[0]
|
self.r_battery_state = command_buffer[0]
|
||||||
self.r_battery_percent = bat_percent
|
self.r_battery_percent = bat_percent
|
||||||
|
elif (command == KISS.CMD_STAT_TEMP):
|
||||||
|
if (byte == KISS.FESC):
|
||||||
|
escape = True
|
||||||
|
else:
|
||||||
|
if (escape):
|
||||||
|
if (byte == KISS.TFEND):
|
||||||
|
byte = KISS.FEND
|
||||||
|
if (byte == KISS.TFESC):
|
||||||
|
byte = KISS.FESC
|
||||||
|
escape = False
|
||||||
|
command_buffer = command_buffer+bytes([byte])
|
||||||
|
if (len(command_buffer) == 1):
|
||||||
|
temp = command_buffer[0]-120
|
||||||
|
if temp >= -30 and temp <= 90: self.r_temperature = temp
|
||||||
|
else: self.r_temperature = None
|
||||||
|
self.cpu_temp = self.r_temperature
|
||||||
elif (command == KISS.CMD_RANDOM):
|
elif (command == KISS.CMD_RANDOM):
|
||||||
self.r_random = byte
|
self.r_random = byte
|
||||||
elif (command == KISS.CMD_PLATFORM):
|
elif (command == KISS.CMD_PLATFORM):
|
||||||
|
|
|
||||||
|
|
@ -1028,6 +1028,9 @@ class Reticulum:
|
||||||
if hasattr(interface, "r_noise_floor"):
|
if hasattr(interface, "r_noise_floor"):
|
||||||
ifstats["noise_floor"] = interface.r_noise_floor
|
ifstats["noise_floor"] = interface.r_noise_floor
|
||||||
|
|
||||||
|
if hasattr(interface, "cpu_temp"):
|
||||||
|
ifstats["cpu_temp"] = interface.cpu_temp
|
||||||
|
|
||||||
if hasattr(interface, "cpu_load"):
|
if hasattr(interface, "cpu_load"):
|
||||||
ifstats["cpu_load"] = interface.cpu_load
|
ifstats["cpu_load"] = interface.cpu_load
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1737,7 +1737,7 @@ def main():
|
||||||
print("[7] Heltec LoRa32 v2")
|
print("[7] Heltec LoRa32 v2")
|
||||||
print("[8] Heltec LoRa32 v3")
|
print("[8] Heltec LoRa32 v3")
|
||||||
print("[9] Heltec LoRa32 v4")
|
print("[9] Heltec LoRa32 v4")
|
||||||
print("[10] LilyGO LoRa T3S3")
|
print("[10] LilyGO LoRa T3S3")
|
||||||
print("[11] RAK4631")
|
print("[11] RAK4631")
|
||||||
print("[12] LilyGo T-Echo")
|
print("[12] LilyGo T-Echo")
|
||||||
print("[13] LilyGO T-Beam Supreme")
|
print("[13] LilyGO T-Beam Supreme")
|
||||||
|
|
@ -4096,8 +4096,8 @@ def main():
|
||||||
print("cases, and copies of the source code for both the RNode Firmware,")
|
print("cases, and copies of the source code for both the RNode Firmware,")
|
||||||
print("Reticulum and other utilities.")
|
print("Reticulum and other utilities.")
|
||||||
print("")
|
print("")
|
||||||
print("To activate the RNode Bootstrap Console, power up your RNode and press")
|
print("To activate the RNode Bootstrap Console, power up your RNode and hold")
|
||||||
print("the reset button twice with a one second interval. The RNode will now")
|
print("down the user button for 10+ seconds, then release. The RNode will now")
|
||||||
print("reboot into console mode, and activate a WiFi access point for you to")
|
print("reboot into console mode, and activate a WiFi access point for you to")
|
||||||
print("connect to. The console is then reachable at: http://10.0.0.1")
|
print("connect to. The console is then reachable at: http://10.0.0.1")
|
||||||
print("")
|
print("")
|
||||||
|
|
|
||||||
|
|
@ -336,6 +336,10 @@ def program_setup(configdir, dispall=False, verbosity=0, name_filter=None, json=
|
||||||
if ifstat["cpu_load"] != None: print(" CPU load : {v} %".format(v=str(ifstat["cpu_load"])))
|
if ifstat["cpu_load"] != None: print(" CPU load : {v} %".format(v=str(ifstat["cpu_load"])))
|
||||||
else: print(" CPU load : Unknown")
|
else: print(" CPU load : Unknown")
|
||||||
|
|
||||||
|
if "cpu_temp" in ifstat:
|
||||||
|
if ifstat["cpu_temp"] != None: print(" CPU temp : {v}°C".format(v=str(ifstat["cpu_temp"])))
|
||||||
|
else: print(" CPU load : Unknown")
|
||||||
|
|
||||||
if "mem_load" in ifstat:
|
if "mem_load" in ifstat:
|
||||||
if ifstat["cpu_load"] != None: print(" Mem usage : {v} %".format(v=str(ifstat["mem_load"])))
|
if ifstat["cpu_load"] != None: print(" Mem usage : {v} %".format(v=str(ifstat["mem_load"])))
|
||||||
else: print(" Mem usage : Unknown")
|
else: print(" Mem usage : Unknown")
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue