@@ -57,7 +57,7 @@ class Decoder(srd.Decoder):
5757 )
5858 annotation_rows = (
5959 ('bit' , 'Bits' , (0 ,)),
60- ('throttle ' , 'Throttle ' , (1 ,2 ,3 )),
60+ ('dshot_data ' , 'DShot Data ' , (1 ,2 ,3 )),
6161 ('dshot_errors' , 'Dshot Errors' , (4 ,)),
6262 )
6363
@@ -91,7 +91,7 @@ def metadata(self, key, value):
9191
9292 def handle_bits (self , samplenum ):
9393 if len (self .bits ) == 16 :
94- throttle = int (reduce (lambda a , b : (a << 1 ) | b , self .bits [:11 ]))
94+ dshot_value = int (reduce (lambda a , b : (a << 1 ) | b , self .bits [:11 ]))
9595 telem_request = self .bits [11 ]
9696 received_crc = int (reduce (lambda a , b : (a << 1 ) | b , self .bits [12 :]))
9797
@@ -103,9 +103,15 @@ def handle_bits(self, samplenum):
103103
104104 # TODO: Align this correctly
105105 crc_startsample = samplenum - (self .actual_period * 5 )
106+
107+ # Split annotation based on value type
108+ if dshot_value < 48 :
109+ self .put (self .ss_packet , crc_startsample , self .out_ann ,
110+ [1 , ['%04d' % dshot_value ]])
111+ else :
112+ self .put (self .ss_packet , crc_startsample , self .out_ann ,
113+ [2 , ['%04d' % dshot_value ]])
106114
107- self .put (self .ss_packet , crc_startsample , self .out_ann ,
108- [2 , ['%04d' % throttle ]])
109115 self .put (crc_startsample , samplenum , self .out_ann , [3 , ['Calc CRC: ' + ('%04d' % calculated_crc )+ ' TXed CRC:' + ('%04d' % received_crc )]])
110116 if not crc_ok :
111117 self .put (crc_startsample , samplenum , self .out_ann ,
0 commit comments