From f6c2760fa5c4c27014454014d38dffe361a24bac Mon Sep 17 00:00:00 2001 From: Harsh Sharma Date: Thu, 5 May 2022 17:49:11 -0500 Subject: Bug fixes: gps disable should be void, all gps stream invalid results should reset the loop --- libloragw/inc/loragw_gps.h | 3 +-- libloragw/src/loragw_gps.c | 2 +- libloragw/tst/test_loragw_gps.c | 10 +++------- 3 files changed, 5 insertions(+), 10 deletions(-) diff --git a/libloragw/inc/loragw_gps.h b/libloragw/inc/loragw_gps.h index 9e3aa27..606bd15 100644 --- a/libloragw/inc/loragw_gps.h +++ b/libloragw/inc/loragw_gps.h @@ -115,9 +115,8 @@ int lgw_gps_enable(); /** @brief Disable GPSD -@return success if the function was able to disable the gpsd connection */ -int lgw_gps_disable(); +void lgw_gps_disable(); /** @brief Prepare for a blocking read diff --git a/libloragw/src/loragw_gps.c b/libloragw/src/loragw_gps.c index e13b85b..736626d 100644 --- a/libloragw/src/loragw_gps.c +++ b/libloragw/src/loragw_gps.c @@ -280,7 +280,7 @@ int lgw_gps_enable() { /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */ -int lgw_gps_disable() { +void lgw_gps_disable() { (void)gps_close(&gpsdata); } diff --git a/libloragw/tst/test_loragw_gps.c b/libloragw/tst/test_loragw_gps.c index 05ec53c..6efd351 100644 --- a/libloragw/tst/test_loragw_gps.c +++ b/libloragw/tst/test_loragw_gps.c @@ -202,12 +202,8 @@ int main() switch (state) { case GPS_LOST: { - i = lgw_gps_disable(); - if (i == LGW_HAL_SUCCESS) { - printf("INFO: GPS closed successfully\n"); - } else { - printf("WARNING: failed to close GPS successfully\n"); - } + lgw_gps_disable(); + printf("INFO: GPS closed\n"); empty_packet_count = 0; read_fail_count = 0; state = GPS_RECONNECTING; @@ -245,8 +241,8 @@ int main() read_fail_count++; if (read_fail_count > 9) { state = GPS_LOST; - continue; } + continue; } break; } -- cgit v1.2.3