From 8105bfcd7bda57eba6edacd5270abb23588e2fec Mon Sep 17 00:00:00 2001 From: rbaron Date: Mon, 26 Dec 2022 11:06:26 +0100 Subject: [PATCH] Ensures sensor-reading callback is always rescheduled --- code/nrf-connect/samples/zigbee/src/main.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/code/nrf-connect/samples/zigbee/src/main.c b/code/nrf-connect/samples/zigbee/src/main.c index 522acce..4b43ea3 100644 --- a/code/nrf-connect/samples/zigbee/src/main.c +++ b/code/nrf-connect/samples/zigbee/src/main.c @@ -158,6 +158,10 @@ void zboss_signal_handler(zb_bufid_t bufid) { void update_sensors_cb(zb_uint8_t arg) { LOG_INF("Updating sensors"); + ZB_SCHEDULE_APP_ALARM(update_sensors_cb, + /*param=*/0, + ZB_TIME_ONE_SECOND * CONFIG_PRST_ZB_SLEEP_DURATION_SEC); + if (prst_sensors_read_all(&sensors)) { LOG_ERR("Unable to read sensors"); return; @@ -198,10 +202,6 @@ void update_sensors_cb(zb_uint8_t arg) { prst_zb_set_attr_value(ZB_ZCL_CLUSTER_ID_ILLUMINANCE_MEASUREMENT, ZB_ZCL_ATTR_ILLUMINANCE_MEASUREMENT_MEASURED_VALUE_ID, &log_lux); - - ZB_SCHEDULE_APP_ALARM(update_sensors_cb, - /*param=*/0, - ZB_TIME_ONE_SECOND * CONFIG_PRST_ZB_SLEEP_DURATION_SEC); } int main(void) {