mirror of
https://github.com/ALLFATHER-BV/wadamesh.git
synced 2026-10-15 14:50:04 +00:00
touch: P4 — make the GPS boot diagnostic tell the truth
The line here claimed "[GPS] L76K DETECTED (NMEA on GPIO22)" but never looked at the UART. It reported whether the "gps" SETTING had been registered, and on this board ENV_SKIP_GPS_DETECT forces that true unconditionally (we set it because the P4's heavy boot misses the core's 1 s detect window, and a false negative hides the GPS toggle entirely). So it printed DETECTED on every boot whether or not a single byte had ever arrived, and it survived several rounds of "GPS still isn't working" while proving nothing. Replaced with a real 3 s drain of Serial1 that reports byte count, complete NMEA sentence count, the configured baud and RX pin, and the first sentence seen. That splits the two cases that were being conflated: bytes arriving means pins, rails, wake and baud are all correct and any stuck "acquiring" is a FIX problem (antenna or sky view); zero bytes means the link itself is dead. First run on hardware answered the open question immediately: [GPS] UART probe: 1985 bytes, 48 lines in 3s @ 9600 baud, module TX -> GPIO22 [GPS] first sentence: $GLGSV,1,1,00,0*79 1985 bytes of well-formed NMEA proves the link is good, and GLGSV ",00," is zero satellites in view, i.e. an antenna/sky-view issue and not firmware. For the record, the config was already identical to Meck-P4's working port (components/meshcore/variant.h: PIN_GPS_TX 22 / PIN_GPS_RX 23, wake on XL9535 IO11), and their L76K driver confirms both our other values: begin() defaults to 9600 baud, and sleep(false) drives the wake pin HIGH. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.8
parent
1863ebdd2c
commit
64308664db
@@ -237,11 +237,46 @@ static void wadameshSetup() {
|
||||
// here — the P4 has RAM to spare, and GPS detection itself needs an intact first second.
|
||||
Serial1.setRxBufferSize(4096);
|
||||
sensors.begin();
|
||||
{ // GPS detect visibility (the "gps" setting is only registered when NMEA was heard)
|
||||
bool has_gps = false;
|
||||
{ // ---- GPS reality check -------------------------------------------------------------
|
||||
// The line that used to be here reported whether the "gps" SETTING got registered, which on
|
||||
// this board is FORCED true by ENV_SKIP_GPS_DETECT (we set that because the P4's heavy boot
|
||||
// misses the core's 1 s detect window, and a false negative hides the GPS toggle entirely).
|
||||
// So it printed DETECTED unconditionally and proved nothing, including across several rounds
|
||||
// of "GPS still isn't working". Read the UART directly instead and report what arrives.
|
||||
bool has_setting = false;
|
||||
for (int i = 0; i < sensors.getNumSettings(); i++)
|
||||
if (strcmp(sensors.getSettingName(i), "gps") == 0) has_gps = true;
|
||||
printf("[GPS] L76K %s\n", has_gps ? "DETECTED (NMEA on GPIO22)" : "NOT detected (no NMEA in the 1s window)");
|
||||
if (strcmp(sensors.getSettingName(i), "gps") == 0) has_setting = true;
|
||||
|
||||
// Drain up to 3 s of NMEA. Bytes at all => pins, rails, wake and baud are ALL correct and a
|
||||
// stuck "acquiring" is a FIX problem (antenna / sky view). Zero bytes => the link is dead.
|
||||
uint32_t bytes = 0, lines = 0;
|
||||
char first[96]; first[0] = '\0';
|
||||
char cur[96]; size_t cl = 0;
|
||||
const uint32_t until = millis() + 3000;
|
||||
while ((int32_t)(millis() - until) < 0) {
|
||||
while (Serial1.available() > 0) {
|
||||
const int c = Serial1.read();
|
||||
if (c < 0) break;
|
||||
++bytes;
|
||||
if (c == '\n' || c == '\r') {
|
||||
if (cl) {
|
||||
cur[cl] = '\0';
|
||||
++lines;
|
||||
if (!first[0] && cur[0] == '$') { strncpy(first, cur, sizeof first - 1); first[sizeof first - 1] = '\0'; }
|
||||
cl = 0;
|
||||
}
|
||||
} else if (cl < sizeof(cur) - 1) {
|
||||
cur[cl++] = (char)c;
|
||||
}
|
||||
}
|
||||
delay(5);
|
||||
}
|
||||
printf("[GPS] setting_registered=%d (forced by ENV_SKIP_GPS_DETECT, proves nothing)\n", (int)has_setting);
|
||||
printf("[GPS] UART probe: %lu bytes, %lu lines in 3s @ %d baud, module TX -> GPIO%d\n",
|
||||
(unsigned long)bytes, (unsigned long)lines, (int)GPS_BAUD_RATE, (int)PIN_GPS_TX);
|
||||
if (first[0]) printf("[GPS] first sentence: %s\n", first);
|
||||
else if (bytes) printf("[GPS] bytes but no complete '$' sentence -> wrong baud or line noise\n");
|
||||
else printf("[GPS] NOTHING on the UART -> check wake (XL9535 IO11 HIGH), rails, RX pin\n");
|
||||
}
|
||||
ui_task.begin(disp, &sensors, the_mesh.getNodePrefs());
|
||||
board.onBootComplete();
|
||||
|
||||
Reference in New Issue
Block a user