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;
}