From 10d1046c824be8d6fdaf3eac1e2fc9bbb36be4ff Mon Sep 17 00:00:00 2001 From: Thomas Hooge Date: Mon, 20 Jan 2025 07:35:50 +0100 Subject: [PATCH] Some more improvements for OBP40, mainly building --- extra_script.py | 21 ++++++++++----- lib/obp60task/OBP60Extensions.cpp | 2 ++ lib/obp60task/README | 7 ++++- lib/obp60task/obp60task.cpp | 4 +++ lib/obp60task/obp60task.h | 5 ++++ lib/obp60task/platformio.ini | 45 ++++++++++++++++++++++++++++++- 6 files changed, 76 insertions(+), 8 deletions(-) diff --git a/extra_script.py b/extra_script.py index ed62c64..c44b546 100644 --- a/extra_script.py +++ b/extra_script.py @@ -10,7 +10,7 @@ from datetime import datetime import re import pprint from platformio.project.config import ProjectConfig - +from platformio.project.exception import InvalidProjectConfError Import("env") #print(env.Dump()) @@ -104,13 +104,22 @@ def writeFileIfChanged(fileName,data): return True def mergeConfig(base,other): + try: + customconfig = env.GetProjectOption("custom_config") + except InvalidProjectConfError: + customconfig = None for bdir in other: + if customconfig and os.path.exists(os.path.join(bdir,customconfig)): + cname=os.path.join(bdir,customconfig) + print("merge custom config {}".format(cname)) + with open(cname,'rb') as ah: + base += json.load(ah) + continue cname=os.path.join(bdir,"config.json") if os.path.exists(cname): - print("merge config %s"%cname) + print("merge config {}".format(cname)) with open(cname,'rb') as ah: - merge=json.load(ah) - base=base+merge + base += json.load(ah) return base def replaceTexts(data,replacements): @@ -274,9 +283,9 @@ class Grove: def _ss(self,z=False): if z: return self.name - return self.name if self.name is not 'Z' else '' + return self.name if self.name != 'Z' else '' def _suffix(self): - return '_'+self.name if self.name is not 'Z' else '' + return '_'+self.name if self.name != 'Z' else '' def replace(self,line): if line is None: return line diff --git a/lib/obp60task/OBP60Extensions.cpp b/lib/obp60task/OBP60Extensions.cpp index 153ecbb..cf1ade5 100644 --- a/lib/obp60task/OBP60Extensions.cpp +++ b/lib/obp60task/OBP60Extensions.cpp @@ -326,12 +326,14 @@ void displayHeader(CommonData &commonData, GwApi::BoatValue *date, GwApi::BoatVa usbRxOld = commonData.status.usbRx; usbTxOld = commonData.status.usbTx; +#ifdef HARDWARE_V21 // Display key lock status if (commonData.keylock) { getdisplay().drawXBitmap(170, 1, lock_bits, icon_width, icon_height, commonData.fgcolor); } else { getdisplay().drawXBitmap(166, 1, swipe_bits, swipe_width, swipe_height, commonData.fgcolor); } +#endif // Heartbeat as dot getdisplay().setTextColor(commonData.fgcolor); diff --git a/lib/obp60task/README b/lib/obp60task/README index ab8e729..e1baf3b 100644 --- a/lib/obp60task/README +++ b/lib/obp60task/README @@ -7,7 +7,12 @@ Important information: THIS BRANCH IS NOT INTENDED TO MERGE INTO "master"! *************************************************** -platformio.ini adapted to compile directly +platformio.ini adapted to compile directly. For compile use matching +environent: + pio run -e obp40 + +for upload to device: + pio run -e obp40 -t upload Differences to OBP60 -------------------- diff --git a/lib/obp60task/obp60task.cpp b/lib/obp60task/obp60task.cpp index 769d7c6..d3148cc 100644 --- a/lib/obp60task/obp60task.cpp +++ b/lib/obp60task/obp60task.cpp @@ -327,8 +327,10 @@ void OBP60Task(GwApi *api){ commonData.logger=logger; commonData.config=config; +#ifdef HARDWARE_V21 // Keyboard coordinates for page footer initKeys(commonData); +#endif tN2kMsg N2kMsg; @@ -686,10 +688,12 @@ void OBP60Task(GwApi *api){ } //call the page code LOG_DEBUG(GwLog::DEBUG,"calling page %d",pageNumber); +#ifdef HARDWARE_V21 // Show footer if enabled (together with header) if (pages[pageNumber].description && pages[pageNumber].description->header){ displayFooter(commonData); } +#endif currentPage->displayPage(pages[pageNumber].parameters); } } diff --git a/lib/obp60task/obp60task.h b/lib/obp60task/obp60task.h index 1ee2f29..2284e6f 100644 --- a/lib/obp60task/obp60task.h +++ b/lib/obp60task/obp60task.h @@ -35,6 +35,11 @@ // OBP60 Task void OBP60Task(GwApi *param); DECLARE_USERTASK_PARAM(OBP60Task, 35000); // Need 35k RAM as stack size + #ifdef HARDWARE_V21 DECLARE_CAPABILITY(obp60,true); + #endif + #ifdef HARDWARE_LIGHT + DECLARE_CAPABILITY(obp40,true) + #endif DECLARE_STRING_CAPABILITY(HELP_URL, "https://obp60-v2-docu.readthedocs.io/de/latest/"); // Link to help pages #endif diff --git a/lib/obp60task/platformio.ini b/lib/obp60task/platformio.ini index e47e00c..7c1a659 100644 --- a/lib/obp60task/platformio.ini +++ b/lib/obp60task/platformio.ini @@ -14,7 +14,7 @@ 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 = +lib_deps = ${basedeps.lib_deps} Wire SPI @@ -60,3 +60,46 @@ 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 + +[env:obp40] +platform = espressif32@6.8.1 +board_build.variants_dir = variants +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 +custom_config = config_obp40.json +framework = arduino +lib_deps = + ${basedeps.lib_deps} + Wire + SPI + SD + esphome/AsyncTCP-esphome@2.0.1 + robtillaart/PCF8574@0.3.9 + adafruit/Adafruit Unified Sensor @ 1.1.13 + blemasle/MCP23017@2.0.0 + adafruit/Adafruit BusIO@1.5.0 + adafruit/Adafruit GFX Library@1.11.9 + #zinggjm/GxEPD2@1.5.8 + #https://github.com/ZinggJM/GxEPD2 + https://github.com/thooge/GxEPD2 + sstaub/Ticker@4.4.0 + adafruit/Adafruit BMP280 Library@2.6.2 + adafruit/Adafruit BME280 Library@2.2.2 + adafruit/Adafruit BMP085 Library@1.2.1 + enjoyneering/HTU21D@1.2.1 + robtillaart/INA226@0.2.0 + paulstoffregen/OneWire@2.3.8 + milesburton/DallasTemperature@3.11.0 + signetica/SunRise@2.0.2 + adafruit/Adafruit FRAM I2C@^2.0.3 +build_flags= + #https://thingpulse.com/usb-settings-for-logging-with-the-esp32-s3-in-platformio/?srsltid=AfmBOopGskbkr4GoeVkNlFaZXe_zXkLceKF6Rn-tmoXABCeAR2vWsdHL + -D DISABLE_DIAGNOSTIC_OUTPUT #Disable diagnostic output for GxEPD2 lib + -D BOARD_OBP60S3 #Board OBP60 V2.1 with ESP32S3 + -D HARDWARE_LIGHT #OBP60 hardware clone (OBP40) + -D DISPLAY_GDEY042T81 #new E-Ink display from Waveshare, R10 2.2 ohm + ${env.build_flags} +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