Skip to content

Commit

Permalink
hybrid working reliably in both directions
Browse files Browse the repository at this point in the history
  • Loading branch information
abiri committed Oct 19, 2018
1 parent 83abd6a commit 54d3071
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 9 deletions.
6 changes: 6 additions & 0 deletions software/module/firmware/app_standard_resp.c
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,12 @@ void resp_txcallback (const dwt_cb_data_t *txd) {
// Packet was sent successfully
//debug_msg("ANCHOR transmitted a packet\n");

// As we sent our single packet, we switch back to INIT mode to catch the rest of the packets
if (standard_is_init_enabled()) {
standard_set_resp_active(FALSE);
standard_set_init_active(TRUE);
}

} else {
// Some error occurred, don't just keep trying to send packets.
debug_msg("ERROR: Failed in sending packet!\n");
Expand Down
15 changes: 6 additions & 9 deletions software/module/firmware/glossy.c
Original file line number Diff line number Diff line change
Expand Up @@ -411,9 +411,6 @@ static void glossy_lwb_round_task() {
_cur_glossy_depth = 0; // seqNum in packet
_glossy_currently_flooding = TRUE;

standard_set_init_active(TRUE);
standard_set_resp_active(FALSE);

dwt_forcetrxoff();

uint16_t frame_len = sizeof(struct pp_signal_flood);
Expand Down Expand Up @@ -582,9 +579,9 @@ bool glossy_process_txcallback(){

if (_cur_glossy_depth < GLOSSY_MAX_DEPTH) {

debug_msg("Sending flooding message with depth ");
/*debug_msg("Sending flooding message with depth ");
debug_msg_uint(_cur_glossy_depth);
debug_msg("\n");
debug_msg("\n");*/

// We're flooding, keep doing it until the max depth!
uint32_t delay_time = _last_delay_time + (DW_DELAY_FROM_US(GLOSSY_FLOOD_TIMESLOT_US) & 0xFFFFFFFE);
Expand Down Expand Up @@ -746,9 +743,9 @@ void glossy_process_rxcallback(uint64_t dw_timestamp, uint8_t *buf){

if (_cur_glossy_depth < GLOSSY_MAX_DEPTH) {

debug_msg("Sending flooding message with depth ");
/*debug_msg("Sending flooding message with depth ");
debug_msg_uint(_cur_glossy_depth);
debug_msg("\n");
debug_msg("\n");*/

_glossy_currently_flooding = TRUE;

Expand Down Expand Up @@ -862,9 +859,9 @@ void glossy_process_rxcallback(uint64_t dw_timestamp, uint8_t *buf){

if (_cur_glossy_depth < GLOSSY_MAX_DEPTH) {

debug_msg("Sending flooding message with depth ");
/*debug_msg("Sending flooding message with depth ");
debug_msg_uint(_cur_glossy_depth);
debug_msg("\n");
debug_msg("\n");*/

_glossy_currently_flooding = TRUE;

Expand Down

0 comments on commit 54d3071

Please sign in to comment.