From 77c05de4fcefe03d4763e07bebbf5a42a014a8fc Mon Sep 17 00:00:00 2001 From: Thomas Hooge Date: Fri, 13 Jun 2025 09:21:41 +0200 Subject: [PATCH] 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