Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
OFreddy committed Jan 22, 2024
2 parents 6068f3e + a5cc0a4 commit a5d238b
Show file tree
Hide file tree
Showing 83 changed files with 950 additions and 1,050 deletions.
47 changes: 47 additions & 0 deletions docs/DeviceProfiles/olimex_esp32_gateway.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
[
{
"name": "Olimex ESP32-Gateway",
"nrf24": {
"miso": 14,
"mosi": 13,
"clk": 12,
"irq": 15,
"en": 2,
"cs": 4
},
"eth": {
"enabled": true,
"phy_addr": 0,
"power": 12,
"mdc": 23,
"mdio": 18,
"type": 0,
"clk_mode": 3
}
},
{
"name": "Olimex ESP32-Gateway with SSH1106",
"nrf24": {
"miso": 14,
"mosi": 13,
"clk": 12,
"irq": 15,
"en": 2,
"cs": 4
},
"eth": {
"enabled": true,
"phy_addr": 0,
"power": 12,
"mdc": 23,
"mdio": 18,
"type": 0,
"clk_mode": 3
},
"display": {
"type": 3,
"data": 32,
"clk": 16
}
}
]
3 changes: 2 additions & 1 deletion include/Datastore.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

class DatastoreClass {
public:
DatastoreClass();
void init(Scheduler& scheduler);

// Sum of yield total of all enabled inverters, a inverter which is just disabled at night is also included
Expand Down Expand Up @@ -81,4 +82,4 @@ class DatastoreClass {
bool _isAtLeastOnePollEnabled = false;
};

extern DatastoreClass Datastore;
extern DatastoreClass Datastore;
1 change: 1 addition & 0 deletions include/InverterSettings.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

class InverterSettingsClass {
public:
InverterSettingsClass();
void init(Scheduler& scheduler);

private:
Expand Down
67 changes: 34 additions & 33 deletions include/MessageOutput.h
Original file line number Diff line number Diff line change
@@ -1,33 +1,34 @@
// SPDX-License-Identifier: GPL-2.0-or-later
#pragma once

#include <AsyncWebSocket.h>
#include <HardwareSerial.h>
#include <Stream.h>
#include <TaskSchedulerDeclarations.h>
#include <mutex>

#define BUFFER_SIZE 500

class MessageOutputClass : public Print {
public:
void init(Scheduler& scheduler);
size_t write(uint8_t c) override;
size_t write(const uint8_t* buffer, size_t size) override;
void register_ws_output(AsyncWebSocket* output);

private:
void loop();

Task _loopTask;

AsyncWebSocket* _ws = nullptr;
char _buffer[BUFFER_SIZE];
uint16_t _buff_pos = 0;
uint32_t _lastSend = 0;
bool _forceSend = false;

std::mutex _msgLock;
};

extern MessageOutputClass MessageOutput;
// SPDX-License-Identifier: GPL-2.0-or-later
#pragma once

#include <AsyncWebSocket.h>
#include <HardwareSerial.h>
#include <Stream.h>
#include <TaskSchedulerDeclarations.h>
#include <mutex>

#define BUFFER_SIZE 500

class MessageOutputClass : public Print {
public:
MessageOutputClass();
void init(Scheduler& scheduler);
size_t write(uint8_t c) override;
size_t write(const uint8_t* buffer, size_t size) override;
void register_ws_output(AsyncWebSocket* output);

private:
void loop();

Task _loopTask;

AsyncWebSocket* _ws = nullptr;
char _buffer[BUFFER_SIZE];
uint16_t _buff_pos = 0;
uint32_t _lastSend = 0;
bool _forceSend = false;

std::mutex _msgLock;
};

extern MessageOutputClass MessageOutput;
3 changes: 2 additions & 1 deletion include/MqttHandleDtu.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

class MqttHandleDtuClass {
public:
MqttHandleDtuClass();
void init(Scheduler& scheduler);

private:
Expand All @@ -14,4 +15,4 @@ class MqttHandleDtuClass {
Task _loopTask;
};

extern MqttHandleDtuClass MqttHandleDtu;
extern MqttHandleDtuClass MqttHandleDtu;
3 changes: 2 additions & 1 deletion include/MqttHandleHass.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ const byteAssign_fieldDeviceClass_t deviceFieldAssignment[] = {

class MqttHandleHassClass {
public:
MqttHandleHassClass();
void init(Scheduler& scheduler);
void publishConfig();
void forceUpdate();
Expand Down Expand Up @@ -79,4 +80,4 @@ class MqttHandleHassClass {
bool _updateForced = false;
};

extern MqttHandleHassClass MqttHandleHass;
extern MqttHandleHassClass MqttHandleHass;
3 changes: 2 additions & 1 deletion include/MqttHandleInverter.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

class MqttHandleInverterClass {
public:
MqttHandleInverterClass();
void init(Scheduler& scheduler);

static String getTopic(std::shared_ptr<InverterAbstract> inv, const ChannelType_t type, const ChannelNum_t channel, const FieldId_t fieldId);
Expand Down Expand Up @@ -39,4 +40,4 @@ class MqttHandleInverterClass {
};
};

extern MqttHandleInverterClass MqttHandleInverter;
extern MqttHandleInverterClass MqttHandleInverter;
3 changes: 2 additions & 1 deletion include/MqttHandleInverterTotal.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

class MqttHandleInverterTotalClass {
public:
MqttHandleInverterTotalClass();
void init(Scheduler& scheduler);

private:
Expand All @@ -13,4 +14,4 @@ class MqttHandleInverterTotalClass {
Task _loopTask;
};

extern MqttHandleInverterTotalClass MqttHandleInverterTotal;
extern MqttHandleInverterTotalClass MqttHandleInverterTotal;
6 changes: 1 addition & 5 deletions include/WebApi.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,6 @@ class WebApiClass {
static void writeConfig(JsonVariant& retMsg, const WebApiError code = WebApiError::GenericSuccess, const String& message = "Settings saved!");

private:
void loop();

Task _loopTask;

AsyncWebServer _server;

WebApiConfigClass _webApiConfig;
Expand All @@ -66,4 +62,4 @@ class WebApiClass {
WebApiWsLiveClass _webApiWsLive;
};

extern WebApiClass WebApi;
extern WebApiClass WebApi;
6 changes: 3 additions & 3 deletions include/WebApi_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
#pragma once

#include <ESPAsyncWebServer.h>
#include <TaskSchedulerDeclarations.h>

class WebApiConfigClass {
public:
void init(AsyncWebServer& server);
void loop();
void init(AsyncWebServer& server, Scheduler& scheduler);

private:
void onConfigGet(AsyncWebServerRequest* request);
Expand All @@ -16,4 +16,4 @@ class WebApiConfigClass {
void onConfigUpload(AsyncWebServerRequest* request, String filename, size_t index, uint8_t* data, size_t len, bool final);

AsyncWebServer* _server;
};
};
6 changes: 3 additions & 3 deletions include/WebApi_device.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@
#pragma once

#include <ESPAsyncWebServer.h>
#include <TaskSchedulerDeclarations.h>

class WebApiDeviceClass {
public:
void init(AsyncWebServer& server);
void loop();
void init(AsyncWebServer& server, Scheduler& scheduler);

private:
void onDeviceAdminGet(AsyncWebServerRequest* request);
void onDeviceAdminPost(AsyncWebServerRequest* request);

AsyncWebServer* _server;
};
};
6 changes: 3 additions & 3 deletions include/WebApi_devinfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@
#pragma once

#include <ESPAsyncWebServer.h>
#include <TaskSchedulerDeclarations.h>

class WebApiDevInfoClass {
public:
void init(AsyncWebServer& server);
void loop();
void init(AsyncWebServer& server, Scheduler& scheduler);

private:
void onDevInfoStatus(AsyncWebServerRequest* request);

AsyncWebServer* _server;
};
};
9 changes: 6 additions & 3 deletions include/WebApi_dtu.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,19 @@
#pragma once

#include <ESPAsyncWebServer.h>
#include <TaskSchedulerDeclarations.h>

class WebApiDtuClass {
public:
void init(AsyncWebServer& server);
void loop();
WebApiDtuClass();
void init(AsyncWebServer& server, Scheduler& scheduler);

private:
void onDtuAdminGet(AsyncWebServerRequest* request);
void onDtuAdminPost(AsyncWebServerRequest* request);

AsyncWebServer* _server;
bool _performReload = false;

Task _applyDataTask;
void applyDataTaskCb();
};
6 changes: 3 additions & 3 deletions include/WebApi_eventlog.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@
#pragma once

#include <ESPAsyncWebServer.h>
#include <TaskSchedulerDeclarations.h>

class WebApiEventlogClass {
public:
void init(AsyncWebServer& server);
void loop();
void init(AsyncWebServer& server, Scheduler& scheduler);

private:
void onEventlogStatus(AsyncWebServerRequest* request);

AsyncWebServer* _server;
};
};
6 changes: 3 additions & 3 deletions include/WebApi_firmware.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@
#pragma once

#include <ESPAsyncWebServer.h>
#include <TaskSchedulerDeclarations.h>

class WebApiFirmwareClass {
public:
void init(AsyncWebServer& server);
void loop();
void init(AsyncWebServer& server, Scheduler& scheduler);

private:
void onFirmwareUpdateFinish(AsyncWebServerRequest* request);
void onFirmwareUpdateUpload(AsyncWebServerRequest* request, String filename, size_t index, uint8_t* data, size_t len, bool final);

AsyncWebServer* _server;
};
};
6 changes: 3 additions & 3 deletions include/WebApi_gridprofile.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@
#pragma once

#include <ESPAsyncWebServer.h>
#include <TaskSchedulerDeclarations.h>

class WebApiGridProfileClass {
public:
void init(AsyncWebServer& server);
void loop();
void init(AsyncWebServer& server, Scheduler& scheduler);

private:
void onGridProfileStatus(AsyncWebServerRequest* request);
void onGridProfileRawdata(AsyncWebServerRequest* request);

AsyncWebServer* _server;
};
};
6 changes: 3 additions & 3 deletions include/WebApi_inverter.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
#pragma once

#include <ESPAsyncWebServer.h>
#include <TaskSchedulerDeclarations.h>

class WebApiInverterClass {
public:
void init(AsyncWebServer& server);
void loop();
void init(AsyncWebServer& server, Scheduler& scheduler);

private:
void onInverterList(AsyncWebServerRequest* request);
Expand All @@ -16,4 +16,4 @@ class WebApiInverterClass {
void onInverterOrder(AsyncWebServerRequest* request);

AsyncWebServer* _server;
};
};
Loading

0 comments on commit a5d238b

Please sign in to comment.