summaryrefslogtreecommitdiff
path: root/lora_pkt_fwd/src/lora_pkt_fwd.c
diff options
context:
space:
mode:
Diffstat (limited to 'lora_pkt_fwd/src/lora_pkt_fwd.c')
-rw-r--r--lora_pkt_fwd/src/lora_pkt_fwd.c20
1 files changed, 13 insertions, 7 deletions
diff --git a/lora_pkt_fwd/src/lora_pkt_fwd.c b/lora_pkt_fwd/src/lora_pkt_fwd.c
index 5b2da71..cb467bc 100644
--- a/lora_pkt_fwd/src/lora_pkt_fwd.c
+++ b/lora_pkt_fwd/src/lora_pkt_fwd.c
@@ -1579,11 +1579,12 @@ int main(int argc, char** argv)
MSG("ERROR: [main] impossible to create GPS thread\n");
exit(EXIT_FAILURE);
}
- i = pthread_create( &thrid_valid, NULL, (void * (*)(void *))thread_valid, NULL);
- if (i != 0) {
- MSG("ERROR: [main] impossible to create validation thread\n");
- exit(EXIT_FAILURE);
- }
+ }
+
+ i = pthread_create( &thrid_valid, NULL, (void * (*)(void *))thread_valid, NULL);
+ if (i != 0) {
+ MSG("ERROR: [main] impossible to create validation thread\n");
+ exit(EXIT_FAILURE);
}
i = pthread_create( &thrid_spectralscan, NULL, (void * (*)(void *))thread_spectralscan, NULL);
@@ -1798,9 +1799,10 @@ int main(int argc, char** argv)
pthread_cancel(thrid_down); /* don't wait for downstream thread */
pthread_cancel(thrid_jit); /* don't wait for jit thread */
pthread_cancel(thrid_timersync); /* don't wait for timer sync thread */
+ pthread_cancel(thrid_valid); /* don't wait for validation thread */
+
if (gps_enabled == true) {
pthread_cancel(thrid_gps); /* don't wait for GPS thread */
- pthread_cancel(thrid_valid); /* don't wait for validation thread */
i = lgw_gps_disable(&gpsdata);
if (i == LGW_HAL_SUCCESS) {
@@ -1810,7 +1812,7 @@ int main(int argc, char** argv)
}
}
- pthread_join(thrid_spectralscan, NULL); /* don't wait for spec scan thread */
+ pthread_join(thrid_spectralscan, NULL); /* wait for spec scan thread */
/* if an exit signal was received, try to quit properly */
if (exit_sig) {
@@ -3372,6 +3374,10 @@ void thread_valid(void) {
last = now;
}
+
+ if (gps_enabled != true) {
+ continue;
+ }
/* calculate when the time reference was last updated */
pthread_mutex_lock(&mx_timeref);