Browse Source

fixed udp service bugs

master
DESKTOP-B25GA9E\W35 1 year ago
parent
commit
eb8240ecb2
  1. 14
      WifiMgr.lua
  2. 2
      init.lua

14
WifiMgr.lua

@ -20,13 +20,19 @@ function ManualLink(ssid,passwd)
wifi.setmode(wifi.STATION) wifi.setmode(wifi.STATION)
StationCfg.ssid=ssid StationCfg.ssid=ssid
StationCfg.pwd=passwd StationCfg.pwd=passwd
StationCfg.save=true StationCfg.save=false
wifi.sta.config(StationCfg) wifi.sta.config(StationCfg)
wifi.sta.connect() wifi.sta.connect()
PageMainScene(ssid,wifi.sta.getip().."","V1.0"); if wifi.sta.getip() == nil then
SetIP("192.168.1.115","255.255.255.0","192.168.1.1")
print("No Ip get,default to 192.168.1.115!");
end
PageMainScene(ssid,wifi.sta.getip(),"V1.0");
local lightArr = {[1]=false,[2]=false,[3]=false,[4]=false} local lightArr = {[1]=false,[2]=false,[3]=false,[4]=false}
PageLight(lightArr) PageLight(lightArr)
--Service Open
StartUDPService();
print(wifi.sta.status());
end end
--mobile setting ap and passwd --mobile setting ap and passwd
@ -37,7 +43,7 @@ function AutoLinkByMobile()
enduser_setup.start( enduser_setup.start(
"DY-Light-Controller", "DY-Light-Controller",
function() function()
print("Connected to WiFi as:" .. wifi.sta.getip()) print("Connected to WiFi!")
end, end,
function(err, str) function(err, str)
print("enduser_setup: Err #" .. err .. ": " .. str) print("enduser_setup: Err #" .. err .. ": " .. str)

2
init.lua

@ -6,8 +6,6 @@ require("OLED_SSD1306")
require("WifiMgr") require("WifiMgr")
require("UDPService") require("UDPService")
function Init() function Init()
SetIP("192.168.1.115","255.255.255.0","192.168.1.1");
AutoLink(); AutoLink();
--StartUDPService();
end end
Init(); Init();

Loading…
Cancel
Save