mirror of
https://github.com/arendst/Tasmota.git
synced 2025-07-28 13:16:32 +00:00
start modus tcp bridge automatically (#18634)
* added default port for modbus tcp bridge to start automatically * updated ifdef style * renamed define for modbus default port
This commit is contained in:
parent
3c951d7751
commit
3a6cd9b63c
@ -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)
|
||||
|
@ -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
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user