Updated telemetry value methodology
Per @rossengeorgiev comments on #27 I now use a dictionary with lists to hold telemetry similar to how aprslib holds telemetry when parsed from comments.
This commit is contained in:
parent
5bc2eda3b4
commit
aa3b1bb165
|
|
@ -2,28 +2,24 @@ from aprslib.packets.base import APRSPacket
|
|||
|
||||
class TelemetryReport(APRSPacket):
|
||||
format = 'raw'
|
||||
sequenceno = 0
|
||||
analog1 = 0
|
||||
analog2 = 0
|
||||
analog3 = 0
|
||||
analog4 = 0
|
||||
analog5 = 0
|
||||
digitalvalue = ['0']*8
|
||||
telemetry = dict(seq=0,
|
||||
vals=['0']*6)
|
||||
telemetry['vals'][5] = ['1']*8
|
||||
comment = ''
|
||||
|
||||
def _serialize_body(self):
|
||||
# What do we do when len(digitalvalue) != 8?
|
||||
self.digitalvalue = ''.join(self.digitalvalue)
|
||||
tempio = ''.join(self.telemetry['vals'][5])
|
||||
|
||||
body = [
|
||||
'T#', # packet type
|
||||
str(self.sequenceno).zfill(3),
|
||||
str(self.analog1).zfill(3),
|
||||
str(self.analog2).zfill(3),
|
||||
str(self.analog3).zfill(3),
|
||||
str(self.analog4).zfill(3),
|
||||
str(self.analog5).zfill(3),
|
||||
str(self.digitalvalue),
|
||||
str(self.telemetry['seq']).zfill(3),
|
||||
str(self.telemetry['vals'][0]).zfill(3),
|
||||
str(self.telemetry['vals'][1]).zfill(3),
|
||||
str(self.telemetry['vals'][2]).zfill(3),
|
||||
str(self.telemetry['vals'][3]).zfill(3),
|
||||
str(self.telemetry['vals'][4]).zfill(3),
|
||||
str(tempio),
|
||||
self.comment,
|
||||
]
|
||||
tmpbody = ",".join(body)
|
||||
|
|
|
|||
Loading…
Reference in New Issue