广州大彩串口屏论坛_大彩开发者交流论坛

 找回密码
 立即注册
搜索
热搜: 活动 交友 discuz
查看: 1153|回复: 3

M系类的如何在LUA脚本下调用屏幕刷新频率

[复制链接]

2

主题

4

帖子

34

积分

新手上路

Rank: 1

积分
34
发表于 2023-9-13 13:49:59 | 显示全部楼层 |阅读模式
目前写了个工程在串口屏上总是不流畅,而在虚拟屏上还是很流畅的。
回复

使用道具 举报

2

主题

1253

帖子

1万

积分

论坛元老

Rank: 8Rank: 8

积分
12543
发表于 2023-9-13 14:50:54 | 显示全部楼层
用了什么协议吗?
Easy doesn't enter into Grown-up life
成年人的生活里面没有“容易”二字
回复

使用道具 举报

2

主题

4

帖子

34

积分

新手上路

Rank: 1

积分
34
 楼主| 发表于 2023-9-13 15:02:21 | 显示全部楼层
没用什么协议,这是代码
timer=359
function on_init()
set_value(0,3,timer)

end

--定时回调函数,系统每隔1秒钟自动调用。
--function on_systick()
--end

--定时器超时回调函数,当设置的定时器超时时,执行此回调函数,timer_id为对应的定时器ID
function on_timer(timer_id)
if        timer_id==0                then
        if                timer>0                        then
                timer=timer+10
local timer1=timer+5
local timer2=timer+35
local timer3=timer+70
if timer1>=360 then
timer1=timer1-360
end
  if timer2>=360 then
timer2=timer2-360
end  
  if timer3>=360 then
timer3=timer3-360
end  
if timer>=360 then
timer=timer-360
end  
set_value(0,5,timer1)
                set_value(0,4,timer2)
                set_value(0,3,timer)
        set_value(0,6,timer3)
        end
        if timer==0 then
    timer=360
end
end


end

--用户通过触摸修改控件后,执行此回调函数。
--点击按钮控件,修改文本控件、修改滑动条都会触发此事件。



function on_control_notify(screen,control,value)
if screen==0 and control==2 and value ==1 then
start_timer(0,50,1,0)
end
if screen==0 and control==2 and value ==0 then
stop_timer(0)
end
if screen==0 and control==4  then
local timer1=get_value (0,4) & 0xFFFF
if timer1<0 then
timer1=timer1+360
end
timer=timer1
set_value(0,3,timer)
end

end


用了按按钮控件和旋转控件
回复

使用道具 举报

2

主题

1253

帖子

1万

积分

论坛元老

Rank: 8Rank: 8

积分
12543
发表于 2023-9-13 16:14:36 | 显示全部楼层
黑猫 发表于 2023-9-13 15:02
没用什么协议,这是代码
timer=359
function on_init()

试一下,将脚本重命名,然后重新下载工程,看看还会不会卡
Easy doesn't enter into Grown-up life
成年人的生活里面没有“容易”二字
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|Archiver|手机版|小黑屋|广州大彩串口屏论坛_大彩开发者交流论坛

GMT+8, 2024-5-3 14:41 , Processed in 0.052698 second(s), 18 queries .

Powered by Discuz! X3.4

Copyright © 2001-2020, Tencent Cloud.

快速回复 返回顶部 返回列表