BME readings 1 each min now
This commit is contained in:
parent
a18f5759fd
commit
42307293f6
|
|
@ -34,7 +34,7 @@ BluetoothSerial SerialBT;
|
|||
OneButton userButton = OneButton(BUTTON_PIN, true, true);
|
||||
#endif
|
||||
|
||||
String versionDate = "2024.01.09";
|
||||
String versionDate = "2024.01.18";
|
||||
|
||||
int myBeaconsIndex = 0;
|
||||
int myBeaconsSize = Config.beacons.size();
|
||||
|
|
@ -79,6 +79,8 @@ double previousHeading = 0;
|
|||
uint32_t menuTime = millis();
|
||||
bool symbolAvailable = true;
|
||||
|
||||
uint32_t bmeLastReading = -60000;
|
||||
|
||||
int screenBrightness = 1;
|
||||
bool keyboardConnected = false;
|
||||
bool keyDetected = false;
|
||||
|
|
|
|||
|
|
@ -10,7 +10,9 @@
|
|||
|
||||
extern Configuration Config;
|
||||
extern logging::Logger logger;
|
||||
extern uint32_t bmeLastReading;
|
||||
|
||||
float newHum, newTemp, newPress, newGas;
|
||||
|
||||
namespace BME_Utils {
|
||||
|
||||
|
|
@ -175,20 +177,23 @@ namespace BME_Utils {
|
|||
|
||||
String readDataSensor(String type) {
|
||||
String wx, tempStr, humStr, presStr;
|
||||
float newHum;
|
||||
|
||||
float newTemp = bme.readTemperature();
|
||||
#if defined(BME280Sensor) || defined(BME680Sensor)
|
||||
newHum = bme.readHumidity();
|
||||
#endif
|
||||
#ifdef BMP280Sensor
|
||||
newHum = 0;
|
||||
#endif
|
||||
float newPress = (bme.readPressure() / 100.0F);
|
||||
|
||||
#ifdef BME680Sensor
|
||||
float newGas = bme.gas_resistance / 1000.0; // in Kilo ohms
|
||||
#endif
|
||||
uint32_t lastReading = millis() - bmeLastReading;
|
||||
if (lastReading > 60*1000) {
|
||||
newTemp = bme.readTemperature();
|
||||
newPress = (bme.readPressure() / 100.0F);
|
||||
#if defined(BME280Sensor) || defined(BME680Sensor)
|
||||
newHum = bme.readHumidity();
|
||||
#endif
|
||||
#ifdef BMP280Sensor
|
||||
newHum = 0;
|
||||
#endif
|
||||
|
||||
#ifdef BME680Sensor
|
||||
newGas = bme.gas_resistance / 1000.0; // in Kilo ohms
|
||||
#endif
|
||||
bmeLastReading = millis();
|
||||
}
|
||||
|
||||
if (isnan(newTemp) || isnan(newHum) || isnan(newPress)) {
|
||||
Serial.println("BME/BMP Module data failed");
|
||||
|
|
|
|||
Loading…
Reference in New Issue