src/ChartiSpindel.cpp

changeset 501
a01ae5ff0e96
parent 498
c6f957fa7442
--- a/src/ChartiSpindel.cpp	Sun Aug 20 11:08:05 2023 +0200
+++ b/src/ChartiSpindel.cpp	Sun Aug 20 11:40:51 2023 +0200
@@ -210,10 +210,11 @@
 	else if (series == density)
 	    t_tooltip->setText(QString(tr("%1\nDensity %2 SG")).arg(timeis.toString("dd-MM-yyyy hh:mm")).arg(point.y(), 5, 'f', 4));
 	else if (series == battery) {
-	    double batt = point.y() - 3.064;	/* 0% */
+	    const float battery_max = 4.13;
+            const float battery_min = 3.43;
+	    double batt = ((point.y() - battery_min) / (battery_max - battery_min)) * 100;
 	    if (batt < 0)
 		batt = 0;
-	    batt = round(batt / 1.17875 * 1000.0) / 10;	/* 100% range */
 	    if (batt > 100)
 		batt = 100;
 	    t_tooltip->setText(QString(tr("%1\nBattery %2 volt\nCapacity %3%")).arg(timeis.toString("dd-MM-yyyy hh:mm"))

mercurial