Skip to content

Commit 8c3efc2

Browse files
committed
fix(zigbee): set rx on idle and alloc address
1 parent 9660e66 commit 8c3efc2

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

libraries/Zigbee/src/ZigbeeCore.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ ZigbeeCore::ZigbeeCore() {
2121
_started = false;
2222
_connected = false;
2323
_scan_duration = 4; // maximum scan duration
24+
_rx_on_when_idle = true;
2425
if (!lock) {
2526
lock = xSemaphoreCreateBinary();
2627
if (lock == NULL) {
@@ -98,7 +99,7 @@ static void esp_zb_task(void *pvParameters) {
9899

99100
//NOTE: This is a workaround to make battery powered devices to be discovered as battery powered
100101
if (((zigbee_role_t)Zigbee.getRole() == ZIGBEE_END_DEVICE) && edBatteryPowered) {
101-
zb_set_ed_node_descriptor(0, 0, 0);
102+
zb_set_ed_node_descriptor(0, _rx_on_when_idle, 1);
102103
}
103104

104105
esp_zb_stack_main_loop();

libraries/Zigbee/src/ZigbeeCore.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ class ZigbeeCore {
6767
uint32_t _primary_channel_mask;
6868
int16_t _scan_status;
6969
uint8_t _scan_duration;
70+
bool _rx_on_when_idle;
7071

7172
esp_zb_ep_list_t *_zb_ep_list;
7273
zigbee_role_t _role;
@@ -112,12 +113,17 @@ class ZigbeeCore {
112113
void setHostConfig(esp_zb_host_config_t config);
113114
esp_zb_host_config_t getHostConfig();
114115

116+
void setPrimaryChannelMask(uint32_t mask);
115117
void setPrimaryChannelMask(uint32_t mask); // By default all channels are scanned (11-26) -> mask 0x07FFF800
116118
void setScanDuration(uint8_t duration); // Can be set from 1 - 4. 1 is fastest, 4 is slowest
117119
uint8_t getScanDuration() {
118120
return _scan_duration;
119121
}
120122

123+
void setRxOnWhenIdle(bool rx_on_when_idle) {
124+
_rx_on_when_idle = rx_on_when_idle;
125+
}
126+
121127
void setRebootOpenNetwork(uint8_t time);
122128
void openNetwork(uint8_t time);
123129

0 commit comments

Comments
 (0)