Jump to content
The simFlight Network Forums

Recommended Posts

Posted

I have been logging events from excercising Mustang C510 switches. There are a few points I don't understand, especially when I am trying to replicated the action using Lua and Alpha and Bravo devices.

In turning the fuel valves (eng1 and eng2) on and off, the events return: 

66494    Param = 0      TOGGLE_FUEL_VALVE_ENG1     
66495    Param = 0       TOGGLE_FUEL_VALVE_ENG2
66495    Param = 0       TOGGLE_FUEL_VALVE_ENG2
66494    Param = 0       TOGGLE_FUEL_VALVE_ENG1

Not sure why the Param is 0 in both events. 

Also, in exercising the Avionics swtich, the following is recorded.

67072    Param = 24     ELECTRICAL_CIRCUIT_TOGGLE
67073    Param = 1       ELECTRICAL_BUS_TO_BUS_CONNECTION_TOGGLE
67073    Param = 1       ELECTRICAL_BUS_TO_BUS_CONNECTION_TOGGLE
67072    Param = 5       ELECTRICAL_CIRCUIT_TOGGLE

I have tried to find these variables in the MSFS SDK to find the definitions of the parameters, especially 24 and 5 in control ELECTRICAL_CIRCUIT_TOGGLE. No luck. Can you help?

I would like to replicate the function with the Alpha Avionics switch with Lua or FSUIPC7.ini Button definitions.

Thanks

Posted
15 minutes ago, DrDave- said:

66494    Param = 0      TOGGLE_FUEL_VALVE_ENG1     
66495    Param = 0       TOGGLE_FUEL_VALVE_ENG2
66495    Param = 0       TOGGLE_FUEL_VALVE_ENG2
66494    Param = 0       TOGGLE_FUEL_VALVE_ENG1

Not sure why the Param is 0 in both events. 

They are toggle events - toggle events don't usually have a parameter (although if I remember correctly some actually do!). A toggle event switches between two states, and no parameter is usually needed.

17 minutes ago, DrDave- said:

I have tried to find these variables in the MSFS SDK to find the definitions of the parameters, especially 24 and 5 in control ELECTRICAL_CIRCUIT_TOGGLE. No luck. Can you help?

They are not variables, they are events. See https://docs.flightsimulator.com/flighting/html/Programming_Tools/Event_IDs/Aircraft_Electrical_Events.htm:

Quote
ELECTRICAL_CIRCUIT_TOGGLE

circuit index

Toggle the indexed circuit switch state. The index is the value assigned to the circuit N when the circuit.N was defined.

Although that is confusing, as it talks about index when i presume they mean parameter (simvars can be indexed, not events, as far as I am aware). So a param of 24 would indicate circuit 24 (and its a toggle event with a parameter, in this case justified!). What circuit 24 is, I have no idea - this will be dependent on the implementation of the electric circuits in the aircraft and you would need to dig into the aircraft config files to determine what that is. Just use the parameters as logged.

John

Posted
1 hour ago, John Dowson said:

They are toggle events - toggle events don't usually have a parameter (although if I remember correctly some actually do!). A toggle event switches between two states, and no parameter is usually needed.

Thank you,

Does one toggle the control then in Lua using ipc.control(66494,1) -- TOGGLE_FUEL_VALVE_ENG1 ? Can one turn the control on/off with 1 and 0? Can one test the state of this control?

If not, does one interrogate "0x3590 4 GENERAL ENG FUEL VALVE:1"? If so, how can one be sure the control sets this variable offset? 

 

Posted
11 hours ago, DrDave- said:

Does one toggle the control then in Lua using ipc.control(66494,1) -- TOGGLE_FUEL_VALVE_ENG1 ?

Did you read my last comment? Try reading it again...as I said, toggle events (usually) DO NOT take a parameter, they toggle/swiych between two states. If something is off and you toggle it, it goes to on, if it is on and you toggle it, it goes to off. You don't need a parameter. So use ipc.control(66494,0).

11 hours ago, DrDave- said:

Can one turn the control on/off with 1 and 0?

Not with the toggle controls. Yo set the state explicitly, you would use the set controls: SET_FUEL_VALVE_ENG1, SET_FUEL_VALVE_ENG2, SET_FUEL_VALVE_ENG3 & SET_FUEL_VALVE_ENG4.

11 hours ago, DrDave- said:

Can one test the state of this control?

These are events and have no state. They do allow the state of something to be changed - usually a simvar (a-type variable), but could also update other variable types, I would expect the fuel valve controls/events change the value of one or both of the following simvars (in aircraft using the new FuelSystem):

Quote
 
FUELSYSTEM VALVE OPEN:index Whether or not the indexed valve is actually fully opened. The index is the number of the valve N component as defined by the Valve.N parameter. Percent Over 100  
FUELSYSTEM VALVE SWITCH:index Whether or not the indexed valve is set to be opened. The index is the number of the valve N component as defined by the Valve.N parameter. Bool  

 

12 hours ago, DrDave- said:

If not, does one interrogate "0x3590 4 GENERAL ENG FUEL VALVE:1"? 

That is another possibility, if using the legacy fuelsystem. Not sure if that is valid if/when using the new FuelSystem. Why don't you just monitor it and see if it changes? That is the only way to determine if its being used.

12 hours ago, DrDave- said:

If so, how can one be sure the control sets this variable offset? 

By testing/checking. How else? If that offset doesn't change, look at those other simvars (i.e. add them to free/spare offsets).

Note the C510 Mustang has 227 Input Events that will be available for assignment in the next beta release:

227 Input Events available:
AS1000_PFD_1_NAV_Volume<>
AS1000_PFD_1_COM_Volume<>
AS1000_PFD_1_NAV_Swap<>
AS1000_PFD_1_NAV_Mhz<>
AS1000_PFD_1_NAV_Khz_Button<>
AS1000_PFD_1_NAV_Khz<>
AS1000_PFD_1_COM_Swap<>
AS1000_PFD_1_COM_Mhz<>
AS1000_PFD_1_COM_Khz_Button<>
AS1000_PFD_1_COM_Khz<>
AS1000_PFD_1_Baro<>
AS1000_PFD_1_Course_Button<>
AS1000_PFD_1_Course<>
AS1000_PFD_1_Softkey_1<>
AS1000_PFD_1_Softkey_2<>
AS1000_PFD_1_Softkey_3<>
AS1000_PFD_1_Softkey_4<>
AS1000_PFD_1_Softkey_5<>
AS1000_PFD_1_Softkey_6<>
AS1000_PFD_1_Softkey_7<>
AS1000_PFD_1_Softkey_8<>
AS1000_PFD_1_Softkey_9<>
AS1000_PFD_1_Softkey_10<>
AS1000_PFD_1_Softkey_11<>
AS1000_PFD_1_Softkey_12<>
AS1000_PFD_1_DirectTo<>
AS1000_PFD_1_Enter<>
AS1000_PFD_1_Clear<>
AS1000_PFD_1_Menu<>
AS1000_PFD_1_FlightPlan<>
AS1000_PFD_1_Procedure<>
AS1000_PFD_1_FMS_Inner_Button<>
AS1000_PFD_1_FMS_Inner<>
AS1000_PFD_1_FMS_Outer<>
AS1000_PFD_1_Range_Pan_X<>
AS1000_PFD_1_Range_Pan_Y<>
AS1000_PFD_1_Range_Zoom<>
AS1000_PFD_1_Range_Cursor<;FLOAT64>
AS1000_PFD_1_Heading_Sync<>
AS1000_PFD_1_Heading<>
AS1000_PFD_2_NAV_Volume<>
AS1000_PFD_2_COM_Volume<>
AS1000_PFD_2_NAV_Swap<>
AS1000_PFD_2_NAV_Mhz<>
AS1000_PFD_2_NAV_Khz_Button<>
AS1000_PFD_2_NAV_Khz<>
AS1000_PFD_2_COM_Swap<>
AS1000_PFD_2_COM_Mhz<>
AS1000_PFD_2_COM_Khz_Button<>
AS1000_PFD_2_COM_Khz<>
AS1000_PFD_2_Baro<>
AS1000_PFD_2_Course_Button<>
AS1000_PFD_2_Course<>
AS1000_PFD_2_Softkey_1<>
AS1000_PFD_2_Softkey_2<>
AS1000_PFD_2_Softkey_3<>
AS1000_PFD_2_Softkey_4<>
AS1000_PFD_2_Softkey_5<>
AS1000_PFD_2_Softkey_6<>
AS1000_PFD_2_Softkey_7<>
AS1000_PFD_2_Softkey_8<>
AS1000_PFD_2_Softkey_9<>
AS1000_PFD_2_Softkey_10<>
AS1000_PFD_2_Softkey_11<>
AS1000_PFD_2_Softkey_12<>
AS1000_PFD_2_DirectTo<>
AS1000_PFD_2_Enter<>
AS1000_PFD_2_Clear<>
AS1000_PFD_2_Menu<>
AS1000_PFD_2_FlightPlan<>
AS1000_PFD_2_Procedure<>
AS1000_PFD_2_FMS_Inner_Button<>
AS1000_PFD_2_FMS_Inner<>
AS1000_PFD_2_FMS_Outer<>
AS1000_PFD_2_Range_Pan_X<>
AS1000_PFD_2_Range_Pan_Y<>
AS1000_PFD_2_Range_Zoom<>
AS1000_PFD_2_Range_Cursor<>
AS1000_PFD_2_Heading_Sync<>
AS1000_PFD_2_Heading<>
AS1000_MID_COM_1<>
AS1000_MID_COM_1_Mic<;FLOAT64>
AS1000_MID_COM_2<>
AS1000_MID_COM_2_Mic<>
AS1000_MID_COM_3<>
AS1000_MID_COM_3_Mic<>
AS1000_MID_COM_Swap_1_2<>
AS1000_MID_PA<>
AS1000_MID_SPKR<>
AS1000_MID_MKR<>
AS1000_MID_HI<;FLOAT64>
AS1000_MID_DME<>
AS1000_MID_NAV_1<;FLOAT64>
AS1000_MID_NAV_2<>
AS1000_MID_ADF<>
AS1000_MID_AUX<>
AS1000_MID_MAN_SQ<>
AS1000_MID_Play<>
AS1000_MID_Isolate_Pilot<>
AS1000_MID_Isolate_Copilot<>
AS1000_MID_Pass_Pilot<>
AS1000_MID_Pass_Copilot<>
AS1000_MID_Display_Backup<>
AS1000_MFD_1_NAV_Volume<>
AS1000_MFD_1_COM_Volume<>
AS1000_MFD_1_NAV_Swap<>
AS1000_MFD_1_NAV_Mhz<>
AS1000_MFD_1_NAV_Khz_Button<>
AS1000_MFD_1_NAV_Khz<>
AS1000_MFD_1_COM_Swap<>
AS1000_MFD_1_COM_Mhz<>
AS1000_MFD_1_COM_Khz_Button<>
AS1000_MFD_1_COM_Khz<>
AS1000_MFD_1_Baro<>
AS1000_MFD_1_Course_Button<>
AS1000_MFD_1_Course<>
AS1000_MFD_1_Softkey_1<>
AS1000_MFD_1_Softkey_2<>
AS1000_MFD_1_Softkey_3<>
AS1000_MFD_1_Softkey_4<>
AS1000_MFD_1_Softkey_5<>
AS1000_MFD_1_Softkey_6<>
AS1000_MFD_1_Softkey_7<>
AS1000_MFD_1_Softkey_8<>
AS1000_MFD_1_Softkey_9<>
AS1000_MFD_1_Softkey_10<>
AS1000_MFD_1_Softkey_11<>
AS1000_MFD_1_Softkey_12<>
AS1000_MFD_1_DirectTo<>
AS1000_MFD_1_Enter<>
AS1000_MFD_1_Clear<>
AS1000_MFD_1_Menu<>
AS1000_MFD_1_FlightPlan<>
AS1000_MFD_1_Procedure<>
AS1000_MFD_1_FMS_Inner_Button<>
AS1000_MFD_1_FMS_Inner<>
AS1000_MFD_1_FMS_Outer<>
AS1000_MFD_1_Range_Pan_X<>
AS1000_MFD_1_Range_Pan_Y<>
AS1000_MFD_1_Range_Zoom<>
AS1000_MFD_1_Range_Cursor<>
AS1000_MFD_1_Heading_Sync<>
AS1000_MFD_1_Heading<>
AUTOPILOT_AP_1<>
AUTOPILOT_Heading_Mode<;FLOAT64>
AUTOPILOT_Heading_Sync<>
AUTOPILOT_Heading<>
AUTOPILOT_Bank_Button<>
AUTOPILOT_Approach_Button<>
AUTOPILOT_Backcourse_Button<>
AUTOPILOT_FD_1_Mode<;FLOAT64>
AUTOPILOT_YD_Button<;FLOAT64>
AUTOPILOT_FLC_Button<;FLOAT64>
AUTOPILOT_Altitude_Button<>
AUTOPILOT_Altitude_100<>
AUTOPILOT_VS_Mode<;FLOAT64>
AUTOPILOT_VerticalSpeed<>
AUTOPILOT_Transfer_Mode<>
AUTOPILOT_NAV_Mode<;FLOAT64>
AUTOPILOT_VNAV_Mode<;FLOAT64>
AUTOPILOT_SpeedToggle_Mode<>
AUTOPILOT_Course_1_Sync<>
AUTOPILOT_Course_1<>
AUTOPILOT_Course_2_Sync<>
AUTOPILOT_Course_2<>
DEICE_Windshield_1<>
DEICE_Airframe_1<;FLOAT64>
DEICE_Engine_1<>
DEICE_Engine_2<;FLOAT64>
ELECTRICAL_Battery_1<;FLOAT64>
ELECTRICAL_Avionics_Bus_1<>
ELECTRICAL_Circuit_5<>
ELECTRICAL_Alternator_1<>
ELECTRICAL_Alternator_2<>
ENGINE_Starter_1<;FLOAT64>
ENGINE_Starter_2<;FLOAT64>
ENGINE_Starter_Disengage<>
ENGINE_Ignition_1<;FLOAT64>
ENGINE_Ignition_2<;FLOAT64>
ENGINE_Throttle_1<;FLOAT64>
ENGINE_Throttle_2<;FLOAT64>
ENGINE_TOGA_1<;FLOAT64>
ENGINE_TOGA_2<>
FUEL_Pump_1<;FLOAT64>
FUEL_Pump_2<;FLOAT64>
FUEL_Crossfeed_1<>
HANDLING_ElevatorTrim_1<;FLOAT64>
HANDLING_Flaps<;FLOAT64>
HANDLING_Anti_Skid<>
HANDLING_RudderTrim_1<;FLOAT64>
HANDLING_AileronsTrim_1<;FLOAT64>
HANDLING_Yoke_Hider_1<;FLOAT64>
HANDLING_Yoke_Hider_2<;FLOAT64>
INSTRUMENT_Attitude_Indicator_Bars<;FLOAT64>
INSTRUMENT_Altimeter_1<;FLOAT64>
INSTRUMENT_Airspeed_Calibrator<>
LANDING_GEAR_Gear<>
LANDING_GEAR_ParkingBrake<;FLOAT64>
LIGHTING_PANEL_1<;FLOAT64>
LIGHTING_POTENTIOMETER_30<;FLOAT64>
LIGHTING_CABIN_1<;FLOAT64>
LIGHTING_CABIN_2<;FLOAT64>
LIGHTING_CABIN_3<;FLOAT64>
LIGHTING_CABIN_4<;FLOAT64>
LIGHTING_CABIN_5<;FLOAT64>
LIGHTING_CABIN_6<;FLOAT64>
LIGHTING_CABIN_7<;FLOAT64>
LIGHTING_STROBE_1<;FLOAT64>
LIGHTING_BEACON_1<;FLOAT64>
LIGHTING_NAV_1<;FLOAT64>
LIGHTING_LANDING_1<;FLOAT64>
LIGHTING_WING_1<;FLOAT64>
NAVCOM_ADF_ADF_ANT_MODE_TOGGLE<>
NAVCOM_ADF_BFO<>
NAVCOM_ADF_FRQ<>
NAVCOM_ADF_FLTET<>
NAVCOM_ADF_SETRESET<>
NAVCOM_ADF_Volume<>
NAVCOM_ADF_Freq_100_Khz<>
NAVCOM_ADF_Freq_Increment<>
NAVCOM_ADF_Freq_1_10_Khz<>
SAFETY_Alternate_Static_Air<>
SAFETY_ELT_1<>
SAFETY_Caution_1<>
SAFETY_Caution_2<>
SAFETY_Warning_1<>
SAFETY_Warning_2<>
 

 

Posted

Thank you,

The reason I asked again, was whether to use ipc.control(xxxxx,0), (xxxxx,1) or (xxxxx). You answered the question with an example, thanks

Appreciate the beta release. How will the input events be presented? As like an LVar, an offset or control? Appreciated.

Are the input events type O:, B:, H:? Or are they something entirely new? Just curious.

Yes, I am impatient with MSFS' as I could control P3D or FSX much faster. As an ex-Naval aviator, I am more interested in flying in my DIY cockpit more than discovery.

Posted

What would really help Lua users is what to read/write using offset length in an entry in the FSUIPC7 Offsets Status.

If a length is 1 it is obvious it is a bool. If it is 8 it is understood that is a double word but which read to use - n = ipc.readDBL(offset) or n = ipc.readDD(offset). Also for the uninitiated is 8 bytes really 64 bits (Doubleword). Same with 32 bits (Word), 16 bits (Half Word) and 8 bits (usually 1 byte).  

Some SDK variables don't state the exact disposition of a variable. For example:

ELECTRICAL MAIN BUS VOLTAGE The main bus voltage. Use a bus index when referencing. Volts

Offset status is:

0x2840 8 ELECTRICAL MAIN BUS VOLTAGE 

Which ipc.readxx or ipc.writexx should we use?

Thanks

Posted
17 hours ago, DrDave- said:

The reason I asked again, was whether to use ipc.control(xxxxx,0), (xxxxx,1) or (xxxxx). You answered the question with an example, thanks

As the parameter is ignored, ipc.control(66494,1,0), ipc.control(66494,1,1), ipc.control(66494,1,99), etc will all have the same effect. You can use just  ipc.control(66494) if you like, or maybe  ipc.control(66494, nil) to indicate that a parameter can be given but not needed in this case. It is just personal preference really.

17 hours ago, DrDave- said:

How will the input events be presented? As like an LVar, an offset or control? Appreciated.

Similar to a control or preset - there will be an additional checkbox 'Select for Input Event'

17 hours ago, DrDave- said:

Are the input events type O:, B:, H:? Or are they something entirely new? Just curious.

As B type variables are also known as Input Events, I suspect that they relate to these. But really, I have no idea - I only have the information provided by the SDK. I suspect they relate to how things are implemented on the aircraft itself. It may take a while for add-in aircraft to be update to use Input Events. For example, I have just taken a look at the PMDG 737 and no input events are available for this aircraft.

11 hours ago, DrDave- said:

If it is 8 it is understood that is a double word but which read to use - n = ipc.readDBL(offset) or n = ipc.readDD(offset).

I see your point, but It is not a double word - a word is 2 bytes, a double word us 4 bytes. It is  a double double-word (hence DD).

11 hours ago, DrDave- said:

Some SDK variables don't state the exact disposition of a variable. For example:

ELECTRICAL MAIN BUS VOLTAGE The main bus voltage. Use a bus index when referencing. Volts

Offset status is:

0x2840 8 ELECTRICAL MAIN BUS VOLTAGE 

Which ipc.readxx or ipc.writexx should we use?

 

That is a 64-bit float, so use ipc.readDBL / ipc.writeDBL

11 hours ago, DrDave- said:

What would really help Lua users is what to read/write using offset length in an entry in the FSUIPC7 Offsets Status.

Well, the length is stated, just not the actual type. I can see that the type would be useful. In fact, for many offsets the description does indicate if it is a float/double or integer, just not for all. Generally, unless stated in the description, you should assume that all 8 byte values are double floating point values. For 4 byte values, they can be either floats (32-bit) or integers, but the description should tell you which for most offsets. Otherwise logging as both types should help you decide.

John

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • 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.