mirror of
https://github.com/markqvist/Reticulum.git
synced 2025-12-16 17:04:25 -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
|
|
@ -64,6 +64,7 @@ class KISS():
|
|||
CMD_STAT_PHYPRM = 0x26
|
||||
CMD_STAT_BAT = 0x27
|
||||
CMD_STAT_CSMA = 0x28
|
||||
CMD_STAT_TEMP = 0x29
|
||||
CMD_BLINK = 0x30
|
||||
CMD_RANDOM = 0x40
|
||||
CMD_FB_EXT = 0x41
|
||||
|
|
@ -213,6 +214,7 @@ class RNodeInterface(Interface):
|
|||
self.bitrate = 0
|
||||
self.st_alock = st_alock
|
||||
self.lt_alock = lt_alock
|
||||
self.cpu_temp = None
|
||||
self.platform = None
|
||||
self.display = None
|
||||
self.mcu = None
|
||||
|
|
@ -257,6 +259,7 @@ class RNodeInterface(Interface):
|
|||
|
||||
self.r_battery_state = RNodeInterface.BATTERY_STATE_UNKNOWN
|
||||
self.r_battery_percent = 0
|
||||
self.r_temperature = None
|
||||
self.r_framebuffer = b""
|
||||
self.r_framebuffer_readtime = 0
|
||||
self.r_framebuffer_latency = 0
|
||||
|
|
@ -985,6 +988,22 @@ class RNodeInterface(Interface):
|
|||
bat_percent = 0
|
||||
self.r_battery_state = command_buffer[0]
|
||||
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):
|
||||
self.r_random = byte
|
||||
elif (command == KISS.CMD_PLATFORM):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue