Skip to content
Snippets Groups Projects
Commit a0af9d4b authored by schneider's avatar schneider
Browse files

ecg: handle error when writing to BLE fails

parent 07b008b6
No related branches found
No related tags found
No related merge requests found
...@@ -177,13 +177,18 @@ class ECG: ...@@ -177,13 +177,18 @@ class ECG:
def callback_ecg(self, datasets): def callback_ecg(self, datasets):
if self.ble_streaming: if self.ble_streaming:
self.ble_sample_count += len(datasets) try:
self.b.gatts_notify( self.b.gatts_notify(
1, 1,
self.ecg_data_handle, self.ecg_data_handle,
struct.pack(">h", self.ble_sample_count & 0xFFFF) struct.pack(">h", self.ble_sample_count & 0xFFFF)
+ struct.pack(">" + ("h" * len(datasets)), *datasets), + struct.pack(">" + ("h" * len(datasets)), *datasets),
) )
except OSError:
pass
# We count all samples, even if we failed to send them
self.ble_sample_count += len(datasets)
# Don't update the screen if it should be off during a connection # Don't update the screen if it should be off during a connection
if not config.get_option("BLE Disp"): if not config.get_option("BLE Disp"):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment