nodesign / weio

weio
http://we-io.net
128 stars 35 forks source link

Bug in parameter Switch automatically to AP if STA network is not found or broken #172

Closed ukicar closed 8 years ago

ukicar commented 9 years ago

Checkbox has never been cabled behind for this functionality. This is the place where variable comes from IDE : https://github.com/nodesign/weio/blob/master/handlers/userSettingsHandler.py#L121

But in config.weio there is nothing called auto_to_ap To resolve this issue we have to

ks156 commented 8 years ago

@ukicar Please confirm this fix and close the issue if OK

drasko commented 8 years ago

@ukicar action from you needed!

ks156 commented 8 years ago

Fix confirmed by @manuIO (email)

ks156 commented 8 years ago

The original fix works if the connection is lost when the board is powered. But if the STA network is not available at system boot, it fall back in AP mode.

From my point of view, the system must stays waiting for the STA network in this case. For example, after a power cut, home routers are often longer to boot than WeIO, and falling back to AP is probably not the intended behavior.

ks156 commented 8 years ago

I propose to transform this part https://github.com/nodesign/weio/blob/master/scripts/run_weio.sh#L118-L127 by :

if grep -q '"auto_to_ap": "YES"' /weio/config.weio; then
    while [ $WIFI_READY -ne 1 ]; do
        echo "WiFi network is not ready. Switching to RESCUE mode."

        # We did not connect even after whole delay expired
        # Something went wrong - got to RESCUE
        /weio/scripts/wifi_set_mode.sh rescue

        # Re-check WiFi
        check_wifi
    done
fi

to prevent an auto reconfiguration if auto_to_ap is not set and the wifi network is not available at boot start.

@ukicar, @drasko, ok with that ?

drasko commented 8 years ago

OK for me. Note - if for some reason you can not log in as a STA (for example typo in the password), you will not come back to AP mode. This will demand manual network set-up, and after that restart of WeIO app.

But this is OK for me, as I suppose that auto_to_ap : "NO" is for advanced users.

ks156 commented 8 years ago

Yeah, but there's a button to fall back in AP if needed. I'll do the change tonight.

drasko commented 8 years ago

OK, +1

ks156 commented 8 years ago

PR #260 merged, and fully tested on my side. Can be closed once the fix is confirmed by someone else.