Simple 28byj-48 Instrument works in editor, not in X-Plane

Questions about deployment and use of Air Manager Instruments

Moderators: russ, Ralph

Post Reply
Message
Author
chobbs42
Posts: 1
Joined: Wed Nov 09, 2022 5:46 am

Simple 28byj-48 Instrument works in editor, not in X-Plane

#1 Post by chobbs42 »

I 3d printed and assembled a nice little whiskey compass based on a 28byj-48 stepper. Downloaded a wet compass script and got it sort of working, but while my compass moves, it got out of sync with the sim compass pretty quickly. So I cloned the instrument in the editor and ran it there, where I could see more of how it worked. When running it from the editor, it works perfectly. I can calibrate it, and then manually set sim/cockpit2/gauges/indicators/compass_heading_deg_mag to any heading I want and the compass moves right to it.

To use it in the sim, I calibrate it before I launch the sim. Once the flight loads the heading does turn to the correct number, indicating that the calilbration was successful and it is reacting appropriately to the dataref. But once the plane starts moving it quickly gets out of whack.

I have triple-checked that the values I used to set up the instrument in my panel match the ones I'm using for the clone (number of steps, speed and type of stepper). I'm at a loss to determine what the difference is. I even downloaded the DataRef Toolkit to make sure that sim/cockpit2/gauges/indicators/compass_heading_deg_mag was sending numbers that made sense given the programming of the script - it is (0-360).

About the only thing I can think of is that the dataref in the sim is changing so quickly that the script/driver can't keep up - is that a thing?

Thanks in advance!

Chris

User avatar
jph
Posts: 2848
Joined: Fri Apr 10, 2020 12:50 pm
Location: Somewhere over the rainbow..

Re: Simple 28byj-48 Instrument works in editor, not in X-Plane

#2 Post by jph »

Probably the number of steps for the stepper.
Write a small piece of code to do say, 30 or 40 revolutions and leep altering the number of steps until the pointer is correct after the 30 or 40 revolutions is completed. You will find is is almost certainly different to what you have now.
Joe. CISSP, MSc.

SimPassion
Posts: 5338
Joined: Thu Jul 27, 2017 12:22 am

Re: Simple 28byj-48 Instrument works in editor, not in X-Plane

#3 Post by SimPassion »

In addition take care of the potential momentum the sim would induce on the whiskey in the VC, which is possibly not added at the moment in the AM script

Post Reply