Skip to content

Instantly share code, notes, and snippets.

@cpuwolf
Created October 25, 2025 10:55
Show Gist options
  • Select an option

  • Save cpuwolf/f1f7803a6b7ae7dfe3e69bad73efcae3 to your computer and use it in GitHub Desktop.

Select an option

Save cpuwolf/f1f7803a6b7ae7dfe3e69bad73efcae3 to your computer and use it in GitHub Desktop.
QMOVH-A PMDG-777 christmas tree blink, must run inside QmdevSimConnect 5.0 and above
-- *****************************************************************
-- created by Wei Shuai <[email protected]> 2025-10-21
-- *****************************************************************
if ilua_is_acfpath_excluded("PMDG") or ilua_is_acfpath_excluded("777") then
return
end
-- Do not remove below lines: hardware detection
local qmovha = com.sim.qm.Qmovha:new()
if not qmovha:Init() then
return
end
-- Do not remove above lines: hardware detection
uluaLog("QMOVH-A of PMDG B777")
x = 0
function blink777()
local b = 5
local TIM2_PERIOD = 40
local y
y = (b * x) - ((b * b * x * x) / (4 * TIM2_PERIOD));
x = x + 1
x = x % ((4 * TIM2_PERIOD) / b);
-- Seed the random number generator with the current time
math.randomseed(os.time())
-- Generate a random number between 1 and 0xFF
local range1 = math.random(1, 255)
local range2 = math.random(1, 255)
local range3 = math.random(1, 255)
local range = range1 * 255 * 255 + range2 * 255 + range3
uluaSet(idr_qmovh_a_hid_dnled_int, range)
uluaSet(idr_qmovh_a_hid_upled1_int, range)
uluaSet(idr_qmovh_a_hid_upled2_int, range)
uluaSet(idr_qmovh_a_hid_bright_int, y)
end
uluasetInterval("blink777()", 100)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment