Relaunch wifi on esp_now_init failure

Signed-off-by: Sara Damiano <sdamiano@stroudcenter.org>
This commit is contained in:
Sara Damiano 2022-04-09 15:50:21 -04:00
parent 1f3bb675ba
commit df772b5c0a
1 changed files with 4 additions and 0 deletions

View File

@ -387,6 +387,10 @@ void MESHstartNode(int32_t _channel, uint8_t _role){ //we need a running broker
MESHsetWifi(0);
if (esp_now_init() != 0) {
AddLog(LOG_LEVEL_INFO, PSTR("MSH: Node init failed"));
// try to re-launch wifi
MESH.role = ROLE_NONE;
MESHsetWifi(1);
WifiBegin(3, MESH.channel);
return;
}