diff --git a/lib/obp60task/Create_new_pages.txt b/lib/obp60task/Create_new_pages.txt new file mode 100644 index 0000000..6bd0e86 --- /dev/null +++ b/lib/obp60task/Create_new_pages.txt @@ -0,0 +1,17 @@ +git remote add upstream /url/to/original/repo +git fetch upstream +git checkout master +git reset --hard upstream/master +git push origin master --force + +https://github.com/norbert-walter/esp32-nmea2000-obp60 + + +cd /workspace/esp32-nmea2000-obp60 +bash /workspace/esp32-nmea2000-obp60/lib/obp60task/run + +Craete new page for OBP60 +1. Create page under /lib/obp60task/PageXXXX.cpp +2. Set page name in PageXXXX.cpp on file name +3. Register new page in /lib/obp60task/obp60task.cpp line 242 (registerAllPages) +4. Add new page in /lib/obp60task/config.json for each page type diff --git a/lib/obp60task/OBP60Extensions.cpp b/lib/obp60task/OBP60Extensions.cpp index 7261e9a..282a1e2 100644 --- a/lib/obp60task/OBP60Extensions.cpp +++ b/lib/obp60task/OBP60Extensions.cpp @@ -235,7 +235,7 @@ void displayHeader(CommonData &commonData, GwApi::BoatValue *date, GwApi::BoatVa getdisplay().print("USB "); } double gpshdop = formatValue(hdop, commonData).value; - if(commonData.config->getString(commonData.config->useGPS) != "off" && gpshdop > 0.3){ + if(commonData.config->getString(commonData.config->useGPS) != "off" && gpshdop <= commonData.config->getInt(commonData.config->hdopAccuracy) && hdop->valid == true){ getdisplay().print("GPS"); } // Save old telegram counter @@ -266,6 +266,7 @@ void displayHeader(CommonData &commonData, GwApi::BoatValue *date, GwApi::BoatVa getdisplay().setTextColor(textcolor); getdisplay().setFont(&Ubuntu_Bold8pt7b); getdisplay().setCursor(230, 15); + // Show date and time if date present if(date->valid == true){ String acttime = formatValue(time, commonData).svalue; acttime = acttime.substring(0, 5); diff --git a/lib/obp60task/OBPSensorTask.cpp b/lib/obp60task/OBPSensorTask.cpp index 9326608..be9f1b1 100644 --- a/lib/obp60task/OBPSensorTask.cpp +++ b/lib/obp60task/OBPSensorTask.cpp @@ -147,6 +147,7 @@ void sensorTask(void *param){ // Settings for GPS sensors String gpsOn=api->getConfig()->getConfigItem(api->getConfig()->useGPS,true)->asString(); + uint hdopAccuracy = uint(api->getConfig()->getConfigItem(api->getConfig()->hdopAccuracy,true)->asInt()); if(String(gpsOn) == "NEO-6M"){ Serial2.begin(9600, SERIAL_8N1, OBP_GPS_RX, OBP_GPS_TX, false); // not inverted (false) if (!Serial2) { @@ -354,7 +355,8 @@ void sensorTask(void *param){ GwApi::BoatValue *gpsdays=new GwApi::BoatValue(GwBoatData::_GPSD); GwApi::BoatValue *gpsseconds=new GwApi::BoatValue(GwBoatData::_GPST); - GwApi::BoatValue *valueList[]={gpsdays, gpsseconds}; + GwApi::BoatValue *hdop=new GwApi::BoatValue(GwBoatData::_HDOP); + GwApi::BoatValue *valueList[]={gpsdays, gpsseconds, hdop}; // Sensor task loop runs with 100ms //#################################################################################### @@ -366,7 +368,7 @@ void sensorTask(void *param){ { starttime0 = millis(); // Send NMEA0183 GPS data on several bus systems all 100ms - if (GPS_ready == true) + if (GPS_ready == true && hdop->value <= hdopAccuracy) { SNMEA0183Msg NMEA0183Msg; while (NMEA0183.GetMessageCor(NMEA0183Msg)) @@ -381,8 +383,8 @@ void sensorTask(void *param){ if(millis() > starttime11 + 5*60*1000){ starttime11 = millis(); if(rtcOn == "DS1388" && RTC_ready == true && GPS_ready == true){ - api->getBoatDataValues(2,valueList); - if(gpsdays->valid && gpsseconds->valid){ + api->getBoatDataValues(3,valueList); + if(gpsdays->valid && gpsseconds->valid && hdop->valid){ long ts = tNMEA0183Msg::daysToTime_t(gpsdays->value - (30*365+7))+floor(gpsseconds->value); // Adjusted to reference year 2000 (-30 years and 7 days for switch years) // sample input: date = "Dec 26 2009", time = "12:34:56" // ds1388.adjust(DateTime("Dec 26 2009", "12:34:56")); @@ -421,7 +423,7 @@ void sensorTask(void *param){ // If GPS not ready or installed then send RTC time on bus all 500ms if(millis() > starttime12 + 500){ starttime12 = millis(); - if(rtcOn == "DS1388" && RTC_ready == true && GPS_ready == false){ + if((rtcOn == "DS1388" && RTC_ready == true && GPS_ready == false) || (rtcOn == "DS1388" && RTC_ready == true && GPS_ready == true && hdop->valid == false)){ // Convert RTC time to Unix system time // https://de.wikipedia.org/wiki/Unixzeit const short daysOfYear[12] = {0,31,59,90,120,151,181,212,243,273,304,334}; diff --git a/lib/obp60task/PageClock.cpp b/lib/obp60task/PageClock.cpp index fc4e9ab..29cea4b 100644 --- a/lib/obp60task/PageClock.cpp +++ b/lib/obp60task/PageClock.cpp @@ -32,10 +32,14 @@ public: static String svalue2old = ""; static String unit2old = ""; static String svalue3old = ""; - static String svalue4old = ""; + static String unit3old = ""; + + static String svalue5old = ""; + static String svalue6old = ""; double value1 = 0; double value2 = 0; + double value3 = 0; // Get config data String lengthformat = config->getString(config->lengthFormat); @@ -66,7 +70,7 @@ public: } // Get boat values for GPS date - GwApi::BoatValue *bvalue2 = pageData.values[1]; // First element in list (only one value by PageOneValue) + GwApi::BoatValue *bvalue2 = pageData.values[1]; // Second element in list (only one value by PageOneValue) String name2 = bvalue2->getName().c_str(); // Value name name2 = name2.substring(0, 6); // String length limit for value name value2 = bvalue2->value; // Value as double in SI unit @@ -78,6 +82,19 @@ public: unit2old = unit2; // Save old unit } + // Get boat values for HDOP date + GwApi::BoatValue *bvalue3 = pageData.values[2]; // Third element in list (only one value by PageOneValue) + String name3 = bvalue3->getName().c_str(); // Value name + name3 = name3.substring(0, 6); // String length limit for value name + value3 = bvalue3->value; // Value as double in SI unit + 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){ + svalue3old = svalue3; // Save old value + unit3old = unit3; // Save old unit + } + // Optical warning by limit violation (unused) if(String(flashLED) == "Limit Violation"){ setBlinkingLED(false); @@ -133,16 +150,16 @@ public: // Show values sunrise String sunrise = "---"; - if(valid1 == true && valid2 == true){ + if(valid1 == true && valid2 == true && valid3 == true){ sunrise = String(commonData.sundata.sunriseHour) + ":" + String(commonData.sundata.sunriseMinute + 100).substring(1); - svalue3old = sunrise; + svalue5old = sunrise; } getdisplay().setTextColor(textcolor); getdisplay().setFont(&Ubuntu_Bold8pt7b); getdisplay().setCursor(335, 65); if(holdvalues == false) getdisplay().print(sunrise); // Value - else getdisplay().print(svalue3old); + else getdisplay().print(svalue5old); getdisplay().setFont(&Ubuntu_Bold12pt7b); getdisplay().setCursor(335, 95); getdisplay().print("SunR"); // Name @@ -152,16 +169,16 @@ public: // Show values sunset String sunset = "---"; - if(valid1 == true && valid2 == true){ + if(valid1 == true && valid2 == true && valid3 == true){ sunset = String(commonData.sundata.sunsetHour) + ":" + String(commonData.sundata.sunsetMinute + 100).substring(1); - svalue4old = sunset; + svalue6old = sunset; } getdisplay().setTextColor(textcolor); getdisplay().setFont(&Ubuntu_Bold8pt7b); getdisplay().setCursor(335, 250); if(holdvalues == false) getdisplay().print(sunset); // Value - else getdisplay().print(svalue4old); + else getdisplay().print(svalue6old); getdisplay().setFont(&Ubuntu_Bold12pt7b); getdisplay().setCursor(335, 220); getdisplay().print("SunS"); // Name @@ -350,10 +367,10 @@ static Page *createPage(CommonData &common){ * and will will provide the names of the fixed values we need */ PageDescription registerPageClock( - "Clock", // Page name + "Clock", // Page name createPage, // Action 0, // Number of bus values depends on selection in Web configuration - {"GPST", "GPSD"}, // Bus values we need in the page + {"GPST", "GPSD", "HDOP"}, // Bus values we need in the page true // Show display header on/off ); diff --git a/lib/obp60task/PageWindRoseFlex.cpp b/lib/obp60task/PageWindRoseFlex.cpp new file mode 100644 index 0000000..f71018a --- /dev/null +++ b/lib/obp60task/PageWindRoseFlex.cpp @@ -0,0 +1,412 @@ +#ifdef BOARD_OBP60S3 + +#include "Pagedata.h" +#include "OBP60Extensions.h" + +class PageWindRoseFlex : public Page +{ +bool keylock = false; // Keylock +int16_t lp = 80; // Pointer length + +public: + PageWindRoseFlex(CommonData &common){ + common.logger->logDebug(GwLog::LOG,"Show PageWindRoseFlex"); + } + + // Key functions + virtual int handleKey(int key){ + // Keylock function + if(key == 11){ // Code for keylock + keylock = !keylock; // Toggle keylock + return 0; // Commit the key + } + return key; + } + + virtual void displayPage(CommonData &commonData, PageData &pageData) + { + GwConfigHandler *config = commonData.config; + GwLog *logger=commonData.logger; + + static String svalue1old = ""; + static String unit1old = ""; + static String svalue2old = ""; + static String unit2old = ""; + static String svalue3old = ""; + static String unit3old = ""; + static String svalue4old = ""; + static String unit4old = ""; + static String svalue5old = ""; + static String unit5old = ""; + static String svalue6old = ""; + static String unit6old = ""; + + // Get config data + String lengthformat = config->getString(config->lengthFormat); + bool simulation = config->getBool(config->useSimuData); + String displaycolor = config->getString(config->displaycolor); + bool holdvalues = config->getBool(config->holdvalues); + String flashLED = config->getString(config->flashLED); + String backlightMode = config->getString(config->backlight); + + // Get boat values for AWA + GwApi::BoatValue *bvalue1 = pageData.values[0]; // First element in list (only one value by PageOneValue) + String name1 = xdrDelete(bvalue1->getName()); // Value name + name1 = name1.substring(0, 6); // String length limit for value name + 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){ + svalue1old = svalue1; // Save old value + unit1old = unit1; // Save old unit + } + + // Get boat values for AWS + GwApi::BoatValue *bvalue2 = pageData.values[1]; // First element in list (only one value by PageOneValue) + String name2 = xdrDelete(bvalue2->getName()); // Value name + name2 = name2.substring(0, 6); // String length limit for value name + double value2 = bvalue2->value; // Value as double in SI unit + bool valid2 = bvalue2->valid; // Valid information + 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){ + svalue2old = svalue2; // Save old value + unit2old = unit2; // Save old unit + } + + // Get boat values TWD + GwApi::BoatValue *bvalue3 = pageData.values[2]; // Second element in list (only one value by PageOneValue) + String name3 = xdrDelete(bvalue3->getName()); // Value name + name3 = name3.substring(0, 6); // String length limit for value name + double value3 = bvalue3->value; // Value as double in SI unit + 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){ + svalue3old = svalue3; // Save old value + unit3old = unit3; // Save old unit + } + + // Get boat values TWS + GwApi::BoatValue *bvalue4 = pageData.values[3]; // Second element in list (only one value by PageOneValue) + String name4 = xdrDelete(bvalue4->getName()); // Value name + name4 = name4.substring(0, 6); // String length limit for value name + double value4 = bvalue4->value; // Value as double in SI unit + 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){ + svalue4old = svalue4; // Save old value + unit4old = unit4; // Save old unit + } + + // Get boat values DBT + GwApi::BoatValue *bvalue5 = pageData.values[4]; // Second element in list (only one value by PageOneValue) + String name5 = xdrDelete(bvalue5->getName()); // Value name + name5 = name5.substring(0, 6); // String length limit for value name + double value5 = bvalue5->value; // Value as double in SI unit + 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){ + svalue5old = svalue5; // Save old value + unit5old = unit5; // Save old unit + } + + // Get boat values STW + GwApi::BoatValue *bvalue6 = pageData.values[5]; // Second element in list (only one value by PageOneValue) + String name6 = xdrDelete(bvalue6->getName()); // Value name + name6 = name6.substring(0, 6); // String length limit for value name + double value6 = bvalue6->value; // Value as double in SI unit + 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){ + svalue6old = svalue6; // Save old value + unit6old = unit6; // Save old unit + } + + // Optical warning by limit violation (unused) + if(String(flashLED) == "Limit Violation"){ + setBlinkingLED(false); + setFlashLED(false); + } + + // Logging boat values + if (bvalue1 == NULL) return; + LOG_DEBUG(GwLog::LOG,"Drawing at PageWindRoseFlex, %s:%f, %s:%f, %s:%f, %s:%f, %s:%f, %s:%f", name1.c_str(), value1, name2.c_str(), value2, name3.c_str(), value3, name4.c_str(), value4, name5.c_str(), value5, name6.c_str(), value6); + + // Draw page + //*********************************************************** + + // Set background color and text color + int textcolor = GxEPD_BLACK; + int pixelcolor = GxEPD_BLACK; + int bgcolor = GxEPD_WHITE; + if(displaycolor == "Normal"){ + textcolor = GxEPD_BLACK; + pixelcolor = GxEPD_BLACK; + bgcolor = GxEPD_WHITE; + } + else{ + textcolor = GxEPD_WHITE; + pixelcolor = GxEPD_WHITE; + bgcolor = GxEPD_BLACK; + } + // Set display in partial refresh mode + getdisplay().setPartialWindow(0, 0, getdisplay().width(), getdisplay().height()); // Set partial update + + // Show values AWA + getdisplay().setTextColor(textcolor); + getdisplay().setFont(&DSEG7Classic_BoldItalic20pt7b); + getdisplay().setCursor(10, 65); + getdisplay().print(svalue1); // Value + getdisplay().setFont(&Ubuntu_Bold12pt7b); + getdisplay().setCursor(10, 95); + getdisplay().print(name1); // Name + getdisplay().setFont(&Ubuntu_Bold8pt7b); + getdisplay().setCursor(10, 115); + getdisplay().print(" "); + if(holdvalues == false){ + getdisplay().print(unit1); // Unit + } + else{ + getdisplay().print(unit1old); // Unit + } + + // Horizintal separator left + getdisplay().fillRect(0, 149, 60, 3, pixelcolor); + + // Show values AWS + getdisplay().setTextColor(textcolor); + getdisplay().setFont(&DSEG7Classic_BoldItalic20pt7b); + getdisplay().setCursor(10, 270); + getdisplay().print(svalue2); // Value + getdisplay().setFont(&Ubuntu_Bold12pt7b); + getdisplay().setCursor(10, 220); + getdisplay().print(name2); // Name + getdisplay().setFont(&Ubuntu_Bold8pt7b); + getdisplay().setCursor(10, 190); + getdisplay().print(" "); + if(holdvalues == false){ + getdisplay().print(unit2); // Unit + } + else{ + getdisplay().print(unit2old); // Unit + } + + // Show values TWD + getdisplay().setTextColor(textcolor); + getdisplay().setFont(&DSEG7Classic_BoldItalic20pt7b); + getdisplay().setCursor(295, 65); + if(valid3 == true){ + getdisplay().print(abs(value3 * 180 / PI), 0); // Value + } + else{ + getdisplay().print("---"); // Value + } + getdisplay().setFont(&Ubuntu_Bold12pt7b); + getdisplay().setCursor(335, 95); + getdisplay().print(name3); // Name + getdisplay().setFont(&Ubuntu_Bold8pt7b); + getdisplay().setCursor(335, 115); + getdisplay().print(" "); + if(holdvalues == false){ + getdisplay().print(unit3); // Unit + } + else{ + getdisplay().print(unit3old); // Unit + } + + // Horizintal separator right + getdisplay().fillRect(340, 149, 80, 3, pixelcolor); + + // Show values TWS + getdisplay().setTextColor(textcolor); + getdisplay().setFont(&DSEG7Classic_BoldItalic20pt7b); + getdisplay().setCursor(295, 270); + getdisplay().print(svalue4); // Value + getdisplay().setFont(&Ubuntu_Bold12pt7b); + getdisplay().setCursor(335, 220); + getdisplay().print(name4); // Name + getdisplay().setFont(&Ubuntu_Bold8pt7b); + getdisplay().setCursor(335, 190); + getdisplay().print(" "); + if(holdvalues == false){ + getdisplay().print(unit4); // Unit + } + else{ + getdisplay().print(unit4old); // Unit + } + +//******************************************************************************************* + + // Draw wind rose + int rInstrument = 110; // Radius of grafic instrument + float pi = 3.141592; + + getdisplay().fillCircle(200, 150, rInstrument + 10, pixelcolor); // Outer circle + getdisplay().fillCircle(200, 150, rInstrument + 7, bgcolor); // Outer circle + getdisplay().fillCircle(200, 150, rInstrument - 10, pixelcolor); // Inner circle + getdisplay().fillCircle(200, 150, rInstrument - 13, bgcolor); // Inner circle + + for(int i=0; i<360; i=i+10) + { + // Scaling values + float x = 200 + (rInstrument-30)*sin(i/180.0*pi); // x-coordinate dots + float y = 150 - (rInstrument-30)*cos(i/180.0*pi); // y-coordinate cots + const char *ii = ""; + switch (i) + { + case 0: ii="0"; break; + case 30 : ii="30"; break; + case 60 : ii="60"; break; + case 90 : ii="90"; break; + case 120 : ii="120"; break; + case 150 : ii="150"; break; + case 180 : ii="180"; break; + case 210 : ii="210"; break; + case 240 : ii="240"; break; + case 270 : ii="270"; break; + case 300 : ii="300"; break; + case 330 : ii="330"; break; + default: break; + } + + // Print text centered on position x, y + int16_t x1, y1; // Return values of getTextBounds + uint16_t w, h; // Return values of getTextBounds + getdisplay().getTextBounds(ii, int(x), int(y), &x1, &y1, &w, &h); // Calc width of new string + getdisplay().setCursor(x-w/2, y+h/2); + if(i % 30 == 0){ + getdisplay().setFont(&Ubuntu_Bold8pt7b); + getdisplay().print(ii); + } + + // Draw sub scale with dots + float x1c = 200 + rInstrument*sin(i/180.0*pi); + float y1c = 150 - rInstrument*cos(i/180.0*pi); + getdisplay().fillCircle((int)x1c, (int)y1c, 2, pixelcolor); + float sinx=sin(i/180.0*pi); + float cosx=cos(i/180.0*pi); + + // Draw sub scale with lines (two triangles) + if(i % 30 == 0){ + float dx=2; // Line thickness = 2*dx+1 + float xx1 = -dx; + float xx2 = +dx; + float yy1 = -(rInstrument-10); + float yy2 = -(rInstrument+10); + getdisplay().fillTriangle(200+(int)(cosx*xx1-sinx*yy1),150+(int)(sinx*xx1+cosx*yy1), + 200+(int)(cosx*xx2-sinx*yy1),150+(int)(sinx*xx2+cosx*yy1), + 200+(int)(cosx*xx1-sinx*yy2),150+(int)(sinx*xx1+cosx*yy2),pixelcolor); + getdisplay().fillTriangle(200+(int)(cosx*xx2-sinx*yy1),150+(int)(sinx*xx2+cosx*yy1), + 200+(int)(cosx*xx1-sinx*yy2),150+(int)(sinx*xx1+cosx*yy2), + 200+(int)(cosx*xx2-sinx*yy2),150+(int)(sinx*xx2+cosx*yy2),pixelcolor); + } + } + + // Draw wind pointer + float startwidth = 8; // Start width of pointer + if(valid2 == true || holdvalues == true || simulation == true){ + float sinx=sin(value1); // Wind direction + float cosx=cos(value1); + // Normal pointer + // Pointer as triangle with center base 2*width + float xx1 = -startwidth; + float xx2 = startwidth; + float yy1 = -startwidth; + float yy2 = -(rInstrument-15); + getdisplay().fillTriangle(200+(int)(cosx*xx1-sinx*yy1),150+(int)(sinx*xx1+cosx*yy1), + 200+(int)(cosx*xx2-sinx*yy1),150+(int)(sinx*xx2+cosx*yy1), + 200+(int)(cosx*0-sinx*yy2),150+(int)(sinx*0+cosx*yy2),pixelcolor); + // Inverted pointer + // Pointer as triangle with center base 2*width + float endwidth = 2; // End width of pointer + float ix1 = endwidth; + float ix2 = -endwidth; + float iy1 = -(rInstrument-15); + float iy2 = -endwidth; + getdisplay().fillTriangle(200+(int)(cosx*ix1-sinx*iy1),150+(int)(sinx*ix1+cosx*iy1), + 200+(int)(cosx*ix2-sinx*iy1),150+(int)(sinx*ix2+cosx*iy1), + 200+(int)(cosx*0-sinx*iy2),150+(int)(sinx*0+cosx*iy2),pixelcolor); + } + + // Center circle + getdisplay().fillCircle(200, 150, startwidth + 6, bgcolor); + getdisplay().fillCircle(200, 150, startwidth + 4, pixelcolor); + +//******************************************************************************************* + + // Show values DBT + getdisplay().setTextColor(textcolor); + getdisplay().setFont(&DSEG7Classic_BoldItalic16pt7b); + getdisplay().setCursor(160, 200); + getdisplay().print(svalue5); // Value + getdisplay().setFont(&Ubuntu_Bold8pt7b); + getdisplay().setCursor(190, 215); + getdisplay().print(" "); + if(holdvalues == false){ + getdisplay().print(unit5); // Unit + } + else{ + getdisplay().print(unit5old); // Unit + } + + // Show values STW + getdisplay().setTextColor(textcolor); + getdisplay().setFont(&DSEG7Classic_BoldItalic16pt7b); + getdisplay().setCursor(160, 130); + getdisplay().print(svalue6); // Value + getdisplay().setFont(&Ubuntu_Bold8pt7b); + getdisplay().setCursor(190, 90); + getdisplay().print(" "); + if(holdvalues == false){ + getdisplay().print(unit6); // Unit + } + else{ + getdisplay().print(unit6old); // Unit + } + + // Key Layout + getdisplay().setTextColor(textcolor); + getdisplay().setFont(&Ubuntu_Bold8pt7b); + if(keylock == false){ + getdisplay().setCursor(130, 290); + getdisplay().print("[ <<<< " + String(commonData.data.actpage) + "/" + String(commonData.data.maxpage) + " >>>> ]"); + if(String(backlightMode) == "Control by Key"){ // Key for illumination + getdisplay().setCursor(343, 290); + getdisplay().print("[ILUM]"); + } + } + else{ + getdisplay().setCursor(130, 290); + getdisplay().print(" [ Keylock active ]"); + } + + // Update display + getdisplay().nextPage(); // Partial update (fast) + }; +}; + +static Page *createPage(CommonData &common){ + return new PageWindRoseFlex(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 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 + //{"AWA", "AWS", "COG", "SOG", "TWD", "TWS"}, // Bus values we need in the page, modified for WindRose2 + true // Show display header on/off +); + +#endif diff --git a/lib/obp60task/config.json b/lib/obp60task/config.json index 1639008..e9ce0e5 100644 --- a/lib/obp60task/config.json +++ b/lib/obp60task/config.json @@ -325,6 +325,20 @@ "obp60":"true" } }, + { + "name": "hdopAccuracy", + "label": "HDOP Accuracy [m]", + "type": "number", + "default": "20", + "check": "checkMinMax", + "min": 1, + "max": 50, + "description": "HDOP ccuracy in m for a valid GPS signal [1...50]", + "category": "OBP60 Hardware", + "capabilities": { + "obp60":"true" + } + }, { "name": "useEnvSensor", "label": "Env. Sensor", @@ -890,7 +904,7 @@ "type": "list", "default": "Voltage", "description": "Type of page for page 1", - "list":["OneValue","TwoValues","ThreeValues","FourValues","FourValues2","ApparentWind","WindRose","Voltage","DST810","Clock","WhitePage","BME280","RudderPosition","KeelPosition","Battery","Battery2","RollPitch","Solar","Generator","Autobahn"], + "list":["OneValue","TwoValues","ThreeValues","FourValues","FourValues2","ApparentWind","WindRose","WindRoseFlex","Voltage","DST810","Clock","WhitePage","BME280","RudderPosition","KeelPosition","Battery","Battery2","RollPitch","Solar","Generator","Autobahn"], "category": "OBP60 Page 1", "capabilities": { "obp60":"true" @@ -898,7 +912,7 @@ }, { "name": "page1value1", - "label": "Field 1 ", + "label": "Field 1", "type": "boatData", "default": "", "description": "The display for field one", @@ -906,7 +920,7 @@ "capabilities": { "obp60":"true" }, - "condition":[{"page1type":"OneValue"},{"page1type":"TwoValues"},{"page1type":"ThreeValues"},{"page1type":"FourValues"},{"page1type":"FourValues2"}] + "condition":[{"page1type":"OneValue"},{"page1type":"TwoValues"},{"page1type":"ThreeValues"},{"page1type":"FourValues"},{"page1type":"FourValues2"},{"page1type":"WindRoseFlex"}] }, { "name": "page1value2", @@ -918,7 +932,7 @@ "capabilities": { "obp60":"true" }, - "condition":[{"page1type":"TwoValues"},{"page1type":"ThreeValues"},{"page1type":"FourValues"},{"page1type":"FourValues2"}] + "condition":[{"page1type":"TwoValues"},{"page1type":"ThreeValues"},{"page1type":"FourValues"},{"page1type":"FourValues2"},{"page1type":"WindRoseFlex"}] }, { "name": "page1value3", @@ -930,7 +944,7 @@ "capabilities": { "obp60":"true" }, - "condition":[{"page1type":"ThreeValues"},{"page1type":"FourValues"},{"page1type":"FourValues2"}] + "condition":[{"page1type":"ThreeValues"},{"page1type":"FourValues"},{"page1type":"FourValues2"},{"page1type":"WindRoseFlex"}] }, { "name": "page1value4", @@ -942,7 +956,31 @@ "capabilities": { "obp60":"true" }, - "condition":[{"page1type":"FourValues"},{"page1type":"FourValues2"}] + "condition":[{"page1type":"FourValues"},{"page1type":"FourValues2"},{"page1type":"WindRoseFlex"}] + }, + { + "name": "page1value5", + "label": "Field 5", + "type": "boatData", + "default": "", + "description": "The display for field 5", + "category": "OBP60 Page 1", + "capabilities": { + "obp60":"true" + }, + "condition":[{"page1type":"WindRoseFlex"}] + }, + { + "name": "page1value6", + "label": "Field 6", + "type": "boatData", + "default": "", + "description": "The display for field 6", + "category": "OBP60 Page 1", + "capabilities": { + "obp60":"true" + }, + "condition":[{"page1type":"WindRoseFlex"}] }, { "name": "page2type", @@ -950,7 +988,7 @@ "type": "list", "default": "WindRose", "description": "Type of page for page 2", - "list":["OneValue","TwoValues","ThreeValues","FourValues","FourValues2","ApparentWind","WindRose","Voltage","DST810","Clock","WhitePage","BME280","RudderPosition","KeelPosition","Battery","Battery2","RollPitch","Solar","Generator","Autobahn"], + "list":["OneValue","TwoValues","ThreeValues","FourValues","FourValues2","ApparentWind","WindRose","WindRoseFlex","Voltage","DST810","Clock","WhitePage","BME280","RudderPosition","KeelPosition","Battery","Battery2","RollPitch","Solar","Generator","Autobahn"], "category": "OBP60 Page 2", "capabilities": { "obp60":"true" @@ -967,7 +1005,7 @@ "capabilities": { "obp60":"true" }, - "condition":[{"page2type":"OneValue"},{"page2type":"TwoValues"},{"page2type":"ThreeValues"},{"page2type":"FourValues"},{"page2type":"FourValues2"}] + "condition":[{"page2type":"OneValue"},{"page2type":"TwoValues"},{"page2type":"ThreeValues"},{"page2type":"FourValues"},{"page2type":"FourValues2"},{"page2type":"WindRoseFlex"}] }, { "name": "page2value2", @@ -979,7 +1017,7 @@ "capabilities": { "obp60":"true" }, - "condition":[{"page2type":"TwoValues"},{"page2type":"ThreeValues"},{"page2type":"FourValues"},{"page2type":"FourValues2"}] + "condition":[{"page2type":"TwoValues"},{"page2type":"ThreeValues"},{"page2type":"FourValues"},{"page2type":"FourValues2"},{"page2type":"WindRoseFlex"}] }, { "name": "page2value3", @@ -991,7 +1029,7 @@ "capabilities": { "obp60":"true" }, - "condition":[{"page2type":"ThreeValues"},{"page2type":"FourValues"},{"page2type":"FourValues2"}] + "condition":[{"page2type":"ThreeValues"},{"page2type":"FourValues"},{"page2type":"FourValues2"},{"page2type":"WindRoseFlex"}] }, { "name": "page2value4", @@ -1003,7 +1041,31 @@ "capabilities": { "obp60":"true" }, - "condition":[{"page2type":"FourValues"},{"page2type":"FourValues2"}] + "condition":[{"page2type":"FourValues"},{"page2type":"FourValues2"},{"page2type":"WindRoseFlex"}] + }, + { + "name": "page2value5", + "label": "Field 5", + "type": "boatData", + "default": "", + "description": "The display for field 5", + "category": "OBP60 Page 2", + "capabilities": { + "obp60":"true" + }, + "condition":[{"page2type":"WindRoseFlex"}] + }, + { + "name": "page2value6", + "label": "Field 6", + "type": "boatData", + "default": "", + "description": "The display for field 6", + "category": "OBP60 Page 2", + "capabilities": { + "obp60":"true" + }, + "condition":[{"page2type":"WindRoseFlex"}] }, { "name": "page3type", @@ -1011,7 +1073,7 @@ "type": "list", "default": "OneValue", "description": "Type of page for page 3", - "list":["OneValue","TwoValues","ThreeValues","FourValues","FourValues2","ApparentWind","WindRose","Voltage","DST810","Clock","WhitePage","BME280","RudderPosition","KeelPosition","Battery","Battery2","RollPitch","Solar","Generator","Autobahn"], + "list":["OneValue","TwoValues","ThreeValues","FourValues","FourValues2","ApparentWind","WindRose","WindRoseFlex","Voltage","DST810","Clock","WhitePage","BME280","RudderPosition","KeelPosition","Battery","Battery2","RollPitch","Solar","Generator","Autobahn"], "category": "OBP60 Page 3", "capabilities": { "obp60":"true" @@ -1028,7 +1090,7 @@ "capabilities": { "obp60":"true" }, - "condition":[{"page3type":"OneValue"},{"page3type":"TwoValues"},{"page3type":"ThreeValues"},{"page3type":"FourValues"},{"page3type":"FourValues2"}] + "condition":[{"page3type":"OneValue"},{"page3type":"TwoValues"},{"page3type":"ThreeValues"},{"page3type":"FourValues"},{"page3type":"FourValues2"},{"page3type":"WindRoseFlex"}] }, { "name": "page3value2", @@ -1040,7 +1102,7 @@ "capabilities": { "obp60":"true" }, - "condition":[{"page3type":"TwoValues"},{"page3type":"ThreeValues"},{"page3type":"FourValues"},{"page3type":"FourValues2"}] + "condition":[{"page3type":"TwoValues"},{"page3type":"ThreeValues"},{"page3type":"FourValues"},{"page3type":"FourValues2"},{"page3type":"WindRoseFlex"}] }, { "name": "page3value3", @@ -1052,7 +1114,7 @@ "capabilities": { "obp60":"true" }, - "condition":[{"page3type":"ThreeValues"},{"page3type":"FourValues"},{"page3type":"FourValues2"}] + "condition":[{"page3type":"ThreeValues"},{"page3type":"FourValues"},{"page3type":"FourValues2"},{"page3type":"WindRoseFlex"}] }, { "name": "page3value4", @@ -1064,7 +1126,31 @@ "capabilities": { "obp60":"true" }, - "condition":[{"page3type":"FourValues"},{"page3type":"FourValues2"}] + "condition":[{"page3type":"FourValues"},{"page3type":"FourValues2"},{"page3type":"WindRoseFlex"}] + }, + { + "name": "page3value5", + "label": "Field 5", + "type": "boatData", + "default": "", + "description": "The display for field 5", + "category": "OBP60 Page 3", + "capabilities": { + "obp60":"true" + }, + "condition":[{"page3type":"WindRoseFlex"}] + }, + { + "name": "page3value6", + "label": "Field 6", + "type": "boatData", + "default": "", + "description": "The display for field 6", + "category": "OBP60 Page 3", + "capabilities": { + "obp60":"true" + }, + "condition":[{"page3type":"WindRoseFlex"}] }, { "name": "page4type", @@ -1072,7 +1158,7 @@ "type": "list", "default": "TwoValues", "description": "Type of page for page 4", - "list":["OneValue","TwoValues","ThreeValues","FourValues","FourValues2","ApparentWind","WindRose","Voltage","DST810","Clock","WhitePage","BME280","RudderPosition","KeelPosition","Battery","Battery2","RollPitch","Solar","Generator","Autobahn"], + "list":["OneValue","TwoValues","ThreeValues","FourValues","FourValues2","ApparentWind","WindRose","WindRoseFlex","Voltage","DST810","Clock","WhitePage","BME280","RudderPosition","KeelPosition","Battery","Battery2","RollPitch","Solar","Generator","Autobahn"], "category": "OBP60 Page 4", "capabilities": { "obp60":"true" @@ -1089,7 +1175,7 @@ "capabilities": { "obp60":"true" }, - "condition":[{"page4type":"OneValue"},{"page4type":"TwoValues"},{"page4type":"ThreeValues"},{"page4type":"FourValues"},{"page4type":"FourValues2"}] + "condition":[{"page4type":"OneValue"},{"page4type":"TwoValues"},{"page4type":"ThreeValues"},{"page4type":"FourValues"},{"page4type":"FourValues2"},{"page4type":"WindRoseFlex"}] }, { "name": "page4value2", @@ -1101,7 +1187,7 @@ "capabilities": { "obp60":"true" }, - "condition":[{"page4type":"TwoValues"},{"page4type":"ThreeValues"},{"page4type":"FourValues"},{"page4type":"FourValues2"}] + "condition":[{"page4type":"TwoValues"},{"page4type":"ThreeValues"},{"page4type":"FourValues"},{"page4type":"FourValues2"},{"page4type":"WindRoseFlex"}] }, { "name": "page4value3", @@ -1113,7 +1199,7 @@ "capabilities": { "obp60":"true" }, - "condition":[{"page4type":"ThreeValues"},{"page4type":"FourValues"},{"page4type":"FourValues2"}] + "condition":[{"page4type":"ThreeValues"},{"page4type":"FourValues"},{"page4type":"FourValues2"},{"page4type":"WindRoseFlex"}] }, { "name": "page4value4", @@ -1125,7 +1211,31 @@ "capabilities": { "obp60":"true" }, - "condition":[{"page4type":"FourValues"},{"page4type":"FourValues2"}] + "condition":[{"page4type":"FourValues"},{"page4type":"FourValues2"},{"page4type":"WindRoseFlex"}] + }, + { + "name": "page4value5", + "label": "Field 5", + "type": "boatData", + "default": "", + "description": "The display for field 5", + "category": "OBP60 Page 4", + "capabilities": { + "obp60":"true" + }, + "condition":[{"page4type":"WindRoseFlex"}] + }, + { + "name": "page4value6", + "label": "Field 6", + "type": "boatData", + "default": "", + "description": "The display for field 6", + "category": "OBP60 Page 4", + "capabilities": { + "obp60":"true" + }, + "condition":[{"page4type":"WindRoseFlex"}] }, { "name": "page5type", @@ -1133,7 +1243,7 @@ "type": "list", "default": "ThreeValues", "description": "Type of page for page 5", - "list":["OneValue","TwoValues","ThreeValues","FourValues","FourValues2","ApparentWind","WindRose","Voltage","DST810","Clock","WhitePage","BME280","RudderPosition","KeelPosition","Battery","Battery2","RollPitch","Solar","Generator","Autobahn"], + "list":["OneValue","TwoValues","ThreeValues","FourValues","FourValues2","ApparentWind","WindRose","WindRoseFlex","Voltage","DST810","Clock","WhitePage","BME280","RudderPosition","KeelPosition","Battery","Battery2","RollPitch","Solar","Generator","Autobahn"], "category": "OBP60 Page 5", "capabilities": { "obp60":"true" @@ -1150,7 +1260,7 @@ "capabilities": { "obp60":"true" }, - "condition":[{"page5type":"OneValue"},{"page5type":"TwoValues"},{"page5type":"ThreeValues"},{"page5type":"FourValues"},{"page5type":"FourValues2"}] + "condition":[{"page5type":"OneValue"},{"page5type":"TwoValues"},{"page5type":"ThreeValues"},{"page5type":"FourValues"},{"page5type":"FourValues2"},{"page4type":"WindRoseFlex"}] }, { "name": "page5value2", @@ -1162,7 +1272,7 @@ "capabilities": { "obp60":"true" }, - "condition":[{"page5type":"TwoValues"},{"page5type":"ThreeValues"},{"page5type":"FourValues"},{"page5type":"FourValues2"}] + "condition":[{"page5type":"TwoValues"},{"page5type":"ThreeValues"},{"page5type":"FourValues"},{"page5type":"FourValues2"},{"page4type":"WindRoseFlex"}] }, { "name": "page5value3", @@ -1174,7 +1284,7 @@ "capabilities": { "obp60":"true" }, - "condition":[{"page5type":"ThreeValues"},{"page5type":"FourValues"},{"page5type":"FourValues2"}] + "condition":[{"page5type":"ThreeValues"},{"page5type":"FourValues"},{"page5type":"FourValues2"},{"page5type":"WindRoseFlex"}] }, { "name": "page5value4", @@ -1186,7 +1296,31 @@ "capabilities": { "obp60":"true" }, - "condition":[{"page5type":"FourValues"},{"page5type":"FourValues2"}] + "condition":[{"page5type":"FourValues"},{"page5type":"FourValues2"},{"page5type":"WindRoseFlex"}] + }, + { + "name": "page5value5", + "label": "Field 5", + "type": "boatData", + "default": "", + "description": "The display for field 5", + "category": "OBP60 Page 5", + "capabilities": { + "obp60":"true" + }, + "condition":[{"page5type":"WindRoseFlex"}] + }, + { + "name": "page5value6", + "label": "Field 6", + "type": "boatData", + "default": "", + "description": "The display for field 6", + "category": "OBP60 Page 5", + "capabilities": { + "obp60":"true" + }, + "condition":[{"page5type":"WindRoseFlex"}] }, { "name": "page6type", @@ -1194,7 +1328,7 @@ "type": "list", "default": "FourValues", "description": "Type of page for page 6", - "list":["OneValue","TwoValues","ThreeValues","FourValues","FourValues2","ApparentWind","WindRose","Voltage","DST810","Clock","WhitePage","BME280","RudderPosition","KeelPosition","Battery","Battery2","RollPitch","Solar","Generator","Autobahn"], + "list":["OneValue","TwoValues","ThreeValues","FourValues","FourValues2","ApparentWind","WindRose","WindRoseFlex","Voltage","DST810","Clock","WhitePage","BME280","RudderPosition","KeelPosition","Battery","Battery2","RollPitch","Solar","Generator","Autobahn"], "category": "OBP60 Page 6", "capabilities": { "obp60":"true" @@ -1211,7 +1345,7 @@ "capabilities": { "obp60":"true" }, - "condition":[{"page6type":"OneValue"},{"page6type":"TwoValues"},{"page6type":"ThreeValues"},{"page6type":"FourValues"},{"page6type":"FourValues2"}] + "condition":[{"page6type":"OneValue"},{"page6type":"TwoValues"},{"page6type":"ThreeValues"},{"page6type":"FourValues"},{"page6type":"FourValues2"},{"page6type":"WindRoseFlex"}] }, { "name": "page6value2", @@ -1223,7 +1357,7 @@ "capabilities": { "obp60":"true" }, - "condition":[{"page6type":"TwoValues"},{"page6type":"ThreeValues"},{"page6type":"FourValues"},{"page6type":"FourValues2"}] + "condition":[{"page6type":"TwoValues"},{"page6type":"ThreeValues"},{"page6type":"FourValues"},{"page6type":"FourValues2"},{"page6type":"WindRoseFlex"}] }, { "name": "page6value3", @@ -1235,7 +1369,7 @@ "capabilities": { "obp60":"true" }, - "condition":[{"page6type":"ThreeValues"},{"page6type":"FourValues"},{"page6type":"FourValues2"}] + "condition":[{"page6type":"ThreeValues"},{"page6type":"FourValues"},{"page6type":"FourValues2"},{"page6type":"WindRoseFlex"}] }, { "name": "page6value4", @@ -1247,7 +1381,31 @@ "capabilities": { "obp60":"true" }, - "condition":[{"page6type":"FourValues"},{"page6type":"FourValues2"}] + "condition":[{"page6type":"FourValues"},{"page6type":"FourValues2"},{"page6type":"WindRoseFlex"}] + }, + { + "name": "page6value5", + "label": "Field 5", + "type": "boatData", + "default": "", + "description": "The display for field 5", + "category": "OBP60 Page 6", + "capabilities": { + "obp60":"true" + }, + "condition":[{"page6type":"WindRoseFlex"}] + }, + { + "name": "page6value6", + "label": "Field 6", + "type": "boatData", + "default": "", + "description": "The display for field 6", + "category": "OBP60 Page 6", + "capabilities": { + "obp60":"true" + }, + "condition":[{"page6type":"WindRoseFlex"}] }, { "name": "page7type", @@ -1255,7 +1413,7 @@ "type": "list", "default": "FourValues2", "description": "Type of page for page 7", - "list":["OneValue","TwoValues","ThreeValues","FourValues","FourValues2","ApparentWind","WindRose","Voltage","DST810","Clock","WhitePage","BME280","RudderPosition","KeelPosition","Battery","Battery2","RollPitch","Solar","Generator","Autobahn"], + "list":["OneValue","TwoValues","ThreeValues","FourValues","FourValues2","ApparentWind","WindRose","WindRoseFlex","Voltage","DST810","Clock","WhitePage","BME280","RudderPosition","KeelPosition","Battery","Battery2","RollPitch","Solar","Generator","Autobahn"], "category": "OBP60 Page 7", "capabilities": { "obp60":"true" @@ -1272,7 +1430,7 @@ "capabilities": { "obp60":"true" }, - "condition":[{"page7type":"OneValue"},{"page7type":"TwoValues"},{"page7type":"ThreeValues"},{"page7type":"FourValues"},{"page7type":"FourValues2"}] + "condition":[{"page7type":"OneValue"},{"page7type":"TwoValues"},{"page7type":"ThreeValues"},{"page7type":"FourValues"},{"page7type":"FourValues2"},{"page7type":"WindRoseFlex"}] }, { "name": "page7value2", @@ -1284,7 +1442,7 @@ "capabilities": { "obp60":"true" }, - "condition":[{"page7type":"TwoValues"},{"page7type":"ThreeValues"},{"page7type":"FourValues"},{"page7type":"FourValues2"}] + "condition":[{"page7type":"TwoValues"},{"page7type":"ThreeValues"},{"page7type":"FourValues"},{"page7type":"FourValues2"},{"page7type":"WindRoseFlex"}] }, { "name": "page7value3", @@ -1296,7 +1454,7 @@ "capabilities": { "obp60":"true" }, - "condition":[{"page7type":"ThreeValues"},{"page7type":"FourValues"},{"page7type":"FourValues2"}] + "condition":[{"page7type":"ThreeValues"},{"page7type":"FourValues"},{"page7type":"FourValues2"},{"page7type":"WindRoseFlex"}] }, { "name": "page7value4", @@ -1308,7 +1466,31 @@ "capabilities": { "obp60":"true" }, - "condition":[{"page7type":"FourValues"},{"page7type":"FourValues2"}] + "condition":[{"page7type":"FourValues"},{"page7type":"FourValues2"},{"page7type":"WindRoseFlex"}] + }, + { + "name": "page7value5", + "label": "Field 5", + "type": "boatData", + "default": "", + "description": "The display for field 5", + "category": "OBP60 Page 7", + "capabilities": { + "obp60":"true" + }, + "condition":[{"page7type":"WindRoseFlex"}] + }, + { + "name": "page7value6", + "label": "Field 6", + "type": "boatData", + "default": "", + "description": "The display for field 6", + "category": "OBP60 Page 7", + "capabilities": { + "obp60":"true" + }, + "condition":[{"page7type":"WindRoseFlex"}] }, { "name": "page8type", @@ -1316,7 +1498,7 @@ "type": "list", "default": "Clock", "description": "Type of page for page 8", - "list":["OneValue","TwoValues","ThreeValues","FourValues","FourValues2","ApparentWind","WindRose","Voltage","DST810","Clock","WhitePage","BME280","RudderPosition","KeelPosition","Battery","Battery2","RollPitch","Solar","Generator","Autobahn"], + "list":["OneValue","TwoValues","ThreeValues","FourValues","FourValues2","ApparentWind","WindRose","WindRoseFlex","Voltage","DST810","Clock","WhitePage","BME280","RudderPosition","KeelPosition","Battery","Battery2","RollPitch","Solar","Generator","Autobahn"], "category": "OBP60 Page 8", "capabilities": { "obp60":"true" @@ -1333,7 +1515,7 @@ "capabilities": { "obp60":"true" }, - "condition":[{"page8type":"OneValue"},{"page8type":"TwoValues"},{"page8type":"ThreeValues"},{"page8type":"FourValues"},{"page8type":"FourValues2"}] + "condition":[{"page8type":"OneValue"},{"page8type":"TwoValues"},{"page8type":"ThreeValues"},{"page8type":"FourValues"},{"page8type":"FourValues2"},{"page8type":"WindRoseFlex"}] }, { "name": "page8value2", @@ -1345,7 +1527,7 @@ "capabilities": { "obp60":"true" }, - "condition":[{"page8type":"TwoValues"},{"page8type":"ThreeValues"},{"page8type":"FourValues"},{"page8type":"FourValues2"}] + "condition":[{"page8type":"TwoValues"},{"page8type":"ThreeValues"},{"page8type":"FourValues"},{"page8type":"FourValues2"},{"page8type":"WindRoseFlex"}] }, { "name": "page8value3", @@ -1357,7 +1539,7 @@ "capabilities": { "obp60":"true" }, - "condition":[{"page8type":"ThreeValues"},{"page8type":"FourValues"},{"page8type":"FourValues2"}] + "condition":[{"page8type":"ThreeValues"},{"page8type":"FourValues"},{"page8type":"FourValues2"},{"page8type":"WindRoseFlex"}] }, { "name": "page8value4", @@ -1369,7 +1551,31 @@ "capabilities": { "obp60":"true" }, - "condition":[{"page8type":"FourValues"},{"page8type":"FourValues2"}] + "condition":[{"page8type":"FourValues"},{"page8type":"FourValues2"},{"page88type":"WindRoseFlex"}] + }, + { + "name": "page8value5", + "label": "Field 5", + "type": "boatData", + "default": "", + "description": "The display for field 5", + "category": "OBP60 Page 8", + "capabilities": { + "obp60":"true" + }, + "condition":[{"page8type":"WindRoseFlex"}] + }, + { + "name": "page8value6", + "label": "Field 6", + "type": "boatData", + "default": "", + "description": "The display for field 6", + "category": "OBP60 Page 8", + "capabilities": { + "obp60":"true" + }, + "condition":[{"page8type":"WindRoseFlex"}] }, { "name": "page9type", @@ -1377,7 +1583,7 @@ "type": "list", "default": "RollPitch", "description": "Type of page for page 9", - "list":["OneValue","TwoValues","ThreeValues","FourValues","FourValues2","ApparentWind","WindRose","Voltage","DST810","Clock","WhitePage","BME280","RudderPosition","KeelPosition","Battery","Battery2","RollPitch","Solar","Generator","Autobahn"], + "list":["OneValue","TwoValues","ThreeValues","FourValues","FourValues2","ApparentWind","WindRose","WindRoseFlex","Voltage","DST810","Clock","WhitePage","BME280","RudderPosition","KeelPosition","Battery","Battery2","RollPitch","Solar","Generator","Autobahn"], "category": "OBP60 Page 9", "capabilities": { "obp60":"true" @@ -1394,7 +1600,7 @@ "capabilities": { "obp60":"true" }, - "condition":[{"page9type":"OneValue"},{"page9type":"TwoValues"},{"page9type":"ThreeValues"},{"page9type":"FourValues"},{"page9type":"FourValues2"}] + "condition":[{"page9type":"OneValue"},{"page9type":"TwoValues"},{"page9type":"ThreeValues"},{"page9type":"FourValues"},{"page9type":"FourValues2"},{"page9type":"WindRoseFlex"}] }, { "name": "page9value2", @@ -1406,7 +1612,7 @@ "capabilities": { "obp60":"true" }, - "condition":[{"page9type":"TwoValues"},{"page9type":"ThreeValues"},{"page9type":"FourValues"},{"page9type":"FourValues2"}] + "condition":[{"page9type":"TwoValues"},{"page9type":"ThreeValues"},{"page9type":"FourValues"},{"page9type":"FourValues2"},{"page9type":"WindRoseFlex"}] }, { "name": "page9value3", @@ -1418,7 +1624,7 @@ "capabilities": { "obp60":"true" }, - "condition":[{"page9type":"ThreeValues"},{"page9type":"FourValues"},{"page9type":"FourValues2"}] + "condition":[{"page9type":"ThreeValues"},{"page9type":"FourValues"},{"page9type":"FourValues2"},{"page9type":"WindRoseFlex"}] }, { "name": "page9value4", @@ -1430,7 +1636,31 @@ "capabilities": { "obp60":"true" }, - "condition":[{"page9type":"FourValues"},{"page9type":"FourValues2"}] + "condition":[{"page9type":"FourValues"},{"page9type":"FourValues2"},{"page9type":"WindRoseFlex"}] + }, + { + "name": "page9value5", + "label": "Field 5", + "type": "boatData", + "default": "", + "description": "The display for field 5", + "category": "OBP60 Page 9", + "capabilities": { + "obp60":"true" + }, + "condition":[{"page9type":"WindRoseFlex"}] + }, + { + "name": "page9value6", + "label": "Field 6", + "type": "boatData", + "default": "", + "description": "The display for field 6", + "category": "OBP60 Page 9", + "capabilities": { + "obp60":"true" + }, + "condition":[{"page9type":"WindRoseFlex"}] }, { "name": "page10type", @@ -1438,7 +1668,7 @@ "type": "list", "default": "Battery2", "description": "Type of page for page 10", - "list":["OneValue","TwoValues","ThreeValues","FourValues","FourValues2","ApparentWind","WindRose","Voltage","DST810","Clock","WhitePage","BME280","RudderPosition","KeelPosition","Battery","Battery2","RollPitch","Solar","Generator","Autobahn"], + "list":["OneValue","TwoValues","ThreeValues","FourValues","FourValues2","ApparentWind","WindRose","WindRoseFlex","Voltage","DST810","Clock","WhitePage","BME280","RudderPosition","KeelPosition","Battery","Battery2","RollPitch","Solar","Generator","Autobahn"], "category": "OBP60 Page 10", "capabilities": { "obp60":"true" @@ -1455,7 +1685,7 @@ "capabilities": { "obp60":"true" }, - "condition":[{"page10type":"OneValue"},{"page10type":"TwoValues"},{"page10type":"ThreeValues"},{"page10type":"FourValues"},{"page10type":"FourValues2"}] + "condition":[{"page10type":"OneValue"},{"page10type":"TwoValues"},{"page10type":"ThreeValues"},{"page10type":"FourValues"},{"page10type":"FourValues2"},{"page10type":"WindRoseFlex"}] }, { "name": "page10value2", @@ -1467,7 +1697,7 @@ "capabilities": { "obp60":"true" }, - "condition":[{"page10type":"TwoValues"},{"page10type":"ThreeValues"},{"page10type":"FourValues"},{"page10type":"FourValues2"}] + "condition":[{"page10type":"TwoValues"},{"page10type":"ThreeValues"},{"page10type":"FourValues"},{"page10type":"FourValues2"},{"page10type":"WindRoseFlex"}] }, { "name": "page10value3", @@ -1479,7 +1709,7 @@ "capabilities": { "obp60":"true" }, - "condition":[{"page10type":"ThreeValues"},{"page10type":"FourValues"},{"page10type":"FourValues2"}] + "condition":[{"page10type":"ThreeValues"},{"page10type":"FourValues"},{"page10type":"FourValues2"},{"page10type":"WindRoseFlex"}] }, { "name": "page10value4", @@ -1491,6 +1721,30 @@ "capabilities": { "obp60":"true" }, - "condition":[{"page10type":"FourValues"},{"page10type":"FourValues2"}] - } + "condition":[{"page10type":"FourValues"},{"page10type":"FourValues2"},{"page10type":"WindRoseFlex"}] + }, + { + "name": "page10value5", + "label": "Field 5", + "type": "boatData", + "default": "", + "description": "The display for field 5", + "category": "OBP60 Page 10", + "capabilities": { + "obp60":"true" + }, + "condition":[{"page10type":"WindRoseFlex"}] + }, + { + "name": "page10value6", + "label": "Field 6", + "type": "boatData", + "default": "", + "description": "The display for field 6", + "category": "OBP60 Page 10", + "capabilities": { + "obp60":"true" + }, + "condition":[{"page10type":"WindRoseFlex"}] + } ] diff --git a/lib/obp60task/obp60task.cpp b/lib/obp60task/obp60task.cpp index 62714eb..9922e88 100644 --- a/lib/obp60task/obp60task.cpp +++ b/lib/obp60task/obp60task.cpp @@ -216,6 +216,8 @@ void registerAllPages(PageList &list){ list.add(®isterPageApparentWind); extern PageDescription registerPageWindRose; list.add(®isterPageWindRose); + extern PageDescription registerPageWindRoseFlex; + list.add(®isterPageWindRoseFlex); // extern PageDescription registerPageVoltage; list.add(®isterPageVoltage); extern PageDescription registerPageDST810; @@ -289,6 +291,8 @@ void underVoltageDetection(GwApi *api){ // OBP60 Task //#################################################################################### void OBP60Task(GwApi *api){ +// vTaskDelete(NULL); +// return; GwLog *logger=api->getLogger(); GwConfigHandler *config=api->getConfig(); startLedTask(api); @@ -430,6 +434,7 @@ void OBP60Task(GwApi *api){ uint brightness = 2.55 * uint(api->getConfig()->getConfigItem(api->getConfig()->blBrightness,true)->asInt()); bool uvoltage = api->getConfig()->getConfigItem(api->getConfig()->underVoltage,true)->asBoolean(); String cpuspeed = api->getConfig()->getConfigItem(api->getConfig()->cpuSpeed,true)->asString(); + uint hdopAccuracy = uint(api->getConfig()->getConfigItem(api->getConfig()->hdopAccuracy,true)->asInt()); // refreshmode defined in init section // displaycolor defined in init section @@ -496,11 +501,11 @@ void OBP60Task(GwApi *api){ commonData.data.maxpage = numPages; // If GPS fix then LED off (HDOP) - if(String(gpsFix) == "GPS Fix Lost" && date->valid == true){ + if(String(gpsFix) == "GPS Fix Lost" && hdop->value <= hdopAccuracy && hdop->valid == true){ setFlashLED(false); } // If missing GPS fix then LED on - if(String(gpsFix) == "GPS Fix Lost" && date->valid == false){ + if((String(gpsFix) == "GPS Fix Lost" && hdop->value > hdopAccuracy && hdop->valid == true) || (String(gpsFix) == "GPS Fix Lost" && hdop->valid == false)){ setFlashLED(true); } diff --git a/lib/obp60task/platformio.ini b/lib/obp60task/platformio.ini index d5b04a1..dc919a9 100644 --- a/lib/obp60task/platformio.ini +++ b/lib/obp60task/platformio.ini @@ -36,10 +36,10 @@ lib_deps = signetica/SunRise@2.0.2 build_flags= #https://thingpulse.com/usb-settings-for-logging-with-the-esp32-s3-in-platformio/?srsltid=AfmBOopGskbkr4GoeVkNlFaZXe_zXkLceKF6Rn-tmoXABCeAR2vWsdHL - -D ARDUINO_USB_MODE=1 #0=OTG (to implement other external devices), 1=CDC (is a serial device) - -D ARDUINO_USB_CDC_ON_BOOT=1 #0=JTAG, 1=CDC (serial device) - -D CORE_DEBUG_LEVEL=1 #Debug level for CPU core via CDC (seral device) - -D TIME=$UNIX_TIME #Set PC time for RTC (only settable via VSC) +# -D ARDUINO_USB_MODE=1 #0=OTG (to implement other external devices), 1=CDC (is a serial device) +# -D ARDUINO_USB_CDC_ON_BOOT=1 #0=JTAG, 1=CDC (serial device) +# -D CORE_DEBUG_LEVEL=1 #Debug level for CPU core via CDC (seral device) +# -D TIME=$UNIX_TIME #Set PC time for RTC (only settable via VSC) -D DISABLE_DIAGNOSTIC_OUTPUT #Disable diagnostic output for GxEPD2 lib -D BOARD_OBP60S3 #Board OBP60 V2.1 with ESP32S3 # -D HARDWARE_V20 #Hardware revision V2.0