diff --git a/lib/obp60task/PageFourValues.cpp b/lib/obp60task/PageFourValues.cpp index 5797f55..23fe5d7 100644 --- a/lib/obp60task/PageFourValues.cpp +++ b/lib/obp60task/PageFourValues.cpp @@ -5,6 +5,11 @@ class PageFourValues : public Page { + private: + static constexpr int8_t LEFT = 0; + static constexpr int8_t CENTER = 1; + static constexpr int8_t RIGHT = 2; + public: PageFourValues(CommonData &common){ commonData = &common; @@ -24,6 +29,9 @@ class PageFourValues : public Page GwConfigHandler *config = commonData->config; GwLog *logger = commonData->logger; + int valueX, valueY; + int DsegFontSize; + // Old values for hold function static String svalue1old = ""; static String unit1old = ""; @@ -35,11 +43,9 @@ class PageFourValues : public Page static String unit4old = ""; // Get config data - String lengthformat = config->getString(config->lengthFormat); - // bool simulation = config->getBool(config->useSimuData); bool holdvalues = config->getBool(config->holdvalues); String flashLED = config->getString(config->flashLED); - String backlightMode = config->getString(config->backlight); + bool smallDecimals = config->getBool(config->smallDecimals); // Get boat values #1 GwApi::BoatValue *bvalue1 = pageData.values[0]; // First element in list (only one value by PageOneValue) @@ -104,7 +110,7 @@ class PageFourValues : public Page // Show unit getdisplay().setFont(&Ubuntu_Bold8pt8b); - getdisplay().setCursor(20, 65); + getdisplay().setCursor(20, 67); if(holdvalues == false){ getdisplay().print(unit1); // Unit } @@ -113,25 +119,32 @@ class PageFourValues : public Page } // Switch font if format for any values + valueX = 380; if(bvalue1->getFormat() == "formatLatitude" || bvalue1->getFormat() == "formatLongitude"){ + valueY = 55; + DsegFontSize = 12; getdisplay().setFont(&Ubuntu_Bold12pt8b); getdisplay().setCursor(120, 55); } else if(bvalue1->getFormat() == "formatTime" || bvalue1->getFormat() == "formatDate"){ + valueY = 67; + DsegFontSize = 20; getdisplay().setFont(&Ubuntu_Bold12pt8b); getdisplay().setCursor(150, 58); } else{ + valueY = 67; + DsegFontSize = 20; getdisplay().setFont(&DSEG7Classic_BoldItalic20pt7b); getdisplay().setCursor(180, 65); } // Show bus data if(holdvalues == false){ - getdisplay().print(svalue1); // Real value as formated string + printBoatValue(svalue1, valueX, valueY, RIGHT, DsegFontSize, smallDecimals); // Real value as formated string } else{ - getdisplay().print(svalue1old); // Old value as formated string + printBoatValue(svalue1old, valueX, valueY, RIGHT, DsegFontSize, smallDecimals); // Real value as formated string } if(valid1 == true){ svalue1old = svalue1; // Save the old value @@ -152,7 +165,7 @@ class PageFourValues : public Page // Show unit getdisplay().setFont(&Ubuntu_Bold8pt8b); - getdisplay().setCursor(20, 133); + getdisplay().setCursor(20, 135); if(holdvalues == false){ getdisplay().print(unit2); // Unit } @@ -162,24 +175,30 @@ class PageFourValues : public Page // Switch font if format for any values if(bvalue2->getFormat() == "formatLatitude" || bvalue2->getFormat() == "formatLongitude"){ + valueY = 123; + DsegFontSize = 12; getdisplay().setFont(&Ubuntu_Bold12pt8b); getdisplay().setCursor(120, 123); } else if(bvalue2->getFormat() == "formatTime" || bvalue2->getFormat() == "formatDate"){ + valueY = 135; + DsegFontSize = 20; getdisplay().setFont(&Ubuntu_Bold12pt8b); getdisplay().setCursor(150, 123); } else{ + valueY = 135; + DsegFontSize = 20; getdisplay().setFont(&DSEG7Classic_BoldItalic20pt7b); getdisplay().setCursor(180, 133); } // Show bus data if(holdvalues == false){ - getdisplay().print(svalue2); // Real value as formated string + printBoatValue(svalue2, valueX, valueY, RIGHT, DsegFontSize, smallDecimals); // Real value as formated string } else{ - getdisplay().print(svalue2old); // Old value as formated string + printBoatValue(svalue2old, valueX, valueY, RIGHT, DsegFontSize, smallDecimals); // Real value as formated string } if(valid2 == true){ svalue2old = svalue2; // Save the old value @@ -200,7 +219,7 @@ class PageFourValues : public Page // Show unit getdisplay().setFont(&Ubuntu_Bold8pt8b); - getdisplay().setCursor(20, 201); + getdisplay().setCursor(20, 203); if(holdvalues == false){ getdisplay().print(unit3); // Unit } @@ -210,24 +229,30 @@ class PageFourValues : public Page // Switch font if format for any values if(bvalue3->getFormat() == "formatLatitude" || bvalue3->getFormat() == "formatLongitude"){ + valueY = 191; + DsegFontSize = 16; getdisplay().setFont(&Ubuntu_Bold12pt8b); getdisplay().setCursor(120, 191); } else if(bvalue3->getFormat() == "formatTime" || bvalue3->getFormat() == "formatDate"){ + valueY = 203; + DsegFontSize = 20; getdisplay().setFont(&Ubuntu_Bold12pt8b); getdisplay().setCursor(150, 191); } else{ + valueY = 203; + DsegFontSize = 20; getdisplay().setFont(&DSEG7Classic_BoldItalic20pt7b); getdisplay().setCursor(180, 201); } // Show bus data if(holdvalues == false){ - getdisplay().print(svalue3); // Real value as formated string + printBoatValue(svalue3, valueX, valueY, RIGHT, DsegFontSize, smallDecimals); // Real value as formated string } else{ - getdisplay().print(svalue3old); // Old value as formated string + printBoatValue(svalue3old, valueX, valueY, RIGHT, DsegFontSize, smallDecimals); // Real value as formated string } if(valid3 == true){ svalue3old = svalue3; // Save the old value @@ -248,7 +273,7 @@ class PageFourValues : public Page // Show unit getdisplay().setFont(&Ubuntu_Bold8pt8b); - getdisplay().setCursor(20, 269); + getdisplay().setCursor(20, 271); if(holdvalues == false){ getdisplay().print(unit4); // Unit } @@ -258,24 +283,30 @@ class PageFourValues : public Page // Switch font if format for any values if(bvalue4->getFormat() == "formatLatitude" || bvalue4->getFormat() == "formatLongitude"){ + valueY = 271; + DsegFontSize = 16; getdisplay().setFont(&Ubuntu_Bold12pt8b); getdisplay().setCursor(120, 259); } else if(bvalue4->getFormat() == "formatTime" || bvalue4->getFormat() == "formatDate"){ + valueY = 271; + DsegFontSize = 20; getdisplay().setFont(&Ubuntu_Bold12pt8b); getdisplay().setCursor(150, 259); } else{ + valueY = 271; + DsegFontSize = 20; getdisplay().setFont(&DSEG7Classic_BoldItalic20pt7b); getdisplay().setCursor(180, 269); } // Show bus data if(holdvalues == false){ - getdisplay().print(svalue4); // Real value as formated string + printBoatValue(svalue4, valueX, valueY, RIGHT, DsegFontSize, smallDecimals); // Real value as formated string } else{ - getdisplay().print(svalue4old); // Old value as formated string + printBoatValue(svalue4old, valueX, valueY, RIGHT, DsegFontSize, smallDecimals); // Real value as formated string } if(valid4 == true){ svalue4old = svalue4; // Save the old value diff --git a/lib/obp60task/PageFourValues2.cpp b/lib/obp60task/PageFourValues2.cpp index 63b0045..af1edcf 100644 --- a/lib/obp60task/PageFourValues2.cpp +++ b/lib/obp60task/PageFourValues2.cpp @@ -5,6 +5,11 @@ class PageFourValues2 : public Page { + private: + static constexpr int8_t LEFT = 0; + static constexpr int8_t CENTER = 1; + static constexpr int8_t RIGHT = 2; + public: PageFourValues2(CommonData &common){ commonData = &common; @@ -24,6 +29,9 @@ class PageFourValues2 : public Page GwConfigHandler *config = commonData->config; GwLog *logger = commonData->logger; + int valueX, valueY; + int DsegFontSize; + // Old values for hold function static String svalue1old = ""; static String unit1old = ""; @@ -35,11 +43,9 @@ class PageFourValues2 : public Page static String unit4old = ""; // Get config data - String lengthformat = config->getString(config->lengthFormat); - // bool simulation = config->getBool(config->useSimuData); bool holdvalues = config->getBool(config->holdvalues); String flashLED = config->getString(config->flashLED); - String backlightMode = config->getString(config->backlight); + bool smallDecimals = config->getBool(config->smallDecimals); // Get boat values #1 GwApi::BoatValue *bvalue1 = pageData.values[0]; // First element in list (only one value by PageOneValue) @@ -113,25 +119,32 @@ class PageFourValues2 : public Page } // Switch font if format for any values + valueX = 380; if(bvalue1->getFormat() == "formatLatitude" || bvalue1->getFormat() == "formatLongitude"){ + valueY = 90; + DsegFontSize = 20; getdisplay().setFont(&Ubuntu_Bold12pt8b); getdisplay().setCursor(100, 90); } else if(bvalue1->getFormat() == "formatTime" || bvalue1->getFormat() == "formatDate"){ + valueY = 80; + DsegFontSize = 20; getdisplay().setFont(&Ubuntu_Bold12pt8b); getdisplay().setCursor(180, 77); } else{ + valueY = 90; + DsegFontSize = 30; getdisplay().setFont(&DSEG7Classic_BoldItalic30pt7b); getdisplay().setCursor(180, 90); } // Show bus data if(holdvalues == false){ - getdisplay().print(svalue1); // Real value as formated string + printBoatValue(svalue1, valueX, valueY, RIGHT, DsegFontSize, smallDecimals); // Real value as formated string } else{ - getdisplay().print(svalue1old); // Old value as formated string + printBoatValue(svalue1old, valueX, valueY, RIGHT, DsegFontSize, smallDecimals); // Real value as formated string } if(valid1 == true){ svalue1old = svalue1; // Save the old value @@ -162,24 +175,30 @@ class PageFourValues2 : public Page // Switch font if format for any values if(bvalue2->getFormat() == "formatLatitude" || bvalue2->getFormat() == "formatLongitude"){ + valueY = 180; + DsegFontSize = 20; getdisplay().setFont(&Ubuntu_Bold12pt8b); getdisplay().setCursor(100, 180); } else if(bvalue2->getFormat() == "formatTime" || bvalue2->getFormat() == "formatDate"){ + valueY = 170; + DsegFontSize = 20; getdisplay().setFont(&Ubuntu_Bold12pt8b); getdisplay().setCursor(180, 158); } else{ + valueY = 180; + DsegFontSize = 30; getdisplay().setFont(&DSEG7Classic_BoldItalic30pt7b); getdisplay().setCursor(180, 180); } // Show bus data if(holdvalues == false){ - getdisplay().print(svalue2); // Real value as formated string + printBoatValue(svalue2, valueX, valueY, RIGHT, DsegFontSize, smallDecimals); // Real value as formated string } else{ - getdisplay().print(svalue2old); // Old value as formated string + printBoatValue(svalue2old, valueX, valueY, RIGHT, DsegFontSize, smallDecimals); // Real value as formated string } if(valid2 == true){ svalue2old = svalue2; // Save the old value @@ -194,13 +213,13 @@ class PageFourValues2 : public Page // ############### Value 3 ################ // Show name - getdisplay().setFont(&Ubuntu_Bold12pt8b); - getdisplay().setCursor(20, 220); + getdisplay().setFont(&Ubuntu_Bold16pt8b); + getdisplay().setCursor(20, 223); getdisplay().print(name3); // Page name // Show unit - getdisplay().setFont(&Ubuntu_Bold8pt8b); - getdisplay().setCursor(20, 240); + getdisplay().setFont(&Ubuntu_Bold10pt8b); + getdisplay().setCursor(20, 270); if(holdvalues == false){ getdisplay().print(unit3); // Unit } @@ -209,25 +228,32 @@ class PageFourValues2 : public Page } // Switch font if format for any values + valueX = 190; if(bvalue3->getFormat() == "formatLatitude" || bvalue3->getFormat() == "formatLongitude"){ + valueY = 250; + DsegFontSize = 10; getdisplay().setFont(&Ubuntu_Bold8pt8b); getdisplay().setCursor(50, 240); } else if(bvalue3->getFormat() == "formatTime" || bvalue3->getFormat() == "formatDate"){ + valueY = 253; + DsegFontSize = 10; getdisplay().setFont(&Ubuntu_Bold8pt8b); getdisplay().setCursor(100, 240); } else{ + valueY = 270; + DsegFontSize = 20; getdisplay().setFont(&DSEG7Classic_BoldItalic20pt7b); getdisplay().setCursor(80, 270); } // Show bus data if(holdvalues == false){ - getdisplay().print(svalue3); // Real value as formated string + printBoatValue(svalue3, valueX, valueY, RIGHT, DsegFontSize, smallDecimals); // Real value as formated string } else{ - getdisplay().print(svalue3old); // Old value as formated string + printBoatValue(svalue3old, valueX, valueY, RIGHT, DsegFontSize, smallDecimals); // Real value as formated string } if(valid3 == true){ svalue3old = svalue3; // Save the old value @@ -242,13 +268,13 @@ class PageFourValues2 : public Page // ############### Value 4 ################ // Show name - getdisplay().setFont(&Ubuntu_Bold12pt8b); - getdisplay().setCursor(220, 220); + getdisplay().setFont(&Ubuntu_Bold16pt8b); + getdisplay().setCursor(220, 223); getdisplay().print(name4); // Page name // Show unit - getdisplay().setFont(&Ubuntu_Bold8pt8b); - getdisplay().setCursor(220, 240); + getdisplay().setFont(&Ubuntu_Bold10pt8b); + getdisplay().setCursor(220, 270); if(holdvalues == false){ getdisplay().print(unit4); // Unit } @@ -257,25 +283,32 @@ class PageFourValues2 : public Page } // Switch font if format for any values + valueX = 390; if(bvalue4->getFormat() == "formatLatitude" || bvalue4->getFormat() == "formatLongitude"){ + valueY = 250; + DsegFontSize = 10; getdisplay().setFont(&Ubuntu_Bold8pt8b); getdisplay().setCursor(250, 240); } else if(bvalue4->getFormat() == "formatTime" || bvalue4->getFormat() == "formatDate"){ + valueY = 253; + DsegFontSize = 10; getdisplay().setFont(&Ubuntu_Bold8pt8b); getdisplay().setCursor(300, 240); } else{ + valueY = 270; + DsegFontSize = 20; getdisplay().setFont(&DSEG7Classic_BoldItalic20pt7b); getdisplay().setCursor(280, 270); } // Show bus data if(holdvalues == false){ - getdisplay().print(svalue4); // Real value as formated string + printBoatValue(svalue4, valueX, valueY, RIGHT, DsegFontSize, smallDecimals); // Real value as formated string } else{ - getdisplay().print(svalue4old); // Old value as formated string + printBoatValue(svalue4old, valueX, valueY, RIGHT, DsegFontSize, smallDecimals); // Real value as formated string } if(valid4 == true){ svalue4old = svalue4; // Save the old value diff --git a/lib/obp60task/PageOneValue.cpp b/lib/obp60task/PageOneValue.cpp index b8fd90e..73e8dbc 100644 --- a/lib/obp60task/PageOneValue.cpp +++ b/lib/obp60task/PageOneValue.cpp @@ -72,11 +72,7 @@ private: nameFnt = &Ubuntu_Bold20pt8b; unitX = 10; unitY = 121; - // unitXoff = -295; - //unitXoff = -280; - //unitYoff = 21; unitFnt = &Ubuntu_Bold12pt8b; - // value1Xoff = 111; valueXoff = 0; valueYoff = -119; valueFontSize1 = 12; @@ -143,6 +139,8 @@ public: { commonData = &common; logger = commonData->logger; + GwConfigHandler *config = commonData->config; + LOG_DEBUG(GwLog::LOG, "Instantiate PageOneValue"); width = getdisplay().width(); // Screen width @@ -150,7 +148,7 @@ public: getdisplay().setTextWrap(false); // Get config data - useSimuData = commonData->config->getBool(commonData->config->useSimuData); + useSimuData = config->getBool(config->useSimuData); holdValues = commonData->config->getBool(commonData->config->holdvalues); flashLED = commonData->config->getString(commonData->config->flashLED); smallDecimals = commonData->config->getBool(commonData->config->smallDecimals); @@ -264,12 +262,13 @@ public: // Get boat value for page GwApi::BoatValue* bValue1 = pageData.values[0]; // Page boat data element +#ifdef BOARD_OBP60S3 // Optical warning by limit violation (unused) if (String(flashLED) == "Limit Violation") { setBlinkingLED(false); setFlashLED(false); } - +#endif if (bValue1 == NULL) return PAGE_OK; // no data, no page to display @@ -280,13 +279,13 @@ public: displaySetPartialWindow(0, 0, width, height); // Set partial update - if (dataChart) { // Check only if dataChart object exist^s at all + if (dataChart) { // Check only if dataChart object exists at all if (!dataChart->isValid()) { dataChart->init(); // try late initialization if chart object could not be properly initialized earlier due to missing boat data } } - if (pageMode == VALUE || dataHstryBuf == nullptr) { + if (pageMode == VALUE || dataChart == nullptr) { // show only data value; ignore other pageMode options if no chart supported boat data history buffer is available showData(bValue1, FULL); diff --git a/lib/obp60task/PageThreeValues.cpp b/lib/obp60task/PageThreeValues.cpp index 404015b..6099977 100644 --- a/lib/obp60task/PageThreeValues.cpp +++ b/lib/obp60task/PageThreeValues.cpp @@ -5,6 +5,11 @@ class PageThreeValues : public Page { + private: + static constexpr int8_t LEFT = 0; + static constexpr int8_t CENTER = 1; + static constexpr int8_t RIGHT = 2; + public: PageThreeValues(CommonData &common){ commonData = &common; @@ -24,6 +29,9 @@ class PageThreeValues : public Page GwConfigHandler *config = commonData->config; GwLog *logger = commonData->logger; + int valueX, valueY; + int DsegFontSize; + // Old values for hold function static String svalue1old = ""; static String unit1old = ""; @@ -33,11 +41,10 @@ class PageThreeValues : public Page static String unit3old = ""; // Get config data - String lengthformat = config->getString(config->lengthFormat); // bool simulation = config->getBool(config->useSimuData); bool holdvalues = config->getBool(config->holdvalues); String flashLED = config->getString(config->flashLED); - String backlightMode = config->getString(config->backlight); + bool smallDecimals = config->getBool(config->smallDecimals); // Get boat values #1 GwApi::BoatValue *bvalue1 = pageData.values[0]; // First element in list (only one value by PageOneValue) @@ -101,25 +108,26 @@ class PageThreeValues : public Page } // Switch font if format for any values + valueX = 380; if(bvalue1->getFormat() == "formatLatitude" || bvalue1->getFormat() == "formatLongitude"){ - getdisplay().setFont(&Ubuntu_Bold20pt8b); - getdisplay().setCursor(50, 90); + valueY = 90; + DsegFontSize = 20; } else if(bvalue1->getFormat() == "formatTime" || bvalue1->getFormat() == "formatDate"){ - getdisplay().setFont(&Ubuntu_Bold20pt8b); - getdisplay().setCursor(170, 68); + valueY = 80; + DsegFontSize = 20; } else{ - getdisplay().setFont(&DSEG7Classic_BoldItalic30pt7b); - getdisplay().setCursor(180, 90); + valueY = 90; + DsegFontSize = 30; } // Show bus data if(holdvalues == false){ - getdisplay().print(svalue1); // Real value as formated string + printBoatValue(svalue1, valueX, valueY, RIGHT, DsegFontSize, smallDecimals); // Real value as formated string } else{ - getdisplay().print(svalue1old); // Old value as formated string + printBoatValue(svalue1old, valueX, valueY, RIGHT, DsegFontSize, smallDecimals); // Old value as formated string } if(valid1 == true){ svalue1old = svalue1; // Save the old value @@ -150,24 +158,30 @@ class PageThreeValues : public Page // Switch font if format for any values if(bvalue2->getFormat() == "formatLatitude" || bvalue2->getFormat() == "formatLongitude"){ + valueY = 180; + DsegFontSize = 20; getdisplay().setFont(&Ubuntu_Bold20pt8b); getdisplay().setCursor(50, 180); } else if(bvalue2->getFormat() == "formatTime" || bvalue2->getFormat() == "formatDate"){ + valueY = 170; + DsegFontSize = 20; getdisplay().setFont(&Ubuntu_Bold20pt8b); getdisplay().setCursor(170, 158); } else{ + valueY = 180; + DsegFontSize = 30; getdisplay().setFont(&DSEG7Classic_BoldItalic30pt7b); getdisplay().setCursor(180, 180); } // Show bus data if(holdvalues == false){ - getdisplay().print(svalue2); // Real value as formated string + printBoatValue(svalue2, valueX, valueY, RIGHT, DsegFontSize, smallDecimals); // Real value as formated string } else{ - getdisplay().print(svalue2old); // Old value as formated string + printBoatValue(svalue2old, valueX, valueY, RIGHT, DsegFontSize, smallDecimals); // Real value as formated string } if(valid2 == true){ svalue2old = svalue2; // Save the old value @@ -198,24 +212,24 @@ class PageThreeValues : public Page // Switch font if format for any values if(bvalue3->getFormat() == "formatLatitude" || bvalue3->getFormat() == "formatLongitude"){ - getdisplay().setFont(&Ubuntu_Bold20pt8b); - getdisplay().setCursor(50, 270); + valueY = 270; + DsegFontSize = 20; } else if(bvalue3->getFormat() == "formatTime" || bvalue3->getFormat() == "formatDate"){ - getdisplay().setFont(&Ubuntu_Bold20pt8b); - getdisplay().setCursor(170, 248); + valueY = 260; + DsegFontSize = 20; } else{ - getdisplay().setFont(&DSEG7Classic_BoldItalic30pt7b); - getdisplay().setCursor(180, 270); + valueY = 270; + DsegFontSize = 30; } // Show bus data if(holdvalues == false){ - getdisplay().print(svalue3); // Real value as formated string + printBoatValue(svalue3, valueX, valueY, RIGHT, DsegFontSize, smallDecimals); // Real value as formated string } else{ - getdisplay().print(svalue3old); // Old value as formated string + printBoatValue(svalue3old, valueX, valueY, RIGHT, DsegFontSize, smallDecimals); // Real value as formated string } if(valid3 == true){ svalue3old = svalue3; // Save the old value diff --git a/lib/obp60task/PageTwoValues.cpp b/lib/obp60task/PageTwoValues.cpp index bc580e0..815e988 100644 --- a/lib/obp60task/PageTwoValues.cpp +++ b/lib/obp60task/PageTwoValues.cpp @@ -34,8 +34,11 @@ private: bool useSimuData; bool holdValues; String flashLED; - String backlightMode; - String tempFormat; + bool smallDecimals; + + static constexpr int8_t LEFT = 0; + static constexpr int8_t CENTER = 1; + static constexpr int8_t RIGHT = 2; // Data buffer pointer (owned by HstryBuffers) static constexpr int NUMVALUES = 2; // two data values in this page @@ -49,8 +52,10 @@ private: // display data values in display [FULL|HALF] void showData(const std::vector& bValue, DisplayMode mode) { - getdisplay().setTextColor(commonData->fgcolor); + int valueX, valueY; + int DsegFontSize; + getdisplay().setTextColor(commonData->fgcolor); int numValues = bValue.size(); // do we have to handle 1 or 2 values? for (int i = 0; i < numValues; i++) { @@ -78,22 +83,23 @@ private: } // Switch font depending on value format and adjust position + valueX = 380; if (bValue[i]->getFormat() == "formatLatitude" || bValue[i]->getFormat() == "formatLongitude") { - getdisplay().setFont(&Ubuntu_Bold20pt8b); - getdisplay().setCursor(50, 125 + yOffset); + valueY = 125 + yOffset; + DsegFontSize = 20; } else if (bValue[i]->getFormat() == "formatTime" || bValue[i]->getFormat() == "formatDate") { - getdisplay().setFont(&Ubuntu_Bold20pt8b); - getdisplay().setCursor(170, 105 + yOffset); + valueY = 105 + yOffset; + DsegFontSize = 20; } else { // Default font for other formats - getdisplay().setFont(&DSEG7Classic_BoldItalic42pt7b); - getdisplay().setCursor(180, 125 + yOffset); + valueY = 125 + yOffset; + DsegFontSize = 42; } // Show bus data if (!holdValues || useSimuData) { - getdisplay().print(sValue); // Real value as formated string + printBoatValue(sValue, valueX, valueY, RIGHT, DsegFontSize, smallDecimals); } else { - getdisplay().print(sValueOld[i]); // Old value as formated string + printBoatValue(sValueOld[i], valueX, valueY, RIGHT, DsegFontSize, smallDecimals); } if (valid == true) { @@ -116,14 +122,13 @@ public: width = getdisplay().width(); // Screen width height = getdisplay().height(); // Screen height + getdisplay().setTextWrap(false); // Get config data - // lengthformat = commonData->config->getString(commonData->config->lengthFormat); useSimuData = commonData->config->getBool(commonData->config->useSimuData); holdValues = commonData->config->getBool(commonData->config->holdvalues); flashLED = commonData->config->getString(commonData->config->flashLED); - backlightMode = commonData->config->getString(commonData->config->backlight); - tempFormat = commonData->config->getString(commonData->config->tempFormat); // [K|°C|°F] + smallDecimals = commonData->config->getBool(commonData->config->smallDecimals); } virtual void setupKeys() @@ -255,12 +260,13 @@ public: bValue.push_back(pageData.values[0]); // Page boat data element 1 bValue.push_back(pageData.values[1]); // Page boat data element 2 +#ifdef BOARD_OBP60S3 // Optical warning by limit violation (unused) if (String(flashLED) == "Limit Violation") { setBlinkingLED(false); setFlashLED(false); } - +#endif if (bValue[0] == NULL && bValue[1] == NULL) return PAGE_OK; // no data, no page to display @@ -273,12 +279,14 @@ public: displaySetPartialWindow(0, 0, width, height); // Set partial update for (int i = 0; i < NUMVALUES; i++) { - if (!dataChart[i]->isValid()) { - dataChart[i]->init(); // try late initialization if chart object could not be properly initialized earlier due to missing boat data + if (dataChart[i]) { // Check only if dataChart object exists at all + if (!dataChart[i]->isValid()) { + dataChart[i]->init(); // try late initialization if chart object could not be properly initialized earlier due to missing boat data + } } } - - if (pageMode == VALUES || (dataHstryBuf[0] == nullptr && dataHstryBuf[1] == nullptr)) { + + if (pageMode == VALUES || (dataChart[0] == nullptr && dataChart[1] == nullptr)) { // show only data value; ignore other pageMode options if no chart supported boat data history buffer is available showData(bValue, FULL);