odwdinc / Python-SimConnect

Python interface for MSFS2020 SimConnect.dll
GNU Affero General Public License v3.0
270 stars 107 forks source link

lag with AircratEvents. fsx:se #92

Closed iceyrazor closed 3 years ago

iceyrazor commented 3 years ago

i have a simple line few lines of code

sm = SimConnect()
aq = AircraftRequests(sm, _time=150)
ae = AircraftEvents(sm)
while loop==True:
    print("ping")
    aq.find('GENERAL_ENG_THROTTLE_LEVER_POSITION:1').value=0
    aq.find('GENERAL_ENG_THROTTLE_LEVER_POSITION:2').value=0

im running python32 bit as a result of it being fsx:se

the more find methods i add. the slower 'print("ping")' gets if its just one find its really fast. 2 is like a 120-200 ms delay

this is not preferable when you trying to turn toggle events. into on/off events like this

    if 'panel_lights' in json_data.keys():
        if aq.get("LIGHT_PANEL") == False and json_data['panel_lights'] == "true":
            ae.Lights.PANEL_LIGHTS_TOGGLE()
        if aq.get("LIGHT_PANEL") == True and json_data['panel_lights'] == "false":
            ae.Lights.PANEL_LIGHTS_TOGGLE()

if im doing somthing wrong with this please correct

iceyrazor commented 3 years ago

i though this was the cause of my lag with my throttle input i have. its not. its the serial read. this is still a issue though

iceyrazor commented 3 years ago

correct me if im wrong, i think its the 10 ms delay. i think its doing it per command. so not as laggy as i thought. though a bit annoying to do threading per section of what im doing. like updates that need to be fast vs doesnt matter