diff --git a/src/cpm.c b/src/cpm.c index 72b7c95..f2a2dd8 100644 --- a/src/cpm.c +++ b/src/cpm.c @@ -708,7 +708,7 @@ void *cp_service(){ /* Reads from the radar */ i32_recv_bytes = recv(raw_socket.raw_fd, &au8_readBuffer, READ_BUFFER_SIZE, 0); - if (dissemination_check(1) && facilities.dissemination.active){ + if (dissemination_check(1)) { if(is_radar_connected){ /* Information parsing from radar */ parse_input(au8_readBuffer,i32_recv_bytes); diff --git a/src/facilities.c b/src/facilities.c index 327867c..0025e61 100644 --- a/src/facilities.c +++ b/src/facilities.c @@ -839,7 +839,8 @@ int main() { pthread_create(&facilities.infrastructure_service, NULL, infrastructure_service, NULL); // CP - pthread_create(&facilities.cp_service, NULL, cp_service, NULL); + if (facilities.dissemination.active) + pthread_create(&facilities.cp_service, NULL, cp_service, NULL); // SA pthread_create(&facilities.sa_service, NULL, sa_service, NULL); @@ -942,7 +943,8 @@ cleanup: pthread_join(facilities.ca_service, NULL); pthread_join(facilities.den_service, NULL); pthread_join(facilities.infrastructure_service, NULL); - pthread_join(facilities.cp_service, NULL); + if (facilities.dissemination.active) + pthread_join(facilities.cp_service, NULL); pthread_join(facilities.sa_service, NULL); itss_queue_trigger(facilities.tx_queue); pthread_join(facilities.transmitting, NULL); diff --git a/src/tpm.c b/src/tpm.c index 7d65dc2..a782ede 100644 --- a/src/tpm.c +++ b/src/tpm.c @@ -24,10 +24,12 @@ int tpm_is_inside_zone(tolling_info_t* ti) { int rv = 0; double point[2]; + int16_t heading; itss_space_lock(); itss_space_get(); point[0] = epv.space.latitude/1.0e7; point[1] = epv.space.longitude/1.0e7; + heading = epv.space.heading; itss_space_unlock(); if (itss_is_inside_polygon(point, ti->zone.polygon, ti->zone.polygon_len)) {