Skip to content

Commit 03f447a

Browse files
author
Jarkko Paso
committed
FHSS: Do not use broadcast queue when fixed channel
1 parent 40f3685 commit 03f447a

File tree

4 files changed

+30
-16
lines changed

4 files changed

+30
-16
lines changed

source/Service_Libs/fhss/fhss.c

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1200,6 +1200,20 @@ static bool fhss_is_broadcast_channel_callback(const fhss_api_t *api)
12001200
return fhss_is_current_channel_broadcast(fhss_structure);
12011201
}
12021202

1203+
static bool fhss_use_broadcast_queue_cb(const fhss_api_t *api, bool is_broadcast_addr, int frame_type)
1204+
{
1205+
fhss_structure_t *fhss_structure = fhss_get_object_with_api(api);
1206+
if (!fhss_structure) {
1207+
return false;
1208+
}
1209+
// Synch requests are always stored in unicast queue
1210+
if (frame_type == FHSS_SYNCH_REQUEST_FRAME) {
1211+
return false;
1212+
}
1213+
// Broadcast packets are stored in broadcast queue
1214+
return is_broadcast_addr;
1215+
}
1216+
12031217
static void fhss_superframe_handler(const fhss_api_t *fhss_api, uint16_t delay)
12041218
{
12051219
uint32_t timeout = 0;

source/Service_Libs/fhss/fhss_common.c

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -239,20 +239,6 @@ int fhss_compare_with_synch_parent_address(fhss_structure_t *fhss_structure, con
239239
return ret_val;
240240
}
241241

242-
bool fhss_use_broadcast_queue_cb(const fhss_api_t *api, bool is_broadcast_addr, int frame_type)
243-
{
244-
fhss_structure_t *fhss_structure = fhss_get_object_with_api(api);
245-
if (!fhss_structure) {
246-
return false;
247-
}
248-
// Synch requests are always stored in unicast queue
249-
if (frame_type == FHSS_SYNCH_REQUEST_FRAME) {
250-
return false;
251-
}
252-
// Broadcast packets are stored in broadcast queue
253-
return is_broadcast_addr;
254-
}
255-
256242
uint32_t fhss_read_timestamp_cb(const fhss_api_t *api)
257243
{
258244
fhss_structure_t *fhss_structure = fhss_get_object_with_api(api);

source/Service_Libs/fhss/fhss_common.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,6 @@ int fhss_update_synch_parent_address(fhss_structure_t *fhss_structure);
6767
void fhss_trig_event(fhss_structure_t *fhss_structure, uint8_t event_type);
6868
int fhss_get_parent_address(fhss_structure_t *fhss_structure, uint8_t *p_addr);
6969
int fhss_compare_with_synch_parent_address(fhss_structure_t *fhss_structure, const uint8_t *source_addr);
70-
bool fhss_use_broadcast_queue_cb(const fhss_api_t *api, bool is_broadcast_addr, int frame_type);
7170
uint32_t fhss_read_timestamp_cb(const fhss_api_t *api);
7271
int fhss_init_callbacks_cb(const fhss_api_t *api, fhss_callback_t *callbacks);
7372
int fhss_failed_handle_remove(fhss_structure_t *fhss_structure, uint8_t handle);

source/Service_Libs/fhss/fhss_ws.c

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -455,6 +455,21 @@ static bool fhss_ws_is_broadcast_channel_callback(const fhss_api_t *api)
455455
return fhss_structure->ws->is_on_bc_channel;
456456
}
457457

458+
static bool fhss_ws_use_broadcast_queue_cb(const fhss_api_t *api, bool is_broadcast_addr, int frame_type)
459+
{
460+
(void) frame_type;
461+
fhss_structure_t *fhss_structure = fhss_get_object_with_api(api);
462+
if (!fhss_structure) {
463+
return false;
464+
}
465+
// Do not use broadcast queue when fixed channel
466+
if (fhss_structure->ws->fhss_configuration.ws_channel_function == WS_FIXED_CHANNEL) {
467+
return false;
468+
}
469+
// Broadcast packets are stored in broadcast queue
470+
return is_broadcast_addr;
471+
}
472+
458473
static void fhss_unicast_handler(const fhss_api_t *fhss_api, uint16_t delay)
459474
{
460475
uint32_t timeout = 0;
@@ -489,7 +504,7 @@ int fhss_ws_set_callbacks(fhss_structure_t *fhss_structure)
489504
{
490505
// Set external API
491506
fhss_structure->fhss_api->is_broadcast_channel = &fhss_ws_is_broadcast_channel_callback;
492-
fhss_structure->fhss_api->use_broadcast_queue = &fhss_use_broadcast_queue_cb;
507+
fhss_structure->fhss_api->use_broadcast_queue = &fhss_ws_use_broadcast_queue_cb;
493508
fhss_structure->fhss_api->tx_handle = &fhss_ws_tx_handle_callback;
494509
fhss_structure->fhss_api->check_tx_conditions = &fhss_ws_check_tx_conditions_callback;
495510
fhss_structure->fhss_api->receive_frame = &fhss_ws_receive_frame_callback;

0 commit comments

Comments
 (0)