diff --git a/src/SCRIPTS/BF/CMS/common.lua b/src/SCRIPTS/BF/CMS/common.lua index 6c1f703..b562fed 100644 --- a/src/SCRIPTS/BF/CMS/common.lua +++ b/src/SCRIPTS/BF/CMS/common.lua @@ -70,12 +70,14 @@ screen = { cms = { menuOpen = false, + synced = false, init = function(cmsConfig) screen.config = assert(cmsConfig, "Resolution not supported") screen.reset() screen.clear() protocol.cms.close() cms.menuOpen = false + cms.synced = false end, open = function() protocol.cms.open(screen.config.rows, screen.config.cols) @@ -112,6 +114,7 @@ cms = { screen.buffer = cRleDecode(screen.data) screen.draw() screen.reset() + cms.synced = true end else protocol.cms.refresh() diff --git a/src/SCRIPTS/BF/cms.lua b/src/SCRIPTS/BF/cms.lua index 15ca339..364bf05 100644 --- a/src/SCRIPTS/BF/cms.lua +++ b/src/SCRIPTS/BF/cms.lua @@ -1,16 +1,25 @@ -lastMenuEventTime = 0 +local lastMenuEventTime = 0 +local INTERVAL = 80 local function init() cms.init(radio) end +local function stickMovement() + local threshold = 30 + return math.abs(getValue('ele')) > threshold or math.abs(getValue('ail')) > threshold or math.abs(getValue('rud')) > threshold +end + local function run(event) - lastMenuEventTime = getTime() + if stickMovement() then + cms.synced = false + lastMenuEventTime = getTime() + end cms.update() if (cms.menuOpen == false) then cms.open() end - if (event == radio.refresh.event) then + if (event == radio.refresh.event) or (lastMenuEventTime + INTERVAL < getTime() and not cms.synced) then cms.refresh() end if (event == EVT_VIRTUAL_EXIT) then