From c7eafbf9b84010ca35f8d96baa01ba610755efa5 Mon Sep 17 00:00:00 2001 From: Thomas Hooge Date: Thu, 12 Jun 2025 11:43:21 +0200 Subject: [PATCH 1/6] Apply new OBP60 settings also to the OBP40 --- lib/obp60task/config_obp40.json | 434 +++++++++++++++++++++++++++++--- 1 file changed, 403 insertions(+), 31 deletions(-) diff --git a/lib/obp60task/config_obp40.json b/lib/obp60task/config_obp40.json index e24e9e9..2c8b0f3 100644 --- a/lib/obp60task/config_obp40.json +++ b/lib/obp60task/config_obp40.json @@ -701,6 +701,189 @@ "obp40": "true" } }, + { + "name": "calInstance1", + "label": "Calibration Data Instance 1", + "type": "list", + "default": "---", + "description": "Data instance for calibration", + "list": [ + "---", + "AWA", + "AWS", + "DBT", + "HDM", + "PRPOS", + "RPOS", + "STW", + "TWA", + "TWS", + "TWD", + "WTemp" + ], + "category": "OBP40 Calibrations", + "capabilities": { + "obp40": "true" + } + }, + { + "name": "calOffset1", + "label": "Data Instance 1 Calibration Offset", + "type": "number", + "default": "0.00", + "description": "Offset for data instance 1", + "category": "OBP40 Calibrations", + "capabilities": { + "obp40": "true" + } + }, + { + "name": "calSlope1", + "label": "Data Instance 1 Calibration Slope", + "type": "number", + "default": "1.00", + "description": "Slope for data instance 1", + "category": "OBP40 Calibrations", + "capabilities": { + "obp40": "true" + } + }, + { + "name": "calSmooth1", + "label": "Data Instance 1 Smoothing", + "type": "number", + "default": "0", + "check": "checkMinMax", + "min": 0, + "max": 10, + "description": "Smoothing factor for data instance 1", + "category": "OBP40 Calibrations", + "capabilities": { + "obp40": "true" + } + }, + { + "name": "calInstance2", + "label": "Calibration Data Instance 2", + "type": "list", + "default": "---", + "description": "Data instance for calibration", + "list": [ + "---", + "AWA", + "AWS", + "DBT", + "HDM", + "PRPOS", + "RPOS", + "STW", + "TWA", + "TWS", + "TWD", + "WTemp" + ], + "category": "OBP40 Calibrations", + "capabilities": { + "obp40": "true" + } + }, + { + "name": "calOffset2", + "label": "Data Instance 2 Calibration Offset", + "type": "number", + "default": "0.00", + "description": "Offset for data instance 2", + "category": "OBP40 Calibrations", + "capabilities": { + "obp40": "true" + } + }, + { + "name": "calSlope2", + "label": "Data Instance 2 Calibration Slope", + "type": "number", + "default": "1.00", + "description": "Slope for data instance 2", + "category": "OBP40 Calibrations", + "capabilities": { + "obp40": "true" + } + }, + { + "name": "calSmooth2", + "label": "Data Instance 2 Smoothing", + "type": "number", + "default": "0", + "check": "checkMinMax", + "min": 0, + "max": 10, + "description": "Smoothing factor for data instance 2", + "category": "OBP40 Calibrations", + "capabilities": { + "obp40": "true" + } + }, + { + "name": "calInstance3", + "label": "Calibration Data Instance 3", + "type": "list", + "default": "---", + "description": "Data instance for calibration", + "list": [ + "---", + "AWA", + "AWS", + "DBT", + "HDM", + "PRPOS", + "RPOS", + "STW", + "TWA", + "TWS", + "TWD", + "WTemp" + ], + "category": "OBP40 Calibrations", + "capabilities": { + "obp40": "true" + } + }, + { + "name": "calOffset3", + "label": "Data Instance 3 Calibration Offset", + "type": "number", + "default": "0.00", + "description": "Offset for data instance 3", + "category": "OBP40 Calibrations", + "capabilities": { + "obp40": "true" + } + }, + { + "name": "calSlope3", + "label": "Data Instance 3 Calibration Slope", + "type": "number", + "default": "1.00", + "description": "Slope for data instance 3", + "category": "OBP40 Calibrations", + "capabilities": { + "obp40": "true" + } + }, + { + "name": "calSmooth3", + "label": "Data Instance 3 Smoothing", + "type": "number", + "default": "0", + "check": "checkMinMax", + "min": 0, + "max": 10, + "description": "Smoothing factor for data instance 3", + "category": "OBP40 Calibrations", + "capabilities": { + "obp40": "true" + } + }, { "name": "display", "label": "Display Mode", @@ -1015,6 +1198,7 @@ "OneValue", "RollPitch", "RudderPosition", + "SixValues", "Solar", "ThreeValues", "TwoValues", @@ -1073,6 +1257,9 @@ "obp40": "true" }, "condition": [ + { + "page1type": "Fluid" + }, { "page1type": "FourValues" }, @@ -1085,6 +1272,9 @@ { "page1type": "RollPitch" }, + { + "page1type": "SixValues" + }, { "page1type": "ThreeValues" }, @@ -1093,9 +1283,6 @@ }, { "page1type": "WindRoseFlex" - }, - { - "page1type": "Fluid" } ] }, @@ -1119,6 +1306,9 @@ { "page1type": "RollPitch" }, + { + "page1type": "SixValues" + }, { "page1type": "ThreeValues" }, @@ -1147,6 +1337,9 @@ { "page1type": "FourValues2" }, + { + "page1type": "SixValues" + }, { "page1type": "ThreeValues" }, @@ -1172,6 +1365,9 @@ { "page1type": "FourValues2" }, + { + "page1type": "SixValues" + }, { "page1type": "WindRoseFlex" } @@ -1188,6 +1384,9 @@ "obp40": "true" }, "condition": [ + { + "page1type": "SixValues" + }, { "page1type": "WindRoseFlex" } @@ -1204,6 +1403,9 @@ "obp40": "true" }, "condition": [ + { + "page1type": "SixValues" + }, { "page1type": "WindRoseFlex" } @@ -1275,6 +1477,7 @@ "OneValue", "RollPitch", "RudderPosition", + "SixValues", "Solar", "ThreeValues", "TwoValues", @@ -1330,6 +1533,9 @@ "obp40": "true" }, "condition": [ + { + "page2type": "Fluid" + }, { "page2type": "FourValues" }, @@ -1342,6 +1548,9 @@ { "page2type": "RollPitch" }, + { + "page2type": "SixValues" + }, { "page2type": "ThreeValues" }, @@ -1350,11 +1559,7 @@ }, { "page2type": "WindRoseFlex" - }, - { - "page2type": "Fluid" } - ] }, { @@ -1377,6 +1582,9 @@ { "page2type": "RollPitch" }, + { + "page2type": "SixValues" + }, { "page2type": "ThreeValues" }, @@ -1405,6 +1613,9 @@ { "page2type": "FourValues2" }, + { + "page2type": "SixValues" + }, { "page2type": "ThreeValues" }, @@ -1430,6 +1641,9 @@ { "page2type": "FourValues2" }, + { + "page2type": "SixValues" + }, { "page2type": "WindRoseFlex" } @@ -1446,6 +1660,9 @@ "obp40": "true" }, "condition": [ + { + "page2type": "SixValues" + }, { "page2type": "WindRoseFlex" } @@ -1462,6 +1679,9 @@ "obp40": "true" }, "condition": [ + { + "page2type": "SixValues" + }, { "page2type": "WindRoseFlex" } @@ -1533,6 +1753,7 @@ "OneValue", "RollPitch", "RudderPosition", + "SixValues", "Solar", "ThreeValues", "TwoValues", @@ -1585,6 +1806,9 @@ "obp40": "true" }, "condition": [ + { + "page3type": "Fluid" + }, { "page3type": "FourValues" }, @@ -1597,6 +1821,9 @@ { "page3type": "RollPitch" }, + { + "page3type": "SixValues" + }, { "page3type": "ThreeValues" }, @@ -1605,9 +1832,6 @@ }, { "page3type": "WindRoseFlex" - }, - { - "page3type": "Fluid" } ] }, @@ -1631,6 +1855,9 @@ { "page3type": "RollPitch" }, + { + "page3type": "SixValues" + }, { "page3type": "ThreeValues" }, @@ -1659,6 +1886,9 @@ { "page3type": "FourValues2" }, + { + "page3type": "SixValues" + }, { "page3type": "ThreeValues" }, @@ -1684,6 +1914,9 @@ { "page3type": "FourValues2" }, + { + "page3type": "SixValues" + }, { "page3type": "WindRoseFlex" } @@ -1700,6 +1933,9 @@ "obp40": "true" }, "condition": [ + { + "page3type": "SixValues" + }, { "page3type": "WindRoseFlex" } @@ -1716,6 +1952,9 @@ "obp40": "true" }, "condition": [ + { + "page3type": "SixValues" + }, { "page3type": "WindRoseFlex" } @@ -1787,6 +2026,7 @@ "OneValue", "RollPitch", "RudderPosition", + "SixValues", "Solar", "ThreeValues", "TwoValues", @@ -1836,6 +2076,9 @@ "obp40": "true" }, "condition": [ + { + "page4type": "Fluid" + }, { "page4type": "FourValues" }, @@ -1848,6 +2091,9 @@ { "page4type": "RollPitch" }, + { + "page4type": "SixValues" + }, { "page4type": "ThreeValues" }, @@ -1856,9 +2102,6 @@ }, { "page4type": "WindRoseFlex" - }, - { - "page4type": "Fluid" } ] }, @@ -1882,6 +2125,9 @@ { "page4type": "RollPitch" }, + { + "page4type": "SixValues" + }, { "page4type": "ThreeValues" }, @@ -1910,6 +2156,9 @@ { "page4type": "FourValues2" }, + { + "page4type": "SixValues" + }, { "page4type": "ThreeValues" }, @@ -1935,6 +2184,9 @@ { "page4type": "FourValues2" }, + { + "page4type": "SixValues" + }, { "page4type": "WindRoseFlex" } @@ -1951,6 +2203,9 @@ "obp40": "true" }, "condition": [ + { + "page4type": "SixValues" + }, { "page4type": "WindRoseFlex" } @@ -1967,6 +2222,9 @@ "obp40": "true" }, "condition": [ + { + "page4type": "SixValues" + }, { "page4type": "WindRoseFlex" } @@ -2038,6 +2296,7 @@ "OneValue", "RollPitch", "RudderPosition", + "SixValues", "Solar", "ThreeValues", "TwoValues", @@ -2084,6 +2343,9 @@ "obp40": "true" }, "condition": [ + { + "page5type": "Fluid" + }, { "page5type": "FourValues" }, @@ -2096,6 +2358,9 @@ { "page5type": "RollPitch" }, + { + "page5type": "SixValues" + }, { "page5type": "ThreeValues" }, @@ -2104,9 +2369,6 @@ }, { "page5type": "WindRoseFlex" - }, - { - "page5type": "Fluid" } ] }, @@ -2130,6 +2392,9 @@ { "page5type": "RollPitch" }, + { + "page5type": "SixValues" + }, { "page5type": "ThreeValues" }, @@ -2158,6 +2423,9 @@ { "page5type": "FourValues2" }, + { + "page5type": "SixValues" + }, { "page5type": "ThreeValues" }, @@ -2183,6 +2451,9 @@ { "page5type": "FourValues2" }, + { + "page5type": "SixValues" + }, { "page5type": "WindRoseFlex" } @@ -2199,6 +2470,9 @@ "obp40": "true" }, "condition": [ + { + "page5type": "SixValues" + }, { "page5type": "WindRoseFlex" } @@ -2215,6 +2489,9 @@ "obp40": "true" }, "condition": [ + { + "page5type": "SixValues" + }, { "page5type": "WindRoseFlex" } @@ -2286,6 +2563,7 @@ "OneValue", "RollPitch", "RudderPosition", + "SixValues", "Solar", "ThreeValues", "TwoValues", @@ -2329,6 +2607,9 @@ "obp40": "true" }, "condition": [ + { + "page6type": "Fluid" + }, { "page6type": "FourValues" }, @@ -2341,6 +2622,9 @@ { "page6type": "RollPitch" }, + { + "page6type": "SixValues" + }, { "page6type": "ThreeValues" }, @@ -2349,9 +2633,6 @@ }, { "page6type": "WindRoseFlex" - }, - { - "page6type": "Fluid" } ] }, @@ -2375,6 +2656,9 @@ { "page6type": "RollPitch" }, + { + "page6type": "SixValues" + }, { "page6type": "ThreeValues" }, @@ -2403,6 +2687,9 @@ { "page6type": "FourValues2" }, + { + "page6type": "SixValues" + }, { "page6type": "ThreeValues" }, @@ -2428,6 +2715,9 @@ { "page6type": "FourValues2" }, + { + "page6type": "SixValues" + }, { "page6type": "WindRoseFlex" } @@ -2444,6 +2734,9 @@ "obp40": "true" }, "condition": [ + { + "page6type": "SixValues" + }, { "page6type": "WindRoseFlex" } @@ -2460,6 +2753,9 @@ "obp40": "true" }, "condition": [ + { + "page6type": "SixValues" + }, { "page6type": "WindRoseFlex" } @@ -2531,6 +2827,7 @@ "OneValue", "RollPitch", "RudderPosition", + "SixValues", "Solar", "ThreeValues", "TwoValues", @@ -2571,6 +2868,9 @@ "obp40": "true" }, "condition": [ + { + "page7type": "Fluid" + }, { "page7type": "FourValues" }, @@ -2583,6 +2883,9 @@ { "page7type": "RollPitch" }, + { + "page7type": "SixValues" + }, { "page7type": "ThreeValues" }, @@ -2591,9 +2894,6 @@ }, { "page7type": "WindRoseFlex" - }, - { - "page7type": "Fluid" } ] }, @@ -2617,6 +2917,9 @@ { "page7type": "RollPitch" }, + { + "page7type": "SixValues" + }, { "page7type": "ThreeValues" }, @@ -2645,6 +2948,9 @@ { "page7type": "FourValues2" }, + { + "page7type": "SixValues" + }, { "page7type": "ThreeValues" }, @@ -2670,6 +2976,9 @@ { "page7type": "FourValues2" }, + { + "page7type": "SixValues" + }, { "page7type": "WindRoseFlex" } @@ -2686,6 +2995,9 @@ "obp40": "true" }, "condition": [ + { + "page7type": "SixValues" + }, { "page7type": "WindRoseFlex" } @@ -2702,6 +3014,9 @@ "obp40": "true" }, "condition": [ + { + "page7type": "SixValues" + }, { "page7type": "WindRoseFlex" } @@ -2773,6 +3088,7 @@ "OneValue", "RollPitch", "RudderPosition", + "SixValues", "Solar", "ThreeValues", "TwoValues", @@ -2810,6 +3126,9 @@ "obp40": "true" }, "condition": [ + { + "page8type": "Fluid" + }, { "page8type": "FourValues" }, @@ -2822,6 +3141,9 @@ { "page8type": "RollPitch" }, + { + "page8type": "SixValues" + }, { "page8type": "ThreeValues" }, @@ -2830,9 +3152,6 @@ }, { "page8type": "WindRoseFlex" - }, - { - "page8type": "Fluid" } ] }, @@ -2856,6 +3175,9 @@ { "page8type": "RollPitch" }, + { + "page8type": "SixValues" + }, { "page8type": "ThreeValues" }, @@ -2884,6 +3206,9 @@ { "page8type": "FourValues2" }, + { + "page8type": "SixValues" + }, { "page8type": "ThreeValues" }, @@ -2909,6 +3234,9 @@ { "page8type": "FourValues2" }, + { + "page8type": "SixValues" + }, { "page8type": "WindRoseFlex" } @@ -2925,6 +3253,9 @@ "obp40": "true" }, "condition": [ + { + "page8type": "SixValues" + }, { "page8type": "WindRoseFlex" } @@ -2941,6 +3272,9 @@ "obp40": "true" }, "condition": [ + { + "page8type": "SixValues" + }, { "page8type": "WindRoseFlex" } @@ -3012,6 +3346,7 @@ "OneValue", "RollPitch", "RudderPosition", + "SixValues", "Solar", "ThreeValues", "TwoValues", @@ -3046,6 +3381,9 @@ "obp40": "true" }, "condition": [ + { + "page9type": "Fluid" + }, { "page9type": "FourValues" }, @@ -3058,6 +3396,9 @@ { "page9type": "RollPitch" }, + { + "page9type": "SixValues" + }, { "page9type": "ThreeValues" }, @@ -3066,9 +3407,6 @@ }, { "page9type": "WindRoseFlex" - }, - { - "page9type": "Fluid" } ] }, @@ -3092,6 +3430,9 @@ { "page9type": "RollPitch" }, + { + "page9type": "SixValues" + }, { "page9type": "ThreeValues" }, @@ -3120,6 +3461,9 @@ { "page9type": "FourValues2" }, + { + "page9type": "SixValues" + }, { "page9type": "ThreeValues" }, @@ -3145,6 +3489,9 @@ { "page9type": "FourValues2" }, + { + "page9type": "SixValues" + }, { "page9type": "WindRoseFlex" } @@ -3161,6 +3508,9 @@ "obp40": "true" }, "condition": [ + { + "page9type": "SixValues" + }, { "page9type": "WindRoseFlex" } @@ -3177,6 +3527,9 @@ "obp40": "true" }, "condition": [ + { + "page9type": "SixValues" + }, { "page9type": "WindRoseFlex" } @@ -3248,6 +3601,7 @@ "OneValue", "RollPitch", "RudderPosition", + "SixValues", "Solar", "ThreeValues", "TwoValues", @@ -3279,6 +3633,9 @@ "obp40": "true" }, "condition": [ + { + "page10type": "Fluid" + }, { "page10type": "FourValues" }, @@ -3291,6 +3648,9 @@ { "page10type": "RollPitch" }, + { + "page10type": "SixValues" + }, { "page10type": "ThreeValues" }, @@ -3299,9 +3659,6 @@ }, { "page10type": "WindRoseFlex" - }, - { - "page10type": "Fluid" } ] }, @@ -3325,6 +3682,9 @@ { "page10type": "RollPitch" }, + { + "page10type": "SixValues" + }, { "page10type": "ThreeValues" }, @@ -3353,6 +3713,9 @@ { "page10type": "FourValues2" }, + { + "page10type": "SixValues" + }, { "page10type": "ThreeValues" }, @@ -3378,6 +3741,9 @@ { "page10type": "FourValues2" }, + { + "page10type": "SixValues" + }, { "page10type": "WindRoseFlex" } @@ -3394,6 +3760,9 @@ "obp40": "true" }, "condition": [ + { + "page10type": "SixValues" + }, { "page10type": "WindRoseFlex" } @@ -3410,6 +3779,9 @@ "obp40": "true" }, "condition": [ + { + "page10type": "SixValues" + }, { "page10type": "WindRoseFlex" } From 1bac5d8b1698ba6db7dbb296767893114abfb425 Mon Sep 17 00:00:00 2001 From: Thomas Hooge Date: Thu, 12 Jun 2025 15:23:21 +0200 Subject: [PATCH 2/6] System page improvements --- extra_script.py.new | 7 +- lib/obp60task/PageSystem.cpp | 160 +++++++++++++++++++++++++---------- 2 files changed, 122 insertions(+), 45 deletions(-) diff --git a/extra_script.py.new b/extra_script.py.new index b185a93..63f7f31 100644 --- a/extra_script.py.new +++ b/extra_script.py.new @@ -520,9 +520,14 @@ prebuild(env) board="PLATFORM_BOARD_%s"%env["BOARD"].replace("-","_").upper() print("Board=#%s#"%board) print("BuildFlags=%s"%(" ".join(env["BUILD_FLAGS"]))) +res=[x for x in env["BUILD_FLAGS"] if x.startswith("-D DISPLAY_")] +if res: + epdtype = res[0].split('_')[1] +else: + epdtype = 'unknown' env.Append( LINKFLAGS=[ "-u", "custom_app_desc" ], - CPPDEFINES=[(board,"1")] + CPPDEFINES=[(board,"1"), ("BOARD", env["BOARD"]), ("EPDTYPE", epdtype)] ) #script does not run on clean yet - maybe in the future env.AddPostAction("clean",cleangenerated) diff --git a/lib/obp60task/PageSystem.cpp b/lib/obp60task/PageSystem.cpp index 7f601a1..5f7e7a6 100644 --- a/lib/obp60task/PageSystem.cpp +++ b/lib/obp60task/PageSystem.cpp @@ -9,16 +9,23 @@ #define STRINGIZE_IMPL(x) #x #define STRINGIZE(x) STRINGIZE_IMPL(x) #define VERSINFO STRINGIZE(GWDEVVERSION) +#define BOARDINFO STRINGIZE(BOARD) +#define DISPLAYINFO STRINGIZE(EPDTYPE) /* * Special system page, called directly with fast key sequence 5,4 * Out of normal page order. + * Consists of some sub-pages with following content: + * 1. Hard and software information + * 2. System settings + * 3. NMEA2000 device list */ class PageSystem : public Page { uint64_t chipid; bool simulation; +bool sdcard; String buzzer_mode; uint8_t buzzer_power; String cpuspeed; @@ -26,7 +33,12 @@ String rtc_module; String gps_module; String env_module; -char mode = 'N'; // (N)ormal, (D)evice list +String batt_sensor; +String solar_sensor; +String gen_sensor; +String rot_sensor; + +char mode = 'N'; // (N)ormal, (S)ettings, (D)evice list public: PageSystem(CommonData &common){ @@ -37,12 +49,18 @@ public: } chipid = ESP.getEfuseMac(); simulation = common.config->getBool(common.config->useSimuData); + sdcard = common.config->getBool(common.config->useSDCard); buzzer_mode = common.config->getString(common.config->buzzerMode); + buzzer_mode.toLowerCase(); buzzer_power = common.config->getInt(common.config->buzzerPower); cpuspeed = common.config->getString(common.config->cpuSpeed); env_module = common.config->getString(common.config->useEnvSensor); rtc_module = common.config->getString(common.config->useRTC); gps_module = common.config->getString(common.config->useGPS); + batt_sensor = common.config->getString(common.config->usePowSensor1); + solar_sensor = common.config->getString(common.config->usePowSensor2); + gen_sensor = common.config->getString(common.config->usePowSensor3); + gen_sensor = common.config->getString(common.config->useRotSensor); } virtual void setupKeys(){ @@ -60,6 +78,8 @@ public: commonData->logger->logDebug(GwLog::LOG, "System keyboard handler"); if (key == 2) { if (mode == 'N') { + mode = 'S'; + } else if (mode == 'S') { mode = 'D'; } else { mode = 'N'; @@ -144,19 +164,22 @@ public: // Draw page //*********************************************************** - const uint16_t y0 = 120; // data table starts here + uint16_t x0 = 8; // left column + uint16_t y0 = 48; // data table starts here // Set display in partial refresh mode getdisplay().setPartialWindow(0, 0, getdisplay().width(), getdisplay().height()); // Set partial update if (mode == 'N') { + getdisplay().setFont(&Ubuntu_Bold12pt7b); - getdisplay().setCursor(8, 50); + getdisplay().setCursor(8, 48); getdisplay().print("System Information"); getdisplay().drawXBitmap(320, 25, logo64_bits, logo64_width, logo64_height, commonData->fgcolor); getdisplay().setFont(&Ubuntu_Bold8pt7b); + y0 = 120; char ssid[13]; snprintf(ssid, 13, "%04X%08X", (uint16_t)(chipid >> 32), (uint32_t)chipid); @@ -164,10 +187,21 @@ public: getdisplay().setCursor(8, 70); getdisplay().print(String("MUDEVICE-") + String(ssid)); - getdisplay().setCursor(8, 90); + getdisplay().setCursor(8, 100); getdisplay().print("Firmware Version: "); + getdisplay().setCursor(160, 100); getdisplay().print(VERSINFO); + getdisplay().setCursor(8, 120); + getdisplay().print("Board version: "); + getdisplay().setCursor(160, 120); + getdisplay().print(BOARDINFO); + + getdisplay().setCursor(8, 140); + getdisplay().print("Display version: "); + getdisplay().setCursor(160, 140); + getdisplay().print(DISPLAYINFO); + getdisplay().setCursor(8, 265); #ifdef BOARD_OBP60S3 getdisplay().print("Press STBY to enter deep sleep mode"); @@ -176,69 +210,107 @@ public: getdisplay().print("Press wheel to enter deep sleep mode"); #endif - getdisplay().setCursor(2, y0); - getdisplay().print("Simulation:"); - getdisplay().setCursor(120, y0); - getdisplay().print(simulation ? "on" : "off"); - - getdisplay().setCursor(2, y0 + 16); - getdisplay().print("Environment:"); - getdisplay().setCursor(120, y0 + 16); - getdisplay().print(env_module); - // total RAM free int Heap_free = esp_get_free_heap_size(); - getdisplay().setCursor(202, y0); + getdisplay().setCursor(8, y0 + 64); getdisplay().print("Total free:"); - getdisplay().setCursor(300, y0); + getdisplay().setCursor(120, y0 + 64); getdisplay().print(String(Heap_free)); - getdisplay().setCursor(2, y0 + 32); - getdisplay().print("Buzzer:"); - getdisplay().setCursor(120, y0 + 32); - getdisplay().print(buzzer_mode); - - // RAM free for task - int RAM_free = uxTaskGetStackHighWaterMark(NULL); - getdisplay().setCursor(202, y0 + 16); - getdisplay().print("Task free:"); - getdisplay().setCursor(300, y0 + 16); - getdisplay().print(String(RAM_free)); - - // FRAM available / status - getdisplay().setCursor(202, y0 + 32); - getdisplay().print("FRAM:"); - getdisplay().setCursor(300, y0 + 32); - getdisplay().print(hasFRAM ? "available" : "not found"); - - getdisplay().setCursor(202, y0 + 64); + // CPU speed config / active + getdisplay().setCursor(8, y0 + 48); getdisplay().print("CPU speed:"); - getdisplay().setCursor(300, y0 + 64); + getdisplay().setCursor(120, y0 + 48); getdisplay().print(cpuspeed); getdisplay().print(" / "); int cpu_freq = esp_clk_cpu_freq() / 1000000; getdisplay().print(String(cpu_freq)); - getdisplay().setCursor(2, y0 + 64); + // RAM free for task + int RAM_free = uxTaskGetStackHighWaterMark(NULL); + getdisplay().setCursor(8, y0 + 80); + getdisplay().print("Task free:"); + getdisplay().setCursor(120, y0 + 80); + getdisplay().print(String(RAM_free)); + + // FRAM available / status + getdisplay().setCursor(8, y0 + 96); + getdisplay().print("FRAM:"); + getdisplay().setCursor(120, y0 + 96); + getdisplay().print(hasFRAM ? "available" : "not found"); + + + } else if (mode == 'S') { + // Settings + + getdisplay().setFont(&Ubuntu_Bold12pt7b); + getdisplay().setCursor(x0, 48); + getdisplay().print("System settings"); + + getdisplay().setFont(&Ubuntu_Bold8pt7b); + x0 = 8; + y0 = 72; + + // left column + getdisplay().setCursor(x0, y0); + getdisplay().print("Simulation:"); + getdisplay().setCursor(140, y0); + getdisplay().print(simulation ? "on" : "off"); + + getdisplay().setCursor(x0, y0 + 16); + getdisplay().print("Environment:"); + getdisplay().setCursor(140, y0 + 16); + getdisplay().print(env_module); + + getdisplay().setCursor(x0, y0 + 32); + getdisplay().print("Buzzer:"); + getdisplay().setCursor(140, y0 + 32); + getdisplay().print(buzzer_mode); + + getdisplay().setCursor(x0, y0 + 64); getdisplay().print("GPS:"); - getdisplay().setCursor(120, y0 + 64); + getdisplay().setCursor(140, y0 + 64); getdisplay().print(gps_module); - getdisplay().setCursor(2, y0 + 80); + getdisplay().setCursor(x0, y0 + 80); getdisplay().print("RTC:"); - getdisplay().setCursor(120, y0 + 80); + getdisplay().setCursor(140, y0 + 80); getdisplay().print(rtc_module); - getdisplay().setCursor(2, y0 + 96); + getdisplay().setCursor(x0, y0 + 96); getdisplay().print("Wifi:"); - getdisplay().setCursor(120, y0 + 96); - getdisplay().print(commonData->status.wifiApOn ? "On" : "Off"); + getdisplay().setCursor(140, y0 + 96); + getdisplay().print(commonData->status.wifiApOn ? "on" : "off"); + // right column + getdisplay().setCursor(202, y0); + getdisplay().print("Batt. sensor:"); + getdisplay().setCursor(320, y0); + getdisplay().print(batt_sensor); + + // Solar sensor + getdisplay().setCursor(202, y0 + 16); + getdisplay().print("Solar sensor:"); + getdisplay().setCursor(320, y0 + 16); + getdisplay().print(solar_sensor); + + // Generator sensor + getdisplay().setCursor(202, y0 + 32); + getdisplay().print("Gen. sensor:"); + getdisplay().setCursor(320, y0 + 32); + getdisplay().print(gen_sensor); + + // Gyro sensor + // SD-Card + getdisplay().setCursor(202, y0 + 64); + getdisplay().print("SD-Card:"); + getdisplay().setCursor(320, y0 + 64); + getdisplay().print(sdcard ? "on" : "off"); } else { // NMEA2000 device list getdisplay().setFont(&Ubuntu_Bold12pt7b); - getdisplay().setCursor(20, 50); + getdisplay().setCursor(8, 48); getdisplay().print("NMEA2000 device list"); getdisplay().setFont(&Ubuntu_Bold8pt7b); From 77c05de4fcefe03d4763e07bebbf5a42a014a8fc Mon Sep 17 00:00:00 2001 From: Thomas Hooge Date: Fri, 13 Jun 2025 09:21:41 +0200 Subject: [PATCH 3/6] More work on system page --- extra_script.py.new | 17 ++++--- lib/obp60task/PageSystem.cpp | 98 ++++++++++++++++++++++-------------- lib/obp60task/platformio.ini | 3 +- 3 files changed, 73 insertions(+), 45 deletions(-) diff --git a/extra_script.py.new b/extra_script.py.new index 63f7f31..31ae608 100644 --- a/extra_script.py.new +++ b/extra_script.py.new @@ -520,14 +520,19 @@ prebuild(env) board="PLATFORM_BOARD_%s"%env["BOARD"].replace("-","_").upper() print("Board=#%s#"%board) print("BuildFlags=%s"%(" ".join(env["BUILD_FLAGS"]))) -res=[x for x in env["BUILD_FLAGS"] if x.startswith("-D DISPLAY_")] -if res: - epdtype = res[0].split('_')[1] -else: - epdtype = 'unknown' + +epdtype = "unknown" +pcbvers = "unknown" +for x in env["BUILD_FLAGS"]: + if x.startswith("-D HARDWARE_"): + pcbvers = x.split('_')[1] + if x.startswith("-D DISPLAY_"): + epdtype = x.split('_')[1] + env.Append( LINKFLAGS=[ "-u", "custom_app_desc" ], - CPPDEFINES=[(board,"1"), ("BOARD", env["BOARD"]), ("EPDTYPE", epdtype)] + CPPDEFINES=[(board,"1"), ("BOARD", env["BOARD"]), ("EPDTYPE", epdtype), + ("PCBVERS", pcbvers)] ) #script does not run on clean yet - maybe in the future env.AddPostAction("clean",cleangenerated) diff --git a/lib/obp60task/PageSystem.cpp b/lib/obp60task/PageSystem.cpp index 5f7e7a6..5af82b6 100644 --- a/lib/obp60task/PageSystem.cpp +++ b/lib/obp60task/PageSystem.cpp @@ -10,6 +10,7 @@ #define STRINGIZE(x) STRINGIZE_IMPL(x) #define VERSINFO STRINGIZE(GWDEVVERSION) #define BOARDINFO STRINGIZE(BOARD) +#define PCBINFO STRINGIZE(PCBVERS) #define DISPLAYINFO STRINGIZE(EPDTYPE) /* @@ -49,7 +50,9 @@ public: } chipid = ESP.getEfuseMac(); simulation = common.config->getBool(common.config->useSimuData); +#ifdef BOARD_OBP40S3 sdcard = common.config->getBool(common.config->useSDCard); +#endif buzzer_mode = common.config->getString(common.config->buzzerMode); buzzer_mode.toLowerCase(); buzzer_power = common.config->getInt(common.config->buzzerPower); @@ -125,12 +128,12 @@ public: // s is pixel size of a single box QRCode qrcode; uint8_t qrcodeData[qrcode_getBufferSize(4)]; - #ifdef BOARD_OBP40S3 +#ifdef BOARD_OBP40S3 String prefix = "OBP40:SN:"; - #endif - #ifdef BOARD_OBP60S3 +#endif +#ifdef BOARD_OBP60S3 String prefix = "OBP60:SN:"; - #endif +#endif qrcode_initText(&qrcode, qrcodeData, 4, 0, (prefix + serialno).c_str()); int16_t x0 = x; for (uint8_t j = 0; j < qrcode.size; j++) { @@ -179,66 +182,89 @@ public: getdisplay().drawXBitmap(320, 25, logo64_bits, logo64_width, logo64_height, commonData->fgcolor); getdisplay().setFont(&Ubuntu_Bold8pt7b); - y0 = 120; + y0 = 155; char ssid[13]; snprintf(ssid, 13, "%04X%08X", (uint16_t)(chipid >> 32), (uint32_t)chipid); displayBarcode(String(ssid), 320, 200, 2); getdisplay().setCursor(8, 70); - getdisplay().print(String("MUDEVICE-") + String(ssid)); + getdisplay().print(String("MCUDEVICE-") + String(ssid)); - getdisplay().setCursor(8, 100); - getdisplay().print("Firmware Version: "); - getdisplay().setCursor(160, 100); + getdisplay().setCursor(8, 95); + getdisplay().print("Firmware version: "); + getdisplay().setCursor(160, 95); getdisplay().print(VERSINFO); - getdisplay().setCursor(8, 120); + getdisplay().setCursor(8, 113); getdisplay().print("Board version: "); - getdisplay().setCursor(160, 120); + getdisplay().setCursor(160, 113); getdisplay().print(BOARDINFO); + getdisplay().print(String(" HW ") + String(PCBINFO)); - getdisplay().setCursor(8, 140); + getdisplay().setCursor(8, 131); getdisplay().print("Display version: "); - getdisplay().setCursor(160, 140); + getdisplay().setCursor(160, 131); getdisplay().print(DISPLAYINFO); getdisplay().setCursor(8, 265); - #ifdef BOARD_OBP60S3 +#ifdef BOARD_OBP60S3 getdisplay().print("Press STBY to enter deep sleep mode"); - #endif - #ifdef BOARD_OBP40S3 +#endif +#ifdef BOARD_OBP40S3 getdisplay().print("Press wheel to enter deep sleep mode"); - #endif +#endif - // total RAM free - int Heap_free = esp_get_free_heap_size(); - getdisplay().setCursor(8, y0 + 64); - getdisplay().print("Total free:"); - getdisplay().setCursor(120, y0 + 64); - getdisplay().print(String(Heap_free)); + // Flash memory size + uint32_t flash_size = ESP.getFlashChipSize(); + getdisplay().setCursor(8, y0); + getdisplay().print("FLASH:"); + getdisplay().setCursor(90, y0); + getdisplay().print(String(flash_size / 1024) + String(" kB")); + + // PSRAM memory size + uint32_t psram_size = ESP.getPsramSize(); + getdisplay().setCursor(8, y0 + 16); + getdisplay().print("PSRAM:"); + getdisplay().setCursor(90, y0 + 16); + getdisplay().print(String(psram_size / 1024) + String(" kB")); + + // FRAM available / status + getdisplay().setCursor(8, y0 + 32); + getdisplay().print("FRAM:"); + getdisplay().setCursor(90, y0 + 32); + getdisplay().print(hasFRAM ? "available" : "not found"); + +#ifdef BOARD_OBP40S3 + // SD-Card + getdisplay().setCursor(8, y0 + 48); + getdisplay().print("SD-Card:"); + getdisplay().setCursor(90, y0 + 48); + getdisplay().print(sdcard ? "on" : "off"); +#endif // CPU speed config / active - getdisplay().setCursor(8, y0 + 48); + getdisplay().setCursor(202, y0); getdisplay().print("CPU speed:"); - getdisplay().setCursor(120, y0 + 48); + getdisplay().setCursor(300, y0); getdisplay().print(cpuspeed); getdisplay().print(" / "); int cpu_freq = esp_clk_cpu_freq() / 1000000; getdisplay().print(String(cpu_freq)); + // total RAM free + int Heap_free = esp_get_free_heap_size(); + getdisplay().setCursor(202, y0 + 16); + getdisplay().print("Total free:"); + getdisplay().setCursor(300, y0 + 16); + getdisplay().print(String(Heap_free)); + // RAM free for task int RAM_free = uxTaskGetStackHighWaterMark(NULL); - getdisplay().setCursor(8, y0 + 80); + getdisplay().setCursor(202, y0 + 32); getdisplay().print("Task free:"); - getdisplay().setCursor(120, y0 + 80); + getdisplay().setCursor(300, y0 + 32); getdisplay().print(String(RAM_free)); - // FRAM available / status - getdisplay().setCursor(8, y0 + 96); - getdisplay().print("FRAM:"); - getdisplay().setCursor(120, y0 + 96); - getdisplay().print(hasFRAM ? "available" : "not found"); - } else if (mode == 'S') { // Settings @@ -301,11 +327,7 @@ public: getdisplay().print(gen_sensor); // Gyro sensor - // SD-Card - getdisplay().setCursor(202, y0 + 64); - getdisplay().print("SD-Card:"); - getdisplay().setCursor(320, y0 + 64); - getdisplay().print(sdcard ? "on" : "off"); + } else { // NMEA2000 device list diff --git a/lib/obp60task/platformio.ini b/lib/obp60task/platformio.ini index 4acd552..f8c26ae 100644 --- a/lib/obp60task/platformio.ini +++ b/lib/obp60task/platformio.ini @@ -94,7 +94,8 @@ lib_deps = adafruit/Adafruit FRAM I2C@^2.0.3 build_flags= -D DISABLE_DIAGNOSTIC_OUTPUT #Disable diagnostic output for GxEPD2 lib - -D BOARD_OBP40S3 #Board OBP40 V1.0 with ESP32S3 SKU:DIE07300S (CrowPanel 4.2) + -D BOARD_OBP40S3 #Board OBP40 with ESP32S3 + -D HARDWARE_V10 #OBP40 hardware revision V1.0 SKU:DIE7300S v1.1 (CrowPanel 4.2) -D DISPLAY_GDEY042T81 #new E-Ink display from Waveshare, R10 2.2 ohm #-D LIPO_ACCU_1200 #Hardware extension, LiPo accu 3,7V 1200mAh #-D VOLTAGE_SENSOR #Hardware extension, LiPo voltage sensor with two resistors From f5cf2928047ee97876b7e1e1d1f55a6890924f59 Mon Sep 17 00:00:00 2001 From: Thomas Hooge Date: Fri, 13 Jun 2025 10:32:18 +0200 Subject: [PATCH 4/6] Typo in platformio.ini fixed --- lib/obp60task/platformio.ini | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/obp60task/platformio.ini b/lib/obp60task/platformio.ini index f8c26ae..21d56a5 100644 --- a/lib/obp60task/platformio.ini +++ b/lib/obp60task/platformio.ini @@ -95,7 +95,7 @@ lib_deps = build_flags= -D DISABLE_DIAGNOSTIC_OUTPUT #Disable diagnostic output for GxEPD2 lib -D BOARD_OBP40S3 #Board OBP40 with ESP32S3 - -D HARDWARE_V10 #OBP40 hardware revision V1.0 SKU:DIE7300S v1.1 (CrowPanel 4.2) + -D HARDWARE_V10 #OBP40 hardware revision V1.0 SKU:DIE07300S V1.1 (CrowPanel 4.2) -D DISPLAY_GDEY042T81 #new E-Ink display from Waveshare, R10 2.2 ohm #-D LIPO_ACCU_1200 #Hardware extension, LiPo accu 3,7V 1200mAh #-D VOLTAGE_SENSOR #Hardware extension, LiPo voltage sensor with two resistors From 99c3470a22667a7d5fecad3f6df0a028b1dbfce3 Mon Sep 17 00:00:00 2001 From: Thomas Hooge Date: Sat, 14 Jun 2025 10:09:48 +0200 Subject: [PATCH 5/6] Some work on system page and SD-card integration --- lib/obp60task/PageSystem.cpp | 36 +++++++++++++++++++++++++++++---- lib/obp60task/config_obp40.json | 6 +----- lib/obp60task/obp60task.cpp | 4 ++-- 3 files changed, 35 insertions(+), 11 deletions(-) diff --git a/lib/obp60task/PageSystem.cpp b/lib/obp60task/PageSystem.cpp index 5af82b6..519bee1 100644 --- a/lib/obp60task/PageSystem.cpp +++ b/lib/obp60task/PageSystem.cpp @@ -6,6 +6,11 @@ #include #include "qrcode.h" +#ifdef BOARD_OBP40S3 +#include +#include +#endif + #define STRINGIZE_IMPL(x) #x #define STRINGIZE(x) STRINGIZE_IMPL(x) #define VERSINFO STRINGIZE(GWDEVVERSION) @@ -39,7 +44,7 @@ String solar_sensor; String gen_sensor; String rot_sensor; -char mode = 'N'; // (N)ormal, (S)ettings, (D)evice list +char mode = 'N'; // (N)ormal, (S)ettings, (D)evice list, (C)ard public: PageSystem(CommonData &common){ @@ -63,7 +68,7 @@ public: batt_sensor = common.config->getString(common.config->usePowSensor1); solar_sensor = common.config->getString(common.config->usePowSensor2); gen_sensor = common.config->getString(common.config->usePowSensor3); - gen_sensor = common.config->getString(common.config->useRotSensor); + rot_sensor = common.config->getString(common.config->useRotSensor); } virtual void setupKeys(){ @@ -84,6 +89,12 @@ public: mode = 'S'; } else if (mode == 'S') { mode = 'D'; + } else if (mode == 'D') { + if (sdcard) { + mode = 'C'; + } else { + mode = 'N'; + } } else { mode = 'N'; } @@ -239,7 +250,12 @@ public: getdisplay().setCursor(8, y0 + 48); getdisplay().print("SD-Card:"); getdisplay().setCursor(90, y0 + 48); - getdisplay().print(sdcard ? "on" : "off"); + if (sdcard) { + uint64_t cardsize = SD.cardSize() / (1024 * 1024); + getdisplay().print(String(cardsize) + String(" MB")); + } else { + getdisplay().print("off"); + } #endif // CPU speed config / active @@ -265,7 +281,6 @@ public: getdisplay().setCursor(300, y0 + 32); getdisplay().print(String(RAM_free)); - } else if (mode == 'S') { // Settings @@ -328,6 +343,19 @@ public: // Gyro sensor + } else if (mode == 'C') { + // Card info + getdisplay().setFont(&Ubuntu_Bold12pt7b); + getdisplay().setCursor(8, 48); + getdisplay().print("SD Card info"); + + getdisplay().setFont(&Ubuntu_Bold8pt7b); + + x0 = 20; + y0 = 72; + getdisplay().setCursor(x0, y0); + getdisplay().print("Work in progress..."); + } else { // NMEA2000 device list diff --git a/lib/obp60task/config_obp40.json b/lib/obp60task/config_obp40.json index 2c8b0f3..c41e95c 100644 --- a/lib/obp60task/config_obp40.json +++ b/lib/obp60task/config_obp40.json @@ -616,12 +616,8 @@ "name": "useSDCard", "label": "SD Card", "type": "boolean", - "default": "off", + "default": "false", "description": "Use internal SD card interface [off|on]", - "list": [ - "off", - "on" - ], "category": "OBP40 Hardware", "capabilities": { "obp40": "true" diff --git a/lib/obp60task/obp60task.cpp b/lib/obp60task/obp60task.cpp index bdc28e0..fb3ef6f 100644 --- a/lib/obp60task/obp60task.cpp +++ b/lib/obp60task/obp60task.cpp @@ -79,8 +79,8 @@ void OBP60Init(GwApi *api){ } #ifdef BOARD_OBP40S3 - String sdcard = config->getConfigItem(config->useSDCard, true)->asString(); - if (sdcard == "on") { + bool sdcard = config->getBool(config->useSDCard); + if (sdcard) { SPIClass SD_SPI = SPIClass(HSPI); SD_SPI.begin(SD_SPI_CLK, SD_SPI_MISO, SD_SPI_MOSI); if (SD.begin(SD_SPI_CS, SD_SPI, 80000000)) { From c5a1244519d4724e4854e96c369b5af2dd1e49ec Mon Sep 17 00:00:00 2001 From: Thomas Hooge Date: Sun, 15 Jun 2025 10:19:59 +0200 Subject: [PATCH 6/6] Some config.json improvements --- lib/obp60task/config.json | 4 +++- lib/obp60task/config_obp40.json | 2 ++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/obp60task/config.json b/lib/obp60task/config.json index c1801af..5b73a1d 100644 --- a/lib/obp60task/config.json +++ b/lib/obp60task/config.json @@ -16,7 +16,7 @@ "description": "NTP time server. Use only one hostname or IP address", "category": "wifi client", "capabilities": { - "obp40": "true" + "obp60": "true" } }, { @@ -1117,6 +1117,7 @@ "min": 1, "max": 10, "default":"10", + "description": "Number of visible data pages [1...10]", "category":"OBP60 Pages", "capabilities": { "obp60":"true" @@ -1130,6 +1131,7 @@ "min": 1, "max": 10, "default":"1", + "description": "First page number to display after device startup", "category":"OBP60 Pages", "capabilities": { "obp60":"true" diff --git a/lib/obp60task/config_obp40.json b/lib/obp60task/config_obp40.json index c41e95c..a03b359 100644 --- a/lib/obp60task/config_obp40.json +++ b/lib/obp60task/config_obp40.json @@ -1129,6 +1129,7 @@ "min": 1, "max": 10, "default":"10", + "description": "Number of visible data pages [1...10]", "category":"OBP40 Pages", "capabilities": { "obp40": "true" @@ -1142,6 +1143,7 @@ "min": 1, "max": 10, "default":"1", + "description": "First page number to display after device startup", "category":"OBP40 Pages", "capabilities": { "obp40": "true"