From b29e3a972baac7b13e8291054ef8e1cc4e912ac1 Mon Sep 17 00:00:00 2001 From: norbert-walter Date: Wed, 2 Mar 2022 22:12:21 +0100 Subject: [PATCH] Formater fixed for XDR data --- lib/obp60task/OBP60Formater.cpp | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/lib/obp60task/OBP60Formater.cpp b/lib/obp60task/OBP60Formater.cpp index a733665..0b4e03d 100644 --- a/lib/obp60task/OBP60Formater.cpp +++ b/lib/obp60task/OBP60Formater.cpp @@ -372,8 +372,16 @@ FormatedData formatValue(GwApi::BoatValue *value, CommonData &commondata){ } } else{ - snprintf(buffer,bsize,"%3.0f",value->value); - result.unit = ""; + if(value->value < 10){ + snprintf(buffer,bsize,"%2.1f",value->value); + } + if(value->value >= 10 && value->value < 100){ + snprintf(buffer,bsize,"%3.1f",value->value); + } + if(value->value >= 100){ + snprintf(buffer,bsize,"%3.0f",value->value); + } + result.unit = ""; } buffer[bsize]=0; result.svalue = String(buffer);