Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BUG: LEDSTRIP project doesn't allow WiFi credentials to be set via Improv #371

Closed
rbergen opened this issue Jul 22, 2023 · 7 comments · Fixed by #395
Closed

BUG: LEDSTRIP project doesn't allow WiFi credentials to be set via Improv #371

rbergen opened this issue Jul 22, 2023 · 7 comments · Fixed by #395
Assignees

Comments

@rbergen
Copy link
Collaborator

rbergen commented Jul 22, 2023

Bug report

Problem

The LEDSTRIP project demands WiFi to be connected (WAIT_FOR_WIFI is defined as 1), and bails out by rebooting if it isn't. This is handled by lines 629 to 637 in main.cpp.
If no WiFi credentials are available at boot, the code in lines 224 to 228 in network.cpp immediately gives up on WiFi connectivity, leading to the device rebooting very early in the boot process.

Although this makes sense if the project is flashed using a method that requires WiFi credentials to be set in secrets.h, it creates a problem if the project is flashed using the web installer, Part of that workflow is the setting of WiFi credentials using Improv. For the LEDSTRIP project that's impossible because the device is stuck in a boot loop by the time the user has a chance to enter their WiFi credentials.

Solution

If WAIT_FOR_WIFI is set to 1, the device should allow enough time for the user to enter WiFi credentials.

Note

This problem was first reported in issue #367. I'm opening this specific issue at @davepl's request.

@robertlipe
Copy link
Contributor

robertlipe commented Jul 22, 2023 via email

@davepl
Copy link
Contributor

davepl commented Jul 22, 2023 via email

@robertlipe
Copy link
Contributor

OK, there's a bug that nobody wants to tackle. That seems the real bug, but I get those can be hard.

Why not let it blink out an error message OR just run the provided effects until it reboots? Then at least people will have a clue what's wrong and/or the benefit of it If that timeout is a minute, it would then at least work 55 seconds (mine takes ~5 seconds to boot) out of the first minute.

From a user perspective, working partially or working mostly seems preferable to being just dead. Imagine building a Halloween costume that works great in your home, but only silently boot loops when you're out of WiFi range. Maybe you build A Thing and now it silently fails when you get to Maker Faire. I DO hear your point about the ladder, but it seems better to work at least somewhat when you can.

If I need to put code where my mouth is, I'll try to implement a "works with no wifi" mode, including a decaying backoff timer on retries up to some max if that helps it run longer for that case. Little Josh may appreciate it.

FTR, I agree that a self-reboot on heap corruption or depletion IS right right action to take. I'm not against reboots in all cases.

@davepl
Copy link
Contributor

davepl commented Jul 23, 2023 via email

@robertlipe
Copy link
Contributor

Apparently there was a bug in the IDF (That's the ESP32 platform SDK) part of the Arduino stuff that could result in parts not always getting a DHCP lease.

espressif/arduino-esp32#7068 (comment)

People have confirmed that updating IDF helped. I don't know what IDF this project is using or when the stuck DHCP's were observed, but it's possible that the fundamental problem might be behind us.

I get that's not totally the point of this report, but it may be worth investigating if intermittent DHCP jamups are actually being observed in the field.

@sdmtr
Copy link

sdmtr commented Aug 5, 2023

The core problem as described in the bug report is that a reboot definitively cannot correct a situation in which wifi credentials haven't been supplied, which will always be the case when flashing LEDSTRIP from the web installer. There isn't enough time between the board booting and rebooting for the web installer to ask the user to supply credentials and then send them through to the board, so no matter what, anyone who tries to install LEDSTRIP from the web installer will never, ever be able to use their board, and they'll have no idea why unless they inspect the console output and put two and two together.

@rbergen rbergen assigned rbergen and unassigned davepl Aug 5, 2023
@rbergen
Copy link
Collaborator Author

rbergen commented Aug 5, 2023

I've opened #395 to fix this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants