File tree Expand file tree Collapse file tree 2 files changed +15
-3
lines changed Expand file tree Collapse file tree 2 files changed +15
-3
lines changed Original file line number Diff line number Diff line change @@ -70,12 +70,14 @@ screen = {
70
70
71
71
cms = {
72
72
menuOpen = false ,
73
+ synced = false ,
73
74
init = function (cmsConfig )
74
75
screen .config = assert (cmsConfig , " Resolution not supported" )
75
76
screen .reset ()
76
77
screen .clear ()
77
78
protocol .cms .close ()
78
79
cms .menuOpen = false
80
+ cms .synced = false
79
81
end ,
80
82
open = function ()
81
83
protocol .cms .open (screen .config .rows , screen .config .cols )
@@ -112,6 +114,7 @@ cms = {
112
114
screen .buffer = cRleDecode (screen .data )
113
115
screen .draw ()
114
116
screen .reset ()
117
+ cms .synced = true
115
118
end
116
119
else
117
120
protocol .cms .refresh ()
Original file line number Diff line number Diff line change 1
- lastMenuEventTime = 0
1
+ local lastMenuEventTime = 0
2
+ local INTERVAL = 80
2
3
3
4
local function init ()
4
5
cms .init (radio )
5
6
end
6
7
8
+ local function stickMovement ()
9
+ local threshold = 30
10
+ return math.abs (getValue (' ele' )) > threshold or math.abs (getValue (' ail' )) > threshold or math.abs (getValue (' rud' )) > threshold
11
+ end
12
+
7
13
local function run (event )
8
- lastMenuEventTime = getTime ()
14
+ if stickMovement () then
15
+ cms .synced = false
16
+ lastMenuEventTime = getTime ()
17
+ end
9
18
cms .update ()
10
19
if (cms .menuOpen == false ) then
11
20
cms .open ()
12
21
end
13
- if (event == radio .refresh .event ) then
22
+ if (event == radio .refresh .event ) or ( lastMenuEventTime + INTERVAL < getTime () and not cms . synced ) then
14
23
cms .refresh ()
15
24
end
16
25
if (event == EVT_VIRTUAL_EXIT ) then
You can’t perform that action at this time.
0 commit comments