Skip to content

Commit aa9763a

Browse files
committed
samples: adjust light switch keepalive mechanism
When the parent router supports "MAC Data Poll Keepalive" method only, using `zb_set_keepalive_timeout()` is equivalent to establishing the poll period. However, if the parent router supports "End Device Timeout Request Keepalive" method, the end device will send End Device Timeout Requests according to the `zb_set_keepalive_timeout()` configuration. These messages have their corresponding End Device Timeout Responses, leading to an increment of the radio usage and consequently, power consumption increase. This commit makes use of `zb_zdo_pim_set_long_poll_interval()` to establish the periodicity of the Data Requests, which determine the latency of the device, while keeping a larger periodicity for the keepalive messages (in case parent router doesn't support "End Device Timeout Request Keepalive" method. Signed-off-by: Eduardo Montoya <[email protected]>
1 parent a54a025 commit aa9763a

File tree

1 file changed

+3
-1
lines changed
  • samples/light_switch/src

1 file changed

+3
-1
lines changed

samples/light_switch/src/main.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -646,6 +646,8 @@ void zboss_signal_handler(zb_bufid_t bufid)
646646
/* Call default signal handler. */
647647
ZB_ERROR_CHECK(zigbee_default_signal_handler(bufid));
648648
if (status == RET_OK) {
649+
zb_zdo_pim_set_long_poll_interval(3000);
650+
649651
/* Check the light device address. */
650652
if (bulb_ctx.short_addr == 0xFFFF) {
651653
k_timer_start(&bulb_ctx.find_alarm,
@@ -833,7 +835,7 @@ int main(void)
833835

834836
zigbee_erase_persistent_storage(ERASE_PERSISTENT_CONFIG);
835837
zb_set_ed_timeout(ED_AGING_TIMEOUT_64MIN);
836-
zb_set_keepalive_timeout(ZB_MILLISECONDS_TO_BEACON_INTERVAL(3000));
838+
zb_set_keepalive_timeout(ZB_MILLISECONDS_TO_BEACON_INTERVAL(30000));
837839

838840
/* Set default bulb short_addr. */
839841
bulb_ctx.short_addr = 0xFFFF;

0 commit comments

Comments
 (0)