From 02738c13cc0fa406c8d11aaaffef4edeb0697fe0 Mon Sep 17 00:00:00 2001 From: ksjh <30961140+ksjh@users.noreply.github.com> Date: Fri, 2 Jan 2026 11:51:54 +0100 Subject: [PATCH] Replace strtok by strsep to fix date error --- src/gps.c | 50 +++++++++++++++++++++++++------------------------- 1 file changed, 25 insertions(+), 25 deletions(-) diff --git a/src/gps.c b/src/gps.c index 21ca73a..79bf00d 100644 --- a/src/gps.c +++ b/src/gps.c @@ -334,9 +334,9 @@ void gps_parse(char* line) { if (strstr(line, "GGA") == line+3) { - char* pch = strtok(line, ","); + char* pch = strsep(&line, ","); - pch = strtok(NULL, ","); // Time + pch = strsep(&line, ","); // Time // GPSDO screen is updated once every second, when receiving the PPS signal // BUT, the GGA frame is received a fraction of second AFTER the PPS pulse @@ -394,18 +394,18 @@ void gps_parse(char* line) // Terminaute time string gps_time[8] = '\0'; - pch = strtok(NULL, ","); // Latitude + pch = strsep(&line, ","); // Latitude gps_latitude_double = gps_parse_coordinate(pch,gps_latitude,sizeof(gps_latitude)); - pch = strtok(NULL, ","); // N/S + pch = strsep(&line, ","); // N/S if(strlen(pch)=6) { // Ignore empty dates @@ -650,4 +650,4 @@ void gps_read() HAL_UART_Transmit_IT(&huart3, comm_send_buf, send_size); } -} \ No newline at end of file +}