Jump to content
The simFlight Network Forums

JessicaZ

new Members
  • Content count

    2
  • Joined

  • Last visited

Community Reputation

0 Neutral

About JessicaZ

  • Rank
    Newbie

Profile Information

  • Gender
    Female
  • Location
    San Francisco
  1. Thank you so much! This really works well! I modified the script slightly, but this really is an idea solution. Jessica -- Using a trim wheel axis to operate with trim INC and DEC instead -- http://forum.simflight.com/topic/72492-using-a-trim-wheel-axis-to-operate-with-trim-inc-and-dec-instead/ -- -- [Auto] -- 1=Lua trimwheel -- assign your axis, in the normal FS controls assignment on the left, to "Luavalue trimwheel". boundary = 16384-2048 function trimwheel_trim(change) trim = ipc.readSW(0x0BC0) - change if trim < -16384 then trim = -16384 elseif trim > 16383 then trim = 16383 end ipc.writeSW(0x0BC0, trim) end function trimwheel_ap_vs(change) if ipc.readUW(0x07BC) == 0 then -- AP disabled trimwheel_trim(change) elseif change > 0 then ipc.control(65895) -- AP_VS_VAR_DEC elseif change < 0 then ipc.control(65894) -- AP_VS_VAR_INC end end function trimwheel_ap_pitch(change) if ipc.readUW(0x07BC) == 0 then -- AP disabled trimwheel_trim(change) elseif change > 0 then ipc.control(66584) -- AP_PITCH_REF_INC_DN elseif change < 0 then ipc.control(66583) -- AP_PITCH_REF_INC_UP end end function trimwheel_ap_pitch_atthold(change) if ipc.readUW(0x07BC) == 0 then -- AP disabled trimwheel_trim(change) elseif change > 0 then if ipc.readUW(0x07D0) > 0 then -- AP alt lock ipc.control(65804, 1) -- AP_ATT_HOLD_ON end ipc.control(66584) -- AP_PITCH_REF_INC_DN elseif change < 0 then if ipc.readUW(0x07D0) > 0 then -- AP alt lock ipc.control(65804, 1) -- AP_ATT_HOLD_ON end ipc.control(66583) -- AP_PITCH_REF_INC_UP end end function trimwheel_ap_pitch_althold(change) if ipc.readUW(0x07BC) == 0 then -- AP disabled trimwheel_trim(change) elseif change > 0 then if ipc.readUW(0x07D0) > 0 then -- AP alt lock ipc.control(65816, 1) -- AP_ALT_HOLD_OFF end ipc.control(66584) -- AP_PITCH_REF_INC_DN elseif change < 0 then if ipc.readUW(0x07D0) > 0 then -- AP alt lock ipc.control(65816, 1) -- AP_ALT_HOLD_OFF end ipc.control(66583) -- AP_PITCH_REF_INC_UP end end function trimwheel_c182(change) if ipc.readUW(0x07BC) == 0 then -- AP disabled trimwheel_trim(change) elseif change > 0 then ipc.writeLvar("kap140_dn_button", 1) elseif change < 0 then ipc.writeLvar("kap140_up_button", 1) else ipc.writeLvar("kap140_dn_button", 0) ipc.writeLvar("kap140_up_button", 0) end end function aircraftchange(eventtype) if ipc.readSTR(0x3D00, 5) == "C182_" then trimwheel = trimwheel_c182 elseif ipc.readSTR(0x3D00, 12) == "Carenado A36" then trimwheel = trimwheel_ap_vs else trimwheel = trimwheel_trim end end aircraftchange(nil) -- initialize at least once function checkvalue(val) if prev ~= nil and val ~= prev then -- axis moved if math.abs(val) > boundary then ipc.display(string.format( "Warning:\n\n" .. "Trim wheel value near boundary: %d\n" .. "Reconnect to restore full range.\n", val), 10) else ipc.display("") end trimwheel(val - prev) end prev = val end event.sim(AIRCRAFTCHANGE, "aircraftchange") event.param("checkvalue")
  2. This appears to be an ideal solution to using my Saitek Pro Trim Wheel, but I ran into some caveats. 1) At least with the Saitek trim wheel, I had to reverse the values in the Lua script, which is an easy fix. I did: function checkvalue(val) if prev ~= nil then if val > prev then ipc.control(65607) elseif val < prev then ipc.control(65615) end end prev = val end event.param("checkvalue") 2) If I turn the trim wheel too quickly, I do not get the full range of movement in the sim trim indication. When I move the trim wheel quickly from its' lowest to highest positions, on the sim it is only moved about half way through its' range of motion. If I move it slowly, I can get the full range of motion. I suspect the trim wheel is sending the nose up/nose down commands too quickly and some of the commands are being ignored. Is there anyway to fix this? 3) The last issue is something that is a limitation with the Saitek Trim Wheel, and cannot be fixed FSUIPC, but I am mentioning it as it is unexpected. The issue is that the trim wheel has limits to the values it can send nose up or down, but turning the wheel there is no indication you have reached full nose up or down, or where you are in the range. That means, if trim wheel is physically at nose up (or down), before you start the simulator, then in the sim you cannot trim more nose up (or down). In this case having a trim wheel that does not have physical limits would be ideal. I wonder if the Saitek can be modified. Internally it uses a optical rotary position sensor. This can somewhat worked around by going into FSUIPC and seeing what the position of the trim wheel is at and setting it to roughly what sim trim position you want to start with. I am using Prepar3d v4.1 and FSUIPC v5.121b Jessica
×