Fixing problem PageBME280 when sensor disabled
This commit is contained in:
parent
4a0e83f2e3
commit
154fc108a0
|
@ -25,6 +25,9 @@ class PageBME280 : public Page
|
||||||
double value1 = 0;
|
double value1 = 0;
|
||||||
double value2 = 0;
|
double value2 = 0;
|
||||||
double value3 = 0;
|
double value3 = 0;
|
||||||
|
String svalue1 = "";
|
||||||
|
String svalue2 = "";
|
||||||
|
String svalue3 = "";
|
||||||
|
|
||||||
// Get config data
|
// Get config data
|
||||||
String tempformat = config->getString(config->tempFormat);
|
String tempformat = config->getString(config->tempFormat);
|
||||||
|
@ -32,6 +35,7 @@ class PageBME280 : public Page
|
||||||
String displaycolor = config->getString(config->displaycolor);
|
String displaycolor = config->getString(config->displaycolor);
|
||||||
String flashLED = config->getString(config->flashLED);
|
String flashLED = config->getString(config->flashLED);
|
||||||
String backlightMode = config->getString(config->backlight);
|
String backlightMode = config->getString(config->backlight);
|
||||||
|
String useenvsensor = config->getString(config->useEnvSensor);
|
||||||
|
|
||||||
// Get sensor values #1
|
// Get sensor values #1
|
||||||
String name1 = "Temp"; // Value name
|
String name1 = "Temp"; // Value name
|
||||||
|
@ -42,7 +46,13 @@ class PageBME280 : public Page
|
||||||
else{
|
else{
|
||||||
value1 = 23.0 + float(random(0, 10)) / 10.0;
|
value1 = 23.0 + float(random(0, 10)) / 10.0;
|
||||||
}
|
}
|
||||||
String svalue1 = String(value1, 1); // Formatted value as string including unit conversion and switching decimal places
|
// Display data when sensor activated
|
||||||
|
if(String(useenvsensor) == "BME280"){
|
||||||
|
svalue1 = String(value1, 1); // Formatted value as string including unit conversion and switching decimal places
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
svalue1 = "---";
|
||||||
|
}
|
||||||
String unit1 = "Deg C"; // Unit of value
|
String unit1 = "Deg C"; // Unit of value
|
||||||
|
|
||||||
// Get sensor values #2
|
// Get sensor values #2
|
||||||
|
@ -54,7 +64,13 @@ class PageBME280 : public Page
|
||||||
else{
|
else{
|
||||||
value2 = 43 + float(random(0, 4));
|
value2 = 43 + float(random(0, 4));
|
||||||
}
|
}
|
||||||
String svalue2 = String(value2, 0); // Formatted value as string including unit conversion and switching decimal places
|
// Display data when sensor activated
|
||||||
|
if(String(useenvsensor) == "BME280"){
|
||||||
|
svalue2 = String(value2, 0); // Formatted value as string including unit conversion and switching decimal places
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
svalue2 = "---";
|
||||||
|
}
|
||||||
String unit2 = "%"; // Unit of value
|
String unit2 = "%"; // Unit of value
|
||||||
|
|
||||||
// Get sensor values #3
|
// Get sensor values #3
|
||||||
|
@ -66,7 +82,13 @@ class PageBME280 : public Page
|
||||||
else{
|
else{
|
||||||
value3 = 1006 + float(random(0, 5));
|
value3 = 1006 + float(random(0, 5));
|
||||||
}
|
}
|
||||||
String svalue3 = String(value3, 0); // Formatted value as string including unit conversion and switching decimal places
|
// Display data when sensor activated
|
||||||
|
if(String(useenvsensor) == "BME280"){
|
||||||
|
svalue3 = String(value3, 0); // Formatted value as string including unit conversion and switching decimal places
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
svalue3 = "---";
|
||||||
|
}
|
||||||
String unit3 = "mBar"; // Unit of value
|
String unit3 = "mBar"; // Unit of value
|
||||||
|
|
||||||
// Optical warning by limit violation (unused)
|
// Optical warning by limit violation (unused)
|
||||||
|
|
|
@ -22,9 +22,9 @@ typedef struct{
|
||||||
double generatorVoltage = 0;
|
double generatorVoltage = 0;
|
||||||
double generatorCurrent = 0;
|
double generatorCurrent = 0;
|
||||||
double generatorPower = 0;
|
double generatorPower = 0;
|
||||||
double airTemperature = 21.3;
|
double airTemperature = 0;
|
||||||
double airHumidity = 43.2;
|
double airHumidity = 0;
|
||||||
double airPressure = 1018.8;
|
double airPressure = 0;
|
||||||
double onewireTemp1 = 0;
|
double onewireTemp1 = 0;
|
||||||
double onewireTemp2 = 0;
|
double onewireTemp2 = 0;
|
||||||
double onewireTemp3 = 0;
|
double onewireTemp3 = 0;
|
||||||
|
|
|
@ -11,6 +11,8 @@
|
||||||
#define GWSERIAL_TX 26
|
#define GWSERIAL_TX 26
|
||||||
#define GWSERIAL_RX 14
|
#define GWSERIAL_RX 14
|
||||||
#define GWSERIAL_MODE "UNI"
|
#define GWSERIAL_MODE "UNI"
|
||||||
|
// Allowed to set a new password for access point
|
||||||
|
#define FORCE_AP_PWCHANGE
|
||||||
|
|
||||||
// Init OBP60 Task
|
// Init OBP60 Task
|
||||||
void OBP60Init(GwApi *param);
|
void OBP60Init(GwApi *param);
|
||||||
|
|
Loading…
Reference in New Issue