Skip to content

Commit

Permalink
FHSS: Prevent changing unicast channel when broadcast is active
Browse files Browse the repository at this point in the history
- Switches to new unicast channel after broadcast channel
  • Loading branch information
Jarkko Paso committed Feb 9, 2018
1 parent b60b113 commit e55ec8a
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions source/Service_Libs/fhss/fhss_ws.c
Expand Up @@ -94,6 +94,11 @@ static void fhss_broadcast_handler(const fhss_api_t *fhss_api, uint16_t delay)
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;
fhss_start_timer(fhss_structure, timeout, fhss_broadcast_handler);
fhss_structure->ws->is_on_bc_channel = false;
// Should return to own (unicast) listening channel after broadcast channel
fhss_structure->callbacks.change_channel(fhss_structure->fhss_api, fhss_structure->rx_channel);
#ifdef FHSS_CHANNEL_DEBUG
tr_info("%"PRIu32" UC %u", fhss_structure->platform_functions.fhss_get_timestamp(fhss_structure->fhss_api), fhss_structure->rx_channel);
#endif /*FHSS_CHANNEL_DEBUG*/
}
}

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

0 comments on commit e55ec8a

Please sign in to comment.