Skip to content

Commit

Permalink
Merge remote-tracking branch 'tbnobody/OpenDTU/master' into development
Browse files Browse the repository at this point in the history
  • Loading branch information
helgeerbe committed Feb 19, 2024
2 parents 4e7dfba + 43c3c8d commit c72ae56
Show file tree
Hide file tree
Showing 79 changed files with 856 additions and 600 deletions.
10 changes: 5 additions & 5 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,14 @@ jobs:
- uses: actions/checkout@v4

- name: Cache pip
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-
- uses: actions/setup-python@v4
- uses: actions/setup-python@v5
with:
python-version: "3.x"

Expand Down Expand Up @@ -61,21 +61,21 @@ jobs:
run: git fetch --force --tags origin

- name: Cache pip
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-
- name: Cache PlatformIO
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: ~/.platformio
key: ${{ runner.os }}-${{ hashFiles('**/lockfiles') }}

- name: Set up Python
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: "3.x"

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/cpplint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:
steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: "3.x"
- name: Install dependencies
Expand Down
76 changes: 76 additions & 0 deletions docs/DeviceProfiles/AhoyDTU-ESP32.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
[
{
"name": "AhoyDTU ESP32 Display LED",
"links": [
{"name": "Information", "url": "https://ahoydtu.de/getting_started/"}
],
"nrf24": {
"miso": 19,
"mosi": 23,
"clk": 18,
"irq": 16,
"en": 4,
"cs": 5
},
"led": {
"led0": 25,
"led1": 26
},
"display": {
"type": 2,
"data": 21,
"clk": 22
}
},
{
"name": "AhoyDTU ESP32 Display",
"links": [
{"name": "Information", "url": "https://ahoydtu.de/getting_started/"}
],
"nrf24": {
"miso": 19,
"mosi": 23,
"clk": 18,
"irq": 16,
"en": 4,
"cs": 5
},
"display": {
"type": 2,
"data": 21,
"clk": 22
}
},
{
"name": "AhoyDTU ESP32 LED",
"links": [
{"name": "Information", "url": "https://ahoydtu.de/getting_started/"}
],
"nrf24": {
"miso": 19,
"mosi": 23,
"clk": 18,
"irq": 16,
"en": 4,
"cs": 5
},
"led": {
"led0": 25,
"led1": 26
}
},
{
"name": "AhoyDTU ESP32",
"links": [
{"name": "Information", "url": "https://ahoydtu.de/getting_started/"}
],
"nrf24": {
"miso": 19,
"mosi": 23,
"clk": 18,
"irq": 16,
"en": 4,
"cs": 5
}
}
]
74 changes: 74 additions & 0 deletions docs/DeviceProfiles/liligo_t-eth-lite_poe.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
[
{
"name": "LILYGO T-ETH-Lite-POE CMT",
"links": [
{"name": "Datasheet", "url": "https://www.lilygo.cc/products/t-eth-lite"}
],
"eth": {
"enabled": true,
"phy_addr": 0,
"power": 12,
"mdc": 23,
"mdio": 18,
"type": 2,
"clk_mode": 0
},
"cmt": {
"clk": 15,
"cs": 32,
"fcs": 33,
"sdio": 4
}
},
{
"name": "LILYGO T-ETH-Lite-POE NRF24",
"links": [
{"name": "Datasheet", "url": "https://www.lilygo.cc/products/t-eth-lite"}
],
"eth": {
"enabled": true,
"phy_addr": 0,
"power": 12,
"mdc": 23,
"mdio": 18,
"type": 2,
"clk_mode": 0
},
"nrf24": {
"miso": 34,
"mosi": 13,
"clk": 14,
"irq": 35,
"en": 4,
"cs": 2
}
},
{
"name": "LILYGO T-ETH-Lite-POE NRF24 + Display",
"links": [
{"name": "Datasheet", "url": "https://www.lilygo.cc/products/t-eth-lite"}
],
"eth": {
"enabled": true,
"phy_addr": 0,
"power": 12,
"mdc": 23,
"mdio": 18,
"type": 2,
"clk_mode": 0
},
"nrf24": {
"miso": 34,
"mosi": 13,
"clk": 14,
"irq": 35,
"en": 4,
"cs": 2
},
"display": {
"type": 3,
"data": 32,
"clk": 33
}
}
]
1 change: 1 addition & 0 deletions include/Utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,5 @@ class Utils {
static int getTimezoneOffset();
static void restartDtu();
static bool checkJsonAlloc(const DynamicJsonDocument& doc, const char* function, const uint16_t line);
static void removeAllFiles();
};
2 changes: 0 additions & 2 deletions include/WebApi_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,4 @@ class WebApiConfigClass {
void onConfigListGet(AsyncWebServerRequest* request);
void onConfigUploadFinish(AsyncWebServerRequest* request);
void onConfigUpload(AsyncWebServerRequest* request, String filename, size_t index, uint8_t* data, size_t len, bool final);

AsyncWebServer* _server;
};
2 changes: 0 additions & 2 deletions include/WebApi_device.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,4 @@ class WebApiDeviceClass {
private:
void onDeviceAdminGet(AsyncWebServerRequest* request);
void onDeviceAdminPost(AsyncWebServerRequest* request);

AsyncWebServer* _server;
};
2 changes: 0 additions & 2 deletions include/WebApi_devinfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,4 @@ class WebApiDevInfoClass {

private:
void onDevInfoStatus(AsyncWebServerRequest* request);

AsyncWebServer* _server;
};
2 changes: 0 additions & 2 deletions include/WebApi_dtu.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@ class WebApiDtuClass {
void onDtuAdminGet(AsyncWebServerRequest* request);
void onDtuAdminPost(AsyncWebServerRequest* request);

AsyncWebServer* _server;

Task _applyDataTask;
void applyDataTaskCb();
};
2 changes: 0 additions & 2 deletions include/WebApi_eventlog.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,4 @@ class WebApiEventlogClass {

private:
void onEventlogStatus(AsyncWebServerRequest* request);

AsyncWebServer* _server;
};
2 changes: 0 additions & 2 deletions include/WebApi_firmware.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,4 @@ class WebApiFirmwareClass {
private:
void onFirmwareUpdateFinish(AsyncWebServerRequest* request);
void onFirmwareUpdateUpload(AsyncWebServerRequest* request, String filename, size_t index, uint8_t* data, size_t len, bool final);

AsyncWebServer* _server;
};
2 changes: 0 additions & 2 deletions include/WebApi_gridprofile.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,4 @@ class WebApiGridProfileClass {
private:
void onGridProfileStatus(AsyncWebServerRequest* request);
void onGridProfileRawdata(AsyncWebServerRequest* request);

AsyncWebServer* _server;
};
2 changes: 0 additions & 2 deletions include/WebApi_inverter.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,4 @@ class WebApiInverterClass {
void onInverterEdit(AsyncWebServerRequest* request);
void onInverterDelete(AsyncWebServerRequest* request);
void onInverterOrder(AsyncWebServerRequest* request);

AsyncWebServer* _server;
};
2 changes: 0 additions & 2 deletions include/WebApi_limit.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,4 @@ class WebApiLimitClass {
private:
void onLimitStatus(AsyncWebServerRequest* request);
void onLimitPost(AsyncWebServerRequest* request);

AsyncWebServer* _server;
};
2 changes: 0 additions & 2 deletions include/WebApi_maintenance.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,4 @@ class WebApiMaintenanceClass {

private:
void onRebootPost(AsyncWebServerRequest* request);

AsyncWebServer* _server;
};
2 changes: 0 additions & 2 deletions include/WebApi_mqtt.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,4 @@ class WebApiMqttClass {
void onMqttAdminGet(AsyncWebServerRequest* request);
void onMqttAdminPost(AsyncWebServerRequest* request);
String getTlsCertInfo(const char* cert);

AsyncWebServer* _server;
};
2 changes: 0 additions & 2 deletions include/WebApi_network.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,4 @@ class WebApiNetworkClass {
void onNetworkStatus(AsyncWebServerRequest* request);
void onNetworkAdminGet(AsyncWebServerRequest* request);
void onNetworkAdminPost(AsyncWebServerRequest* request);

AsyncWebServer* _server;
};
2 changes: 0 additions & 2 deletions include/WebApi_ntp.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,4 @@ class WebApiNtpClass {
void onNtpAdminPost(AsyncWebServerRequest* request);
void onNtpTimeGet(AsyncWebServerRequest* request);
void onNtpTimePost(AsyncWebServerRequest* request);

AsyncWebServer* _server;
};
2 changes: 0 additions & 2 deletions include/WebApi_power.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,4 @@ class WebApiPowerClass {
private:
void onPowerStatus(AsyncWebServerRequest* request);
void onPowerPost(AsyncWebServerRequest* request);

AsyncWebServer* _server;
};
2 changes: 0 additions & 2 deletions include/WebApi_prometheus.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@ class WebApiPrometheusClass {

void addPanelInfo(AsyncResponseStream* stream, const String& serial, const uint8_t idx, std::shared_ptr<InverterAbstract> inv, const ChannelType_t type, const ChannelNum_t channel);

AsyncWebServer* _server;

enum MetricType_t {
NONE = 0,
GAUGE,
Expand Down
2 changes: 0 additions & 2 deletions include/WebApi_security.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,4 @@ class WebApiSecurityClass {
void onSecurityPost(AsyncWebServerRequest* request);

void onAuthenticateGet(AsyncWebServerRequest* request);

AsyncWebServer* _server;
};
2 changes: 0 additions & 2 deletions include/WebApi_sysstatus.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,4 @@ class WebApiSysstatusClass {

private:
void onSystemStatus(AsyncWebServerRequest* request);

AsyncWebServer* _server;
};
2 changes: 1 addition & 1 deletion include/WebApi_webapp.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,5 @@ class WebApiWebappClass {
void init(AsyncWebServer& server, Scheduler& scheduler);

private:
AsyncWebServer* _server;
void responseBinaryDataWithETagCache(AsyncWebServerRequest* request, const String &contentType, const String &contentEncoding, const uint8_t *content, size_t len);
};
1 change: 0 additions & 1 deletion include/WebApi_ws_console.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ class WebApiWsConsoleClass {
void init(AsyncWebServer& server, Scheduler& scheduler);

private:
AsyncWebServer* _server;
AsyncWebSocket _ws;

Task _wsCleanupTask;
Expand Down
15 changes: 9 additions & 6 deletions include/WebApi_ws_live.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// SPDX-License-Identifier: GPL-2.0-or-later
#pragma once

#include "Configuration.h"
#include <ArduinoJson.h>
#include <ESPAsyncWebServer.h>
#include <Hoymiles.h>
Expand All @@ -12,17 +13,19 @@ class WebApiWsLiveClass {
void init(AsyncWebServer& server, Scheduler& scheduler);

private:
void generateJsonResponse(JsonVariant& root);
void addField(JsonObject& root, std::shared_ptr<InverterAbstract> inv, const ChannelType_t type, const ChannelNum_t channel, const FieldId_t fieldId, String topic = "");
void addTotalField(JsonObject& root, const String& name, const float value, const String& unit, const uint8_t digits);
static void generateInverterCommonJsonResponse(JsonObject& root, std::shared_ptr<InverterAbstract> inv);
static void generateInverterChannelJsonResponse(JsonObject& root, std::shared_ptr<InverterAbstract> inv);
static void generateCommonJsonResponse(JsonVariant& root);

static void addField(JsonObject& root, std::shared_ptr<InverterAbstract> inv, const ChannelType_t type, const ChannelNum_t channel, const FieldId_t fieldId, String topic = "");
static void addTotalField(JsonObject& root, const String& name, const float value, const String& unit, const uint8_t digits);

void onLivedataStatus(AsyncWebServerRequest* request);
void onWebsocketEvent(AsyncWebSocket* server, AsyncWebSocketClient* client, AwsEventType type, void* arg, uint8_t* data, size_t len);

AsyncWebServer* _server;
AsyncWebSocket _ws;

uint32_t _lastWsPublish = 0;
uint32_t _newestInverterTimestamp = 0;
uint32_t _lastPublishStats[INV_MAX_COUNT] = { 0 };

std::mutex _mutex;

Expand Down
5 changes: 4 additions & 1 deletion lib/Hoymiles/src/HoymilesRadio_CMT.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -239,8 +239,11 @@ CountryModeId_t HoymilesRadio_CMT::getCountryMode() const

void HoymilesRadio_CMT::setCountryMode(const CountryModeId_t mode)
{
_radio->setFrequencyBand(countryDefinition.at(mode).Band);
_countryMode = mode;
if (!_isInitialized) {
return;
}
_radio->setFrequencyBand(countryDefinition.at(mode).Band);
}

uint32_t HoymilesRadio_CMT::getInvBootFrequency() const
Expand Down
Loading

0 comments on commit c72ae56

Please sign in to comment.