|
@ -119,7 +119,26 @@ time_t getTimestamp() { |
|
|
void poweroffDevices() { |
|
|
void poweroffDevices() { |
|
|
display.powerOff(); |
|
|
display.powerOff(); |
|
|
|
|
|
|
|
|
// ToDo: Sensors
|
|
|
if (sensors_active.bme680) { |
|
|
|
|
|
bme680.setGasHeater(0, 0); |
|
|
|
|
|
} |
|
|
|
|
|
if (sensors_active.bme280) { |
|
|
|
|
|
bme280.setSampling(Adafruit_BME280::MODE_SLEEP, |
|
|
|
|
|
Adafruit_BME280::SAMPLING_X1, // temperature
|
|
|
|
|
|
Adafruit_BME280::SAMPLING_X1, // pressure
|
|
|
|
|
|
Adafruit_BME280::SAMPLING_X1, // humidity
|
|
|
|
|
|
Adafruit_BME280::FILTER_OFF ); |
|
|
|
|
|
} |
|
|
|
|
|
if (sensors_active.light) { |
|
|
|
|
|
static constexpr byte BH1750_I2CADDR = 0x23; |
|
|
|
|
|
Wire.beginTransmission(BH1750_I2CADDR); |
|
|
|
|
|
Wire.write(BH1750_POWER_DOWN); |
|
|
|
|
|
byte ack = Wire.endTransmission(); |
|
|
|
|
|
} |
|
|
|
|
|
if (sensors_active.uv) { |
|
|
|
|
|
uv.shutdown(true); |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -718,6 +737,7 @@ void setup() |
|
|
|
|
|
|
|
|
if (lightMeter.begin()) { |
|
|
if (lightMeter.begin()) { |
|
|
sensors_active.light = true; |
|
|
sensors_active.light = true; |
|
|
|
|
|
lightMeter.setMTreg((byte) BH1750_DEFAULT_MTREG); |
|
|
} else { |
|
|
} else { |
|
|
ESP_LOGW(TAG, "Failed to communicate with BH1750 sensor, check wiring?"); |
|
|
ESP_LOGW(TAG, "Failed to communicate with BH1750 sensor, check wiring?"); |
|
|
} |
|
|
} |
|
|