From 940b5882a8b8a4bd4109691599db1407cecce145 Mon Sep 17 00:00:00 2001 From: Nerivec <62446222+Nerivec@users.noreply.github.com> Date: Thu, 7 Nov 2024 00:08:31 +0100 Subject: [PATCH 1/2] More cleanup --- src/zigbee_router/app.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/src/zigbee_router/app.c b/src/zigbee_router/app.c index 6d56963a..90292263 100644 --- a/src/zigbee_router/app.c +++ b/src/zigbee_router/app.c @@ -44,12 +44,12 @@ #define NWK_STEERING_COOLDOWN_MS 10000 -static sl_zigbee_af_event_t commissioning_led_event; +static sl_zigbee_af_event_t commissioning_event; //--------------- // Event handlers -static void commissioning_led_event_handler(sl_zigbee_af_event_t *event) +static void commissioning_event_handler(sl_zigbee_af_event_t *event) { led_turn_on(COMMISSIONING_STATUS_LED); @@ -73,9 +73,10 @@ void sl_zigbee_af_stack_status_cb(sl_status_t status) { if (status == SL_STATUS_NETWORK_DOWN) { led_turn_off(COMMISSIONING_STATUS_LED); - sl_zigbee_af_event_set_delay_ms(&commissioning_led_event, NWK_STEERING_COOLDOWN_MS); + sl_zigbee_af_event_set_delay_ms(&commissioning_event, NWK_STEERING_COOLDOWN_MS); } else if (status == SL_STATUS_NETWORK_UP) { - // make some noise on start for reconnect (otherwise perceived as offline until pinged) + // make some noise on start for reconnect + // (otherwise perceived as offline until pinged) sl_zigbee_send_device_announcement(); led_turn_on(COMMISSIONING_STATUS_LED); } @@ -86,9 +87,9 @@ void sl_zigbee_af_stack_status_cb(sl_status_t status) */ void sl_zigbee_af_main_init_cb(void) { - sl_zigbee_af_event_init(&commissioning_led_event, commissioning_led_event_handler); + sl_zigbee_af_event_init(&commissioning_event, commissioning_event_handler); - sl_zigbee_af_event_set_active(&commissioning_led_event); + sl_zigbee_af_event_set_active(&commissioning_event); } /** @brief Complete network steering. @@ -118,7 +119,7 @@ void sl_zigbee_af_network_steering_complete_cb(sl_status_t status, if (status != SL_STATUS_OK) { led_turn_off(COMMISSIONING_STATUS_LED); - sl_zigbee_af_event_set_delay_ms(&commissioning_led_event, NWK_STEERING_COOLDOWN_MS); + sl_zigbee_af_event_set_delay_ms(&commissioning_event, NWK_STEERING_COOLDOWN_MS); } } From 833869e66cd4708fce86a8866e3f6df290b32eab Mon Sep 17 00:00:00 2001 From: Nerivec <62446222+Nerivec@users.noreply.github.com> Date: Thu, 7 Nov 2024 00:21:31 +0100 Subject: [PATCH 2/2] Test router BTL --- src/zigbee_router/app.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/zigbee_router/app.c b/src/zigbee_router/app.c index 90292263..f8f166a9 100644 --- a/src/zigbee_router/app.c +++ b/src/zigbee_router/app.c @@ -26,8 +26,10 @@ #if (LARGE_NETWORK_TESTING == 0) +#include "btl_interface.h" #include "network-steering.h" #include "stack/include/zigbee-device-stack.h" +#include "app/framework/plugin/basic/basic.h" #if defined(SL_CATALOG_LED0_PRESENT) #include "sl_led.h" @@ -123,6 +125,21 @@ void sl_zigbee_af_network_steering_complete_cb(sl_status_t status, } } +/** @brief Reset To Factory Defaults + * + * This function is called by the Basic server plugin when a request to reset + * to factory defaults is received. The plugin will reset attributes managed by + * the framework to their default values. The application should perform any + * other necessary reset-related operations in this callback, including + * resetting any externally-stored attributes. + * + * @param endpoint Ver.: always + */ +void sl_zigbee_af_basic_reset_to_factory_defaults_cb(uint8_t endpoint) +{ + bootloader_rebootAndInstall(); +} + /** @brief * * Application framework equivalent of ::sl_zigbee_radio_needs_calibrating_handler