Add GPS RTC time synchronization, remove debug prints

replace/2692c1e66c6ce23302be7657e0e007a8c5bfd919
Niccolò Izzo 2021-02-15 09:26:13 +01:00
rodzic e9f0a46823
commit f850dbdc45
2 zmienionych plików z 5 dodań i 32 usunięć

Wyświetl plik

@ -36,7 +36,7 @@ void gps_taskFunc(char *line, int len, gps_t *state)
state->longitude = minmea_tocoord(&frame.longitude);
state->timestamp.hour = frame.time.hours;
state->timestamp.minute = frame.time.minutes;
state->timestamp.second = frame.time.seconds;
state->timestamp.second = frame.time.seconds - 1;
state->timestamp.day = 0;
state->timestamp.date = frame.date.day;
state->timestamp.month = frame.date.month;

Wyświetl plik

@ -321,39 +321,12 @@ static void gps_task(void *arg)
// GPS readout is blocking, no need to delay here
gps_taskFunc(line, len, &state.gps_data);
// Synchronize RTC with GPS UTC clock
if(state.settings.gps_set_time)
rtc_setTime(state.gps_data.timestamp);
// Unlock state mutex
OSMutexPost(&state_mutex, OS_OPT_POST_NONE, &os_err);
// Debug prints
//printf("Timestamp: %d:%d:%d %d/%d/%d\n\r",
// state.gps_data.timestamp.hour,
// state.gps_data.timestamp.minute,
// state.gps_data.timestamp.second,
// state.gps_data.timestamp.date,
// state.gps_data.timestamp.month,
// state.gps_data.timestamp.year);
//printf("Fix quality: %d - %d\n\r",
// state.gps_data.fix_quality,
// state.gps_data.fix_type);
//printf("Satellites tracked: %d/%d\n\r",
// state.gps_data.satellites_tracked,
// state.gps_data.satellites_in_view);
//for(int i = 0; i < state.gps_data.satellites_in_view; i++)
//{
// printf("%d - elevation: %d azimuth: %d snr: %d\n\r",
// state.gps_data.satellites[i].id,
// state.gps_data.satellites[i].elevation,
// state.gps_data.satellites[i].azimuth,
// state.gps_data.satellites[i].snr);
//}
//printf("Coordinates: %f %f\n\r",
// state.gps_data.latitude,
// state.gps_data.longitude);
//printf("Speed: %f km/h TMGM: %f deg TMGT: %f deg\n\r",
// state.gps_data.speed,
// state.gps_data.tmg_mag,
// state.gps_data.tmg_true);
//printf("\n\r\n\r");
}
}
}