From a129d865c964db4cb233cf2f70505730e0c8f4fc Mon Sep 17 00:00:00 2001 From: wellenvogel Date: Tue, 10 Dec 2024 19:16:11 +0100 Subject: [PATCH 01/11] warn the user if page translation is enabled for cibuild --- webinstall/cibuild.html | 4 ++-- webinstall/cibuild.js | 22 ++++++++++++++++++++++ 2 files changed, 24 insertions(+), 2 deletions(-) diff --git a/webinstall/cibuild.html b/webinstall/cibuild.html index 4f41c1a..78ce76d 100644 --- a/webinstall/cibuild.html +++ b/webinstall/cibuild.html @@ -1,5 +1,5 @@ - + @@ -83,4 +83,4 @@ - \ No newline at end of file + diff --git a/webinstall/cibuild.js b/webinstall/cibuild.js index 26443b0..690da1d 100644 --- a/webinstall/cibuild.js +++ b/webinstall/cibuild.js @@ -867,5 +867,27 @@ class PipelineInfo{ buildSelectors(ROOT_PATH,structure.config.children,true); if (! isRunning()) findPipeline(); updateStatus(); + const translationCheck=()=>{ + const lang = document.documentElement.lang; + if (lang != "en"){ + alert( + "This page will not work correctly with translation enabled" + ); + } + } + // Works at least for Chrome, Firefox, Safari and probably more. Not Microsoft + // Edge though. They're special. + // Yell at clouds if a translator doesn't change it + const observer = new MutationObserver(() => { + translationCheck(); + }); + observer.observe(document.documentElement, { + attributes: true, + attributeFilter: ['lang'], + childList: false, + characterData: false, + }); + translationCheck(); + } })(); \ No newline at end of file From e4af7cf731cad3b66d2b5173717a86b9a2550e0c Mon Sep 17 00:00:00 2001 From: Thomas Hooge Date: Fri, 10 Jan 2025 19:41:55 +0100 Subject: [PATCH 02/11] Move page number, swipe and lock indicator to header --- lib/obp60task/OBP60Extensions.cpp | 19 ++++--- lib/obp60task/OBP60Extensions.h | 20 +++++++- lib/obp60task/PageApparentWind.cpp | 40 ++++++--------- lib/obp60task/PageBME280.cpp | 36 ++++++------- lib/obp60task/PageBattery.cpp | 56 +++++++++----------- lib/obp60task/PageBattery2.cpp | 60 ++++++++++------------ lib/obp60task/PageClock.cpp | 69 +++++++++++-------------- lib/obp60task/PageDST810.cpp | 50 ++++++++---------- lib/obp60task/PageFluid.cpp | 66 +++++++++++------------- lib/obp60task/PageFourValues.cpp | 48 ++++++++--------- lib/obp60task/PageFourValues2.cpp | 48 ++++++++--------- lib/obp60task/PageGenerator.cpp | 34 +++++------- lib/obp60task/PageKeelPosition.cpp | 55 +++++++++----------- lib/obp60task/PageOneValue.cpp | 33 +++++------- lib/obp60task/PageRollPitch.cpp | 62 ++++++++++------------ lib/obp60task/PageRudderPosition.cpp | 48 ++++++++--------- lib/obp60task/PageSolar.cpp | 35 +++++-------- lib/obp60task/PageThreeValues.cpp | 42 +++++++-------- lib/obp60task/PageTwoValues.cpp | 32 ++++++------ lib/obp60task/PageVoltage.cpp | 73 ++++++++++++-------------- lib/obp60task/PageWhite.cpp | 16 +++--- lib/obp60task/PageWindRose.cpp | 77 +++++++++++++--------------- lib/obp60task/PageWindRoseFlex.cpp | 77 +++++++++++++--------------- lib/obp60task/PageXTETrack.cpp | 51 +++++++++--------- lib/obp60task/Pagedata.h | 7 ++- lib/obp60task/obp60task.cpp | 5 +- 26 files changed, 527 insertions(+), 632 deletions(-) diff --git a/lib/obp60task/OBP60Extensions.cpp b/lib/obp60task/OBP60Extensions.cpp index 2fa4bc6..85393e1 100644 --- a/lib/obp60task/OBP60Extensions.cpp +++ b/lib/obp60task/OBP60Extensions.cpp @@ -314,16 +314,23 @@ void displayHeader(CommonData &commonData, GwApi::BoatValue *date, GwApi::BoatVa usbRxOld = commonData.status.usbRx; usbTxOld = commonData.status.usbTx; + // Display key lock status + if (commonData.keylock) { + getdisplay().drawXBitmap(150, 1, lock_bits, icon_width, icon_height, commonData.fgcolor); + } else { + getdisplay().drawXBitmap(150, 1, swipe_bits, icon_width, icon_height, commonData.fgcolor); + } + + // Current page number in a small box + getdisplay().setFont(&Ubuntu_Bold8pt7b); + getdisplay().drawRect(170, 2, 20, 15, textcolor); + drawTextCenter(179, 9, String(commonData.data.actpage)); + // Heartbeat as dot getdisplay().setTextColor(textcolor); getdisplay().setFont(&Ubuntu_Bold32pt7b); getdisplay().setCursor(205, 14); - if(heartbeat == true){ - getdisplay().print("."); - } - else{ - getdisplay().print(" "); - } + getdisplay().print(heartbeat ? "." : " "); heartbeat = !heartbeat; // Date and time diff --git a/lib/obp60task/OBP60Extensions.h b/lib/obp60task/OBP60Extensions.h index 5ab4caa..effeddd 100644 --- a/lib/obp60task/OBP60Extensions.h +++ b/lib/obp60task/OBP60Extensions.h @@ -9,6 +9,8 @@ // FRAM address reservations 32kB: 0x0000 - 0x7FFF // 0x0000 - 0x03ff: single variables +#define FRAM_PAGE_NO 0x0002 +// Voltage page #define FRAM_VOLTAGE_AVG 0x000A #define FRAM_VOLTAGE_TREND 0x000B #define FRAM_VOLTAGE_MODE 0x000C @@ -19,7 +21,7 @@ extern Adafruit_FRAM_I2C fram; extern bool hasFRAM; -// Fonts declarations for display (#inclues see OBP60Extensions.cpp) +// Fonts declarations for display (#includes see OBP60Extensions.cpp) extern const GFXfont Ubuntu_Bold8pt7b; extern const GFXfont Ubuntu_Bold10pt7b; extern const GFXfont Ubuntu_Bold12pt7b; @@ -32,7 +34,21 @@ extern const GFXfont DSEG7Classic_BoldItalic30pt7b; extern const GFXfont DSEG7Classic_BoldItalic42pt7b; extern const GFXfont DSEG7Classic_BoldItalic60pt7b; -// Gloabl functions +// Icons +#define icon_width 16 +#define icon_height 16 + +static unsigned char swipe_bits[] PROGMEM = { + 0x80, 0x03, 0xe0, 0x06, 0xb0, 0x0a, 0xa8, 0x0a, 0xa8, 0x0a, 0xa8, 0x3a, + 0x28, 0x28, 0x08, 0x28, 0x08, 0x28, 0x08, 0x26, 0x08, 0x21, 0x08, 0x10, + 0x10, 0x08, 0x10, 0x04, 0x10, 0x04, 0x00, 0x00 }; + +static unsigned char lock_bits[] PROGMEM = { + 0xc0, 0x03, 0x60, 0x06, 0x30, 0x0c, 0x10, 0x08, 0x10, 0x08, 0x10, 0x08, + 0xfc, 0x3f, 0x04, 0x20, 0x04, 0x20, 0x84, 0x21, 0x84, 0x21, 0x84, 0x21, + 0x04, 0x20, 0x04, 0x20, 0x04, 0x20, 0xfc, 0x3f }; + +// Global functions #ifdef DISPLAY_GDEW042T2 GxEPD2_BW & getdisplay(); #endif diff --git a/lib/obp60task/PageApparentWind.cpp b/lib/obp60task/PageApparentWind.cpp index 50be31c..6f0713b 100644 --- a/lib/obp60task/PageApparentWind.cpp +++ b/lib/obp60task/PageApparentWind.cpp @@ -5,12 +5,12 @@ class PageApparentWind : public Page { -bool keylock = false; // Keylock int16_t lp = 80; // Pointer length public: PageApparentWind(CommonData &common){ - common.logger->logDebug(GwLog::LOG,"Show PageApparentWind"); + commonData = &common; + common.logger->logDebug(GwLog::LOG,"Instantiate PageApparentWind"); } // Key functions @@ -33,18 +33,18 @@ public: return 0; // Commit the key } - // Keylock function - if(key == 11){ // Code for keylock - keylock = !keylock; // Toggle keylock + // Code for keylock + if(key == 11){ + commonData->keylock = !commonData->keylock; return 0; // Commit the key } return key; } - virtual void displayPage(CommonData &commonData, PageData &pageData) + virtual void displayPage(PageData &pageData) { - GwConfigHandler *config = commonData.config; - GwLog *logger=commonData.logger; + GwConfigHandler *config = commonData->config; + GwLog *logger = commonData->logger; static String svalue1old = ""; static String unit1old = ""; @@ -64,8 +64,8 @@ public: 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 - 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 + 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 // Get boat values for AWD GwApi::BoatValue *bvalue2 = pageData.values[1]; // First element in list (only one value by PageOneValue) @@ -73,8 +73,8 @@ public: 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 + 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 // Optical warning by limit violation (unused) if(String(flashLED) == "Limit Violation"){ @@ -92,7 +92,7 @@ public: // Set display in partial refresh mode getdisplay().setPartialWindow(0, 0, getdisplay().width(), getdisplay().height()); // Set partial update - getdisplay().setTextColor(commonData.fgcolor); + getdisplay().setTextColor(commonData->fgcolor); // Show values AWS getdisplay().setFont(&Ubuntu_Bold20pt7b); @@ -139,8 +139,8 @@ public: static int16_t y2 = y0; //Draw instrument - getdisplay().fillCircle(x0, y0, lp + 5, commonData.fgcolor); - getdisplay().fillCircle(x0, y0, lp + 1, commonData.bgcolor); + getdisplay().fillCircle(x0, y0, lp + 5, commonData->fgcolor); + getdisplay().fillCircle(x0, y0, lp + 1, commonData->bgcolor); // Calculation end point of pointer value2 = value2 - 3.14 / 2; @@ -148,22 +148,16 @@ public: y1 = y0 + sin(value2) * lp * 0.6; x2 = x0 + cos(value2) * lp; y2 = y0 + sin(value2) * lp; - getdisplay().drawLine(x1, y1, x2, y2, commonData.fgcolor); + getdisplay().drawLine(x1, y1, x2, y2, commonData->fgcolor); // Key Layout getdisplay().setFont(&Ubuntu_Bold8pt7b); - if(keylock == false){ - getdisplay().setCursor(130, 290); - getdisplay().print("[ <<<< " + String(commonData.data.actpage) + "/" + String(commonData.data.maxpage) + " >>>> ]"); + if(commonData->keylock == false){ 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) diff --git a/lib/obp60task/PageBME280.cpp b/lib/obp60task/PageBME280.cpp index d7893d2..3b68de6 100644 --- a/lib/obp60task/PageBME280.cpp +++ b/lib/obp60task/PageBME280.cpp @@ -5,24 +5,24 @@ class PageBME280 : public Page { - bool keylock = false; // Keylock - public: PageBME280(CommonData &common){ - common.logger->logDebug(GwLog::LOG,"Show PageBME280"); + commonData = &common; + common.logger->logDebug(GwLog::LOG,"Instantiate PageBME280"); } virtual int handleKey(int key){ - if(key == 11){ // Code for keylock - keylock = !keylock; // Toggle keylock + // Code for keylock + if(key == 11){ + commonData->keylock = !commonData->keylock; return 0; // Commit the key } return key; } - virtual void displayPage(CommonData &commonData, PageData &pageData){ - GwConfigHandler *config = commonData.config; - GwLog *logger=commonData.logger; + virtual void displayPage(PageData &pageData){ + GwConfigHandler *config = commonData->config; + GwLog *logger = commonData->logger; double value1 = 0; double value2 = 0; @@ -42,7 +42,7 @@ class PageBME280 : public Page String name1 = "Temp"; // Value name name1 = name1.substring(0, 6); // String length limit for value name if(simulation == false){ - value1 = commonData.data.airTemperature; // Value as double in SI unit + value1 = commonData->data.airTemperature; // Value as double in SI unit } else{ value1 = 23.0 + float(random(0, 10)) / 10.0; @@ -60,7 +60,7 @@ class PageBME280 : public Page String name2 = "Humid"; // Value name name2 = name2.substring(0, 6); // String length limit for value name if(simulation == false){ - value2 = commonData.data.airHumidity; // Value as double in SI unit + value2 = commonData->data.airHumidity; // Value as double in SI unit } else{ value2 = 43 + float(random(0, 4)); @@ -78,7 +78,7 @@ class PageBME280 : public Page String name3 = "Press"; // Value name name3 = name3.substring(0, 6); // String length limit for value name if(simulation == false){ - value3 = commonData.data.airPressure; // Value as double in SI unit + value3 = commonData->data.airPressure; // Value as double in SI unit } else{ value3 = 1006 + float(random(0, 5)); @@ -107,7 +107,7 @@ class PageBME280 : public Page // Set display in partial refresh mode getdisplay().setPartialWindow(0, 0, getdisplay().width(), getdisplay().height()); // Set partial update - getdisplay().setTextColor(commonData.fgcolor); + getdisplay().setTextColor(commonData->fgcolor); // ############### Value 1 ################ @@ -131,7 +131,7 @@ class PageBME280 : public Page // ############### Horizontal Line ################ // Horizontal line 3 pix - getdisplay().fillRect(0, 105, 400, 3, commonData.fgcolor); + getdisplay().fillRect(0, 105, 400, 3, commonData->fgcolor); // ############### Value 2 ################ @@ -155,7 +155,7 @@ class PageBME280 : public Page // ############### Horizontal Line ################ // Horizontal line 3 pix - getdisplay().fillRect(0, 195, 400, 3, commonData.fgcolor); + getdisplay().fillRect(0, 195, 400, 3, commonData->fgcolor); // ############### Value 3 ################ @@ -180,18 +180,12 @@ class PageBME280 : public Page // Key Layout getdisplay().setFont(&Ubuntu_Bold8pt7b); - if(keylock == false){ - getdisplay().setCursor(130, 290); - getdisplay().print("[ <<<< " + String(commonData.data.actpage) + "/" + String(commonData.data.maxpage) + " >>>> ]"); + if(commonData->keylock == false){ 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) diff --git a/lib/obp60task/PageBattery.cpp b/lib/obp60task/PageBattery.cpp index 6322981..1b12d93 100644 --- a/lib/obp60task/PageBattery.cpp +++ b/lib/obp60task/PageBattery.cpp @@ -5,12 +5,12 @@ class PageBattery : public Page { - bool keylock = false; // Keylock int average = 0; // Average type [0...3], 0=off, 1=10s, 2=60s, 3=300s public: PageBattery(CommonData &common){ - common.logger->logDebug(GwLog::LOG,"Show PageBattery"); + commonData = &common; + common.logger->logDebug(GwLog::LOG,"Instantiate PageBattery"); } virtual int handleKey(int key){ @@ -23,15 +23,15 @@ class PageBattery : public Page // Code for keylock if(key == 11){ - keylock = !keylock; // Toggle keylock + commonData->keylock = !commonData->keylock; return 0; // Commit the key } return key; } - virtual void displayPage(CommonData &commonData, PageData &pageData){ - GwConfigHandler *config = commonData.config; - GwLog *logger=commonData.logger; + virtual void displayPage(PageData &pageData){ + GwConfigHandler *config = commonData->config; + GwLog *logger = commonData->logger; // Old values for hold function double value1 = 0; @@ -58,19 +58,19 @@ class PageBattery : public Page // Switch average values switch (average) { case 0: - value1 = commonData.data.batteryVoltage; // Live data + value1 = commonData->data.batteryVoltage; // Live data break; case 1: - value1 = commonData.data.batteryVoltage10; // Average 10s + value1 = commonData->data.batteryVoltage10; // Average 10s break; case 2: - value1 = commonData.data.batteryVoltage60; // Average 60s + value1 = commonData->data.batteryVoltage60; // Average 60s break; case 3: - value1 = commonData.data.batteryVoltage300; // Average 300s + value1 = commonData->data.batteryVoltage300; // Average 300s break; default: - value1 = commonData.data.batteryVoltage; // Default + value1 = commonData->data.batteryVoltage; // Default break; } } @@ -87,19 +87,19 @@ class PageBattery : public Page if(String(powsensor1) == "INA219" || String(powsensor1) == "INA226"){ switch (average) { case 0: - value2 = commonData.data.batteryCurrent; // Live data + value2 = commonData->data.batteryCurrent; // Live data break; case 1: - value2 = commonData.data.batteryCurrent10; // Average 10s + value2 = commonData->data.batteryCurrent10; // Average 10s break; case 2: - value2 = commonData.data.batteryCurrent60; // Average 60s + value2 = commonData->data.batteryCurrent60; // Average 60s break; case 3: - value2 = commonData.data.batteryCurrent300; // Average 300s + value2 = commonData->data.batteryCurrent300; // Average 300s break; default: - value2 = commonData.data.batteryCurrent; // Default + value2 = commonData->data.batteryCurrent; // Default break; } } @@ -116,19 +116,19 @@ class PageBattery : public Page if(String(powsensor1) == "INA219" || String(powsensor1) == "INA226"){ switch (average) { case 0: - value3 = commonData.data.batteryPower; // Live data + value3 = commonData->data.batteryPower; // Live data break; case 1: - value3 = commonData.data.batteryPower10; // Average 10s + value3 = commonData->data.batteryPower10; // Average 10s break; case 2: - value3 = commonData.data.batteryPower60; // Average 60s + value3 = commonData->data.batteryPower60; // Average 60s break; case 3: - value3 = commonData.data.batteryPower300; // Average 300s + value3 = commonData->data.batteryPower300; // Average 300s break; default: - value3 = commonData.data.batteryPower; // Default + value3 = commonData->data.batteryPower; // Default break; } } @@ -156,7 +156,7 @@ class PageBattery : public Page getdisplay().setPartialWindow(0, 0, getdisplay().width(), getdisplay().height()); // Set partial update // Show average settings - getdisplay().setTextColor(commonData.fgcolor); + getdisplay().setTextColor(commonData->fgcolor); getdisplay().setFont(&Ubuntu_Bold8pt7b); switch (average) { case 0: @@ -228,7 +228,7 @@ class PageBattery : public Page // ############### Horizontal Line ################ // Horizontal line 3 pix - getdisplay().fillRect(0, 105, 400, 3, commonData.fgcolor); + getdisplay().fillRect(0, 105, 400, 3, commonData->fgcolor); // ############### Value 2 ################ @@ -257,7 +257,7 @@ class PageBattery : public Page // ############### Horizontal Line ################ // Horizontal line 3 pix - getdisplay().fillRect(0, 195, 400, 3, commonData.fgcolor); + getdisplay().fillRect(0, 195, 400, 3, commonData->fgcolor); // ############### Value 3 ################ @@ -288,20 +288,14 @@ class PageBattery : public Page // Key Layout getdisplay().setFont(&Ubuntu_Bold8pt7b); - if(keylock == false){ + if(commonData->keylock == false){ getdisplay().setCursor(10, 290); getdisplay().print("[AVG]"); - 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) diff --git a/lib/obp60task/PageBattery2.cpp b/lib/obp60task/PageBattery2.cpp index 8c3bd44..4cb4a40 100644 --- a/lib/obp60task/PageBattery2.cpp +++ b/lib/obp60task/PageBattery2.cpp @@ -7,14 +7,14 @@ class PageBattery2 : public Page { bool init = false; // Marker for init done -bool keylock = false; // Keylock int average = 0; // Average type [0...3], 0=off, 1=10s, 2=60s, 3=300s bool trend = true; // Trend indicator [0|1], 0=off, 1=on double raw = 0; public: PageBattery2(CommonData &common){ - common.logger->logDebug(GwLog::LOG,"Show PageBattery2"); + commonData = &common; + common.logger->logDebug(GwLog::LOG,"Instantiate PageBattery2"); } virtual int handleKey(int key){ // Change average @@ -32,16 +32,16 @@ public: // Code for keylock if(key == 11){ - keylock = !keylock; // Toggle keylock + commonData->keylock = !commonData->keylock; return 0; // Commit the key } return key; } - virtual void displayPage(CommonData &commonData, PageData &pageData) + virtual void displayPage(PageData &pageData) { - GwConfigHandler *config = commonData.config; - GwLog *logger=commonData.logger; + GwConfigHandler *config = commonData->config; + GwLog *logger = commonData->logger; // Polynominal coefficients second order for battery energy level calculation // index 0 = Pb, 1 = Gel, 2 = AGM, 3 = LiFePo4 @@ -71,42 +71,42 @@ public: // Create trend value if(init == false){ // Load start values for first page run - valueTrend = commonData.data.batteryVoltage10; + valueTrend = commonData->data.batteryVoltage10; init = true; } else{ // Reading trend value - valueTrend = commonData.data.batteryVoltage10; + valueTrend = commonData->data.batteryVoltage10; } // Get raw value for trend indicator - raw = commonData.data.batteryVoltage; // Live data + raw = commonData->data.batteryVoltage; // Live data // Switch average values switch (average) { case 0: - value1 = commonData.data.batteryVoltage; // Live data - value2 = commonData.data.batteryCurrent; - value3 = commonData.data.batteryPower; + value1 = commonData->data.batteryVoltage; // Live data + value2 = commonData->data.batteryCurrent; + value3 = commonData->data.batteryPower; break; case 1: - value1 = commonData.data.batteryVoltage10; // Average 10s - value2 = commonData.data.batteryCurrent10; - value3 = commonData.data.batteryPower10; + value1 = commonData->data.batteryVoltage10; // Average 10s + value2 = commonData->data.batteryCurrent10; + value3 = commonData->data.batteryPower10; break; case 2: - value1 = commonData.data.batteryVoltage60; // Average 60s - value2 = commonData.data.batteryCurrent60; - value3 = commonData.data.batteryPower60; + value1 = commonData->data.batteryVoltage60; // Average 60s + value2 = commonData->data.batteryCurrent60; + value3 = commonData->data.batteryPower60; break; case 3: - value1 = commonData.data.batteryVoltage300; // Average 300s - value2 = commonData.data.batteryCurrent300; - value3 = commonData.data.batteryPower300; + value1 = commonData->data.batteryVoltage300; // Average 300s + value2 = commonData->data.batteryCurrent300; + value3 = commonData->data.batteryPower300; break; default: - value1 = commonData.data.batteryVoltage; // Default - value2 = commonData.data.batteryCurrent; - value3 = commonData.data.batteryPower; + value1 = commonData->data.batteryVoltage; // Default + value2 = commonData->data.batteryCurrent; + value3 = commonData->data.batteryPower; break; } bool valid1 = true; @@ -180,7 +180,7 @@ public: // Set display in partial refresh mode getdisplay().setPartialWindow(0, 0, getdisplay().width(), getdisplay().height()); // Set partial update - getdisplay().setTextColor(commonData.fgcolor); + getdisplay().setTextColor(commonData->fgcolor); // Show name getdisplay().setFont(&Ubuntu_Bold20pt7b); @@ -219,7 +219,7 @@ public: getdisplay().print("Battery Type"); // Show battery with fill level - batteryGraphic(150, 45, batPercentage, commonData.fgcolor, commonData.bgcolor); + batteryGraphic(150, 45, batPercentage, commonData->fgcolor, commonData->bgcolor); // Show average settings getdisplay().setFont(&Ubuntu_Bold8pt7b); @@ -330,20 +330,14 @@ public: // Key Layout getdisplay().setFont(&Ubuntu_Bold8pt7b); - if(keylock == false){ + if(commonData->keylock == false){ getdisplay().setCursor(10, 290); getdisplay().print("[AVG]"); - 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) diff --git a/lib/obp60task/PageClock.cpp b/lib/obp60task/PageClock.cpp index c93949b..f99679a 100644 --- a/lib/obp60task/PageClock.cpp +++ b/lib/obp60task/PageClock.cpp @@ -5,27 +5,26 @@ class PageClock : public Page { -bool keylock = false; // Keylock - public: PageClock(CommonData &common){ - common.logger->logDebug(GwLog::LOG,"Show PageClock"); + commonData = &common; + common.logger->logDebug(GwLog::LOG,"Instantiate PageClock"); } // Key functions virtual int handleKey(int key){ - // Keylock function - if(key == 11){ // Code for keylock - keylock = !keylock; // Toggle keylock + // Code for keylock + if(key == 11){ + commonData->keylock = !commonData->keylock; return 0; // Commit the key } return key; } - virtual void displayPage(CommonData &commonData, PageData &pageData) + virtual void displayPage(PageData &pageData) { - GwConfigHandler *config = commonData.config; - GwLog *logger=commonData.logger; + GwConfigHandler *config = commonData->config; + GwLog *logger = commonData->logger; static String svalue1old = ""; static String unit1old = ""; @@ -61,8 +60,8 @@ public: value1 = 38160; // Simulation data for time value 11:36 in seconds } // Other simulation data see OBP60Formater.cpp bool valid1 = bvalue1->valid; // Valid information - 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 + 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 @@ -74,8 +73,8 @@ public: name2 = name2.substring(0, 6); // String length limit for value name 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 + 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 @@ -87,8 +86,8 @@ public: 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 + 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 @@ -110,7 +109,7 @@ public: // Set display in partial refresh mode getdisplay().setPartialWindow(0, 0, getdisplay().width(), getdisplay().height()); // Set partial update - getdisplay().setTextColor(commonData.fgcolor); + getdisplay().setTextColor(commonData->fgcolor); // Show values GPS date getdisplay().setFont(&Ubuntu_Bold8pt7b); @@ -122,7 +121,7 @@ public: getdisplay().print("Date"); // Name // Horizintal separator left - getdisplay().fillRect(0, 149, 60, 3, commonData.fgcolor); + getdisplay().fillRect(0, 149, 60, 3, commonData->fgcolor); // Show values GPS time getdisplay().setFont(&Ubuntu_Bold8pt7b); @@ -136,7 +135,7 @@ public: // Show values sunrise String sunrise = "---"; if(valid1 == true && valid2 == true && valid3 == true){ - sunrise = String(commonData.sundata.sunriseHour) + ":" + String(commonData.sundata.sunriseMinute + 100).substring(1); + sunrise = String(commonData->sundata.sunriseHour) + ":" + String(commonData->sundata.sunriseMinute + 100).substring(1); svalue5old = sunrise; } @@ -149,12 +148,12 @@ public: getdisplay().print("SunR"); // Name // Horizintal separator right - getdisplay().fillRect(340, 149, 80, 3, commonData.fgcolor); + getdisplay().fillRect(340, 149, 80, 3, commonData->fgcolor); // Show values sunset String sunset = "---"; if(valid1 == true && valid2 == true && valid3 == true){ - sunset = String(commonData.sundata.sunsetHour) + ":" + String(commonData.sundata.sunsetMinute + 100).substring(1); + sunset = String(commonData->sundata.sunsetHour) + ":" + String(commonData->sundata.sunsetMinute + 100).substring(1); svalue6old = sunset; } @@ -172,8 +171,8 @@ public: int rInstrument = 110; // Radius of clock float pi = 3.141592; - getdisplay().fillCircle(200, 150, rInstrument + 10, commonData.fgcolor); // Outer circle - getdisplay().fillCircle(200, 150, rInstrument + 7, commonData.bgcolor); // Outer circle + getdisplay().fillCircle(200, 150, rInstrument + 10, commonData->fgcolor); // Outer circle + getdisplay().fillCircle(200, 150, rInstrument + 7, commonData->bgcolor); // Outer circle for(int i=0; i<360; i=i+1) { @@ -214,7 +213,7 @@ public: if(i % 6 == 0){ 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, commonData.fgcolor); + getdisplay().fillCircle((int)x1c, (int)y1c, 2, commonData->fgcolor); sinx=sin(i/180.0*pi); cosx=cos(i/180.0*pi); } @@ -228,10 +227,10 @@ public: 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),commonData.fgcolor); + 200+(int)(cosx*xx1-sinx*yy2),150+(int)(sinx*xx1+cosx*yy2),commonData->fgcolor); 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),commonData.fgcolor); + 200+(int)(cosx*xx2-sinx*yy2),150+(int)(sinx*xx2+cosx*yy2),commonData->fgcolor); } } @@ -270,7 +269,7 @@ public: float yy2 = -(rInstrument * 0.5); 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),commonData.fgcolor); + 200+(int)(cosx*0-sinx*yy2),150+(int)(sinx*0+cosx*yy2),commonData->fgcolor); // Inverted pointer // Pointer as triangle with center base 2*width float endwidth = 2; // End width of pointer @@ -280,7 +279,7 @@ public: 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),commonData.fgcolor); + 200+(int)(cosx*0-sinx*iy2),150+(int)(sinx*0+cosx*iy2),commonData->fgcolor); } // Draw minute pointer @@ -296,7 +295,7 @@ public: 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),commonData.fgcolor); + 200+(int)(cosx*0-sinx*yy2),150+(int)(sinx*0+cosx*yy2),commonData->fgcolor); // Inverted pointer // Pointer as triangle with center base 2*width float endwidth = 2; // End width of pointer @@ -306,28 +305,22 @@ public: 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),commonData.fgcolor); + 200+(int)(cosx*0-sinx*iy2),150+(int)(sinx*0+cosx*iy2),commonData->fgcolor); } // Center circle - getdisplay().fillCircle(200, 150, startwidth + 6, commonData.bgcolor); - getdisplay().fillCircle(200, 150, startwidth + 4, commonData.fgcolor); + getdisplay().fillCircle(200, 150, startwidth + 6, commonData->bgcolor); + getdisplay().fillCircle(200, 150, startwidth + 4, commonData->fgcolor); //******************************************************************************************* // Key Layout getdisplay().setFont(&Ubuntu_Bold8pt7b); - if(keylock == false){ - getdisplay().setCursor(130, 290); - getdisplay().print("[ <<<< " + String(commonData.data.actpage) + "/" + String(commonData.data.maxpage) + " >>>> ]"); + if(commonData->keylock == false){ 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) diff --git a/lib/obp60task/PageDST810.cpp b/lib/obp60task/PageDST810.cpp index 89f6e7b..568e3e2 100644 --- a/lib/obp60task/PageDST810.cpp +++ b/lib/obp60task/PageDST810.cpp @@ -5,24 +5,24 @@ class PageDST810 : public Page { - bool keylock = false; // Keylock - - public: +public: PageDST810(CommonData &common){ - common.logger->logDebug(GwLog::LOG,"Show PageDST810"); + commonData = &common; + common.logger->logDebug(GwLog::LOG,"Instantiate PageDST810"); } virtual int handleKey(int key){ - if(key == 11){ // Code for keylock - keylock = !keylock; // Toggle keylock + // Code for keylock + if(key == 11){ + commonData->keylock = !commonData->keylock; return 0; // Commit the key } return key; } - virtual void displayPage(CommonData &commonData, PageData &pageData){ - GwConfigHandler *config = commonData.config; - GwLog *logger=commonData.logger; + virtual void displayPage(PageData &pageData){ + GwConfigHandler *config = commonData->config; + GwLog *logger = commonData->logger; // Old values for hold function static String svalue1old = ""; @@ -47,8 +47,8 @@ class PageDST810 : public Page 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 - 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 + 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 // Get boat values #2 GwApi::BoatValue *bvalue2 = pageData.values[1]; // Second element in list (only one value by PageOneValue) @@ -56,8 +56,8 @@ class PageDST810 : public Page 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 + 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 // Get boat values #3 GwApi::BoatValue *bvalue3 = pageData.values[2]; // Second element in list (only one value by PageOneValue) @@ -65,8 +65,8 @@ class PageDST810 : public Page 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 + 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 // Get boat values #4 GwApi::BoatValue *bvalue4 = pageData.values[3]; // Second element in list (only one value by PageOneValue) @@ -74,8 +74,8 @@ class PageDST810 : public Page 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 + 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 // Optical warning by limit violation (unused) if(String(flashLED) == "Limit Violation"){ @@ -93,7 +93,7 @@ class PageDST810 : public Page // Set display in partial refresh mode getdisplay().setPartialWindow(0, 0, getdisplay().width(), getdisplay().height()); // Set partial update - getdisplay().setTextColor(commonData.fgcolor); + getdisplay().setTextColor(commonData->fgcolor); // ############### Value 1 ################ @@ -131,7 +131,7 @@ class PageDST810 : public Page // ############### Horizontal Line ################ // Horizontal line 3 pix - getdisplay().fillRect(0, 105, 400, 3, commonData.fgcolor); + getdisplay().fillRect(0, 105, 400, 3, commonData->fgcolor); // ############### Value 2 ################ @@ -169,7 +169,7 @@ class PageDST810 : public Page // ############### Horizontal Line ################ // Horizontal line 3 pix - getdisplay().fillRect(0, 195, 400, 3, commonData.fgcolor); + getdisplay().fillRect(0, 195, 400, 3, commonData->fgcolor); // ############### Value 3 ################ @@ -207,7 +207,7 @@ class PageDST810 : public Page // ############### Vertical Line ################ // Vertical line 3 pix - getdisplay().fillRect(200, 195, 3, 75, commonData.fgcolor); + getdisplay().fillRect(200, 195, 3, 75, commonData->fgcolor); // ############### Value 4 ################ @@ -247,18 +247,12 @@ class PageDST810 : public Page // Key Layout getdisplay().setFont(&Ubuntu_Bold8pt7b); - if(keylock == false){ - getdisplay().setCursor(130, 290); - getdisplay().print("[ <<<< " + String(commonData.data.actpage) + "/" + String(commonData.data.maxpage) + " >>>> ]"); + if(commonData->keylock == false){ 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) diff --git a/lib/obp60task/PageFluid.cpp b/lib/obp60task/PageFluid.cpp index 9d4a092..6c12635 100644 --- a/lib/obp60task/PageFluid.cpp +++ b/lib/obp60task/PageFluid.cpp @@ -57,31 +57,33 @@ static unsigned char gasoline_bits[] = { 0x98, 0xcf, 0x38, 0xe7, 0x78, 0xf0, 0xf8, 0xfa, 0xf8, 0xfa, 0x78, 0xf0, 0x38, 0xe7, 0x98, 0xcf, 0xf8, 0xff, 0xf0, 0x7f }; -class PageFluid : public Page{ - bool keylock = false; // Keylock +class PageFluid : public Page +{ int fluidtype; public: PageFluid(CommonData &common){ + commonData = &common; common.logger->logDebug(GwLog::LOG,"Instantiate PageFluid"); } virtual int handleKey(int key){ - if(key == 11){ // Code for keylock - keylock = !keylock; // Toggle keylock + // Code for keylock + if(key == 11){ + commonData->keylock = !commonData->keylock; return 0; // Commit the key } return key; } - virtual void displayNew(CommonData &commonData, PageData &pageData){ - fluidtype = commonData.config->getInt("page" + String(pageData.pageNumber) + "fluid", 0); - commonData.logger->logDebug(GwLog::LOG,"New PageFluid: fluidtype=%d", fluidtype); + virtual void displayNew(PageData &pageData){ + fluidtype = commonData->config->getInt("page" + String(pageData.pageNumber) + "fluid", 0); + commonData->logger->logDebug(GwLog::LOG,"New PageFluid: fluidtype=%d", fluidtype); } - virtual void displayPage(CommonData &commonData, PageData &pageData){ - GwConfigHandler *config = commonData.config; - GwLog *logger=commonData.logger; + virtual void displayPage(PageData &pageData){ + GwConfigHandler *config = commonData->config; + GwLog *logger = commonData->logger; // Get config data String flashLED = config->getString(config->flashLED); @@ -107,7 +109,7 @@ class PageFluid : public Page{ // Set display in partial refresh mode getdisplay().setPartialWindow(0, 0, getdisplay().width(), getdisplay().height()); - getdisplay().setTextColor(commonData.fgcolor); + getdisplay().setTextColor(commonData->fgcolor); // descriptions getdisplay().setFont(&Ubuntu_Bold12pt7b); @@ -125,11 +127,11 @@ class PageFluid : public Page{ uint8_t r = 110; // circular frame - getdisplay().drawCircle(c.x, c.y, r+5, commonData.fgcolor); - getdisplay().fillCircle(c.x, c.y, r+2, commonData.fgcolor); - getdisplay().fillCircle(c.x, c.y, r-1, commonData.bgcolor); + getdisplay().drawCircle(c.x, c.y, r+5, commonData->fgcolor); + getdisplay().fillCircle(c.x, c.y, r+2, commonData->fgcolor); + getdisplay().fillCircle(c.x, c.y, r-1, commonData->bgcolor); // center of pointer as dot - getdisplay().fillCircle(c.x, c.y, 8, commonData.fgcolor); + getdisplay().fillCircle(c.x, c.y, 8, commonData->fgcolor); // value down centered char buffer[6]; @@ -143,19 +145,19 @@ class PageFluid : public Page{ // draw symbol (as bitmap) switch (fluidtype) { case 0: - getdisplay().drawXBitmap(c.x-8, c.y-50, fuel_bits, fuel_width, fuel_height, commonData.fgcolor); + getdisplay().drawXBitmap(c.x-8, c.y-50, fuel_bits, fuel_width, fuel_height, commonData->fgcolor); break; case 1: - getdisplay().drawXBitmap(c.x-8, c.y-50, water_bits, water_width, water_height, commonData.fgcolor); + getdisplay().drawXBitmap(c.x-8, c.y-50, water_bits, water_width, water_height, commonData->fgcolor); break; case 4: - getdisplay().drawXBitmap(c.x-8, c.y-50, oil_bits, oil_width, oil_height, commonData.fgcolor); + getdisplay().drawXBitmap(c.x-8, c.y-50, oil_bits, oil_width, oil_height, commonData->fgcolor); break; case 5: - getdisplay().drawXBitmap(c.x-8, c.y-50, waste_bits, waste_width, waste_height, commonData.fgcolor); + getdisplay().drawXBitmap(c.x-8, c.y-50, waste_bits, waste_width, waste_height, commonData->fgcolor); break; case 6: - getdisplay().drawXBitmap(c.x-8, c.y-50, gasoline_bits, gasoline_width, gasoline_height, commonData.fgcolor); + getdisplay().drawXBitmap(c.x-8, c.y-50, gasoline_bits, gasoline_width, gasoline_height, commonData->fgcolor); break; } @@ -184,11 +186,11 @@ class PageFluid : public Page{ {c.x + 2, c.y - (r - 16)}, {c.x - 2, c.y - (r - 16)} }; - fillPoly4(rotatePoints(c, pts, -120), commonData.fgcolor); - fillPoly4(rotatePoints(c, pts, -60), commonData.fgcolor); - fillPoly4(rotatePoints(c, pts, 0), commonData.fgcolor); - fillPoly4(rotatePoints(c, pts, 60), commonData.fgcolor); - fillPoly4(rotatePoints(c, pts, 120), commonData.fgcolor); + fillPoly4(rotatePoints(c, pts, -120), commonData->fgcolor); + fillPoly4(rotatePoints(c, pts, -60), commonData->fgcolor); + fillPoly4(rotatePoints(c, pts, 0), commonData->fgcolor); + fillPoly4(rotatePoints(c, pts, 60), commonData->fgcolor); + fillPoly4(rotatePoints(c, pts, 120), commonData->fgcolor); // dots // rotate 0 to 360 in 12 degree steps @@ -197,7 +199,7 @@ class PageFluid : public Page{ continue; } p = rotatePoint(c, {c.x, c.y - r + 10}, angle); - getdisplay().fillCircle(p.x, p.y, 3, commonData.fgcolor); + getdisplay().fillCircle(p.x, p.y, 3, commonData->fgcolor); } // pointer @@ -208,25 +210,19 @@ class PageFluid : public Page{ {c.x + 6, c.y + 15}, {c.x - 6, c.y + 15} }; - fillPoly4(rotatePoints(c, pts, -120 + bvalue1->value * 2.4), commonData.fgcolor); + fillPoly4(rotatePoints(c, pts, -120 + bvalue1->value * 2.4), commonData->fgcolor); // Pointer axis is white - getdisplay().fillCircle(c.x, c.y, 6, commonData.bgcolor); + getdisplay().fillCircle(c.x, c.y, 6, commonData->bgcolor); } // Key Layout getdisplay().setFont(&Ubuntu_Bold8pt7b); - if(keylock == false){ - getdisplay().setCursor(130, 296); - getdisplay().print("[ <<<< " + String(commonData.data.actpage) + "/" + String(commonData.data.maxpage) + " >>>> ]"); + if(commonData->keylock == false){ if(String(backlightMode) == "Control by Key"){ // Key for illumination getdisplay().setCursor(343, 296); getdisplay().print("[ILUM]"); } } - else{ - getdisplay().setCursor(130, 296); - getdisplay().print(" [ Keylock active ]"); - } // Update display getdisplay().nextPage(); // Partial update (fast) diff --git a/lib/obp60task/PageFourValues.cpp b/lib/obp60task/PageFourValues.cpp index 1bad689..e0c418f 100644 --- a/lib/obp60task/PageFourValues.cpp +++ b/lib/obp60task/PageFourValues.cpp @@ -5,24 +5,24 @@ class PageFourValues : public Page { - bool keylock = false; // Keylock - public: PageFourValues(CommonData &common){ - common.logger->logDebug(GwLog::LOG,"Show PageFourValues"); + commonData = &common; + common.logger->logDebug(GwLog::LOG,"Instantiate PageFourValues"); } virtual int handleKey(int key){ - if(key == 11){ // Code for keylock - keylock = !keylock; // Toggle keylock + // Code for keylock + if(key == 11){ + commonData->keylock = !commonData->keylock; return 0; // Commit the key } return key; } - virtual void displayPage(CommonData &commonData, PageData &pageData){ - GwConfigHandler *config = commonData.config; - GwLog *logger=commonData.logger; + virtual void displayPage(PageData &pageData){ + GwConfigHandler *config = commonData->config; + GwLog *logger = commonData->logger; // Old values for hold function static String svalue1old = ""; @@ -47,8 +47,8 @@ class PageFourValues : public Page 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 - 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 + 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 // Get boat values #2 GwApi::BoatValue *bvalue2 = pageData.values[1]; // Second element in list (only one value by PageOneValue) @@ -56,8 +56,8 @@ class PageFourValues : public Page 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 + 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 // Get boat values #3 GwApi::BoatValue *bvalue3 = pageData.values[2]; // Second element in list (only one value by PageOneValue) @@ -65,8 +65,8 @@ class PageFourValues : public Page 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 + 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 // Get boat values #4 GwApi::BoatValue *bvalue4 = pageData.values[3]; // Second element in list (only one value by PageOneValue) @@ -74,8 +74,8 @@ class PageFourValues : public Page 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 + 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 // Optical warning by limit violation (unused) if(String(flashLED) == "Limit Violation"){ @@ -93,7 +93,7 @@ class PageFourValues : public Page // Set display in partial refresh mode getdisplay().setPartialWindow(0, 0, getdisplay().width(), getdisplay().height()); // Set partial update - getdisplay().setTextColor(commonData.fgcolor); + getdisplay().setTextColor(commonData->fgcolor); // ############### Value 1 ################ @@ -141,7 +141,7 @@ class PageFourValues : public Page // ############### Horizontal Line ################ // Horizontal line 3 pix - getdisplay().fillRect(0, 80, 400, 3, commonData.fgcolor); + getdisplay().fillRect(0, 80, 400, 3, commonData->fgcolor); // ############### Value 2 ################ @@ -189,7 +189,7 @@ class PageFourValues : public Page // ############### Horizontal Line ################ // Horizontal line 3 pix - getdisplay().fillRect(0, 146, 400, 3, commonData.fgcolor); + getdisplay().fillRect(0, 146, 400, 3, commonData->fgcolor); // ############### Value 3 ################ @@ -237,7 +237,7 @@ class PageFourValues : public Page // ############### Horizontal Line ################ // Horizontal line 3 pix - getdisplay().fillRect(0, 214, 400, 3, commonData.fgcolor); + getdisplay().fillRect(0, 214, 400, 3, commonData->fgcolor); // ############### Value 4 ################ @@ -287,18 +287,12 @@ class PageFourValues : public Page // Key Layout getdisplay().setFont(&Ubuntu_Bold8pt7b); - if(keylock == false){ - getdisplay().setCursor(130, 290); - getdisplay().print("[ <<<< " + String(commonData.data.actpage) + "/" + String(commonData.data.maxpage) + " >>>> ]"); + if(commonData->keylock == false){ 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) diff --git a/lib/obp60task/PageFourValues2.cpp b/lib/obp60task/PageFourValues2.cpp index c7f5a1a..9f3f07b 100644 --- a/lib/obp60task/PageFourValues2.cpp +++ b/lib/obp60task/PageFourValues2.cpp @@ -5,24 +5,24 @@ class PageFourValues2 : public Page { - bool keylock = false; // Keylock - public: PageFourValues2(CommonData &common){ - common.logger->logDebug(GwLog::LOG,"Show PageFourValues2"); + commonData = &common; + common.logger->logDebug(GwLog::LOG,"Instantiate PageFourValues2"); } virtual int handleKey(int key){ - if(key == 11){ // Code for keylock - keylock = !keylock; // Toggle keylock + // Code for keylock + if(key == 11){ + commonData->keylock = !commonData->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; + virtual void displayPage(PageData &pageData){ + GwConfigHandler *config = commonData->config; + GwLog *logger = commonData->logger; // Old values for hold function static String svalue1old = ""; @@ -47,8 +47,8 @@ class PageFourValues2 : public Page 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 - 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 + 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 // Get boat values #2 GwApi::BoatValue *bvalue2 = pageData.values[1]; // Second element in list (only one value by PageOneValue) @@ -56,8 +56,8 @@ class PageFourValues2 : public Page 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 + 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 // Get boat values #3 GwApi::BoatValue *bvalue3 = pageData.values[2]; // Second element in list (only one value by PageOneValue) @@ -65,8 +65,8 @@ class PageFourValues2 : public Page 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 + 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 // Get boat values #4 GwApi::BoatValue *bvalue4 = pageData.values[3]; // Second element in list (only one value by PageOneValue) @@ -74,8 +74,8 @@ class PageFourValues2 : public Page 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 + 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 // Optical warning by limit violation (unused) if(String(flashLED) == "Limit Violation"){ @@ -93,7 +93,7 @@ class PageFourValues2 : public Page // Set display in partial refresh mode getdisplay().setPartialWindow(0, 0, getdisplay().width(), getdisplay().height()); // Set partial update - getdisplay().setTextColor(commonData.fgcolor); + getdisplay().setTextColor(commonData->fgcolor); // ############### Value 1 ################ @@ -141,7 +141,7 @@ class PageFourValues2 : public Page // ############### Horizontal Line ################ // Horizontal line 3 pix - getdisplay().fillRect(0, 105, 400, 3, commonData.fgcolor); + getdisplay().fillRect(0, 105, 400, 3, commonData->fgcolor); // ############### Value 2 ################ @@ -189,7 +189,7 @@ class PageFourValues2 : public Page // ############### Horizontal Line ################ // Horizontal line 3 pix - getdisplay().fillRect(0, 195, 400, 3, commonData.fgcolor); + getdisplay().fillRect(0, 195, 400, 3, commonData->fgcolor); // ############### Value 3 ################ @@ -237,7 +237,7 @@ class PageFourValues2 : public Page // ############### Vertical Line ################ // Vertical line 3 pix - getdisplay().fillRect(200, 195, 3, 75, commonData.fgcolor); + getdisplay().fillRect(200, 195, 3, 75, commonData->fgcolor); // ############### Value 4 ################ @@ -287,18 +287,12 @@ class PageFourValues2 : public Page // Key Layout getdisplay().setFont(&Ubuntu_Bold8pt7b); - if(keylock == false){ - getdisplay().setCursor(130, 290); - getdisplay().print("[ <<<< " + String(commonData.data.actpage) + "/" + String(commonData.data.maxpage) + " >>>> ]"); + if(commonData->keylock == false){ 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) diff --git a/lib/obp60task/PageGenerator.cpp b/lib/obp60task/PageGenerator.cpp index aa8ac8d..fc0c402 100644 --- a/lib/obp60task/PageGenerator.cpp +++ b/lib/obp60task/PageGenerator.cpp @@ -6,26 +6,24 @@ class PageGenerator : public Page { -bool init = false; // Marker for init done -bool keylock = false; // Keylock - public: PageGenerator(CommonData &common){ - common.logger->logDebug(GwLog::LOG,"Show PageGenerator"); + commonData = &common; + common.logger->logDebug(GwLog::LOG,"Instantiate PageGenerator"); } virtual int handleKey(int key){ // Code for keylock if(key == 11){ - keylock = !keylock; // Toggle keylock + commonData->keylock = !commonData->keylock; return 0; // Commit the key } return key; } - virtual void displayPage(CommonData &commonData, PageData &pageData) + virtual void displayPage(PageData &pageData) { - GwConfigHandler *config = commonData.config; - GwLog *logger=commonData.logger; + GwConfigHandler *config = commonData->config; + GwLog *logger = commonData->logger; // Get config data bool simulation = config->getBool(config->useSimuData); @@ -47,13 +45,13 @@ public: // Get raw value for trend indicator if(powerSensor != "off"){ - value1 = commonData.data.generatorVoltage; // Use voltage from external sensor + value1 = commonData->data.generatorVoltage; // Use voltage from external sensor } else{ - value1 = commonData.data.batteryVoltage; // Use internal voltage sensor + value1 = commonData->data.batteryVoltage; // Use internal voltage sensor } - value2 = commonData.data.generatorCurrent; - value3 = commonData.data.generatorPower; + value2 = commonData->data.generatorCurrent; + value3 = commonData->data.generatorPower; genPercentage = value3 * 100 / (double)genPower; // Load value // Limits for battery level if(genPercentage < 0) genPercentage = 0; @@ -87,7 +85,7 @@ public: // Set display in partial refresh mode getdisplay().setPartialWindow(0, 0, getdisplay().width(), getdisplay().height()); // Set partial update - getdisplay().setTextColor(commonData.fgcolor); + getdisplay().setTextColor(commonData->fgcolor); // Show name getdisplay().setFont(&Ubuntu_Bold20pt7b); @@ -124,7 +122,7 @@ public: getdisplay().print("Power Modul"); // Show generator - generatorGraphic(200, 95, commonData.fgcolor, commonData.bgcolor); + generatorGraphic(200, 95, commonData->fgcolor, commonData->bgcolor); // Show load level in percent getdisplay().setFont(&DSEG7Classic_BoldItalic20pt7b); @@ -207,18 +205,12 @@ public: // Key Layout getdisplay().setFont(&Ubuntu_Bold8pt7b); - if(keylock == false){ - getdisplay().setCursor(130, 290); - getdisplay().print("[ <<<< " + String(commonData.data.actpage) + "/" + String(commonData.data.maxpage) + " >>>> ]"); + if(commonData->keylock == false){ 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) diff --git a/lib/obp60task/PageKeelPosition.cpp b/lib/obp60task/PageKeelPosition.cpp index 1d02c3e..6ecaf61 100644 --- a/lib/obp60task/PageKeelPosition.cpp +++ b/lib/obp60task/PageKeelPosition.cpp @@ -5,27 +5,26 @@ class PageKeelPosition : public Page { -bool keylock = false; // Keylock - public: PageKeelPosition(CommonData &common){ - common.logger->logDebug(GwLog::LOG,"Show PageKeelPosition"); + commonData = &common; + common.logger->logDebug(GwLog::LOG,"Instantiate PageKeelPosition"); } // Key functions virtual int handleKey(int key){ - // Keylock function - if(key == 11){ // Code for keylock - keylock = !keylock; // Toggle keylock + // Code for keylock + if(key == 11){ + commonData->keylock = !commonData->keylock; return 0; // Commit the key } return key; } - virtual void displayPage(CommonData &commonData, PageData &pageData) + virtual void displayPage(PageData &pageData) { - GwConfigHandler *config = commonData.config; - GwLog *logger=commonData.logger; + GwConfigHandler *config = commonData->config; + GwLog *logger = commonData->logger; double value1 = 0; double value1old = 0; @@ -40,9 +39,9 @@ public: String rotfunction = config->getString(config->rotFunction); // Get boat values for Keel position - bool valid1 = commonData.data.validRotAngle; // Valid information + bool valid1 = commonData->data.validRotAngle; // Valid information if(simulation == false && rotsensor == "AS5600" && rotfunction == "Keel"){ - value1 = commonData.data.rotationAngle; // Raw value without unit convertion + value1 = commonData->data.rotationAngle; // Raw value without unit convertion } else{ value1 = 0; @@ -77,9 +76,9 @@ public: int rInstrument = 110; // Radius of KeelPosition float pi = 3.141592; - getdisplay().fillCircle(200, 150, rInstrument + 10, commonData.fgcolor); // Outer circle - getdisplay().fillCircle(200, 150, rInstrument + 7, commonData.bgcolor); // Outer circle - getdisplay().fillRect(0, 30, 400, 122, commonData.bgcolor); // Delete half top circle + getdisplay().fillCircle(200, 150, rInstrument + 10, commonData->fgcolor); // Outer circle + getdisplay().fillCircle(200, 150, rInstrument + 7, commonData->bgcolor); // Outer circle + getdisplay().fillRect(0, 30, 400, 122, commonData->bgcolor); // Delete half top circle for(int i=90; i<=270; i=i+10) { @@ -117,7 +116,7 @@ public: // 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, commonData.fgcolor); + getdisplay().fillCircle((int)x1c, (int)y1c, 2, commonData->fgcolor); float sinx=sin(i/180.0*pi); float cosx=cos(i/180.0*pi); @@ -130,10 +129,10 @@ public: 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),commonData.fgcolor); + 200+(int)(cosx*xx1-sinx*yy2),150+(int)(sinx*xx1+cosx*yy2),commonData->fgcolor); 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),commonData.fgcolor); + 200+(int)(cosx*xx2-sinx*yy2),150+(int)(sinx*xx2+cosx*yy2),commonData->fgcolor); } } @@ -167,7 +166,7 @@ public: float yy2 = -(rInstrument * 0.6); 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),commonData.fgcolor); + 200+(int)(cosx*0-sinx*yy2),150+(int)(sinx*0+cosx*yy2),commonData->fgcolor); // Inverted pointer // Pointer as triangle with center base 2*width float endwidth = 2; // End width of pointer @@ -177,17 +176,17 @@ public: 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),commonData.fgcolor); + 200+(int)(cosx*0-sinx*iy2),150+(int)(sinx*0+cosx*iy2),commonData->fgcolor); // Draw counterweight - getdisplay().fillCircle(200+(int)(cosx*0-sinx*yy2),150+(int)(sinx*0+cosx*yy2), 5, commonData.fgcolor); + getdisplay().fillCircle(200+(int)(cosx*0-sinx*yy2),150+(int)(sinx*0+cosx*yy2), 5, commonData->fgcolor); } // Center circle - getdisplay().fillCircle(200, 140, startwidth + 22, commonData.bgcolor); - getdisplay().fillCircle(200, 140, startwidth + 20, commonData.fgcolor); // Boat circle - getdisplay().fillRect(200 - 30, 140 - 30, 2 * 30, 30, commonData.bgcolor); // Delete half top of boat circle - getdisplay().fillRect(150, 150, 100, 4, commonData.fgcolor); // Water line + getdisplay().fillCircle(200, 140, startwidth + 22, commonData->bgcolor); + getdisplay().fillCircle(200, 140, startwidth + 20, commonData->fgcolor); // Boat circle + getdisplay().fillRect(200 - 30, 140 - 30, 2 * 30, 30, commonData->bgcolor); // Delete half top of boat circle + getdisplay().fillRect(150, 150, 100, 4, commonData->fgcolor); // Water line // Print label getdisplay().setFont(&Ubuntu_Bold16pt7b); @@ -210,18 +209,12 @@ public: //******************************************************************************************* // Key Layout getdisplay().setFont(&Ubuntu_Bold8pt7b); - if(keylock == false){ - getdisplay().setCursor(130, 290); - getdisplay().print("[ <<<< " + String(commonData.data.actpage) + "/" + String(commonData.data.maxpage) + " >>>> ]"); + if(commonData->keylock == false){ 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) diff --git a/lib/obp60task/PageOneValue.cpp b/lib/obp60task/PageOneValue.cpp index 708c611..6910890 100644 --- a/lib/obp60task/PageOneValue.cpp +++ b/lib/obp60task/PageOneValue.cpp @@ -3,25 +3,26 @@ #include "Pagedata.h" #include "OBP60Extensions.h" -class PageOneValue : public Page{ - bool keylock = false; // Keylock - +class PageOneValue : public Page +{ public: PageOneValue(CommonData &common){ - common.logger->logDebug(GwLog::LOG,"Show PageOneValue"); + commonData = &common; + common.logger->logDebug(GwLog::LOG,"Instantiate PageOneValue"); } virtual int handleKey(int key){ - if(key == 11){ // Code for keylock - keylock = !keylock; // Toggle keylock + // Code for keylock + if(key == 11){ + commonData->keylock = !commonData->keylock; return 0; // Commit the key } return key; } - virtual void displayPage(CommonData &commonData, PageData &pageData){ - GwConfigHandler *config = commonData.config; - GwLog *logger=commonData.logger; + virtual void displayPage(PageData &pageData){ + GwConfigHandler *config = commonData->config; + GwLog *logger = commonData->logger; // Old values for hold function static String svalue1old = ""; @@ -40,8 +41,8 @@ class PageOneValue : public Page{ 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 - 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 + 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 // Optical warning by limit violation (unused) if(String(flashLED) == "Limit Violation"){ @@ -60,7 +61,7 @@ class PageOneValue : public Page{ getdisplay().setPartialWindow(0, 0, getdisplay().width(), getdisplay().height()); // Set partial update // Show name - getdisplay().setTextColor(commonData.fgcolor); + getdisplay().setTextColor(commonData->fgcolor); getdisplay().setFont(&Ubuntu_Bold32pt7b); getdisplay().setCursor(20, 100); getdisplay().print(name1); // Page name @@ -103,18 +104,12 @@ class PageOneValue : public Page{ // Key Layout getdisplay().setFont(&Ubuntu_Bold8pt7b); - if(keylock == false){ - getdisplay().setCursor(130, 290); - getdisplay().print("[ <<<< " + String(commonData.data.actpage) + "/" + String(commonData.data.maxpage) + " >>>> ]"); + if(commonData->keylock == false){ 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) diff --git a/lib/obp60task/PageRollPitch.cpp b/lib/obp60task/PageRollPitch.cpp index bb5b0e3..019a3b7 100644 --- a/lib/obp60task/PageRollPitch.cpp +++ b/lib/obp60task/PageRollPitch.cpp @@ -5,27 +5,25 @@ class PageRollPitch : public Page { -bool keylock = false; // Keylock - public: PageRollPitch(CommonData &common){ - common.logger->logDebug(GwLog::LOG,"Show PageRollPitch"); + commonData = &common; + common.logger->logDebug(GwLog::LOG,"Instantiate PageRollPitch"); } // Key functions virtual int handleKey(int key){ - // Keylock function - if(key == 11){ // Code for keylock - keylock = !keylock; // Toggle keylock + // Code for keylock + if(key == 11){ + commonData->keylock = !commonData->keylock; return 0; // Commit the key } return key; } - virtual void displayPage(CommonData &commonData, PageData &pageData) - { - GwConfigHandler *config = commonData.config; - GwLog *logger=commonData.logger; + virtual void displayPage(PageData &pageData){ + GwConfigHandler *config = commonData->config; + GwLog *logger = commonData->logger; double value1 = 0; double value2 = 0; @@ -120,7 +118,7 @@ public: // Set display in partial refresh mode getdisplay().setPartialWindow(0, 0, getdisplay().width(), getdisplay().height()); // Set partial update - getdisplay().setTextColor(commonData.fgcolor); + getdisplay().setTextColor(commonData->fgcolor); // Show roll limit getdisplay().setFont(&DSEG7Classic_BoldItalic20pt7b); @@ -136,7 +134,7 @@ public: getdisplay().print("DEG"); // Horizintal separator left - getdisplay().fillRect(0, 149, 60, 3, commonData.fgcolor); + getdisplay().fillRect(0, 149, 60, 3, commonData->fgcolor); // Show roll value getdisplay().setFont(&DSEG7Classic_BoldItalic20pt7b); @@ -151,7 +149,7 @@ public: getdisplay().print("Deg"); // Horizintal separator right - getdisplay().fillRect(340, 149, 80, 3, commonData.fgcolor); + getdisplay().fillRect(340, 149, 80, 3, commonData->fgcolor); // Show pitch value getdisplay().setFont(&DSEG7Classic_BoldItalic20pt7b); @@ -171,8 +169,8 @@ public: int rInstrument = 100; // Radius of instrument float pi = 3.141592; - getdisplay().fillCircle(200, 150, rInstrument + 10, commonData.fgcolor); // Outer circle - getdisplay().fillCircle(200, 150, rInstrument + 7, commonData.bgcolor); // Outer circle + getdisplay().fillCircle(200, 150, rInstrument + 10, commonData->fgcolor); // Outer circle + getdisplay().fillCircle(200, 150, rInstrument + 7, commonData->bgcolor); // Outer circle for(int i=0; i<360; i=i+10) { @@ -207,7 +205,7 @@ public: // 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, commonData.fgcolor); + getdisplay().fillCircle((int)x1c, (int)y1c, 2, commonData->fgcolor); float sinx=sin(i/180.0*pi); float cosx=cos(i/180.0*pi); @@ -220,10 +218,10 @@ public: 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),commonData.fgcolor); + 200+(int)(cosx*xx1-sinx*yy2),150+(int)(sinx*xx1+cosx*yy2),commonData->fgcolor); 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),commonData.fgcolor); + 200+(int)(cosx*xx2-sinx*yy2),150+(int)(sinx*xx2+cosx*yy2),commonData->fgcolor); } } } @@ -244,7 +242,7 @@ public: float yy2 = -(rInstrument * 0.7); 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),commonData.fgcolor); + 200+(int)(cosx*0-sinx*yy2),150+(int)(sinx*0+cosx*yy2),commonData->fgcolor); // Inverted pointer // Pointer as triangle with center base 2*width float endwidth = 2; // End width of pointer @@ -254,26 +252,26 @@ public: 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),commonData.fgcolor); + 200+(int)(cosx*0-sinx*iy2),150+(int)(sinx*0+cosx*iy2),commonData->fgcolor); // Draw counterweight - getdisplay().fillCircle(200+(int)(cosx*0-sinx*yy2),150+(int)(sinx*0+cosx*yy2), 5, commonData.fgcolor); + getdisplay().fillCircle(200+(int)(cosx*0-sinx*yy2),150+(int)(sinx*0+cosx*yy2), 5, commonData->fgcolor); } // Center circle - getdisplay().fillCircle(200, 150, startwidth + 22, commonData.bgcolor); - getdisplay().fillCircle(200, 150, startwidth + 20, commonData.fgcolor); // Boat circle + getdisplay().fillCircle(200, 150, startwidth + 22, commonData->bgcolor); + getdisplay().fillCircle(200, 150, startwidth + 20, commonData->fgcolor); // Boat circle int x0 = 200; int y0 = 150; int x1 = x0 + 50*cos(value1); int y1 = y0 + 50*sin(value1); int x2 = x0 + 50*cos(value1 - pi/2); int y2 = y0 + 50*sin(value1 - pi/2); - getdisplay().fillTriangle(x0, y0, x1, y1, x2, y2, commonData.bgcolor); // Clear half top side of boat circle (right triangle) + getdisplay().fillTriangle(x0, y0, x1, y1, x2, y2, commonData->bgcolor); // Clear half top side of boat circle (right triangle) x1 = x0 + 50*cos(value1 + pi); y1 = y0 + 50*sin(value1 + pi); - getdisplay().fillTriangle(x0, y0, x1, y1, x2, y2, commonData.bgcolor); // Clear half top side of boat circle (left triangle) - getdisplay().fillRect(150, 160, 100, 4, commonData.fgcolor); // Water line + getdisplay().fillTriangle(x0, y0, x1, y1, x2, y2, commonData->bgcolor); // Clear half top side of boat circle (left triangle) + getdisplay().fillRect(150, 160, 100, 4, commonData->fgcolor); // Water line // Draw roll pointer startwidth = 4; // Start width of pointer @@ -288,7 +286,7 @@ public: 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),commonData.fgcolor); + 200+(int)(cosx*0-sinx*yy2),150+(int)(sinx*0+cosx*yy2),commonData->fgcolor); // Inverted pointer // Pointer as triangle with center base 2*width float endwidth = 2; // End width of pointer @@ -298,7 +296,7 @@ public: 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),commonData.fgcolor); + 200+(int)(cosx*0-sinx*iy2),150+(int)(sinx*0+cosx*iy2),commonData->fgcolor); } else{ // Print sensor info @@ -310,18 +308,12 @@ public: //******************************************************************************************* // Key Layout getdisplay().setFont(&Ubuntu_Bold8pt7b); - if(keylock == false){ - getdisplay().setCursor(130, 290); - getdisplay().print("[ <<<< " + String(commonData.data.actpage) + "/" + String(commonData.data.maxpage) + " >>>> ]"); + if(commonData->keylock == false){ 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) diff --git a/lib/obp60task/PageRudderPosition.cpp b/lib/obp60task/PageRudderPosition.cpp index 5f88f0e..afceeb4 100644 --- a/lib/obp60task/PageRudderPosition.cpp +++ b/lib/obp60task/PageRudderPosition.cpp @@ -5,27 +5,25 @@ class PageRudderPosition : public Page { -bool keylock = false; // Keylock - public: PageRudderPosition(CommonData &common){ + commonData = &common; common.logger->logDebug(GwLog::LOG,"Show PageRudderPosition"); } // Key functions virtual int handleKey(int key){ - // Keylock function - if(key == 11){ // Code for keylock - keylock = !keylock; // Toggle keylock + // Code for keylock + if(key == 11){ + commonData->keylock = !commonData->keylock; return 0; // Commit the key } return key; } - virtual void displayPage(CommonData &commonData, PageData &pageData) - { - GwConfigHandler *config = commonData.config; - GwLog *logger=commonData.logger; + virtual void displayPage(PageData &pageData){ + GwConfigHandler *config = commonData->config; + GwLog *logger = commonData->logger; static String unit1old = ""; double value1 = 0.1; @@ -44,8 +42,8 @@ public: name1 = name1.substring(0, 6); // String length limit for value name value1 = bvalue1->value; // Raw value without unit convertion bool valid1 = bvalue1->valid; // Valid information - 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 + 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){ value1old = value1; // Save old value unit1old = unit1; // Save old unit @@ -82,9 +80,9 @@ public: int rInstrument = 110; // Radius of RudderPosition float pi = 3.141592; - getdisplay().fillCircle(200, 150, rInstrument + 10, commonData.fgcolor); // Outer circle - getdisplay().fillCircle(200, 150, rInstrument + 7, commonData.bgcolor); // Outer circle - getdisplay().fillRect(0, 30, 400, 122, commonData.bgcolor); // Delete half top circle + getdisplay().fillCircle(200, 150, rInstrument + 10, commonData->fgcolor); // Outer circle + getdisplay().fillCircle(200, 150, rInstrument + 7, commonData->bgcolor); // Outer circle + getdisplay().fillRect(0, 30, 400, 122, commonData->bgcolor); // Delete half top circle for(int i=90; i<=270; i=i+10) { @@ -122,7 +120,7 @@ public: // 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, commonData.fgcolor); + getdisplay().fillCircle((int)x1c, (int)y1c, 2, commonData->fgcolor); float sinx=sin(i/180.0*pi); float cosx=cos(i/180.0*pi); @@ -135,10 +133,10 @@ public: 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),commonData.fgcolor); + 200+(int)(cosx*xx1-sinx*yy2),150+(int)(sinx*xx1+cosx*yy2),commonData->fgcolor); 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),commonData.fgcolor); + 200+(int)(cosx*xx2-sinx*yy2),150+(int)(sinx*xx2+cosx*yy2),commonData->fgcolor); } } @@ -190,7 +188,7 @@ public: float yy2 = -(rInstrument * 0.5); 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),commonData.fgcolor); + 200+(int)(cosx*0-sinx*yy2),150+(int)(sinx*0+cosx*yy2),commonData->fgcolor); // Inverted pointer // Pointer as triangle with center base 2*width float endwidth = 2; // End width of pointer @@ -200,28 +198,22 @@ public: 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),commonData.fgcolor); + 200+(int)(cosx*0-sinx*iy2),150+(int)(sinx*0+cosx*iy2),commonData->fgcolor); } // Center circle - getdisplay().fillCircle(200, 150, startwidth + 6, commonData.bgcolor); - getdisplay().fillCircle(200, 150, startwidth + 4, commonData.fgcolor); + getdisplay().fillCircle(200, 150, startwidth + 6, commonData->bgcolor); + getdisplay().fillCircle(200, 150, startwidth + 4, commonData->fgcolor); //******************************************************************************************* // Key Layout getdisplay().setFont(&Ubuntu_Bold8pt7b); - if(keylock == false){ - getdisplay().setCursor(130, 290); - getdisplay().print("[ <<<< " + String(commonData.data.actpage) + "/" + String(commonData.data.maxpage) + " >>>> ]"); + if(commonData->keylock == false){ 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) diff --git a/lib/obp60task/PageSolar.cpp b/lib/obp60task/PageSolar.cpp index d3b1acd..786dfe7 100644 --- a/lib/obp60task/PageSolar.cpp +++ b/lib/obp60task/PageSolar.cpp @@ -6,26 +6,23 @@ class PageSolar : public Page { -bool init = false; // Marker for init done -bool keylock = false; // Keylock - public: PageSolar(CommonData &common){ - common.logger->logDebug(GwLog::LOG,"Show PageSolar"); + commonData = &common; + common.logger->logDebug(GwLog::LOG,"Instantiate PageSolar"); } virtual int handleKey(int key){ // Code for keylock if(key == 11){ - keylock = !keylock; // Toggle keylock + commonData->keylock = !commonData->keylock; return 0; // Commit the key } return key; } - virtual void displayPage(CommonData &commonData, PageData &pageData) - { - GwConfigHandler *config = commonData.config; - GwLog *logger=commonData.logger; + virtual void displayPage(PageData &pageData){ + GwConfigHandler *config = commonData->config; + GwLog *logger = commonData->logger; // Get config data bool simulation = config->getBool(config->useSimuData); @@ -47,13 +44,13 @@ public: // Get raw value for trend indicator if(powerSensor != "off"){ - value1 = commonData.data.solarVoltage; // Use voltage from external sensor + value1 = commonData->data.solarVoltage; // Use voltage from external sensor } else{ - value1 = commonData.data.batteryVoltage; // Use internal voltage sensor + value1 = commonData->data.batteryVoltage; // Use internal voltage sensor } - value2 = commonData.data.solarCurrent; - value3 = commonData.data.solarPower; + value2 = commonData->data.solarCurrent; + value3 = commonData->data.solarPower; solPercentage = value3 * 100 / (double)solPower; // Load value // Limits for battery level if(solPercentage < 0) solPercentage = 0; @@ -87,7 +84,7 @@ public: // Set display in partial refresh mode getdisplay().setPartialWindow(0, 0, getdisplay().width(), getdisplay().height()); // Set partial update - getdisplay().setTextColor(commonData.fgcolor); + getdisplay().setTextColor(commonData->fgcolor); // Show name getdisplay().setFont(&Ubuntu_Bold20pt7b); @@ -121,7 +118,7 @@ public: getdisplay().print("Solar Modul"); // Show solar panel - solarGraphic(150, 45, commonData.fgcolor, commonData.bgcolor); + solarGraphic(150, 45, commonData->fgcolor, commonData->bgcolor); // Show load level in percent getdisplay().setFont(&DSEG7Classic_BoldItalic20pt7b); @@ -204,18 +201,12 @@ public: // Key Layout getdisplay().setFont(&Ubuntu_Bold8pt7b); - if(keylock == false){ - getdisplay().setCursor(130, 290); - getdisplay().print("[ <<<< " + String(commonData.data.actpage) + "/" + String(commonData.data.maxpage) + " >>>> ]"); + if(commonData->keylock == false){ 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) diff --git a/lib/obp60task/PageThreeValues.cpp b/lib/obp60task/PageThreeValues.cpp index 08de8f3..a4fbf90 100644 --- a/lib/obp60task/PageThreeValues.cpp +++ b/lib/obp60task/PageThreeValues.cpp @@ -5,24 +5,24 @@ class PageThreeValues : public Page { - bool keylock = false; // Keylock - public: PageThreeValues(CommonData &common){ - common.logger->logDebug(GwLog::LOG,"Show PageThreeValue"); + commonData = &common; + common.logger->logDebug(GwLog::LOG,"Instantiate PageThreeValue"); } virtual int handleKey(int key){ - if(key == 11){ // Code for keylock - keylock = !keylock; // Toggle keylock + // Code for keylock + if(key == 11){ + commonData->keylock = !commonData->keylock; return 0; // Commit the key } return key; } - virtual void displayPage(CommonData &commonData, PageData &pageData){ - GwConfigHandler *config = commonData.config; - GwLog *logger=commonData.logger; + virtual void displayPage(PageData &pageData){ + GwConfigHandler *config = commonData->config; + GwLog *logger = commonData->logger; // Old values for hold function static String svalue1old = ""; @@ -45,8 +45,8 @@ class PageThreeValues : public Page 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 - 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 + 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 // Get boat values #2 GwApi::BoatValue *bvalue2 = pageData.values[1]; // Second element in list (only one value by PageOneValue) @@ -54,8 +54,8 @@ class PageThreeValues : public Page 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 + 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 // Get boat values #3 GwApi::BoatValue *bvalue3 = pageData.values[2]; // Second element in list (only one value by PageOneValue) @@ -63,8 +63,8 @@ class PageThreeValues : public Page 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 + 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 // Optical warning by limit violation (unused) if(String(flashLED) == "Limit Violation"){ @@ -85,7 +85,7 @@ class PageThreeValues : public Page // ############### Value 1 ################ // Show name - getdisplay().setTextColor(commonData.fgcolor); + getdisplay().setTextColor(commonData->fgcolor); getdisplay().setFont(&Ubuntu_Bold20pt7b); getdisplay().setCursor(20, 55); getdisplay().print(name1); // Page name @@ -129,7 +129,7 @@ class PageThreeValues : public Page // ############### Horizontal Line ################ // Horizontal line 3 pix - getdisplay().fillRect(0, 105, 400, 3, commonData.fgcolor); + getdisplay().fillRect(0, 105, 400, 3, commonData->fgcolor); // ############### Value 2 ################ @@ -177,7 +177,7 @@ class PageThreeValues : public Page // ############### Horizontal Line ################ // Horizontal line 3 pix - getdisplay().fillRect(0, 195, 400, 3, commonData.fgcolor); + getdisplay().fillRect(0, 195, 400, 3, commonData->fgcolor); // ############### Value 3 ################ @@ -227,18 +227,12 @@ class PageThreeValues : public Page // Key Layout getdisplay().setFont(&Ubuntu_Bold8pt7b); - if(keylock == false){ - getdisplay().setCursor(130, 290); - getdisplay().print("[ <<<< " + String(commonData.data.actpage) + "/" + String(commonData.data.maxpage) + " >>>> ]"); + if(commonData->keylock == false){ 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) diff --git a/lib/obp60task/PageTwoValues.cpp b/lib/obp60task/PageTwoValues.cpp index 01469d9..e8dcf40 100644 --- a/lib/obp60task/PageTwoValues.cpp +++ b/lib/obp60task/PageTwoValues.cpp @@ -5,24 +5,24 @@ class PageTwoValues : public Page { - bool keylock = false; // Keylock - public: PageTwoValues(CommonData &common){ - common.logger->logDebug(GwLog::LOG,"Show PageTwoValue"); + commonData = &common; + common.logger->logDebug(GwLog::LOG,"Instantiate PageTwoValue"); } virtual int handleKey(int key){ - if(key == 11){ // Code for keylock - keylock = !keylock; // Toggle keylock + // Code for keylock + if(key == 11){ + commonData->keylock = !commonData->keylock; return 0; // Commit the key } return key; } - virtual void displayPage(CommonData &commonData, PageData &pageData){ - GwConfigHandler *config = commonData.config; - GwLog *logger=commonData.logger; + virtual void displayPage(PageData &pageData){ + GwConfigHandler *config = commonData->config; + GwLog *logger = commonData->logger; // Old values for hold function static String svalue1old = ""; @@ -43,8 +43,8 @@ class PageTwoValues : public Page 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 - 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 + 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 // Get boat values #2 GwApi::BoatValue *bvalue2 = pageData.values[1]; // Second element in list (only one value by PageOneValue) @@ -52,8 +52,8 @@ class PageTwoValues : public Page 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 + 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 // Optical warning by limit violation (unused) if(String(flashLED) == "Limit Violation"){ @@ -74,7 +74,7 @@ class PageTwoValues : public Page // ############### Value 1 ################ // Show name - getdisplay().setTextColor(commonData.fgcolor); + getdisplay().setTextColor(commonData->fgcolor); getdisplay().setFont(&Ubuntu_Bold20pt7b); getdisplay().setCursor(20, 80); getdisplay().print(name1); // Page name @@ -118,7 +118,7 @@ class PageTwoValues : public Page // ############### Horizontal Line ################ // Horizontal line 3 pix - getdisplay().fillRect(0, 145, 400, 3, commonData.fgcolor); + getdisplay().fillRect(0, 145, 400, 3, commonData->fgcolor); // ############### Value 2 ################ @@ -168,9 +168,7 @@ class PageTwoValues : public Page // Key Layout getdisplay().setFont(&Ubuntu_Bold8pt7b); - if(keylock == false){ - getdisplay().setCursor(130, 290); - getdisplay().print("[ <<<< " + String(commonData.data.actpage) + "/" + String(commonData.data.maxpage) + " >>>> ]"); + if(commonData->keylock == false){ if(String(backlightMode) == "Control by Key"){ // Key for illumination getdisplay().setCursor(343, 290); getdisplay().print("[ILUM]"); diff --git a/lib/obp60task/PageVoltage.cpp b/lib/obp60task/PageVoltage.cpp index cdee817..76d67e2 100644 --- a/lib/obp60task/PageVoltage.cpp +++ b/lib/obp60task/PageVoltage.cpp @@ -7,7 +7,6 @@ class PageVoltage : public Page { bool init = false; // Marker for init done -bool keylock = false; // Keylock uint8_t average = 0; // Average type [0...3], 0=off, 1=10s, 2=60s, 3=300s bool trend = true; // Trend indicator [0|1], 0=off, 1=on double raw = 0; @@ -15,6 +14,7 @@ char mode = 'D'; // display mode (A)nalog | (D)igital public: PageVoltage(CommonData &common){ + commonData = &common; common.logger->logDebug(GwLog::LOG,"Instantiate PageVoltage"); if (hasFRAM) { average = fram.read(FRAM_VOLTAGE_AVG); @@ -51,7 +51,7 @@ public: // Code for keylock if(key == 11){ - keylock = !keylock; // Toggle keylock + commonData->keylock = !commonData->keylock; return 0; // Commit the key } return key; @@ -92,10 +92,9 @@ public: getdisplay().fillRect(x + 16, y + 11, 6, 3, color); } - virtual void displayPage(CommonData &commonData, PageData &pageData) - { - GwConfigHandler *config = commonData.config; - GwLog *logger=commonData.logger; + virtual void displayPage(PageData &pageData){ + GwConfigHandler *config = commonData->config; + GwLog *logger = commonData->logger; // Get config data bool simulation = config->getBool(config->useSimuData); @@ -113,32 +112,32 @@ public: // Create trend value if(init == false){ // Load start values for first page run - valueTrend = commonData.data.batteryVoltage10; + valueTrend = commonData->data.batteryVoltage10; init = true; } else{ // Reading trend value - valueTrend = commonData.data.batteryVoltage10; + valueTrend = commonData->data.batteryVoltage10; } // Get raw value for trend indicator - raw = commonData.data.batteryVoltage; // Live data + raw = commonData->data.batteryVoltage; // Live data // Switch average values switch (average) { case 0: - value1 = commonData.data.batteryVoltage; // Live data + value1 = commonData->data.batteryVoltage; // Live data break; case 1: - value1 = commonData.data.batteryVoltage10; // Average 10s + value1 = commonData->data.batteryVoltage10; // Average 10s break; case 2: - value1 = commonData.data.batteryVoltage60; // Average 60s + value1 = commonData->data.batteryVoltage60; // Average 60s break; case 3: - value1 = commonData.data.batteryVoltage300; // Average 300s + value1 = commonData->data.batteryVoltage300; // Average 300s break; default: - value1 = commonData.data.batteryVoltage; // Default + value1 = commonData->data.batteryVoltage; // Default break; } bool valid1 = true; @@ -193,7 +192,7 @@ public: // Display mode digital // Show name - getdisplay().setTextColor(commonData.fgcolor); + getdisplay().setTextColor(commonData->fgcolor); getdisplay().setFont(&Ubuntu_Bold32pt7b); getdisplay().setCursor(20, 100); getdisplay().print(name1); // Value name @@ -246,18 +245,18 @@ public: // Trend indicator // Show trend indicator if(trend == true){ - getdisplay().fillRect(310, 240, 40, 120, commonData.bgcolor); // Clear area - getdisplay().fillRect(315, 183, 35, 4, commonData.fgcolor); // Draw separator + getdisplay().fillRect(310, 240, 40, 120, commonData->bgcolor); // Clear area + getdisplay().fillRect(315, 183, 35, 4, commonData->fgcolor); // Draw separator if(int(raw * 10) > int(valueTrend * 10)){ - displayTrendHigh(320, 174, 11, commonData.fgcolor); // Show high indicator + displayTrendHigh(320, 174, 11, commonData->fgcolor); // Show high indicator } if(int(raw * 10) < int(valueTrend * 10)){ - displayTrendLow(320, 195, 11, commonData.fgcolor); // Show low indicator + displayTrendLow(320, 195, 11, commonData->fgcolor); // Show low indicator } } // No trend indicator else{ - getdisplay().fillRect(310, 240, 40, 120, commonData.bgcolor); // Clear area + getdisplay().fillRect(310, 240, 40, 120, commonData->bgcolor); // Clear area } } @@ -272,9 +271,9 @@ public: std::vector pts; // Instrument - getdisplay().drawCircleHelper(c.x, c.y, r + 2, 0x01, commonData.fgcolor); - getdisplay().drawCircleHelper(c.x, c.y, r + 1, 0x01, commonData.fgcolor); - getdisplay().drawCircleHelper(c.x, c.y, r , 0x01, commonData.fgcolor); + getdisplay().drawCircleHelper(c.x, c.y, r + 2, 0x01, commonData->fgcolor); + getdisplay().drawCircleHelper(c.x, c.y, r + 1, 0x01, commonData->fgcolor); + getdisplay().drawCircleHelper(c.x, c.y, r , 0x01, commonData->fgcolor); // Scale // angle to voltage scale mapping @@ -290,14 +289,14 @@ public: getdisplay().setFont(&Ubuntu_Bold10pt7b); for (int angle = 3; angle < 90; angle += 3) { if (angle % 15 == 0) { - fillPoly4(rotatePoints(c, pts, angle), commonData.fgcolor); + fillPoly4(rotatePoints(c, pts, angle), commonData->fgcolor); p1 = rotatePoint(c, {c.x - r + 30, c.y}, angle); drawTextCenter(p1.x, p1.y, mapping[angle]); } else { p1 = rotatePoint(c, {c.x - r, c.y}, angle); p2 = rotatePoint(c, {c.x - r + 6, c.y}, angle); - getdisplay().drawLine(p1.x, p1.y, p2.x, p2.y, commonData.fgcolor); + getdisplay().drawLine(p1.x, p1.y, p2.x, p2.y, commonData->fgcolor); } } @@ -326,7 +325,7 @@ public: {c.x - r + 38, c.y - 2}, {c.x - 2, c.y - 3} }; - fillPoly4(rotatePoints(c, pts, angle), commonData.fgcolor); + fillPoly4(rotatePoints(c, pts, angle), commonData->fgcolor); // thin part pts = { {c.x - r + 40, c.y + 1}, @@ -334,14 +333,14 @@ public: {c.x - r + 5, c.y -1}, {c.x - r + 40, c.y - 1}, }; - fillPoly4(rotatePoints(c, pts, angle), commonData.fgcolor); + fillPoly4(rotatePoints(c, pts, angle), commonData->fgcolor); // base - getdisplay().fillCircle(c.x, c.y, 7, commonData.fgcolor); - getdisplay().fillCircle(c.x, c.y, 4, commonData.bgcolor); + getdisplay().fillCircle(c.x, c.y, 7, commonData->fgcolor); + getdisplay().fillCircle(c.x, c.y, 4, commonData->bgcolor); // Symbol - printVoltageSymbol(40, 60, commonData.fgcolor); + printVoltageSymbol(40, 60, commonData->fgcolor); // Additional information at right side getdisplay().setFont(&Ubuntu_Bold8pt7b); @@ -361,32 +360,26 @@ public: // FRAM indicator if (hasFRAM) { - getdisplay().drawXBitmap(300, 240, fram_bits, fram_width, fram_height, commonData.fgcolor); + getdisplay().drawXBitmap(300, 240, fram_bits, fram_width, fram_height, commonData->fgcolor); } } // Key Layout - getdisplay().setTextColor(commonData.fgcolor); + getdisplay().setTextColor(commonData->fgcolor); getdisplay().setFont(&Ubuntu_Bold8pt7b); - if(keylock == false){ + if(commonData->keylock == false){ getdisplay().setCursor(10, 290); getdisplay().print("[AVG]"); getdisplay().setCursor(62, 290); getdisplay().print("[MODE]"); - getdisplay().setCursor(130, 290); - getdisplay().print("[ <<<< " + String(commonData.data.actpage) + "/" + String(commonData.data.maxpage) + " >>>> ]"); getdisplay().setCursor(293, 290); - getdisplay().print("[TRD]"); + getdisplay().print("[TRD]"); 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) diff --git a/lib/obp60task/PageWhite.cpp b/lib/obp60task/PageWhite.cpp index e941732..4c9d0c7 100644 --- a/lib/obp60task/PageWhite.cpp +++ b/lib/obp60task/PageWhite.cpp @@ -3,17 +3,17 @@ #include "Pagedata.h" #include "OBP60Extensions.h" -class PageWhite : public Page{ - bool keylock = false; // Keylock - +class PageWhite : public Page +{ public: PageWhite(CommonData &common){ - common.logger->logDebug(GwLog::LOG,"Show PageWhite"); + commonData = &common; + common.logger->logDebug(GwLog::LOG,"Instantiate PageWhite"); } - virtual void displayPage(CommonData &commonData, PageData &pageData){ - GwConfigHandler *config = commonData.config; - GwLog *logger=commonData.logger; + virtual void displayPage(PageData &pageData){ + GwConfigHandler *config = commonData->config; + GwLog *logger = commonData->logger; // Get config data String flashLED = config->getString(config->flashLED); @@ -60,4 +60,4 @@ PageDescription registerPageWhite( false // Show display header on/off ); -#endif \ No newline at end of file +#endif diff --git a/lib/obp60task/PageWindRose.cpp b/lib/obp60task/PageWindRose.cpp index 82700f3..be3d468 100644 --- a/lib/obp60task/PageWindRose.cpp +++ b/lib/obp60task/PageWindRose.cpp @@ -5,28 +5,27 @@ class PageWindRose : public Page { -bool keylock = false; // Keylock int16_t lp = 80; // Pointer length public: PageWindRose(CommonData &common){ + commonData = &common; common.logger->logDebug(GwLog::LOG,"Show PageWindRose"); } // Key functions virtual int handleKey(int key){ - // Keylock function - if(key == 11){ // Code for keylock - keylock = !keylock; // Toggle keylock + // Code for keylock + if(key == 11){ + commonData->keylock = !commonData->keylock; return 0; // Commit the key } return key; } - virtual void displayPage(CommonData &commonData, PageData &pageData) - { - GwConfigHandler *config = commonData.config; - GwLog *logger=commonData.logger; + virtual void displayPage(PageData &pageData){ + GwConfigHandler *config = commonData->config; + GwLog *logger = commonData->logger; static String svalue1old = ""; static String unit1old = ""; @@ -54,9 +53,9 @@ public: 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 + 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 @@ -68,8 +67,8 @@ public: 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 + 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 @@ -81,8 +80,8 @@ public: 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 + 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 @@ -94,8 +93,8 @@ public: 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 + 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 @@ -107,8 +106,8 @@ public: 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 + 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 @@ -120,8 +119,8 @@ public: 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 + 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 @@ -143,7 +142,7 @@ public: // Set display in partial refresh mode getdisplay().setPartialWindow(0, 0, getdisplay().width(), getdisplay().height()); // Set partial update - getdisplay().setTextColor(commonData.fgcolor); + getdisplay().setTextColor(commonData->fgcolor); // Show values AWA getdisplay().setFont(&DSEG7Classic_BoldItalic20pt7b); @@ -163,7 +162,7 @@ public: } // Horizintal separator left - getdisplay().fillRect(0, 149, 60, 3, commonData.fgcolor); + getdisplay().fillRect(0, 149, 60, 3, commonData->fgcolor); // Show values AWS getdisplay().setFont(&DSEG7Classic_BoldItalic20pt7b); @@ -205,7 +204,7 @@ public: } // Horizintal separator right - getdisplay().fillRect(340, 149, 80, 3, commonData.fgcolor); + getdisplay().fillRect(340, 149, 80, 3, commonData->fgcolor); // Show values TWS getdisplay().setFont(&DSEG7Classic_BoldItalic20pt7b); @@ -230,10 +229,10 @@ public: int rInstrument = 110; // Radius of grafic instrument float pi = 3.141592; - getdisplay().fillCircle(200, 150, rInstrument + 10, commonData.fgcolor); // Outer circle - getdisplay().fillCircle(200, 150, rInstrument + 7, commonData.bgcolor); // Outer circle - getdisplay().fillCircle(200, 150, rInstrument - 10, commonData.fgcolor); // Inner circle - getdisplay().fillCircle(200, 150, rInstrument - 13, commonData.bgcolor); // Inner circle + getdisplay().fillCircle(200, 150, rInstrument + 10, commonData->fgcolor); // Outer circle + getdisplay().fillCircle(200, 150, rInstrument + 7, commonData->bgcolor); // Outer circle + getdisplay().fillCircle(200, 150, rInstrument - 10, commonData->fgcolor); // Inner circle + getdisplay().fillCircle(200, 150, rInstrument - 13, commonData->bgcolor); // Inner circle for(int i=0; i<360; i=i+10) { @@ -271,7 +270,7 @@ public: // 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, commonData.fgcolor); + getdisplay().fillCircle((int)x1c, (int)y1c, 2, commonData->fgcolor); float sinx=sin(i/180.0*pi); float cosx=cos(i/180.0*pi); @@ -284,10 +283,10 @@ public: 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),commonData.fgcolor); + 200+(int)(cosx*xx1-sinx*yy2),150+(int)(sinx*xx1+cosx*yy2),commonData->fgcolor); 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),commonData.fgcolor); + 200+(int)(cosx*xx2-sinx*yy2),150+(int)(sinx*xx2+cosx*yy2),commonData->fgcolor); } } @@ -304,7 +303,7 @@ public: 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),commonData.fgcolor); + 200+(int)(cosx*0-sinx*yy2),150+(int)(sinx*0+cosx*yy2),commonData->fgcolor); // Inverted pointer // Pointer as triangle with center base 2*width float endwidth = 2; // End width of pointer @@ -314,12 +313,12 @@ public: 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),commonData.fgcolor); + 200+(int)(cosx*0-sinx*iy2),150+(int)(sinx*0+cosx*iy2),commonData->fgcolor); } // Center circle - getdisplay().fillCircle(200, 150, startwidth + 6, commonData.bgcolor); - getdisplay().fillCircle(200, 150, startwidth + 4, commonData.fgcolor); + getdisplay().fillCircle(200, 150, startwidth + 6, commonData->bgcolor); + getdisplay().fillCircle(200, 150, startwidth + 4, commonData->fgcolor); //******************************************************************************************* @@ -353,18 +352,12 @@ public: // Key Layout getdisplay().setFont(&Ubuntu_Bold8pt7b); - if(keylock == false){ - getdisplay().setCursor(130, 290); - getdisplay().print("[ <<<< " + String(commonData.data.actpage) + "/" + String(commonData.data.maxpage) + " >>>> ]"); + if(commonData->keylock == false){ 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) diff --git a/lib/obp60task/PageWindRoseFlex.cpp b/lib/obp60task/PageWindRoseFlex.cpp index e33b869..ad5cfde 100644 --- a/lib/obp60task/PageWindRoseFlex.cpp +++ b/lib/obp60task/PageWindRoseFlex.cpp @@ -5,28 +5,27 @@ class PageWindRoseFlex : public Page { -bool keylock = false; // Keylock int16_t lp = 80; // Pointer length public: PageWindRoseFlex(CommonData &common){ + 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 + // Code for keylock + if(key == 11){ + commonData->keylock = !commonData->keylock; return 0; // Commit the key } return key; } - virtual void displayPage(CommonData &commonData, PageData &pageData) - { - GwConfigHandler *config = commonData.config; - GwLog *logger=commonData.logger; + virtual void displayPage(PageData &pageData){ + GwConfigHandler *config = commonData->config; + GwLog *logger = commonData->logger; static String svalue1old = ""; static String unit1old = ""; @@ -54,9 +53,9 @@ public: 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 + 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 @@ -68,8 +67,8 @@ public: 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 + 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 @@ -81,8 +80,8 @@ public: 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 + 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 @@ -94,8 +93,8 @@ public: 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 + 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 @@ -107,8 +106,8 @@ public: 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 + 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 @@ -120,8 +119,8 @@ public: 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 + 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 @@ -143,7 +142,7 @@ public: // Set display in partial refresh mode getdisplay().setPartialWindow(0, 0, getdisplay().width(), getdisplay().height()); // Set partial update - getdisplay().setTextColor(commonData.fgcolor); + getdisplay().setTextColor(commonData->fgcolor); // Show values AWA getdisplay().setFont(&DSEG7Classic_BoldItalic20pt7b); @@ -163,7 +162,7 @@ public: } // Horizintal separator left - getdisplay().fillRect(0, 149, 60, 3, commonData.fgcolor); + getdisplay().fillRect(0, 149, 60, 3, commonData->fgcolor); // Show values AWS getdisplay().setFont(&DSEG7Classic_BoldItalic20pt7b); @@ -205,7 +204,7 @@ public: } // Horizintal separator right - getdisplay().fillRect(340, 149, 80, 3, commonData.fgcolor); + getdisplay().fillRect(340, 149, 80, 3, commonData->fgcolor); // Show values TWS getdisplay().setFont(&DSEG7Classic_BoldItalic20pt7b); @@ -230,10 +229,10 @@ public: int rInstrument = 110; // Radius of grafic instrument float pi = 3.141592; - getdisplay().fillCircle(200, 150, rInstrument + 10, commonData.fgcolor); // Outer circle - getdisplay().fillCircle(200, 150, rInstrument + 7, commonData.bgcolor); // Outer circle - getdisplay().fillCircle(200, 150, rInstrument - 10, commonData.fgcolor); // Inner circle - getdisplay().fillCircle(200, 150, rInstrument - 13, commonData.bgcolor); // Inner circle + getdisplay().fillCircle(200, 150, rInstrument + 10, commonData->fgcolor); // Outer circle + getdisplay().fillCircle(200, 150, rInstrument + 7, commonData->bgcolor); // Outer circle + getdisplay().fillCircle(200, 150, rInstrument - 10, commonData->fgcolor); // Inner circle + getdisplay().fillCircle(200, 150, rInstrument - 13, commonData->bgcolor); // Inner circle for(int i=0; i<360; i=i+10) { @@ -271,7 +270,7 @@ public: // 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, commonData.fgcolor); + getdisplay().fillCircle((int)x1c, (int)y1c, 2, commonData->fgcolor); float sinx=sin(i/180.0*pi); float cosx=cos(i/180.0*pi); @@ -284,10 +283,10 @@ public: 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),commonData.fgcolor); + 200+(int)(cosx*xx1-sinx*yy2),150+(int)(sinx*xx1+cosx*yy2),commonData->fgcolor); 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),commonData.fgcolor); + 200+(int)(cosx*xx2-sinx*yy2),150+(int)(sinx*xx2+cosx*yy2),commonData->fgcolor); } } @@ -304,7 +303,7 @@ public: 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),commonData.fgcolor); + 200+(int)(cosx*0-sinx*yy2),150+(int)(sinx*0+cosx*yy2),commonData->fgcolor); // Inverted pointer // Pointer as triangle with center base 2*width float endwidth = 2; // End width of pointer @@ -314,12 +313,12 @@ public: 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),commonData.fgcolor); + 200+(int)(cosx*0-sinx*iy2),150+(int)(sinx*0+cosx*iy2),commonData->fgcolor); } // Center circle - getdisplay().fillCircle(200, 150, startwidth + 6, commonData.bgcolor); - getdisplay().fillCircle(200, 150, startwidth + 4, commonData.fgcolor); + getdisplay().fillCircle(200, 150, startwidth + 6, commonData->bgcolor); + getdisplay().fillCircle(200, 150, startwidth + 4, commonData->fgcolor); //******************************************************************************************* @@ -353,18 +352,12 @@ public: // Key Layout getdisplay().setFont(&Ubuntu_Bold8pt7b); - if(keylock == false){ - getdisplay().setCursor(130, 290); - getdisplay().print("[ <<<< " + String(commonData.data.actpage) + "/" + String(commonData.data.maxpage) + " >>>> ]"); + if(commonData->keylock == false){ 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) diff --git a/lib/obp60task/PageXTETrack.cpp b/lib/obp60task/PageXTETrack.cpp index 91afff1..d16a8b7 100644 --- a/lib/obp60task/PageXTETrack.cpp +++ b/lib/obp60task/PageXTETrack.cpp @@ -26,12 +26,12 @@ static unsigned char ship_bits[] PROGMEM = { 0x00, 0xf8, 0x3f, 0x00, 0x00, 0xf8, 0x3f, 0x00, 0x00, 0xf8, 0x3f, 0x00, 0x00, 0xf0, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00 }; -class PageXTETrack : public Page{ - bool keylock = false; // Keylock - +class PageXTETrack : public Page +{ public: PageXTETrack(CommonData &common){ - common.logger->logDebug(GwLog::LOG,"Show PageXTETrack"); + commonData = &common; + common.logger->logDebug(GwLog::LOG,"Instantiate PageXTETrack"); } void drawSegment(uint16_t x0, uint16_t y0, uint16_t x1, uint16_t y1, @@ -52,16 +52,17 @@ class PageXTETrack : public Page{ } virtual int handleKey(int key){ - if(key == 11){ // Code for keylock - keylock = !keylock; // Toggle keylock + // Code for keylock + if(key == 11){ + commonData->keylock = !commonData->keylock; return 0; // Commit the key } return key; } - virtual void displayPage(CommonData &commonData, PageData &pageData){ - GwConfigHandler *config = commonData.config; - GwLog *logger=commonData.logger; + virtual void displayPage(PageData &pageData){ + GwConfigHandler *config = commonData->config; + GwLog *logger = commonData->logger; // Get config data String flashLED = config->getString(config->flashLED); @@ -85,7 +86,7 @@ class PageXTETrack : public Page{ // Set display in partial refresh mode getdisplay().setPartialWindow(0, 0, getdisplay().width(), getdisplay().height()); // Set partial update - getdisplay().setTextColor(commonData.fgcolor); + getdisplay().setTextColor(commonData->fgcolor); // descriptions getdisplay().setFont(&Ubuntu_Bold8pt7b); @@ -105,25 +106,25 @@ class PageXTETrack : public Page{ uint16_t w, h; GwApi::BoatValue *bv_xte = pageData.values[0]; // XTE - String sval_xte = formatValue(bv_xte, commonData).svalue; + String sval_xte = formatValue(bv_xte, *commonData).svalue; getdisplay().getTextBounds(sval_xte, 0, 0, &x, &y, &w, &h); getdisplay().setCursor(160-w, 170); getdisplay().print(sval_xte); GwApi::BoatValue *bv_cog = pageData.values[1]; // COG - String sval_cog = formatValue(bv_cog, commonData).svalue; + String sval_cog = formatValue(bv_cog, *commonData).svalue; getdisplay().getTextBounds(sval_cog, 0, 0, &x, &y, &w, &h); getdisplay().setCursor(360-w, 170); getdisplay().print(sval_cog); GwApi::BoatValue *bv_dtw = pageData.values[2]; // DTW - String sval_dtw = formatValue(bv_dtw, commonData).svalue; + String sval_dtw = formatValue(bv_dtw, *commonData).svalue; getdisplay().getTextBounds(sval_dtw, 0, 0, &x, &y, &w, &h); getdisplay().setCursor(160-w, 257); getdisplay().print(sval_dtw); GwApi::BoatValue *bv_btw = pageData.values[3]; // BTW - String sval_btw = formatValue(bv_btw, commonData).svalue; + String sval_btw = formatValue(bv_btw, *commonData).svalue; getdisplay().getTextBounds(sval_btw, 0, 0, &x, &y, &w, &h); getdisplay().setCursor(360-w, 257); getdisplay().print(sval_btw); @@ -133,7 +134,7 @@ class PageXTETrack : public Page{ // XTETrack view // draw ship symbol (as bitmap) - getdisplay().drawXBitmap(184, 68, ship_bits, ship_width, ship_height, commonData.fgcolor); + getdisplay().drawXBitmap(184, 68, ship_bits, ship_width, ship_height, commonData->fgcolor); // draw next waypoint name String sval_wpname = "no data"; @@ -188,28 +189,22 @@ class PageXTETrack : public Page{ } // left segments - drawSegment(0, 54, 46, 24, 75, 24, 0, 90, commonData.fgcolor, seg[2]); - drawSegment(0, 100, 82, 24, 112, 24, 50, 100, commonData.fgcolor, seg[1]); - drawSegment(60, 100, 117, 24, 147, 24, 110, 100, commonData.fgcolor,seg[0]); + drawSegment(0, 54, 46, 24, 75, 24, 0, 90, commonData->fgcolor, seg[2]); + drawSegment(0, 100, 82, 24, 112, 24, 50, 100, commonData->fgcolor, seg[1]); + drawSegment(60, 100, 117, 24, 147, 24, 110, 100, commonData->fgcolor,seg[0]); // right segments - drawSegment(340, 100, 283, 24, 253, 24, 290, 100, commonData.fgcolor, seg[3]); - drawSegment(399, 100, 318, 24, 289, 24, 350, 100, commonData.fgcolor, seg[4]); - drawSegment(399, 54, 354, 24, 325, 24, 399, 90, commonData.fgcolor, seg[5]); + drawSegment(340, 100, 283, 24, 253, 24, 290, 100, commonData->fgcolor, seg[3]); + drawSegment(399, 100, 318, 24, 289, 24, 350, 100, commonData->fgcolor, seg[4]); + drawSegment(399, 54, 354, 24, 325, 24, 399, 90, commonData->fgcolor, seg[5]); // Key Layout getdisplay().setFont(&Ubuntu_Bold8pt7b); - if(keylock == false){ - getdisplay().setCursor(130, 296); - getdisplay().print("[ <<<< " + String(commonData.data.actpage) + "/" + String(commonData.data.maxpage) + " >>>> ]"); + if(commonData->keylock == false){ if(String(backlightMode) == "Control by Key"){ // Key for illumination getdisplay().setCursor(343, 296); getdisplay().print("[ILUM]"); } } - else{ - getdisplay().setCursor(130, 296); - getdisplay().print(" [ Keylock active ]"); - } // Update display getdisplay().nextPage(); // Partial update (fast) diff --git a/lib/obp60task/Pagedata.h b/lib/obp60task/Pagedata.h index d18452f..9f9764c 100644 --- a/lib/obp60task/Pagedata.h +++ b/lib/obp60task/Pagedata.h @@ -73,13 +73,16 @@ typedef struct{ GwApi::BoatValue *date=NULL; uint16_t fgcolor; uint16_t bgcolor; + bool keylock = false; } CommonData; //a base class that all pages must inherit from class Page{ + protected: + CommonData *commonData; public: - virtual void displayPage(CommonData &commonData, PageData &pageData)=0; - virtual void displayNew(CommonData &commonData, PageData &pageData){} + virtual void displayPage(PageData &pageData)=0; + virtual void displayNew(PageData &pageData){} //return -1 if handled by the page virtual int handleKey(int key){return key;} }; diff --git a/lib/obp60task/obp60task.cpp b/lib/obp60task/obp60task.cpp index 73bd9fe..f85e746 100644 --- a/lib/obp60task/obp60task.cpp +++ b/lib/obp60task/obp60task.cpp @@ -629,12 +629,13 @@ void OBP60Task(GwApi *api){ } else{ if (lastPage != pageNumber){ - currentPage->displayNew(commonData,pages[pageNumber].parameters); + if (hasFRAM) fram.write(FRAM_PAGE_NO, pageNumber); // remember page for device restart + currentPage->displayNew(pages[pageNumber].parameters); lastPage=pageNumber; } //call the page code LOG_DEBUG(GwLog::DEBUG,"calling page %d",pageNumber); - currentPage->displayPage(commonData,pages[pageNumber].parameters); + currentPage->displayPage(pages[pageNumber].parameters); } } } From dfc79c80dc6e2baf9f96064c686014780dafbc9e Mon Sep 17 00:00:00 2001 From: Tobias E Date: Sun, 12 Jan 2025 21:40:39 +0000 Subject: [PATCH 03/11] Add SixValues and fix Fluid in gen_set.py --- lib/obp60task/gen_set.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/obp60task/gen_set.py b/lib/obp60task/gen_set.py index d0ff7e5..a0f7b6d 100755 --- a/lib/obp60task/gen_set.py +++ b/lib/obp60task/gen_set.py @@ -5,14 +5,14 @@ import json # List of all pages and the number of parameters they expect. no_of_fields_per_page = { - "ApparentWind": 0, + "Wind": 0, "XTETrack": 0, "Battery2": 0, "Battery": 0, "BME280": 0, "Clock": 0, "DST810": 0, - "Fluid": 0, + "Fluid": 1, "FourValues2": 4, "FourValues": 4, "Generator": 0, @@ -27,6 +27,7 @@ no_of_fields_per_page = { "White": 0, "WindRose": 0, "WindRoseFlex": 6, + "SixValues" : 6, } # No changes needed beyond this point From 519af68befe6ca9b57ff4f4b9739ec502ae16c71 Mon Sep 17 00:00:00 2001 From: Thomas Hooge Date: Wed, 15 Jan 2025 18:08:39 +0100 Subject: [PATCH 04/11] Footer function for improved key labels, icons implemented --- lib/obp60task/Atari16px8b.h | 338 +++++++++++++++++++++++++++ lib/obp60task/LedSpiTask.h | 3 +- lib/obp60task/OBP60Extensions.cpp | 59 +++++ lib/obp60task/OBP60Extensions.h | 77 ++++-- lib/obp60task/OBP60Keypad.h | 34 ++- lib/obp60task/PageBME280.cpp | 11 - lib/obp60task/PageBattery.cpp | 19 +- lib/obp60task/PageBattery2.cpp | 17 +- lib/obp60task/PageClock.cpp | 10 - lib/obp60task/PageDST810.cpp | 12 - lib/obp60task/PageFluid.cpp | 22 +- lib/obp60task/PageFourValues.cpp | 12 - lib/obp60task/PageFourValues2.cpp | 12 - lib/obp60task/PageGenerator.cpp | 9 - lib/obp60task/PageKeelPosition.cpp | 10 - lib/obp60task/PageOneValue.cpp | 9 - lib/obp60task/PageRollPitch.cpp | 10 - lib/obp60task/PageRudderPosition.cpp | 10 - lib/obp60task/PageSolar.cpp | 9 - lib/obp60task/PageThreeValues.cpp | 12 - lib/obp60task/PageTwoValues.cpp | 16 -- lib/obp60task/PageVoltage.cpp | 32 +-- lib/obp60task/PageWind.cpp | 62 +++-- lib/obp60task/PageWindRose.cpp | 11 +- lib/obp60task/PageWindRoseFlex.cpp | 11 +- lib/obp60task/PageXTETrack.cpp | 9 - lib/obp60task/Pagedata.h | 31 +++ lib/obp60task/obp60task.cpp | 53 +++-- 28 files changed, 620 insertions(+), 300 deletions(-) create mode 100644 lib/obp60task/Atari16px8b.h diff --git a/lib/obp60task/Atari16px8b.h b/lib/obp60task/Atari16px8b.h new file mode 100644 index 0000000..c12a5ba --- /dev/null +++ b/lib/obp60task/Atari16px8b.h @@ -0,0 +1,338 @@ +const uint8_t Atari16pxBitmaps[] PROGMEM = { + 0x00, 0xFF, 0xFF, 0x0F, 0xCF, 0x3C, 0xF3, 0xCF, 0x30, 0x66, 0x66, 0xFF, + 0xFF, 0x66, 0x66, 0xFF, 0xFF, 0x66, 0x66, 0x30, 0xC7, 0xFF, 0xC3, 0x0F, + 0x9F, 0x0C, 0x3F, 0xFE, 0x30, 0xC0, 0xCF, 0x3D, 0x86, 0x30, 0xC6, 0x1B, + 0xCF, 0x30, 0x38, 0xF9, 0xB3, 0x63, 0x87, 0x1C, 0x38, 0xDF, 0xBF, 0x36, + 0x6F, 0xEE, 0xC0, 0xFF, 0xF0, 0x36, 0xEC, 0xCC, 0xCC, 0xCE, 0x63, 0xC6, + 0x73, 0x33, 0x33, 0x37, 0x6C, 0x66, 0x66, 0x3C, 0x3C, 0xFF, 0xFF, 0x3C, + 0x3C, 0x66, 0x66, 0x30, 0xC3, 0x3F, 0xFC, 0xC3, 0x0C, 0x6D, 0xBD, 0x00, + 0xFF, 0xF0, 0xFF, 0x0C, 0x30, 0xC6, 0x18, 0xC3, 0x18, 0x63, 0x0C, 0x30, + 0x7B, 0xFC, 0xF3, 0xCF, 0x7E, 0xF3, 0xCF, 0x3F, 0xDE, 0x30, 0xC7, 0x1C, + 0x30, 0xC3, 0x0C, 0x30, 0xCF, 0xFF, 0x7B, 0xFC, 0xF3, 0x18, 0x63, 0x0C, + 0x61, 0x8F, 0xFF, 0xFF, 0xF1, 0x86, 0x30, 0xC1, 0x86, 0xCF, 0x3F, 0xDE, + 0x18, 0x63, 0x8E, 0x79, 0xED, 0xB6, 0xFF, 0xF1, 0x86, 0xFF, 0xFC, 0x30, + 0xFB, 0xF0, 0xC3, 0x0F, 0x3F, 0xDE, 0x39, 0xEE, 0x30, 0xC3, 0xEF, 0xF3, + 0xCF, 0x3F, 0xDE, 0xFF, 0xF0, 0xC3, 0x18, 0x63, 0x0C, 0x61, 0x86, 0x18, + 0x7B, 0xFC, 0xF3, 0x79, 0xEC, 0xF3, 0xCF, 0x3F, 0xDE, 0x7B, 0xFC, 0xF3, + 0xFD, 0xF0, 0xC3, 0x0C, 0x77, 0x9C, 0xFF, 0x0F, 0xF0, 0x6D, 0xB0, 0x1B, + 0x6F, 0x40, 0x0E, 0x38, 0xE3, 0x8E, 0x0E, 0x0E, 0x0E, 0x0E, 0xFF, 0xF0, + 0x00, 0xFF, 0xF0, 0xE0, 0xE0, 0xE0, 0xE0, 0xE3, 0x8E, 0x38, 0xE0, 0x7B, + 0xFC, 0xF3, 0x18, 0x63, 0x0C, 0x30, 0x03, 0x0C, 0x38, 0xFB, 0x9E, 0x1D, + 0xBA, 0xF5, 0xEE, 0xC1, 0xC5, 0xF9, 0xE0, 0x31, 0xEF, 0xF3, 0xCF, 0x3F, + 0xFF, 0xCF, 0x3C, 0xF3, 0xFB, 0xFC, 0xF3, 0xFF, 0xEC, 0xF3, 0xCF, 0x3F, + 0xFE, 0x7B, 0xFC, 0xF3, 0xC3, 0x0C, 0x30, 0xCF, 0x3F, 0xDE, 0xF3, 0xED, + 0xF3, 0xCF, 0x3C, 0xF3, 0xCF, 0x7F, 0xBC, 0xFF, 0xFC, 0x30, 0xFB, 0xEC, + 0x30, 0xC3, 0x0F, 0xFF, 0xFF, 0xFC, 0x30, 0xFB, 0xEC, 0x30, 0xC3, 0x0C, + 0x30, 0x7F, 0xFC, 0x30, 0xDF, 0x7C, 0xF3, 0xCF, 0x3F, 0xDE, 0xCF, 0x3C, + 0xF3, 0xFF, 0xFC, 0xF3, 0xCF, 0x3C, 0xF3, 0xFF, 0xF3, 0x0C, 0x30, 0xC3, + 0x0C, 0x30, 0xCF, 0xFF, 0x0C, 0x30, 0xC3, 0x0C, 0x30, 0xC3, 0xCF, 0x3F, + 0xDE, 0xCD, 0x9B, 0x66, 0xCF, 0x1E, 0x36, 0x6C, 0xCD, 0x9B, 0x1E, 0x30, + 0xC3, 0x0C, 0x30, 0xC3, 0x0C, 0x30, 0xC3, 0x0F, 0xFF, 0xC7, 0x8F, 0xBF, + 0x7F, 0xFA, 0xF5, 0xE3, 0xC7, 0x8F, 0x1E, 0x30, 0xCF, 0x3C, 0xFB, 0xEF, + 0xFF, 0xF7, 0xDF, 0x3C, 0xF3, 0x7B, 0xFC, 0xF3, 0xCF, 0x3C, 0xF3, 0xCF, + 0x3F, 0xDE, 0xFB, 0xFC, 0xF3, 0xCF, 0x3F, 0xFE, 0xC3, 0x0C, 0x30, 0x7B, + 0xFC, 0xF3, 0xCF, 0x3C, 0xF3, 0xCF, 0x5F, 0x9B, 0xF9, 0xFB, 0x36, 0x6C, + 0xDF, 0xBE, 0x6C, 0xCD, 0x9B, 0x1E, 0x30, 0x7F, 0xFC, 0x30, 0xE1, 0xC3, + 0x87, 0x0C, 0x3F, 0xFE, 0xFF, 0xF3, 0x0C, 0x30, 0xC3, 0x0C, 0x30, 0xC3, + 0x0C, 0xCF, 0x3C, 0xF3, 0xCF, 0x3C, 0xF3, 0xCF, 0x3F, 0xDE, 0xCF, 0x3C, + 0xF3, 0xCF, 0x3C, 0xF3, 0x79, 0xE3, 0x0C, 0xC7, 0x8F, 0x1E, 0x3C, 0x7A, + 0xF5, 0xFF, 0xFF, 0xDF, 0x1C, 0x10, 0xCF, 0x3C, 0xDE, 0x78, 0xC3, 0x1E, + 0x7B, 0x3C, 0xF3, 0xCF, 0x3C, 0xF3, 0x79, 0xE3, 0x0C, 0x30, 0xC3, 0x0C, + 0xFF, 0xF1, 0x86, 0x30, 0xC6, 0x18, 0xC3, 0x0F, 0xFF, 0xFF, 0xCC, 0xCC, + 0xCC, 0xCC, 0xFF, 0xC3, 0x0C, 0x18, 0x60, 0xC3, 0x06, 0x18, 0x30, 0xC3, + 0xFF, 0x33, 0x33, 0x33, 0x33, 0xFF, 0x10, 0x20, 0xE1, 0xC6, 0xCD, 0xB1, + 0xE3, 0xFF, 0xFC, 0x86, 0x38, 0xE3, 0x8C, 0x20, 0x79, 0xF0, 0xDF, 0xFF, + 0x3C, 0xFF, 0x7C, 0xC3, 0x0C, 0x3E, 0xFF, 0x3C, 0xF3, 0xCF, 0x3F, 0xFE, + 0x7B, 0xEC, 0x30, 0xC3, 0x0C, 0x3F, 0x7C, 0x0C, 0x30, 0xDF, 0xFF, 0x3C, + 0xF3, 0xCF, 0x3F, 0xDF, 0x7B, 0xFC, 0xF3, 0xFF, 0x0C, 0x3F, 0x7C, 0x1C, + 0xF3, 0x0C, 0xFF, 0xF3, 0x0C, 0x30, 0xC3, 0x0C, 0x7F, 0xFC, 0xF3, 0xCF, + 0x3F, 0xDF, 0x0F, 0xFF, 0x80, 0xC3, 0x0C, 0x3E, 0xFF, 0x3C, 0xF3, 0xCF, + 0x3C, 0xF3, 0x66, 0x0E, 0xE6, 0x66, 0x66, 0xFF, 0x18, 0xC0, 0x31, 0x8C, + 0x63, 0x18, 0xC6, 0x3F, 0xF8, 0xC1, 0x83, 0x06, 0x6D, 0xDF, 0x3C, 0x7C, + 0xD9, 0x9B, 0x3E, 0x30, 0xEE, 0x66, 0x66, 0x66, 0x66, 0xFF, 0x6D, 0xFF, + 0xFE, 0xBD, 0x7A, 0xF1, 0xE3, 0xC6, 0x7B, 0xFC, 0xF3, 0xCF, 0x3C, 0xF3, + 0xCC, 0x7B, 0xFC, 0xF3, 0xCF, 0x3C, 0xFF, 0x78, 0xFB, 0xFC, 0xF3, 0xCF, + 0x3C, 0xFF, 0xFB, 0x0C, 0x00, 0x7F, 0xFC, 0xF3, 0xCF, 0x3C, 0xFF, 0x7C, + 0x30, 0xC0, 0xFB, 0xFC, 0xF0, 0xC3, 0x0C, 0x30, 0xC0, 0x7F, 0xFC, 0x38, + 0x78, 0x70, 0xFF, 0xF8, 0x30, 0xCF, 0xFF, 0x30, 0xC3, 0x0C, 0x30, 0xF1, + 0xC0, 0xCF, 0x3C, 0xF3, 0xCF, 0x3C, 0xFF, 0x7C, 0xCF, 0x3C, 0xF3, 0xCD, + 0xE7, 0x8C, 0x30, 0xC7, 0x8F, 0x5E, 0xBF, 0xFF, 0xFB, 0xE3, 0x82, 0xCF, + 0x37, 0x9E, 0x31, 0xE7, 0xB3, 0xCC, 0xCF, 0x3C, 0xF3, 0xCF, 0x3F, 0xDF, + 0x0F, 0xFF, 0x80, 0xFF, 0xF1, 0x8C, 0x31, 0x86, 0x3F, 0xFC, 0x0E, 0x30, + 0x60, 0xC1, 0x87, 0x3C, 0x78, 0x38, 0x30, 0x60, 0xC1, 0x81, 0xC0, 0xFF, + 0xFF, 0xFF, 0xF0, 0xE0, 0x60, 0xC1, 0x83, 0x07, 0x07, 0x8F, 0x38, 0x60, + 0xC1, 0x83, 0x1C, 0x00, 0x63, 0xE6, 0xFC, 0xE0, 0xFC, 0x63, 0x18, 0xC6, + 0x31, 0x8C, 0x7E, 0x00, 0xF3, 0xFF, 0xFF, 0x30, 0xC7, 0xBF, 0xCF, 0x0C, + 0x33, 0xFD, 0xE3, 0x0C, 0x0E, 0x1E, 0x38, 0x30, 0x30, 0x30, 0x30, 0xFE, + 0x30, 0x30, 0x30, 0x7F, 0xFF, 0xFC, 0x63, 0x18, 0xC6, 0x31, 0x8C, 0x7E, + 0xCF, 0x3C, 0xF3, 0xFD, 0xE3, 0x3F, 0x30, 0xC3, 0x0C, 0xFC, 0x63, 0x18, + 0xC6, 0x31, 0x8C, 0x7E, 0x39, 0xB6, 0x4C, 0x7B, 0x3C, 0xDE, 0x32, 0x6D, + 0x9C, 0xFC, 0x63, 0x18, 0xC6, 0x31, 0x8C, 0x7E, 0x7D, 0x8E, 0x0D, 0xDA, + 0x34, 0x68, 0xDD, 0x83, 0x8D, 0xF0, 0x79, 0xF0, 0xDF, 0xFF, 0x3C, 0xFF, + 0x7C, 0x0F, 0xC0, 0x1A, 0x6D, 0xB6, 0xC6, 0xC6, 0xC6, 0x80, 0xFF, 0xF0, + 0xC3, 0x0C, 0xFF, 0x7D, 0x8E, 0x0D, 0xDA, 0xB6, 0x6E, 0xD5, 0x83, 0x8D, + 0xF0, 0xFF, 0xFC, 0x76, 0xE3, 0xB7, 0x00, 0x30, 0xC3, 0x3F, 0xFC, 0xC3, + 0x0C, 0x03, 0xFF, 0xC0, 0x69, 0x36, 0xCF, 0xF3, 0x63, 0x96, 0xFC, 0x63, + 0x18, 0xC6, 0x31, 0x8C, 0x7E, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x7F, + 0x5D, 0xC0, 0x80, 0x7B, 0x97, 0x2E, 0x5C, 0xB9, 0x5E, 0x85, 0x0A, 0x14, + 0x28, 0x50, 0x6F, 0xF6, 0xFC, 0x63, 0x18, 0xC6, 0x31, 0x8C, 0x7E, 0xD5, + 0x50, 0x7B, 0xFC, 0xF3, 0xCF, 0x3C, 0xFF, 0x78, 0x0F, 0xC0, 0xB1, 0xB1, + 0xB1, 0xB6, 0xDB, 0x2C, 0x00, 0xFC, 0x63, 0x18, 0xC6, 0x31, 0x8C, 0x7E, + 0xFC, 0x63, 0x18, 0xC6, 0x31, 0x8C, 0x7E, 0xFC, 0x63, 0x18, 0xC6, 0x31, + 0x8C, 0x7E, 0x30, 0xC0, 0x0C, 0x30, 0xC6, 0x18, 0xCF, 0x3F, 0xDE, 0xC1, + 0x83, 0x00, 0x7B, 0xFC, 0xF3, 0xFF, 0xFC, 0xF3, 0xCF, 0x30, 0x0C, 0x63, + 0x00, 0x7B, 0xFC, 0xF3, 0xFF, 0xFC, 0xF3, 0xCF, 0x30, 0x31, 0xEC, 0xC0, + 0x7B, 0xFC, 0xF3, 0xFF, 0xFC, 0xF3, 0xCF, 0x30, 0x67, 0xD9, 0x80, 0x7B, + 0xFC, 0xF3, 0xFF, 0xFC, 0xF3, 0xCF, 0x30, 0xCF, 0x33, 0x1E, 0xFF, 0x3C, + 0xFF, 0xFF, 0x3C, 0xF3, 0xCC, 0x7B, 0x37, 0x8C, 0x7B, 0xFC, 0xF3, 0xFF, + 0xFC, 0xF3, 0xCF, 0x30, 0x3E, 0xFF, 0xE6, 0xCD, 0x9B, 0xF7, 0xFC, 0xF9, + 0xB3, 0x66, 0xFD, 0xE0, 0x7B, 0xFC, 0xF3, 0xC3, 0x0C, 0x30, 0xCF, 0x3F, + 0xDE, 0x19, 0xC0, 0xC1, 0x83, 0x00, 0xFF, 0xFC, 0x3E, 0xFB, 0x0C, 0x30, + 0xFF, 0xF0, 0x0C, 0x63, 0x00, 0xFF, 0xFC, 0x3E, 0xFB, 0x0C, 0x30, 0xFF, + 0xF0, 0x31, 0xEC, 0xC0, 0xFF, 0xFC, 0x3E, 0xFB, 0x0C, 0x30, 0xFF, 0xF0, + 0xCF, 0x30, 0x3F, 0xFF, 0x0F, 0xBE, 0xC3, 0x0C, 0x3F, 0xFC, 0xC1, 0x83, + 0x00, 0xFF, 0xF3, 0x0C, 0x30, 0xC3, 0x0C, 0xFF, 0xF0, 0x0C, 0x63, 0x00, + 0xFF, 0xF3, 0x0C, 0x30, 0xC3, 0x0C, 0xFF, 0xF0, 0x31, 0xEC, 0xC0, 0xFF, + 0xF3, 0x0C, 0x30, 0xC3, 0x0C, 0xFF, 0xF0, 0xCF, 0x30, 0x3F, 0xFC, 0xC3, + 0x0C, 0x30, 0xC3, 0x3F, 0xFC, 0x78, 0xF9, 0xBB, 0x36, 0x7E, 0xFD, 0xB3, + 0x66, 0xDD, 0xF3, 0xC0, 0x67, 0xD9, 0x80, 0xCF, 0x3E, 0xFF, 0xFF, 0x7C, + 0xF3, 0xCC, 0xC1, 0x83, 0x00, 0x7B, 0xFC, 0xF3, 0xCF, 0x3C, 0xF3, 0xFD, + 0xE0, 0x0C, 0x63, 0x00, 0x7B, 0xFC, 0xF3, 0xCF, 0x3C, 0xF3, 0xFD, 0xE0, + 0x31, 0xEC, 0xC0, 0x7B, 0xFC, 0xF3, 0xCF, 0x3C, 0xF3, 0xFD, 0xE0, 0x67, + 0xD9, 0x80, 0x7B, 0xFC, 0xF3, 0xCF, 0x3C, 0xF3, 0xFD, 0xE0, 0xCF, 0x30, + 0x1E, 0xFF, 0x3C, 0xF3, 0xCF, 0x3C, 0xFF, 0x78, 0xCD, 0xE3, 0x1E, 0xCC, + 0x01, 0x3D, 0x7E, 0x66, 0x66, 0x6E, 0x6E, 0x76, 0x76, 0x66, 0x66, 0x7E, + 0xBC, 0x80, 0xC1, 0x83, 0x00, 0xCF, 0x3C, 0xF3, 0xCF, 0x3C, 0xF3, 0xFD, + 0xE0, 0x0C, 0x63, 0x00, 0xCF, 0x3C, 0xF3, 0xCF, 0x3C, 0xF3, 0xFD, 0xE0, + 0x31, 0xEC, 0xC0, 0xCF, 0x3C, 0xF3, 0xCF, 0x3C, 0xF3, 0xFD, 0xE0, 0xCF, + 0x30, 0x33, 0xCF, 0x3C, 0xF3, 0xCF, 0x3C, 0xFF, 0x78, 0x0C, 0x63, 0x00, + 0xCF, 0x3C, 0xF3, 0x79, 0xE3, 0x0C, 0x30, 0xC0, 0xC3, 0x0F, 0xBF, 0xCF, + 0x3C, 0xFF, 0xFB, 0x0C, 0x30, 0x31, 0xEC, 0xF3, 0xCF, 0xEC, 0xF3, 0xCF, + 0xED, 0xB0, 0x80, 0xC1, 0x83, 0x00, 0x79, 0xF0, 0xDF, 0xFF, 0x3C, 0xFF, + 0x7C, 0x0C, 0x63, 0x00, 0x79, 0xF0, 0xDF, 0xFF, 0x3C, 0xFF, 0x7C, 0x31, + 0xEC, 0xC0, 0x79, 0xF0, 0xDF, 0xFF, 0x3C, 0xFF, 0x7C, 0x67, 0xD9, 0x80, + 0x79, 0xF0, 0xDF, 0xFF, 0x3C, 0xFF, 0x7C, 0xCF, 0x30, 0x1E, 0x7C, 0x37, + 0xFF, 0xCF, 0x3F, 0xDF, 0x39, 0xB3, 0x80, 0x79, 0xF0, 0xDF, 0xFF, 0x3C, + 0xFF, 0x7C, 0x76, 0x7F, 0x1B, 0x7B, 0xFF, 0xD8, 0xD8, 0xFF, 0x7F, 0x7B, + 0xEC, 0x30, 0xC3, 0x0C, 0x3F, 0x7C, 0x67, 0x00, 0xC1, 0x83, 0x00, 0x7B, + 0xFC, 0xF3, 0xFF, 0x0C, 0x3F, 0x7C, 0x0C, 0x63, 0x00, 0x7B, 0xFC, 0xF3, + 0xFF, 0x0C, 0x3F, 0x7C, 0x31, 0xEC, 0xC0, 0x7B, 0xFC, 0xF3, 0xFF, 0x0C, + 0x3F, 0x7C, 0xCF, 0x30, 0x1E, 0xFF, 0x3C, 0xFF, 0xC3, 0x0F, 0xDF, 0xC3, + 0x0C, 0x07, 0x38, 0xC6, 0x31, 0x8C, 0xF7, 0x80, 0x19, 0x98, 0x0E, 0x71, + 0x8C, 0x63, 0x19, 0xEF, 0x00, 0x31, 0xEC, 0xC0, 0x71, 0xC3, 0x0C, 0x30, + 0xC3, 0x1E, 0x78, 0xCF, 0x30, 0x1C, 0x70, 0xC3, 0x0C, 0x30, 0xC7, 0x9E, + 0x78, 0xC7, 0x86, 0x7F, 0xFC, 0xF3, 0xCF, 0x3C, 0xFF, 0x78, 0x67, 0xD9, + 0x80, 0x7B, 0xFC, 0xF3, 0xCF, 0x3C, 0xF3, 0xCC, 0xC1, 0x83, 0x00, 0x7B, + 0xFC, 0xF3, 0xCF, 0x3C, 0xFF, 0x78, 0x0C, 0x63, 0x00, 0x7B, 0xFC, 0xF3, + 0xCF, 0x3C, 0xFF, 0x78, 0x31, 0xEC, 0xC0, 0x7B, 0xFC, 0xF3, 0xCF, 0x3C, + 0xFF, 0x78, 0x67, 0xD9, 0x80, 0x7B, 0xFC, 0xF3, 0xCF, 0x3C, 0xFF, 0x78, + 0xCF, 0x30, 0x1E, 0xFF, 0x3C, 0xF3, 0xCF, 0x3F, 0xDE, 0x30, 0xC0, 0x3F, + 0xFC, 0x03, 0x0C, 0x01, 0x3D, 0x7E, 0x66, 0x6E, 0x7E, 0x76, 0x66, 0x7E, + 0xBC, 0x80, 0xC1, 0x83, 0x00, 0xCF, 0x3C, 0xF3, 0xCF, 0x3C, 0xFF, 0x7C, + 0x0C, 0x63, 0x00, 0xCF, 0x3C, 0xF3, 0xCF, 0x3C, 0xFF, 0x7C, 0x31, 0xEC, + 0xC0, 0xCF, 0x3C, 0xF3, 0xCF, 0x3C, 0xFF, 0x7C, 0xCF, 0x30, 0x33, 0xCF, + 0x3C, 0xF3, 0xCF, 0x3F, 0xDF, 0x0C, 0x63, 0x00, 0xCF, 0x3C, 0xF3, 0xCF, + 0x3F, 0xDF, 0x0F, 0xFF, 0x80, 0xC3, 0x0C, 0x3E, 0xFF, 0x3C, 0xF3, 0xCF, + 0x3F, 0xFE, 0xC3, 0x00, 0xCF, 0x30, 0x33, 0xCF, 0x3C, 0xF3, 0xCF, 0xF7, + 0xC3, 0xFF, 0xE0 }; + +const GFXglyph Atari16pxGlyphs[] PROGMEM = { + { 0, 1, 1, 8, 0, 0 }, // 0x20 ' ' U+0020 + { 1, 2, 12, 8, 3, -11 }, // 0x21 '!' U+0021 + { 4, 6, 6, 8, 1, -11 }, // 0x22 '"' U+0022 + { 9, 8, 10, 8, 0, -11 }, // 0x23 '#' U+0023 + { 19, 6, 14, 8, 1, -13 }, // 0x24 '$' U+0024 + { 30, 6, 10, 8, 1, -11 }, // 0x25 '%' U+0025 + { 38, 7, 14, 8, 0, -13 }, // 0x26 '&' U+0026 + { 51, 2, 6, 8, 3, -11 }, // 0x27 ''' U+0027 + { 53, 4, 12, 8, 3, -11 }, // 0x28 '(' U+0028 + { 59, 4, 12, 8, 1, -11 }, // 0x29 ')' U+0029 + { 65, 8, 10, 8, 0, -11 }, // 0x2a '*' U+002A + { 75, 6, 8, 8, 1, -10 }, // 0x2b '+' U+002B + { 81, 3, 6, 8, 2, -3 }, // 0x2c ',' U+002C + { 84, 6, 2, 8, 1, -7 }, // 0x2d '-' U+002D + { 86, 2, 4, 8, 3, -3 }, // 0x2e '.' U+002E + { 87, 6, 12, 8, 1, -11 }, // 0x2f '/' U+002F + { 96, 6, 12, 8, 1, -11 }, // 0x30 '0' U+0030 + { 105, 6, 12, 8, 1, -11 }, // 0x31 '1' U+0031 + { 114, 6, 12, 8, 1, -11 }, // 0x32 '2' U+0032 + { 123, 6, 12, 8, 1, -11 }, // 0x33 '3' U+0033 + { 132, 6, 12, 8, 1, -11 }, // 0x34 '4' U+0034 + { 141, 6, 12, 8, 1, -11 }, // 0x35 '5' U+0035 + { 150, 6, 12, 8, 1, -11 }, // 0x36 '6' U+0036 + { 159, 6, 12, 8, 1, -11 }, // 0x37 '7' U+0037 + { 168, 6, 12, 8, 1, -11 }, // 0x38 '8' U+0038 + { 177, 6, 12, 8, 1, -11 }, // 0x39 '9' U+0039 + { 186, 2, 10, 8, 3, -9 }, // 0x3a ':' U+003A + { 189, 3, 12, 8, 2, -9 }, // 0x3b ';' U+003B + { 194, 7, 9, 8, 0, -10 }, // 0x3c '<' U+003C + { 202, 6, 6, 8, 1, -9 }, // 0x3d '=' U+003D + { 207, 7, 9, 8, 0, -10 }, // 0x3e '>' U+003E + { 215, 6, 12, 8, 1, -11 }, // 0x3f '?' U+003F + { 224, 7, 12, 8, 0, -11 }, // 0x40 '@' U+0040 + { 235, 6, 12, 8, 1, -11 }, // 0x41 'A' U+0041 + { 244, 6, 12, 8, 1, -11 }, // 0x42 'B' U+0042 + { 253, 6, 12, 8, 1, -11 }, // 0x43 'C' U+0043 + { 262, 6, 12, 8, 1, -11 }, // 0x44 'D' U+0044 + { 271, 6, 12, 8, 1, -11 }, // 0x45 'E' U+0045 + { 280, 6, 12, 8, 1, -11 }, // 0x46 'F' U+0046 + { 289, 6, 12, 8, 1, -11 }, // 0x47 'G' U+0047 + { 298, 6, 12, 8, 1, -11 }, // 0x48 'H' U+0048 + { 307, 6, 12, 8, 1, -11 }, // 0x49 'I' U+0049 + { 316, 6, 12, 8, 1, -11 }, // 0x4a 'J' U+004A + { 325, 7, 12, 8, 0, -11 }, // 0x4b 'K' U+004B + { 336, 6, 12, 8, 1, -11 }, // 0x4c 'L' U+004C + { 345, 7, 12, 8, 0, -11 }, // 0x4d 'M' U+004D + { 356, 6, 12, 8, 1, -11 }, // 0x4e 'N' U+004E + { 365, 6, 12, 8, 1, -11 }, // 0x4f 'O' U+004F + { 374, 6, 12, 8, 1, -11 }, // 0x50 'P' U+0050 + { 383, 6, 12, 8, 1, -11 }, // 0x51 'Q' U+0051 + { 392, 7, 12, 8, 0, -11 }, // 0x52 'R' U+0052 + { 403, 6, 12, 8, 1, -11 }, // 0x53 'S' U+0053 + { 412, 6, 12, 8, 1, -11 }, // 0x54 'T' U+0054 + { 421, 6, 12, 8, 1, -11 }, // 0x55 'U' U+0055 + { 430, 6, 12, 8, 1, -11 }, // 0x56 'V' U+0056 + { 439, 7, 12, 8, 0, -11 }, // 0x57 'W' U+0057 + { 450, 6, 12, 8, 1, -11 }, // 0x58 'X' U+0058 + { 459, 6, 12, 8, 1, -11 }, // 0x59 'Y' U+0059 + { 468, 6, 12, 8, 1, -11 }, // 0x5a 'Z' U+005A + { 477, 4, 12, 8, 3, -11 }, // 0x5b '[' U+005B + { 483, 6, 12, 8, 1, -11 }, // 0x5c '\' U+005C + { 492, 4, 12, 8, 1, -11 }, // 0x5d ']' U+005D + { 498, 7, 8, 8, 0, -12 }, // 0x5e '^' U+005E + { 505, 7, 2, 8, 0, -1 }, // 0x5f '_' U+005F + { 507, 5, 7, 8, 1, -13 }, // 0x60 '`' U+0060 + { 512, 6, 9, 8, 1, -8 }, // 0x61 'a' U+0061 + { 519, 6, 12, 8, 1, -11 }, // 0x62 'b' U+0062 + { 528, 6, 9, 8, 1, -8 }, // 0x63 'c' U+0063 + { 535, 6, 12, 8, 1, -11 }, // 0x64 'd' U+0064 + { 544, 6, 9, 8, 1, -8 }, // 0x65 'e' U+0065 + { 551, 6, 12, 8, 1, -11 }, // 0x66 'f' U+0066 + { 560, 6, 11, 8, 1, -8 }, // 0x67 'g' U+0067 + { 569, 6, 12, 8, 1, -11 }, // 0x68 'h' U+0068 + { 578, 4, 12, 8, 2, -11 }, // 0x69 'i' U+0069 + { 584, 5, 14, 8, 1, -11 }, // 0x6a 'j' U+006A + { 593, 7, 12, 8, 0, -11 }, // 0x6b 'k' U+006B + { 604, 4, 12, 8, 2, -11 }, // 0x6c 'l' U+006C + { 610, 7, 9, 8, 0, -8 }, // 0x6d 'm' U+006D + { 618, 6, 9, 8, 1, -8 }, // 0x6e 'n' U+006E + { 625, 6, 9, 8, 1, -8 }, // 0x6f 'o' U+006F + { 632, 6, 11, 8, 1, -8 }, // 0x70 'p' U+0070 + { 641, 6, 11, 8, 1, -8 }, // 0x71 'q' U+0071 + { 650, 6, 9, 8, 1, -8 }, // 0x72 'r' U+0072 + { 657, 6, 9, 8, 1, -8 }, // 0x73 's' U+0073 + { 664, 6, 11, 8, 1, -10 }, // 0x74 't' U+0074 + { 673, 6, 9, 8, 1, -8 }, // 0x75 'u' U+0075 + { 680, 6, 9, 8, 1, -8 }, // 0x76 'v' U+0076 + { 687, 7, 9, 8, 0, -8 }, // 0x77 'w' U+0077 + { 695, 6, 9, 8, 1, -8 }, // 0x78 'x' U+0078 + { 702, 6, 11, 8, 1, -8 }, // 0x79 'y' U+0079 + { 711, 6, 9, 8, 1, -8 }, // 0x7a 'z' U+007A + { 718, 7, 14, 8, 0, -12 }, // 0x7b '{' U+007B + { 731, 2, 14, 8, 3, -12 }, // 0x7c '|' U+007C + { 735, 7, 14, 8, 0, -12 }, // 0x7d '}' U+007D + { 748, 7, 4, 8, 0, -8 }, // 0x7e '~' U+007E + { 752, 5, 11, 8, 1, -10 }, // 0x7f 'REPLACEMENT CHARACTER *' U+2370 + { 759, 1, 1, 8, 0, 0 }, // 0x80 'NO-BREAK SPACE' U+00A0 + { 760, 2, 12, 8, 3, -10 }, // 0x81 'INVERTED EXCLAMATION MARK' U+00A1 + { 763, 6, 12, 8, 1, -11 }, // 0x82 'CENT SIGN' U+00A2 + { 772, 8, 13, 8, 0, -12 }, // 0x83 'POUND SIGN' U+00A3 + { 785, 5, 11, 8, 1, -10 }, // 0x84 'CURRENCY SIGN' U+00A4 + { 792, 6, 12, 8, 1, -11 }, // 0x85 'YEN SIGN' U+00A5 + { 801, 5, 11, 8, 1, -10 }, // 0x86 'BROKEN BAR' U+00A6 + { 808, 6, 12, 8, 1, -11 }, // 0x87 'SECTION SIGN' U+00A7 + { 817, 5, 11, 8, 1, -10 }, // 0x88 'DIAERESIS' U+00A8 + { 824, 7, 11, 8, 0, -11 }, // 0x89 'COPYRIGHT SIGN' U+00A9 + { 834, 6, 11, 8, 1, -9 }, // 0x8a 'FEMININE ORDINAL INDICATOR' U+00AA + { 843, 7, 7, 8, 0, -7 }, // 0x8b 'LEFT-POINTING DOUBLE ANGLE QUOTATION MARK' U+00AB + { 850, 6, 5, 8, 1, -4 }, // 0x8c 'NOT SIGN' U+00AC + { 854, 4, 2, 8, 2, -4 }, // 0x8d 'SOFT HYPHEN' U+00AD + { 855, 7, 11, 8, 0, -11 }, // 0x8e 'REGISTERED SIGN' U+00AE + { 865, 7, 2, 8, 0, -12 }, // 0x8f 'MACRON' U+00AF + { 867, 5, 5, 8, 1, -12 }, // 0x90 'DEGREE SIGN' U+00B0 + { 871, 6, 11, 8, 1, -10 }, // 0x91 'PLUS-MINUS SIGN' U+00B1 + { 880, 4, 6, 8, 1, -11 }, // 0x92 'SUPERSCRIPT TWO' U+00B2 + { 883, 4, 6, 8, 1, -11 }, // 0x93 'SUPERSCRIPT THREE' U+00B3 + { 886, 5, 11, 8, 1, -10 }, // 0x94 'ACUTE ACCENT' U+00B4 + { 893, 8, 10, 8, 0, -8 }, // 0x95 'MICRO SIGN' U+00B5 + { 903, 7, 12, 8, 0, -11 }, // 0x96 'PILCROW SIGN' U+00B6 + { 914, 4, 4, 8, 2, -6 }, // 0x97 'MIDDLE DOT' U+00B7 + { 916, 5, 11, 8, 1, -10 }, // 0x98 'CEDILLA' U+00B8 + { 923, 2, 6, 8, 1, -11 }, // 0x99 'SUPERSCRIPT ONE' U+00B9 + { 925, 6, 11, 8, 1, -9 }, // 0x9a 'MASCULINE ORDINAL INDICATOR' U+00BA + { 934, 7, 7, 8, 0, -7 }, // 0x9b 'RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK' U+00BB + { 941, 5, 11, 8, 1, -10 }, // 0x9c 'VULGAR FRACTION ONE QUARTER' U+00BC + { 948, 5, 11, 8, 1, -10 }, // 0x9d 'VULGAR FRACTION ONE HALF' U+00BD + { 955, 5, 11, 8, 1, -10 }, // 0x9e 'VULGAR FRACTION THREE QUARTERS' U+00BE + { 962, 6, 12, 8, 1, -11 }, // 0x9f 'INVERTED QUESTION MARK' U+00BF + { 971, 6, 14, 8, 1, -13 }, // 0xa0 'LATIN CAPITAL LETTER A WITH GRAVE' U+00C0 + { 982, 6, 14, 8, 1, -13 }, // 0xa1 'LATIN CAPITAL LETTER A WITH ACUTE' U+00C1 + { 993, 6, 14, 8, 1, -13 }, // 0xa2 'LATIN CAPITAL LETTER A WITH CIRCUMFLEX' U+00C2 + { 1004, 6, 14, 8, 1, -13 }, // 0xa3 'LATIN CAPITAL LETTER A WITH TILDE' U+00C3 + { 1015, 6, 13, 8, 1, -12 }, // 0xa4 'LATIN CAPITAL LETTER A WITH DIAERESIS' U+00C4 + { 1025, 6, 14, 8, 1, -13 }, // 0xa5 'LATIN CAPITAL LETTER A WITH RING ABOVE' U+00C5 + { 1036, 7, 13, 8, 0, -12 }, // 0xa6 'LATIN CAPITAL LETTER AE' U+00C6 + { 1048, 6, 14, 8, 1, -11 }, // 0xa7 'LATIN CAPITAL LETTER C WITH CEDILLA' U+00C7 + { 1059, 6, 14, 8, 1, -13 }, // 0xa8 'LATIN CAPITAL LETTER E WITH GRAVE' U+00C8 + { 1070, 6, 14, 8, 1, -13 }, // 0xa9 'LATIN CAPITAL LETTER E WITH ACUTE' U+00C9 + { 1081, 6, 14, 8, 1, -13 }, // 0xaa 'LATIN CAPITAL LETTER E WITH CIRCUMFLEX' U+00CA + { 1092, 6, 13, 8, 1, -12 }, // 0xab 'LATIN CAPITAL LETTER E WITH DIAERESIS' U+00CB + { 1102, 6, 14, 8, 1, -13 }, // 0xac 'LATIN CAPITAL LETTER I WITH GRAVE' U+00CC + { 1113, 6, 14, 8, 1, -13 }, // 0xad 'LATIN CAPITAL LETTER I WITH ACUTE' U+00CD + { 1124, 6, 14, 8, 1, -13 }, // 0xae 'LATIN CAPITAL LETTER I WITH CIRCUMFLEX' U+00CE + { 1135, 6, 13, 8, 1, -12 }, // 0xaf 'LATIN CAPITAL LETTER I WITH DIAERESIS' U+00CF + { 1145, 7, 12, 8, 0, -11 }, // 0xb0 'LATIN CAPITAL LETTER ETH' U+00D0 + { 1156, 6, 13, 8, 1, -12 }, // 0xb1 'LATIN CAPITAL LETTER N WITH TILDE' U+00D1 + { 1166, 6, 14, 8, 1, -13 }, // 0xb2 'LATIN CAPITAL LETTER O WITH GRAVE' U+00D2 + { 1177, 6, 14, 8, 1, -13 }, // 0xb3 'LATIN CAPITAL LETTER O WITH ACUTE' U+00D3 + { 1188, 6, 14, 8, 1, -13 }, // 0xb4 'LATIN CAPITAL LETTER O WITH CIRCUMFLEX' U+00D4 + { 1199, 6, 14, 8, 1, -13 }, // 0xb5 'LATIN CAPITAL LETTER O WITH TILDE' U+00D5 + { 1210, 6, 13, 8, 1, -12 }, // 0xb6 'LATIN CAPITAL LETTER O WITH DIAERESIS' U+00D6 + { 1220, 6, 5, 8, 1, -6 }, // 0xb7 'MULTIPLICATION SIGN' U+00D7 + { 1224, 8, 14, 8, 0, -12 }, // 0xb8 'LATIN CAPITAL LETTER O WITH STROKE' U+00D8 + { 1238, 6, 14, 8, 1, -13 }, // 0xb9 'LATIN CAPITAL LETTER U WITH GRAVE' U+00D9 + { 1249, 6, 14, 8, 1, -13 }, // 0xba 'LATIN CAPITAL LETTER U WITH ACUTE' U+00DA + { 1260, 6, 14, 8, 1, -13 }, // 0xbb 'LATIN CAPITAL LETTER U WITH CIRCUMFLEX' U+00DB + { 1271, 6, 13, 8, 1, -12 }, // 0xbc 'LATIN CAPITAL LETTER U WITH DIAERESIS' U+00DC + { 1281, 6, 14, 8, 1, -13 }, // 0xbd 'LATIN CAPITAL LETTER Y WITH ACUTE' U+00DD + { 1292, 6, 12, 8, 1, -11 }, // 0xbe 'LATIN CAPITAL LETTER THORN' U+00DE + { 1301, 6, 13, 8, 1, -11 }, // 0xbf 'LATIN SMALL LETTER SHARP S' U+00DF + { 1311, 6, 13, 8, 1, -12 }, // 0xc0 'LATIN SMALL LETTER A WITH GRAVE' U+00E0 + { 1321, 6, 13, 8, 1, -12 }, // 0xc1 'LATIN SMALL LETTER A WITH ACUTE' U+00E1 + { 1331, 6, 13, 8, 1, -12 }, // 0xc2 'LATIN SMALL LETTER A WITH CIRCUMFLEX' U+00E2 + { 1341, 6, 13, 8, 1, -12 }, // 0xc3 'LATIN SMALL LETTER A WITH TILDE' U+00E3 + { 1351, 6, 12, 8, 1, -11 }, // 0xc4 'LATIN SMALL LETTER A WITH DIAERESIS' U+00E4 + { 1360, 6, 13, 8, 1, -12 }, // 0xc5 'LATIN SMALL LETTER A WITH RING ABOVE' U+00E5 + { 1370, 8, 9, 8, 0, -8 }, // 0xc6 'LATIN SMALL LETTER AE' U+00E6 + { 1379, 6, 11, 8, 1, -8 }, // 0xc7 'LATIN SMALL LETTER C WITH CEDILLA' U+00E7 + { 1388, 6, 13, 8, 1, -12 }, // 0xc8 'LATIN SMALL LETTER E WITH GRAVE' U+00E8 + { 1398, 6, 13, 8, 1, -12 }, // 0xc9 'LATIN SMALL LETTER E WITH ACUTE' U+00E9 + { 1408, 6, 13, 8, 1, -12 }, // 0xca 'LATIN SMALL LETTER E WITH CIRCUMFLEX' U+00EA + { 1418, 6, 12, 8, 1, -11 }, // 0xcb 'LATIN SMALL LETTER E WITH DIAERESIS' U+00EB + { 1427, 5, 13, 8, 1, -12 }, // 0xcc 'LATIN SMALL LETTER I WITH GRAVE' U+00EC + { 1436, 5, 13, 8, 2, -12 }, // 0xcd 'LATIN SMALL LETTER I WITH ACUTE' U+00ED + { 1445, 6, 13, 8, 1, -12 }, // 0xce 'LATIN SMALL LETTER I WITH CIRCUMFLEX' U+00EE + { 1455, 6, 12, 8, 1, -11 }, // 0xcf 'LATIN SMALL LETTER I WITH DIAERESIS' U+00EF + { 1464, 6, 13, 8, 1, -12 }, // 0xd0 'LATIN SMALL LETTER ETH' U+00F0 + { 1474, 6, 13, 8, 1, -12 }, // 0xd1 'LATIN SMALL LETTER N WITH TILDE' U+00F1 + { 1484, 6, 13, 8, 1, -12 }, // 0xd2 'LATIN SMALL LETTER O WITH GRAVE' U+00F2 + { 1494, 6, 13, 8, 1, -12 }, // 0xd3 'LATIN SMALL LETTER O WITH ACUTE' U+00F3 + { 1504, 6, 13, 8, 1, -12 }, // 0xd4 'LATIN SMALL LETTER O WITH CIRCUMFLEX' U+00F4 + { 1514, 6, 13, 8, 1, -12 }, // 0xd5 'LATIN SMALL LETTER O WITH TILDE' U+00F5 + { 1524, 6, 12, 8, 1, -11 }, // 0xd6 'LATIN SMALL LETTER O WITH DIAERESIS' U+00F6 + { 1533, 6, 8, 8, 1, -10 }, // 0xd7 'DIVISION SIGN' U+00F7 + { 1539, 8, 11, 8, 0, -9 }, // 0xd8 'LATIN SMALL LETTER O WITH STROKE' U+00F8 + { 1550, 6, 13, 8, 1, -12 }, // 0xd9 'LATIN SMALL LETTER U WITH GRAVE' U+00F9 + { 1560, 6, 13, 8, 1, -12 }, // 0xda 'LATIN SMALL LETTER U WITH ACUTE' U+00FA + { 1570, 6, 13, 8, 1, -12 }, // 0xdb 'LATIN SMALL LETTER U WITH CIRCUMFLEX' U+00FB + { 1580, 6, 12, 8, 1, -11 }, // 0xdc 'LATIN SMALL LETTER U WITH DIAERESIS' U+00FC + { 1589, 6, 15, 8, 1, -12 }, // 0xdd 'LATIN SMALL LETTER Y WITH ACUTE' U+00FD + { 1601, 6, 14, 8, 1, -11 }, // 0xde 'LATIN SMALL LETTER THORN' U+00FE + { 1612, 6, 14, 8, 1, -11 } }; // 0xdf 'LATIN SMALL LETTER Y WITH DIAERESIS' U+000FF + +const GFXfont Atari16px PROGMEM = { + (uint8_t *)Atari16pxBitmaps, + (GFXglyph *)Atari16pxGlyphs, + 0x20, 0xDF, 16 }; + +// Approx. 2974 bytes diff --git a/lib/obp60task/LedSpiTask.h b/lib/obp60task/LedSpiTask.h index 5c2e82c..c21a65e 100644 --- a/lib/obp60task/LedSpiTask.h +++ b/lib/obp60task/LedSpiTask.h @@ -33,6 +33,7 @@ static Color COLOR_BLACK=Color(0,0,0); Color setBrightness(const Color &color,uint8_t brightness); +enum BacklightMode {OFF, ON, SUN, BUS, TIME, KEY}; class LedInterface { private: @@ -93,4 +94,4 @@ class LedTaskData{ void createSpiLedTask(LedTaskData *param); -#endif \ No newline at end of file +#endif diff --git a/lib/obp60task/OBP60Extensions.cpp b/lib/obp60task/OBP60Extensions.cpp index 85393e1..30a85ee 100644 --- a/lib/obp60task/OBP60Extensions.cpp +++ b/lib/obp60task/OBP60Extensions.cpp @@ -22,6 +22,7 @@ #include "DSEG7Classic-BoldItalic30pt7b.h" #include "DSEG7Classic-BoldItalic42pt7b.h" #include "DSEG7Classic-BoldItalic60pt7b.h" +#include "Atari16px8b.h" // Key label font // E-Ink Display #define GxEPD_WIDTH 400 // Display width @@ -130,6 +131,21 @@ Color colorMapping(const String &colorString){ return color; } +BacklightMode backlightMapping(const String &backlightString) { + static std::map const table = { + {"Off", BacklightMode::OFF}, + {"Control by Bus", BacklightMode::BUS}, + {"Control by Time", BacklightMode::TIME}, + {"Control by Key", BacklightMode::KEY}, + {"On", BacklightMode::ON}, + }; + auto it = table.find(backlightString); + if (it != table.end()) { + return it->second; + } + return BacklightMode::OFF; +} + // All defined colors see pixeltypes.h in FastLED lib void setBacklightLED(uint brightness, const Color &color){ if (ledTaskData == nullptr) return; @@ -364,6 +380,49 @@ void displayHeader(CommonData &commonData, GwApi::BoatValue *date, GwApi::BoatVa } } +void displayFooter(CommonData &commonData) { + + static const uint16_t cx[6] = {35, 101, 167, 233, 299, 365}; // label center positions + static const uint16_t cy = 290; + + getdisplay().setFont(&Atari16px); + getdisplay().setTextColor(commonData.fgcolor); + + // Frame around key icon area + getdisplay().drawLine(0, 280, 399, 280, commonData.fgcolor); + getdisplay().drawLine(68, 280, 68, 299, commonData.fgcolor); + getdisplay().drawLine(134, 280, 134, 299, commonData.fgcolor); + getdisplay().drawLine(200, 280, 200, 299, commonData.fgcolor); + getdisplay().drawLine(266, 280, 266, 299, commonData.fgcolor); + getdisplay().drawLine(332, 280, 332, 299, commonData.fgcolor); + + for (int i=0; i<6; i++) { + uint16_t x, y; + if (commonData.keydata[i].label.length() > 0) { + // check if icon is enabled + String icon_name = commonData.keydata[i].label.substring(1); + if (commonData.keydata[i].label[0] == '#') { + if (iconmap.find(icon_name) != iconmap.end()) { + x = commonData.keydata[i].x + (commonData.keydata[i].w - icon_width) / 2; + y = commonData.keydata[i].y + (commonData.keydata[i].h - icon_height) / 2; + getdisplay().drawXBitmap(x, y, iconmap[icon_name], icon_width, icon_height, commonData.fgcolor); + } else { + // icon is missing, use name instead + x = commonData.keydata[i].x + commonData.keydata[i].w / 2; + y = commonData.keydata[i].y + commonData.keydata[i].h / 2; + drawTextCenter(x, y, icon_name); + } + } else { + //drawTextCenter(cx[i], cy, commonData.keydata[i].label); + x = commonData.keydata[i].x + commonData.keydata[i].w / 2; + y = commonData.keydata[i].y + commonData.keydata[i].h / 2; + drawTextCenter(x, y, commonData.keydata[i].label); + } + } + } + +} + // Sunset und sunrise calculation SunData calcSunsetSunrise(GwApi *api, double time, double date, double latitude, double longitude, double timezone){ GwLog *logger=api->getLogger(); diff --git a/lib/obp60task/OBP60Extensions.h b/lib/obp60task/OBP60Extensions.h index ac0c189..e94c535 100644 --- a/lib/obp60task/OBP60Extensions.h +++ b/lib/obp60task/OBP60Extensions.h @@ -37,20 +37,6 @@ extern const GFXfont DSEG7Classic_BoldItalic30pt7b; extern const GFXfont DSEG7Classic_BoldItalic42pt7b; extern const GFXfont DSEG7Classic_BoldItalic60pt7b; -// Icons -#define icon_width 16 -#define icon_height 16 - -static unsigned char swipe_bits[] PROGMEM = { - 0x80, 0x03, 0xe0, 0x06, 0xb0, 0x0a, 0xa8, 0x0a, 0xa8, 0x0a, 0xa8, 0x3a, - 0x28, 0x28, 0x08, 0x28, 0x08, 0x28, 0x08, 0x26, 0x08, 0x21, 0x08, 0x10, - 0x10, 0x08, 0x10, 0x04, 0x10, 0x04, 0x00, 0x00 }; - -static unsigned char lock_bits[] PROGMEM = { - 0xc0, 0x03, 0x60, 0x06, 0x30, 0x0c, 0x10, 0x08, 0x10, 0x08, 0x10, 0x08, - 0xfc, 0x3f, 0x04, 0x20, 0x04, 0x20, 0x84, 0x21, 0x84, 0x21, 0x84, 0x21, - 0x04, 0x20, 0x04, 0x20, 0x04, 0x20, 0xfc, 0x3f }; - // Global functions #ifdef DISPLAY_GDEW042T2 GxEPD2_BW & getdisplay(); @@ -85,6 +71,7 @@ void togglePortPin(uint pin); // Toggle extension port pin Color colorMapping(const String &colorString); // Color mapping string to CHSV colors void setBacklightLED(uint brightness, const Color &color);// Set backlight LEDs void toggleBacklightLED(uint brightness,const Color &color);// Toggle backlight LEDs +BacklightMode backlightMapping(const String &backlightString);// Configuration string to value void setFlashLED(bool status); // Set flash LED void blinkingFlashLED(); // Blinking function for flash LED @@ -102,6 +89,7 @@ void displayTrendHigh(int16_t x, int16_t y, uint16_t size, uint16_t color); void displayTrendLow(int16_t x, int16_t y, uint16_t size, uint16_t color); void displayHeader(CommonData &commonData, GwApi::BoatValue *date, GwApi::BoatValue *time, GwApi::BoatValue *hdop); // Draw display header +void displayFooter(CommonData &commonData); SunData calcSunsetSunrise(GwApi *api, double time, double date, double latitude, double longitude, double timezone); // Calulate sunset and sunrise @@ -112,11 +100,68 @@ void startLedTask(GwApi *api); void doImageRequest(GwApi *api, int *pageno, const PageStruct pages[MAX_PAGE_NUMBER], AsyncWebServerRequest *request); -#define fram_width 16 -#define fram_height 16 +// Icons +#define icon_width 16 +#define icon_height 16 + +static unsigned char left_bits[] PROGMEM = { + 0x00, 0x00, 0xc0, 0x01, 0xe0, 0x01, 0xf0, 0x01, 0xf8, 0x01, 0xfc, 0x7f, + 0xfe, 0x7f, 0xff, 0x7f, 0xff, 0x7f, 0xfe, 0x7f, 0xfc, 0x7f, 0xf8, 0x01, + 0xf0, 0x01, 0xe0, 0x01, 0xc0, 0x01, 0x00, 0x00 }; + +static unsigned char right_bits[] PROGMEM = { + 0x00, 0x00, 0x80, 0x03, 0x80, 0x07, 0x80, 0x0f, 0x80, 0x1f, 0xfe, 0x3f, + 0xfe, 0x7f, 0xfe, 0xff, 0xfe, 0xff, 0xfe, 0x7f, 0xfe, 0x3f, 0x80, 0x1f, + 0x80, 0x0f, 0x80, 0x07, 0x80, 0x03, 0x00, 0x00 }; + +static unsigned char swipe_bits[] PROGMEM = { + 0x80, 0x03, 0xe0, 0x06, 0xb0, 0x0a, 0xa8, 0x0a, 0xa8, 0x0a, 0xa8, 0x3a, + 0x28, 0x28, 0x08, 0x28, 0x08, 0x28, 0x08, 0x26, 0x08, 0x21, 0x08, 0x10, + 0x10, 0x08, 0x10, 0x04, 0x10, 0x04, 0x00, 0x00 }; + +static unsigned char lock_bits[] PROGMEM = { + 0xc0, 0x03, 0x60, 0x06, 0x30, 0x0c, 0x10, 0x08, 0x10, 0x08, 0x10, 0x08, + 0xfc, 0x3f, 0x04, 0x20, 0x04, 0x20, 0x84, 0x21, 0x84, 0x21, 0x84, 0x21, + 0x04, 0x20, 0x04, 0x20, 0x04, 0x20, 0xfc, 0x3f }; + +static unsigned char plus_bits[] = { + 0x00, 0x00, 0xe0, 0x01, 0x18, 0x06, 0x04, 0x08, 0xc4, 0x08, 0xc2, 0x10, + 0xf2, 0x13, 0xf2, 0x13, 0xc2, 0x10, 0xc4, 0x08, 0x04, 0x0c, 0x18, 0x1e, + 0xe0, 0x39, 0x00, 0x70, 0x00, 0xe0, 0x00, 0xc0 }; + +static unsigned char minus_bits[] = { + 0x00, 0x00, 0xe0, 0x01, 0x18, 0x06, 0x04, 0x08, 0x04, 0x08, 0x02, 0x10, + 0xf2, 0x13, 0xf2, 0x13, 0x02, 0x10, 0x04, 0x08, 0x04, 0x0c, 0x18, 0x1e, + 0xe0, 0x39, 0x00, 0x70, 0x00, 0xe0, 0x00, 0xc0 }; + static unsigned char fram_bits[] = { 0xf8, 0x1f, 0xff, 0xff, 0x9f, 0xff, 0x98, 0x1f, 0xf8, 0x1f, 0xff, 0xff, 0xff, 0xff, 0xf8, 0x1f, 0xf8, 0x1f, 0xff, 0xff, 0xff, 0xff, 0xf8, 0x1f, 0xf8, 0x1f, 0xff, 0xff, 0xff, 0xff, 0xf8, 0x1f }; +static std::map iconmap = { + {"LEFT", left_bits}, + {"RIGHT", right_bits}, + {"SWIPE", swipe_bits}, + {"LOCK", lock_bits}, + {"PLUS", plus_bits}, + {"MINUS", minus_bits} +}; + +// Other symbols +#define exclamation_width 32 +#define exclamation_height 32 +static unsigned char exclamation_bits[] = { + 0x00, 0xc0, 0x03, 0x00, 0x00, 0x60, 0x06, 0x00, 0x00, 0xb0, 0x0d, 0x00, + 0x00, 0xd8, 0x1b, 0x00, 0x00, 0xec, 0x37, 0x00, 0x00, 0xf6, 0x6f, 0x00, + 0x00, 0x3b, 0xdc, 0x00, 0x80, 0x3d, 0xbc, 0x01, 0xc0, 0x3e, 0x7c, 0x03, + 0x60, 0x3f, 0xfc, 0x06, 0xb0, 0x3f, 0xfc, 0x0d, 0xd8, 0x3f, 0xfc, 0x1b, + 0xec, 0x3f, 0xfc, 0x37, 0xf6, 0x3f, 0xfc, 0x6f, 0xfb, 0x3f, 0xfc, 0xdf, + 0xfd, 0x3f, 0xfc, 0xbf, 0xfd, 0x3f, 0xfc, 0xbf, 0xfb, 0x3f, 0xfc, 0xdf, + 0xf6, 0x3f, 0xfc, 0x6f, 0xec, 0x3f, 0xfc, 0x37, 0xd8, 0xff, 0xff, 0x1b, + 0xb0, 0xff, 0xff, 0x0d, 0x60, 0x3f, 0xfc, 0x06, 0xc0, 0x3e, 0x7c, 0x03, + 0x80, 0x3d, 0xbc, 0x01, 0x00, 0x3b, 0xdc, 0x00, 0x00, 0xf6, 0x6f, 0x00, + 0x00, 0xec, 0x37, 0x00, 0x00, 0xd8, 0x1b, 0x00, 0x00, 0xb0, 0x0d, 0x00, + 0x00, 0x60, 0x06, 0x00, 0x00, 0xc0, 0x03, 0x00 }; + #endif diff --git a/lib/obp60task/OBP60Keypad.h b/lib/obp60task/OBP60Keypad.h index e51fe9d..017d07f 100644 --- a/lib/obp60task/OBP60Keypad.h +++ b/lib/obp60task/OBP60Keypad.h @@ -19,6 +19,38 @@ int keydelay = 250; // Delay after key pressed in [ms] bool keylock = false; // Key lock after pressed key is valid (repeat protection by conginous pressing) long starttime = 0; // Start time point for pressed key +void initKeys(CommonData &commonData) { + // coordinates for virtual keyboard keys + commonData.keydata[0].x = 1; + commonData.keydata[0].y = 281; + commonData.keydata[0].w = 67; + commonData.keydata[0].h = 18; + + commonData.keydata[1].x = 69; + commonData.keydata[1].y = 281; + commonData.keydata[1].w = 66; + commonData.keydata[1].h = 18; + + commonData.keydata[2].x = 135; + commonData.keydata[2].y = 281; + commonData.keydata[2].w = 66; + commonData.keydata[2].h = 18; + + commonData.keydata[3].x = 201; + commonData.keydata[3].y = 281; + commonData.keydata[3].w = 66; + commonData.keydata[3].h = 18; + + commonData.keydata[4].x = 267; + commonData.keydata[4].y = 281; + commonData.keydata[4].w = 66; + commonData.keydata[4].h = 18; + + commonData.keydata[5].x = 333; + commonData.keydata[5].y = 281; + commonData.keydata[5].w = 66; + commonData.keydata[5].h = 18; +} int readKeypad(uint thSensitivity) { @@ -177,4 +209,4 @@ int readKeypad(uint thSensitivity) { return keystatus; } -#endif \ No newline at end of file +#endif diff --git a/lib/obp60task/PageBME280.cpp b/lib/obp60task/PageBME280.cpp index 3b68de6..f0f02c0 100644 --- a/lib/obp60task/PageBME280.cpp +++ b/lib/obp60task/PageBME280.cpp @@ -176,17 +176,6 @@ class PageBME280 : public Page // Show bus data getdisplay().print(svalue3); // Real value as formated string - // ############### Key Layout ################ - - // Key Layout - getdisplay().setFont(&Ubuntu_Bold8pt7b); - if(commonData->keylock == false){ - if(String(backlightMode) == "Control by Key"){ // Key for illumination - getdisplay().setCursor(343, 290); - getdisplay().print("[ILUM]"); - } - } - // Update display getdisplay().nextPage(); // Partial update (fast) diff --git a/lib/obp60task/PageBattery.cpp b/lib/obp60task/PageBattery.cpp index 1b12d93..bbde098 100644 --- a/lib/obp60task/PageBattery.cpp +++ b/lib/obp60task/PageBattery.cpp @@ -13,6 +13,11 @@ class PageBattery : public Page common.logger->logDebug(GwLog::LOG,"Instantiate PageBattery"); } + virtual void setupKeys(){ + Page::setupKeys(); + commonData->keydata[0].label = "AVG"; + } + virtual int handleKey(int key){ // Change average if(key == 1){ @@ -283,20 +288,6 @@ class PageBattery : public Page getdisplay().print("---"); // No sensor data (sensor is off) } - - // ############### Key Layout ################ - - // Key Layout - getdisplay().setFont(&Ubuntu_Bold8pt7b); - if(commonData->keylock == false){ - getdisplay().setCursor(10, 290); - getdisplay().print("[AVG]"); - if(String(backlightMode) == "Control by Key"){ // Key for illumination - getdisplay().setCursor(343, 290); - getdisplay().print("[ILUM]"); - } - } - // Update display getdisplay().nextPage(); // Partial update (fast) diff --git a/lib/obp60task/PageBattery2.cpp b/lib/obp60task/PageBattery2.cpp index 4cb4a40..b8694a7 100644 --- a/lib/obp60task/PageBattery2.cpp +++ b/lib/obp60task/PageBattery2.cpp @@ -16,6 +16,12 @@ public: commonData = &common; common.logger->logDebug(GwLog::LOG,"Instantiate PageBattery2"); } + + virtual void setupKeys(){ + Page::setupKeys(); + commonData->keydata[0].label = "AVG"; + } + virtual int handleKey(int key){ // Change average if(key == 1){ @@ -328,17 +334,6 @@ public: getdisplay().setFont(&Ubuntu_Bold16pt7b); getdisplay().print("W"); - // Key Layout - getdisplay().setFont(&Ubuntu_Bold8pt7b); - if(commonData->keylock == false){ - getdisplay().setCursor(10, 290); - getdisplay().print("[AVG]"); - if(String(backlightMode) == "Control by Key"){ // Key for illumination - getdisplay().setCursor(343, 290); - getdisplay().print("[ILUM]"); - } - } - // Update display getdisplay().nextPage(); // Partial update (fast) }; diff --git a/lib/obp60task/PageClock.cpp b/lib/obp60task/PageClock.cpp index f99679a..3442797 100644 --- a/lib/obp60task/PageClock.cpp +++ b/lib/obp60task/PageClock.cpp @@ -312,16 +312,6 @@ public: getdisplay().fillCircle(200, 150, startwidth + 6, commonData->bgcolor); getdisplay().fillCircle(200, 150, startwidth + 4, commonData->fgcolor); -//******************************************************************************************* - // Key Layout - getdisplay().setFont(&Ubuntu_Bold8pt7b); - if(commonData->keylock == false){ - if(String(backlightMode) == "Control by Key"){ // Key for illumination - getdisplay().setCursor(343, 290); - getdisplay().print("[ILUM]"); - } - } - // Update display getdisplay().nextPage(); // Partial update (fast) diff --git a/lib/obp60task/PageDST810.cpp b/lib/obp60task/PageDST810.cpp index 568e3e2..0da67ff 100644 --- a/lib/obp60task/PageDST810.cpp +++ b/lib/obp60task/PageDST810.cpp @@ -242,18 +242,6 @@ public: unit4old = unit4; // Save the old unit } - - // ############### Key Layout ################ - - // Key Layout - getdisplay().setFont(&Ubuntu_Bold8pt7b); - if(commonData->keylock == false){ - if(String(backlightMode) == "Control by Key"){ // Key for illumination - getdisplay().setCursor(343, 290); - getdisplay().print("[ILUM]"); - } - } - // Update display getdisplay().nextPage(); // Partial update (fast) diff --git a/lib/obp60task/PageFluid.cpp b/lib/obp60task/PageFluid.cpp index 6c12635..e03c814 100644 --- a/lib/obp60task/PageFluid.cpp +++ b/lib/obp60task/PageFluid.cpp @@ -57,6 +57,13 @@ static unsigned char gasoline_bits[] = { 0x98, 0xcf, 0x38, 0xe7, 0x78, 0xf0, 0xf8, 0xfa, 0xf8, 0xfa, 0x78, 0xf0, 0x38, 0xe7, 0x98, 0xcf, 0xf8, 0xff, 0xf0, 0x7f }; +#define fish_width 16 +#define fish_height 16 +static unsigned char fish_bits[] = { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x01, 0xf0, 0x03, 0xf8, 0x37, + 0xfc, 0x7f, 0xfc, 0x7f, 0xec, 0x3f, 0xfc, 0x7f, 0xfc, 0x7f, 0xf8, 0x37, + 0xf0, 0x03, 0xe0, 0x01, 0x00, 0x00, 0x00, 0x00 }; + class PageFluid : public Page { int fluidtype; @@ -150,6 +157,12 @@ class PageFluid : public Page case 1: getdisplay().drawXBitmap(c.x-8, c.y-50, water_bits, water_width, water_height, commonData->fgcolor); break; + case 2: // gray water no symbol yet + // getdisplay().drawXBitmap(c.x-8, c.y-50, gray_bits, gray_width, gray_height, commonData->fgcolor); + break; + case 3: + getdisplay().drawXBitmap(c.x-8, c.y-50, fish_bits, fish_width, fish_height, commonData->fgcolor); + break; case 4: getdisplay().drawXBitmap(c.x-8, c.y-50, oil_bits, oil_width, oil_height, commonData->fgcolor); break; @@ -215,15 +228,6 @@ class PageFluid : public Page getdisplay().fillCircle(c.x, c.y, 6, commonData->bgcolor); } - // Key Layout - getdisplay().setFont(&Ubuntu_Bold8pt7b); - if(commonData->keylock == false){ - if(String(backlightMode) == "Control by Key"){ // Key for illumination - getdisplay().setCursor(343, 296); - getdisplay().print("[ILUM]"); - } - } - // Update display getdisplay().nextPage(); // Partial update (fast) diff --git a/lib/obp60task/PageFourValues.cpp b/lib/obp60task/PageFourValues.cpp index e0c418f..73329e4 100644 --- a/lib/obp60task/PageFourValues.cpp +++ b/lib/obp60task/PageFourValues.cpp @@ -282,18 +282,6 @@ class PageFourValues : public Page unit4old = unit4; // Save the old unit } - - // ############### Key Layout ################ - - // Key Layout - getdisplay().setFont(&Ubuntu_Bold8pt7b); - if(commonData->keylock == false){ - if(String(backlightMode) == "Control by Key"){ // Key for illumination - getdisplay().setCursor(343, 290); - getdisplay().print("[ILUM]"); - } - } - // Update display getdisplay().nextPage(); // Partial update (fast) diff --git a/lib/obp60task/PageFourValues2.cpp b/lib/obp60task/PageFourValues2.cpp index 9f3f07b..6ac5981 100644 --- a/lib/obp60task/PageFourValues2.cpp +++ b/lib/obp60task/PageFourValues2.cpp @@ -282,18 +282,6 @@ class PageFourValues2 : public Page unit4old = unit4; // Save the old unit } - - // ############### Key Layout ################ - - // Key Layout - getdisplay().setFont(&Ubuntu_Bold8pt7b); - if(commonData->keylock == false){ - if(String(backlightMode) == "Control by Key"){ // Key for illumination - getdisplay().setCursor(343, 290); - getdisplay().print("[ILUM]"); - } - } - // Update display getdisplay().nextPage(); // Partial update (fast) diff --git a/lib/obp60task/PageGenerator.cpp b/lib/obp60task/PageGenerator.cpp index fc0c402..20e7652 100644 --- a/lib/obp60task/PageGenerator.cpp +++ b/lib/obp60task/PageGenerator.cpp @@ -203,15 +203,6 @@ public: getdisplay().setFont(&Ubuntu_Bold16pt7b); getdisplay().print("W"); - // Key Layout - getdisplay().setFont(&Ubuntu_Bold8pt7b); - if(commonData->keylock == false){ - if(String(backlightMode) == "Control by Key"){ // Key for illumination - getdisplay().setCursor(343, 290); - getdisplay().print("[ILUM]"); - } - } - // Update display getdisplay().nextPage(); // Partial update (fast) }; diff --git a/lib/obp60task/PageKeelPosition.cpp b/lib/obp60task/PageKeelPosition.cpp index 6ecaf61..f3eac49 100644 --- a/lib/obp60task/PageKeelPosition.cpp +++ b/lib/obp60task/PageKeelPosition.cpp @@ -206,16 +206,6 @@ public: getdisplay().print("No sensor data"); // Info missing sensor } -//******************************************************************************************* - // Key Layout - getdisplay().setFont(&Ubuntu_Bold8pt7b); - if(commonData->keylock == false){ - if(String(backlightMode) == "Control by Key"){ // Key for illumination - getdisplay().setCursor(343, 290); - getdisplay().print("[ILUM]"); - } - } - // Update display getdisplay().nextPage(); // Partial update (fast) diff --git a/lib/obp60task/PageOneValue.cpp b/lib/obp60task/PageOneValue.cpp index 6910890..84aff6d 100644 --- a/lib/obp60task/PageOneValue.cpp +++ b/lib/obp60task/PageOneValue.cpp @@ -102,15 +102,6 @@ class PageOneValue : public Page unit1old = unit1; // Save the old unit } - // Key Layout - getdisplay().setFont(&Ubuntu_Bold8pt7b); - if(commonData->keylock == false){ - if(String(backlightMode) == "Control by Key"){ // Key for illumination - getdisplay().setCursor(343, 290); - getdisplay().print("[ILUM]"); - } - } - // Update display getdisplay().nextPage(); // Partial update (fast) diff --git a/lib/obp60task/PageRollPitch.cpp b/lib/obp60task/PageRollPitch.cpp index b7c4c57..320e43f 100644 --- a/lib/obp60task/PageRollPitch.cpp +++ b/lib/obp60task/PageRollPitch.cpp @@ -305,16 +305,6 @@ public: getdisplay().print("No sensor data"); // Info missing sensor } -//******************************************************************************************* - // Key Layout - getdisplay().setFont(&Ubuntu_Bold8pt7b); - if(commonData->keylock == false){ - if(String(backlightMode) == "Control by Key"){ // Key for illumination - getdisplay().setCursor(343, 290); - getdisplay().print("[ILUM]"); - } - } - // Update display getdisplay().nextPage(); // Partial update (fast) diff --git a/lib/obp60task/PageRudderPosition.cpp b/lib/obp60task/PageRudderPosition.cpp index afceeb4..6ed0d4c 100644 --- a/lib/obp60task/PageRudderPosition.cpp +++ b/lib/obp60task/PageRudderPosition.cpp @@ -205,16 +205,6 @@ public: getdisplay().fillCircle(200, 150, startwidth + 6, commonData->bgcolor); getdisplay().fillCircle(200, 150, startwidth + 4, commonData->fgcolor); -//******************************************************************************************* - // Key Layout - getdisplay().setFont(&Ubuntu_Bold8pt7b); - if(commonData->keylock == false){ - if(String(backlightMode) == "Control by Key"){ // Key for illumination - getdisplay().setCursor(343, 290); - getdisplay().print("[ILUM]"); - } - } - // Update display getdisplay().nextPage(); // Partial update (fast) }; diff --git a/lib/obp60task/PageSolar.cpp b/lib/obp60task/PageSolar.cpp index 786dfe7..646a568 100644 --- a/lib/obp60task/PageSolar.cpp +++ b/lib/obp60task/PageSolar.cpp @@ -199,15 +199,6 @@ public: getdisplay().setFont(&Ubuntu_Bold16pt7b); getdisplay().print("W"); - // Key Layout - getdisplay().setFont(&Ubuntu_Bold8pt7b); - if(commonData->keylock == false){ - if(String(backlightMode) == "Control by Key"){ // Key for illumination - getdisplay().setCursor(343, 290); - getdisplay().print("[ILUM]"); - } - } - // Update display getdisplay().nextPage(); // Partial update (fast) }; diff --git a/lib/obp60task/PageThreeValues.cpp b/lib/obp60task/PageThreeValues.cpp index a4fbf90..c740b30 100644 --- a/lib/obp60task/PageThreeValues.cpp +++ b/lib/obp60task/PageThreeValues.cpp @@ -222,18 +222,6 @@ class PageThreeValues : public Page unit3old = unit3; // Save the old unit } - - // ############### Key Layout ################ - - // Key Layout - getdisplay().setFont(&Ubuntu_Bold8pt7b); - if(commonData->keylock == false){ - if(String(backlightMode) == "Control by Key"){ // Key for illumination - getdisplay().setCursor(343, 290); - getdisplay().print("[ILUM]"); - } - } - // Update display getdisplay().nextPage(); // Partial update (fast) }; diff --git a/lib/obp60task/PageTwoValues.cpp b/lib/obp60task/PageTwoValues.cpp index e8dcf40..6b8d0d1 100644 --- a/lib/obp60task/PageTwoValues.cpp +++ b/lib/obp60task/PageTwoValues.cpp @@ -163,22 +163,6 @@ class PageTwoValues : public Page unit2old = unit2; // Save the old unit } - - // ############### Key Layout ################ - - // Key Layout - getdisplay().setFont(&Ubuntu_Bold8pt7b); - if(commonData->keylock == false){ - 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) }; diff --git a/lib/obp60task/PageVoltage.cpp b/lib/obp60task/PageVoltage.cpp index 76d67e2..cc77b01 100644 --- a/lib/obp60task/PageVoltage.cpp +++ b/lib/obp60task/PageVoltage.cpp @@ -22,6 +22,14 @@ public: mode = fram.read(FRAM_VOLTAGE_MODE); } } + + virtual void setupKeys(){ + Page::setupKeys(); + commonData->keydata[0].label = "AVG"; + commonData->keydata[1].label = "MODE"; + commonData->keydata[4].label = "TRD"; + } + virtual int handleKey(int key){ // Change average if(key == 1){ @@ -242,10 +250,8 @@ public: } } - // Trend indicator // Show trend indicator if(trend == true){ - getdisplay().fillRect(310, 240, 40, 120, commonData->bgcolor); // Clear area getdisplay().fillRect(315, 183, 35, 4, commonData->fgcolor); // Draw separator if(int(raw * 10) > int(valueTrend * 10)){ displayTrendHigh(320, 174, 11, commonData->fgcolor); // Show high indicator @@ -254,10 +260,6 @@ public: displayTrendLow(320, 195, 11, commonData->fgcolor); // Show low indicator } } - // No trend indicator - else{ - getdisplay().fillRect(310, 240, 40, 120, commonData->bgcolor); // Clear area - } } else { @@ -360,27 +362,11 @@ public: // FRAM indicator if (hasFRAM) { - getdisplay().drawXBitmap(300, 240, fram_bits, fram_width, fram_height, commonData->fgcolor); + getdisplay().drawXBitmap(300, 240, fram_bits, icon_width, icon_height, commonData->fgcolor); } } - // Key Layout - getdisplay().setTextColor(commonData->fgcolor); - getdisplay().setFont(&Ubuntu_Bold8pt7b); - if(commonData->keylock == false){ - getdisplay().setCursor(10, 290); - getdisplay().print("[AVG]"); - getdisplay().setCursor(62, 290); - getdisplay().print("[MODE]"); - getdisplay().setCursor(293, 290); - getdisplay().print("[TRD]"); - if(String(backlightMode) == "Control by Key"){ // Key for illumination - getdisplay().setCursor(343, 290); - getdisplay().print("[ILUM]"); - } - } - // Update display getdisplay().nextPage(); // Partial update (fast) }; diff --git a/lib/obp60task/PageWind.cpp b/lib/obp60task/PageWind.cpp index 39f6a67..3702613 100644 --- a/lib/obp60task/PageWind.cpp +++ b/lib/obp60task/PageWind.cpp @@ -229,6 +229,17 @@ public: } } + virtual void setupKeys(){ + Page::setupKeys(); + commonData->keydata[0].label = "MODE"; + if (mode == 'X') { + commonData->keydata[1].label = "#MINUS"; + commonData->keydata[4].label = "#PLUS"; + } else { + commonData->keydata[1].label = "SRC"; + } + } + // Key functions virtual int handleKey(int key){ @@ -241,26 +252,28 @@ public: mode = 'N'; } if (hasFRAM) fram.write(FRAM_WIND_MODE, mode); + setupKeys(); return 0; // Commit the key } - if(key == 3){ // Source switch - if(source == 'A'){ - source = 'T'; + // Set source or reduce instrument size + if(key == 2){ + if(mode == 'X'){ + // Code for reduce + lp = lp - 10; + if(lp < 10){ + lp = 10; + } + if (hasFRAM) fram.write(FRAM_WIND_SIZE, lp); } else { - source = 'A'; + // Code for set source + if(source == 'A'){ + source = 'T'; + } else { + source = 'A'; + } + if (hasFRAM) fram.write(FRAM_WIND_SRC, source); } - if (hasFRAM) fram.write(FRAM_WIND_SRC, source); - return 0; // Commit the key - } - - // Reduce instrument size - if(key == 2 && mode == 'X'){ // Code for reduce - lp = lp - 10; - if(lp < 10){ - lp = 10; - } - if (hasFRAM) fram.write(FRAM_WIND_SIZE, lp); return 0; // Commit the key } @@ -599,25 +612,6 @@ public: } - // Key Layout - getdisplay().setFont(&Ubuntu_Bold8pt7b); - if(commonData->keylock == false){ - getdisplay().setCursor(10, 290); - getdisplay().print("[MODE]"); - - if (mode == 'X') { - getdisplay().setCursor(85, 290); - getdisplay().print("[ - ]"); - getdisplay().setCursor(295, 290); - getdisplay().print("[ + ]"); - } - - if(String(backlightMode) == "Control by Key"){ // Key for illumination - getdisplay().setCursor(343, 290); - getdisplay().print("[ILUM]"); - } - } - // Update display getdisplay().nextPage(); // Partial update (fast) diff --git a/lib/obp60task/PageWindRose.cpp b/lib/obp60task/PageWindRose.cpp index be3d468..88c490f 100644 --- a/lib/obp60task/PageWindRose.cpp +++ b/lib/obp60task/PageWindRose.cpp @@ -10,7 +10,7 @@ int16_t lp = 80; // Pointer length public: PageWindRose(CommonData &common){ commonData = &common; - common.logger->logDebug(GwLog::LOG,"Show PageWindRose"); + common.logger->logDebug(GwLog::LOG,"Instantiate PageWindRose"); } // Key functions @@ -350,15 +350,6 @@ public: getdisplay().print(unit6old); // Unit } - // Key Layout - getdisplay().setFont(&Ubuntu_Bold8pt7b); - if(commonData->keylock == false){ - if(String(backlightMode) == "Control by Key"){ // Key for illumination - getdisplay().setCursor(343, 290); - getdisplay().print("[ILUM]"); - } - } - // Update display getdisplay().nextPage(); // Partial update (fast) }; diff --git a/lib/obp60task/PageWindRoseFlex.cpp b/lib/obp60task/PageWindRoseFlex.cpp index a01e73f..ba4b029 100644 --- a/lib/obp60task/PageWindRoseFlex.cpp +++ b/lib/obp60task/PageWindRoseFlex.cpp @@ -10,7 +10,7 @@ int16_t lp = 80; // Pointer length public: PageWindRoseFlex(CommonData &common){ commonData = &common; - common.logger->logDebug(GwLog::LOG,"Show PageWindRoseFlex"); + common.logger->logDebug(GwLog::LOG,"Instantiate PageWindRoseFlex"); } // Key functions @@ -351,15 +351,6 @@ public: getdisplay().print(unit6old); // Unit } - // Key Layout - getdisplay().setFont(&Ubuntu_Bold8pt7b); - if(commonData->keylock == false){ - if(String(backlightMode) == "Control by Key"){ // Key for illumination - getdisplay().setCursor(343, 290); - getdisplay().print("[ILUM]"); - } - } - // Update display getdisplay().nextPage(); // Partial update (fast) }; diff --git a/lib/obp60task/PageXTETrack.cpp b/lib/obp60task/PageXTETrack.cpp index d16a8b7..7b5f487 100644 --- a/lib/obp60task/PageXTETrack.cpp +++ b/lib/obp60task/PageXTETrack.cpp @@ -197,15 +197,6 @@ class PageXTETrack : public Page drawSegment(399, 100, 318, 24, 289, 24, 350, 100, commonData->fgcolor, seg[4]); drawSegment(399, 54, 354, 24, 325, 24, 399, 90, commonData->fgcolor, seg[5]); - // Key Layout - getdisplay().setFont(&Ubuntu_Bold8pt7b); - if(commonData->keylock == false){ - if(String(backlightMode) == "Control by Key"){ // Key for illumination - getdisplay().setCursor(343, 296); - getdisplay().print("[ILUM]"); - } - } - // Update display getdisplay().nextPage(); // Partial update (fast) diff --git a/lib/obp60task/Pagedata.h b/lib/obp60task/Pagedata.h index 9f9764c..2a72ba6 100644 --- a/lib/obp60task/Pagedata.h +++ b/lib/obp60task/Pagedata.h @@ -3,6 +3,7 @@ #include "GwApi.h" #include #include +#include "LedSpiTask.h" #define MAX_PAGE_NUMBER 10 // Max number of pages for show data @@ -63,12 +64,30 @@ typedef struct{ bool sunDown = true; } SunData; +typedef struct{ + String label = ""; + bool selected = false; // for virtual keyboard function + uint16_t x; + uint16_t y; + uint16_t w; + uint16_t h; +} TouchKeyData; + +typedef struct{ + Color color; // red, orange, yellow, green, blue, aqua, violet, white + BacklightMode mode; // off, on, sun, bus, time, key + uint8_t brightness; // 0% (off), user setting from 20% to 100% full power + bool on; // fast on/off detector +} BacklightData; + typedef struct{ GwApi::Status status; GwLog *logger=NULL; GwConfigHandler *config=NULL; SensorData data; SunData sundata; + TouchKeyData keydata[6]; + BacklightData backlight; GwApi::BoatValue *time=NULL; GwApi::BoatValue *date=NULL; uint16_t fgcolor; @@ -83,6 +102,18 @@ class Page{ public: virtual void displayPage(PageData &pageData)=0; virtual void displayNew(PageData &pageData){} + virtual void setupKeys() { + commonData->keydata[0].label = ""; + commonData->keydata[1].label = ""; + commonData->keydata[2].label = "#LEFT"; + commonData->keydata[3].label = "#RIGHT"; + commonData->keydata[4].label = ""; + if (commonData->backlight.mode == KEY) { + commonData->keydata[5].label = "ILUM"; + } else { + commonData->keydata[5].label = ""; + } + } //return -1 if handled by the page virtual int handleKey(int key){return key;} }; diff --git a/lib/obp60task/obp60task.cpp b/lib/obp60task/obp60task.cpp index ade14fa..f336f68 100644 --- a/lib/obp60task/obp60task.cpp +++ b/lib/obp60task/obp60task.cpp @@ -76,10 +76,10 @@ void OBP60Init(GwApi *api){ if(String(backlightMode) == "On"){ setBacklightLED(brightness, colorMapping(backlightColor)); } - if(String(backlightMode) == "Off"){ + else if(String(backlightMode) == "Off"){ setBacklightLED(0, COLOR_BLACK); // Backlight LEDs off (blue without britghness) } - if(String(backlightMode) == "Control by Key"){ + else if(String(backlightMode) == "Control by Key"){ setBacklightLED(0, COLOR_BLUE); // Backlight LEDs off (blue without britghness) } @@ -285,13 +285,16 @@ void OBP60Task(GwApi *api){ commonData.logger=logger; commonData.config=config; + // Keyboard coordinates for page footer + initKeys(commonData); + tN2kMsg N2kMsg; LOG_DEBUG(GwLog::LOG,"obp60task started"); for (auto it=allPages.pages.begin();it != allPages.pages.end();it++){ LOG_DEBUG(GwLog::LOG,"found registered page %s",(*it)->pageName.c_str()); } - + // Init E-Ink display String displaymode = api->getConfig()->getConfigItem(api->getConfig()->display,true)->asString(); String displaycolor = api->getConfig()->getConfigItem(api->getConfig()->displaycolor,true)->asString(); @@ -416,12 +419,13 @@ void OBP60Task(GwApi *api){ // Configuration values for main loop String gpsFix = api->getConfig()->getConfigItem(api->getConfig()->flashLED,true)->asString(); - String backlight = api->getConfig()->getConfigItem(api->getConfig()->backlight,true)->asString(); String gpsOn=api->getConfig()->getConfigItem(api->getConfig()->useGPS,true)->asString(); String tz = api->getConfig()->getConfigItem(api->getConfig()->timeZone,true)->asString(); - String backlightColor = api->getConfig()->getConfigItem(api->getConfig()->blColor,true)->asString(); - Color color = colorMapping(backlightColor); - uint brightness = 2.55 * uint(api->getConfig()->getConfigItem(api->getConfig()->blBrightness,true)->asInt()); + + commonData.backlight.mode = backlightMapping(config->getConfigItem(config->backlight,true)->asString()); + commonData.backlight.color = colorMapping(config->getConfigItem(config->blColor,true)->asString()); + commonData.backlight.brightness = 2.55 * uint(config->getConfigItem(config->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()); @@ -448,7 +452,9 @@ void OBP60Task(GwApi *api){ long starttime3 = millis(); // Display update all 1s long starttime4 = millis(); // Delayed display update after 4s when select a new page long starttime5 = millis(); // Calculate sunrise and sunset all 1s - + + pages[pageNumber].page->setupKeys(); // Initialize keys for first page + // Main loop runs with 100ms //#################################################################################### @@ -505,14 +511,15 @@ void OBP60Task(GwApi *api){ { // Decoding all key codes // #6 Backlight on if key controled - if(String(backlight) == "Control by Key"){ + if (commonData.backlight.mode == BacklightMode::KEY) { + // if(String(backlight) == "Control by Key"){ if(keyboardMessage == 6){ LOG_DEBUG(GwLog::LOG,"Toggle Backlight LED"); - toggleBacklightLED(brightness, color); + toggleBacklightLED(commonData.backlight.brightness, commonData.backlight.color); } } - // #9 Swipe right - if (keyboardMessage == 9) + // #9 Swipe right or #4 key right + if ((keyboardMessage == 9) or (keyboardMessage == 4)) { pageNumber++; if (pageNumber >= numPages){ @@ -521,8 +528,8 @@ void OBP60Task(GwApi *api){ commonData.data.actpage = pageNumber + 1; commonData.data.maxpage = numPages; } - // #10 Swipe left - if (keyboardMessage == 10) + // #10 Swipe left or #3 key left + if ((keyboardMessage == 10) or (keyboardMessage == 3)) { pageNumber--; if (pageNumber < 0){ @@ -549,9 +556,10 @@ void OBP60Task(GwApi *api){ // Provide sundata to all pages commonData.sundata = calcSunsetSunrise(api, time->value , date->value, lat->value, lon->value, tz.toDouble()); // Backlight with sun control - if(String(backlight) == "Control by Sun"){ + if (commonData.backlight.mode == BacklightMode::SUN) { + // if(String(backlight) == "Control by Sun"){ if(commonData.sundata.sunDown == true){ - setBacklightLED(brightness, color); + setBacklightLED(commonData.backlight.brightness, commonData.backlight.color); } else{ setBacklightLED(0, COLOR_BLUE); // Backlight LEDs off (blue without britghness) @@ -616,11 +624,11 @@ void OBP60Task(GwApi *api){ // Show header if enabled getdisplay().fillRect(0, 0, getdisplay().width(), getdisplay().height(), commonData.bgcolor); // Clear display if (pages[pageNumber].description && pages[pageNumber].description->header){ - //build some header and footer using commonData - getdisplay().fillScreen(commonData.bgcolor); // Clear display - displayHeader(commonData, date, time, hdop); // Sown header + // build header using commonData + getdisplay().fillScreen(commonData.bgcolor); // Clear display + displayHeader(commonData, date, time, hdop); // Show page header } - + // Call the particular page Page *currentPage=pages[pageNumber].page; if (currentPage == NULL){ @@ -630,11 +638,16 @@ void OBP60Task(GwApi *api){ else{ if (lastPage != pageNumber){ if (hasFRAM) fram.write(FRAM_PAGE_NO, pageNumber); // remember page for device restart + currentPage->setupKeys(); currentPage->displayNew(pages[pageNumber].parameters); lastPage=pageNumber; } //call the page code LOG_DEBUG(GwLog::DEBUG,"calling page %d",pageNumber); + // Show footer if enabled (together with header) + if (pages[pageNumber].description && pages[pageNumber].description->header){ + displayFooter(commonData); + } currentPage->displayPage(pages[pageNumber].parameters); } } From f690cf3a3491a0a32719011ca24cf41789684983 Mon Sep 17 00:00:00 2001 From: Thomas Hooge Date: Thu, 16 Jan 2025 19:39:35 +0100 Subject: [PATCH 05/11] Hide key labels in keylock mode, improved swipe icon --- lib/obp60task/OBP60Extensions.cpp | 69 ++++++++++++++----------------- lib/obp60task/OBP60Extensions.h | 14 +++---- 2 files changed, 39 insertions(+), 44 deletions(-) diff --git a/lib/obp60task/OBP60Extensions.cpp b/lib/obp60task/OBP60Extensions.cpp index 2e4ae1c..146f3c9 100644 --- a/lib/obp60task/OBP60Extensions.cpp +++ b/lib/obp60task/OBP60Extensions.cpp @@ -287,15 +287,11 @@ void displayHeader(CommonData &commonData, GwApi::BoatValue *date, GwApi::BoatVa if(commonData.config->getBool(commonData.config->statusLine) == true){ - if(commonData.config->getString(commonData.config->displaycolor) == "Normal"){ - textcolor = GxEPD_BLACK; - } - else{ - textcolor = GxEPD_WHITE; - } + // Header separator line (optional) + // getdisplay().drawLine(0, 19, 399, 19, commonData.fgcolor); // Show status info - getdisplay().setTextColor(textcolor); + getdisplay().setTextColor(commonData.fgcolor); getdisplay().setFont(&Ubuntu_Bold8pt7b); getdisplay().setCursor(0, 15); if(commonData.status.wifiApOn){ @@ -339,18 +335,18 @@ void displayHeader(CommonData &commonData, GwApi::BoatValue *date, GwApi::BoatVa // Current page number in a small box getdisplay().setFont(&Ubuntu_Bold8pt7b); - getdisplay().drawRect(170, 2, 20, 15, textcolor); + getdisplay().drawRect(170, 2, 20, 15, commonData.fgcolor); drawTextCenter(179, 9, String(commonData.data.actpage)); // Heartbeat as dot - getdisplay().setTextColor(textcolor); + getdisplay().setTextColor(commonData.fgcolor); getdisplay().setFont(&Ubuntu_Bold32pt7b); getdisplay().setCursor(205, 14); getdisplay().print(heartbeat ? "." : " "); heartbeat = !heartbeat; // Date and time - getdisplay().setTextColor(textcolor); + getdisplay().setTextColor(commonData.fgcolor); getdisplay().setFont(&Ubuntu_Bold8pt7b); getdisplay().setCursor(230, 15); // Show date and time if date present @@ -382,45 +378,44 @@ void displayHeader(CommonData &commonData, GwApi::BoatValue *date, GwApi::BoatVa void displayFooter(CommonData &commonData) { - static const uint16_t cx[6] = {35, 101, 167, 233, 299, 365}; // label center positions - static const uint16_t cy = 290; - getdisplay().setFont(&Atari16px); getdisplay().setTextColor(commonData.fgcolor); // Frame around key icon area getdisplay().drawLine(0, 280, 399, 280, commonData.fgcolor); - getdisplay().drawLine(68, 280, 68, 299, commonData.fgcolor); - getdisplay().drawLine(134, 280, 134, 299, commonData.fgcolor); - getdisplay().drawLine(200, 280, 200, 299, commonData.fgcolor); - getdisplay().drawLine(266, 280, 266, 299, commonData.fgcolor); - getdisplay().drawLine(332, 280, 332, 299, commonData.fgcolor); - - for (int i=0; i<6; i++) { - uint16_t x, y; - if (commonData.keydata[i].label.length() > 0) { - // check if icon is enabled - String icon_name = commonData.keydata[i].label.substring(1); - if (commonData.keydata[i].label[0] == '#') { - if (iconmap.find(icon_name) != iconmap.end()) { - x = commonData.keydata[i].x + (commonData.keydata[i].w - icon_width) / 2; - y = commonData.keydata[i].y + (commonData.keydata[i].h - icon_height) / 2; - getdisplay().drawXBitmap(x, y, iconmap[icon_name], icon_width, icon_height, commonData.fgcolor); + if (! commonData.keylock) { + getdisplay().drawLine(68, 280, 68, 299, commonData.fgcolor); + getdisplay().drawLine(134, 280, 134, 299, commonData.fgcolor); + getdisplay().drawLine(200, 280, 200, 299, commonData.fgcolor); + getdisplay().drawLine(266, 280, 266, 299, commonData.fgcolor); + getdisplay().drawLine(332, 280, 332, 299, commonData.fgcolor); + for (int i = 0; i < 6; i++) { + uint16_t x, y; + if (commonData.keydata[i].label.length() > 0) { + // check if icon is enabled + String icon_name = commonData.keydata[i].label.substring(1); + if (commonData.keydata[i].label[0] == '#') { + if (iconmap.find(icon_name) != iconmap.end()) { + x = commonData.keydata[i].x + (commonData.keydata[i].w - icon_width) / 2; + y = commonData.keydata[i].y + (commonData.keydata[i].h - icon_height) / 2; + getdisplay().drawXBitmap(x, y, iconmap[icon_name], icon_width, icon_height, commonData.fgcolor); + } else { + // icon is missing, use name instead + x = commonData.keydata[i].x + commonData.keydata[i].w / 2; + y = commonData.keydata[i].y + commonData.keydata[i].h / 2; + drawTextCenter(x, y, icon_name); + } } else { - // icon is missing, use name instead x = commonData.keydata[i].x + commonData.keydata[i].w / 2; y = commonData.keydata[i].y + commonData.keydata[i].h / 2; - drawTextCenter(x, y, icon_name); + drawTextCenter(x, y, commonData.keydata[i].label); } - } else { - //drawTextCenter(cx[i], cy, commonData.keydata[i].label); - x = commonData.keydata[i].x + commonData.keydata[i].w / 2; - y = commonData.keydata[i].y + commonData.keydata[i].h / 2; - drawTextCenter(x, y, commonData.keydata[i].label); } } + } else { + getdisplay().setCursor(65, 295); + getdisplay().print("Press 1 and 6 fast to unlock keys"); } - } // Sunset und sunrise calculation diff --git a/lib/obp60task/OBP60Extensions.h b/lib/obp60task/OBP60Extensions.h index e94c535..6665dc3 100644 --- a/lib/obp60task/OBP60Extensions.h +++ b/lib/obp60task/OBP60Extensions.h @@ -114,27 +114,27 @@ static unsigned char right_bits[] PROGMEM = { 0xfe, 0x7f, 0xfe, 0xff, 0xfe, 0xff, 0xfe, 0x7f, 0xfe, 0x3f, 0x80, 0x1f, 0x80, 0x0f, 0x80, 0x07, 0x80, 0x03, 0x00, 0x00 }; -static unsigned char swipe_bits[] PROGMEM = { - 0x80, 0x03, 0xe0, 0x06, 0xb0, 0x0a, 0xa8, 0x0a, 0xa8, 0x0a, 0xa8, 0x3a, - 0x28, 0x28, 0x08, 0x28, 0x08, 0x28, 0x08, 0x26, 0x08, 0x21, 0x08, 0x10, - 0x10, 0x08, 0x10, 0x04, 0x10, 0x04, 0x00, 0x00 }; +static unsigned char swipe_bits[] = { + 0x30, 0x00, 0x48, 0x00, 0x48, 0x00, 0x48, 0x00, 0xc8, 0x05, 0x48, 0x0e, + 0x4a, 0x12, 0x4d, 0x32, 0x09, 0x50, 0x41, 0x44, 0x62, 0x4c, 0xf2, 0x5f, + 0x64, 0x2c, 0x48, 0x24, 0x10, 0x10, 0xe0, 0x0f }; static unsigned char lock_bits[] PROGMEM = { 0xc0, 0x03, 0x60, 0x06, 0x30, 0x0c, 0x10, 0x08, 0x10, 0x08, 0x10, 0x08, 0xfc, 0x3f, 0x04, 0x20, 0x04, 0x20, 0x84, 0x21, 0x84, 0x21, 0x84, 0x21, 0x04, 0x20, 0x04, 0x20, 0x04, 0x20, 0xfc, 0x3f }; -static unsigned char plus_bits[] = { +static unsigned char plus_bits[] PROGMEM = { 0x00, 0x00, 0xe0, 0x01, 0x18, 0x06, 0x04, 0x08, 0xc4, 0x08, 0xc2, 0x10, 0xf2, 0x13, 0xf2, 0x13, 0xc2, 0x10, 0xc4, 0x08, 0x04, 0x0c, 0x18, 0x1e, 0xe0, 0x39, 0x00, 0x70, 0x00, 0xe0, 0x00, 0xc0 }; -static unsigned char minus_bits[] = { +static unsigned char minus_bits[] PROGMEM = { 0x00, 0x00, 0xe0, 0x01, 0x18, 0x06, 0x04, 0x08, 0x04, 0x08, 0x02, 0x10, 0xf2, 0x13, 0xf2, 0x13, 0x02, 0x10, 0x04, 0x08, 0x04, 0x0c, 0x18, 0x1e, 0xe0, 0x39, 0x00, 0x70, 0x00, 0xe0, 0x00, 0xc0 }; -static unsigned char fram_bits[] = { +static unsigned char fram_bits[] PROGMEM = { 0xf8, 0x1f, 0xff, 0xff, 0x9f, 0xff, 0x98, 0x1f, 0xf8, 0x1f, 0xff, 0xff, 0xff, 0xff, 0xf8, 0x1f, 0xf8, 0x1f, 0xff, 0xff, 0xff, 0xff, 0xf8, 0x1f, 0xf8, 0x1f, 0xff, 0xff, 0xff, 0xff, 0xf8, 0x1f }; From 49be7f117a24fb408528be3c15387c57231827fe Mon Sep 17 00:00:00 2001 From: norbert-walter Date: Fri, 17 Jan 2025 18:00:32 +0100 Subject: [PATCH 06/11] Modify pad detectionfor OBP60 Light --- lib/obp60task/OBP60Keypad.h | 45 +++++++++++++++++------------- lib/obp60task/platformio.ini | 18 ++++++------ lib/obp60task/platformio.ini.light | 2 +- 3 files changed, 36 insertions(+), 29 deletions(-) diff --git a/lib/obp60task/OBP60Keypad.h b/lib/obp60task/OBP60Keypad.h index 7ad6f9b..54935be 100644 --- a/lib/obp60task/OBP60Keypad.h +++ b/lib/obp60task/OBP60Keypad.h @@ -181,6 +181,29 @@ long starttime = 0; // Start time point for pressed key #endif #ifdef HARDWARE_LIGHT + int readSensorpads(){ + // Read key code + if(digitalRead(UP) == LOW){ + keycode = 10; // Left swipe + } + else if(digitalRead(DOWN) == LOW){ + keycode = 9; // Right swipe + } + else if(digitalRead(CONF) == LOW){ + keycode = 3; // Key 3 + } + else if(digitalRead(MENUE) == LOW){ + keycode = 1; // Key 1 + } + else if(digitalRead(EXIT) == LOW){ + keycode = 2; // Key 2 + } + else{ + keycode = 0; // No key activ + } + return keycode; + } + // Keypad functions for OBP60 clone (thSensitivity is inactiv) int readKeypad(uint thSensitivity) { pinMode(UP, INPUT); @@ -189,25 +212,8 @@ long starttime = 0; // Start time point for pressed key pinMode(MENUE, INPUT); pinMode(EXIT, INPUT); - // Read key code - if(digitalRead(UP) == LOW){ - keycode = 10; // Left swipe - } - else if(digitalRead(DOWN) == LOW){ - keycode = 9; // Right swipe - } - else if(digitalRead(CONF) == LOW){ - keycode = 3; // Key 3 - } - else if(digitalRead(MENUE) == LOW){ - keycode = 1; // Key 1 - } - else if(digitalRead(EXIT) == LOW){ - keycode = 2; // Key 2 - } - else{ - keycode = 0; // No key activ - } + // Raed pad values + readSensorpads(); // Detect key if (keycode > 0 ){ @@ -220,6 +226,7 @@ long starttime = 0; // Start time point for pressed key keystatus = keycode; // Copy keycode keycodeold = keycode; + while(readSensorpads() > 0){} // Wait for pad lesease delay(keydelay); } } diff --git a/lib/obp60task/platformio.ini b/lib/obp60task/platformio.ini index 4010a82..6d6ae65 100644 --- a/lib/obp60task/platformio.ini +++ b/lib/obp60task/platformio.ini @@ -9,10 +9,10 @@ board_build.variants_dir = variants #board = obp60_s3_n8 #ESP32-S3 N8, 8MB flash, no PSRAM #board = obp60_s3_n16 #ESP32-S3 N16,16MB flash, no PSRAM, zero series #board = obp60_s3_n8r8 #ESP32-S3 N8R8, 8MB flash, 8MB PSRAM -board = obp60_s3_n16r8 #ESP32-S3 N16R8, 16MB flash, 8MB PSRAM, production series -#board = obp60_s3_light_n8r8 #ESP32-S3 N8R8, 8MB flash, 8MB PSRAM, OBP60 clone -#board_build.partitions = default_8MB.csv #ESP32-S3 N8, 8MB flash -board_build.partitions = default_16MB.csv #ESP32-S3 N16, 16MB flash +#board = obp60_s3_n16r8 #ESP32-S3 N16R8, 16MB flash, 8MB PSRAM, production series +board = obp60_s3_light_n8r8 #ESP32-S3 N8R8, 8MB flash, 8MB PSRAM, OBP60 clone +board_build.partitions = default_8MB.csv #ESP32-S3 N8, 8MB flash +#board_build.partitions = default_16MB.csv #ESP32-S3 N16, 16MB flash framework = arduino lib_deps = ${basedeps.lib_deps} @@ -40,22 +40,22 @@ lib_deps = 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 ARDUINO_USB_CDC_ON_BOOT=0 #Serial output via RX/TX # -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 #OBP60 hardware revision V2.0 - -D HARDWARE_V21 #OBP60 hardware revision V2.1 -# -D HARDWARE_LIGHT #OBP60 hardware clone +# -D HARDWARE_V21 #OBP60 hardware revision V2.1 + -D HARDWARE_LIGHT #OBP60 hardware clone # -D DISPLAY_GDEW042T2 #old E-Ink display from Waveshare, R10 0.47 ohm -D DISPLAY_GDEY042T81 #new E-Ink display from Waveshare, R10 2.2 ohm # -D DISPLAY_GYE042A87 #alternativ E-Ink display from Genyo Optical, R10 2.2 ohm # -D DISPLAY_SE0420NQ04 #alternativ E-Ink display from SID Technology, R10 2.2 ohm ${env.build_flags} #CONFIG_ESP_TASK_WDT_TIMEOUT_S = 10 #Task Watchdog timeout period (seconds) [1...60] 5 default -upload_port = /dev/ttyACM0 #OBP60 original -#upload_port = /dev/ttyUSB0 #OBP60 clone +#upload_port = /dev/ttyACM0 #OBP60 original +upload_port = /dev/ttyUSB0 #OBP60 clone upload_protocol = esptool #firmware upload via USB OTG seriell, by first upload need to set the ESP32-S3 in the upload mode with shortcut GND to Pin27 upload_speed = 230400 monitor_speed = 115200 diff --git a/lib/obp60task/platformio.ini.light b/lib/obp60task/platformio.ini.light index d11edcf..6d6ae65 100644 --- a/lib/obp60task/platformio.ini.light +++ b/lib/obp60task/platformio.ini.light @@ -40,7 +40,7 @@ lib_deps = 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 ARDUINO_USB_CDC_ON_BOOT=0 #Serial output via RX/TX # -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 From 24386d4d4274fd3742d30a81be7e672233c8fa39 Mon Sep 17 00:00:00 2001 From: Tobias E Date: Fri, 17 Jan 2025 19:23:26 +0000 Subject: [PATCH 07/11] add explanation to gen_set.py --- lib/obp60task/gen_set.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/obp60task/gen_set.py b/lib/obp60task/gen_set.py index a0f7b6d..c848a91 100755 --- a/lib/obp60task/gen_set.py +++ b/lib/obp60task/gen_set.py @@ -1,5 +1,9 @@ #!/usr/bin/env python3 # A tool to generate that part of config.json that deals with pages and fields. +# +#Usage: 1. modify this script (e.g.add a page, change number of fields, etc.) +# 2. Delete all lines from config.json from the curly backet before "name": "page1type" to o the end of the file (as of today, delete from line 917 to the end of the File) +# 3. run ./gen_set.py >> config.json import json @@ -120,5 +124,5 @@ for page_no in range(1, no_of_pages + 1): json_output = json.dumps(output, indent=4) # print omitting first and last line containing [ ] of JSON array -print(json_output[1:-1]) +print(json_output[1:]) # print(",") \ No newline at end of file From 10552763fbc3b485ff1581aa73492968eed1097d Mon Sep 17 00:00:00 2001 From: Tobias E Date: Fri, 17 Jan 2025 19:24:16 +0000 Subject: [PATCH 08/11] add explanation to gen_set.py --- lib/obp60task/gen_set.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/obp60task/gen_set.py b/lib/obp60task/gen_set.py index c848a91..bf40b6c 100755 --- a/lib/obp60task/gen_set.py +++ b/lib/obp60task/gen_set.py @@ -124,5 +124,7 @@ for page_no in range(1, no_of_pages + 1): json_output = json.dumps(output, indent=4) # print omitting first and last line containing [ ] of JSON array +#print(json_output[1:-1]) +# print omitting first line containing [ of JSON array print(json_output[1:]) # print(",") \ No newline at end of file From e917a7fc765b821bf83f6011928412a380b5c9bc Mon Sep 17 00:00:00 2001 From: Thomas Hooge Date: Fri, 17 Jan 2025 21:23:41 +0100 Subject: [PATCH 09/11] Modification of footer layout and new swipe icon --- lib/obp60task/OBP60Extensions.cpp | 32 +++++++++++-------- lib/obp60task/OBP60Extensions.h | 30 ++++++++++++----- lib/obp60task/OBP60Keypad.h | 53 +++++++++++++++++-------------- 3 files changed, 70 insertions(+), 45 deletions(-) diff --git a/lib/obp60task/OBP60Extensions.cpp b/lib/obp60task/OBP60Extensions.cpp index 146f3c9..153ecbb 100644 --- a/lib/obp60task/OBP60Extensions.cpp +++ b/lib/obp60task/OBP60Extensions.cpp @@ -328,16 +328,11 @@ void displayHeader(CommonData &commonData, GwApi::BoatValue *date, GwApi::BoatVa // Display key lock status if (commonData.keylock) { - getdisplay().drawXBitmap(150, 1, lock_bits, icon_width, icon_height, commonData.fgcolor); + getdisplay().drawXBitmap(170, 1, lock_bits, icon_width, icon_height, commonData.fgcolor); } else { - getdisplay().drawXBitmap(150, 1, swipe_bits, icon_width, icon_height, commonData.fgcolor); + getdisplay().drawXBitmap(166, 1, swipe_bits, swipe_width, swipe_height, commonData.fgcolor); } - // Current page number in a small box - getdisplay().setFont(&Ubuntu_Bold8pt7b); - getdisplay().drawRect(170, 2, 20, 15, commonData.fgcolor); - drawTextCenter(179, 9, String(commonData.data.actpage)); - // Heartbeat as dot getdisplay().setTextColor(commonData.fgcolor); getdisplay().setFont(&Ubuntu_Bold32pt7b); @@ -382,13 +377,21 @@ void displayFooter(CommonData &commonData) { getdisplay().setTextColor(commonData.fgcolor); // Frame around key icon area - getdisplay().drawLine(0, 280, 399, 280, commonData.fgcolor); if (! commonData.keylock) { - getdisplay().drawLine(68, 280, 68, 299, commonData.fgcolor); - getdisplay().drawLine(134, 280, 134, 299, commonData.fgcolor); - getdisplay().drawLine(200, 280, 200, 299, commonData.fgcolor); - getdisplay().drawLine(266, 280, 266, 299, commonData.fgcolor); - getdisplay().drawLine(332, 280, 332, 299, commonData.fgcolor); + // horizontal elements + const uint16_t top = 280; + const uint16_t bottom = 299; + getdisplay().drawLine(commonData.keydata[0].x, top, commonData.keydata[0].x+10, top, commonData.fgcolor); + getdisplay().drawLine(commonData.keydata[1].x-10, top, commonData.keydata[1].x+10, top, commonData.fgcolor); + getdisplay().drawLine(commonData.keydata[2].x-10, top, commonData.keydata[2].x+10, top, commonData.fgcolor); + getdisplay().drawLine(commonData.keydata[4].x-10, top, commonData.keydata[4].x+10, top, commonData.fgcolor); + getdisplay().drawLine(commonData.keydata[5].x-10, top, commonData.keydata[5].x+10, top, commonData.fgcolor); + getdisplay().drawLine(commonData.keydata[5].x + commonData.keydata[5].w - 10, top, commonData.keydata[5].x + commonData.keydata[5].w + 1, top, commonData.fgcolor); + // vertical key separators + getdisplay().drawLine(commonData.keydata[0].x + commonData.keydata[0].w, top, commonData.keydata[0].x + commonData.keydata[0].w, bottom, commonData.fgcolor); + getdisplay().drawLine(commonData.keydata[1].x + commonData.keydata[1].w, top, commonData.keydata[1].x + commonData.keydata[1].w, bottom, commonData.fgcolor); + getdisplay().drawLine(commonData.keydata[3].x + commonData.keydata[3].w, top, commonData.keydata[3].x + commonData.keydata[3].w, bottom, commonData.fgcolor); + getdisplay().drawLine(commonData.keydata[4].x + commonData.keydata[4].w, top, commonData.keydata[4].x + commonData.keydata[4].w, bottom, commonData.fgcolor); for (int i = 0; i < 6; i++) { uint16_t x, y; if (commonData.keydata[i].label.length() > 0) { @@ -412,6 +415,9 @@ void displayFooter(CommonData &commonData) { } } } + // Current page number in a small box + getdisplay().drawRect(190, 280, 23, 19, commonData.fgcolor); + drawTextCenter(200, 289, String(commonData.data.actpage)); } else { getdisplay().setCursor(65, 295); getdisplay().print("Press 1 and 6 fast to unlock keys"); diff --git a/lib/obp60task/OBP60Extensions.h b/lib/obp60task/OBP60Extensions.h index 6665dc3..a529da7 100644 --- a/lib/obp60task/OBP60Extensions.h +++ b/lib/obp60task/OBP60Extensions.h @@ -114,11 +114,6 @@ static unsigned char right_bits[] PROGMEM = { 0xfe, 0x7f, 0xfe, 0xff, 0xfe, 0xff, 0xfe, 0x7f, 0xfe, 0x3f, 0x80, 0x1f, 0x80, 0x0f, 0x80, 0x07, 0x80, 0x03, 0x00, 0x00 }; -static unsigned char swipe_bits[] = { - 0x30, 0x00, 0x48, 0x00, 0x48, 0x00, 0x48, 0x00, 0xc8, 0x05, 0x48, 0x0e, - 0x4a, 0x12, 0x4d, 0x32, 0x09, 0x50, 0x41, 0x44, 0x62, 0x4c, 0xf2, 0x5f, - 0x64, 0x2c, 0x48, 0x24, 0x10, 0x10, 0xe0, 0x0f }; - static unsigned char lock_bits[] PROGMEM = { 0xc0, 0x03, 0x60, 0x06, 0x30, 0x0c, 0x10, 0x08, 0x10, 0x08, 0x10, 0x08, 0xfc, 0x3f, 0x04, 0x20, 0x04, 0x20, 0x84, 0x21, 0x84, 0x21, 0x84, 0x21, @@ -139,19 +134,38 @@ static unsigned char fram_bits[] PROGMEM = { 0xff, 0xff, 0xf8, 0x1f, 0xf8, 0x1f, 0xff, 0xff, 0xff, 0xff, 0xf8, 0x1f, 0xf8, 0x1f, 0xff, 0xff, 0xff, 0xff, 0xf8, 0x1f }; +static unsigned char ap_bits[] = { + 0xe0, 0x03, 0x18, 0x0c, 0x04, 0x10, 0xc2, 0x21, 0x30, 0x06, 0x08, 0x08, + 0xc0, 0x01, 0x20, 0x02, 0x00, 0x00, 0x80, 0x00, 0xc0, 0x01, 0xc0, 0x01, + 0x80, 0x00, 0x80, 0x00, 0x80, 0x00, 0x80, 0x00 }; + +static unsigned char dish_bits[] PROGMEM= { + 0x3c, 0x00, 0x42, 0x18, 0xfa, 0x1b, 0x02, 0x04, 0x02, 0x0a, 0x02, 0x09, + 0x82, 0x08, 0x06, 0x0a, 0x0e, 0x1b, 0x9c, 0x2b, 0x38, 0x2b, 0x74, 0x20, + 0xec, 0x1f, 0x1c, 0x00, 0xf4, 0x00, 0xfe, 0x03 }; + static std::map iconmap = { {"LEFT", left_bits}, {"RIGHT", right_bits}, - {"SWIPE", swipe_bits}, {"LOCK", lock_bits}, {"PLUS", plus_bits}, - {"MINUS", minus_bits} + {"MINUS", minus_bits}, + {"DISH", dish_bits}, + {"AP", ap_bits} }; // Other symbols +#define swipe_width 24 +#define swipe_height 16 +static unsigned char swipe_bits[] PROGMEM = { + 0x00, 0x06, 0x00, 0x24, 0x09, 0x24, 0x12, 0x09, 0x48, 0x7f, 0x09, 0xfe, + 0x12, 0xb9, 0x48, 0x24, 0xc9, 0x25, 0x40, 0x49, 0x02, 0xa0, 0x49, 0x06, + 0x20, 0x01, 0x0a, 0x20, 0x00, 0x08, 0x40, 0x00, 0x08, 0x40, 0x00, 0x08, + 0x80, 0x00, 0x04, 0x00, 0x01, 0x04, 0x00, 0x02, 0x02, 0x00, 0xfc, 0x01 }; + #define exclamation_width 32 #define exclamation_height 32 -static unsigned char exclamation_bits[] = { +static unsigned char exclamation_bits[] PROGMEM = { 0x00, 0xc0, 0x03, 0x00, 0x00, 0x60, 0x06, 0x00, 0x00, 0xb0, 0x0d, 0x00, 0x00, 0xd8, 0x1b, 0x00, 0x00, 0xec, 0x37, 0x00, 0x00, 0xf6, 0x6f, 0x00, 0x00, 0x3b, 0xdc, 0x00, 0x80, 0x3d, 0xbc, 0x01, 0xc0, 0x3e, 0x7c, 0x03, diff --git a/lib/obp60task/OBP60Keypad.h b/lib/obp60task/OBP60Keypad.h index c06c163..5c2f928 100644 --- a/lib/obp60task/OBP60Keypad.h +++ b/lib/obp60task/OBP60Keypad.h @@ -22,35 +22,40 @@ long starttime = 0; // Start time point for pressed key void initKeys(CommonData &commonData) { // coordinates for virtual keyboard keys - commonData.keydata[0].x = 1; - commonData.keydata[0].y = 281; - commonData.keydata[0].w = 67; - commonData.keydata[0].h = 18; - commonData.keydata[1].x = 69; - commonData.keydata[1].y = 281; - commonData.keydata[1].w = 66; - commonData.keydata[1].h = 18; + static uint16_t top = 281; + static uint16_t width = 65; + static uint16_t height = 18; - commonData.keydata[2].x = 135; - commonData.keydata[2].y = 281; - commonData.keydata[2].w = 66; - commonData.keydata[2].h = 18; + commonData.keydata[0].x = 0; + commonData.keydata[0].y = top; + commonData.keydata[0].w = width + 1; + commonData.keydata[0].h = height; - commonData.keydata[3].x = 201; - commonData.keydata[3].y = 281; - commonData.keydata[3].w = 66; - commonData.keydata[3].h = 18; + commonData.keydata[1].x = commonData.keydata[0].x + commonData.keydata[0].w + 1; + commonData.keydata[1].y = top; + commonData.keydata[1].w = width; + commonData.keydata[1].h = height; - commonData.keydata[4].x = 267; - commonData.keydata[4].y = 281; - commonData.keydata[4].w = 66; - commonData.keydata[4].h = 18; + commonData.keydata[2].x = commonData.keydata[1].x + commonData.keydata[1].w + 1; + commonData.keydata[2].y = top; + commonData.keydata[2].w = width; + commonData.keydata[2].h = height; - commonData.keydata[5].x = 333; - commonData.keydata[5].y = 281; - commonData.keydata[5].w = 66; - commonData.keydata[5].h = 18; + commonData.keydata[3].x = commonData.keydata[2].x + commonData.keydata[2].w + 1; + commonData.keydata[3].y = top; + commonData.keydata[3].w = width; + commonData.keydata[3].h = height; + + commonData.keydata[4].x = commonData.keydata[3].x + commonData.keydata[3].w + 1; + commonData.keydata[4].y = top; + commonData.keydata[4].w = width; + commonData.keydata[4].h = height; + + commonData.keydata[5].x = commonData.keydata[4].x + commonData.keydata[4].w + 1; + commonData.keydata[5].y = top; + commonData.keydata[5].w = width; + commonData.keydata[5].h = height; } #ifdef HARDWARE_V21 From 27b02c4860a84cbec4e3453c8ace1d1b5d7815ac Mon Sep 17 00:00:00 2001 From: Tobias E Date: Sat, 18 Jan 2025 13:59:37 +0000 Subject: [PATCH 10/11] removed obsolete perl script gen_set.pl --- lib/obp60task/Create_new_pages.txt | 2 +- lib/obp60task/gen_set.pl | 112 ----------------------------- 2 files changed, 1 insertion(+), 113 deletions(-) delete mode 100755 lib/obp60task/gen_set.pl diff --git a/lib/obp60task/Create_new_pages.txt b/lib/obp60task/Create_new_pages.txt index 5ad71fd..b318985 100644 --- a/lib/obp60task/Create_new_pages.txt +++ b/lib/obp60task/Create_new_pages.txt @@ -2,5 +2,5 @@ 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 or add new page to gen_set.pl and run it to auto-generate the relevant section of config.json +4. Add new page in /lib/obp60task/config.json for each page type or add new page to gen_set.py and run it to auto-generate the relevant section of config.json diff --git a/lib/obp60task/gen_set.pl b/lib/obp60task/gen_set.pl deleted file mode 100755 index 3c74904..0000000 --- a/lib/obp60task/gen_set.pl +++ /dev/null @@ -1,112 +0,0 @@ -#!/bin/perl -w -#A tool to generate the part of config.json that deals with pages and fields. -#DEPRECATED, moved to get_set.py -die "Please use gen_set.py instead"; -#List of all pages and the number of parameters they expect. -%NoOfFieldsPerPage=qw( - ApparentWind 0 - XTETrack 0 - Battery2 0 - Battery 0 - BME280 0 - Clock 0 - DST810 0 - FourValues2 4 - FourValues 4 - Generator 0 - KeelPosition 0 - OneValue 1 - RollPitch 0 - RudderPosition 0 - Solar 0 - ThreeValues 3 - TwoValues 2 - Voltage 0 - White 0 - WindRose 0 - WindRoseFlex 6 - ); -# No changes needed beyond this point -#max number of pages supported by OBP60 -$NoOfPages=10; -#Default selection for each page -@Defaults=qw(Voltage WindRose OneValue TwoValues ThreeValues FourValues FourValues2 Clock RollPitch Battery2); -@Numbers=qw(one two three four five six seven eight nine ten); -@Pages=sort(keys(%NoOfFieldsPerPage)); -$MaxNoOfFieldsPerPage=0; # inital value, gets updated with maximum entry from %NoOfFieldsPerPage - - -#find max. number of fields without additional modules - foreach (values(%NoOfFieldsPerPage)){ - if ($_ > $MaxNoOfFieldsPerPage){ - $MaxNoOfFieldsPerPage=$_; - } - } - -for ($PageNo=1;$PageNo<=$NoOfPages;$PageNo++){ - print "{\n"; - print "\t","\"name\": \"page", $PageNo,"type\",\n"; - print "\t","\"label\": \"Type\",\n"; - print "\t",'"type": "list",',"\n"; - print "\t",'"default": "'; - print "$Defaults[$PageNo-1]"; - print'"',"\n"; - print "\t",'"description": "Type of page for page ',$PageNo,'",',"\n"; - print "\t",'"list": ['; - for ($p=0;$p<=$#Pages;$p++) { - print '"', $Pages[$p], '"' ; - if ($p < $#Pages){print ","} - } - print "]\n"; - print "\t",'"category": "OBP60 Page ',$PageNo,'",',"\n"; - print "\t",'"capabilities": {',"\n"; - print "\t\t",'"obp60":"true"',"\n"; - print "\t",'}',"\n"; - print "\t",'"condition":['; - for ($vp=$PageNo;$vp<=$NoOfPages;$vp++){ - print '"{visiblePages":"',$vp,'"},'; - } - print "\b",']',"\n"; - print '},',"\n"; - for ($FieldNo=1; $FieldNo<=$MaxNoOfFieldsPerPage;$FieldNo++){ - print "{\n"; - print "\t",'"name": "page',$PageNo,'value',$FieldNo,'",',"\n"; - print "\t",'"label": "Field ',$FieldNo,'",',"\n"; - print "\t",'"type": "boatData",',"\n"; - print "\t",'"default": "",',"\n"; - print "\t",'"description": "The display for field ',$Numbers[$FieldNo-1],'",',"\n"; - print "\t",'"category": "OBP60 Page ',$PageNo,'",',"\n"; - print "\t",'"capabilities": {',"\n"; - print "\t",' "obp60":"true"',"\n"; - print "\t",'}, ',"\n"; - print "\t",'"condition":['; - foreach $page (@Pages) { - if($NoOfFieldsPerPage{$page}>=$FieldNo){ - print '{"page',$PageNo,'type":"',$page,'"},'; - } - } - print "\b],\n"; - print '},',"\n"; - } - print "{\n"; - print "\t","\"name\": \"page", $PageNo,"fluid\",\n"; - print "\t",'"label": "Fluid type",',"\n"; - print "\t",'"type": "list",',"\n"; - print "\t",'"default": "0",',"\n"; - print "\t",'"list": [',"\n"; - print "\t",'{"l":"Fuel (0)","v":"0"},',"\n"; - print "\t",'{"l":"Water (1)","v":"1"},',"\n"; - print "\t",'{"l":"Gray Water (2)","v":"2"},',"\n"; - print "\t",'{"l":"Live Well (3)","v":"3"},',"\n"; - print "\t",'{"l":"Oil (4)","v":"4"},',"\n"; - print "\t",'{"l":"Black Water (5)","v":"5"},',"\n"; - print "\t",'{"l":"Fuel Gasoline (6)","v":"6"}',"\n"; - print "\t",'],',"\n"; - print "\t",'"description": "Fluid type in tank",',"\n"; - print "\t",'"category": "OBP60 Page ',$PageNo,'",',"\n"; - print "\t",'"capabilities": {',"\n"; - print "\t",'"obp60":"true"',"\n"; - print "\t",'},',"\n"; - print "\t",'"condition":[{"page',$PageNo,'type":"Fluid"}]',"\n"; - print '},',"\n"; -} From 87a7a79358ea3b894d3ce8be59cd11821ec1d7ed Mon Sep 17 00:00:00 2001 From: norbert-walter Date: Sun, 19 Jan 2025 00:23:22 +0100 Subject: [PATCH 11/11] Change back to plaformio.ini OBP60 --- lib/obp60task/platformio.ini | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/lib/obp60task/platformio.ini b/lib/obp60task/platformio.ini index 6d6ae65..4010a82 100644 --- a/lib/obp60task/platformio.ini +++ b/lib/obp60task/platformio.ini @@ -9,10 +9,10 @@ board_build.variants_dir = variants #board = obp60_s3_n8 #ESP32-S3 N8, 8MB flash, no PSRAM #board = obp60_s3_n16 #ESP32-S3 N16,16MB flash, no PSRAM, zero series #board = obp60_s3_n8r8 #ESP32-S3 N8R8, 8MB flash, 8MB PSRAM -#board = obp60_s3_n16r8 #ESP32-S3 N16R8, 16MB flash, 8MB PSRAM, production series -board = obp60_s3_light_n8r8 #ESP32-S3 N8R8, 8MB flash, 8MB PSRAM, OBP60 clone -board_build.partitions = default_8MB.csv #ESP32-S3 N8, 8MB flash -#board_build.partitions = default_16MB.csv #ESP32-S3 N16, 16MB flash +board = obp60_s3_n16r8 #ESP32-S3 N16R8, 16MB flash, 8MB PSRAM, production series +#board = obp60_s3_light_n8r8 #ESP32-S3 N8R8, 8MB flash, 8MB PSRAM, OBP60 clone +#board_build.partitions = default_8MB.csv #ESP32-S3 N8, 8MB flash +board_build.partitions = default_16MB.csv #ESP32-S3 N16, 16MB flash framework = arduino lib_deps = ${basedeps.lib_deps} @@ -40,22 +40,22 @@ lib_deps = 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=0 #Serial output via RX/TX +# -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 #OBP60 hardware revision V2.0 -# -D HARDWARE_V21 #OBP60 hardware revision V2.1 - -D HARDWARE_LIGHT #OBP60 hardware clone + -D HARDWARE_V21 #OBP60 hardware revision V2.1 +# -D HARDWARE_LIGHT #OBP60 hardware clone # -D DISPLAY_GDEW042T2 #old E-Ink display from Waveshare, R10 0.47 ohm -D DISPLAY_GDEY042T81 #new E-Ink display from Waveshare, R10 2.2 ohm # -D DISPLAY_GYE042A87 #alternativ E-Ink display from Genyo Optical, R10 2.2 ohm # -D DISPLAY_SE0420NQ04 #alternativ E-Ink display from SID Technology, R10 2.2 ohm ${env.build_flags} #CONFIG_ESP_TASK_WDT_TIMEOUT_S = 10 #Task Watchdog timeout period (seconds) [1...60] 5 default -#upload_port = /dev/ttyACM0 #OBP60 original -upload_port = /dev/ttyUSB0 #OBP60 clone +upload_port = /dev/ttyACM0 #OBP60 original +#upload_port = /dev/ttyUSB0 #OBP60 clone upload_protocol = esptool #firmware upload via USB OTG seriell, by first upload need to set the ESP32-S3 in the upload mode with shortcut GND to Pin27 upload_speed = 230400 monitor_speed = 115200