Skip to content

Commit

Permalink
fixed command "dump gps"
Browse files Browse the repository at this point in the history
The format specifiers were miscounted and misaligned.
  • Loading branch information
barry-ha committed Mar 31, 2023
1 parent 99b53cf commit 6be5bc0
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions model_gps.h
Original file line number Diff line number Diff line change
Expand Up @@ -619,7 +619,7 @@ class Model {
snprintf(msg, sizeof(msg), "now() = %s GMT", sDate); // debug
Serial.println(msg); // debug

Serial.println("Record, Date GMT, Grid, Lat, Long, Alt(m), Speed(mph), Dir, Sats");
Serial.println("Record, Date GMT, Grid, Lat, Long, Alt(m), Speed(mph), Direction(Degrees), Sats");
int ii;
for (ii = 0; ii < numHistory; ii++) {
Location item = history[ii];
Expand All @@ -636,14 +636,15 @@ class Model {
floatToCharArray(sLat, sizeof(sLat), history[ii].loc.lat, 5);
floatToCharArray(sLng, sizeof(sLng), history[ii].loc.lng, 5);

char sSpeed[12], sDir[12];
floatToCharArray(sSpeed, sizeof(sSpeed), history[ii].speed, 1);
floatToCharArray(sDir, sizeof(sDir), history[ii].direction, 1);
uint8_t nSats = history[ii].numSatellites;
char sSpeed[12], sDirection[12], sAltitude[12];
floatToCharArray(sSpeed, sizeof(sSpeed), item.speed, 1);
floatToCharArray(sDirection, sizeof(sDirection), item.direction, 1);
floatToCharArray(sAltitude, sizeof(sAltitude), item.altitude, 0);
uint8_t nSats = item.numSatellites;

char out[128];
snprintf(out, sizeof(out), "%d, %s, %s, %s, %s, %s, %s, %d",
ii, sDate, grid6, sLat, sLng, sSpeed, sDir, nSats);
snprintf(out, sizeof(out), "%d, %s, %s, %s, %s, %s, %s, %s, %d",
ii, sDate, grid6, sLat, sLng, sSpeed, sDirection, sAltitude, nSats);
Serial.println(out);

// TimeElements time; // https://github.com/PaulStoffregen/Time
Expand Down

0 comments on commit 6be5bc0

Please sign in to comment.