初始提交
This commit is contained in:
202
gui/main.lua
Normal file
202
gui/main.lua
Normal file
@ -0,0 +1,202 @@
|
||||
--<2D><><EFBFBD><EFBFBD><EFBFBD>г<EFBFBD><D0B3>˳<EFBFBD><CBB3>õĻص<C4BB><D8B5><EFBFBD><EFBFBD><EFBFBD>
|
||||
--<2D><><EFBFBD><EFBFBD><E0B9A6><EFBFBD><EFBFBD><EFBFBD>Ķ<EFBFBD><<LUA<55>ű<EFBFBD>API.pdf>>
|
||||
|
||||
--<2D><>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
--function on_init()
|
||||
--end
|
||||
|
||||
--<2D><>ʱ<EFBFBD>ص<EFBFBD><D8B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϵͳÿ<CDB3><C3BF>1<EFBFBD><31><EFBFBD><EFBFBD><EFBFBD>Զ<EFBFBD><D4B6><EFBFBD><EFBFBD>á<EFBFBD>
|
||||
--function on_systick()
|
||||
--end
|
||||
|
||||
--<2D>û<EFBFBD>ͨ<EFBFBD><CDA8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ŀؼ<C4BF><D8BC><EFBFBD><EFBFBD><EFBFBD>ִ<EFBFBD>д˻ص<CBBB><D8B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
--<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ť<EFBFBD>ؼ<EFBFBD><D8BC><EFBFBD><EFBFBD><EFBFBD><DEB8>ı<EFBFBD><C4B1>ؼ<EFBFBD><D8BC><EFBFBD><EFBFBD>Ļ<DEB8><C4BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ᴥ<EFBFBD><E1B4A5><EFBFBD><EFBFBD><EFBFBD>¼<EFBFBD><C2BC><EFBFBD>
|
||||
--function on_control_notify(screen,control,value)
|
||||
--end
|
||||
|
||||
--<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>л<EFBFBD>ʱ<EFBFBD><CAB1>ִ<EFBFBD>д˻ص<CBBB><D8B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>screenΪĿ<CEAA>껭<EFBFBD>档
|
||||
--function on_screen_change(screen)
|
||||
--end
|
||||
local progress = 0
|
||||
local meter_value = 0
|
||||
local meter_flag = 0
|
||||
local Progress_screenid = 5
|
||||
local Meter_screenid = 6
|
||||
local Slider_screendid = 7
|
||||
local RTC_screenid = 8
|
||||
local Seltor_screenid = 13
|
||||
local Historicalcurve_screenid = 16
|
||||
local Audioscreen_id = 17
|
||||
local Languagescreen_id = 18
|
||||
local Bootanimation_id = 39
|
||||
local CatTime = 4
|
||||
|
||||
function on_init()
|
||||
--set_button_notify_release()
|
||||
start_timer(0,1000,0,0)
|
||||
local language_id = get_language()
|
||||
if language_id == 0 then
|
||||
set_value(Languagescreen_id,1,1)
|
||||
set_value(Languagescreen_id,2,0)
|
||||
end
|
||||
if language_id == 1 then
|
||||
set_value(Languagescreen_id,2,1)
|
||||
set_value(Languagescreen_id,1,0)
|
||||
end
|
||||
end
|
||||
|
||||
function on_timer(timer_id)
|
||||
if timer_id==1
|
||||
then
|
||||
if meter_value <=0 --С<><D0A1>0ʱ<30><CAB1><EFBFBD><EFBFBD>ֵ<EFBFBD><D6B5>
|
||||
then
|
||||
meter_flag = 0
|
||||
end
|
||||
if meter_value >=270 --<2D><><EFBFBD><EFBFBD>0ʱ<30><CAB1><EFBFBD><EFBFBD>ֵ<EFBFBD><D6B5>
|
||||
then
|
||||
meter_flag = 1
|
||||
end
|
||||
if meter_flag ==0
|
||||
then
|
||||
set_value(Meter_screenid,1,meter_value)
|
||||
set_value(Meter_screenid,5,meter_value) --ָ<><D6B8>ת<EFBFBD><D7AA>
|
||||
meter_value = meter_value+2 --<2D><>ֵ<EFBFBD><D6B5><EFBFBD><EFBFBD>
|
||||
end
|
||||
if meter_flag ==1
|
||||
then
|
||||
set_value(Meter_screenid,1,meter_value)
|
||||
set_value(Meter_screenid,5,meter_value) --ָ<><D6B8>ת<EFBFBD><D7AA>
|
||||
meter_value = meter_value-2 --<2D><>ֵ<EFBFBD><D6B5><EFBFBD><EFBFBD>
|
||||
end
|
||||
end
|
||||
if timer_id == 0 then
|
||||
local Curve_value = math.random(1,254)
|
||||
set_history_graph_value(Historicalcurve_screenid,1,Curve_value)
|
||||
end
|
||||
if timer_id == 2 then
|
||||
if get_current_screen() == Bootanimation_id then
|
||||
CatTime = CatTime - 1
|
||||
set_value(Bootanimation_id,3,CatTime)
|
||||
if CatTime == 0 then
|
||||
change_screen(0)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
|
||||
function on_control_notify(screen,control,value)
|
||||
if screen == Meter_screenid then
|
||||
if control == 4 and value == 1 then
|
||||
start_timer(1,15,0,0)
|
||||
end
|
||||
if control == 4 and value == 0 then
|
||||
stop_timer(1)
|
||||
end
|
||||
end
|
||||
|
||||
if screen == Seltor_screenid then
|
||||
if control == 1 then
|
||||
if value >= 0 and value <= 6 then
|
||||
set_value(screen,3,0)
|
||||
end
|
||||
if value > 6 and value <= 12 then
|
||||
set_value(screen,3,1)
|
||||
end
|
||||
if value > 12 and value <= 18 then
|
||||
set_value(screen,3,2)
|
||||
end
|
||||
if value > 18 and value <= 21 then
|
||||
set_value(screen,3,3)
|
||||
end
|
||||
if value > 21 and value <= 23 then
|
||||
set_value(screen,3,4)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
if screen == RTC_screenid then
|
||||
if control == 8 and value == 0 then
|
||||
local year,mon,day,hour,min,sec,week = get_date_time()
|
||||
if week == 0 then week = "<EFBFBD><EFBFBD>" end
|
||||
if week == 1 then week = "һ" end
|
||||
if week == 2 then week = "<EFBFBD><EFBFBD>" end
|
||||
if week == 3 then week = "<EFBFBD><EFBFBD>" end
|
||||
if week == 4 then week = "<EFBFBD><EFBFBD>" end
|
||||
if week == 5 then week = "<EFBFBD><EFBFBD>" end
|
||||
if week == 6 then week = "<EFBFBD><EFBFBD>" end
|
||||
set_text(screen,1,year)
|
||||
set_text(screen,2,mon)
|
||||
set_text(screen,3,day)
|
||||
set_text(screen,4,hour)
|
||||
set_text(screen,5,min)
|
||||
set_text(screen,6,sec)
|
||||
set_text(screen,7,week)
|
||||
end
|
||||
end
|
||||
if screen == Progress_screenid then
|
||||
if control == 3
|
||||
then
|
||||
if value == 0 or value == 2
|
||||
then
|
||||
progress = progress - 1
|
||||
if progress <= 0
|
||||
then
|
||||
progress = 0
|
||||
end
|
||||
set_value(screen,1,progress)
|
||||
set_value(screen,2,progress)
|
||||
end
|
||||
elseif control == 1
|
||||
then
|
||||
set_value(screen, 2, value)
|
||||
progress = value
|
||||
elseif control == 4
|
||||
then
|
||||
if value == 0 or value == 2
|
||||
then
|
||||
progress = progress + 1
|
||||
if progress >= 100
|
||||
then
|
||||
progress = 100
|
||||
end
|
||||
set_value(screen,1,progress)
|
||||
set_value(screen,2,progress)
|
||||
end
|
||||
end
|
||||
end
|
||||
if screen == Slider_screendid then
|
||||
if control == 2 then
|
||||
set_value(screen,3,value)
|
||||
set_backlight(value)
|
||||
end
|
||||
if control == 5 then
|
||||
set_value(screen,6,value)
|
||||
end
|
||||
end
|
||||
end
|
||||
function on_video_notify(msg,v1,v2)
|
||||
for i = 3, 5 do
|
||||
set_visiable(Bootanimation_id,i,0)
|
||||
end
|
||||
local anim_id = get_current_screen()
|
||||
if anim_id == Bootanimation_id and msg == 0 then
|
||||
change_screen(0)
|
||||
end
|
||||
end
|
||||
function on_audio_callback(state)
|
||||
set_value(Audioscreen_id,3,0)
|
||||
set_value(Audioscreen_id,4,0)
|
||||
end
|
||||
|
||||
|
||||
function on_screen_change(screen)
|
||||
if screen == Bootanimation_id then
|
||||
start_timer(2,1000,0,4)
|
||||
set_value(screen,3,CatTime)
|
||||
end
|
||||
end
|
Reference in New Issue
Block a user