mirror of
				https://github.com/esphome/esphome.git
				synced 2025-10-31 15:12:06 +00:00 
			
		
		
		
	[esp32_ble_tracker] Optimize member variable ordering to reduce memory padding (#10113)
This commit is contained in:
		| @@ -333,33 +333,37 @@ class ESP32BLETracker : public Component, | |||||||
|     return counts; |     return counts; | ||||||
|   } |   } | ||||||
|  |  | ||||||
|   uint8_t app_id_{0}; |   // Group 1: Large objects (12+ bytes) - vectors and callback manager | ||||||
|  |   std::vector<ESPBTDeviceListener *> listeners_; | ||||||
|  |   std::vector<ESPBTClient *> clients_; | ||||||
|  |   CallbackManager<void(ScannerState)> scanner_state_callbacks_; | ||||||
| #ifdef USE_ESP32_BLE_DEVICE | #ifdef USE_ESP32_BLE_DEVICE | ||||||
|   /// Vector of addresses that have already been printed in print_bt_device_info |   /// Vector of addresses that have already been printed in print_bt_device_info | ||||||
|   std::vector<uint64_t> already_discovered_; |   std::vector<uint64_t> already_discovered_; | ||||||
| #endif | #endif | ||||||
|   std::vector<ESPBTDeviceListener *> listeners_; |  | ||||||
|   /// Client parameters. |   // Group 2: Structs (aligned to 4 bytes) | ||||||
|   std::vector<ESPBTClient *> clients_; |  | ||||||
|   /// A structure holding the ESP BLE scan parameters. |   /// A structure holding the ESP BLE scan parameters. | ||||||
|   esp_ble_scan_params_t scan_params_; |   esp_ble_scan_params_t scan_params_; | ||||||
|  |   ClientStateCounts client_state_counts_; | ||||||
|  |  | ||||||
|  |   // Group 3: 4-byte types | ||||||
|   /// The interval in seconds to perform scans. |   /// The interval in seconds to perform scans. | ||||||
|   uint32_t scan_duration_; |   uint32_t scan_duration_; | ||||||
|   uint32_t scan_interval_; |   uint32_t scan_interval_; | ||||||
|   uint32_t scan_window_; |   uint32_t scan_window_; | ||||||
|  |   esp_bt_status_t scan_start_failed_{ESP_BT_STATUS_SUCCESS}; | ||||||
|  |   esp_bt_status_t scan_set_param_failed_{ESP_BT_STATUS_SUCCESS}; | ||||||
|  |  | ||||||
|  |   // Group 4: 1-byte types (enums, uint8_t, bool) | ||||||
|  |   uint8_t app_id_{0}; | ||||||
|   uint8_t scan_start_fail_count_{0}; |   uint8_t scan_start_fail_count_{0}; | ||||||
|  |   ScannerState scanner_state_{ScannerState::IDLE}; | ||||||
|   bool scan_continuous_; |   bool scan_continuous_; | ||||||
|   bool scan_active_; |   bool scan_active_; | ||||||
|   ScannerState scanner_state_{ScannerState::IDLE}; |  | ||||||
|   CallbackManager<void(ScannerState)> scanner_state_callbacks_; |  | ||||||
|   bool ble_was_disabled_{true}; |   bool ble_was_disabled_{true}; | ||||||
|   bool raw_advertisements_{false}; |   bool raw_advertisements_{false}; | ||||||
|   bool parse_advertisements_{false}; |   bool parse_advertisements_{false}; | ||||||
|  |  | ||||||
|   esp_bt_status_t scan_start_failed_{ESP_BT_STATUS_SUCCESS}; |  | ||||||
|   esp_bt_status_t scan_set_param_failed_{ESP_BT_STATUS_SUCCESS}; |  | ||||||
|   ClientStateCounts client_state_counts_; |  | ||||||
| #ifdef USE_ESP32_BLE_SOFTWARE_COEXISTENCE | #ifdef USE_ESP32_BLE_SOFTWARE_COEXISTENCE | ||||||
|   bool coex_prefer_ble_{false}; |   bool coex_prefer_ble_{false}; | ||||||
| #endif | #endif | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user