From 880b40cf5707ef3cf60a48c7c8b3b2be8e4e06ef Mon Sep 17 00:00:00 2001 From: Alvaro Valdebenito Date: Mon, 16 Nov 2015 23:11:11 +0100 Subject: [PATCH] dofile('wifi_connect') for wifi wake-up/sleep --- lua_modules/sendData.lua | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/lua_modules/sendData.lua b/lua_modules/sendData.lua index 0ba94ce..4766129 100644 --- a/lua_modules/sendData.lua +++ b/lua_modules/sendData.lua @@ -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(...) @@ -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')