diff --git a/esp32/uwb_tag/src/main.cpp b/esp32/uwb_tag/src/main.cpp index 5f885b8..9b63296 100644 --- a/esp32/uwb_tag/src/main.cpp +++ b/esp32/uwb_tag/src/main.cpp @@ -403,8 +403,11 @@ void loop(void) { g_last_hb = millis(); } - /* DW1000Ranging handles TWR internally — - calls newRange() callback when range is available */ + /* + * Time-division: match anchor slots (50ms each, 2 anchors). + * At each slot boundary, let DW1000Ranging rediscover. + * This ensures the tag ranges with whichever anchor is active. + */ if (!g_estop_active) { DW1000Ranging.loop(); } diff --git a/lib/DW1000/src/DW1000Ranging.cpp b/lib/DW1000/src/DW1000Ranging.cpp index 8e8d50e..a77cd94 100644 --- a/lib/DW1000/src/DW1000Ranging.cpp +++ b/lib/DW1000/src/DW1000Ranging.cpp @@ -742,7 +742,7 @@ void DW1000RangingClass::timerTick() { checkForInactiveDevices(); } counterForBlink++; - if(counterForBlink > 20) { + if(counterForBlink > 5) { counterForBlink = 0; } } diff --git a/lib/DW1000/src/DW1000Ranging.h b/lib/DW1000/src/DW1000Ranging.h index c390176..55f7fdc 100644 --- a/lib/DW1000/src/DW1000Ranging.h +++ b/lib/DW1000/src/DW1000Ranging.h @@ -60,7 +60,7 @@ #define ANCHOR 1 //default timer delay -#define DEFAULT_TIMER_DELAY 80 +#define DEFAULT_TIMER_DELAY 40 //debug mode #ifndef DEBUG