diff --git a/Platformio/HAL/HardwareAbstract.cpp b/Platformio/HAL/HardwareAbstract.cpp index b6d70a8..0de7a1b 100644 --- a/Platformio/HAL/HardwareAbstract.cpp +++ b/Platformio/HAL/HardwareAbstract.cpp @@ -1,9 +1,9 @@ #include "HardwareAbstract.hpp" HardwareAbstract::HardwareAbstract( + std::shared_ptr aDisplay, std::shared_ptr aBattery, - std::shared_ptr aWifiHandler, - std::shared_ptr aDisplay + std::shared_ptr aWifiHandler ) : mBattery(std::move(aBattery)), mWifiHandler(std::move(aWifiHandler)), diff --git a/Platformio/HAL/HardwareAbstract.hpp b/Platformio/HAL/HardwareAbstract.hpp index 0c48b9e..32a32e4 100644 --- a/Platformio/HAL/HardwareAbstract.hpp +++ b/Platformio/HAL/HardwareAbstract.hpp @@ -15,11 +15,12 @@ class HardwareAbstract { public: - HardwareAbstract(std::shared_ptr aBattery = nullptr, - std::shared_ptr aWifiHandler = nullptr, - std::shared_ptr aDisplay = nullptr + HardwareAbstract( + std::shared_ptr aDisplay, + std::shared_ptr aBattery = nullptr, + std::shared_ptr aWifiHandler = nullptr ); - + struct batteryStatus { /// @brief Percent of battery remaining (0-100] int percentage; @@ -29,25 +30,24 @@ public: }; virtual std::optional getBatteryStatus(); - /// @brief Register function to be ran when hardware notifies battery - /// status has changed. + /// @brief Register function to be ran when hardware notifies battery + /// status has changed. /// @param onBatteryStatusChangeHandler - Callable to be ran when batter status changes void onBatteryChange(std::function onBatteryStatusChangeHandler); - + /// @brief Override in order to do setup of hardware devices virtual void init() = 0; - + /// @brief Override to allow printing of a message for debugging /// @param message - Debug message virtual void debugPrint(std::string message) = 0; protected: Notification mBatteryNotification; - + private: std::shared_ptr mBattery; std::shared_ptr mWifiHandler; std::shared_ptr mDisplay; - }; diff --git a/Platformio/HAL/Targets/ESP32/HardwareRevX.cpp b/Platformio/HAL/Targets/ESP32/HardwareRevX.cpp index 8351908..6023625 100644 --- a/Platformio/HAL/Targets/ESP32/HardwareRevX.cpp +++ b/Platformio/HAL/Targets/ESP32/HardwareRevX.cpp @@ -53,9 +53,9 @@ void HardwareRevX::initIO() { HardwareRevX::HardwareRevX(): HardwareAbstract( + Display::getInstance(standbyTimer), std::make_shared(ADC_BAT,CRG_STAT), - wifiHandler::getInstance(), - Display::getInstance(standbyTimer) + wifiHandler::getInstance() ){} HardwareRevX::WakeReason getWakeReason() { diff --git a/Platformio/HAL/Targets/Simulator/HardwareSimulator.hpp b/Platformio/HAL/Targets/Simulator/HardwareSimulator.hpp index 979dc06..6fc67d5 100644 --- a/Platformio/HAL/Targets/Simulator/HardwareSimulator.hpp +++ b/Platformio/HAL/Targets/Simulator/HardwareSimulator.hpp @@ -5,7 +5,7 @@ class HardwareSimulator : public HardwareAbstract { public: - HardwareSimulator() : HardwareAbstract(nullptr){}; + HardwareSimulator() : HardwareAbstract(){}; virtual void debugPrint(std::string message) override { std::cout << message;