Tympan / Tympan_Library

Arduino/Teensy Library for Tympan Open Source Hearing Aid
MIT License
116 stars 31 forks source link

Improve how BLE class updates whether it is advertising or not #44

Closed chipaudette closed 2 years ago

chipaudette commented 2 years ago

Currently, I generally ask the BLE module to update its advertising status every X seconds (usually 5 seconds). This is via the ble.updateAdvertising() method.

In watching the RevE do other tasks (like blink the LEDs during SD recording), I see the LEDs slow down once every 5 seconds. When I turn off the updating for the advertising. The LEDs blinks smoothly.

When it does the update, it (1) checks whether it is connected and (2) whether it is already advertising. If both tests fail, it (3) starts advertising. This ends up being one to three interactions with the BT module via the slow 9600 bps serial connection.

I would not have expected the update routine to cause the Tympan to cough. We should improve this process to make it not cough.

@ijenkins-creare, it'd be great if you had thoughts.

chipaudette commented 2 years ago

This is tied up with the BT Classic merge (#51 ) and it is tied up with increasing the baudrate to the BLE module. Closing this discussion here.