From 4a97768d0b5c5d621f7fe109513db04d59531d45 Mon Sep 17 00:00:00 2001 From: TobiasE-github Date: Sun, 17 Aug 2025 16:34:52 +0200 Subject: [PATCH 1/4] button in WindRoseFlex to switch true/apparent + 4 user-defined values --- lib/obp60task/PageWindRoseFlex.cpp | 159 ++++++++++++++++++++--------- lib/obp60task/config.json | 61 ----------- 2 files changed, 108 insertions(+), 112 deletions(-) diff --git a/lib/obp60task/PageWindRoseFlex.cpp b/lib/obp60task/PageWindRoseFlex.cpp index 35215c9..09e9791 100644 --- a/lib/obp60task/PageWindRoseFlex.cpp +++ b/lib/obp60task/PageWindRoseFlex.cpp @@ -7,15 +7,33 @@ class PageWindRoseFlex : public Page { int16_t lp = 80; // Pointer length +char source = 'A'; // data source (A)pparent | (T)rue +String ssource="App."; // String for Data Source public: PageWindRoseFlex(CommonData &common){ commonData = &common; common.logger->logDebug(GwLog::LOG,"Instantiate PageWindRoseFlex"); } + virtual void setupKeys(){ + Page::setupKeys(); + commonData->keydata[1].label = "SRC"; + } // Key functions virtual int handleKey(int key){ + if(key == 2){ + // Code for set source + if(source == 'A'){ + source = 'T'; + ssource = "True"; // String to display + } else { + source = 'A'; + ssource = "App."; // String to display + } + } + return key; // Commit the key + // Code for keylock if(key == 11){ commonData->keylock = !commonData->keylock; @@ -48,42 +66,57 @@ public: String flashLED = config->getString(config->flashLED); String backlightMode = config->getString(config->backlight); - // Get boat values #1 - GwApi::BoatValue *bvalue1 = pageData.values[0]; // First element in list (only one value by PageOneValue) - String name1 = xdrDelete(bvalue1->getName()); // Value name + GwApi::BoatValue *bvalue1; // Value 1 for angle + GwApi::BoatValue *bvalue2; // Value 2 for speed + + // Get boat value for wind angle (AWA/TWA), shown by pointer + if (source == 'A') { + bvalue1 = pageData.values[4]; + } else { + bvalue1 = pageData.values[6]; + } + String name1 = bvalue1->getName().c_str(); // Value name name1 = name1.substring(0, 6); // String length limit for value name calibrationData.calibrateInstance(bvalue1, logger); // Check if boat data value is to be calibrated double value1 = bvalue1->value; // Value as double in SI unit bool valid1 = bvalue1->valid; // Valid information - value1 = formatValue(bvalue1, *commonData).value;// Format only nesaccery for simulation data for pointer String svalue1 = formatValue(bvalue1, *commonData).svalue; // Formatted value as string including unit conversion and switching decimal places String unit1 = formatValue(bvalue1, *commonData).unit; // Unit of value - if(valid1 == true){ + if(valid1 == true){ svalue1old = svalue1; // Save old value unit1old = unit1; // Save old unit } - // Get boat values #2 - GwApi::BoatValue *bvalue2 = pageData.values[1]; // Second element in list - String name2 = xdrDelete(bvalue2->getName()); // Value name + // Get boat value for wind speed (AWS/TWS), shown in top left corner + if (source == 'A') { + bvalue2 =pageData.values[5]; + } else { + bvalue2 = pageData.values[7]; + } + String name2 = bvalue2->getName().c_str(); // Value name name2 = name2.substring(0, 6); // String length limit for value name calibrationData.calibrateInstance(bvalue2, logger); // Check if boat data value is to be calibrated double value2 = bvalue2->value; // Value as double in SI unit bool valid2 = bvalue2->valid; // Valid information + if (simulation) { + value2 = 0.62731; // some random value + } String svalue2 = formatValue(bvalue2, *commonData).svalue; // Formatted value as string including unit conversion and switching decimal places String unit2 = formatValue(bvalue2, *commonData).unit; // Unit of value - if(valid2 == true){ + if(valid2 == true){ svalue2old = svalue2; // Save old value unit2old = unit2; // Save old unit } - // Get boat values #3 - GwApi::BoatValue *bvalue3 = pageData.values[2]; // Third element in list + + + // Get boat value for bottom left corner + GwApi::BoatValue *bvalue3 = pageData.values[0]; String name3 = xdrDelete(bvalue3->getName()); // Value name name3 = name3.substring(0, 6); // String length limit for value name calibrationData.calibrateInstance(bvalue3, logger); // Check if boat data value is to be calibrated double value3 = bvalue3->value; // Value as double in SI unit - bool valid3 = bvalue3->valid; // Valid information + bool valid3 = bvalue3->valid; // Valid information String svalue3 = formatValue(bvalue3, *commonData).svalue; // Formatted value as string including unit conversion and switching decimal places String unit3 = formatValue(bvalue3, *commonData).unit; // Unit of value if(valid3 == true){ @@ -91,13 +124,13 @@ public: unit3old = unit3; // Save old unit } - // Get boat values #4 - GwApi::BoatValue *bvalue4 = pageData.values[3]; // Fourth element in list - String name4 = xdrDelete(bvalue4->getName()); // Value name + // Get boat value for top right corner + GwApi::BoatValue *bvalue4 = pageData.values[1]; + String name4 = xdrDelete(bvalue4->getName()); // Value name name4 = name4.substring(0, 6); // String length limit for value name calibrationData.calibrateInstance(bvalue4, logger); // Check if boat data value is to be calibrated double value4 = bvalue4->value; // Value as double in SI unit - bool valid4 = bvalue4->valid; // Valid information + bool valid4 = bvalue4->valid; // Valid information String svalue4 = formatValue(bvalue4, *commonData).svalue; // Formatted value as string including unit conversion and switching decimal places String unit4 = formatValue(bvalue4, *commonData).unit; // Unit of value if(valid4 == true){ @@ -105,13 +138,13 @@ public: unit4old = unit4; // Save old unit } - // Get boat values #5 - GwApi::BoatValue *bvalue5 = pageData.values[4]; // Fifth element in list - String name5 = xdrDelete(bvalue5->getName()); // Value name + // Get boat value bottom right corner + GwApi::BoatValue *bvalue5 = pageData.values[2]; + String name5 = xdrDelete(bvalue5->getName()); // Value name name5 = name5.substring(0, 6); // String length limit for value name calibrationData.calibrateInstance(bvalue5, logger); // Check if boat data value is to be calibrated double value5 = bvalue5->value; // Value as double in SI unit - bool valid5 = bvalue5->valid; // Valid information + bool valid5 = bvalue5->valid; // Valid information String svalue5 = formatValue(bvalue5, *commonData).svalue; // Formatted value as string including unit conversion and switching decimal places String unit5 = formatValue(bvalue5, *commonData).unit; // Unit of value if(valid5 == true){ @@ -119,13 +152,13 @@ public: unit5old = unit5; // Save old unit } - // Get boat values #5 - GwApi::BoatValue *bvalue6 = pageData.values[5]; // Sixth element in list - String name6 = xdrDelete(bvalue6->getName()); // Value name + // Get boat value for center + GwApi::BoatValue *bvalue6 = pageData.values[3]; + String name6 = xdrDelete(bvalue6->getName()); // Value name name6 = name6.substring(0, 6); // String length limit for value name calibrationData.calibrateInstance(bvalue6, logger); // Check if boat data value is to be calibrated double value6 = bvalue6->value; // Value as double in SI unit - bool valid6 = bvalue6->valid; // Valid information + bool valid6 = bvalue6->valid; // Valid information String svalue6 = formatValue(bvalue6, *commonData).svalue; // Formatted value as string including unit conversion and switching decimal places String unit6 = formatValue(bvalue6, *commonData).unit; // Unit of value if(valid6 == true){ @@ -133,6 +166,7 @@ public: unit6old = unit6; // Save old unit } + // Optical warning by limit violation (unused) if(String(flashLED) == "Limit Violation"){ setBlinkingLED(false); @@ -151,7 +185,7 @@ public: getdisplay().setTextColor(commonData->fgcolor); - // Show value 2 at position of value 1 (top left) + // Show AWS or TWS top left getdisplay().setFont(&DSEG7Classic_BoldItalic20pt7b); getdisplay().setCursor(10, 65); getdisplay().print(svalue2); // Value @@ -171,7 +205,7 @@ public: // Horizintal separator left getdisplay().fillRect(0, 149, 60, 3, commonData->fgcolor); - // Show value 3 at bottom left + // Show value 3 (=first user-configured parameter) at bottom left getdisplay().setFont(&DSEG7Classic_BoldItalic20pt7b); getdisplay().setCursor(10, 270); getdisplay().print(svalue3); // Value @@ -188,11 +222,10 @@ public: getdisplay().print(unit3old); // Unit } - // Show value 4 at top right + // Show value 4 (=second user-configured parameter) at top right getdisplay().setFont(&DSEG7Classic_BoldItalic20pt7b); getdisplay().setCursor(295, 65); if(valid3 == true){ - // getdisplay().print(abs(value3 * 180 / M_PI), 0); // Value getdisplay().print(svalue4); // Value } else{ @@ -214,7 +247,7 @@ public: // Horizintal separator right getdisplay().fillRect(340, 149, 80, 3, commonData->fgcolor); - // Show value 5 at bottom right + // Show value 5 (=third user-configured parameter) at bottom right getdisplay().setFont(&DSEG7Classic_BoldItalic20pt7b); getdisplay().setCursor(295, 270); getdisplay().print(svalue5); // Value @@ -329,26 +362,49 @@ public: //******************************************************************************************* - // Show value6, so that it does not collide with the wind pointer - getdisplay().setFont(&DSEG7Classic_BoldItalic16pt7b); - if (cos(value1) > 0){ - getdisplay().setCursor(160, 200); - getdisplay().print(svalue6); // Value - getdisplay().setFont(&Ubuntu_Bold8pt8b); - getdisplay().setCursor(190, 215); - } else{ - getdisplay().setCursor(160, 130); - getdisplay().print(svalue6); // Value - getdisplay().setFont(&Ubuntu_Bold8pt8b); - getdisplay().setCursor(190, 90); - } - getdisplay().print(" "); - if(holdvalues == false){ - getdisplay().print(unit6); // Unit - } - else{ - getdisplay().print(unit6old); // Unit - } + // Show value6 (=fourth user-configured parameter) and ssource, so that they do not collide with the wind pointer +if ( cos(value1) > 0){ + getdisplay().setFont(&DSEG7Classic_BoldItalic16pt7b); + getdisplay().setCursor(160, 200); + getdisplay().print(svalue6); // Value + getdisplay().setFont(&Ubuntu_Bold8pt8b); + getdisplay().setCursor(190, 215); + getdisplay().print(" "); + if(holdvalues == false){ + getdisplay().print(unit6); // Unit + } + else{ + getdisplay().print(unit6old); // Unit + } + if (sin(value1)>0){ + getdisplay().setCursor(160, 130); + } + else{ + getdisplay().setCursor(220, 130); + } + getdisplay().print(ssource); // true or app. +} +else{ + getdisplay().setFont(&DSEG7Classic_BoldItalic16pt7b); + getdisplay().setCursor(160, 130); + getdisplay().print(svalue6); // Value + getdisplay().setFont(&Ubuntu_Bold8pt8b); + getdisplay().setCursor(190, 90); + getdisplay().print(" "); + if(holdvalues == false){ + getdisplay().print(unit6); // Unit + } + else{ + getdisplay().print(unit6old); // Unit + } + if (sin(value1)>0){ + getdisplay().setCursor(160, 130); + } + else{ + getdisplay().setCursor(220, 130); + } + getdisplay().print(ssource); //true or app. +} return PAGE_UPDATE; }; @@ -361,13 +417,14 @@ static Page *createPage(CommonData &common){ * with the code below we make this page known to the PageTask * we give it a type (name) that can be selected in the config * we define which function is to be called - * and we provide the number of user parameters we expect (0 here) + * and we provide the number of user parameters we expect (4 here) * and will will provide the names of the fixed values we need */ PageDescription registerPageWindRoseFlex( "WindRoseFlex", // Page name createPage, // Action - 6, // Number of bus values depends on selection in Web configuration; was zero + 4, // Number of bus values depends on selection in Web configuration + {"AWA", "AWS", "TWA", "TWS"}, // fixed values we need in the page. They are inserted AFTER the web-configured values. true // Show display header on/off ); diff --git a/lib/obp60task/config.json b/lib/obp60task/config.json index 9346f6e..c1c2d06 100644 --- a/lib/obp60task/config.json +++ b/lib/obp60task/config.json @@ -1521,9 +1521,6 @@ "condition": [ { "page1type": "SixValues" - }, - { - "page1type": "WindRoseFlex" } ] }, @@ -1540,9 +1537,6 @@ "condition": [ { "page1type": "SixValues" - }, - { - "page1type": "WindRoseFlex" } ] }, @@ -1799,9 +1793,6 @@ "condition": [ { "page2type": "SixValues" - }, - { - "page2type": "WindRoseFlex" } ] }, @@ -1818,9 +1809,6 @@ "condition": [ { "page2type": "SixValues" - }, - { - "page2type": "WindRoseFlex" } ] }, @@ -2074,9 +2062,6 @@ "condition": [ { "page3type": "SixValues" - }, - { - "page3type": "WindRoseFlex" } ] }, @@ -2093,9 +2078,6 @@ "condition": [ { "page3type": "SixValues" - }, - { - "page3type": "WindRoseFlex" } ] }, @@ -2346,9 +2328,6 @@ "condition": [ { "page4type": "SixValues" - }, - { - "page4type": "WindRoseFlex" } ] }, @@ -2365,9 +2344,6 @@ "condition": [ { "page4type": "SixValues" - }, - { - "page4type": "WindRoseFlex" } ] }, @@ -2615,9 +2591,6 @@ "condition": [ { "page5type": "SixValues" - }, - { - "page5type": "WindRoseFlex" } ] }, @@ -2634,9 +2607,6 @@ "condition": [ { "page5type": "SixValues" - }, - { - "page5type": "WindRoseFlex" } ] }, @@ -2881,9 +2851,6 @@ "condition": [ { "page6type": "SixValues" - }, - { - "page6type": "WindRoseFlex" } ] }, @@ -2900,9 +2867,6 @@ "condition": [ { "page6type": "SixValues" - }, - { - "page6type": "WindRoseFlex" } ] }, @@ -3144,9 +3108,6 @@ "condition": [ { "page7type": "SixValues" - }, - { - "page7type": "WindRoseFlex" } ] }, @@ -3163,9 +3124,6 @@ "condition": [ { "page7type": "SixValues" - }, - { - "page7type": "WindRoseFlex" } ] }, @@ -3404,9 +3362,6 @@ "condition": [ { "page8type": "SixValues" - }, - { - "page8type": "WindRoseFlex" } ] }, @@ -3423,9 +3378,6 @@ "condition": [ { "page8type": "SixValues" - }, - { - "page8type": "WindRoseFlex" } ] }, @@ -3661,9 +3613,6 @@ "condition": [ { "page9type": "SixValues" - }, - { - "page9type": "WindRoseFlex" } ] }, @@ -3680,9 +3629,6 @@ "condition": [ { "page9type": "SixValues" - }, - { - "page9type": "WindRoseFlex" } ] }, @@ -3915,9 +3861,6 @@ "condition": [ { "page10type": "SixValues" - }, - { - "page10type": "WindRoseFlex" } ] }, @@ -3934,9 +3877,6 @@ "condition": [ { "page10type": "SixValues" - }, - { - "page10type": "WindRoseFlex" } ] }, @@ -3987,4 +3927,3 @@ ] } ] - From a8f3fbb34d19d1f21ddc74f8d89217c8156d37ef Mon Sep 17 00:00:00 2001 From: norbert-walter Date: Mon, 18 Aug 2025 10:22:09 +0200 Subject: [PATCH 2/4] Fix for XTE page --- lib/obp60task/OBP60Formatter.cpp | 33 ++++++++++++++++++++++---------- 1 file changed, 23 insertions(+), 10 deletions(-) diff --git a/lib/obp60task/OBP60Formatter.cpp b/lib/obp60task/OBP60Formatter.cpp index b1d6888..cfdcc96 100644 --- a/lib/obp60task/OBP60Formatter.cpp +++ b/lib/obp60task/OBP60Formatter.cpp @@ -439,21 +439,34 @@ FormattedData formatValue(GwApi::BoatValue *value, CommonData &commondata){ //######################################################## else if (value->getFormat() == "formatXte"){ double xte = 0; - if (!usesimudata) { - xte = abs(value->value); + if(usesimudata == false) { + xte = value->value; rawvalue = value->value; - } else { + } + else{ rawvalue = 6.0 + float(random(0, 4)); xte = rawvalue; } - if (xte >= 100) { - snprintf(buffer, bsize, fmt_dec_100, value->value); - } else if (xte >= 10) { - snprintf(buffer, bsize, fmt_dec_10, value->value); - } else { - snprintf(buffer, bsize, fmt_dec_1, value->value); + if(String(distanceFormat) == "km"){ + xte = xte * 0.001; + result.unit = "km"; + } + else if(String(distanceFormat) == "nm"){ + xte = xte * 0.000539957; + result.unit = "nm"; + } + else{; + result.unit = "m"; + } + if(xte < 10){ + snprintf(buffer,bsize,"%3.2f",xte); + } + if(xte >= 10 && xte < 100){ + snprintf(buffer,bsize,"%3.1f",xte); + } + if(xte >= 100){ + snprintf(buffer,bsize,"%3.0f",xte); } - result.unit = "nm"; } //######################################################## else if (value->getFormat() == "kelvinToC"){ From 4f6079f418ab9d8cedaa586b735d42f9fb19e05c Mon Sep 17 00:00:00 2001 From: Thomas Hooge Date: Fri, 22 Aug 2025 10:14:38 +0200 Subject: [PATCH 3/4] Improve and speedup undervoltage detection code --- lib/obp60task/obp60task.cpp | 122 ++++++++++++++++++------------------ 1 file changed, 61 insertions(+), 61 deletions(-) diff --git a/lib/obp60task/obp60task.cpp b/lib/obp60task/obp60task.cpp index 0ca3532..62e2332 100644 --- a/lib/obp60task/obp60task.cpp +++ b/lib/obp60task/obp60task.cpp @@ -21,9 +21,6 @@ #include #endif -// True type character sets includes -// See OBP60ExtensionPort.cpp - // Pictures //#include GxEPD_BitmapExamples // Example picture #include "MFD_OBP60_400x300_sw.h" // MFD with logo @@ -159,7 +156,7 @@ class BoatValueList{ //additionally we put the necessary values into the paga data - see below GwApi::BoatValue *allBoatValues[MAXVALUES]; int numValues=0; - + bool addValueToList(GwApi::BoatValue *v){ for (int i=0;i Pages; -//the page list class class PageList{ public: Pages pages; @@ -273,64 +269,64 @@ void registerAllPages(PageList &list){ } // Undervoltage detection for shutdown display -void underVoltageDetection(GwApi *api, CommonData &common){ - // Read settings - double voffset = (api->getConfig()->getConfigItem(api->getConfig()->vOffset,true)->asString()).toFloat(); - double vslope = (api->getConfig()->getConfigItem(api->getConfig()->vSlope,true)->asString()).toFloat(); +void underVoltageError(CommonData &common) { +#if defined VOLTAGE_SENSOR && defined LIPO_ACCU_1200 + // Switch off all power lines + setPortPin(OBP_BACKLIGHT_LED, false); // Backlight Off + setFlashLED(false); // Flash LED Off + buzzer(TONE4, 20); // Buzzer tone 4kHz 20ms + // Shutdown EInk display + getdisplay().setFullWindow(); // Set full Refresh + //getdisplay().setPartialWindow(0, 0, getdisplay().width(), getdisplay().height()); // Set partial update + getdisplay().fillScreen(common.bgcolor);// Clear screen + getdisplay().setTextColor(common.fgcolor); + getdisplay().setFont(&Ubuntu_Bold20pt8b); + getdisplay().setCursor(65, 150); + getdisplay().print("Undervoltage"); + getdisplay().setFont(&Ubuntu_Bold8pt8b); + getdisplay().setCursor(65, 175); + getdisplay().print("Charge battery and restart system"); + getdisplay().nextPage(); // Partial update + getdisplay().powerOff(); // Display power off + setPortPin(OBP_POWER_EPD, false); // Power off ePaper display + setPortPin(OBP_POWER_SD, false); // Power off SD card +#else + // Switch off all power lines + setPortPin(OBP_BACKLIGHT_LED, false); // Backlight Off + setFlashLED(false); // Flash LED Off + buzzer(TONE4, 20); // Buzzer tone 4kHz 20ms + setPortPin(OBP_POWER_50, false); // Power rail 5.0V Off + // Shutdown EInk display + getdisplay().setPartialWindow(0, 0, getdisplay().width(), getdisplay().height()); // Set partial update + getdisplay().fillScreen(common.bgcolor);// Clear screen + getdisplay().setTextColor(common.fgcolor); + getdisplay().setFont(&Ubuntu_Bold20pt8b); + getdisplay().setCursor(65, 150); + getdisplay().print("Undervoltage"); + getdisplay().setFont(&Ubuntu_Bold8pt8b); + getdisplay().setCursor(65, 175); + getdisplay().print("To wake up repower system"); + getdisplay().nextPage(); // Partial update + getdisplay().powerOff(); // Display power off +#endif + // Stop system + while (true) { + esp_deep_sleep_start(); // Deep Sleep without wakeup. Wakeup only after power cycle (restart). + } +} + +inline bool underVoltageDetection(float voffset, float vslope) { // Read supply voltage - #if defined VOLTAGE_SENSOR && defined LIPO_ACCU_1200 +#if defined VOLTAGE_SENSOR && defined LIPO_ACCU_1200 float actVoltage = (float(analogRead(OBP_ANALOG0)) * 3.3 / 4096 + 0.53) * 2; // Vin = 1/2 for OBP40 float minVoltage = 3.65; // Absolut minimum volatge for 3,7V LiPo accu - #else +#else float actVoltage = (float(analogRead(OBP_ANALOG0)) * 3.3 / 4096 + 0.17) * 20; // Vin = 1/20 for OBP60 float minVoltage = MIN_VOLTAGE; - #endif - double calVoltage = actVoltage * vslope + voffset; // Calibration - if(calVoltage < minVoltage){ - #if defined VOLTAGE_SENSOR && defined LIPO_ACCU_1200 - // Switch off all power lines - setPortPin(OBP_BACKLIGHT_LED, false); // Backlight Off - setFlashLED(false); // Flash LED Off - buzzer(TONE4, 20); // Buzzer tone 4kHz 20ms - // Shutdown EInk display - getdisplay().setFullWindow(); // Set full Refresh - //getdisplay().setPartialWindow(0, 0, getdisplay().width(), getdisplay().height()); // Set partial update - getdisplay().fillScreen(common.bgcolor);// Clear screen - getdisplay().setTextColor(common.fgcolor); - getdisplay().setFont(&Ubuntu_Bold20pt8b); - getdisplay().setCursor(65, 150); - getdisplay().print("Undervoltage"); - getdisplay().setFont(&Ubuntu_Bold8pt8b); - getdisplay().setCursor(65, 175); - getdisplay().print("Charge battery and restart system"); - getdisplay().nextPage(); // Partial update - getdisplay().powerOff(); // Display power off - setPortPin(OBP_POWER_EPD, false); // Power off ePaper display - setPortPin(OBP_POWER_SD, false); // Power off SD card - #else - // Switch off all power lines - setPortPin(OBP_BACKLIGHT_LED, false); // Backlight Off - setFlashLED(false); // Flash LED Off - buzzer(TONE4, 20); // Buzzer tone 4kHz 20ms - setPortPin(OBP_POWER_50, false); // Power rail 5.0V Off - // Shutdown EInk display - getdisplay().setPartialWindow(0, 0, getdisplay().width(), getdisplay().height()); // Set partial update - getdisplay().fillScreen(common.bgcolor);// Clear screen - getdisplay().setTextColor(common.fgcolor); - getdisplay().setFont(&Ubuntu_Bold20pt8b); - getdisplay().setCursor(65, 150); - getdisplay().print("Undervoltage"); - getdisplay().setFont(&Ubuntu_Bold8pt8b); - getdisplay().setCursor(65, 175); - getdisplay().print("To wake up repower system"); - getdisplay().nextPage(); // Partial update - getdisplay().powerOff(); // Display power off - #endif - // Stop system - while(true){ - esp_deep_sleep_start(); // Deep Sleep without weakup. Weakup only after power cycle (restart). - } - } +#endif + // TODO Why double here? + float calVoltage = actVoltage * vslope + voffset; // Calibration + return (calVoltage < minVoltage); } // Calculate true wind data and add to obp60task boat data list @@ -738,7 +734,9 @@ void OBP60Task(GwApi *api){ commonData.backlight.brightness = 2.55 * uint(config->getConfigItem(config->blBrightness,true)->asInt()); commonData.powermode = api->getConfig()->getConfigItem(api->getConfig()->powerMode,true)->asString(); - bool uvoltage = api->getConfig()->getConfigItem(api->getConfig()->underVoltage,true)->asBoolean(); + bool uvoltage = config->getConfigItem(config->underVoltage, true)->asBoolean(); + float voffset = (config->getConfigItem(config->vOffset,true)->asString()).toFloat(); + float vslope = (config->getConfigItem(config->vSlope,true)->asString()).toFloat(); String cpuspeed = api->getConfig()->getConfigItem(api->getConfig()->cpuSpeed,true)->asString(); uint hdopAccuracy = uint(api->getConfig()->getConfigItem(api->getConfig()->hdopAccuracy,true)->asInt()); @@ -787,8 +785,10 @@ void OBP60Task(GwApi *api){ bool keypressed = false; // Undervoltage detection - if(uvoltage == true){ - underVoltageDetection(api, commonData); + if (uvoltage == true) { + if (underVoltageDetection(voffset, vslope)) { + underVoltageError(commonData); + } } // Set CPU speed after boot after 1min From 794cbf1c4fe4a025df1d860f3d1336ad4a3d87c9 Mon Sep 17 00:00:00 2001 From: norbert-walter Date: Fri, 22 Aug 2025 10:23:53 +0200 Subject: [PATCH 4/4] New links for docu, rename new tab --- lib/obp60task/index.js | 6 ++++-- lib/obp60task/obp60task.h | 7 ++++++- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/lib/obp60task/index.js b/lib/obp60task/index.js index 54b3cf2..21e8235 100644 --- a/lib/obp60task/index.js +++ b/lib/obp60task/index.js @@ -1,10 +1,12 @@ +// Add a new register card in web configuration interface +// This is a Java Script! (function(){ const api=window.esp32nmea2k; if (! api) return; - const tabName="OBP60"; + const tabName="Screen"; api.registerListener((id, data) => { // if (!data.testboard) return; //do nothing if we are not active - let page = api.addTabPage(tabName, "OBP60"); + let page = api.addTabPage(tabName, "Screen"); api.addEl('button', '', page, 'Screenshot').addEventListener('click', function (ev) { window.open('/api/user/OBP60Task/screenshot', 'screenshot'); }) diff --git a/lib/obp60task/obp60task.h b/lib/obp60task/obp60task.h index 4d959f0..9d6ad97 100644 --- a/lib/obp60task/obp60task.h +++ b/lib/obp60task/obp60task.h @@ -41,5 +41,10 @@ #ifdef BOARD_OBP40S3 DECLARE_CAPABILITY(obp40,true) #endif - DECLARE_STRING_CAPABILITY(HELP_URL, "https://obp60-v2-docu.readthedocs.io/de/latest/"); // Link to help pages + #ifdef BOARD_OBP60S3 + DECLARE_STRING_CAPABILITY(HELP_URL, "https://obp60-v2-docu.readthedocs.io/en/latest/"); // Link to help pages + #endif + #ifdef BOARD_OBP40S3 + DECLARE_STRING_CAPABILITY(HELP_URL, "https://obp40-v1-docu.readthedocs.io/en/latest/"); // Link to help pages + #endif #endif