1
0
mirror of https://github.com/esphome/esphome.git synced 2025-09-18 03:02:20 +01:00
This commit is contained in:
J. Nick Koston
2025-06-16 15:23:04 +02:00
parent 7aa2fd9f0e
commit 6e739ac453
2 changed files with 5 additions and 2 deletions

View File

@@ -219,7 +219,7 @@ class BLEEvent {
return; // Invalid event, but we can't log in header file
}
// Heap-allocate param
// Heap-allocate param and data
// Heap allocation is used because GATTC/GATTS events are rare (<1% of events)
// while GAP events (99%) are stored inline to minimize memory usage
this->event_.gattc.gattc_param = new esp_ble_gattc_cb_param_t(*p);
@@ -252,7 +252,7 @@ class BLEEvent {
return; // Invalid event, but we can't log in header file
}
// Heap-allocate param
// Heap-allocate param and data
// Heap allocation is used because GATTC/GATTS events are rare (<1% of events)
// while GAP events (99%) are stored inline to minimize memory usage
this->event_.gatts.gatts_param = new esp_ble_gatts_cb_param_t(*p);

View File

@@ -71,8 +71,11 @@ template<class T, uint8_t SIZE> class LockFreeQueue {
protected:
T *buffer_[SIZE];
// Atomic: written by consumer (pop), read by producer (push) to check if full
std::atomic<uint8_t> head_;
// Atomic: written by producer (push), read by consumer (pop) to check if empty
std::atomic<uint8_t> tail_;
// Atomic: written by producer (push/increment), read+reset by consumer (get_and_reset)
std::atomic<uint32_t> dropped_count_; // Keep this larger for accumulated counts
};