From a8cf34343f05b09890a2b535fcf45e1f01916018 Mon Sep 17 00:00:00 2001 From: Thomas Hooge Date: Tue, 9 Sep 2025 15:32:56 +0200 Subject: [PATCH] Config data for tracker page --- lib/obp60task/PageAIS.cpp | 3 ++ lib/obp60task/PageAnchor.cpp | 4 ++ lib/obp60task/PageEPropulsion.cpp | 8 ++++ lib/obp60task/obp60.conf | 67 +++++++++++++++++++++++++++++ lib/obp60task/utils/auto_version.py | 17 ++++++++ lib/obp60task/utils/xbmconvert.py | 61 ++++++++++++++++++++++++++ 6 files changed, 160 insertions(+) create mode 100644 lib/obp60task/utils/auto_version.py create mode 100755 lib/obp60task/utils/xbmconvert.py diff --git a/lib/obp60task/PageAIS.cpp b/lib/obp60task/PageAIS.cpp index 2ca5420..9d7f963 100644 --- a/lib/obp60task/PageAIS.cpp +++ b/lib/obp60task/PageAIS.cpp @@ -13,6 +13,9 @@ Feature possibilities - switch between North up / Heading up + - filter + - zoom + - special vessel symbols */ diff --git a/lib/obp60task/PageAnchor.cpp b/lib/obp60task/PageAnchor.cpp index ee679de..bd16b70 100644 --- a/lib/obp60task/PageAnchor.cpp +++ b/lib/obp60task/PageAnchor.cpp @@ -39,6 +39,10 @@ Drop / raise function in device OBP40 has to be done inside config mode because of limited number of buttons. + Save position in FRAM + Alarm: gps fix lost + switch unit feet/meter + */ #define anchor_width 16 diff --git a/lib/obp60task/PageEPropulsion.cpp b/lib/obp60task/PageEPropulsion.cpp index 4f537dd..881d8a4 100644 --- a/lib/obp60task/PageEPropulsion.cpp +++ b/lib/obp60task/PageEPropulsion.cpp @@ -7,6 +7,14 @@ /* Electric propulsion + - Current, voltage, power + - 12, 24, 48 etc. Voltage + - rpm + - throttle position + - controller state + - error codes + - temperature engine, controller, batteries + */ class PageEPropulsion : public Page diff --git a/lib/obp60task/obp60.conf b/lib/obp60task/obp60.conf index 5d2cbf0..0d0444a 100644 --- a/lib/obp60task/obp60.conf +++ b/lib/obp60task/obp60.conf @@ -788,3 +788,70 @@ dict = BMP:Windows bitmap (BMP) category = OBP60 Pages capabilities = obp60:true + +# WIP + +[trackerType] +label = Tracker Type +type = list +default = off +description = Type of tracker to use [OFF|SDCARD|SERVER|HERO] +dict = OFF:No tracker + SDCARD:Log to SD-Card + SERVER:Log to Server + HERO:Connect with Regatta Hero +category = OBP60 Pages +capabilities = obp60:true + +[trackerOrganization] +label = Tracker team +type = string +default = demo +description = Tracker organization for login +category = OBP60 Pages + +[trackerPasscode] +label = Tracker team +type = password +default = 291758 +description = Your tracker team you belong to. E.g. short name of association +category = OBP60 Pages + +[trackerTeam] +label = Tracker team +type = string +default = none +description = Your tracker team you belong to. E.g. short name of association +category = OBP60 Pages + +[trackerHandicap] +label = Boat handicap +type = number +default = 100 +check = checkMinMax +min = 50 +max = 1000 +description = The handicap value of your boat. E.g. yardstick value +category = OBP60 Pages + +[boatName] +label = Boat Name +type = string +default = Unsinkbar II +description = name of your boat +category = OBP60 Pages + +[boatClass] +label = Boat Class +type = string +default = One off +description = Class name of your boat if available or "One off" +category = OBP60 Pages + +[sailNumber] +label = Sail number +type = string +default = GER 11 +description = Identification number on sail +category = OBP60 Pages + diff --git a/lib/obp60task/utils/auto_version.py b/lib/obp60task/utils/auto_version.py new file mode 100644 index 0000000..5c73ec5 --- /dev/null +++ b/lib/obp60task/utils/auto_version.py @@ -0,0 +1,17 @@ +import subprocess + +# Import("env") + +def get_firmware_specifier_build_flag(): + #ret = subprocess.run(["git", "describe"], stdout=subprocess.PIPE, text=True) #Uses only annotated tags + ret = subprocess.run(["git", "describe", "--tags"], stdout=subprocess.PIPE, text=True) #Uses any tags + build_version = ret.stdout.strip() + build_flag = "-D AUTO_VERSION=\\\"" + build_version + "\\\"" + print ("Firmware Revision: " + build_version) + return (build_flag) + +#env.Append( +# BUILD_FLAGS=[get_firmware_specifier_build_flag()] +#) + +get_firmware_specifier_build_flag() diff --git a/lib/obp60task/utils/xbmconvert.py b/lib/obp60task/utils/xbmconvert.py new file mode 100755 index 0000000..d3e4b5d --- /dev/null +++ b/lib/obp60task/utils/xbmconvert.py @@ -0,0 +1,61 @@ +#!/usr/bin/python +# +# Convert a Gimp-created XBM file to bitmap useable by drawBitmap() +# + +import os +import sys +import re +from PIL import Image + +if len(sys.argv) < 2: + print("Usage: xbmconvert.py ") + sys.exit(1) + +xbmfilename = sys.argv[1] +if not os.path.isfile(xbmfilename): + print(f"The file '{xbmfilename}' does not exists.") + sys.exit(1) + +im = Image.open(xbmfilename) +imname = "image" +with open(xbmfilename, 'r') as fh: + pattern = r'static\s+unsigned\s+char\s+(\w+)_bits$$$$' + for line in fh: + match = re.search(pattern, line) + if match: + imname = match.group(1) + break +bytecount = int(im.width * im.height / 8) + +print(f"#ifndef _{imname.upper()}_H_") +print(f"#define _{imname.upper()}_H_ 1\n") +print(f"#define {imname}_width {im.width}") +print(f"#define {imname}_height {im.height}") +print(f"const unsigned char {imname}_bits[{bytecount}] PROGMEM = {{") + +n = 0 +print(" ", end='') +f = im.tobytes() + +switched_bytes = bytearray() +for i in range(0, len(f), 2): + # Switch LSB and MSB + switched_bytes.append(f[i + 1]) # Append MSB + switched_bytes.append(f[i]) # Append LSB + +#for b in im.tobytes(): +for b in switched_bytes: + #b2 = 0 + #for i in range(8): + # # b2 |= ((b >> i) & 1) << (7 - i) + # b2 <<= 1 + # b2 |= b & 1 + # b >>= 1 + n += 1 + print(f"0x{b:02x}", end='') + if n < bytecount: + print(', ', end='') + if n % 12 == 0: + print("\n ", end='') +print("};\n\n#endif")