1
0
mirror of https://github.com/esphome/esphome.git synced 2025-09-20 04:02:21 +01:00

Optimize bluetooth_proxy memory usage on ESP32 (#9114)

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This commit is contained in:
J. Nick Koston
2025-06-19 03:11:13 +02:00
committed by GitHub
parent eeb0710ad4
commit 2e11e66db4
4 changed files with 49 additions and 19 deletions

View File

@@ -26,10 +26,17 @@ class BluetoothConnection : public esp32_ble_client::BLEClientBase {
protected:
friend class BluetoothProxy;
bool seen_mtu_or_services_{false};
int16_t send_service_{-2};
// Memory optimized layout for 32-bit systems
// Group 1: Pointers (4 bytes each, naturally aligned)
BluetoothProxy *proxy_;
// Group 2: 2-byte types
int16_t send_service_{-2}; // Needs to handle negative values and service count
// Group 3: 1-byte types
bool seen_mtu_or_services_{false};
// 1 byte used, 1 byte padding
};
} // namespace bluetooth_proxy