diff --git a/examples/twr_aloha/control.c b/examples/twr_aloha/control.c index c0cba17926..fc81a50455 100644 --- a/examples/twr_aloha/control.c +++ b/examples/twr_aloha/control.c @@ -227,20 +227,11 @@ void init_ranging(void) (uint16_t)ceilf(uwb_dwt_usecs_to_usecs(rng->config. tx_holdoff_delay))); - if (IS_USED(MODULE_UWB_CORE_TWR_SS_ACK)) { - uwb_set_autoack(udev, true); - uwb_set_autoack_delay(udev, 12); - } - dpl_callout_init(&_rng_req_callout, dpl_eventq_dflt_get(), uwb_ev_cb, rng); dpl_callout_reset(&_rng_req_callout, RANGE_REQUEST_T_MS); dpl_event_init(&_slot_event, _slot_complete_cb, rng); - /* Apply config */ - uwb_mac_config(udev, NULL); - uwb_txrf_config(udev, &udev->config.txrf); - if ((udev->role & UWB_ROLE_ANCHOR)) { printf("Node role: ANCHOR \n"); udev->my_short_address = ANCHOR_ADDRESS; diff --git a/pkg/uwb-core/contrib/uwb_core_init.c b/pkg/uwb-core/contrib/uwb_core_init.c index 6581714b48..6ee773e182 100644 --- a/pkg/uwb-core/contrib/uwb_core_init.c +++ b/pkg/uwb-core/contrib/uwb_core_init.c @@ -47,6 +47,9 @@ void uwb_core_init(void) uwb_dw1000_setup(&dev, (void *) &dw1000_params[0]); /* this will start a thread handling dw1000 device */ uwb_dw1000_config_and_start(&dev); + /* apply default configuration */ + uwb_mac_config(&dev.uwb_dev, NULL); + uwb_txrf_config(&dev.uwb_dev, &dev.uwb_dev.config.txrf); /* init uwb pkg's */ #if IS_USED(MODULE_UWB_CORE_RNG) @@ -64,6 +67,8 @@ void uwb_core_init(void) #endif #if IS_USED(MODULE_UWB_CORE_TWR_SS_ACK) twr_ss_ack_pkg_init(); + uwb_set_autoack(&dev.uwb_dev, true); + uwb_set_autoack_delay(&dev.uwb_dev, 12); #endif #if IS_USED(MODULE_UWB_CORE_TWR_SS_EXT) twr_ss_ext_pkg_init();