Skip to content

Commit

Permalink
FHSS: Added minimum synch interval
Browse files Browse the repository at this point in the history
  • Loading branch information
Jarkko Paso committed Oct 2, 2018
1 parent d9e2ea6 commit 9d79ca9
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
5 changes: 5 additions & 0 deletions source/Service_Libs/fhss/fhss_ws.c
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ fhss_structure_t *fhss_ws_enable(fhss_api_t *fhss_api, const fhss_ws_configurati
fhss_struct->number_of_channels = channel_count;
fhss_struct->own_hop = 0xff;
fhss_struct->rx_channel = fhss_configuration->unicast_fixed_channel;
fhss_struct->ws->min_synch_interval = DEFAULT_MIN_SYNCH_INTERVAL;
fhss_set_txrx_slot_length(fhss_struct);
ns_list_init(&fhss_struct->fhss_failed_tx_list);
return fhss_struct;
Expand Down Expand Up @@ -666,6 +667,10 @@ int fhss_ws_set_parent(fhss_structure_t *fhss_structure, const uint8_t eui64[8],
if (!bc_timing_info->broadcast_interval || !bc_timing_info->broadcast_dwell_interval) {
return -1;
}
if (((uint32_t)fhss_structure->ws->min_synch_interval*1000000) > (fhss_structure->callbacks.read_timestamp(fhss_structure->fhss_api) - fhss_structure->ws->synchronization_time)) {
return 0;
}
fhss_structure->ws->synchronization_time = fhss_structure->callbacks.read_timestamp(fhss_structure->fhss_api);
platform_enter_critical();
fhss_stop_timer(fhss_structure, fhss_broadcast_handler);
uint32_t time_from_reception_ms = (fhss_structure->callbacks.read_timestamp(fhss_structure->fhss_api) - bc_timing_info->bt_rx_timestamp)/1000;
Expand Down
4 changes: 4 additions & 0 deletions source/Service_Libs/fhss/fhss_ws.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,18 @@
#define WS_NUMBER_OF_CHANNEL_RETRIES 4
//TX/RX slot length in milliseconds
#define WS_MAX_TXRX_SLOT_LEN_MS 100
// Default minimum broadcast synchronization interval in seconds
#define DEFAULT_MIN_SYNCH_INTERVAL 60
typedef struct fhss_ws fhss_ws_t;

struct fhss_ws
{
uint8_t bc_channel;
uint16_t uc_slot;
uint16_t bc_slot;
uint16_t min_synch_interval;
uint32_t txrx_slot_length_ms;
uint32_t synchronization_time;
bool unicast_timer_running;
bool is_on_bc_channel;
struct fhss_ws_configuration fhss_configuration;
Expand Down

0 comments on commit 9d79ca9

Please sign in to comment.