Skip to content

Commit

Permalink
FHSS: Start broadcast schedule when bc intervals are known
Browse files Browse the repository at this point in the history
  • Loading branch information
Jarkko Paso committed Feb 9, 2018
1 parent e55ec8a commit 7d4a2f8
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions source/Service_Libs/fhss/fhss_ws.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@
// Enable this flag to use channel traces
#define FHSS_CHANNEL_DEBUG

static void fhss_ws_update_uc_channel_callback(fhss_structure_t *fhss_structure);

fhss_structure_t *fhss_ws_enable(fhss_api_t *fhss_api, const fhss_ws_configuration_t *fhss_configuration, const fhss_timer_t *fhss_timer)
{
if (!fhss_api || !fhss_configuration || !fhss_timer) {
Expand Down Expand Up @@ -111,6 +113,14 @@ static int fhss_ws_handle_state_set(fhss_structure_t *fhss_structure, fhss_state
{
(void) pan_id;
if (fhss_state == FHSS_SYNCHRONIZED) {
uint32_t fhss_broadcast_interval = fhss_structure->fhss_conf.fhss_ws_configuration.fhss_broadcast_interval;
uint8_t fhss_bc_dwell_interval = fhss_structure->fhss_conf.fhss_ws_configuration.fhss_bc_dwell_interval;
// Start broadcast schedule when BC intervals are known
if (fhss_broadcast_interval && fhss_bc_dwell_interval) {
fhss_broadcast_handler(fhss_structure->fhss_api, 0);
}
// Start unicast schedule
fhss_ws_update_uc_channel_callback(fhss_structure);
fhss_start_timer(fhss_structure, fhss_structure->fhss_conf.fhss_ws_configuration.fhss_uc_dwell_interval*1000, fhss_superframe_handler);
}

Expand Down

0 comments on commit 7d4a2f8

Please sign in to comment.