diff --git a/Platformio/HAL/Interface/BatteryInterface.h b/Platformio/HAL/Interface/BatteryInterface.h index 60a9a3f..3cc7381 100644 --- a/Platformio/HAL/Interface/BatteryInterface.h +++ b/Platformio/HAL/Interface/BatteryInterface.h @@ -1,6 +1,17 @@ +#include "DisplayInterface.h" class BatteryInterface { public: + struct batteryStatus { + /// @brief Percent of battery remaining (0-100] + int percentage; + /// @brief Voltage of battery in millivolts + int voltage; + /// @brief True - Battery is Charging + /// False - Battery discharging + bool isCharging; + }; + virtual void setup(DisplayInterface& display, int adc_pin, int charging_pin) = 0; virtual int getPercentage() = 0; virtual bool isCharging() = 0; diff --git a/Platformio/HAL/Interface/DisplayInterface.h b/Platformio/HAL/Interface/DisplayInterface.h index a9d79da..2b9aabb 100644 --- a/Platformio/HAL/Interface/DisplayInterface.h +++ b/Platformio/HAL/Interface/DisplayInterface.h @@ -15,4 +15,4 @@ class DisplayInterface virtual void reset_settings_menu() = 0; virtual void update_battery(int percentage, bool isCharging, bool isConnected) = 0; virtual void turnOff() = 0; -} \ No newline at end of file +}; \ No newline at end of file diff --git a/Platformio/HAL/Interface/HardwareInterface.h b/Platformio/HAL/Interface/HardwareInterface.h index 71a455f..6e2df38 100644 --- a/Platformio/HAL/Interface/HardwareInterface.h +++ b/Platformio/HAL/Interface/HardwareInterface.h @@ -4,24 +4,16 @@ #pragma once #include #include +#include "BatteryInterface.h" class HardwareInterface { public: - struct batteryStatus { - /// @brief Percent of battery remaining (0-100] - int percentage; - /// @brief Voltage of battery in millivolts - int voltage; - /// @brief True - Battery is Charging - /// False - Battery discharging - bool isCharging; - }; HardwareInterface() = default; virtual void init() = 0; virtual void sendIR() = 0; virtual void MQTTPublish(const char *topic, const char *payload) = 0; - virtual batteryStatus getBatteryPercentage() = 0; + virtual BatteryInterface::batteryStatus getBatteryPercentage() = 0; virtual void debugPrint(std::string message) = 0; }; diff --git a/Platformio/HAL/Targets/ESP32/HardwareRevX.cpp b/Platformio/HAL/Targets/ESP32/HardwareRevX.cpp index 161163a..151974c 100644 --- a/Platformio/HAL/Targets/ESP32/HardwareRevX.cpp +++ b/Platformio/HAL/Targets/ESP32/HardwareRevX.cpp @@ -99,7 +99,7 @@ void HardwareRevX::MQTTPublish(const char *topic, const char *payload) { #endif } -HardwareInterface::batteryStatus HardwareRevX::getBatteryPercentage() { +BatteryInterface::batteryStatus HardwareRevX::getBatteryPercentage() { return battery; } diff --git a/Platformio/HAL/Targets/Simulator/HardwareSimulator.hpp b/Platformio/HAL/Targets/Simulator/HardwareSimulator.hpp index d7cd0db..612ad66 100644 --- a/Platformio/HAL/Targets/Simulator/HardwareSimulator.hpp +++ b/Platformio/HAL/Targets/Simulator/HardwareSimulator.hpp @@ -19,8 +19,8 @@ public: virtual void init() override; - virtual batteryStatus getBatteryPercentage() { - batteryStatus fakeStatus; + virtual BatteryInterface::batteryStatus getBatteryPercentage() { + BatteryInterface::batteryStatus fakeStatus; fakeStatus.isCharging = false; fakeStatus.percentage = 100; fakeStatus.voltage = 4200; diff --git a/Platformio/HAL/Targets/Simulator/omoteconfig.h b/Platformio/HAL/Targets/Simulator/omoteconfig.h index 4f8b2f6..94e4a42 100644 --- a/Platformio/HAL/Targets/Simulator/omoteconfig.h +++ b/Platformio/HAL/Targets/Simulator/omoteconfig.h @@ -1,6 +1,3 @@ #pragma once -#define IS_SIMULATOR true - -#define SCREEN_WIDTH 240 -#define SCREEN_HEIGHT 360 +#define IS_SIMULATOR true \ No newline at end of file