- Power Saving for ZED
- For sleepy end devices (RxOffWhenIdle = TRUE), ZBOSS provides a mechanism for power saving. ZBOSS scheduler tracks the callback queue and if there is no immediate callback for execution and there is no outgoing packet on the MAC level, a special signal ZB_COMMON_SIGNAL_CAN_SLEEP is sent to an application. The "can sleep" signal has a sleep time parameter that indicates allowed sleep duration in milliseconds.
Sleep duration value is based on the time remaining before the first alarm is called or it is set to 10 seconds if there are no alarms in the queue. Upon receiving ZB_COMMON_SIGNAL_CAN_SLEEP the application analyzes its internal state and decides whether to enter the sleep mode or not. To go to the sleep mode, the application should call the zb_sleep_now() function.
§ ZB_MAXIMUM_SLEEP_THRESHOLD_MS
| #define ZB_MAXIMUM_SLEEP_THRESHOLD_MS 86400000U |
§ ZB_SCHED_SLEEP_THRESHOLD_MS
| #define ZB_SCHED_SLEEP_THRESHOLD_MS 20U |
§ zb_get_sleep_threshold()
§ zb_sleep_now()
| void zb_sleep_now |
( |
void |
| ) |
|
§ zb_sleep_set_threshold()