Skip to content

Commit eedd746

Browse files
author
Jarkko Paso
committed
FHSS: Compensate delay from platform driver when starting timeout
1 parent 7d537ea commit eedd746

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

source/Service_Libs/fhss/fhss_ws.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,6 @@ static int32_t fhss_ws_calc_bc_channel(fhss_structure_t *fhss_structure)
115115

116116
static void fhss_broadcast_handler(const fhss_api_t *fhss_api, uint16_t delay)
117117
{
118-
(void) delay;
119118
int32_t next_channel;
120119
fhss_structure_t *fhss_structure = fhss_get_object_with_api(fhss_api);
121120
if (!fhss_structure) {
@@ -128,12 +127,12 @@ static void fhss_broadcast_handler(const fhss_api_t *fhss_api, uint16_t delay)
128127
return;
129128
}
130129
if (fhss_structure->ws->is_on_bc_channel == false) {
131-
fhss_start_timer(fhss_structure, fhss_structure->ws->fhss_configuration.fhss_bc_dwell_interval*1000, fhss_broadcast_handler);
130+
fhss_start_timer(fhss_structure, fhss_structure->ws->fhss_configuration.fhss_bc_dwell_interval*1000 - (delay * fhss_structure->platform_functions.fhss_resolution_divider), fhss_broadcast_handler);
132131
fhss_structure->ws->is_on_bc_channel = true;
133132
next_channel = fhss_structure->ws->bc_channel = fhss_ws_calc_bc_channel(fhss_structure);
134133
} else {
135134
uint32_t timeout = (fhss_structure->ws->fhss_configuration.fhss_broadcast_interval - fhss_structure->ws->fhss_configuration.fhss_bc_dwell_interval) * 1000;
136-
fhss_start_timer(fhss_structure, timeout, fhss_broadcast_handler);
135+
fhss_start_timer(fhss_structure, timeout - (delay * fhss_structure->platform_functions.fhss_resolution_divider), fhss_broadcast_handler);
137136
fhss_structure->ws->is_on_bc_channel = false;
138137
// Should return to own (unicast) listening channel after broadcast channel
139138
next_channel = fhss_structure->rx_channel;

0 commit comments

Comments
 (0)