Skip to content

Commit e55ec8a

Browse files
author
Jarkko Paso
committed
FHSS: Prevent changing unicast channel when broadcast is active
- Switches to new unicast channel after broadcast channel
1 parent b60b113 commit e55ec8a

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

source/Service_Libs/fhss/fhss_ws.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,11 @@ static void fhss_broadcast_handler(const fhss_api_t *fhss_api, uint16_t delay)
9494
uint32_t timeout = (fhss_structure->fhss_conf.fhss_ws_configuration.fhss_broadcast_interval - fhss_structure->fhss_conf.fhss_ws_configuration.fhss_bc_dwell_interval) * 1000;
9595
fhss_start_timer(fhss_structure, timeout, fhss_broadcast_handler);
9696
fhss_structure->ws->is_on_bc_channel = false;
97+
// Should return to own (unicast) listening channel after broadcast channel
98+
fhss_structure->callbacks.change_channel(fhss_structure->fhss_api, fhss_structure->rx_channel);
99+
#ifdef FHSS_CHANNEL_DEBUG
100+
tr_info("%"PRIu32" UC %u", fhss_structure->platform_functions.fhss_get_timestamp(fhss_structure->fhss_api), fhss_structure->rx_channel);
101+
#endif /*FHSS_CHANNEL_DEBUG*/
97102
}
98103
}
99104

@@ -136,6 +141,10 @@ static void fhss_ws_update_uc_channel_callback(fhss_structure_t *fhss_structure)
136141
} else if (fhss_structure->ws->channel_function == WS_VENDOR_DEF_CF) {
137142
//TODO: Callback to get channel schedule from application
138143
}
144+
// Do not switch unicast channel when broadcast channel is active.
145+
if (fhss_structure->ws->is_on_bc_channel == true) {
146+
return;
147+
}
139148
#ifdef FHSS_CHANNEL_DEBUG
140149
tr_info("%"PRIu32" UC %u %u", fhss_structure->platform_functions.fhss_get_timestamp(fhss_structure->fhss_api), next_channel, fhss_structure->ws->uc_slot);
141150
#endif /*FHSS_CHANNEL_DEBUG*/

0 commit comments

Comments
 (0)