forked from tbnobody/OpenDTU
-
Notifications
You must be signed in to change notification settings - Fork 66
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge development into master to prepare release 2024.03.23
Prepare release 2024.03.23
- Loading branch information
Showing
103 changed files
with
3,354 additions
and
1,962 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,36 +1,35 @@ | ||
// SPDX-License-Identifier: GPL-2.0-or-later | ||
#pragma once | ||
|
||
#include <stdint.h> | ||
#include <memory> | ||
#include <mutex> | ||
#include <TaskSchedulerDeclarations.h> | ||
|
||
#include "BatteryStats.h" | ||
|
||
class BatteryProvider { | ||
public: | ||
// returns true if the provider is ready for use, false otherwise | ||
virtual bool init(bool verboseLogging) = 0; | ||
|
||
virtual void deinit() = 0; | ||
virtual void loop() = 0; | ||
virtual std::shared_ptr<BatteryStats> getStats() const = 0; | ||
public: | ||
// returns true if the provider is ready for use, false otherwise | ||
virtual bool init(bool verboseLogging) = 0; | ||
virtual void deinit() = 0; | ||
virtual void loop() = 0; | ||
virtual std::shared_ptr<BatteryStats> getStats() const = 0; | ||
virtual bool usesHwPort2() const { return false; } | ||
}; | ||
|
||
class BatteryClass { | ||
public: | ||
void init(Scheduler&); | ||
void updateSettings(); | ||
public: | ||
void init(Scheduler&); | ||
void updateSettings(); | ||
|
||
std::shared_ptr<BatteryStats const> getStats() const; | ||
private: | ||
void loop(); | ||
std::shared_ptr<BatteryStats const> getStats() const; | ||
|
||
Task _loopTask; | ||
private: | ||
void loop(); | ||
|
||
mutable std::mutex _mutex; | ||
std::unique_ptr<BatteryProvider> _upProvider = nullptr; | ||
Task _loopTask; | ||
mutable std::mutex _mutex; | ||
std::unique_ptr<BatteryProvider> _upProvider = nullptr; | ||
}; | ||
|
||
extern BatteryClass Battery; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
// SPDX-License-Identifier: GPL-2.0-or-later | ||
#pragma once | ||
|
||
#include <ArduinoJson.h> | ||
#include <TaskSchedulerDeclarations.h> | ||
|
||
class MqttHandlePowerLimiterHassClass { | ||
public: | ||
void init(Scheduler& scheduler); | ||
void publishConfig(); | ||
void forceUpdate(); | ||
|
||
private: | ||
void loop(); | ||
void publish(const String& subtopic, const String& payload); | ||
void publishNumber(const char* caption, const char* icon, const char* category, const char* commandTopic, const char* stateTopic, const char* unitOfMeasure, const int16_t min, const int16_t max); | ||
void publishSelect(const char* caption, const char* icon, const char* category, const char* commandTopic, const char* stateTopic); | ||
void createDeviceInfo(JsonObject& object); | ||
|
||
Task _loopTask; | ||
|
||
bool _wasConnected = false; | ||
bool _updateForced = false; | ||
}; | ||
|
||
extern MqttHandlePowerLimiterHassClass MqttHandlePowerLimiterHass; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.