简体中文
简体中文
English
注册
登录
简体中文
简体中文
English
注册
登录
语言
简体中文
简体中文
English
注册
登录

低功耗 ZIgbee 子设备 poll 及 Rejoin 如何配置?

更新时间2024-02-18 06:44:42
Poll 配置
/*
* Zigbee poll configuration
*/
typedef struct {
UINT8_T forever_flag; ///< TRUE: forever poll if device no network(TAL_ZG_NWK_POWER_ON_ONLINE/TAL_ZG_NWK_JOIN_OK/TAL_ZG_NWK_REJOIN_OK)
UINT8_T fast_swicth_parent; ///< TRUE: if ack isn't received, will continue polling until the max number of failures is reached before switching the parent
UINT16_T interval_ms; ///< poll period (bet: ms)
UINT16_T max_failed_times; ///< enter parent-lost status when poll failed x times.
UINT16_T duration_after_data_ms; ///< tiemout waitting app ack (bet: ms)
UINT_T duration_after_join_ms; ///< wakeup time when join success.(for gateway get cluser data) (bet:ms)
UINT_T duration_after_rejoin_ms; ///< wakeup time when rejoin success.(for app use) (bet:ms)
} TAL_ZG_POLL_CFG_T;
Rejoin 配置
/*
* Zigbee end-device rejoin config
*/
typedef struct {
UINT8_T power_on_active; ///< auto rejoin when power on.
UINT8_T send_data_active; ///< auto rejoin when send data if parent lost.
UINT8_T reserved; ///< Reserved
UINT8_T attempts; ///< max rejoin attempts when parent lost.
UINT16_T interval; ///< rejoin attempt interval when parent lost.
} TAL_ZG_REJOIN_CFG_T;
注册设备
/**
* @brief register router or sleep device
* @return none
*/
STATIC VOID_T app_sleep_device_node_init(VOID_T)
{
// sleep end device node init
TAL_ZG_NODE_CFG_T node_config = {
.node_type = ZG_SLEEPY_END_DEVICE,
.tx_power = 10,
.scan_interval = 100,
.scan_duration = ZG_SCAN_DURATION_3,
.config.sleep_ed_cfg.poll_config.forever_flag = 1,
.config.sleep_ed_cfg.poll_config.fast_swicth_parent = 1,
.config.sleep_ed_cfg.poll_config.interval_ms = 250,
.config.sleep_ed_cfg.poll_config.max_failed_times = 10,
.config.sleep_ed_cfg.poll_config.duration_after_data_ms = 1000,
.config.sleep_ed_cfg.poll_config.duration_after_join_ms = 60000,
.config.sleep_ed_cfg.poll_config.duration_after_rejoin_ms = 15000,
.config.sleep_ed_cfg.rejoin_config.power_on_active = 1,
.config.sleep_ed_cfg.rejoin_config.send_data_active = 1,
.config.sleep_ed_cfg.rejoin_config.attempts = 3,
.config.sleep_ed_cfg.rejoin_config.interval = 3000,
};
//config zigbee node
tal_zg_node_config(&node_config);
}
元素作用补充说明
forever_flag在网时设备是否定时向父节点请求数据如果有网关下发数据给该设备的需求,建议开启,例如单火开关。像门磁等只有状态上报而没有下发交互的设备,可以置为false
fast_swicth_parent一般用于forever_flagfalse时,快速判断是否与父节点断开连接forever_flagfalse时,设备发送一组数据请求可能没法感知已经与父节点失联,fast_swicth_parent置为true后,会持续发送数据请求直到感知到已与父节点失联,从而可以快速重连网络。
interval_ms设置数据请求的发送间隔-
max_failed_times发送多少次数据请求没有响应会触发重连-
duration_after_data_ms在网发送一次数据后连续的数据请求持续时间duration_after_data_ms除以interval_ms是对应的请求次数
duration_after_join_ms配网成功时连续的数据请求持续时间duration_after_join_ms除以interval_ms是对应的请求次数
duration_after_rejoin_ms重连成功时连续的数据请求持续时间duration_after_rejoin_ms除以interval_ms是对应的请求次数
power_on_active使能与父节点失联状态时,上电主动触发重连机制建议开启
send_data_active使能与父节点失联状态时,发送数据时触发重连机制建议开启
attempts与父节点失联状态时,触发重连机制一组发多少次 beacon request-
interval与父节点失联状态时,触发重连机制一组隔多久发一次 beacon request-
示例:一次重连尝试 3 次 beacon request,每次 beacon request 间隔 3 秒。

点击获取服务和帮助

帮助中心