mirror of
				https://github.com/espressif/esp-idf.git
				synced 2025-10-31 13:09:38 +00:00 
			
		
		
		
	Merge branch 'mesh/bugfix' into 'master'
mesh: update libs See merge request idf/esp-idf!2580
This commit is contained in:
		| @@ -43,12 +43,23 @@ typedef struct { | ||||
| typedef struct { | ||||
|     int duration_ms;   /* parent weak RSSI monitor duration, if the RSSI continues to be weak during this duration_ms, | ||||
|                           will switch to a better parent */ | ||||
|     int cnx_rssi;      /* RSSI threshold for keeping a good connection with parent */ | ||||
|     int cnx_rssi;      /* RSSI threshold for keeping a good connection with parent. | ||||
|                           if set a value greater than -120 dBm, will arm a timer to monitor current RSSI at a period time of | ||||
|                           duration_ms. if keep the default value(-120 dBm), a timer at a random period(<3minutes) will | ||||
|                           be armed to switch a better parent if there does have one. | ||||
|                           The better parent must have RSSI greater than a high RSSI threshold(-78 dBm by default) and a top layer | ||||
|                           than current one. */ | ||||
|     int select_rssi;   /* RSSI threshold for parent selection, should be a value greater than switch_rssi */ | ||||
|     int switch_rssi;   /* RSSI threshold for action to reselect a better parent */ | ||||
|     int switch_rssi;   /* Disassociate current parent and switch to a new parent when the RSSI is greater than this set threshold */ | ||||
|     int backoff_rssi;  /* RSSI threshold for connecting to the root */ | ||||
| } mesh_switch_parent_t; | ||||
|  | ||||
| typedef struct { | ||||
|     int high; | ||||
|     int medium; | ||||
|     int low; | ||||
| } mesh_rssi_threshold_t; | ||||
|  | ||||
| /** | ||||
|  * @brief mesh networking IE | ||||
|  */ | ||||
| @@ -74,13 +85,13 @@ typedef struct { | ||||
|     uint16_t self_cap;       /**< self capacity */ | ||||
|     uint16_t layer2_cap;     /**< layer2 capacity */ | ||||
|     uint16_t scan_ap_num;    /**< the number of scanned APs */ | ||||
|     int8_t rssi;             /**< rssi of the parent */ | ||||
|     int8_t router_rssi;      /**< rssi of the router */ | ||||
|     int8_t rssi;             /**< RSSI of the parent */ | ||||
|     int8_t router_rssi;      /**< RSSI of the router */ | ||||
|     uint8_t flag;            /**< flag of networking */ | ||||
|     uint8_t rc_addr[6];      /**< root address */ | ||||
|     int8_t rc_rssi;          /**< root rssi */ | ||||
|     int8_t rc_rssi;          /**< root RSSI */ | ||||
|     uint8_t vote_addr[6];    /**< voter address */ | ||||
|     int8_t vote_rssi;        /**< vote rssi of the router */ | ||||
|     int8_t vote_rssi;        /**< vote RSSI of the router */ | ||||
|     uint8_t vote_ttl;        /**< vote ttl */ | ||||
|     uint16_t votes;          /**< votes */ | ||||
|     uint16_t my_votes;       /**< my votes */ | ||||
| @@ -132,7 +143,7 @@ esp_err_t esp_mesh_set_attempts(mesh_attempts_t *attempts); | ||||
|  * | ||||
|  * @return | ||||
|  *    - ESP_OK | ||||
|  *    - ESP_FAIL | ||||
|  *    - ESP_ERR_MESH_ARGUMENT | ||||
|  */ | ||||
| esp_err_t esp_mesh_get_attempts(mesh_attempts_t *attempts); | ||||
|  | ||||
| @@ -143,7 +154,7 @@ esp_err_t esp_mesh_get_attempts(mesh_attempts_t *attempts); | ||||
|  * | ||||
|  * @return | ||||
|  *    - ESP_OK | ||||
|  *    - ESP_FAIL | ||||
|  *    - ESP_ERR_MESH_ARGUMENT | ||||
|  */ | ||||
| esp_err_t esp_mesh_set_switch_parent_paras(mesh_switch_parent_t *paras); | ||||
|  | ||||
| @@ -154,10 +165,46 @@ esp_err_t esp_mesh_set_switch_parent_paras(mesh_switch_parent_t *paras); | ||||
|  * | ||||
|  * @return | ||||
|  *    - ESP_OK | ||||
|  *    - ESP_FAIL | ||||
|  *    - ESP_ERR_MESH_ARGUMENT | ||||
|  */ | ||||
| esp_err_t esp_mesh_get_switch_parent_paras(mesh_switch_parent_t *paras); | ||||
|  | ||||
| /** | ||||
|  * @brief     set RSSI threshold | ||||
|  *            The default high RSSI threshold value is -78 dBm. | ||||
|  *            The default medium RSSI threshold value is -82 dBm. | ||||
|  *            The default low RSSI threshold value is -85 dBm. | ||||
|  * | ||||
|  * @param     threshold  RSSI threshold | ||||
|  * | ||||
|  * @return | ||||
|  *    - ESP_OK | ||||
|  *    - ESP_ERR_MESH_ARGUMENT | ||||
|  */ | ||||
| esp_err_t esp_mesh_set_rssi_threshold(const mesh_rssi_threshold_t *threshold); | ||||
|  | ||||
| /** | ||||
|  * @brief     get RSSI threshold | ||||
|  * @param     threshold  RSSI threshold | ||||
|  * | ||||
|  * @return | ||||
|  *    - ESP_OK | ||||
|  *    - ESP_ERR_MESH_ARGUMENT | ||||
|  */ | ||||
| esp_err_t esp_mesh_get_rssi_threshold(mesh_rssi_threshold_t *threshold); | ||||
|  | ||||
| /** | ||||
|  * @brief     enable the minimum rate to 6Mbps | ||||
|  * | ||||
|  * @attention This API shall be called before WiFi start. | ||||
|  * | ||||
|  * @param     is_6m  enable or not | ||||
|  * | ||||
|  * @return | ||||
|  *    - ESP_OK | ||||
|  */ | ||||
| esp_err_t esp_mesh_set_6m_rate(bool is_6m); | ||||
|  | ||||
| /** | ||||
|  * @brief     print the number of txQ waiting | ||||
|  * | ||||
| @@ -195,6 +242,29 @@ esp_err_t esp_mesh_set_passive_scan_time(int time_ms); | ||||
|  */ | ||||
| int esp_mesh_get_passive_scan_time(void); | ||||
|  | ||||
| /** | ||||
|  * @brief     set announce interval | ||||
|  *            The default short interval is 500 milliseconds. | ||||
|  *            The default long interval is 3000 milliseconds. | ||||
|  * | ||||
|  * @param     short_ms  shall be greater than the default value | ||||
|  * @param     long_ms  shall be greater than the default value | ||||
|  * | ||||
|  * @return | ||||
|  *    - ESP_OK | ||||
|  */ | ||||
| esp_err_t esp_mesh_set_announce_interval(int short_ms, int long_ms); | ||||
|  | ||||
| /** | ||||
|  * @brief     get announce interval | ||||
|  * | ||||
|  * @param     short_ms  short interval | ||||
|  * @param     long_ms  long interval | ||||
|  * | ||||
|  * @return | ||||
|  *    - ESP_OK | ||||
|  */ | ||||
| esp_err_t esp_mesh_get_announce_interval(int *short_ms, int *long_ms); | ||||
|  | ||||
| #ifdef __cplusplus | ||||
| } | ||||
|   | ||||
 Submodule components/esp32/lib updated: 67fe3bdfb2...1f2b30fc41
									
								
							| @@ -372,14 +372,6 @@ void app_main(void) | ||||
|     memcpy((uint8_t *) &cfg.mesh_ap.password, CONFIG_MESH_AP_PASSWD, | ||||
|            strlen(CONFIG_MESH_AP_PASSWD)); | ||||
|     ESP_ERROR_CHECK(esp_mesh_set_config(&cfg)); | ||||
|     /* set RSSI threshold for connecting to the root */ | ||||
|     mesh_switch_parent_t switch_paras ; | ||||
|     ESP_ERROR_CHECK(esp_mesh_get_switch_parent_paras(&switch_paras)); | ||||
|     switch_paras.select_rssi = -55; | ||||
|     switch_paras.cnx_rssi = -65; | ||||
|     switch_paras.duration_ms = 120 * 1000; | ||||
|     switch_paras.switch_rssi = -65; | ||||
|     ESP_ERROR_CHECK(esp_mesh_set_switch_parent_paras(&switch_paras)); | ||||
|     /* mesh start */ | ||||
|     ESP_ERROR_CHECK(esp_mesh_start()); | ||||
|     ESP_LOGI(MESH_TAG, "mesh starts successfully, heap:%d, %s\n",  esp_get_free_heap_size(), | ||||
|   | ||||
							
								
								
									
										14
									
								
								examples/mesh/manual_networking/README.md
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										14
									
								
								examples/mesh/manual_networking/README.md
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,14 @@ | ||||
| # Mesh Manual Networking Example | ||||
|  | ||||
| ESP-MESH provides the function of self-organized networking, but if users disable this function on one node, users must designate a parent for this node. | ||||
|  | ||||
|  | ||||
| This example demonstrates how to scan a list of parent candidates, choose an appropriate parent and set as the parent of this node. | ||||
|  | ||||
| If no parent is found through this scan, enable the self-organized function to let the ESP-MESH handle it by itself. | ||||
|  | ||||
| Run `make menuconfig` to configure the mesh network channel, router SSID, router password and mesh softAP settings. | ||||
|  | ||||
| When the mesh network is established and if you happen to run this example on ESP-WROVER-KIT boards, the RGB light indicator will show you on which layer devices are. The pink reprents root; the yellow reprents layer 2; the red reprents layer 3; the blue reprents layer 4; the green reprents layer 5; the white reprents layer greater than 5. | ||||
|  | ||||
|  | ||||
		Reference in New Issue
	
	Block a user
	 Jiang Jiang Jian
					Jiang Jiang Jian