1 Star 0 Fork 2

田胜蓝/nodemcu

forked from zhangoneone/nodemcu 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
gui_src.lua 1.56 KB
一键复制 编辑 原始数据 按行查看 历史
zhangoneone 提交于 2022-12-11 08:24 . 调整一下文字位置
gui_src = {}
function gui_src.net_config_display()
local disp = gui_mgr.get_disp()
disp:drawUTF8(40, 5, "wifi")
if wifi_mgr.ip ~= nil then
disp:drawUTF8(0, 20, "ip:"..wifi_mgr.ip)
else
disp:drawUTF8(0, 20, "ip:".."getting...")
end
--[[
if wifi_mgr.nm ~= nil then
disp:drawUTF8(0, 14, "nm:"..wifi_mgr.nm)
else
disp:drawUTF8(0, 14, "nm:".."getting...")
end
--]]
if wifi_mgr.gw ~= nil then
disp:drawUTF8(0, 35, "gw:"..wifi_mgr.gw)
else
disp:drawUTF8(0, 35, "gw:".."getting...")
end
--[[
if wifi_mgr.mac ~= nil then
disp:drawUTF8(0, 42, wifi_mgr.mac)
else
disp:drawUTF8(0, 42, "mac:".."getting...")
end
--]]
end
function gui_src.weather_display()
local disp = gui_mgr.get_disp()
local str1 = "--------"
local weat_map = {["晴"] = "sunny",["阴"] = "cloudy",["多云"] = "cloudy",["雨"] = "cloudy",}
local ymd, hms = ntp.get_tim_str2()
local t, h, we, wind = json.weather["temperature"],
json.weather["humidity"], json.weather["text"],
json.weather["wind_speed"]
if h ~=nil and t ~=nil then
str1 = t.."度".." "..h.."%".." "..weat_map[we]
end
--if we ~=nil and wind ~=nil then
-- str2 = "风力:"..wind
--end
disp:drawUTF8(10, 5, str1)
if ymd ~= nil then
disp:drawUTF8(20, 45, ymd)
else
disp:drawUTF8(20, 45, "----")
end
if hms ~= nil then
disp:drawUTF8(30, 25, hms)
else
disp:drawUTF8(30, 25, "----")
end
end
return gui_src
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Lua
1
https://gitee.com/tianword/nodemcu.git
git@gitee.com:tianword/nodemcu.git
tianword
nodemcu
nodemcu
master

搜索帮助