Ai
1 Star 7 Fork 4

合宙Luat/LuatOS-Air724UG

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
idle.lua 1.64 KB
一键复制 编辑 原始数据 按行查看 历史
朱天华 提交于 2021-08-04 10:04 +08:00 . 发布script_LuaTask(2.4.0版本)
--- 模块功能:待机界面
-- @author openLuat
-- @module ui.idle
-- @license MIT
-- @copyright openLuat
-- @release 2018.03.27
module(...,package.seeall)
require"misc"
require"ntp"
require"common"
--appid:窗口id
local appid
--[[
函数名:refresh
功能 :窗口刷新处理
参数 :无
返回值:无
]]
local function refresh()
--清空LCD显示缓冲区
disp.clear()
local oldColor = lcd.setcolor(0xF100)
disp.puttext(common.utf8ToGb2312("待机界面"),lcd.getxpos(common.utf8ToGb2312("待机界面")),0)
local tm = misc.getClock()
local datestr = string.format("%04d",tm.year).."-"..string.format("%02d",tm.month).."-"..string.format("%02d",tm.day)
local timestr = string.format("%02d",tm.hour)..":"..string.format("%02d",tm.min)..":"..string.format("%02d",tm.sec)
--显示日期
lcd.setcolor(0x07E0)
disp.puttext(datestr,lcd.getxpos(datestr),24)
--显示时间
lcd.setcolor(0x001F)
disp.puttext(timestr,lcd.getxpos(timestr),44)
--刷新LCD显示缓冲区到LCD屏幕上
disp.update()
lcd.setcolor(oldColor)
end
--窗口类型的消息处理函数表
local winapp =
{
onUpdate = refresh,
}
--[[
函数名:clkind
功能 :时间更新处理
参数 :无
返回值:无
]]
local function clkind()
if uiWin.isActive(appid) then
refresh()
end
end
--[[
函数名:open
功能 :打开待机界面窗口
参数 :无
返回值:无
]]
function open()
appid = uiWin.add(winapp)
end
ntp.timeSync()
sys.timerLoopStart(clkind,1000)
sys.subscribe("TIME_UPDATE_IND",clkind)
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/openLuat/LuatOS-Air724UG.git
git@gitee.com:openLuat/LuatOS-Air724UG.git
openLuat
LuatOS-Air724UG
LuatOS-Air724UG
master

搜索帮助