Skip to content

Commit 78ea0eb

Browse files
author
Jarkko Paso
committed
FHSS: Debug callbacks added
1 parent c4ef759 commit 78ea0eb

File tree

1 file changed

+23
-2
lines changed

1 file changed

+23
-2
lines changed

source/Service_Libs/fhss/fhss_channel.c

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,13 @@
2929

3030
// Enable this flag to use channel traces
3131
// #define FHSS_CHANNEL_DEBUG
32+
// Enable this flag to use debug callbacks
33+
#define FHSS_CHANNEL_DEBUG_CBS
34+
35+
#ifdef FHSS_CHANNEL_DEBUG_CBS
36+
void (*fhss_uc_switch)(void) = NULL;
37+
void (*fhss_bc_switch)(void) = NULL;
38+
#endif /*FHSS_CHANNEL_DEBUG_CBS*/
3239

3340
static uint8_t fhss_get_bc_index(const fhss_structure_t *fhss_structure);
3441

@@ -138,13 +145,27 @@ bool fhss_change_to_next_channel(fhss_structure_t *fhss_structure)
138145
next_channel = channel_list_get_channel(fhss_structure->bs->fhss_configuration.channel_mask, channel_index_tmp);
139146

140147
fhss_structure->rx_channel = next_channel;
141-
#ifdef FHSS_CHANNEL_DEBUG
148+
142149
if (fhss_is_current_channel_broadcast(fhss_structure) == true) {
150+
#ifdef FHSS_CHANNEL_DEBUG_CBS
151+
if (fhss_bc_switch) {
152+
fhss_bc_switch();
153+
}
154+
#endif /*FHSS_CHANNEL_DEBUG_CBS*/
155+
#ifdef FHSS_CHANNEL_DEBUG
143156
tr_info("%"PRIu32" BC %u", fhss_structure->platform_functions.fhss_get_timestamp(fhss_structure->fhss_api), next_channel);
157+
#endif /*FHSS_CHANNEL_DEBUG*/
144158
} else {
159+
#ifdef FHSS_CHANNEL_DEBUG_CBS
160+
if (fhss_uc_switch) {
161+
fhss_uc_switch();
162+
}
163+
#endif /*FHSS_CHANNEL_DEBUG_CBS*/
164+
#ifdef FHSS_CHANNEL_DEBUG
145165
tr_info("%"PRIu32" UC %u", fhss_structure->platform_functions.fhss_get_timestamp(fhss_structure->fhss_api), next_channel);
146-
}
147166
#endif /*FHSS_CHANNEL_DEBUG*/
167+
}
168+
148169
fhss_structure->callbacks.change_channel(fhss_structure->fhss_api, next_channel);
149170
return broadcast_channel;
150171
}

0 commit comments

Comments
 (0)