esphome/esphome
bisbastuner 356efdb92c
Add support for multiple devices in bme680_bsec (#3550)
* Add initial support for multiple devices

Re-introduce support for multiple I2C devices (it was suppressed in df37a7635f). Devices are identified by their I2C address, and the BME680 can only have the 0x76 or 0x77 address, so this adds support for a maximum of two devices.

* Reintegrate commit ebf13a0b

Reintegrate commit ebf13a0ba0 which was lost in my changes (I were working on old files)

* wrong commit

* wrong commit

* Reintegrate commit ebf13a0b

Reintegrate commit ebf13a0ba0 which was lost due to me working on old files

* Reintroduce newlines at end of files

* Reintroduce newlines at end of files

* Adhere to codebase standards

Obey the "All uses of class members and member functions should be prefixed with this-> to distinguish them from global functions in code review" rule of the Codebase Standards

* Fix formatting according to clang-format

* Perform the BSEC library reinitialization+snapshot only when more than one device is present

* Fix formatting according to clang-format

* Degrade abort message in restore_state_() from warning to verbose

This always happen at initial setup, so it's not a really useful message; when some real problems arise, we'll have a more useful warning from snapshot_state_()

Co-authored-by: Trevor North <trevor@freedisc.co.uk>

* Reduce peak stack usage to avoid bootloops on ESP8266

Achieved mainly by moving the work_buffer needed by the BSEC library to the heap, as a single global work buffer shared by all instances.
::set_config_ has been reverted to a code path similar to the original, as that reduces peak stack usage enough to be OK on ESP8266 even without moving the work_buffer to the heap.

* Fix formatting according to clang-format

* Add support for devices with the same i2c address

Devices are now identified using their index in the BME680BSECComponent::instances member, which became a vector. This allows adding two devices with the same i2c address (which should be placed on different i2c buses). Since a BME680 can only have an address of 0x76 or 0x77, a maximum of 2 devices could be added before this commit. Now there is no theoretical limit on the number of devices which could be added.

* Fix formatting according to clang-format

* Fix formatting according to clang-format

---------

Co-authored-by: Trevor North <trevor@freedisc.co.uk>
Co-authored-by: Jesse Hills <3060199+jesserockz@users.noreply.github.com>
2023-03-07 07:15:40 +00:00
..
components Add support for multiple devices in bme680_bsec (#3550) 2023-03-07 07:15:40 +00:00
core Ensure component is ready before update. (#4523) 2023-03-07 04:16:42 +00:00
dashboard Bump pylint from 2.15.10 to 2.16.2 (#4426) 2023-02-13 22:55:36 +00:00
__init__.py
__main__.py Dump full parsed config to json-config api call (#4373) 2023-02-01 16:59:51 +13:00
automation.py Fix parallel invocations of repeat action (#4480) 2023-02-26 22:23:04 +00:00
codegen.py Add int16 to codegen (#4507) 2023-03-04 07:19:51 +00:00
config_helpers.py Merge components in packages (#3555) 2023-02-07 14:08:40 +13:00
config_validation.py Initial stab at importing idf components (#4000) 2023-02-23 01:22:39 +00:00
config.py Merge components in packages (#3555) 2023-02-07 14:08:40 +13:00
const.py climate: add on_control callbacks (#4511) 2023-03-07 04:19:49 +00:00
coroutine.py
cpp_generator.py Bump pylint from 2.15.10 to 2.16.2 (#4426) 2023-02-13 22:55:36 +00:00
cpp_helpers.py
cpp_types.py Add int16 to codegen (#4507) 2023-03-04 07:19:51 +00:00
espota2.py Improve OTA error messages adding return codes (#3698) 2022-08-16 21:51:05 +12:00
final_validate.py
git.py Remove idf components before checking if any in config (#4506) 2023-03-05 20:17:32 +00:00
helpers.py
loader.py Bump pylint from 2.15.10 to 2.16.2 (#4426) 2023-02-13 22:55:36 +00:00
log.py
mqtt.py
pins.py adds gpio INPUT_OUTPUT_OPEN_DRAIN (#4360) 2023-02-07 12:55:35 +13:00
platformio_api.py
schema_extractors.py
storage_json.py Add friendly_name to device (#4296) 2023-01-17 10:28:09 +13:00
types.py
util.py
voluptuous_schema.py
vscode.py
wizard.py Add friendly_name to device (#4296) 2023-01-17 10:28:09 +13:00
writer.py Add ESPHome version to generated platformio.ini (#4443) 2023-02-16 00:27:32 +00:00
yaml_util.py Merge components in packages (#3555) 2023-02-07 14:08:40 +13:00
zeroconf.py mDNS updates (#4399) 2023-02-09 10:25:44 +13:00