0
0
mirror of https://github.com/Doodle3D/doodle3d-firmware.git synced 2024-12-22 02:53:49 +01:00

Fixed wifi issue

Different approach different solution. Instead of using the API to govern whether or not connection  was succesful the netconfig.lua figurers this out.
This commit is contained in:
olijf 2016-03-23 13:33:14 +01:00
parent 8fb0eba9e6
commit fa91ace160
2 changed files with 11 additions and 2 deletions

View File

@ -386,7 +386,11 @@ function M.associateSsid(ssid, passphrase, recreate)
if attempt >= maxAttempts then
-- still no correct ssid; fail
local msg = "Could not associate with network (incorrect password?)"
wifi.removeConfig(ssid)
M.setStatus(M.CONNECTING_FAILED,msg);
local backupssid = wifi.getSubstitutedSsid(settings.get('network.ap.ssid'))
M.setupAccessPoint(backupssid)
M.enableAccessPoint(backupssid)
return false, msg
else
nextAttemptTime = os.time() + attemptInterval

View File

@ -177,11 +177,16 @@ end
function M.removeConfig(ssid)
local rv = false
uci:foreach('wireless', 'wifi-iface', function(s)
log:info(MOD_ABBR, utils.dump(s.ssid).."\n "..utils.dump(s))
if s.ssid == ssid then
uci:delete('wireless', s['.name'])
rv = true
log:info(MOD_ABBR, "deleting faulty ssid: "..utils.dump(s['.name']))
rv = uci:delete('wireless', s['.name'])
end
if s.disabled == 1 then
M.activateConfig(s.ssid)
end
end)
uci:save('wireless')
uci:commit('wireless')
return rv
end