Python-SimConnect icon indicating copy to clipboard operation
Python-SimConnect copied to clipboard

Add support for selected vs managed airspeed etc.

Open omrygin opened this issue 4 years ago • 6 comments

Hi, There seem to be a way to control whether or not airspeed, altitude, heading and vertical speed are controlled by the FCU or managed. See reference here: https://github.com/flybywiresim/a32nx/issues/597#issuecomment-691663831

Is it possible to add this functionality to the package?

Thanks

omrygin avatar Oct 23 '20 08:10 omrygin

let me do some testng and see, for now you could use the Event class directly: https://github.com/odwdinc/Python-SimConnect/blob/bc4737f2b584cc1891a04e4e5e43a583a22d88bc/SimConnect/EventList.py#L4-L15

Sample:

from SimConnect import *
import logging


logging.basicConfig(level=logging.DEBUG)
LOGGER = logging.getLogger(__name__)
LOGGER.info("START")
sm = SimConnect()

hsi = Event(b'HEADING_SLOT_INDEX_SET', sm)
ssi = Event(b'SPEED_SLOT_INDEX_SET', sm)
asi = Event(b'ALTITUDE_SLOT_INDEX_SET', sm)
vssi = Event(b'VS_SLOT_INDEX_SET', sm)

# give authority to FCU
hsi(2)
ssi(2)
asi(2)
vssi(2)


# sending them with value 1 enables selected mode.
hsi(1)
ssi(1)
asi(1)
vssi(1)


sm.exit()
quit()

odwdinc avatar Oct 23 '20 19:10 odwdinc

Great answer.

Was able to get this to work with 1 and 2 values (for heading, speed, altitude) to enable selected or managed mode by using the Event class directly. Did not try VS_SLOT_INDEX_SET, supposedly people are having a hard time making it work.

Are there any plans to add these to EventList.py? You would need some kind of meta events (A32NX_AP_HDG_SET_MANAGED and A32NX_AP_HDG_SET_SELECTED with a forced key/value passed to SimConnect hidden in the EventList class). Even better would be a toggle event, but that implies getting the previous value before.

Thanks again for the great work, 0.4.19 is really stable.

viboux avatar Oct 25 '20 18:10 viboux

@viboux it would be trivial to just add a new section in the EventList classes for A32NX as this seems to be just limited to A32NX. the other option is to append the https://github.com/odwdinc/Python-SimConnect/blob/b5cf4ef94c5f9d0ddf7db08582dec3dc39383453/SimConnect/EventList.py#L384 as this may be reused on other aircraft ,more testing is needed there.

Next there has been some talk of creating classes for aircraft. This would be where the logic would handle things like meta events and toggles could be implemented.

odwdinc avatar Oct 25 '20 18:10 odwdinc

A similar issue exists for managed vs. selected heading - see also

daheise avatar Nov 01 '20 19:11 daheise

@odwdinc thank you so much for your work! I'm currently working on an A320 Home Cockpit and Python-SimConnect helped me a lot! I've got a similar question. For ex I found out that turning the knob for the brightness of the PFD triggers the event LIGHT_POTENTIOMETER_SET with the parameter 88. If I try this:

lp=Event(b'LIGHT_POTENTIOMETER_SET',sm) lp(88)

the ND gets dark. I think I have to pass two values. One for the correct potentiometer (88 in this case) and a second between 0 and 1 for the brightness. Please excuse my stupid question (I'm new to python and github) but is there a way how I can do this with your library?

alex-eddk avatar Feb 25 '21 13:02 alex-eddk

see https://github.com/flybywiresim/a32nx/issues/1202#issuecomment-706756056

odwdinc avatar Feb 25 '21 21:02 odwdinc