Fix for PageWindRose and calibration for einternal voltage sensor
This commit is contained in:
parent
4de0606521
commit
e0505997c7
|
@ -248,6 +248,9 @@ void sensorTask(void *param){
|
|||
}
|
||||
|
||||
int rotoffset = api->getConfig()->getConfigItem(api->getConfig()->rotOffset,true)->asInt();
|
||||
double voffset = (api->getConfig()->getConfigItem(api->getConfig()->vOffset,true)->asString()).toFloat();
|
||||
double vslope = (api->getConfig()->getConfigItem(api->getConfig()->vSlope,true)->asString()).toFloat();
|
||||
|
||||
long starttime0 = millis(); // GPS update all 1s
|
||||
long starttime5 = millis(); // Voltage update all 1s
|
||||
long starttime6 = millis(); // Environment sensor update all 1s
|
||||
|
@ -283,6 +286,7 @@ void sensorTask(void *param){
|
|||
if(millis() > starttime5 + 1000 && String(powsensor1) == "off"){
|
||||
starttime5 = millis();
|
||||
sensors.batteryVoltage = (float(analogRead(OBP_ANALOG0)) * 3.3 / 4096 + 0.17) * 20; // Vin = 1/20
|
||||
sensors.batteryVoltage = sensors.batteryVoltage * vslope + voffset; // Calibration
|
||||
// Save new data in average array
|
||||
batV.reading(int(sensors.batteryVoltage * 100));
|
||||
// Calculate the average values for different time lines from integer values
|
||||
|
|
|
@ -128,29 +128,20 @@ public:
|
|||
|
||||
// Show values AWA
|
||||
display.setTextColor(textcolor);
|
||||
display.setFont(&DSEG7Classic_BoldItalic20pt7b);
|
||||
display.setCursor(10, 65);
|
||||
display.print(svalue1); // Value
|
||||
display.setFont(&Ubuntu_Bold12pt7b);
|
||||
display.setCursor(10, 95);
|
||||
display.print(name1); // Name
|
||||
display.setFont(&Ubuntu_Bold8pt7b);
|
||||
display.setCursor(10, 115);
|
||||
display.print(" ");
|
||||
if(holdvalues == false){
|
||||
display.setFont(&DSEG7Classic_BoldItalic20pt7b);
|
||||
display.setCursor(10, 65);
|
||||
display.print(svalue1); // Value
|
||||
display.setFont(&Ubuntu_Bold12pt7b);
|
||||
display.setCursor(10, 95);
|
||||
display.print(name1); // Name
|
||||
display.setFont(&Ubuntu_Bold8pt7b);
|
||||
display.setCursor(10, 115);
|
||||
display.print(" ");
|
||||
display.print(unit1); // Unit
|
||||
display.print(unit1); // Unit
|
||||
}
|
||||
else{
|
||||
display.setFont(&DSEG7Classic_BoldItalic20pt7b);
|
||||
display.setCursor(10, 65);
|
||||
display.print(svalue1old); // Value
|
||||
display.setFont(&Ubuntu_Bold12pt7b);
|
||||
display.setCursor(10, 95);
|
||||
display.print(name1); // Name
|
||||
display.setFont(&Ubuntu_Bold8pt7b);
|
||||
display.setCursor(10, 115);
|
||||
display.print(" ");
|
||||
display.print(unit1old); // Unit
|
||||
display.print(unit1old); // Unit
|
||||
}
|
||||
|
||||
// Horizintal separator left
|
||||
|
@ -158,56 +149,43 @@ public:
|
|||
|
||||
// Show values AWS
|
||||
display.setTextColor(textcolor);
|
||||
display.setFont(&DSEG7Classic_BoldItalic20pt7b);
|
||||
display.setCursor(10, 270);
|
||||
display.print(svalue2); // Value
|
||||
display.setFont(&Ubuntu_Bold12pt7b);
|
||||
display.setCursor(10, 220);
|
||||
display.print(name2); // Name
|
||||
display.setFont(&Ubuntu_Bold8pt7b);
|
||||
display.setCursor(10, 190);
|
||||
display.print(" ");
|
||||
if(holdvalues == false){
|
||||
display.setFont(&DSEG7Classic_BoldItalic20pt7b);
|
||||
display.setCursor(10, 270);
|
||||
display.print(svalue2); // Value
|
||||
display.setFont(&Ubuntu_Bold12pt7b);
|
||||
display.setCursor(10, 220);
|
||||
display.print(name2); // Name
|
||||
display.setFont(&Ubuntu_Bold8pt7b);
|
||||
display.setCursor(10, 190);
|
||||
display.print(" ");
|
||||
display.print(unit2); // Unit
|
||||
display.print(unit2); // Unit
|
||||
}
|
||||
else{
|
||||
display.setFont(&DSEG7Classic_BoldItalic20pt7b);
|
||||
display.setCursor(10, 270);
|
||||
display.print(svalue2old); // Value
|
||||
display.setFont(&Ubuntu_Bold12pt7b);
|
||||
display.setCursor(10, 220);
|
||||
display.print(name2); // Name
|
||||
display.setFont(&Ubuntu_Bold8pt7b);
|
||||
display.setCursor(10, 190);
|
||||
display.print(" ");
|
||||
display.print(unit2old); // Unit
|
||||
display.print(unit2old); // Unit
|
||||
}
|
||||
|
||||
// Show values TWD
|
||||
display.setTextColor(textcolor);
|
||||
if(holdvalues == false){
|
||||
display.setFont(&DSEG7Classic_BoldItalic20pt7b);
|
||||
display.setCursor(295, 65);
|
||||
display.print(svalue3); // Value
|
||||
display.setFont(&Ubuntu_Bold12pt7b);
|
||||
display.setCursor(335, 95);
|
||||
display.print(name3); // Name
|
||||
display.setFont(&Ubuntu_Bold8pt7b);
|
||||
display.setCursor(335, 115);
|
||||
display.print(" ");
|
||||
display.print(unit3); // Unit
|
||||
display.setFont(&DSEG7Classic_BoldItalic20pt7b);
|
||||
display.setCursor(295, 65);
|
||||
if(valid3 == true){
|
||||
display.print(abs(value3 * 360 / PI), 0); // Value
|
||||
}
|
||||
else{
|
||||
display.setFont(&DSEG7Classic_BoldItalic20pt7b);
|
||||
display.setCursor(295, 65);
|
||||
display.print(svalue3old); // Value
|
||||
display.setFont(&Ubuntu_Bold12pt7b);
|
||||
display.setCursor(335, 95);
|
||||
display.print(name3); // Name
|
||||
display.setFont(&Ubuntu_Bold8pt7b);
|
||||
display.setCursor(335, 115);
|
||||
display.print(" ");
|
||||
display.print(unit3old); // Unit
|
||||
display.print("---"); // Value
|
||||
}
|
||||
display.setFont(&Ubuntu_Bold12pt7b);
|
||||
display.setCursor(335, 95);
|
||||
display.print(name3); // Name
|
||||
display.setFont(&Ubuntu_Bold8pt7b);
|
||||
display.setCursor(335, 115);
|
||||
display.print(" ");
|
||||
if(holdvalues == false){
|
||||
display.print(unit3); // Unit
|
||||
}
|
||||
else{
|
||||
display.print(unit3old); // Unit
|
||||
}
|
||||
|
||||
// Horizintal separator right
|
||||
|
@ -215,29 +193,20 @@ public:
|
|||
|
||||
// Show values TWS
|
||||
display.setTextColor(textcolor);
|
||||
display.setFont(&DSEG7Classic_BoldItalic20pt7b);
|
||||
display.setCursor(295, 270);
|
||||
display.print(svalue4); // Value
|
||||
display.setFont(&Ubuntu_Bold12pt7b);
|
||||
display.setCursor(335, 220);
|
||||
display.print(name4); // Name
|
||||
display.setFont(&Ubuntu_Bold8pt7b);
|
||||
display.setCursor(335, 190);
|
||||
display.print(" ");
|
||||
if(holdvalues == false){
|
||||
display.setFont(&DSEG7Classic_BoldItalic20pt7b);
|
||||
display.setCursor(295, 270);
|
||||
display.print(svalue4); // Value
|
||||
display.setFont(&Ubuntu_Bold12pt7b);
|
||||
display.setCursor(335, 220);
|
||||
display.print(name4); // Name
|
||||
display.setFont(&Ubuntu_Bold8pt7b);
|
||||
display.setCursor(335, 190);
|
||||
display.print(" ");
|
||||
display.print(unit4); // Unit
|
||||
display.print(unit4); // Unit
|
||||
}
|
||||
else{
|
||||
display.setFont(&DSEG7Classic_BoldItalic20pt7b);
|
||||
display.setCursor(295, 270);
|
||||
display.print(svalue4old); // Value
|
||||
display.setFont(&Ubuntu_Bold12pt7b);
|
||||
display.setCursor(335, 220);
|
||||
display.print(name4); // Name
|
||||
display.setFont(&Ubuntu_Bold8pt7b);
|
||||
display.setCursor(335, 190);
|
||||
display.print(" ");
|
||||
display.print(unit4old); // Unit
|
||||
else{
|
||||
display.print(unit4old); // Unit
|
||||
}
|
||||
|
||||
//*******************************************************************************************
|
||||
|
|
|
@ -20,8 +20,8 @@
|
|||
"default": "0.00",
|
||||
"check": "checkMinMax",
|
||||
"min": 0.00,
|
||||
"max": 10.00,
|
||||
"description": "The draft of the boat [0...10m]",
|
||||
"max": 50.00,
|
||||
"description": "The draft of the boat [0...50m]",
|
||||
"category": "OBP60 Settings",
|
||||
"capabilities": {
|
||||
"obp60":"true"
|
||||
|
@ -274,7 +274,7 @@
|
|||
"label": "Env. Sensor",
|
||||
"type": "list",
|
||||
"default": "off",
|
||||
"description": "Use internal or external environment sensor via I2C bus[off|BME280|BMP280|SHT21]",
|
||||
"description": "Use internal or external environment sensor via I2C bus [off|BME280|BMP280|SHT21]",
|
||||
"list": [
|
||||
"off",
|
||||
"BME280",
|
||||
|
@ -382,7 +382,7 @@
|
|||
"label": "Gen. Shunt",
|
||||
"type": "list",
|
||||
"default": "10",
|
||||
"description": "Shunt current value [10A|50A|100A|200A|300A|400A|500A]",
|
||||
"description": "Shunt current value [10A|50A|100A|200A|300A|400A|500A] @ 75mV",
|
||||
"list": [
|
||||
"10",
|
||||
"50",
|
||||
|
@ -524,7 +524,7 @@
|
|||
"name": "underVoltage",
|
||||
"label": "Undervoltage",
|
||||
"type": "boolean",
|
||||
"default": "true",
|
||||
"default": "false",
|
||||
"description": "Switch off device if voltage drops below 9V [on|off]",
|
||||
"category": "OBP60 Hardware",
|
||||
"capabilities": {
|
||||
|
@ -542,6 +542,28 @@
|
|||
"obp60":"true"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "vOffset",
|
||||
"label": "VSensor Offset",
|
||||
"type": "number",
|
||||
"default": "0.00",
|
||||
"description": "Offset for internal voltage sensor (ESP32)",
|
||||
"category": "OBP60 Calibrations",
|
||||
"capabilities": {
|
||||
"obp60":"true"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "vSlope",
|
||||
"label": "VSensor Slope",
|
||||
"type": "number",
|
||||
"default": "1.00",
|
||||
"description": "Slope for internal voltage sensor (ESP32)",
|
||||
"category": "OBP60 Calibrations",
|
||||
"capabilities": {
|
||||
"obp60":"true"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "display",
|
||||
"label": "Display Mode",
|
||||
|
|
Loading…
Reference in New Issue