throttle GPS sync messages
This commit is contained in:
parent
120c864f73
commit
c4673e2249
|
|
@ -9,7 +9,7 @@
|
|||
#include <stdarg.h>
|
||||
#include <stdio.h>
|
||||
#include <assert.h>
|
||||
#include <inttypes.h> // Required for PRIu64
|
||||
#include <inttypes.h>
|
||||
|
||||
// --- SAFE WIRING FOR ESP32-C5 ---
|
||||
#define GPS_UART_NUM UART_NUM_1
|
||||
|
|
@ -100,6 +100,7 @@ void gps_force_next_update(void) {
|
|||
static void gps_task(void* arg) {
|
||||
char line[128];
|
||||
int pos = 0;
|
||||
static int log_counter = 0; // NEW: Counter to throttle logs
|
||||
|
||||
while (1) {
|
||||
uint8_t data;
|
||||
|
|
@ -132,6 +133,7 @@ static void gps_task(void* arg) {
|
|||
if (force_sync_update) {
|
||||
ESP_LOGW(TAG, "GPS sync SNAP: Offset forced to %lld us", monotonic_offset_us);
|
||||
force_sync_update = false;
|
||||
log_counter = 0; // Ensure we see the log immediately after a snap
|
||||
}
|
||||
} else {
|
||||
// Low-pass filter: 90% old + 10% new
|
||||
|
|
@ -140,10 +142,15 @@ static void gps_task(void* arg) {
|
|||
|
||||
gps_has_fix = true;
|
||||
|
||||
// LOGGING THROTTLE: Only print every 60th update (approx 60 seconds)
|
||||
if (log_counter == 0) {
|
||||
ESP_LOGI(TAG, "GPS sync: %04d-%02d-%02d %02d:%02d:%02d, offset=%lld us",
|
||||
gps_tm.tm_year + 1900, gps_tm.tm_mon + 1, gps_tm.tm_mday,
|
||||
gps_tm.tm_hour, gps_tm.tm_min, gps_tm.tm_sec,
|
||||
monotonic_offset_us);
|
||||
log_counter = 60;
|
||||
}
|
||||
log_counter--;
|
||||
}
|
||||
xSemaphoreGive(sync_mutex);
|
||||
} else {
|
||||
|
|
|
|||
Loading…
Reference in New Issue