From 4d318bf4ec4b407239f1219bae766fda7cac1bc7 Mon Sep 17 00:00:00 2001 From: Manuel Weiser Date: Mon, 9 Mar 2026 19:25:01 +0100 Subject: [PATCH] fix: change weight parameter type to int16_t in oledShowWeight function --- src/display.cpp | 2 +- src/display.h | 2 +- src/main.cpp | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/display.cpp b/src/display.cpp index 80c18cc..cd74955 100644 --- a/src/display.cpp +++ b/src/display.cpp @@ -270,7 +270,7 @@ void oledShowProgressBar(const uint8_t step, const uint8_t numSteps, const char* display.display(); } -void oledShowWeight(uint16_t weight) { +void oledShowWeight(int16_t weight) { // Display Gewicht oledcleardata(); display.setTextSize(3); diff --git a/src/display.h b/src/display.h index 414838d..9f86012 100644 --- a/src/display.h +++ b/src/display.h @@ -32,7 +32,7 @@ int oled_center_v(const String &text); void oledShowProgressBar(const uint8_t step, const uint8_t numSteps, const char* largeText, const char* statusMessage); -void oledShowWeight(uint16_t weight); +void oledShowWeight(int16_t weight); void oledShowRemainingWeight(uint16_t remainingWeight); void oledDisplayText(const String &message, uint8_t size = 2); void oledShowConnectionError(const char* error, const String& ip); diff --git a/src/main.cpp b/src/main.cpp index 6194259..856683f 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -168,7 +168,7 @@ void loop() { int16_t displayWeight = getFilteredDisplayWeight(); if (mainTaskWasPaused || (weight != lastWeight && (nfcReaderState == NFC_IDLE || tagProcessed))) { - (displayWeight < 2) ? ((displayWeight < -2) ? oledDisplayText("!! -0") : oledShowWeight(0)) : oledShowWeight(displayWeight); + oledShowWeight((abs(displayWeight) < 2) ? 0 : displayWeight); oledSetPriority(DISPLAY_PRIORITY_STATUS, 0); // Weight can always be overwritten } mainTaskWasPaused = false;