Merge branch 'mesh/ps_duty_signaling_backport_v4.2' into 'release/v4.2'

mesh/ps: network duty signaling (backport v4.2)

See merge request espressif/esp-idf!12810
This commit is contained in:
Jiang Jiang Jian 2021-03-23 16:02:56 +00:00
commit def9153200
4 changed files with 22 additions and 13 deletions

View File

@ -212,6 +212,7 @@ typedef enum {
router with the same SSID, this event will be posted and the new router information is attached. */
MESH_EVENT_PS_PARENT_DUTY, /**< parent duty */
MESH_EVENT_PS_CHILD_DUTY, /**< child duty */
MESH_EVENT_PS_DEVICE_DUTY, /**< device duty */
MESH_EVENT_MAX,
} mesh_event_id_t;
@ -237,8 +238,8 @@ typedef enum {
MESH_PROTO_HTTP, /**< HTTP protocol */
MESH_PROTO_JSON, /**< JSON format */
MESH_PROTO_MQTT, /**< MQTT protocol */
MESH_PROTO_AP, /**< IP network mesh communication of node's AP inteface */
MESH_PROTO_STA, /**< IP network mesh communication of node's STA inteface */
MESH_PROTO_AP, /**< IP network mesh communication of node's AP interface */
MESH_PROTO_STA, /**< IP network mesh communication of node's STA interface */
} mesh_proto_t;
/**
@ -1565,7 +1566,7 @@ bool esp_mesh_is_device_active(void);
/**
* @brief Set the device duty cycle and type
* - The range of dev_duty values is 1 to 100. The default value is 12.
* - 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.
@ -1596,7 +1597,7 @@ esp_err_t esp_mesh_get_active_duty_cycle(int* dev_duty, int* dev_duty_type);
/**
* @brief Set the network duty cycle, duration and rule
* - The range of nwk_duty values is 1 to 100. The default value is 12.
* - 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 successfully
* 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
@ -1604,7 +1605,6 @@ esp_err_t esp_mesh_get_active_duty_cycle(int* dev_duty, int* dev_duty_type);
* NWK-DUTY-MASTER again.
* - duration_mins = (-1) represents nwk_duty will be used until a new NWK-DUTY-MASTER with a different nwk_duty appears.
* - Only the root can set duration_mins to (-1).
* - applied_rule could be MESH_PS_NETWORK_DUTY_APPLIED_ENTIRE or MESH_PS_NETWORK_DUTY_APPLIED_UPLINK.
* - 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.
@ -1620,7 +1620,7 @@ esp_err_t esp_mesh_get_active_duty_cycle(int* dev_duty, int* dev_duty_type);
*
* @param[in] nwk_duty network duty cycle
* @param[in] duration_mins duration (unit: minutes)
* @param[in] applied_rule MESH_PS_NETWORK_DUTY_APPLIED_ENTIRE or MESH_PS_NETWORK_DUTY_APPLIED_UPLINK
* @param[in] applied_rule only support MESH_PS_NETWORK_DUTY_APPLIED_ENTIRE
*
* @return
* - ESP_OK
@ -1634,7 +1634,7 @@ esp_err_t esp_mesh_set_network_duty_cycle(int nwk_duty, int duration_mins, int a
* @param[out] nwk_duty current network duty cycle
* @param[out] duration_mins the duration of current nwk_duty
* @param[out] dev_duty_type if it includes MESH_PS_DEVICE_DUTY_MASTER, this device is the current NWK-DUTY-MASTER.
* @param[out] applied_rule MESH_PS_NETWORK_DUTY_APPLIED_ENTIRE or MESH_PS_NETWORK_DUTY_APPLIED_UPLINK
* @param[out] applied_rule MESH_PS_NETWORK_DUTY_APPLIED_ENTIRE
*
* @return
* - ESP_OK
@ -1656,6 +1656,16 @@ esp_err_t esp_mesh_get_network_duty_cycle(int* nwk_duty, int* duration_mins, int
*/
int esp_mesh_get_running_active_duty_cycle(void);
/**
* @brief Duty signaling
*
* @param[in] fwd_times the times of forwarding duty signaling packets
*
* @return
* - ESP_OK
*/
esp_err_t esp_mesh_ps_duty_signaling(int fwd_times);
#ifdef __cplusplus
}
#endif

@ -1 +1 @@
Subproject commit dfe4c8ec6c8edce255fd7f3c3716920b8e9dd9e9
Subproject commit 5ebf229b9940805f0fce91964ae80d0f2c05f5f3

View File

@ -50,7 +50,7 @@ menu "Example Configuration"
int "Mesh PS device duty cycle"
depends on MESH_ENABLE_PS
range 1 100
default 12
default 10
help
Mesh PS device duty cycle.
@ -58,7 +58,7 @@ menu "Example Configuration"
int "Mesh PS network duty cycle"
depends on MESH_ENABLE_PS
range 1 100
default 12
default 10
help
Mesh PS network duty cycle.
@ -163,4 +163,3 @@ menu "Example Configuration"
help
The number of devices over the network(max: 300).
endmenu

View File

@ -438,9 +438,9 @@ void app_main(void)
/* mesh start */
ESP_ERROR_CHECK(esp_mesh_start());
#ifdef CONFIG_MESH_ENABLE_PS
/* set the device active duty cycle. (default:12, MESH_PS_DEVICE_DUTY_REQUEST) */
/* set the device active duty cycle. (default:10, MESH_PS_DEVICE_DUTY_REQUEST) */
ESP_ERROR_CHECK(esp_mesh_set_active_duty_cycle(CONFIG_MESH_PS_DEV_DUTY, CONFIG_MESH_PS_DEV_DUTY_TYPE));
/* set the network active duty cycle. (default:12, -1, MESH_PS_NETWORK_DUTY_APPLIED_ENTIRE) */
/* set the network active duty cycle. (default:10, -1, MESH_PS_NETWORK_DUTY_APPLIED_ENTIRE) */
ESP_ERROR_CHECK(esp_mesh_set_network_duty_cycle(CONFIG_MESH_PS_NWK_DUTY, CONFIG_MESH_PS_NWK_DUTY_DURATION, CONFIG_MESH_PS_NWK_DUTY_RULE));
#endif
ESP_LOGI(MESH_TAG, "mesh starts successfully, heap:%d, %s<%d>%s, ps:%d\n", esp_get_minimum_free_heap_size(),