forked from tbnobody/OpenDTU
-
Notifications
You must be signed in to change notification settings - Fork 60
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'tbnobody/OpenDTU/master'
- Loading branch information
Showing
166 changed files
with
4,452 additions
and
2,428 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 |
---|---|---|
@@ -0,0 +1,27 @@ | ||
// SPDX-License-Identifier: GPL-2.0-or-later | ||
#pragma once | ||
|
||
#include <AsyncWebSocket.h> | ||
#include <HardwareSerial.h> | ||
#include <Stream.h> | ||
|
||
#define BUFFER_SIZE 500 | ||
|
||
class MessageOutputClass : public Print { | ||
public: | ||
MessageOutputClass(); | ||
void loop(); | ||
size_t write(uint8_t c); | ||
void register_ws_output(AsyncWebSocket* output); | ||
|
||
private: | ||
AsyncWebSocket* _ws = NULL; | ||
char _buffer[BUFFER_SIZE]; | ||
uint16_t _buff_pos = 0; | ||
uint32_t _lastSend = 0; | ||
bool _forceSend = false; | ||
|
||
SemaphoreHandle_t _lock; | ||
}; | ||
|
||
extern MessageOutputClass MessageOutput; |
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,15 @@ | ||
// SPDX-License-Identifier: GPL-2.0-or-later | ||
#pragma once | ||
|
||
#include <cstdint> | ||
|
||
class MqttHandleDtuClass { | ||
public: | ||
void init(); | ||
void loop(); | ||
|
||
private: | ||
uint32_t _lastPublish; | ||
}; | ||
|
||
extern MqttHandleDtuClass MqttHandleDtu; |
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
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,84 @@ | ||
// SPDX-License-Identifier: GPL-2.0-or-later | ||
#pragma once | ||
|
||
enum WebApiError { | ||
GenericBase = 1000, | ||
GenericSuccess, | ||
GenericNoValueFound, | ||
GenericDataTooLarge, | ||
GenericParseError, | ||
GenericValueMissing, | ||
|
||
DtuBase = 2000, | ||
DtuSerialZero, | ||
DtuPollZero, | ||
DtuInvalidPowerLevel, | ||
|
||
ConfigBase = 3000, | ||
ConfigNotDeleted, | ||
ConfigSuccess, | ||
|
||
InverterBase = 4000, | ||
InverterSerialZero, | ||
InverterNameLength, | ||
InverterCount, | ||
InverterAdded, | ||
InverterInvalidId, | ||
InverterInvalidMaxChannel, | ||
InverterChanged, | ||
InverterDeleted, | ||
|
||
LimitBase = 5000, | ||
LimitSerialZero, | ||
LimitInvalidLimit, | ||
LimitInvalidType, | ||
LimitInvalidInverter, | ||
|
||
MaintenanceBase = 6000, | ||
MaintenanceRebootTriggered, | ||
MaintenanceRebootCancled, | ||
|
||
MqttBase = 7000, | ||
MqttHostnameLength, | ||
MqttUsernameLength, | ||
MqttPasswordLength, | ||
MqttTopicLength, | ||
MqttTopicCharacter, | ||
MqttTopicTrailingSlash, | ||
MqttPort, | ||
MqttCertificateLength, | ||
MqttLwtTopicLength, | ||
MqttLwtTopicCharacter, | ||
MqttLwtOnlineLength, | ||
MqttLwtOfflineLength, | ||
MqttPublishInterval, | ||
MqttHassTopicLength, | ||
MqttHassTopicCharacter, | ||
|
||
NetworkBase = 8000, | ||
NetworkIpInvalid, | ||
NetworkNetmaskInvalid, | ||
NetworkGatewayInvalid, | ||
NetworkDns1Invalid, | ||
NetworkDns2Invalid, | ||
|
||
NtpBase = 9000, | ||
NtpServerLength, | ||
NtpTimezoneLength, | ||
NtpTimezoneDescriptionLength, | ||
NtpYearInvalid, | ||
NtpMonthInvalid, | ||
NtpDayInvalid, | ||
NtpHourInvalid, | ||
NtpMinuteInvalid, | ||
NtpSecondInvalid, | ||
NtpTimeUpdated, | ||
|
||
SecurityBase = 10000, | ||
SecurityPasswordLength, | ||
SecurityAuthSuccess, | ||
|
||
PowerBase = 11000, | ||
PowerSerialZero, | ||
PowerInvalidInverter, | ||
}; |
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,19 @@ | ||
// SPDX-License-Identifier: GPL-2.0-or-later | ||
#pragma once | ||
|
||
#include <ESPAsyncWebServer.h> | ||
|
||
class WebApiWsConsoleClass { | ||
public: | ||
WebApiWsConsoleClass(); | ||
void init(AsyncWebServer* server); | ||
void loop(); | ||
|
||
private: | ||
void onWebsocketEvent(AsyncWebSocket* server, AsyncWebSocketClient* client, AwsEventType type, void* arg, uint8_t* data, size_t len); | ||
|
||
AsyncWebServer* _server; | ||
AsyncWebSocket _ws; | ||
|
||
uint32_t _lastWsCleanup = 0; | ||
}; |
Oops, something went wrong.