From 28ad821b970f4de102b3ee86c852656cf1473e7f Mon Sep 17 00:00:00 2001 From: Explorer09 Date: Sat, 10 Feb 2024 18:31:29 +0800 Subject: [PATCH] makeDetailsMask() blanksAtEnd floats (q15a) --- Meter.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/Meter.c b/Meter.c index 29e41710c..db17691b1 100644 --- a/Meter.c +++ b/Meter.c @@ -526,13 +526,10 @@ static uint16_t GraphMeterMode_makeDetailsMask(const GraphColorComputeState* pre roundsUpInAscii = distance > 0.5; roundsDownInAscii = distance < 0.5; - double fraction = (uint8_t)numDots % 2 > 0 ? 0.5 : 0.0; + double fraction = numDots * 0.5; + fraction -= (int)fraction; distance = ceil(distance * 8.0 - fraction); - if (8.0 - distance - (uint8_t)numDots / 2 > 0) { - blanksAtEnd = 8.0 - distance - (uint8_t)numDots / 2; - } else { - blanksAtEnd = 0; - } + blanksAtEnd = (uint8_t)MAXIMUM(8.0 - distance - (double)(int)(numDots * 0.5), 0.0); } assert(blanksAtEnd < 8);