mirror of
https://github.com/arendst/Tasmota.git
synced 2025-07-23 18:56:38 +00:00
Add support for Modbus bridge
Add support for Modbus bridge adding commands ``ModbusSend``, ``ModbusBaudrate`` and ``ModbusSerialConfig`` (#16013)
This commit is contained in:
parent
3fe317c675
commit
722406a461
@ -183,7 +183,7 @@ Note: `minimal` variant is not listed as it shouldn't be used outside of the [up
|
||||
| USE_NOVA_SDS | - | - / x | - | x | - | - |
|
||||
| USE_HPMA | - | - / x | - | x | - | - |
|
||||
| USE_SERIAL_BRIDGE | - | x / x | x | x | - | x |
|
||||
| USE_MODBUS_BRIDGE | - | - / - | - | - | - | - |
|
||||
| USE_MODBUS_BRIDGE | - | - / x | - | - | - | - |
|
||||
| USE_MP3_PLAYER | - | - / x | - | x | - | - |
|
||||
| USE_AZ7798 | - | - / - | - | - | - | - |
|
||||
| USE_PN532_HSU | - | - / x | - | x | - | - |
|
||||
|
@ -6,9 +6,10 @@ All notable changes to this project will be documented in this file.
|
||||
## [12.0.2.4]
|
||||
### Added
|
||||
- Command ``SetOption45 1..250`` to change default bistable latching relay pulse length of 40 milliseconds
|
||||
- ESP32 LVGL library from v8.2.0 to v8.3.0
|
||||
- Support for Modbus bridge adding commands ``ModbusSend``, ``ModbusBaudrate`` and ``ModbusSerialConfig`` (#16013)
|
||||
|
||||
### Changed
|
||||
- ESP32 LVGL library from v8.2.0 to v8.3.0
|
||||
|
||||
### Fixed
|
||||
|
||||
|
@ -117,12 +117,14 @@ The latter links can be used for OTA upgrades too like ``OtaUrl http://ota.tasmo
|
||||
- Support for 5-channel light dimmer driver SM2335 used in SwitchBot Color Bulbs [#15839](https://github.com/arendst/Tasmota/issues/15839)
|
||||
- Support for Sonoff POWR3xxD and THR3xxD [#15856](https://github.com/arendst/Tasmota/issues/15856)
|
||||
- Support for bistable (latching) relays mixed with monostable relays using GPIO Relay_b or Relay_bi as used by Sonoff POWR320D and THR320D
|
||||
- Support for Modbus bridge adding commands ``ModbusSend``, ``ModbusBaudrate`` and ``ModbusSerialConfig`` [#16013](https://github.com/arendst/Tasmota/issues/16013)
|
||||
- ESP32 Support for Ultra Low Power (ULP) coprocessor via Berry by Christian Staars [#15916](https://github.com/arendst/Tasmota/issues/15916)
|
||||
|
||||
### Breaking Changed
|
||||
|
||||
### Changed
|
||||
- Tasmota ESP32 Arduino core from v2.0.3 to v2.0.4 [#15940](https://github.com/arendst/Tasmota/issues/15940)
|
||||
- ESP32 Arduino core from v2.0.3 to v2.0.4 [#15940](https://github.com/arendst/Tasmota/issues/15940)
|
||||
- ESP32 LVGL library from v8.2.0 to v8.3.0
|
||||
- Driver DHT v6 consolidation for both ESP8266 and ESP32 to support SI7021, THS01 and MS01 on ESP32 [#15856](https://github.com/arendst/Tasmota/issues/15856)
|
||||
|
||||
### Fixed
|
||||
|
@ -176,6 +176,7 @@
|
||||
#define USE_SR04 // Add support for HC-SR04 ultrasonic devices (+1k code)
|
||||
//#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 (+0k8 code)
|
||||
//#define USE_MODBUS_BRIDGE // Add support for software Modbus Bridge (+3k code)
|
||||
#define USE_MP3_PLAYER // Use of the DFPlayer Mini MP3 Player RB-DFR-562 commands: play, volume and stop
|
||||
//#define USE_AZ7798 // Add support for AZ-Instrument 7798 CO2 datalogger
|
||||
#define USE_PN532_HSU // Add support for PN532 using HSU (Serial) interface (+1k8 code, 140 bytes mem)
|
||||
@ -235,7 +236,6 @@
|
||||
#define USE_HRE // Add support for Badger HR-E Water Meter (+1k4 code)
|
||||
//#define USE_A4988_STEPPER // Add support for A4988/DRV8825 stepper-motor-driver-circuit (+10k5 code)
|
||||
//#define USE_THERMOSTAT // Add support for Thermostat
|
||||
//#define USE_MODBUS_BRIDGE // Add support for software Modbus Bridge
|
||||
#undef DEBUG_THEO // Disable debug code
|
||||
#undef USE_DEBUG_DRIVER // Disable debug code
|
||||
#endif // FIRMWARE_SENSORS
|
||||
@ -448,6 +448,7 @@
|
||||
#undef USE_SR04 // Disable support for HC-SR04 ultrasonic devices (+1k code)
|
||||
#undef USE_DYP // Disable support for DYP ME-007 ultrasonic distance sensor, serial port version (+0k5 code)
|
||||
#undef USE_SERIAL_BRIDGE // Disable support for software Serial Bridge
|
||||
#undef USE_MODBUS_BRIDGE // Disable support for software Modbus Bridge (+3k code)
|
||||
#undef USE_MP3_PLAYER // Disable DFPlayer Mini MP3 Player RB-DFR-562 commands: play, volume and stop
|
||||
#undef USE_AZ7798 // Disable support for AZ-Instrument 7798 CO2 datalogger
|
||||
#undef USE_PN532_HSU // Disable support for PN532 using HSU (Serial) interface (+1k8 code, 140 bytes mem)
|
||||
@ -576,6 +577,7 @@
|
||||
#undef USE_SR04 // Disable support for HC-SR04 ultrasonic devices (+1k code)
|
||||
#undef USE_DYP // Disable support for DYP ME-007 ultrasonic distance sensor, serial port version (+0k5 code)
|
||||
#undef USE_SERIAL_BRIDGE // Disable support for software Serial Bridge
|
||||
#undef USE_MODBUS_BRIDGE // Disable support for software Modbus Bridge (+3k code)
|
||||
#undef USE_MP3_PLAYER // Disable DFPlayer Mini MP3 Player RB-DFR-562 commands: play, volume and stop
|
||||
#undef USE_AZ7798 // Disable support for AZ-Instrument 7798 CO2 datalogger
|
||||
#undef USE_PN532_HSU // Disable support for PN532 using HSU (Serial) interface (+1k8 code, 140 bytes mem)
|
||||
@ -722,6 +724,7 @@
|
||||
#undef USE_SR04 // Disable support for HC-SR04 ultrasonic devices (+1k code)
|
||||
#undef USE_DYP // Disable support for DYP ME-007 ultrasonic distance sensor, serial port version (+0k5 code)
|
||||
#undef USE_SERIAL_BRIDGE // Disable support for software Serial Bridge
|
||||
#undef USE_MODBUS_BRIDGE // Disable support for software Modbus Bridge (+3k code)
|
||||
#undef USE_MP3_PLAYER // Disable DFPlayer Mini MP3 Player RB-DFR-562 commands: play, volume and stop
|
||||
#undef USE_AZ7798 // Disable support for AZ-Instrument 7798 CO2 datalogger
|
||||
#undef USE_PN532_HSU // Disable support for PN532 using HSU (Serial) interface (+1k8 code, 140 bytes mem)
|
||||
@ -862,6 +865,7 @@
|
||||
#undef USE_SR04 // Disable support for HC-SR04 ultrasonic devices (+1k code)
|
||||
#undef USE_DYP // Disable support for DYP ME-007 ultrasonic distance sensor, serial port version (+0k5 code)
|
||||
#undef USE_SERIAL_BRIDGE // Disable support for software Serial Bridge
|
||||
#undef USE_MODBUS_BRIDGE // Disable support for software Modbus Bridge (+3k code)
|
||||
#undef USE_TCP_BRIDGE // DIsable support for Serial to TCP bridge (+1.3k code)
|
||||
#undef USE_MP3_PLAYER // Disable DFPlayer Mini MP3 Player RB-DFR-562 commands: play, volume and stop
|
||||
#undef USE_AZ7798 // Disable support for AZ-Instrument 7798 CO2 datalogger
|
||||
|
@ -115,6 +115,7 @@
|
||||
#undef USE_SR04 // Disable support for HC-SR04 ultrasonic devices (+1k code)
|
||||
#undef USE_DYP // Disable support for DYP ME-007 ultrasonic distance sensor, serial port version (+0k5 code)
|
||||
#undef USE_SERIAL_BRIDGE // Disable support for software Serial Bridge
|
||||
#undef USE_MODBUS_BRIDGE // Disable support for software Modbus Bridge (+3k code)
|
||||
#undef USE_TCP_BRIDGE // DIsable support for Serial to TCP bridge (+1.3k code)
|
||||
#undef USE_MP3_PLAYER // Disable DFPlayer Mini MP3 Player RB-DFR-562 commands: play, volume and stop
|
||||
#undef USE_AZ7798 // Disable support for AZ-Instrument 7798 CO2 datalogger
|
||||
@ -429,6 +430,7 @@
|
||||
//#define USE_SR04 // Add support for HC-SR04 ultrasonic devices (+1k code)
|
||||
//#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 (+0k8 code)
|
||||
//#define USE_MODBUS_BRIDGE // Add support for software Modbus Bridge (+3k code)
|
||||
//#define USE_MP3_PLAYER // Use of the DFPlayer Mini MP3 Player RB-DFR-562 commands: play, volume and stop
|
||||
//#define USE_AZ7798 // Add support for AZ-Instrument 7798 CO2 datalogger
|
||||
//#define USE_PN532_HSU // Add support for PN532 using HSU (Serial) interface (+1k8 code, 140 bytes mem)
|
||||
@ -637,6 +639,7 @@
|
||||
#define USE_SR04 // Add support for HC-SR04 ultrasonic devices (+1k code)
|
||||
//#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 (+0k8 code)
|
||||
#define USE_MODBUS_BRIDGE // Add support for software Modbus Bridge (+3k code)
|
||||
#define USE_MP3_PLAYER // Use of the DFPlayer Mini MP3 Player RB-DFR-562 commands: play, volume and stop
|
||||
//#define USE_AZ7798 // Add support for AZ-Instrument 7798 CO2 datalogger
|
||||
#define USE_PN532_HSU // Add support for PN532 using HSU (Serial) interface (+1k8 code, 140 bytes mem)
|
||||
|
@ -753,6 +753,7 @@
|
||||
#define SR04_MAX_SENSOR_DISTANCE 500 // Set sensor max detection distance
|
||||
//#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 (+0k8 code)
|
||||
//#define USE_MODBUS_BRIDGE // Add support for software Modbus Bridge (+3k code)
|
||||
//#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)
|
||||
@ -782,7 +783,6 @@
|
||||
//#define USE_VINDRIKTNING // Add support for IKEA VINDRIKTNING particle concentration sensor (+0k6 code)
|
||||
// #define VINDRIKTNING_SHOW_PM1 // Display undocumented/supposed PM1.0 values
|
||||
// #define VINDRIKTNING_SHOW_PM10 // Display undocumented/supposed PM10 values
|
||||
//#define USE_MODBUS_BRIDGE // Add support for software Modbus Bridge
|
||||
|
||||
// -- Power monitoring sensors --------------------
|
||||
#define USE_ENERGY_SENSOR // Add support for Energy Monitors (+14k code)
|
||||
|
@ -61,9 +61,9 @@ void ResponseAppendFeatures(void)
|
||||
//#if (MQTT_LIBRARY_TYPE == MQTT_TASMOTAMQTT)
|
||||
// feature1 |= 0x00000800; // xdrv_02_mqtt.ino
|
||||
//#endif
|
||||
//#if (MQTT_LIBRARY_TYPE == MQTT_ESPMQTTARDUINO) // Obsolete since 6.2.1.11
|
||||
// feature1 |= 0x00001000; // xdrv_02_mqtt.ino
|
||||
//#endif
|
||||
#ifdef USE_MODBUS_BRIDGE
|
||||
feature1 |= 0x00001000; // xdrv_63_modbus_bridge.ino
|
||||
#endif
|
||||
#if defined(USE_DISCOVERY) && defined(MQTT_HOST_DISCOVERY)
|
||||
feature1 |= 0x00002000; // xdrv_02_mqtt.ino
|
||||
#endif
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*
|
||||
xdrv_100_modbus_bridge.ino - modbus bridge support for Tasmota
|
||||
xdrv_63_modbus_bridge.ino - modbus bridge support for Tasmota
|
||||
|
||||
Copyright (C) 2021 Theo Arends and Dániel Zoltán Tolnai
|
||||
Copyright (C) 2021 Theo Arends and Jeroenst
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
@ -26,15 +26,15 @@
|
||||
* Modbus Bridge using Modbus library (TasmotaModbus)
|
||||
\*********************************************************************************************/
|
||||
|
||||
#define XDRV_100 100
|
||||
#define HARDWARE_FALLBACK 2
|
||||
#define MBR_MAX_VALUE_LENGTH 30
|
||||
#define MBR_SPEED TM_MODBUS_BAUDRATE
|
||||
#define MBR_MAX_REGISTERS 64
|
||||
#define XDRV_63 63
|
||||
|
||||
#define D_CMND_MODBUS_SEND "ModbusSend"
|
||||
#define D_CMND_MODBUS_SETBAUDRATE "ModbusSetBaudrate"
|
||||
#define D_CMND_MODBUS_SETSERIALCONFIG "ModbusSetSerialConfig"
|
||||
#define MBR_MAX_VALUE_LENGTH 30
|
||||
#define MBR_SPEED TM_MODBUS_BAUDRATE
|
||||
#define MBR_MAX_REGISTERS 64
|
||||
|
||||
#define D_CMND_MODBUS_SEND "Send"
|
||||
#define D_CMND_MODBUS_SETBAUDRATE "Baudrate"
|
||||
#define D_CMND_MODBUS_SETSERIALCONFIG "SerialConfig"
|
||||
|
||||
#define D_JSON_MODBUS_RECEIVED "ModbusReceived"
|
||||
#define D_JSON_MODBUS_DEVICE_ADDRESS "DeviceAddress"
|
||||
@ -46,7 +46,7 @@
|
||||
#define D_JSON_MODBUS_VALUES "Values"
|
||||
#define D_JSON_MODBUS_LENGTH "Length"
|
||||
|
||||
const char kModbusBridgeCommands[] PROGMEM = "|" // No prefix
|
||||
const char kModbusBridgeCommands[] PROGMEM = "Modbus|" // Prefix
|
||||
D_CMND_MODBUS_SEND "|" D_CMND_MODBUS_SETBAUDRATE "|" D_CMND_MODBUS_SETSERIALCONFIG;
|
||||
|
||||
void (*const ModbusBridgeCommand[])(void) PROGMEM = {
|
||||
@ -103,15 +103,15 @@ struct ModbusBridge
|
||||
{
|
||||
unsigned long polling_window = 0;
|
||||
int in_byte_counter = 0;
|
||||
bool raw = false;
|
||||
|
||||
ModbusBridgeFunctionCode functionCode = ModbusBridgeFunctionCode::mb_undefined;
|
||||
ModbusBridgeType type = ModbusBridgeType::mb_undefined;
|
||||
|
||||
uint8_t count = 0;
|
||||
uint16_t registerCount = 0;
|
||||
uint16_t startAddress = 0;
|
||||
uint8_t deviceAddress = 0;
|
||||
uint8_t startAddress = 0;
|
||||
uint8_t count = 0;
|
||||
bool raw = false;
|
||||
};
|
||||
|
||||
ModbusBridge modbusBridge;
|
||||
@ -412,7 +412,7 @@ void CmndModbusBridgeSetConfig(void)
|
||||
* Interface
|
||||
\*********************************************************************************************/
|
||||
|
||||
bool Xdrv100(uint8_t function)
|
||||
bool Xdrv63(uint8_t function)
|
||||
{
|
||||
bool result = false;
|
||||
|
@ -213,7 +213,7 @@ a_features = [[
|
||||
"USE_ENERGY_MARGIN_DETECTION","USE_LIGHT","USE_I2C","USE_SPI",
|
||||
"USE_DISCOVERY","USE_ARDUINO_OTA","USE_MQTT_TLS","USE_WEBSERVER",
|
||||
"WEBSERVER_ADVERTISE","USE_EMULATION_HUE","MQTT_PUBSUBCLIENT","MQTT_TASMOTAMQTT",
|
||||
"MQTT_ESPMQTTARDUINO","MQTT_HOST_DISCOVERY","USE_ARILUX_RF","USE_WS2812",
|
||||
"USE_MODBUS_BRIDGE","MQTT_HOST_DISCOVERY","USE_ARILUX_RF","USE_WS2812",
|
||||
"USE_WS2812_DMA","USE_IR_REMOTE","USE_IR_HVAC","USE_IR_RECEIVE",
|
||||
"USE_DOMOTICZ","USE_DISPLAY","USE_HOME_ASSISTANT","USE_SERIAL_BRIDGE",
|
||||
"USE_TIMERS","USE_SUNRISE","USE_TIMERS_WEB","USE_RULES",
|
||||
|
Loading…
x
Reference in New Issue
Block a user