From 754918fda6a1ead2c6a8b440af489aae038918d0 Mon Sep 17 00:00:00 2001 From: JF Date: Sat, 22 Aug 2020 20:43:14 +0200 Subject: [PATCH] Fix bad formatting in SystemInfo. --- src/DisplayApp/Screens/Clock.h | 2 +- src/DisplayApp/Screens/SystemInfo.cpp | 9 +++++---- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/DisplayApp/Screens/Clock.h b/src/DisplayApp/Screens/Clock.h index e1e10bdf..7363fdaf 100644 --- a/src/DisplayApp/Screens/Clock.h +++ b/src/DisplayApp/Screens/Clock.h @@ -57,7 +57,7 @@ namespace Pinetime { Pinetime::Controllers::DateTime::Days currentDayOfWeek = Pinetime::Controllers::DateTime::Days::Unknown; uint8_t currentDay = 0; - DirtyValue batteryPercentRemaining {0}; + DirtyValue batteryPercentRemaining {0}; DirtyValue bleState {false}; DirtyValue> currentDateTime; DirtyValue stepCount {0}; diff --git a/src/DisplayApp/Screens/SystemInfo.cpp b/src/DisplayApp/Screens/SystemInfo.cpp index ef55eb5f..fcafcf7d 100644 --- a/src/DisplayApp/Screens/SystemInfo.cpp +++ b/src/DisplayApp/Screens/SystemInfo.cpp @@ -43,9 +43,10 @@ bool SystemInfo::OnTouchEvent(Pinetime::Applications::TouchEvents event) { } std::unique_ptr SystemInfo::CreateScreen1() { - auto batteryPercent = static_cast(batteryController.PercentRemaining()); - if(batteryPercent > 100) batteryPercent = 100; - else if(batteryPercent < 0) batteryPercent = 0; + auto batteryPercentF = batteryController.PercentRemaining(); + uint16_t batteryPercent = 0; + if(batteryPercentF > 100.0f) batteryPercent = 100; + else if(batteryPercentF < 0.0f) batteryPercent = 0; uint8_t brightness = 0; switch(brightnessController.Level()) { @@ -86,7 +87,7 @@ std::unique_ptr SystemInfo::CreateScreen1() { "Version:%ld.%ld.%ld\n" "Build: %s\n" " %s\n" - "Date: %02d/%02hhu/%04d\n" + "Date: %02d/%02d/%04d\n" "Time: %02d:%02d:%02d\n" "Uptime: %02lud %02lu:%02lu:%02lu\n" "Battery: %d%%\n"