ogabrielinacio / esp_provisioning_ble

A Flutter plugin for provisioning ESP32 modules with Ble
MIT License
10 stars 3 forks source link

Provisioning stuck at last screen #7

Closed garudaonekh closed 2 days ago

garudaonekh commented 9 months ago

Hi, The provisoning screen keep spinning after giving the wifi password. However, it's already successfull at the ESP32 side.

Here's my esp32 code and I use Security1, I use https://github.com/espressif/esp-idf/blob/v4.4.6/examples/provisioning/wifi_prov_mgr/main/app_main.c

I use android phone. Haven't tested on iOS yet.

THanks;

ogabrielinacio commented 9 months ago

I'll take a look into this and let you know. It's true, things are a bit hectic with the end of the year coming up, so working on the package might be tricky in the near future. But rest assured, I'll prioritize it as soon as I can and get that fix out to you. I'm very happy to hear that you are using an ESP32 and IDF, now your project is much more professional !!! :)

ogabrielinacio commented 8 months ago

@garudaonekh

I apologize for the delay in resolving your issue. Unfortunately, I've been facing some health challenges lately. I assure you I'll prioritize fixing your problem as soon as I'm able.

Do you have anything else to report?

ogabrielinacio commented 7 months ago

Hi @garudaonekh !!

I believe I've found the issue!

To fully understand the problem, access the ESP32 configuration:

Execute the following command in your preferred terminal: idf.py menuconfig Navigate to "Example Configuration." You'll find the option "Max retries before resetting provisioning state machine." It was set to 5 in my case, but you can modify it.

This setting controls the number of attempts the ESP32 makes to connect to the Wi-Fi network after a failed, in my case, occurs an authentication failed in the esp32 side

I (30660) app: Disconnected. Connecting to the AP again... E (30670) wifi_prov_mgr: STA Disconnected E (30670) wifi_prov_mgr: Disconnect reason : 202 E (30670) wifi_prov_mgr: STA Auth Error E (30680) app: Provisioning failed! Reason : Wi-Fi station authentication failed Please reset to factory and retry provisioning I (34050) app: Disconnected. Connecting to the AP again... E (34060) wifi_prov_mgr: STA Disconnected E (34060) wifi_prov_mgr: Disconnect reason : 205 E (34060) wifi:sta is connecting, return error

Even though I sent the correct wifi settings, this error occurred on the esp32 side, so as I defined it in menuconfig, it will try to reconnect to the Wifi 5 times, but before that my code received a Status from the esp32 and that was a WifiConnectionState. ConnectionFailed and that's why it goes to BleWifiConnectionFailedEvent and that calls disposeGettingStatusTimer, which cancels the timer to continue checking if it received a Status, so even if the esp32 tries to reconnect to Wi-Fi and is successful, the application will not receive this because currently it will only receive the first status event, this occurs with all events, "Connected", "Disconnected" and "Failed" event

image

Call the function to dispose the Timer :

image

I'll fix this and get back to you.

ogabrielinacio commented 7 months ago

@garudaonekh

I believe I've resolved the issue! commit : https://github.com/ogabrielinacio/esp_provisioning_ble/commit/f48727a8d7d9fbf524b4a4faa5ade1b6407960f2

ivanhercaz commented 2 days ago

This issue has been opened without response more than 6 months, I am going to close it. @garudaonekh, @ogabrielinacio think he resolves this issue with https://github.com/ogabrielinacio/esp_provisioning_ble/commit/f48727a8d7d9fbf524b4a4faa5ade1b6407960f2. If you still have the same issue, don't hesitate in opening this issue again.