[reMarkable] Don't need to keep attempting WiFi connection after success (#7121)

If we're in range of multiple known WiFi Access Points (including multiple instances of the same SSID), we don't need to keep trying to connect after the first successful connection.

Minimal change would have been replacing the return inside the foreach function with return [a non-nil value].
But foreach is deprecated, and since I was touching the code anyhow, I figured I'd do that tiny update as well.
reviewable/pr7155/r1
Glen Sawyer 3 years ago committed by GitHub
parent 5c9dc850e8
commit 7753577616
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -594,23 +594,22 @@ function NetworkMgr:reconnectOrShowNetworkMenu(complete_callback)
table.sort(network_list,
function(l, r) return l.signal_quality > r.signal_quality end)
local success = false
table.foreach(network_list,
function(idx, network)
if network.password then
success = NetworkMgr:authenticateNetwork(network)
if success then
NetworkMgr:obtainIP()
if complete_callback then
complete_callback()
end
UIManager:show(InfoMessage:new{
text = T(_("Connected to network %1"), BD.wrap(network.ssid)),
timeout = 3,
})
return
end
end
end)
for dummy, network in ipairs(network_list) do
if network.password then
success = NetworkMgr:authenticateNetwork(network)
if success then
NetworkMgr:obtainIP()
if complete_callback then
complete_callback()
end
UIManager:show(InfoMessage:new{
text = T(_("Connected to network %1"), BD.wrap(network.ssid)),
timeout = 3,
})
break
end
end
end
if not success then
UIManager:show(require("ui/widget/networksetting"):new{
network_list = network_list,

Loading…
Cancel
Save