mirror of
https://github.com/meshtastic/firmware.git
synced 2025-02-08 13:41:28 +00:00
Beautify GPS_DEBUG getACK logging code (#4672)
This getACK is used to look for ASCII responses, so print ASCII when GPS_DEBUG is enabled. This markedly assisted with recent AG3335 debugging. It works great with other chips too (tested eg ATGM336H). Even UBLOX prints understandable "GPTXT,01,01,01,PDTI inv format*35." responses. Credit to bluebrolly. on discord.
This commit is contained in:
parent
f37df4d6bf
commit
371c3e05bf
@ -166,18 +166,21 @@ GPS_RESPONSE GPS::getACK(const char *message, uint32_t waitMillis)
|
|||||||
b = _serial_gps->read();
|
b = _serial_gps->read();
|
||||||
|
|
||||||
#ifdef GPS_DEBUG
|
#ifdef GPS_DEBUG
|
||||||
LOG_DEBUG("%02X", (char *)buffer);
|
LOG_DEBUG("%c", (b >= 32 && b <= 126) ? b : '.');
|
||||||
#endif
|
#endif
|
||||||
buffer[bytesRead] = b;
|
buffer[bytesRead] = b;
|
||||||
bytesRead++;
|
bytesRead++;
|
||||||
if ((bytesRead == 767) || (b == '\r')) {
|
if ((bytesRead == 767) || (b == '\r')) {
|
||||||
if (strnstr((char *)buffer, message, bytesRead) != nullptr) {
|
if (strnstr((char *)buffer, message, bytesRead) != nullptr) {
|
||||||
#ifdef GPS_DEBUG
|
#ifdef GPS_DEBUG
|
||||||
LOG_DEBUG("\r");
|
LOG_DEBUG("\r\nFound: %s\r\n", message); // Log the found message
|
||||||
#endif
|
#endif
|
||||||
return GNSS_RESPONSE_OK;
|
return GNSS_RESPONSE_OK;
|
||||||
} else {
|
} else {
|
||||||
bytesRead = 0;
|
bytesRead = 0;
|
||||||
|
#ifdef GPS_DEBUG
|
||||||
|
LOG_DEBUG("\r\n");
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1804,4 +1807,4 @@ void GPS::toggleGpsMode()
|
|||||||
enable();
|
enable();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif // Exclude GPS
|
#endif // Exclude GPS
|
Loading…
Reference in New Issue
Block a user