From 0c246dc372e14d100221f0c999a4130dbb7fc1c9 Mon Sep 17 00:00:00 2001 From: Mateusz Piesta Date: Tue, 12 Jul 2022 13:05:02 +0200 Subject: [PATCH] [BH-1533] Display battery charging state Battery state during charging is always displayed even if the state of charge reached 100%. Minor refactor of BellBattery class. Removed unused includes. --- module-db/Interface/AlarmEventRecord.cpp | 3 --- module-db/Interface/AlarmEventRecord.hpp | 2 +- .../layouts/HomeScreenLayoutClassic.hpp | 6 ----- .../layouts/HomeScreenLayoutVertical.hpp | 6 ----- .../include/common/widgets/BellBattery.hpp | 11 ++------ .../src/layouts/HomeScreenLayoutClassic.cpp | 19 +++++++++----- .../src/layouts/HomeScreenLayoutVertical.cpp | 20 +++++++++----- .../apps/common/src/widgets/BellBattery.cpp | 26 +++++++------------ 8 files changed, 38 insertions(+), 55 deletions(-) diff --git a/module-db/Interface/AlarmEventRecord.cpp b/module-db/Interface/AlarmEventRecord.cpp index c0d37adaf592623465031200825f282b710a4a87..73f0af30dc543dc13a088ea5fccef678b18e1b9d 100644 --- a/module-db/Interface/AlarmEventRecord.cpp +++ b/module-db/Interface/AlarmEventRecord.cpp @@ -39,9 +39,6 @@ auto AlarmEventRecord::isValid() const -> bool AlarmEventRecordInterface::AlarmEventRecordInterface(EventsDB *eventsDB) : eventsDB(eventsDB) {} -AlarmEventRecordInterface::~AlarmEventRecordInterface() -{} - std::unique_ptr AlarmEventRecordInterface::runQuery(std::shared_ptr query) { if (typeid(*query) == typeid(db::query::alarmEvents::Add)) { diff --git a/module-db/Interface/AlarmEventRecord.hpp b/module-db/Interface/AlarmEventRecord.hpp index e37e40d0768169685b6e3a8cb3845b8209d0c203..1799109e19cb654246dc9fd42d9f5d467cdd78ca 100644 --- a/module-db/Interface/AlarmEventRecord.hpp +++ b/module-db/Interface/AlarmEventRecord.hpp @@ -66,7 +66,7 @@ class AlarmEventRecordInterface : public db::Interface { public: explicit AlarmEventRecordInterface(EventsDB *eventsDB); - ~AlarmEventRecordInterface(); + virtual ~AlarmEventRecordInterface() noexcept = default; std::unique_ptr runQuery(std::shared_ptr query) override; diff --git a/products/BellHybrid/apps/common/include/common/layouts/HomeScreenLayoutClassic.hpp b/products/BellHybrid/apps/common/include/common/layouts/HomeScreenLayoutClassic.hpp index 96ff778157d14cf49adaa41bb7da659658e2c15d..8f6bf36a567826674b5f75a29734a7e9c38c1fa9 100644 --- a/products/BellHybrid/apps/common/include/common/layouts/HomeScreenLayoutClassic.hpp +++ b/products/BellHybrid/apps/common/include/common/layouts/HomeScreenLayoutClassic.hpp @@ -39,12 +39,6 @@ namespace gui SnoozeIconAndTime, }; - namespace battery - { - constexpr auto chargingLevelHideBot = 100; - constexpr auto dischargingLevelShowTop = 20; - }; // namespace battery - class HomeScreenLayoutClassic : public BaseHomeScreenLayoutProvider, BellBaseLayout { public: diff --git a/products/BellHybrid/apps/common/include/common/layouts/HomeScreenLayoutVertical.hpp b/products/BellHybrid/apps/common/include/common/layouts/HomeScreenLayoutVertical.hpp index 0423bf3cff557743e2f6439c10564f923c1e9d43..2b3a08bb3968c194e2ec89f9210ee11e9bc9836d 100644 --- a/products/BellHybrid/apps/common/include/common/layouts/HomeScreenLayoutVertical.hpp +++ b/products/BellHybrid/apps/common/include/common/layouts/HomeScreenLayoutVertical.hpp @@ -24,12 +24,6 @@ namespace gui class Icon; class Item; - namespace battery_vertical - { - constexpr auto chargingLevelHideBot = 100; - constexpr auto dischargingLevelShowTop = 20; - }; // namespace battery_vertical - enum class ScreenMode { Main, diff --git a/products/BellHybrid/apps/common/include/common/widgets/BellBattery.hpp b/products/BellHybrid/apps/common/include/common/widgets/BellBattery.hpp index 031e85476439dc67749cde61d3e701268cf40f55..9176e4a4f6d0992e60d2dfce92009db255c1c72a 100644 --- a/products/BellHybrid/apps/common/include/common/widgets/BellBattery.hpp +++ b/products/BellHybrid/apps/common/include/common/widgets/BellBattery.hpp @@ -3,7 +3,7 @@ #pragma once -#include +#include #include #include #include @@ -13,13 +13,7 @@ namespace gui namespace battery { - constexpr auto battery_low = "bell_battery_lvl1"; - constexpr auto battery_critical = "bell_battery_empty"; - constexpr auto battery_charging = "bell_battery_charging"; constexpr auto font_small = style::window::font::largelight; - constexpr auto image_h = 64; - constexpr auto image_w = 64U; - constexpr auto image_left_margin = 0U; constexpr auto image_right_margin = 10U; constexpr auto percent_h = 102U; constexpr auto percent_w = 106U; @@ -38,9 +32,8 @@ namespace gui { public: BellBattery(Item *parent, uint32_t x, uint32_t y, uint32_t w, uint32_t h); - void update(const Store::Battery &batteryContext); + void update(units::SOC soc, bool isCharging); void setBatteryPercentMode(BatteryPercentMode mode); - std::uint32_t getLevel(); private: BatteryPercentMode batteryPercentMode = BatteryPercentMode::Show; diff --git a/products/BellHybrid/apps/common/src/layouts/HomeScreenLayoutClassic.cpp b/products/BellHybrid/apps/common/src/layouts/HomeScreenLayoutClassic.cpp index 4852b5a022892ed3bfe6dbd9c15ed42c5f66cebd..249a88114c4d427ed170ec7727ff1b4070150e60 100644 --- a/products/BellHybrid/apps/common/src/layouts/HomeScreenLayoutClassic.cpp +++ b/products/BellHybrid/apps/common/src/layouts/HomeScreenLayoutClassic.cpp @@ -8,13 +8,23 @@ #include "widgets/SnoozeTimer.hpp" #include -#include #include #include #include