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) @@ -20,13 +20,19 @@ function ManualLink(ssid,passwd)
wifi.setmode(wifi.STATION)
StationCfg.ssid=ssid
StationCfg.pwd=passwd
StationCfg.save=true
StationCfg.save=false
wifi.sta.config(StationCfg)
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}
PageLight(lightArr)
--Service Open
StartUDPService();
print(wifi.sta.status());
end
--mobile setting ap and passwd
@ -37,7 +43,7 @@ function AutoLinkByMobile() @@ -37,7 +43,7 @@ function AutoLinkByMobile()
enduser_setup.start(
"DY-Light-Controller",
function()
print("Connected to WiFi as:" .. wifi.sta.getip())
print("Connected to WiFi!")
end,
function(err, str)
print("enduser_setup: Err #" .. err .. ": " .. str)

2
init.lua

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

Loading…
Cancel
Save