Skip to content

Commit

Permalink
removed warnings for bad packet reception - PROTOCOL STABLE
Browse files Browse the repository at this point in the history
  • Loading branch information
abiri committed Oct 26, 2018
1 parent b1b8d45 commit 2572794
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 17 deletions.
20 changes: 12 additions & 8 deletions software/module/firmware/app_standard_common.c
Original file line number Diff line number Diff line change
Expand Up @@ -446,10 +446,11 @@ static void common_rxcallback(const dwt_cb_data_t *rxd) {
} else if ( (rxd->status & SYS_STATUS_ALL_RX_ERR) ||
(rxd->status & SYS_STATUS_ALL_RX_TO ) ) {

debug_msg("WARNING: Rx error, status: ");
/*debug_msg("WARNING: Rx error for GLOSSY, status: ");
debug_msg_int((uint32_t) rxd->status);
debug_msg("\n");
debug_msg("\n");*/

standard_set_ranging_response_settings(TRUE, 0);
dwt_rxenable(0);
return;
}
Expand Down Expand Up @@ -483,11 +484,14 @@ static void common_rxcallback(const dwt_cb_data_t *rxd) {
}
else
{
debug_msg("WARNING: Received invalid packet of type ");
/*debug_msg("WARNING: Received invalid packet of type ");
debug_msg_uint(message_type_sync);
debug_msg("\n");
debug_msg(" with status ");
debug_msg_uint(rxd->status);
debug_msg("\n");*/

// Reenable Rx though
// Frame received incorrectly - Reed Solomon cannot correct it, so we just have to drop the packet
standard_set_ranging_response_settings(TRUE, 0);
dwt_rxenable(0);
}
}
Expand All @@ -497,13 +501,13 @@ static void common_rxcallback(const dwt_cb_data_t *rxd) {
// Helper functions
/******************************************************************************/

void helper_print_EUI(uint8_t * address) {
void helper_print_EUI(uint8_t * address, uint8_t len) {

for (uint8_t i = 0; i < EUI_LEN; i++) {
for (uint8_t i = 0; i < len; i++) {
debug_msg_hex(address[i] >> 0x04);
debug_msg_hex(address[i] & 0x0F);

if (i < (EUI_LEN - 1))
if (i < (len - 1))
debug_msg(":");
}
}
2 changes: 1 addition & 1 deletion software/module/firmware/app_standard_common.h
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,6 @@ void resp_rxcallback (const dwt_cb_data_t *rxd, uint8_t * buf, uint64_t dw_rx_t

// Helper functions
void debug_print_tx(uint32_t length);
void helper_print_EUI(uint8_t * address);
void helper_print_EUI(uint8_t * address, uint8_t len);

#endif
6 changes: 3 additions & 3 deletions software/module/firmware/app_standard_init.c
Original file line number Diff line number Diff line change
Expand Up @@ -291,9 +291,9 @@ void init_rxcallback (const dwt_cb_data_t* rxd, uint8_t * buf, uint64_t dw_rx_ti
// within dwt_isr smashes everything without regard.)
if ( (rxd->status & SYS_STATUS_ALL_RX_ERR) ||
(rxd->status & SYS_STATUS_ALL_RX_TO ) ) {
debug_msg("WARNING: Rx error, status: ");
/*debug_msg("WARNING: Rx error for INIT, status: ");
debug_msg_int((uint32_t)rxd->status);
debug_msg("\n");
debug_msg("\n");*/

standard_set_ranging_response_settings(TRUE, 0);
dwt_rxenable(0);
Expand Down Expand Up @@ -567,7 +567,7 @@ static void calculate_ranges () {
anchor_responses_t* aresp = &(si_scratch->anchor_responses[anchor_index]);

debug_msg("Anchor ID: ");
helper_print_EUI(aresp->anchor_addr);
helper_print_EUI(aresp->anchor_addr, PROTOCOL_EUI_LEN);
debug_msg("; First index: ");
debug_msg_int(aresp->tag_poll_first_idx);
debug_msg("; last index: ");
Expand Down
4 changes: 2 additions & 2 deletions software/module/firmware/app_standard_resp.c
Original file line number Diff line number Diff line change
Expand Up @@ -455,9 +455,9 @@ void resp_rxcallback (const dwt_cb_data_t *rxd, uint8_t * buf, uint64_t dw_rx_ti
// (because dwt_rxreset within dwt_isr smashes everything without regard)
if ( (rxd->status & SYS_STATUS_ALL_RX_ERR) ||
(rxd->status & SYS_STATUS_ALL_RX_TO ) ) {
debug_msg("ERROR: Rx error, status: ");
/*debug_msg("WARNING: Rx error for RESP, status: ");
debug_msg_uint((uint32_t)rxd->status);
debug_msg("\n");
debug_msg("\n");*/

standard_set_ranging_broadcast_subsequence_settings(TRUE, sr_scratch->ranging_broadcast_ss_num);
dwt_rxenable(0);
Expand Down
6 changes: 3 additions & 3 deletions software/module/firmware/glossy.c
Original file line number Diff line number Diff line change
Expand Up @@ -850,7 +850,7 @@ void glossy_process_rxcallback(uint64_t dw_timestamp, uint8_t *buf){
host_interface_notify_master_change(_lwb_master_eui, EUI_LEN);

debug_msg("Found new Glossy master: ");
helper_print_EUI(_lwb_master_eui);
helper_print_EUI(_lwb_master_eui, EUI_LEN);
debug_msg("\n");
#ifndef PROTOCOL_FLEXIBLE_MASTER
} else {
Expand Down Expand Up @@ -1031,7 +1031,7 @@ static uint8_t schedule_device(uint8_t * array, uint8_t array_length, uint8_t *
memcpy( (array + candidate_slot * PROTOCOL_EUI_LEN), eui, PROTOCOL_EUI_LEN);

/*debug_msg("Scheduled EUI ");
helper_print_EUI(eui);
helper_print_EUI(eui, PROTOCOL_EUI_LEN);
debug_msg("in slot ");
debug_msg_uint(candidate_slot);*/

Expand Down Expand Up @@ -1076,7 +1076,7 @@ static uint8_t deschedule_device(uint8_t * array, uint8_t array_length, uint8_t
memset( (array + i * PROTOCOL_EUI_LEN), 0, PROTOCOL_EUI_LEN);

/*debug_msg("Descheduled EUI ");
helper_print_EUI(eui);
helper_print_EUI(eui, PROTOCOL_EUI_LEN);
debug_msg("from slot ");
debug_msg_uint(i);*/

Expand Down

0 comments on commit 2572794

Please sign in to comment.