File tree Expand file tree Collapse file tree 1 file changed +4
-5
lines changed Expand file tree Collapse file tree 1 file changed +4
-5
lines changed Original file line number Diff line number Diff line change @@ -13,7 +13,8 @@ class Chords_BLE:
13
13
CONTROL_CHAR_UUID = "0000ff01-0000-1000-8000-00805f9b34fb"
14
14
15
15
# Packet parameters
16
- SINGLE_SAMPLE_LEN = 7 # (1 Counter + 3 Channels * 2 bytes)
16
+ NUM_CHANNELS = 3
17
+ SINGLE_SAMPLE_LEN = (NUM_CHANNELS * 2 ) + 1 # (1 Counter + Num_Channels * 2 bytes)
17
18
BLOCK_COUNT = 10
18
19
NEW_PACKET_LEN = SINGLE_SAMPLE_LEN * BLOCK_COUNT
19
20
@@ -72,10 +73,8 @@ def process_sample(self, sample_data: bytearray):
72
73
if self .start_time is None :
73
74
self .start_time = time .time ()
74
75
75
- channels = [
76
- int .from_bytes (sample_data [1 :3 ], byteorder = 'big' , signed = True ),
77
- int .from_bytes (sample_data [3 :5 ], byteorder = 'big' , signed = True ),
78
- int .from_bytes (sample_data [5 :7 ], byteorder = 'big' , signed = True )]
76
+ channels = [int .from_bytes (sample_data [i :i + 2 ], byteorder = 'big' , signed = True )
77
+ for i in range (1 , len (sample_data ), 2 )]
79
78
80
79
self .samples_received += 1
81
80
You can’t perform that action at this time.
0 commit comments