diff --git a/tool_services/gate/data_manager.c b/tool_services/gate/data_manager.c index 8d311859b..d291ec918 100644 --- a/tool_services/gate/data_manager.c +++ b/tool_services/gate/data_manager.c @@ -18,13 +18,7 @@ void DataManager_collect(service_t *service) { msg_t update_msg; search_result_t result; -#ifdef GATE_POLLING - update_msg.header.cmd = GET_CMD; - update_msg.header.target_mode = SERVICEID; - update_msg.header.size = 0; -#else update_msg.header.target_mode = SERVICEIDACK; -#endif RTFilter_Reset(&result); // ask services to publish datas for (uint8_t i = 0; i < result.result_nbr; i++) @@ -32,28 +26,12 @@ void DataManager_collect(service_t *service) // Check if this service is a sensor if ((DataManager_ServiceIsSensor(result.result_table[i]->type)) || (result.result_table[i]->type >= LUOS_LAST_TYPE)) { -#ifdef GATE_POLLING - // This service is a sensor so create a msg and send it - update_msg.header.target = result.result_table[i]->id; - Luos_SendMsg(service, &update_msg); - #ifdef GATE_TIMEOUT - // Get the current number of message available - int back_nbr_msg = Luos_NbrAvailableMsg(); - // Get the current time - uint32_t send_time = Luos_GetSystick(); - // Wait for a reply before continuing - while ((back_nbr_msg == Luos_NbrAvailableMsg()) & (send_time == Luos_GetSystick())) - { - Luos_Loop(); - } - #endif -#else // This service is a sensor so create a msg to enable auto update + update_msg.header.target = result.result_table[i]->id; TimeOD_TimeToMsg(&update_time, &update_msg); update_msg.header.cmd = UPDATE_PUB; Luos_SendMsg(service, &update_msg); -#endif } } } @@ -61,9 +39,6 @@ void DataManager_collect(service_t *service) // This function manage entirely data conversion void DataManager_Run(service_t *service) { -#ifdef GATE_POLLING - DataManager_collect(service); -#endif DataManager_Format(service); } // This function manage only commands incoming from pipe @@ -103,10 +78,8 @@ void DataManager_RunPipeOnly(service_t *service) // Generate routing table datas Convert_RoutingTableData(service); // Run the gate - gate_running = RUNNING; -#ifndef GATE_POLLING + gate_running = RUNNING; first_conversion = true; -#endif } } } diff --git a/tool_services/gate/data_manager.h b/tool_services/gate/data_manager.h index f0c62a3c7..e901a1412 100644 --- a/tool_services/gate/data_manager.h +++ b/tool_services/gate/data_manager.h @@ -24,9 +24,7 @@ typedef enum ******************************************************************************/ extern time_luos_t update_time; extern volatile gate_state_t gate_running; -#ifndef GATE_POLLING extern volatile bool first_conversion; -#endif /******************************************************************************* * Function diff --git a/tool_services/gate/gate.c b/tool_services/gate/gate.c index fbe0837d1..4d48d8407 100644 --- a/tool_services/gate/gate.c +++ b/tool_services/gate/gate.c @@ -21,9 +21,7 @@ ******************************************************************************/ service_t *gate; volatile gate_state_t gate_running = NOT_RUNNING; -#ifndef GATE_POLLING -volatile bool first_conversion = false; -#endif +volatile bool first_conversion = false; time_luos_t update_time = {GATE_REFRESH_TIME_S}; /******************************************************************************* @@ -56,9 +54,7 @@ void Gate_Loop(void) // Check the detection status. if (Luos_IsDetected() == false) { -#ifndef GATE_POLLING update_time = TimeOD_TimeFrom_s(GATE_REFRESH_TIME_S); -#endif } else { @@ -67,31 +63,28 @@ void Gate_Loop(void) { // Manage input and output data DataManager_Run(gate); -#ifndef GATE_POLLING + if (first_conversion == true) { - if (first_conversion == true) + // This is the first time we perform a convertion +#ifdef GATE_REFRESH_AUTOSCALE + // Evaluate the time needed to convert all the data of this configuration and update refresh rate + search_result_t result; + RTFilter_Reset(&result); + // find the biggest id + if (result.result_table[result.result_nbr - 1]->id) + { + // update time is related to the biggest id + update_time = TimeOD_TimeFrom_s((float)result.result_table[result.result_nbr - 1]->id * 0.001); + } + else { - // This is the first time we perform a convertion - #ifdef GATE_REFRESH_AUTOSCALE - // Evaluate the time needed to convert all the data of this configuration and update refresh rate - search_result_t result; - RTFilter_Reset(&result); - // find the biggest id - if (result.result_table[result.result_nbr - 1]->id) - { - // update time is related to the biggest id - update_time = TimeOD_TimeFrom_s((float)result.result_table[result.result_nbr - 1]->id * 0.001); - } - else - { - update_time = TimeOD_TimeFrom_s(GATE_REFRESH_TIME_S); - } - #endif - // Update refresh rate for all services of the network - DataManager_collect(gate); - first_conversion = false; + update_time = TimeOD_TimeFrom_s(GATE_REFRESH_TIME_S); } #endif + // Update refresh rate for all services of the network + DataManager_collect(gate); + first_conversion = false; + } } else { diff --git a/tool_services/gate/gate_config.h b/tool_services/gate/gate_config.h index d2f064146..e7ba84c3f 100644 --- a/tool_services/gate/gate_config.h +++ b/tool_services/gate/gate_config.h @@ -14,7 +14,6 @@ * Define | Description * :-----------------------|----------------------------------------------- * GATE_BUFF_SIZE | Formatted Data Buffer. Max size of 1 msg - * GATE_POLLING | No autorefresh always ask data (more intensive to Luos bandwidth.) * NODETECTION | Gate not perform a network detection a power up * GATE_REFRESH_TIME_S | Default refresh Gate recalculate optimal rate at first command * INIT_TIME | Delay before first detection, to verify that all boards are connected