diff --git a/code/nrf-connect/samples/zigbee/Kconfig b/code/nrf-connect/samples/zigbee/Kconfig new file mode 100644 index 0000000..93136ee --- /dev/null +++ b/code/nrf-connect/samples/zigbee/Kconfig @@ -0,0 +1,9 @@ +source "Kconfig.zephyr" + +config PRST_ZB_SLEEP_DURATION_SEC + int "Sleep duration between waking up and reading sensors (in seconds)" + default 300 + +config PRST_ZB_PARENT_POLL_INTERVAL_SEC + int "Interval for when b-parasite polls its parent for data (in seconds)" + default 300 \ No newline at end of file diff --git a/code/nrf-connect/samples/zigbee/src/main.c b/code/nrf-connect/samples/zigbee/src/main.c index 4cb9630..1dca231 100644 --- a/code/nrf-connect/samples/zigbee/src/main.c +++ b/code/nrf-connect/samples/zigbee/src/main.c @@ -5,6 +5,7 @@ #include #include #include +#include #include #include #include @@ -143,7 +144,9 @@ void update_sensors_cb(zb_uint8_t arg) { PRST_ZB_ZCL_ATTR_SOIL_MOISTURE_VALUE_ID, &soil_moisture); - ZB_SCHEDULE_APP_ALARM(update_sensors_cb, NULL, ZB_TIME_ONE_SECOND * 10); + ZB_SCHEDULE_APP_ALARM(update_sensors_cb, + /*param=*/0, + ZB_TIME_ONE_SECOND * CONFIG_PRST_ZB_SLEEP_DURATION_SEC); } int main(void) { @@ -154,9 +157,6 @@ int main(void) { // We do this to quickly put the shtc3 to sleep. prst_sensors_read_all(&sensors); - zigbee_configure_sleepy_behavior(/*enable=*/true); - zb_set_rx_on_when_idle(ZB_FALSE); - register_factory_reset_button(FACTORY_RESET_BUTTON); prst_zb_attrs_init(&dev_ctx); @@ -166,8 +166,8 @@ int main(void) { update_sensors_cb(/*arg=*/0); RET_IF_ERR(prst_led_flash(2)); - // One minute. - zb_zdo_pim_set_long_poll_interval(60000); + + zb_zdo_pim_set_long_poll_interval(CONFIG_PRST_ZB_PARENT_POLL_INTERVAL_SEC); power_down_unused_ram(); zigbee_enable();