Skip to content

Commit

Permalink
dofile('wifi_connect') for wifi wake-up/sleep
Browse files Browse the repository at this point in the history
  • Loading branch information
avaldebe committed Nov 16, 2015
1 parent 6466c00 commit 880b40c
Showing 1 changed file with 2 additions and 10 deletions.
12 changes: 2 additions & 10 deletions lua_modules/sendData.lua
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,7 @@ return function(self,status)
end
self.sent=false

if wifi.sta.status()~=5 then
print('WiFi wakeup')
wifi.sta.connect()
--status('alert')
end
wifi.sleeptype(wifi.NONE_SLEEP)

dofile('wifi_connect.lc')(wifi.STATION,false) -- wifi wake-up
local sk=net.createConnection(net.TCP,0)
--[[Expected sequence of events:
sk:connect(...)
Expand Down Expand Up @@ -72,9 +66,7 @@ return function(self,status)
conn:close()
print(' Disconnected')
gpio.write(0,1)
print('WiFi sleep')
wifi.sleeptype(wifi.MODEM_SLEEP)
wifi.sta.disconnect()
dofile('wifi_connect.lc')(wifi.STATION,true) -- wifi sleep
self.sent=nil
self.last=tmr.time()
status('iddle')
Expand Down

0 comments on commit 880b40c

Please sign in to comment.