Skip to content

Commit 5e9ec0a

Browse files
committed
fix(hosted): Fix Hosted deinit and protect reinit for now
1 parent a62841b commit 5e9ec0a

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

Diff for: libraries/WiFi/src/WiFiGeneric.cpp

+4-1
Original file line numberDiff line numberDiff line change
@@ -253,11 +253,13 @@ static bool wifiHostedInit() {
253253
conf.pin_d2.pin = CONFIG_ESP_SDIO_PIN_D2;
254254
conf.pin_d3.pin = CONFIG_ESP_SDIO_PIN_D3;
255255
//conf.pin_rst.pin = CONFIG_ESP_SDIO_GPIO_RESET_SLAVE;
256+
// esp_hosted_sdio_set_config() will fail on second attempt but here temporarily to not cause exception on reinit
256257
if (esp_hosted_sdio_set_config(&conf) != ESP_OK || esp_hosted_init() != ESP_OK) {
257258
log_e("esp_hosted_init failed!");
258259
hosted_initialized = false;
259260
return false;
260261
}
262+
log_v("ESP-HOSTED initialized!");
261263
}
262264
// Attach pins to PeriMan here
263265
// Slave chip model is CONFIG_IDF_SLAVE_TARGET
@@ -346,8 +348,9 @@ static bool wifiLowLevelDeinit() {
346348
arduino_event.event_id = ARDUINO_EVENT_WIFI_OFF;
347349
Network.postEvent(&arduino_event);
348350
#if CONFIG_ESP_WIFI_REMOTE_ENABLED
349-
if (!hosted_initialized && esp_hosted_deinit() == ESP_OK) {
351+
if (hosted_initialized && esp_hosted_deinit() == ESP_OK) {
350352
hosted_initialized = false;
353+
log_v("ESP-HOSTED uninitialized!");
351354
// detach SDIO pins from PeriMan
352355
}
353356
#endif

0 commit comments

Comments
 (0)