RoystonS / BetterBravoLights

Utility for controlling lights on a Honeycomb Bravo Throttle from Microsoft Flight Simulator
MIT License
42 stars 8 forks source link

decimal value parsed as integer #8

Closed carpaIdea closed 3 years ago

carpaIdea commented 3 years ago

Software version

0.2.0

Describe the bug

decimal values are converted in integer for example 24.5 becomes 245 (the dot separator is ignored)

Expected behavior

I expect the value 24.5 in Config.ini to be read 24.5 (with the comma separator) for Bravo's lights to work as they should for me. for example: in Config.ini - section [Aircraft.Asobo_TBM930] the line LowVolts = A:ELECTRICAL MAIN BUS VOLTAGE, volts < 24.5 will never turn off the light "LOW VOLTS" of Bravo because the value is parsed as 245 while the value returned by the sim will be 28,9 (see the comma).

I spotted this with the debbuger of the application.

Other software

Additional context

my system is in Italian but the simulator is in english

RoystonS commented 3 years ago

Thanks for the bug report. I'm not managing to reproduce it straightforwardly.

I've just been working on an expression where the underlying variable was 82.72. An expression < 82.7 returned false, and < 82.8 returned true.

Off the top of my head it's probably something related to the Italian system setup with the use of , as the decimal separator instead of .. I'll investigate.

RoystonS commented 3 years ago

Hey @carpaIdea. I switched my OS into Italian and reproduced the problem easily. As I suspected, it's using the Italian decimal separator when parsing, so it's looking for a comma to separate the decimal, not the . character. Very easy fix. I'll get an explicit unit test in for it and get a release out, hopefully tomorrow.

RoystonS commented 3 years ago

Released in v0.3.0. Thanks for the bug report!

carpaIdea commented 3 years ago

Thank you. It's working very well now.