Search the Community
Showing results for tags 'Code'.
Found 1 result
-
Hey there. Having copied the HDG Bug code (hdg plusfast & hdg minusfast) which allows a fast spin of a physical encoder and works a treat, I am completely baffled why the Fast Spin code below for VOR1 - VOR2 & ADF will not work, any ideas / help please. I confirm that the normal calls work (VOR1_plus (and minus) | VOR2_plus (and minus) ADF_plus (and minus) but they are painfully slow. I have used the User.lua to enter the code in to Linda 3.0.9 v2 (FSUIPC is up to date) Shut Linda down and restarted no luck. Many Thanks Roger PS Sorted now - I had forgotten to set the variables.. see below -- ## Rotaries functions -- ## VOR1 --Orignal function _VOR1_OBI_DEC (p) ipc.control( 65662, p ) end --Orignal function _VOR1_OBI_INC (p) ipc.control( 65663, p ) end function VOR1_plus (a, b, c) if c == nil then _VOR1_OBI_INC () return end sync_vor1 = round(c / 360 * 65536) ipc.writeUW(0x07CC, sync_vor1) end function VOR1_plusfast (a, b, c) if c == nil then for i = 1, fast_vor1 do _VOR1_OBI_INC () end return end sync_vor1 = round(c / 360 * 65536) ipc.writeUW(0x07CC, sync_vor1) end function VOR1_minus (a, b, c) if c == nil then _VOR1_OBI_DEC () return end sync_vor1 = round(c / 360 * 65536) ipc.writeUW(0x07CC, sync_vor1) end function VOR1_minusfast (a, b, c) if c == nil then for i = 1, fast_vor1 do _VOR1_OBI_DEC () end return end sync_vor1 = round(c / 360 * 65536) ipc.writeUW(0x07CC, sync_vor1) end -- ## VOR2 -- Orignal function _VOR2_OBI_DEC (p) ipc.control( 65664, p ) end -- Orignal function _VOR2_OBI_INC (p) ipc.control( 65665, p ) end function VOR2_plus (a, b, c) if c == nil then _VOR2_OBI_INC () return end sync_vor2 = round(c / 360 * 65536) ipc.writeUW(0x07CC, sync_vor2) end function VOR2_plusfast (a, b, c) if c == nil then for i = 1, fast_vor2 do _VOR2_OBI_INC () end return end sync_vor2 = round(c / 360 * 65536) ipc.writeUW(0x07CC, sync_vor2) end function VOR2_minus (a, b, c) if c == nil then _VOR2_OBI_DEC () return end sync_vor2 = round(c / 360 * 65536) ipc.writeUW(0x07CC, sync_vor2) end function VOR2_minusfast (a, b, c) if c == nil then for i = 1, fast_vor2 do _VOR2_OBI_DEC () end return end sync_vor2 = round(c / 360 * 65536) ipc.writeUW(0x07CC, sync_vor2) end -- ## ADF -- Orignal function _ADF_CARD_DEC (p) ipc.control( 65882, p ) end -- Orignal function _ADF_CARD_INC (p) ipc.control( 65881, p ) end function ADF_plus (a, b, c) if c == nil then _ADF_CARD_INC () return end sync_adf = round(c / 360 * 65536) ipc.writeUW(0x07CC, sync_adf) end function ADF_plusfast (a, b, c) if c == nil then for i = 1, fast_adf do _ADF_CARD_INC () end return end sync_adf = round(c / 360 * 65536) ipc.writeUW(0x07CC, sync_adf) end function ADF_minus (a, b, c) if c == nil then _ADF_CARD_DEC () return end sync_adf = round(c / 360 * 65536) ipc.writeUW(0x07CC, sync_adf) end function ADF_minusfast (a, b, c) if c == nil then for i = 1, fast_adf do _ADF_CARD_DEC () end return end sync_adf = round(c / 360 * 65536) ipc.writeUW(0x07CC, sync_adf) end -- ## DUPLICATE HDG BUG function HDG_plus (a, b, c) if c == nil then _HEADING_BUG_INC () return end sync_hdg = round(c / 360 * 65536) ipc.writeUW(0x07CC, sync_hdg) end function HDG_plusfast (a, b, c) if c == nil then for i = 1, fast_hdg do _HEADING_BUG_INC () end return end sync_hdg = round(c / 360 * 65536) ipc.writeUW(0x07CC, sync_hdg) end function HDG_minus (a, b, c) if c == nil then _HEADING_BUG_DEC () return end sync_hdg = round(c / 360 * 65536) ipc.writeUW(0x07CC, sync_hdg) end function HDG_minusfast (a, b, c) if c == nil then for i = 1, fast_hdg do _HEADING_BUG_DEC () end return end sync_hdg = round(c / 360 * 65536) ipc.writeUW(0x07CC, sync_hdg) end