Skip to content

Commit

Permalink
map all slave ids
Browse files Browse the repository at this point in the history
  • Loading branch information
zivillian committed Jun 15, 2022
1 parent 67e7d4f commit b478940
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
3 changes: 1 addition & 2 deletions platformio.ini
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,4 @@ lib_deps =
https://github.com/me-no-dev/ESPAsyncWebServer.git
ayushsharma82/AsyncElegantOTA @ 2.2.7
eModbus
build_flags =
-DLOG_LEVEL=LOG_LEVEL_DEBUG
;build_flags = -DLOG_LEVEL=LOG_LEVEL_DEBUG
5 changes: 4 additions & 1 deletion src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,10 @@ void setup() {
modbusSerial.begin(config.baud, config.serialConfig);
MBclient.setTimeout(1000);
MBclient.begin();
MBbridge.attachServer(1, 1, ANY_FUNCTION_CODE, &MBclient);
for (uint8_t i = 1; i < 248; i++)
{
MBbridge.attachServer(i, i, ANY_FUNCTION_CODE, &MBclient);
}
MBbridge.start(502, 10, 10000);
dbgln("[modbus] finished");
dbgln("[setup] finished");
Expand Down

0 comments on commit b478940

Please sign in to comment.