Skip to content

Commit

Permalink
[Gate] remove auto-updates before setting a new one allowing to keep …
Browse files Browse the repository at this point in the history
…only one at a time per services.
  • Loading branch information
nicolas-rabault committed Mar 12, 2024
1 parent d8e5b74 commit d97db8e
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
7 changes: 6 additions & 1 deletion tool_services/gate/TinyJSON/convert.c
Original file line number Diff line number Diff line change
Expand Up @@ -543,7 +543,12 @@ void Convert_JsonToMsg(service_t *service, uint16_t id, luos_type_t type, char *
{
if (type != GATE_TYPE)
{
// this should be a function because it is frequently used
// remove any current updates
time = TimeOD_TimeFrom_s(0);
TimeOD_TimeToMsg(&time, &msg);
msg.header.cmd = UPDATE_PUB;
Luos_SendMsg(service, &msg);
// configure the new update value
time = TimeOD_TimeFrom_s((float)json_getReal(jobj));
TimeOD_TimeToMsg(&time, &msg);
msg.header.cmd = UPDATE_PUB;
Expand Down
6 changes: 6 additions & 0 deletions tool_services/gate/data_manager.c
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,13 @@ void DataManager_collect(service_t *service)
#endif
#else
// This service is a sensor so create a msg to enable auto update
// First remove any auto update
time_luos_t reset_time = {.raw = 0};
update_msg.header.target = result.result_table[i]->id;
TimeOD_TimeToMsg(&reset_time, &update_msg);
update_msg.header.cmd = UPDATE_PUB;
Luos_SendMsg(service, &update_msg);

TimeOD_TimeToMsg(&update_time, &update_msg);
update_msg.header.cmd = UPDATE_PUB;
Luos_SendMsg(service, &update_msg);
Expand Down

0 comments on commit d97db8e

Please sign in to comment.