Skip to content

Commit 9d79ca9

Browse files
author
Jarkko Paso
committed
FHSS: Added minimum synch interval
1 parent d9e2ea6 commit 9d79ca9

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

source/Service_Libs/fhss/fhss_ws.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,7 @@ fhss_structure_t *fhss_ws_enable(fhss_api_t *fhss_api, const fhss_ws_configurati
9191
fhss_struct->number_of_channels = channel_count;
9292
fhss_struct->own_hop = 0xff;
9393
fhss_struct->rx_channel = fhss_configuration->unicast_fixed_channel;
94+
fhss_struct->ws->min_synch_interval = DEFAULT_MIN_SYNCH_INTERVAL;
9495
fhss_set_txrx_slot_length(fhss_struct);
9596
ns_list_init(&fhss_struct->fhss_failed_tx_list);
9697
return fhss_struct;
@@ -666,6 +667,10 @@ int fhss_ws_set_parent(fhss_structure_t *fhss_structure, const uint8_t eui64[8],
666667
if (!bc_timing_info->broadcast_interval || !bc_timing_info->broadcast_dwell_interval) {
667668
return -1;
668669
}
670+
if (((uint32_t)fhss_structure->ws->min_synch_interval*1000000) > (fhss_structure->callbacks.read_timestamp(fhss_structure->fhss_api) - fhss_structure->ws->synchronization_time)) {
671+
return 0;
672+
}
673+
fhss_structure->ws->synchronization_time = fhss_structure->callbacks.read_timestamp(fhss_structure->fhss_api);
669674
platform_enter_critical();
670675
fhss_stop_timer(fhss_structure, fhss_broadcast_handler);
671676
uint32_t time_from_reception_ms = (fhss_structure->callbacks.read_timestamp(fhss_structure->fhss_api) - bc_timing_info->bt_rx_timestamp)/1000;

source/Service_Libs/fhss/fhss_ws.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,18 @@
2323
#define WS_NUMBER_OF_CHANNEL_RETRIES 4
2424
//TX/RX slot length in milliseconds
2525
#define WS_MAX_TXRX_SLOT_LEN_MS 100
26+
// Default minimum broadcast synchronization interval in seconds
27+
#define DEFAULT_MIN_SYNCH_INTERVAL 60
2628
typedef struct fhss_ws fhss_ws_t;
2729

2830
struct fhss_ws
2931
{
3032
uint8_t bc_channel;
3133
uint16_t uc_slot;
3234
uint16_t bc_slot;
35+
uint16_t min_synch_interval;
3336
uint32_t txrx_slot_length_ms;
37+
uint32_t synchronization_time;
3438
bool unicast_timer_running;
3539
bool is_on_bc_channel;
3640
struct fhss_ws_configuration fhss_configuration;

0 commit comments

Comments
 (0)