1
0
mirror of https://github.com/thooge/esp32-nmea2000-obp60.git synced 2025-12-29 13:33:06 +01:00

1 Commits

Author SHA1 Message Date
1545855326 OBP40 integration code and improvements 2025-01-20 12:49:30 +01:00
9 changed files with 3445 additions and 101 deletions

View File

@@ -10,7 +10,7 @@
"-DBOARD_HAS_PSRAM", "-DBOARD_HAS_PSRAM",
"-DARDUINO_ESP32S3_DEV", "-DARDUINO_ESP32S3_DEV",
"-DARDUINO_USB_MODE=1", "-DARDUINO_USB_MODE=1",
"-DARDUINO_USB_CDC_ON_BOOT=0", "-DARDUINO_USB_CDC_ON_BOOT=1",
"-DARDUINO_RUNNING_CORE=1", "-DARDUINO_RUNNING_CORE=1",
"-DARDUINO_EVENT_RUNNING_CORE=1" "-DARDUINO_EVENT_RUNNING_CORE=1"
], ],

View File

@@ -10,7 +10,7 @@ from datetime import datetime
import re import re
import pprint import pprint
from platformio.project.config import ProjectConfig from platformio.project.config import ProjectConfig
from platformio.project.exception import InvalidProjectConfError
Import("env") Import("env")
#print(env.Dump()) #print(env.Dump())
@@ -104,22 +104,13 @@ def writeFileIfChanged(fileName,data):
return True return True
def mergeConfig(base,other): def mergeConfig(base,other):
try:
customconfig = env.GetProjectOption("custom_config")
except InvalidProjectConfError:
customconfig = None
for bdir in other: 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") cname=os.path.join(bdir,"config.json")
if os.path.exists(cname): if os.path.exists(cname):
print("merge config {}".format(cname)) print("merge config %s"%cname)
with open(cname,'rb') as ah: with open(cname,'rb') as ah:
base += json.load(ah) merge=json.load(ah)
base=base+merge
return base return base
def replaceTexts(data,replacements): def replaceTexts(data,replacements):
@@ -283,9 +274,9 @@ class Grove:
def _ss(self,z=False): def _ss(self,z=False):
if z: if z:
return self.name return self.name
return self.name if self.name != 'Z' else '' return self.name if self.name is not 'Z' else ''
def _suffix(self): def _suffix(self):
return '_'+self.name if self.name != 'Z' else '' return '_'+self.name if self.name is not 'Z' else ''
def replace(self,line): def replace(self,line):
if line is None: if line is None:
return line return line

View File

@@ -439,6 +439,17 @@ void displayFooter(CommonData &commonData) {
getdisplay().drawCircle(x0 + i * (r * 2 + space), 290, r, commonData.fgcolor); getdisplay().drawCircle(x0 + i * (r * 2 + space), 290, r, commonData.fgcolor);
} }
} }
// key indicators
// left side = top key "menu"
getdisplay().drawLine(0, 280, 10, 280, commonData.fgcolor);
getdisplay().drawLine(55, 280, 65, 280, commonData.fgcolor);
getdisplay().drawLine(65, 280, 65, 299, commonData.fgcolor);
drawTextCenter(33, 291, commonData.keydata[0].label);
// right side = bottom key "exit"
getdisplay().drawLine(390, 280, 399, 280, commonData.fgcolor);
getdisplay().drawLine(335, 280, 345, 280, commonData.fgcolor);
getdisplay().drawLine(335, 280, 335, 399, commonData.fgcolor);
drawTextCenter(366, 291, commonData.keydata[1].label);
#endif #endif
} }

View File

@@ -103,6 +103,7 @@ class Page{
virtual void displayPage(PageData &pageData)=0; virtual void displayPage(PageData &pageData)=0;
virtual void displayNew(PageData &pageData){} virtual void displayNew(PageData &pageData){}
virtual void setupKeys() { virtual void setupKeys() {
#ifdef HARDWARE_V21
commonData->keydata[0].label = ""; commonData->keydata[0].label = "";
commonData->keydata[1].label = ""; commonData->keydata[1].label = "";
commonData->keydata[2].label = "#LEFT"; commonData->keydata[2].label = "#LEFT";
@@ -113,6 +114,12 @@ class Page{
} else { } else {
commonData->keydata[5].label = ""; commonData->keydata[5].label = "";
} }
#endif
#ifdef HARDWARE_LIGHT
commonData->keydata[0].label = "";
commonData->keydata[1].label = "";
#endif
} }
//return -1 if handled by the page //return -1 if handled by the page
virtual int handleKey(int key){return key;} virtual int handleKey(int key){return key;}

View File

@@ -1,52 +0,0 @@
OBP40
=====
Important information:
***************************************************
THIS BRANCH IS NOT INTENDED TO MERGE INTO "master"!
***************************************************
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
--------------------
- no GPS
- no RTC
- no LEDs
- no environment sensor
- no key lock
- no swipe
- only 5 keys
+ SD card interface
GPIO assignments
----------------
NMEA0183
IO9 - RS485 TX
IO14 - RS485 RX
NMEA2000/CAN
IO15 - CAN TX
IO16 - CAN RX
Keyboard
--------
Keycode Key Function
-------- ---------------- -------------------------
1 Menu key Key 1 of OBP60 (left)
2 Exit key Key 2 of OBP60
3 Jog-Dial press
9 Jog-Dial down Next page
10 Jog-Dial up Previous page

View File

@@ -297,7 +297,7 @@
"name": "useRTC", "name": "useRTC",
"label": "RTC Modul", "label": "RTC Modul",
"type": "list", "type": "list",
"default": "off", "default": "DS1388",
"description": "Use internal RTC module type [off|DS1388]", "description": "Use internal RTC module type [off|DS1388]",
"list": [ "list": [
"off", "off",
@@ -312,7 +312,7 @@
"name": "useGPS", "name": "useGPS",
"label": "GPS Sensor", "label": "GPS Sensor",
"type": "list", "type": "list",
"default": "off", "default": "ATGM336H",
"description": "Use internal GPS module type [off|NEO-6M|NEO-M8N|ATGM336H]", "description": "Use internal GPS module type [off|NEO-6M|NEO-M8N|ATGM336H]",
"list": [ "list": [
"off", "off",
@@ -343,7 +343,7 @@
"name": "useEnvSensor", "name": "useEnvSensor",
"label": "Env. Sensor", "label": "Env. Sensor",
"type": "list", "type": "list",
"default": "off", "default": "BMP280",
"description": "Use internal or external environment sensor via I2C bus [off|BME280|BMP280|BMP180|BMP085|HTU21|SHT21]", "description": "Use internal or external environment sensor via I2C bus [off|BME280|BMP280|BMP180|BMP085|HTU21|SHT21]",
"list": [ "list": [
"off", "off",
@@ -573,21 +573,6 @@
"obp60":"true" "obp60":"true"
} }
}, },
{
"name": "useSDCard",
"label": "SD Card",
"type": "boolean",
"default": "off",
"description": "Use internal SD card interface [off|on]",
"list": [
"off",
"on"
],
"category": "OBP60 Hardware",
"capabilities": {
"obp60":"true"
}
},
{ {
"name": "powerMode", "name": "powerMode",
"label": "Power Mode", "label": "Power Mode",
@@ -933,7 +918,7 @@
"name": "page1type", "name": "page1type",
"label": "Type", "label": "Type",
"type": "list", "type": "list",
"default": "Clock", "default": "Voltage",
"description": "Type of page for page 1", "description": "Type of page for page 1",
"list": [ "list": [
"BME280", "BME280",
@@ -1193,7 +1178,7 @@
"name": "page2type", "name": "page2type",
"label": "Type", "label": "Type",
"type": "list", "type": "list",
"default": "Wind", "default": "WindRose",
"description": "Type of page for page 2", "description": "Type of page for page 2",
"list": [ "list": [
"BME280", "BME280",
@@ -2691,7 +2676,7 @@
"name": "page8type", "name": "page8type",
"label": "Type", "label": "Type",
"type": "list", "type": "list",
"default": "Fluid", "default": "Clock",
"description": "Type of page for page 8", "description": "Type of page for page 8",
"list": [ "list": [
"BME280", "BME280",

File diff suppressed because it is too large Load Diff

View File

@@ -13,9 +13,11 @@
#include "OBP60Extensions.h" // Functions lib for extension board #include "OBP60Extensions.h" // Functions lib for extension board
#include "OBP60Keypad.h" // Functions for keypad #include "OBP60Keypad.h" // Functions for keypad
#ifdef HARDWARE_LIGHT
#include <FS.h> // SD-Card access #include <FS.h> // SD-Card access
#include <SD.h> #include <SD.h>
#include <SPI.h> #include <SPI.h>
#endif
// True type character sets includes // True type character sets includes
// See OBP60ExtensionPort.cpp // See OBP60ExtensionPort.cpp
@@ -27,6 +29,8 @@
#include "OBP60QRWiFi.h" // Functions lib for WiFi QR code #include "OBP60QRWiFi.h" // Functions lib for WiFi QR code
#include "OBPSensorTask.h" // Functions lib for sensor data #include "OBPSensorTask.h" // Functions lib for sensor data
#include "LedSpiTask.h"
// Global vars // Global vars
bool initComplete = false; // Initialization complete bool initComplete = false; // Initialization complete
int taskRunCounter = 0; // Task couter for loop section int taskRunCounter = 0; // Task couter for loop section
@@ -50,6 +54,7 @@ void OBP60Init(GwApi *api){
// Init hardware // Init hardware
hardwareInit(api); hardwareInit(api);
#ifdef HARDWARE_LIGHT
String sdcard = config->getConfigItem(config->useSDCard, true)->asString(); String sdcard = config->getConfigItem(config->useSDCard, true)->asString();
if (sdcard == "on") { if (sdcard == "on") {
setPortPin(OBP_POWER_SD, true); // Power on SD setPortPin(OBP_POWER_SD, true); // Power on SD
@@ -74,6 +79,7 @@ void OBP60Init(GwApi *api){
LOG_DEBUG(GwLog::LOG,"SD card type %s of size %d MB detected", sdtype, cardSize); LOG_DEBUG(GwLog::LOG,"SD card type %s of size %d MB detected", sdtype, cardSize);
} }
} }
#endif
// Init power rail 5.0V // Init power rail 5.0V
String powermode = api->getConfig()->getConfigItem(api->getConfig()->powerMode,true)->asString(); String powermode = api->getConfig()->getConfigItem(api->getConfig()->powerMode,true)->asString();

View File

@@ -9,16 +9,15 @@ board_build.variants_dir = variants
#board = obp60_s3_n8 #ESP32-S3 N8, 8MB flash, no PSRAM #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_n16 #ESP32-S3 N16,16MB flash, no PSRAM, zero series
#board = obp60_s3_n8r8 #ESP32-S3 N8R8, 8MB flash, 8MB PSRAM #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_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 = 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_8MB.csv #ESP32-S3 N8, 8MB flash
#board_build.partitions = default_16MB.csv #ESP32-S3 N16, 16MB flash board_build.partitions = default_16MB.csv #ESP32-S3 N16, 16MB flash
framework = arduino framework = arduino
lib_deps = lib_deps =
${basedeps.lib_deps} ${basedeps.lib_deps}
Wire Wire
SPI SPI
SD
esphome/AsyncTCP-esphome@2.0.1 esphome/AsyncTCP-esphome@2.0.1
robtillaart/PCF8574@0.3.9 robtillaart/PCF8574@0.3.9
adafruit/Adafruit Unified Sensor @ 1.1.13 adafruit/Adafruit Unified Sensor @ 1.1.13
@@ -41,22 +40,22 @@ lib_deps =
build_flags= build_flags=
#https://thingpulse.com/usb-settings-for-logging-with-the-esp32-s3-in-platformio/?srsltid=AfmBOopGskbkr4GoeVkNlFaZXe_zXkLceKF6Rn-tmoXABCeAR2vWsdHL #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_MODE=1 #0=OTG (to implement other external devices), 1=CDC (is a serial device)
# -D ARDUINO_USB_CDC_ON_BOOT=0 #0=JTAG, 1=CDC (serial device) # -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 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 TIME=$UNIX_TIME #Set PC time for RTC (only settable via VSC)
-D DISABLE_DIAGNOSTIC_OUTPUT #Disable diagnostic output for GxEPD2 lib -D DISABLE_DIAGNOSTIC_OUTPUT #Disable diagnostic output for GxEPD2 lib
-D BOARD_OBP60S3 #Board OBP60 V2.1 with ESP32S3 -D BOARD_OBP60S3 #Board OBP60 V2.1 with ESP32S3
# -D HARDWARE_V20 #OBP60 hardware revision V2.0 # -D HARDWARE_V20 #OBP60 hardware revision V2.0
# -D HARDWARE_V21 #OBP60 hardware revision V2.1 -D HARDWARE_V21 #OBP60 hardware revision V2.1
-D HARDWARE_LIGHT #OBP60 hardware clone # -D HARDWARE_LIGHT #OBP60 hardware clone
# -D DISPLAY_GDEW042T2 #old E-Ink display from Waveshare, R10 0.47 ohm # -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_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_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 # -D DISPLAY_SE0420NQ04 #alternativ E-Ink display from SID Technology, R10 2.2 ohm
${env.build_flags} ${env.build_flags}
#CONFIG_ESP_TASK_WDT_TIMEOUT_S = 10 #Task Watchdog timeout period (seconds) [1...60] 5 default #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/ttyACM0 #OBP60 original
upload_port = /dev/ttyUSB0 #OBP60 clone #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_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 upload_speed = 230400
monitor_speed = 115200 monitor_speed = 115200
@@ -93,7 +92,6 @@ lib_deps =
signetica/SunRise@2.0.2 signetica/SunRise@2.0.2
adafruit/Adafruit FRAM I2C@^2.0.3 adafruit/Adafruit FRAM I2C@^2.0.3
build_flags= 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 DISABLE_DIAGNOSTIC_OUTPUT #Disable diagnostic output for GxEPD2 lib
-D BOARD_OBP60S3 #Board OBP60 V2.1 with ESP32S3 -D BOARD_OBP60S3 #Board OBP60 V2.1 with ESP32S3
-D HARDWARE_LIGHT #OBP60 hardware clone (OBP40) -D HARDWARE_LIGHT #OBP60 hardware clone (OBP40)