diff --git a/tasmota/my_user_config.h b/tasmota/my_user_config.h index 0f4c01480..4056ec8e1 100644 --- a/tasmota/my_user_config.h +++ b/tasmota/my_user_config.h @@ -799,8 +799,9 @@ //#define USE_DYP // Add support for DYP ME-007 ultrasonic distance sensor, serial port version (+0k5 code) #define USE_SERIAL_BRIDGE // Add support for software Serial Bridge (+2k code) // #define SERIAL_BRIDGE_BUFFER_SIZE 256 // Serial Bridge receive buffer size (Default ESP8266 = 256, ESP32 = 800) -//#define USE_MODBUS_BRIDGE // Add support for software Modbus Bridge (+4.5k code) -//#define USE_MODBUS_BRIDGE_TCP // Add support for software Modbus TCP Bridge (also enable Modbus TCP Bridge) (+2k code) +// #define USE_MODBUS_BRIDGE // Add support for software Modbus Bridge (+4.5k code) +// #define USE_MODBUS_BRIDGE_TCP // Add support for software Modbus TCP Bridge (also enable Modbus TCP Bridge) (+2k code) +// #define MODBUS_BRIDGE_TCP_DEFAULT_PORT 502 // Add support for software Modbus TCP Bridge (start the TCP bridge automatically at PORT 502) //#define USE_TCP_BRIDGE // Add support for Serial to TCP bridge (+1.3k code) //#define USE_MP3_PLAYER // Use of the DFPlayer Mini MP3 Player RB-DFR-562 commands: play, pause, stop, track, volume and reset #define MP3_VOLUME 30 // Set the startup volume on init, the range can be 0..100(max) diff --git a/tasmota/tasmota_xdrv_driver/xdrv_63_modbus_bridge.ino b/tasmota/tasmota_xdrv_driver/xdrv_63_modbus_bridge.ino index 0bd488981..194f6156b 100644 --- a/tasmota/tasmota_xdrv_driver/xdrv_63_modbus_bridge.ino +++ b/tasmota/tasmota_xdrv_driver/xdrv_63_modbus_bridge.ino @@ -574,6 +574,16 @@ void ModbusBridgeInit(void) ModbusBridgeAllocError(PSTR("TCP")); return; } +#ifdef MODBUS_BRIDGE_TCP_DEFAULT_PORT + else + { + AddLog(LOG_LEVEL_INFO, PSTR("MBS: MBRTCP Starting server on port %d"), MODBUS_BRIDGE_TCP_DEFAULT_PORT); + + modbusBridgeTCP.server_tcp = new WiFiServer(MODBUS_BRIDGE_TCP_DEFAULT_PORT); + modbusBridgeTCP.server_tcp->begin(); // start TCP server + modbusBridgeTCP.server_tcp->setNoDelay(true); + } +#endif #endif } }