mirror of
https://github.com/thooge/esp32-nmea2000-obp60.git
synced 2025-12-29 13:33:06 +01:00
Fixed OBP60Formatter issue with speeds of 9.9999 knots
This commit is contained in:
@@ -305,10 +305,13 @@ FormattedData formatValue(GwApi::BoatValue *value, CommonData &commondata){
|
||||
snprintf(buffer, bsize, "%2.0f", speed);
|
||||
}
|
||||
else{
|
||||
if (speed < 10){
|
||||
speed = std::round(speed * 100) / 100; // in rare cases, speed could be 9.9999 kn instead of 10.0 kn
|
||||
LOG_DEBUG(GwLog::DEBUG,"OBPFormatter-formatValue: value->value: %.3f speed: %.15f speed<10: %d", value->value, speed, speed < 10.0);
|
||||
|
||||
if (speed < 10.0){
|
||||
snprintf(buffer, bsize, fmt_dec_1, speed);
|
||||
}
|
||||
else if (speed < 100){
|
||||
else if (speed < 100.0){
|
||||
snprintf(buffer, bsize, fmt_dec_10, speed);
|
||||
}
|
||||
else {
|
||||
|
||||
Reference in New Issue
Block a user