Function esp_idf_svc::sys::esp_mesh_waive_root

source ยท
pub unsafe extern "C" fn esp_mesh_waive_root(
    vote: *const mesh_vote_t,
    reason: i32,
) -> i32
Expand description

@brief Cause the root device to give up (waive) its mesh root status - A device is elected root primarily based on RSSI from the external router. - If external router conditions change, users can call this API to perform a root switch. - In this API, users could specify a desired root address to replace itself or specify an attempts value to ask current root to initiate a new round of voting. During the voting, a better root candidate would be expected to find to replace the current one. - If no desired root candidate, the vote will try a specified number of attempts (at least 15). If no better root candidate is found, keep the current one. If a better candidate is found, the new better one will send a root switch request to the current root, current root will respond with a root switch acknowledgment. - After that, the new candidate will connect to the router to be a new root, the previous root will disconnect with the router and choose another parent instead.

        Root switch is completed with minimal disruption to the whole mesh network.

@attention This API is only called by the root.

@param[in] vote vote configuration - If this parameter is set NULL, the vote will perform the default 15 times.

        - Field percentage threshold is 0.9 by default.
        - Field is_rc_specified shall be false.
        - Field attempts shall be at least 15 times.

@param[in] reason only accept MESH_VOTE_REASON_ROOT_INITIATED for now

@return

  • ESP_OK
  • ESP_ERR_MESH_QUEUE_FULL
  • ESP_ERR_MESH_DISCARD
  • ESP_FAIL