MobiFlight / MobiFlight-Connector

MobiFlight is an open source project that allows you to create your own home cockpit for your favorite flight simulator in a flexible, affordable and extremely user-friendly way.
https://mobiflight.com
MIT License
245 stars 106 forks source link

Transformation modifier doesn't work with String type #1348

Closed DocMoebiuz closed 1 year ago

DocMoebiuz commented 1 year ago

Describe the bug Transformation modifier doesn't work with String type

Steps To Reproduce Steps to reproduce the behavior:

  1. Create a output config
  2. Use MobiFflight Variable as type
  3. Add transformation
  4. Set the transformation to 'Hello'
  5. Run the test

Expected behavior The value should be Hello

Actual behavior The value is 0

Details

Additional context It works correctly with number types

DocMoebiuz commented 1 year ago

This issue is little bit more complicated.

There used to be a special string handling for the FSUIPC string type transform. Instead of allowing nCalc, it would show substring options.

With the introduction of modifiers we now would have to split the original transform into potentially two modifiers:

Unfortunately for all old configs, both values all values are set in the xml and we have to evaluate whether the config uses string type fsuipc offsets (then we would have to use a substring modifier) or anything else (then we would have to use a transform modifier).

I am leaning towards dropping the backward compatibility because this special handling kind of makes the code meh.