File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -232,6 +232,7 @@ uint16_t nuxTxBufLength = 0;
232232#define DEFAULT_PERIPH_MAX_CONN_INTERVAL BLE_DYNAMIC_INTERVAL_HIGH_RATE // highest possible on connect
233233#define BLE_DYNAMIC_INTERVAL_IDLE_TIME 30000 // time in milliseconds at which we enter idle
234234#define BLE_DYNAMIC_INTERVAL_HIGH_TIME 500 // time in milliseconds since last activity at which we go back to high rate
235+ #define BLE_DYNAMIC_INTERVAL_COUNTDOWN 10000 // when we have activity, we subtract this from bleIdleCounter
235236/// How long has BLE been idle for in msec? Use for dynamic interval adjustment
236237uint16_t bleIdleCounter = 0 ;
237238/// Are we using a high speed or low speed interval at the moment?
@@ -755,7 +756,11 @@ void jsble_peripheral_activity() {
755756 jsble_set_periph_connection_interval (BLE_DYNAMIC_INTERVAL_HIGH_RATE , BLE_DYNAMIC_INTERVAL_HIGH_RATE );
756757 }
757758 }
758- bleIdleCounter = 0 ;
759+ // decrement our idle counter - don't zero it immediately so *some* activity can happen and we don't go back to high rate immediately
760+ if (bleIdleCounter > BLE_DYNAMIC_INTERVAL_COUNTDOWN )
761+ bleIdleCounter -= BLE_DYNAMIC_INTERVAL_COUNTDOWN ;
762+ else
763+ bleIdleCounter = 0 ;
759764#endif
760765}
761766
You can’t perform that action at this time.
0 commit comments