mirror of
https://github.com/esphome/esphome.git
synced 2025-10-05 19:33:47 +01:00
ble pool
This commit is contained in:
@@ -388,17 +388,10 @@ void load_ble_event(BLEEvent *event, esp_gatts_cb_event_t e, esp_gatt_if_t i, es
|
|||||||
}
|
}
|
||||||
|
|
||||||
template<typename... Args> void enqueue_ble_event(Args... args) {
|
template<typename... Args> void enqueue_ble_event(Args... args) {
|
||||||
// Check if queue is full before allocating
|
|
||||||
if (global_ble->ble_events_.full()) {
|
|
||||||
// Queue is full, drop the event
|
|
||||||
global_ble->ble_events_.increment_dropped_count();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Allocate an event from the pool
|
// Allocate an event from the pool
|
||||||
BLEEvent *event = global_ble->ble_event_pool_.allocate();
|
BLEEvent *event = global_ble->ble_event_pool_.allocate();
|
||||||
if (event == nullptr) {
|
if (event == nullptr) {
|
||||||
// Pool is full, drop the event
|
// No events available - queue is full or we're out of memory
|
||||||
global_ble->ble_events_.increment_dropped_count();
|
global_ble->ble_events_.increment_dropped_count();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user