enable PageVoltage for small decimals; add formatValue overload to OBP60Formatter

This commit is contained in:
Ulrich Meine
2026-09-01 21:53:09 +02:00
parent 6c318d5a69
commit 3dd13ae899
3 changed files with 30 additions and 33 deletions
+16
View File
@@ -922,6 +922,22 @@ FormattedData formatValue(GwApi::BoatValue *value, CommonData &commondata, Strin
return formatValue(value, commondata, false, setPrecision);
}
// Format double value from SI to user defined format and convert to string user defined precision setting
String formatValue(const double &value, const String &vFormat, CommonData &commondata)
{
GwApi::BoatValue tmpBVal("dummy"); // temporary boat value for string formatter
String sVal;
tmpBVal.setFormat(vFormat);
tmpBVal.valid = true;
tmpBVal.value = value;
sVal = formatValue(&tmpBVal, commondata, false, String("-1")).svalue; // Formatted value as string including unit conversion and switching decimal places
if (sVal.length() > 0 && sVal[0] == '!') {
sVal = sVal.substring(1); // cut leading "!" created at OBPFormatter; doesn't work for other fonts than 7SEG
}
return sVal;
}
// Helper method for conversion of any data value from SI to user defined format
double convertValue(const double &value, const String &name, const String &format, CommonData &commondata)
{