norbert-walter / esp32-nmea2000-obp60

nmea2000 gateway with ESP32
GNU General Public License v2.0
12 stars 8 forks source link

XTE formatting and default formatting of negative numbers #72

Open W-Geronius opened 2 years ago

W-Geronius commented 2 years ago

1.) OBP60Formatter.cpp lacks specific XTE handling (like value->getFormat() == "formatXTE"). Therefore no unit is displayed for XTE values and formatting is left to default processing (lines 684ff)

2.) XTE = 0 is displayed as -0.00

3.) default processing formats negative values with 2 decimals, causing an overflow on display (e.g. in bottom fields of PageFourValues2)

W-Geronius commented 2 years ago

as a quick & dirty fix, default formatting could be modified:

{ if(value->value >= 100){ snprintf(buffer,bsize,"%3.0f",value->value); } else if (value->value >= 10){ snprintf(buffer,bsize,"%3.1f",value->value); } else if (value->value > 0){ snprintf(buffer,bsize,"%3.2f",value->value); } else if (value->value > -10){ snprintf(buffer,bsize,"%3.1f",value->value); } else { snprintf(buffer,bsize,"%3.0f",value->value); }

W-Geronius commented 2 years ago

possibly the dirty fix leads to this: image

image

odd XTE value !

to be investigated

norbert-walter commented 2 months ago

Good idea