After modifying all pio settings to allow for Ublox GPS alternative, defaults to L76k; TODO code to implement Ublox

This commit is contained in:
John Poole 2026-04-03 14:35:33 -07:00
commit b5ff96d6a9
11 changed files with 700 additions and 14 deletions

View file

@ -29,6 +29,7 @@ build_flags =
-D GPS_1PPS_PIN=6
-D ARDUINO_USB_MODE=1
-D ARDUINO_USB_CDC_ON_BOOT=1
-D GPS_L76K
[env:node_a]
build_flags =

View file

@ -53,7 +53,7 @@ static size_t g_gpsLineLen = 0;
enum class GpsModuleKind : uint8_t {
UNKNOWN = 0,
L76K,
QUECTEL_TODO
UBLOX
};
struct RtcDateTime {
@ -169,8 +169,8 @@ static String gpsModuleToString(GpsModuleKind kind) {
if (kind == GpsModuleKind::L76K) {
return "L76K";
}
if (kind == GpsModuleKind::QUECTEL_TODO) {
return "Quectel/TODO";
if (kind == GpsModuleKind::UBLOX) {
return "UBLOX";
}
return "Unknown";
}
@ -198,7 +198,7 @@ static void detectModuleFromText(const char* text) {
if (t.indexOf("QUECTEL") >= 0 || t.indexOf("2021-10-20") >= 0 || t.indexOf("2021/10/20") >= 0) {
if (g_gps.module != GpsModuleKind::L76K) {
g_gps.module = GpsModuleKind::QUECTEL_TODO;
g_gps.module = GpsModuleKind::UBLOX;
}
}
}
@ -386,8 +386,8 @@ static uint8_t bestSatelliteCount() {
return (g_gps.satsUsed > g_gps.satsInView) ? g_gps.satsUsed : g_gps.satsInView;
}
static bool isUnsupportedQuectelMode() {
return g_gps.module == GpsModuleKind::QUECTEL_TODO;
static bool isUnsupportedGpsMode() {
return g_gps.module == GpsModuleKind::UBLOX;
}
static void reportStatusToSerial() {
@ -402,7 +402,7 @@ static void reportStatusToSerial() {
}
static void maybeAnnounceGpsTransitions() {
if (isUnsupportedQuectelMode()) {
if (isUnsupportedGpsMode()) {
return;
}
@ -432,7 +432,7 @@ static void maybeAnnounceGpsTransitions() {
(unsigned)g_gps.utcMinute,
(unsigned)g_gps.utcSecond);
snprintf(line3, sizeof(line3), "Satellites: %u", (unsigned)sats);
oledShowLines("GPS UTC acquired", line2, line3, "Source: L76K");
oledShowLines("GPS UTC acquired", line2, line3, ("Source: " + gpsModuleToString(g_gps.module)).c_str());
logf("Transition: GPS UTC acquired: %s", line2);
g_timeAcquiredAnnounced = true;
}
@ -442,9 +442,9 @@ static void maybeAnnounceGpsTransitions() {
}
static void drawMinuteStatus() {
if (isUnsupportedQuectelMode()) {
oledShowLines("GPS module mismatch", "Quectel detected", "L76K required", "TODO: implement", "Quectel support");
logf("GPS module mismatch: Quectel detected but this exercise currently supports only L76K (TODO)");
if (isUnsupportedGpsMode()) {
oledShowLines("GPS module mismatch", "UBLOX detected", "L76K required", "TODO: implement", "UBLOX support");
logf("GPS module mismatch: UBLOX detected but this exercise currently supports only L76K (TODO)");
return;
}
@ -462,7 +462,7 @@ static void drawMinuteStatus() {
(unsigned)g_gps.utcMinute,
(unsigned)g_gps.utcSecond);
snprintf(line3, sizeof(line3), "Satellites: %u", (unsigned)sats);
oledShowLines("GPS time (UTC)", line2, line3, "Source: L76K");
oledShowLines("GPS time (UTC)", line2, line3, ("Source: " + gpsModuleToString(g_gps.module)).c_str());
logf("GPS time (UTC): %s satellites=%u", line2, (unsigned)sats);
return;
}

View file

@ -28,6 +28,7 @@ build_flags =
-D GPS_1PPS_PIN=6
-D ARDUINO_USB_MODE=1
-D ARDUINO_USB_CDC_ON_BOOT=1
-D GPS_L76K
[env:node_a]
build_flags =

View file

@ -28,6 +28,7 @@ build_flags =
-D GPS_TX_PIN=8
-D GPS_WAKEUP_PIN=7
-D GPS_1PPS_PIN=6
-D GPS_L76K
-D ARDUINO_USB_MODE=1
-D ARDUINO_USB_CDC_ON_BOOT=1

View file

@ -0,0 +1,11 @@
main.cpp needs to be modified to reflect the number of units. It is a zero-based array, so for 7 possible unite, the value of 6 is used in both lines below:
#if (NODE_SLOT_INDEX < 0) || (NODE_SLOT_INDEX > 6)
#error "NODE_SLOT_INDEX must be 0..6"
#endif
INSERT SCREENSHOT HERE.

View file

@ -27,6 +27,7 @@ build_flags =
-D GPS_TX_PIN=8
-D GPS_WAKEUP_PIN=7
-D GPS_1PPS_PIN=6
-D GPS_L76K
-D LORA_CS=10
-D LORA_MOSI=11
-D LORA_SCK=12
@ -77,3 +78,20 @@ build_flags =
-D NODE_LABEL=\"Ed\"
-D NODE_SHORT=\"E\"
-D NODE_SLOT_INDEX=4
[env:flo]
extends = env
build_flags =
${env.build_flags}
-D NODE_LABEL=\"Flo\"
-D NODE_SHORT=\"F\"
-D NODE_SLOT_INDEX=5
[env:guy]
extends = env
build_flags =
${env.build_flags}
-D NODE_LABEL=\"Guy\"
-D NODE_SHORT=\"G\"
-D NODE_SLOT_INDEX=6

View file

@ -63,8 +63,8 @@
#define FW_BUILD_UTC "unknown"
#endif
#if (NODE_SLOT_INDEX < 0) || (NODE_SLOT_INDEX > 4)
#error "NODE_SLOT_INDEX must be 0..4"
#if (NODE_SLOT_INDEX < 0) || (NODE_SLOT_INDEX > 6)
#error "NODE_SLOT_INDEX must be 0..6"
#endif
static const uint32_t kSerialDelayMs = 1000;