File tree 1 file changed +3
-10
lines changed
1 file changed +3
-10
lines changed Original file line number Diff line number Diff line change @@ -149,10 +149,10 @@ class AdafruitSensorMeasurement(Advertisement):
149
149
"""Battery voltage in millivolts. Saves two bytes over voltage and is more readable in bare
150
150
packets."""
151
151
152
- def __init__ (self , * , sequence_number = None ):
152
+ def __init__ (self , * , sequence_number = 0 ):
153
153
super ().__init__ ()
154
- if sequence_number :
155
- self .sequence_number = sequence_number
154
+ # Always set the sequence number so that it's always first in the packet
155
+ self .sequence_number = sequence_number
156
156
157
157
def __str__ (self ):
158
158
parts = []
@@ -164,13 +164,6 @@ def __str__(self):
164
164
parts .append ("{}={}" .format (attr , str (value )))
165
165
return "<{} {} >" .format (self .__class__ .__name__ , " " .join (parts ))
166
166
167
- def __bytes__ (self ):
168
- """The raw packet bytes."""
169
- # Must reorder the ManufacturerData contents so the sequence number field is always first.
170
- # Necessary to ensure that match_prefixes works right to reconstruct on the receiver.
171
- self .data_dict [255 ].data .move_to_end (3 , last = False )
172
- return super ().__bytes__ ()
173
-
174
167
def split (self , max_packet_size = 31 ):
175
168
"""Split the measurement into multiple measurements with the given max_packet_size. Yields
176
169
each submeasurement."""
You can’t perform that action at this time.
0 commit comments