From 356e0059090207416884bdade26c0c1a4a6772d4 Mon Sep 17 00:00:00 2001 From: Andre Thomas <470015+andrethomas@users.noreply.github.com> Date: Thu, 2 Jan 2020 22:38:18 +0200 Subject: [PATCH 1/4] BMPxxx - Enter power on state before deep sleep --- tasmota/xsns_09_bmp.ino | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/tasmota/xsns_09_bmp.ino b/tasmota/xsns_09_bmp.ino index 8f49e1bea..4190a675c 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; From 6a54eef50ab8c4fc4a287a1c036d13bd402ab262 Mon Sep 17 00:00:00 2001 From: Andre Thomas <470015+andrethomas@users.noreply.github.com> Date: Thu, 2 Jan 2020 22:40:14 +0200 Subject: [PATCH 2/4] - Add support to BMP driver to enter reset state (sleep enable) - Add support to BMP driver to enter reset state (sleep enable) when deep sleep is used in Tasmota --- tasmota/CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/tasmota/CHANGELOG.md b/tasmota/CHANGELOG.md index 676822799..36d7be89e 100644 --- a/tasmota/CHANGELOG.md +++ b/tasmota/CHANGELOG.md @@ -9,6 +9,7 @@ - Fix LCD line and column positioning (#7387) - Fix Display handling of hexadecimal escape characters (#7387) - Fix Improved fade linearity with gamma correction +- Add support to BMP driver to enter reset state (sleep enable) when deep sleep is used in Tasmota ### 8.1.0.1 20191225 From d3d60141397710798a4aeb73193f2a664d4fdf71 Mon Sep 17 00:00:00 2001 From: Andre Thomas <470015+andrethomas@users.noreply.github.com> Date: Thu, 2 Jan 2020 22:41:16 +0200 Subject: [PATCH 3/4] - Add support to BMP driver to enter reset state (sleep enable) - Add support to BMP driver to enter reset state (sleep enable) when deep sleep is used in Tasmota --- RELEASENOTES.md | 1 + 1 file changed, 1 insertion(+) 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 From 06f053c1723cd374d01f18ca7e2f547dba4c28f1 Mon Sep 17 00:00:00 2001 From: Andre Thomas <470015+andrethomas@users.noreply.github.com> Date: Thu, 2 Jan 2020 22:51:15 +0200 Subject: [PATCH 4/4] - Add support to BMP driver to enter reset state (sleep enable) --- tasmota/xsns_09_bmp.ino | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tasmota/xsns_09_bmp.ino b/tasmota/xsns_09_bmp.ino index 4190a675c..057dac9df 100644 --- a/tasmota/xsns_09_bmp.ino +++ b/tasmota/xsns_09_bmp.ino @@ -654,7 +654,7 @@ bool Xsns09(uint8_t function) case FUNC_SAVE_BEFORE_RESTART: BMP_EnterSleep(); break; -#endif USE_DEEPSLEEP +#endif // USE_DEEPSLEEP } } return result;