Page 1 of 1

mesh_rssi_threshold_t has no documentation at all

Posted: Tue Sep 19, 2023 8:58 am
by martins
Hello, I'm trying to adjust connetion rssi thresholds in ESP-WIFI-MESH and found following in esp_mesh_internal.h :

Code: Select all

typedef struct {
    int duration_ms;   /* parent weak RSSI monitor duration, if the RSSI continues to be weak during this duration_ms, device will search for a new parent. */
    int cnx_rssi;      /* RSSI threshold for keeping a good connection with parent.
                          If set a value greater than -120 dBm, a timer will be armed to monitor parent RSSI at a period time of duration_ms. */
    int select_rssi;   /* RSSI threshold for parent selection. It should be a value greater than switch_rssi. */
    int switch_rssi;   /* Disassociate with 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;
While the mesh_switch_parent_t has at least some comments to get a hint of what it is doing, the mesh_rssi_threshold_t has none whatsoever, ohter than its default values.
Source code for `esp_err_t esp_mesh_set_rssi_threshold(const mesh_rssi_threshold_t *threshold)` is closed so I have no way to figure this out. Could you please clarify what are these levels for?

Re: mesh_rssi_threshold_t has no documentation at all

Posted: Wed Sep 27, 2023 9:33 am
by zhangyanjiao
`esp_err_t esp_mesh_set_rssi_threshold(const mesh_rssi_threshold_t *threshold)` is used to set the RSSI threshold of the current parent. And if the parent's rssi is lower than `threshold->low` for a period time of `duration_ms`, then the mesh node will post `MESH_WEAK_RSSI` event.
The `threshold->low`, `threshold->high`, `threshold->medium` also be used when the mesh node want to switch parent, they are used to determine whether the new parent and the current parent are in the same rssi range.