Open duhovny opened 8 years ago
the while(1) will only reboot the microcontroller if there's a watchdog configured, and this usually isn't the case in Arduino stuff.
it's also not necessary to reboot the microcontroller when the WiFly reboots since it'll usually auto-reconnect and keep most of the same config, especially for use cases where you use open(). in my branch I have replaced the while(1) with a delay(2000) and return false. this gives a little time for the reconnect and lets the calling code decide what to do next.
additionally, the jmp 0 may not work on non-AVR platforms. the library is otherwise microcontroller agnostic and it would be nice to keep it that way.
The reboot (reset) was actually being triggered by the XBee carrier connected back to the Arduino when the WiFly rebooted. Not all of the carrier boards do this, so yes this is not a general solution.
Also, I would think the firmware bug in the WiFly that was causing the it to reboot is fixed by now? Haven't been testing new firmware for quite a while...
I think I managed to trigger this code, but it wasn't a firmware bug, it was something else doing the wrong thing and getting to that getprompt when it should have backed out earlier, or something. I don't recall now, I've actually fixed a ton of things recently in my branch, pull req coming soon.
@chrwei I agree, there should be a proper fix — I just fixed existing hack.
'while (1)' didn't reboot on some Arduino models, replaced with more reliable solution.