Merge pull request #7416 from andrethomas/bmp

BMPxxx - Add support for deep sleep
This commit is contained in:
Theo Arends 2020-01-03 16:31:49 +01:00 committed by GitHub
commit d473d8068a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 30 additions and 0 deletions

View File

@ -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

View File

@ -6,6 +6,7 @@
- Add optional support for Prometheus using file xsns_91_prometheus.ino (#7216)
- Add command ``ShutterButton <parameters>`` 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

View File

@ -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;