EasyManua.ls Logo

Espressif ESP32-S2 - Page 165

Espressif ESP32-S2
1695 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
Chapter 2. API Reference
esp_err_t esp_mesh_set_active_duty_cycle(int dev_duty, int dev_duty_type)
Set the device duty cycle and type.
The range of dev_duty values is 1 to 100. The default value is 10.
dev_duty = 100, the PS will be stopped.
dev_duty is better to not less than 5.
dev_duty_type could be MESH_PS_DEVICE_DUTY_REQUEST or
MESH_PS_DEVICE_DUTY_DEMAND.
If dev_duty_type is set to MESH_PS_DEVICE_DUTY_REQUEST, the device will use a nwk_duty
provided by the network.
If dev_duty_type is set to MESH_PS_DEVICE_DUTY_DEMAND, the device will use the specified
dev_duty.
Attention This API can be called at any time after mesh is started.
Return
ESP_OK
ESP_FAIL
Parameters
[in] dev_duty: device duty cycle
[in] dev_duty_type: device PS duty cycle type, not accept
MESH_PS_NETWORK_DUTY_MASTER
esp_err_t esp_mesh_get_active_duty_cycle(int *dev_duty, int *dev_duty_type)
Get device duty cycle and type.
Return
ESP_OK
Parameters
[out] dev_duty: device duty cycle
[out] dev_duty_type: device PS duty cycle type
esp_err_t esp_mesh_set_network_duty_cycle(int nwk_duty, int duration_mins, int applied_rule)
Set the network duty cycle, duration and rule.
The range of nwk_duty values is 1 to 100. The default value is 10.
nwk_duty is the network duty cycle the entire network or the up-link path will use. A device that suc-
cessfully sets the nwk_duty is known as a NWK-DUTY-MASTER.
duration_mins specifies how long the specified nwk_duty will be used. Once duration_mins expires, the
root will take over as the NWK-DUTY-MASTER. If an existing NWK-DUTY-MASTER leaves the
network, the root will take over as the NWK-DUTY-MASTER again.
duration_mins = (-1) represents nwk_duty will be used until a new NWK-DUTY-MASTER with a dif-
ferent nwk_duty appears.
Only the root can set duration_mins to (-1).
If applied_rule is set to MESH_PS_NETWORK_DUTY_APPLIED_ENTIRE, the nwk_duty will be
used by the entire network.
If applied_rule is set to MESH_PS_NETWORK_DUTY_APPLIED_UPLINK, the nwk_duty will only
be used by the up-link path nodes.
The root does not accept MESH_PS_NETWORK_DUTY_APPLIED_UPLINK.
A nwk_duty with duration_mins(-1) set by the root is the default network duty cycle used by the entire
network.
Attention This API can be called at any time after mesh is started.
In self-organized network, if this API is called before mesh is started in all devices, (1)nwk_duty
shall be set to the same value for all devices; (2)duration_mins shall be set to (-1); (3)applied_rule
shall be set to MESH_PS_NETWORK_DUTY_APPLIED_ENTIRE; after the voted root appears,
the root will become the NWK-DUTY-MASTER and broadcast the nwk_duty and its identity of
NWK-DUTY-MASTER.
If the root is specified (FIXED-ROOT), call this API in the root to provide a default nwk_duty for
the entire network.
After joins the network, any device can call this API to change the nwk_duty, duration_mins or
applied_rule.
Return
Espressif Systems 154
Submit Document Feedback
Release v4.4

Table of Contents