ソースを参照

additional string checking due to upload timeouts causing the file to contain a space

etisab 10 年 前
コミット
dc07d7a110
2 ファイル変更6 行追加2 行削除
  1. 5 1
      BUILD/init.lua
  2. 1 1
      BUILD/sendYo.lua

+ 5 - 1
BUILD/init.lua

@@ -30,7 +30,11 @@ tmr.alarm(STARTUP_DELAY_TIMER, 3000, 0, function ()
   yoRecipientExists = file.open('yorecipient.txt', 'r')
   YO_RECIPIENT = file.read()
   file.close()
-  debugMsg('found recipient: ' .. tostring(YO_RECIPIENT))
+  if YO_RECIPIENT then
+    YO_RECIPIENT = string.gsub(YO_RECIPIENT, '\n', '')
+    YO_RECIPIENT = string.gsub(YO_RECIPIENT, ' ', '')
+  end
+  debugMsg('found recipient:' .. tostring(YO_RECIPIENT) .. '.')
 
   apiKeyExists = file.open('apikey.txt', 'r')
   API_KEY = file.read()

+ 1 - 1
BUILD/sendYo.lua

@@ -1,7 +1,7 @@
 wifi.sleeptype(wifi.NONE_SLEEP)
 wifi.setmode(wifi.STATION)
 
-if YO_RECIPIENT then
+if YO_RECIPIENT ~= nil and YO_RECIPIENT ~= '' then
 	debugMsg('sending yo to ' .. YO_RECIPIENT)
 	local contentString = "api_token=" .. API_KEY .. "&username="..string.upper(YO_RECIPIENT)
 	local contentLength = string.len(contentString)