From b478940b0c6205e7c7759f5ea1880f2194020f67 Mon Sep 17 00:00:00 2001 From: zivillian Date: Wed, 15 Jun 2022 17:34:53 +0200 Subject: [PATCH] map all slave ids --- platformio.ini | 3 +-- src/main.cpp | 5 ++++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/platformio.ini b/platformio.ini index 8bd9898..2ff6b70 100644 --- a/platformio.ini +++ b/platformio.ini @@ -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 \ No newline at end of file +;build_flags = -DLOG_LEVEL=LOG_LEVEL_DEBUG \ No newline at end of file diff --git a/src/main.cpp b/src/main.cpp index 7036b06..babc38f 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -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");