mirror of
https://github.com/ArduPilot/ardupilot
synced 2025-01-10 18:08:30 -04:00
AP_GPS: added optional NMEA debug log
compile time option for debugging
This commit is contained in:
parent
a2e9d0488c
commit
25fe2b3fb0
@ -40,6 +40,13 @@
|
||||
|
||||
extern const AP_HAL::HAL& hal;
|
||||
|
||||
// optionally log all NMEA data for debug purposes
|
||||
// #define NMEA_LOG_PATH "nmea.log"
|
||||
|
||||
#ifdef NMEA_LOG_PATH
|
||||
#include <stdio.h>
|
||||
#endif
|
||||
|
||||
// SiRF init messages //////////////////////////////////////////////////////////
|
||||
//
|
||||
// Note that we will only see a SiRF in NMEA mode if we are explicitly configured
|
||||
@ -117,7 +124,17 @@ bool AP_GPS_NMEA::read(void)
|
||||
|
||||
numc = port->available();
|
||||
while (numc--) {
|
||||
if (_decode(port->read())) {
|
||||
char c = port->read();
|
||||
#ifdef NMEA_LOG_PATH
|
||||
static FILE *logf = NULL;
|
||||
if (logf == NULL) {
|
||||
logf = fopen(NMEA_LOG_PATH, "wb");
|
||||
}
|
||||
if (c >= 0 && logf != NULL) {
|
||||
::fwrite(&c, 1, 1, logf);
|
||||
}
|
||||
#endif
|
||||
if (_decode(c)) {
|
||||
parsed = true;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user