diff --git a/RELEASENOTES.md b/RELEASENOTES.md index a96235e31..0335fc6e6 100644 --- a/RELEASENOTES.md +++ b/RELEASENOTES.md @@ -70,3 +70,4 @@ The following binary downloads have been compiled with ESP8266/Arduino library c - Add support for ``AdcParam`` parameters to control ADC0 Current Transformer Apparent Power formula by Jodi Dillon (#7100) - Add optional support for Prometheus using file xsns_91_prometheus.ino (#7216) - Add experimental support for NRF24L01 as BLE-bridge for Mijia Bluetooth sensors by Christian Baars (#7394) +- Add support to BMP driver to enter reset state (sleep enable) when deep sleep is used in Tasmota diff --git a/tasmota/CHANGELOG.md b/tasmota/CHANGELOG.md index fff26d0c8..b1687e5e3 100644 --- a/tasmota/CHANGELOG.md +++ b/tasmota/CHANGELOG.md @@ -6,6 +6,7 @@ - Add optional support for Prometheus using file xsns_91_prometheus.ino (#7216) - Add command ``ShutterButton `` to control shutter(s) by to-scho (#7403) - Add experimental support for NRF24L01 as BLE-bridge for Mijia Bluetooth sensors by Christian Baars (#7394) +- Add support to BMP driver to enter reset state (sleep enable) when deep sleep is used in Tasmota - Fix LCD line and column positioning (#7387) - Fix Display handling of hexadecimal escape characters (#7387) - Fix Improved fade linearity with gamma correction diff --git a/tasmota/xsns_09_bmp.ino b/tasmota/xsns_09_bmp.ino index 8f49e1bea..057dac9df 100644 --- a/tasmota/xsns_09_bmp.ino +++ b/tasmota/xsns_09_bmp.ino @@ -40,6 +40,10 @@ #define BMP_REGISTER_CHIPID 0xD0 +#define BMP_REGISTER_RESET 0xE0 // Register to reset to power on defaults (used for sleep) + +#define BMP_CMND_RESET 0xB6 // I2C Parameter for RESET to put BMP into reset state + #define BMP_MAX_SENSORS 2 const char kBmpTypes[] PROGMEM = "BMP180|BMP280|BME280|BME680"; @@ -601,6 +605,25 @@ void BmpShow(bool json) } } +#ifdef USE_DEEPSLEEP + +void BMP_EnterSleep(void) +{ + for (uint32_t bmp_idx = 0; bmp_idx < bmp_count; bmp_idx++) { + switch (bmp_sensors[bmp_idx].bmp_type) { + case BMP180_CHIPID: + case BMP280_CHIPID: + case BME280_CHIPID: + I2cWrite8(bmp_sensors[bmp_idx].bmp_address, BMP_REGISTER_RESET, BMP_CMND_RESET); + break; + default: + break; + } + } +} + +#endif // USE_DEEPSLEEP + /*********************************************************************************************\ * Interface \*********************************************************************************************/ @@ -627,6 +650,11 @@ bool Xsns09(uint8_t function) BmpShow(0); break; #endif // USE_WEBSERVER +#ifdef USE_DEEPSLEEP + case FUNC_SAVE_BEFORE_RESTART: + BMP_EnterSleep(); + break; +#endif // USE_DEEPSLEEP } } return result;