|
|
@ -9,24 +9,20 @@ print("Oled Init Success!"); |
|
|
|
Screen_WIFINAME = ""; |
|
|
|
Screen_WIFINAME = ""; |
|
|
|
Screen_IPADDRESS = ""; |
|
|
|
Screen_IPADDRESS = ""; |
|
|
|
Screen_VERSION = ""; |
|
|
|
Screen_VERSION = ""; |
|
|
|
--tips to user link-AP |
|
|
|
Screen_LightArr = {} |
|
|
|
function PageAPNet() |
|
|
|
--tips user use pc tools to link-AP |
|
|
|
|
|
|
|
function PageSerialNet() |
|
|
|
Disp:clearBuffer() |
|
|
|
Disp:clearBuffer() |
|
|
|
--Disp:setFont(u8g2.font_unifont_t_symbols); |
|
|
|
|
|
|
|
Disp:setFont(u8g2.font_unifont_t_symbols); |
|
|
|
Disp:setFont(u8g2.font_unifont_t_symbols); |
|
|
|
Disp:drawStr(0,10,"AP-LinkMode"); |
|
|
|
Disp:drawStr(0,10,"Serial-LinkMode"); |
|
|
|
Disp:setFont(u8g2.font_6x10_tf); |
|
|
|
Disp:setFont(u8g2.font_6x10_tf); |
|
|
|
Disp:drawStr(0,26,"Please use your"); |
|
|
|
Disp:drawStr(0,26,"Open NetTools.exe "); |
|
|
|
Disp:drawStr(0,36,"mobile phone search"); |
|
|
|
Disp:drawStr(0,36,"input ssid and pwd."); |
|
|
|
Disp:drawStr(0,46,"and link ap-point"); |
|
|
|
|
|
|
|
Disp:drawStr(0,56,"DY-Light-Controller"); |
|
|
|
|
|
|
|
Disp:updateDisplay(); |
|
|
|
Disp:updateDisplay(); |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
--progress:1-100,tips loading and update from server |
|
|
|
--progress:1-100,tips loading and update from server |
|
|
|
function PageLoading(progress) |
|
|
|
function PageLoading(progress) |
|
|
|
Disp:clearBuffer(); |
|
|
|
Disp:clearBuffer(); |
|
|
|
--Disp:setFont(u8g2.font_unifont_t_symbols); |
|
|
|
|
|
|
|
Disp:setFont(u8g2.font_unifont_t_symbols); |
|
|
|
Disp:setFont(u8g2.font_unifont_t_symbols); |
|
|
|
Disp:drawStr(40,10,"DYTech"); |
|
|
|
Disp:drawStr(40,10,"DYTech"); |
|
|
|
Disp:setFont(u8g2.font_6x10_tf); |
|
|
|
Disp:setFont(u8g2.font_6x10_tf); |
|
|
@ -36,14 +32,13 @@ function PageLoading(progress) |
|
|
|
Disp:updateDisplay(); |
|
|
|
Disp:updateDisplay(); |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
-- |
|
|
|
|
|
|
|
function PageMainScene(wifiName,ipAddress,version) |
|
|
|
function PageMainScene(wifiName,ipAddress,version) |
|
|
|
Disp:clearBuffer(); |
|
|
|
|
|
|
|
DrawMainScene(wifiName,ipAddress,version) |
|
|
|
|
|
|
|
Disp:updateDisplay(); |
|
|
|
|
|
|
|
Screen_WIFINAME = wifiName; |
|
|
|
Screen_WIFINAME = wifiName; |
|
|
|
Screen_IPADDRESS = ipAddress; |
|
|
|
Screen_IPADDRESS = ipAddress; |
|
|
|
Screen_VERSION = version; |
|
|
|
Screen_VERSION = version; |
|
|
|
|
|
|
|
Disp:clearBuffer(); |
|
|
|
|
|
|
|
DrawMainScene(Screen_WIFINAME,Screen_IPADDRESS,Screen_VERSION) |
|
|
|
|
|
|
|
Disp:updateDisplay(); |
|
|
|
--Disp:sendBuffer(); |
|
|
|
--Disp:sendBuffer(); |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
@ -57,23 +52,47 @@ function DrawMainScene(wifiName,ipAddress,version) |
|
|
|
Disp:drawStr(0,46,"S:"..ipAddress..":5000"); |
|
|
|
Disp:drawStr(0,46,"S:"..ipAddress..":5000"); |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
function PageLight(lightArr) |
|
|
|
function DrawLight(lightArr) |
|
|
|
Disp:clearBuffer(); |
|
|
|
|
|
|
|
DrawMainScene(Screen_WIFINAME,Screen_IPADDRESS,Screen_VERSION); |
|
|
|
|
|
|
|
Disp:drawCircle(16,56,4,u8g2.U8G2_DRAW_ALL); |
|
|
|
Disp:drawCircle(16,56,4,u8g2.U8G2_DRAW_ALL); |
|
|
|
Disp:drawCircle(32,56,4,u8g2.U8G2_DRAW_ALL); |
|
|
|
Disp:drawCircle(32,56,4,u8g2.U8G2_DRAW_ALL); |
|
|
|
Disp:drawCircle(48,56,4,u8g2.U8G2_DRAW_ALL); |
|
|
|
Disp:drawCircle(48,56,4,u8g2.U8G2_DRAW_ALL); |
|
|
|
Disp:drawCircle(64,56,4,u8g2.U8G2_DRAW_ALL); |
|
|
|
Disp:drawCircle(64,56,4,u8g2.U8G2_DRAW_ALL); |
|
|
|
|
|
|
|
Screen_LightArr = lightArr; |
|
|
|
for index, value in ipairs(lightArr) do |
|
|
|
for index, value in ipairs(lightArr) do |
|
|
|
if value then |
|
|
|
if value then |
|
|
|
Disp:drawDisc(16*index,56,4,u8g2.U8G2_DRAW_ALL); |
|
|
|
Disp:drawDisc(16*index,56,4,u8g2.U8G2_DRAW_ALL); |
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function PageLight(lightArr) |
|
|
|
|
|
|
|
Disp:clearBuffer(); |
|
|
|
|
|
|
|
DrawMainScene(Screen_WIFINAME,Screen_IPADDRESS,Screen_VERSION); |
|
|
|
|
|
|
|
DrawLight(lightArr); |
|
|
|
Disp:sendBuffer(); |
|
|
|
Disp:sendBuffer(); |
|
|
|
--Disp:updateDisplayArea(0,0,64,64); |
|
|
|
|
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
--PageMainScene("DF2","192.168.1.115","V1.0") |
|
|
|
function RefeshIP(ipAddress) |
|
|
|
--local lightArr = {[1]=true,[2]=false,[3]=true,[4]=true} |
|
|
|
Screen_IPADDRESS = ipAddress; |
|
|
|
--PageLight(lightArr) |
|
|
|
Disp:clearBuffer(); |
|
|
|
--PageAPNet() |
|
|
|
DrawMainScene(Screen_WIFINAME,Screen_IPADDRESS,Screen_VERSION); |
|
|
|
|
|
|
|
DrawLight(Screen_LightArr); |
|
|
|
|
|
|
|
Disp:sendBuffer(); |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function PageConnecting() |
|
|
|
|
|
|
|
Disp:clearBuffer() |
|
|
|
|
|
|
|
Disp:setFont(u8g2.font_6x10_tf); |
|
|
|
|
|
|
|
Disp:drawStr(0,10,"Connecting to internet"); |
|
|
|
|
|
|
|
Disp:drawStr(0,36,"Waiting..."); |
|
|
|
|
|
|
|
Disp:updateDisplay(); |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function PageConnectFaild(reason) |
|
|
|
|
|
|
|
Disp:clearBuffer() |
|
|
|
|
|
|
|
Disp:setFont(u8g2.font_unifont_t_symbols); |
|
|
|
|
|
|
|
Disp:drawStr(0,10,"Connect Failed"); |
|
|
|
|
|
|
|
Disp:setFont(u8g2.font_6x10_tf); |
|
|
|
|
|
|
|
Disp:drawStr(0,26,reason); |
|
|
|
|
|
|
|
Disp:updateDisplay(); |
|
|
|
|
|
|
|
end |
|
|
|