diff --git a/README.md b/README.md index 28712e528..88555d857 100644 --- a/README.md +++ b/README.md @@ -185,8 +185,10 @@ Repeater navíc: * `simple_sensor`: telemetrie z externí stanice po UART (`BudkaLinkSensorManager`, jeden LPP kanál na veličinu), `sensor read`. * Senzory, které jinak měří nepřetržitě (INA219, INA226, INA260, INA3221, - BMP280), mezi čteními telemetrie spí a měří jen na vyžádání (nápad a první - patch pro INA219: Alkel Brostl). Čipy INA se rozlišují podle ID, takže + BMP280), mezi čteními telemetrie spí a měří jen na vyžádání; SHTC3 spí už + od startu, ne až po prvním čtení. Na lavici bez PR stál INA226 0,34 mA + a BMP280 0,42 mA navíc (nápad a první patch pro INA219: Alkel Brostl; + upstream PR meshcore-dev/MeshCore#4017). Čipy INA se rozlišují podle ID, takže INA226 už se nedetekuje jako INA219. Odpor bočníku (INA219, INA226, INA3221; INA260 ho má uvnitř) se nastavuje za běhu a ukládá se: `sensor set ina.shunt `. * Companion: `gps duty` přežije reboot, kopie data sestavení má hlídanou @@ -525,8 +527,10 @@ The repeater also has: * `simple_sensor`: telemetry from an external station over UART (`BudkaLinkSensorManager`, one LPP channel per meter), `sensor read`. * Sensors that would otherwise convert continuously (INA219, INA226, INA260, - INA3221, BMP280) sleep between telemetry reads and measure on demand (idea - and first INA219 patch: Alkel Brostl). INA chips are told apart by their ID, + INA3221, BMP280) sleep between telemetry reads and measure on demand; the + SHTC3 sleeps from init, not only after its first read. On the bench the + INA226 cost 0.34 mA and the BMP280 0.42 mA without this (idea and first + INA219 patch: Alkel Brostl; upstream PR meshcore-dev/MeshCore#4017). INA chips are told apart by their ID, so an INA226 is no longer taken for an INA219. The shunt (INA219, INA226, INA3221; the INA260 has it inside) is set at runtime and saved: `sensor set ina.shunt `. diff --git a/src/helpers/sensors/EnvironmentSensorManager.cpp b/src/helpers/sensors/EnvironmentSensorManager.cpp index 950328e6f..b2d1e9be0 100644 --- a/src/helpers/sensors/EnvironmentSensorManager.cpp +++ b/src/helpers/sensors/EnvironmentSensorManager.cpp @@ -225,7 +225,8 @@ static void scanI2CBus(TwoWire* wire, bool found[128]) { // forced) conversion per query; power-down keeps the configuration. On a 0.5 W // solar node in December a single INA219 was 15-20 % of the budget. The ones // not touched already sleep on their own (BME280 forced, BME680 performReading, -// SHTC3, SHT4x, AHTX0, LPS22HB one-shot, BMP085). Idea and first patch (INA219): +// SHT4x, AHTX0, LPS22HB one-shot, BMP085; SHTC3 only after its first read, so +// it is sent to sleep right after init). Idea and first patch (INA219): // Alkel Brostl. #if ENV_INCLUDE_AHTX0 @@ -303,7 +304,11 @@ static void query_bmp280(uint8_t ch, uint8_t, CayenneLPP& lpp) { #if ENV_INCLUDE_SHTC3 static uint8_t init_shtc3(TwoWire* wire, uint8_t) { // Adafruit_SHTC3::begin() does not accept an address (fixed at 0x70). - return SHTC3.begin(wire) ? 1 : 0; + if (!SHTC3.begin(wire)) return 0; + // CUSTOM (TeTeHacko): begin() wakes it and leaves it idle (~45 uA) until the + // first read, after which getEvent() puts it back to sleep (~0.3 uA) on its own. + SHTC3.sleep(true); + return 1; } static void query_shtc3(uint8_t ch, uint8_t, CayenneLPP& lpp) { sensors_event_t humidity, temp;