Jump to content
The simFlight Network Forums

chrisdev01

new Members
  • Content Count

    4
  • Joined

  • Last visited

Community Reputation

0 Neutral

About chrisdev01

  • Rank
    Newbie

Profile Information

  • Gender
    Male
  • Location
    United States
  1. Dave: Thanks for confirming this behavior in FSUIPC. I was assuming (incorrectly) that the command sent on release only applied to momentary toggles and buttons. I'm glad to now know that it works for standard toggle switches too. Kind Regards, Chris
  2. Hello: I am building my first home cockpit panel and I have a question regarding three position toggle switches and the USB boards that support them. I have engaged two different vendors for parts. One vendor provides ON / ON / ON functionality with their USB board, and another only provides ON / OFF / ON functionality for three position switches with their board. I need to control a fuel pump that has Hi / OFF / Lo in P3D (obviously “Low” is simulated since there is no Hi / Lo pump control in P3D, only On / Off). I plan to use Lua script and FSUIPC to read and write to Lvars to get the switch animation along with ipc.Control() functions to effect the pumps. I think this will require a board capable of sending a pulse signal for ON / ON / ON, and that ON / OFF / ON will not work since there will be no pulse sent for the middle position. Can anyone confirm that my assumption is correct, or perhaps enlighten me as to how I might meet my requirements using a board that provides only ON / OFF / ON functionality for three position toggle switches? Thank You! Chris
  3. Pete: Got it working with a couple of simple scripts. Thank you very much for your help! Chris
  4. Hello: I am just starting to scratch the surface of using Lua scripts with FSUIPC. I am trying to solve a problem with the Milviz C310 where the prop condition levers do not move into the feather range using my CH Products throttle quadrant. Despite accurate calibration, moving the hardware prop levers aft of the detents does not move the software levers into the feather range, nor does the prop feather animation get displayed. Instead, the Milviz C310 requires users to right-click the prop lever knobs to feather the props. My current calibration does work for other default and payware prop aircraft. In an effort to have the C310 props go into the feather range using my quadrant, I tried using the FSUIPC Axis Assignments GUI to stack two ranges to the prop levers, aft of the detents, to assign the commands: ~ PROP_PITCH1_SET (with a parameter of -1) ~ TOGGLE_FEATHER_SWITCH_1 After doing so, when I move the hardware prop lever aft of the detent, I can see the commands being set using the FSUIPC log as expected; but the animation in the sim does not move the condition levers to the feather range, and the prop feather animation is not displayed. On the Milviz support forum, the aircraft's developer provided a snippet of right mouse click event code that checks a boolean L variable called Prop1_Feathered. The Prop1_Feathered variable represents the feather animation. If the Prop1_Feathered variable is false, then PROP_PITCH1_SET is set to -1 and the TOGGLE_FEATHER_SWITCH_1 command is called, else the reciprocal values are set. This is done for both the left and the right engines. From Milviz: if{ (L:Prop1_Feathered,bool) ! if { 1 (>L:Prop1_Feathered,bool) -1 (>K:PROP_PITCH1_SET) (>K:TOGGLE_FEATHER_SWITCH_1) } els{ 0 (>L:Prop1_Feathered,bool) 0 (>K:PROP_PITCH1_SET) (>K:TOGGLE_FEATHER_SWITCH_1) } } So it seems I need to script the following: If prop 1 axis range is between two values (aft of hardware detent), then set variable L:Prop1_Feathered to true set PROP_PITCH1_SET -1 toggle TOGGLE_FEATHER_SWITCH_1 When leaving the prop 1 axis feather range (forward of hardware detent), then set variable L:Prop1_Feathered to false set PROP_PITCH1_SET 0 toggle TOGGLE_FEATHER_SWITCH_1 I'm not sure, but the latter part of the logic may not be necessary as I suspect that existing Milviz code will set the prop as soon as I move out of the feathered range - will need to test this. Based on what I've read, I think I am supposed to use the FSUIPC GUI to reference a script file, that I create in the Modules folder, that gets called when the axis range is entered or exited. I also suppose that my script file could have a function/method like FeatherProp(int) that accepts one variable: ~ int EngineNumber So my pseudo code might look something like this: FeatherProp(EngineNumber(int) { Feathered bool; if (EngineNumber == 1) { //Getting the current value of the Prop1_Feathered animation variable will likely look something like this Feathered = ipc.readLvar(“Prop1_Feathered”); //Setting the reciprical of the current “Prop1_Feathered” variable may look like this ipc.writeLvar("Prop1_Feathered", !Feathered); //Calling the Toggle Feather Switch command might look like this ipc.control("TOGGLE_FEATHER_SWITCH_1"); if(!Feathered) { //Setting the prop pitch might look like this ipc.control("PROP_PITCH1_SET", -1); } else { ipc.control("PROP_PITCH1_SET", 0); } } else { //Getting the current value of the Prop2_Feathered variable will likely look something like this Feathered = ipc.readLvar(“Prop2_Feathered”); //Setting the reciprocal of the current “Prop2_Feathered” variable may look like this ipc.writeLvar("Prop2_Feathered", !Feathered); //Calling the Toggle Feather Switch command might look like this ipc.control("TOGGLE_FEATHER_SWITCH_2"); if(!Feathered) { //Setting the prop pitch might look like this ipc.control("PROP_PITCH2_SET", -1); } else { ipc.control("PROP_PITCH2_SET", 0); } } } As you can see, I'm a C# developer, so my pseudo code looks nothing like Lua script yet, I still need to work that part out... I have a few questions regarding key concepts of Lua scripting: Generally speaking, am I on the right track from a conceptual standpoint? Can the variable L:Prop1_Feathered (mentioned by the aircraft's developer) be referenced by name in my script, or do I need to log the variables running in the sim and reference the variable using some returned int or hex that represents the L:Prop1_Feathered animation variable? How do I reference my script file using the FSUIPC GUI? Specifically, how do I call my script file's FeatherProp() method passing in the engine number parameter when my hardware prop lever is aft of the detent? On the Axis assignment tab? Am I using the correct IPC commands to read and set my L variable? Am I using the correct IPC commands to set my prop pitch values? Am I using the correct IPC commands to toggle my feather switches? Thank you for your patience as I try to code my first Lua script. Sincerely, Chris
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use. Guidelines Privacy Policy We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.