Dabull Posted October 6, 2021 Report Share Posted October 6, 2021 Can someone please verify if this is the correct reverse computation to write back heading (0x0580) and altitude (0x6020) to the sim? I think altitude is pretty much easy. I am not convinced of the heading though. I extracted it as follows: heading = Math.round(response.data.heading * 360 / (65536*65536)) altitude = Math.round(response.data.altitude * 3.28084) And I plan to write back as follows: var newheading = (plannedrecord.heading / 360) * (65536/65536) var newaltitude = plannedrecord.altitude / 3.28084 Link to comment Share on other sites More sharing options...
Paul Henty Posted October 6, 2021 Report Share Posted October 6, 2021 Heading would be this: var newheading = (plannedrecord.heading / 360) * (65536*65536) Paul Link to comment Share on other sites More sharing options...
Dabull Posted October 7, 2021 Author Report Share Posted October 7, 2021 It worked for heading. But for altitude I could not write as x6020 you cannot write to. So I found x0570 that you can write to. But it behaves oddly when I pass the altitude in meters. It flips the plane over and shuts the engine off. Is the computation for writing to this offset different? Link to comment Share on other sites More sharing options...
Paul Henty Posted October 7, 2021 Report Share Posted October 7, 2021 4 minutes ago, Dabull said: Is the computation for writing to this offset different? Yes it's completely different. 6020 is an easier way of reading the altitude. 0570 is an 8-byte integer (not a float like 6020) so you'll need to declare it as { name: 'altitude', address: 0x0570, type: 'int', size: 8 }, The conversion to metres/feet is: var altitudeMetres = data.altitude / (65535 * 65535); var altitudeFeet = data.altitude / (65535 * 65535) * 3.28084; Conversion from metres/feet is: var newAltitude = altitudeMetres * (65535 * 65535); var newAltitude = altitudeFeet / 3.28084 * (65535 * 65535); Paul Link to comment Share on other sites More sharing options...
Dabull Posted October 7, 2021 Author Report Share Posted October 7, 2021 Ok never mind. They referred to 0574 but that one is not listed explicitly in the FSUIPC document. x0574 is for the whole meters and x0570 is for the fractional part of the altitude. Hence my crashing at low altitude. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now