forked from tbnobody/OpenDTU
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
OpenDTU is extended by a Modbus server. The Modbus server serves TCP at port 502. At Modbus ID 1 the server mimicks the Modbus registers in the original DTUPro. At Modbus ID 125 the server serves a SunSpec compatible pseudo inverter that provides the OpenDTU aggregated data from all registered inverters. The OpenDTU Modbus sources were imspired by : https://github.com/ArekKubacki/OpenDTU. See tbnobody#582 for the orignal pull request. The Modbus library used for Modbus communication is: https://github.com/eModbus/eModbus. Documentation for the library is here: https://emodbus.github.io/. The library was choosen to achieve a lower memory footprint. fixes tbnobody#582 Signed-off-by: Bobby Noelte <[email protected]>
- Loading branch information
Showing
13 changed files
with
988 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
// SPDX-License-Identifier: GPL-2.0-or-later | ||
#pragma once | ||
|
||
#include <TaskSchedulerDeclarations.h> | ||
|
||
// eModbus | ||
#include "ModbusServerTCPasync.h" | ||
|
||
class ModbusDtuClass { | ||
public: | ||
ModbusDtuClass(); | ||
void init(Scheduler& scheduler); | ||
|
||
private: | ||
void loop(); | ||
|
||
Task _loopTask; | ||
}; | ||
|
||
ModbusMessage OpenDTUTotal(ModbusMessage request); | ||
ModbusMessage DTUPro(ModbusMessage request); | ||
|
||
extern ModbusDtuClass ModbusDtu; | ||
extern ModbusServerTCPasync ModbusTCPServer; |
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,17 @@ | ||
// SPDX-License-Identifier: GPL-2.0-or-later | ||
#pragma once | ||
|
||
class ModbusSettingsClass { | ||
public: | ||
ModbusSettingsClass(); | ||
void init(); | ||
|
||
void performConfig(); | ||
|
||
private: | ||
void startTCP(); | ||
|
||
void stopTCP(); | ||
}; | ||
|
||
extern ModbusSettingsClass ModbusSettings; |
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,15 @@ | ||
// SPDX-License-Identifier: GPL-2.0-or-later | ||
#pragma once | ||
|
||
#include <ESPAsyncWebServer.h> | ||
#include <TaskSchedulerDeclarations.h> | ||
|
||
class WebApiModbusClass { | ||
public: | ||
void init(AsyncWebServer& server, Scheduler& scheduler); | ||
|
||
private: | ||
void onModbusStatus(AsyncWebServerRequest* request); | ||
void onModbusAdminGet(AsyncWebServerRequest* request); | ||
void onModbusAdminPost(AsyncWebServerRequest* request); | ||
}; |
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.