mauer / xmidictrl

XMidiCtrl is an X-Plane plugin to use midi controllers within the flight simulator
https://mauer.github.io/xmidictrl/#/
GNU Affero General Public License v3.0
31 stars 10 forks source link

Add support for encoder value wrapping #31

Closed constvoidptr closed 7 months ago

constvoidptr commented 7 months ago

Hey Marco,

love the plugin - using it daily.

Some aircraft apparently don't do any validation / transformation on the dataref values, like the Dash here for example.

https://github.com/mauer/xmidictrl/assets/48032395/142039be-cd94-4c86-86c1-d754500a1c13

So I added another optional field value_wrap to the dataref encoders. It toggles whether value_min and value_max should be considered hard stops, the current functionality. Or if they define an interval that the value gets normalized to, wrapping it around if needed.

The default behavior stays the same. So this is a non breaking change.

{ ch = 11, cc = 5, type = "enc", dataref = "sim/cockpit/radios/nav1_obs_degm", modifier_up = 1, modifier_down = -1, value_min = 1, value_max = 361, value_wrap = true } For example keeps the value between (0; 360].

Changes are:

sonarcloud[bot] commented 7 months ago

Quality Gate Passed Quality Gate passed

Kudos, no new issues were introduced!

0 New issues
0 Security Hotspots
No data about Coverage
No data about Duplication

See analysis details on SonarCloud

mauer commented 7 months ago

Hi,

Many thanks for your pull request. Your enhancement for the encoder mapping looks really great and thank you for the bugfix.

Really cool that you updated the documentation, as well!

Thanks again and I'm glad that you like XMidiCtrl.

Cheers, Marco