Simstrumentation / Air-Manager

A collection of quality Air Manager instruments built by flight sim enthusiasts for our own personal home cockpits, but shared with the community at large.
110 stars 20 forks source link

WT CJ4 Baro Acceleration #12

Closed rob2791 closed 1 year ago

rob2791 commented 2 years ago

Reminder to Add Acceleration to Baro knob sometime in the future at the request of @sunbeam60.

sunbeam60 commented 2 years ago

I still hope to take a look at it when I find the time, but obviously happy if someone else wants to have a go.

Acceleration to baro knob itself is super easy. The challenge is to ensure the dark/light knob overlay PNGs rotate at the same rate, as they are currently set to a fixed value of each tick of the knob-change function (ie if acceleration is set to 3, they will rotate up to 3 times as fast as the knob-PNG.

The challenge is that the underlying knob graphic continues to rotate at a fixed rate even if the rotate-function is called multiple times due to acceleration.

The easiest approach I can see is to have a transparent PNG for the knob itself and include the normal knob graphic alongside the light/dark graphic, rotating them all so they stay in sync.

rob2791 commented 1 year ago

Yes, we typically do exactly that. Very rarely do I code a instrument using the image in the knob itself anymore. You have to add a rotate line as well to make sure they stay in sync. Replace lines 165-170 with the following:

     rotate (img_baro_day, baro_angle)     
     rotate (img_baro_night, baro_angle)
     rotate (img_baro_backlight, baro_angle)
end
dial_baro = dial_add(nil, 115,165,120,120, callback_baro_turn)
dial_set_acceleration(dial_baro, 3) 
img_baro_day = img_add("baro.png", 115,165,120,120 )
img_baro_night = img_add("baro_night.png", 115,165,120,120 )
img_baro_backlight = img_add("baro_backlight.png", 115,165,120,120)
rob2791 commented 1 year ago

@sunbeam60 Updated release is on Github and pushed to the AirManager "Store". I don't know when they will update everyone's instruments, it's usually once a month or so, but you can import the Siff file from the Github anytime. https://github.com/Simstrumentation/Air-Manager/tree/main/Instruments/Cessena_Citation_CJ4/CJ4-Upper_DCP_Panel

rob2791 commented 1 year ago

I will add that Acceleration does not seem to work in STD mode, when you want to preset for landing typically. I'm 90% sure this has to do with STD mode using an Event and User mode using a variable write. I don't think there is any solution too this as of right now. When the new CJ4 version comes out we'll have to see if it's different.

sunbeam60 commented 1 year ago

Yup, learnt that the hard way 😄

When in STD, pre-set baro has to be set in-game, unfortunately.

Thank you for making this fix!! Much obliged