Closed FS2020-USER-TESTER closed 3 years ago
The problem seem to be with the Enum data type, python has a bit of a hard time with this type.
I seem to be able to read with
sm = SimConnect()
pl = Request((b"COM SPACING MODE:0", b"Enum"), sm)
print("com", pl.value)
one should be able to use
sm = SimConnect()
pl = Request((b"COM SPACING MODE:0", b"Enum"), sm, _settable=True)
print("com", pl.value)
pl.value = 1 // or 0
SIMCONNECT_EXCEPTION_DATA_ERROR seems to suggest that the data passed to the event is not of the right format. this is where I'm lost as well.
Attempting to pass as pointer to array of ctypes.c_double as normal and as pointer to ctypes.c_double showed no improvements. changing the data type form SIMCONNECT_DATATYPE.SIMCONNECT_DATATYPE_FLOAT64 to all others in
Did not change the message. mismatching data types did change the message.
Attempting to change b"Enum" did not result in any changes.
I tried a C# program but did not find reliable set data operation for this spacing variable. So appears not Python problem. What I see testing here - the C152 and the C172 mostly start up with COM SPACING MODE = 1 and the knob works consistent with that. Occasionally they start up with COM SPACING MODE = 0 and the knob works consistent with that. I do not see a pattern as to what it picks to start. The call to SetDataOnSimObject always generates an exception.
Initially the random startup convinced me I was somehow setting the variable via SimConnect but I no longer believe that. Now I think it is just FS2020 bug.
This mod https://github.com/JPLogistics/MSFS_C152 fixes the C152 COM spacing to 25mHz. (And has odd side effect to setting the C172 spacing to 25 mHz if plane selected in same session.) This mod https://github.com/Working-Title-MSFS-Mods/fspackages/releases/tag/g1000-v0.3.4 fixes the G1000 to have a AUX menu available to select the frequency spacing.
So simulation user has a path to select correct spacing but not through SimConnect.
In the document posted with the recent SDK update, https://docs.flightsimulator.com/html/Programming_Tools/SimVars/Aircraft_Simulation_Variables.htm
I noticed a new variable COM SPACING MODE | Com [index] Radio Frequency step: | Enum:0 = 25kHz1 = 8.33kHz Default was 1.0 which matched the behavior of the COM knob. I tried adding into the variable list using several different data types. Consistently get SIMCONNECT_EXCEPTION_DATA_ERROR on set. Somehow I got variable set to 0.0 for several flights, but today I cannot reproduce that success using same code. Stuck Back to 1.0
Can you try to add?