Posted: Wed Mar 30, 2011 1:31 pm
In playing around with manipulating the Autopilot I've run across a problem while trying to set the reference altitude. If I make the following call to set the reference altitude;
SimConnect_TransmitClientEvent(hSimConnect, 0, AP_ALT_VAR_SET_ENGLISH, 4420, SIMCONNECT_GROUP_PRIORITY_HIGHEST, SIMCONNECT_EVENT_FLAG_GROUPID_IS_PRIORITY);
And then check our reference altitude with the following data definition;
SimConnect_AddToDataDefinition(hSimConnect, RADIO_DEFINITION, "AUTOPILOT ALTITUDE LOCK VAR", "Feet");
I get a value of 4500. If I set the altitude to anything 20-99, I get a returned value that has been rounded up to the above 100 foot mark like above. If I set the altitude to anything from 1-19, it rounds down (ie, if I set the altitude value to 4419, I get 4400 returned).
Now, the other weirdness that I'm seeing is if I set the reference altitude in meters, with the following call;
SimConnect_TransmitClientEvent(hSimConnect, 0, AP_ALT_VAR_SET_METRIC, 1347, SIMCONNECT_GROUP_PRIORITY_HIGHEST, SIMCONNECT_EVENT_FLAG_GROUPID_IS_PRIORITY);
and I would expect to see the value of 4419 returned (1347 meters equals 4419 feet), but instead I get back a value of 1476.4.
So, this is all strange/confusing in that if I set the value in feet, I get a rounded value and if I set the value in meters, I get a value that I'm unsure of what it is. Are we using this completely wrong, are we completely missing something, or is there a bug somewhere?
SimConnect_TransmitClientEvent(hSimConnect, 0, AP_ALT_VAR_SET_ENGLISH, 4420, SIMCONNECT_GROUP_PRIORITY_HIGHEST, SIMCONNECT_EVENT_FLAG_GROUPID_IS_PRIORITY);
And then check our reference altitude with the following data definition;
SimConnect_AddToDataDefinition(hSimConnect, RADIO_DEFINITION, "AUTOPILOT ALTITUDE LOCK VAR", "Feet");
I get a value of 4500. If I set the altitude to anything 20-99, I get a returned value that has been rounded up to the above 100 foot mark like above. If I set the altitude to anything from 1-19, it rounds down (ie, if I set the altitude value to 4419, I get 4400 returned).
Now, the other weirdness that I'm seeing is if I set the reference altitude in meters, with the following call;
SimConnect_TransmitClientEvent(hSimConnect, 0, AP_ALT_VAR_SET_METRIC, 1347, SIMCONNECT_GROUP_PRIORITY_HIGHEST, SIMCONNECT_EVENT_FLAG_GROUPID_IS_PRIORITY);
and I would expect to see the value of 4419 returned (1347 meters equals 4419 feet), but instead I get back a value of 1476.4.
So, this is all strange/confusing in that if I set the value in feet, I get a rounded value and if I set the value in meters, I get a value that I'm unsure of what it is. Are we using this completely wrong, are we completely missing something, or is there a bug somewhere?