Skip to content

Commit 3b6a921

Browse files
author
Jarkko Paso
committed
FHSS: Debug callback update
1 parent ec1c41d commit 3b6a921

File tree

3 files changed

+18
-6
lines changed

3 files changed

+18
-6
lines changed

source/Service_Libs/fhss/fhss.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1129,6 +1129,9 @@ static bool fhss_data_tx_fail_callback(const fhss_api_t *api, uint8_t handle, in
11291129
if (fhss_structure->fhss_state == FHSS_UNSYNCHRONIZED) {
11301130
return false;
11311131
}
1132+
#ifdef FHSS_CHANNEL_DEBUG
1133+
tr_info("TX failed on ch: %u", debug_destination_channel);
1134+
#endif /*FHSS_CHANNEL_DEBUG*/
11321135
// Channel retries are disabled -> return
11331136
if (fhss_structure->bs->fhss_configuration.fhss_number_of_channel_retries == 0) {
11341137
return false;

source/Service_Libs/fhss/fhss_channel.c

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,16 +27,15 @@
2727

2828
#define TRACE_GROUP "fhss"
2929

30-
// Enable this flag to use channel traces
31-
// #define FHSS_CHANNEL_DEBUG
32-
// Enable this flag to use debug callbacks
33-
#define FHSS_CHANNEL_DEBUG_CBS
34-
3530
#ifdef FHSS_CHANNEL_DEBUG_CBS
3631
void (*fhss_uc_switch)(void) = NULL;
3732
void (*fhss_bc_switch)(void) = NULL;
3833
#endif /*FHSS_CHANNEL_DEBUG_CBS*/
3934

35+
#ifdef FHSS_CHANNEL_DEBUG
36+
uint8_t debug_destination_channel = 0;
37+
#endif /*FHSS_CHANNEL_DEBUG*/
38+
4039
static uint8_t fhss_get_bc_index(const fhss_structure_t *fhss_structure);
4140

4241
uint8_t fhss_calc_channel_shuffle(uint8_t index, uint16_t number_of_channels, uint8_t number_of_broadcast_channels)
@@ -252,7 +251,7 @@ int fhss_change_to_tx_channel(fhss_structure_t *fhss_structure, uint8_t *destina
252251
uint8_t destination_channel = fhss_get_destination_channel(fhss_structure, destination_address);
253252
fhss_structure->callbacks.change_channel(fhss_structure->fhss_api, destination_channel);
254253
#ifdef FHSS_CHANNEL_DEBUG
255-
tr_info("TX channel: %u", destination_channel);
254+
debug_destination_channel = destination_channel;
256255
#endif /*FHSS_CHANNEL_DEBUG*/
257256
}
258257
}

source/Service_Libs/fhss/fhss_channel.h

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,4 +24,14 @@ int fhss_change_to_tx_channel(fhss_structure_t *fhss_structure, uint8_t *destina
2424
int fhss_change_to_parent_channel(fhss_structure_t *fhss_structure);
2525
int fhss_change_to_rx_channel(fhss_structure_t *fhss_structure);
2626

27+
28+
// Enable this flag to use channel traces
29+
// #define FHSS_CHANNEL_DEBUG
30+
// Enable this flag to use debug callbacks
31+
// #define FHSS_CHANNEL_DEBUG_CBS
32+
33+
#ifdef FHSS_CHANNEL_DEBUG
34+
extern uint8_t debug_destination_channel;
35+
#endif /*FHSS_CHANNEL_DEBUG*/
36+
2737
#endif /*FHSS_CHANNEL_H_*/

0 commit comments

Comments
 (0)