Quellcode durchsuchen

remove yo module wifi dependency

etisab vor 10 Jahren
Ursprung
Commit
7bc640f616
2 geänderte Dateien mit 6 neuen und 3 gelöschten Zeilen
  1. 6 0
      rebuild/main.lua
  2. 0 3
      rebuild/yo.lua

+ 6 - 0
rebuild/main.lua

@@ -19,15 +19,21 @@ function wifi_setup(func, ...)
     auth = wifi.AUTH_OPEN
   })
   wifi.ap.dhcp.start()
+  wifi.sleeptype(wifi.NONE_SLEEP)
 
   func(...)
+
+  --TODO wifi_setup inactivity timeout
 end
 
 function wifi_default(func, ...)
   server.stop()
   wifi.setmode(wifi.STATION)
+  wifi.sleeptype(wifi.NONE_SLEEP)
 
   func(...)
+
+  wifi.sleeptype(wifi.MODEM_SLEEP)
 end
 
 function short_press()

+ 0 - 3
rebuild/yo.lua

@@ -1,5 +1,4 @@
 local http = http
-local wifi = wifi
 local string = string
 local assert = assert
 local type = type
@@ -17,14 +16,12 @@ function yo(yo_user, api_token)
   local content_length = string.len(content_string)
 
   debug_message('yo.yo: sending Yo')
-  wifi.sleeptype(wifi.NONE_SLEEP)
   http.post(
     'https://api.justyo.co/yo/',
     'Content-Type: application/x-www-form-urlencoded\r\n' ..
     'Content-length: ' .. content_length .. '\r\n',
     content_string,
     function(status_code, response_data)
-      wifi.sleeptype(wifi.LIGHT_SLEEP)
       debug_message('yo.yo: status code: ' .. status_code)
       debug_message('yo.yo: response data: ' .. (response_data or 'nil'))
     end