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 Bump python min to 3.9 (#3871) 2022-10-05 20:09:27 +13:00
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 Remove a bunch of unnecessary pylint disabling (#4079) 2022-11-24 11:09:19 +13:00
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 Bump python min to 3.9 (#3871) 2022-10-05 20:09:27 +13:00
git.py Remove idf components before checking if any in config (#4506) 2023-03-05 20:17:32 +00:00
helpers.py Proxy friendly host url resolution for use_address with path. (#3653) 2022-10-11 12:01:31 +13:00
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 Bump black from 21.12b0 to 22.1.0 (#3147) 2022-02-01 10:26:37 +01:00
pins.py adds gpio INPUT_OUTPUT_OPEN_DRAIN (#4360) 2023-02-07 12:55:35 +13:00
platformio_api.py Remove a bunch of unnecessary pylint disabling (#4079) 2022-11-24 11:09:19 +13:00
schema_extractors.py Language schema 202204 (#3492) 2022-06-17 13:46:20 +12:00
storage_json.py Add friendly_name to device (#4296) 2023-01-17 10:28:09 +13:00
types.py Bump python min to 3.9 (#3871) 2022-10-05 20:09:27 +13:00
util.py Fix type annotation on extract_registry_entry_config (#3623) 2022-10-12 15:15:03 +13:00
voluptuous_schema.py Remove a bunch of unnecessary pylint disabling (#4079) 2022-11-24 11:09:19 +13:00
vscode.py Remove a bunch of unnecessary pylint disabling (#4079) 2022-11-24 11:09:19 +13:00
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