mesh/ps: network duty signaling

pull/6828/head
shenjun 2021-03-12 16:39:24 +08:00 zatwierdzone przez bot
rodzic 3bc3407aeb
commit f9fe524c32
4 zmienionych plików z 22 dodań i 12 usunięć

Wyświetl plik

@ -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 8f951ea341721767731e18a260847f6306fc68b7
Subproject commit 8aa2b953691b35a64775efe48ebc4c22dfc96cd0

Wyświetl plik

@ -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.

Wyświetl plik

@ -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(),