mirror of
https://github.com/IoTManagerProject/IoTManager.git
synced 2026-03-30 03:49:13 +03:00
fix ecto modbus
This commit is contained in:
@@ -80,8 +80,6 @@ private:
|
|||||||
bool _isNetworkActive;
|
bool _isNetworkActive;
|
||||||
bool _mqttIsConnect;
|
bool _mqttIsConnect;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
EctoControlAdapter(String parameters) : IoTItem(parameters)
|
EctoControlAdapter(String parameters) : IoTItem(parameters)
|
||||||
{
|
{
|
||||||
@@ -119,7 +117,6 @@ public:
|
|||||||
node.preTransmission(modbusPreTransmission);
|
node.preTransmission(modbusPreTransmission);
|
||||||
node.postTransmission(modbusPostTransmission);
|
node.postTransmission(modbusPostTransmission);
|
||||||
|
|
||||||
|
|
||||||
if (_DIR_PIN)
|
if (_DIR_PIN)
|
||||||
{
|
{
|
||||||
_DIR_PIN = _DIR_PIN;
|
_DIR_PIN = _DIR_PIN;
|
||||||
@@ -130,16 +127,20 @@ public:
|
|||||||
// 0x14 – адаптер OpenTherm (вторая версия)
|
// 0x14 – адаптер OpenTherm (вторая версия)
|
||||||
// 0x15 – адаптер eBus
|
// 0x15 – адаптер eBus
|
||||||
// 0x16 – адаптер Navien
|
// 0x16 – адаптер Navien
|
||||||
|
if (_addr > 0)
|
||||||
|
{
|
||||||
uint16_t type;
|
uint16_t type;
|
||||||
readFunctionModBus(0x0000, type);
|
readFunctionModBus(0x0000, type);
|
||||||
if (0x14 != (uint8_t)type || 0x15 != (uint8_t)type || 0x16 != (uint8_t)type)
|
if (0x14 != (uint8_t)type || 0x15 != (uint8_t)type || 0x16 != (uint8_t)type)
|
||||||
{
|
{
|
||||||
SerialPrint("E", "EctoControlAdapter", "Не подходящее устройство, type: " + String(type, HEX));
|
SerialPrint("E", "EctoControlAdapter", "Не подходящее устройство, type: " + String(type, HEX));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
else if (_addr == 0)
|
||||||
|
{ // если адреса нет, то шлем широковещательный запрос адреса
|
||||||
uint8_t addr = node.readAddresEctoControl();
|
uint8_t addr = node.readAddresEctoControl();
|
||||||
SerialPrint("I", "EctoControlAdapter", "readAddresEctoControl, addr: " + String(addr, HEX) + " - Enter to configuration");
|
SerialPrint("I", "EctoControlAdapter", "readAddresEctoControl, addr: " + String(addr, HEX) + " - Enter to configuration");
|
||||||
|
}
|
||||||
getModelVersion();
|
getModelVersion();
|
||||||
getBoilerInfo();
|
getBoilerInfo();
|
||||||
getBoilerStatus();
|
getBoilerStatus();
|
||||||
@@ -322,8 +323,7 @@ public:
|
|||||||
tlgrmItem->sendTelegramMsg(false, msg);
|
tlgrmItem->sendTelegramMsg(false, msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
~EctoControlAdapter()
|
~EctoControlAdapter() {
|
||||||
{
|
|
||||||
};
|
};
|
||||||
|
|
||||||
bool writeFunctionModBus(const uint16_t ®, uint16_t &data)
|
bool writeFunctionModBus(const uint16_t ®, uint16_t &data)
|
||||||
@@ -792,9 +792,6 @@ public:
|
|||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
void *getAPI_EctoControlAdapter(String subtype, String param)
|
void *getAPI_EctoControlAdapter(String subtype, String param)
|
||||||
|
|||||||
@@ -429,8 +429,12 @@ uint8_t ModbusMaster::ModbusMasterTransaction(uint8_t u8MBFunction)
|
|||||||
if (u8ModbusADUSize == 5)
|
if (u8ModbusADUSize == 5)
|
||||||
{
|
{
|
||||||
// verify response is for correct Modbus slave
|
// verify response is for correct Modbus slave
|
||||||
if (u8ModbusADU[0] != _u8MBSlave || u8ModbusADU[0] != 0x00)
|
if (u8ModbusADU[0] != _u8MBSlave)
|
||||||
{
|
{
|
||||||
|
// Serial.print(u8ModbusADU[0], HEX);
|
||||||
|
// Serial.print(" != ");
|
||||||
|
// Serial.println(_u8MBSlave, HEX);
|
||||||
|
|
||||||
u8MBStatus = ku8MBInvalidSlaveID;
|
u8MBStatus = ku8MBInvalidSlaveID;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,12 +11,12 @@
|
|||||||
"page": "Котёл",
|
"page": "Котёл",
|
||||||
"descr": "Адаптер",
|
"descr": "Адаптер",
|
||||||
"int": 60,
|
"int": 60,
|
||||||
"addr": "0xF0",
|
"addr": 240,
|
||||||
"RX": 18,
|
"RX": 18,
|
||||||
"TX": 19,
|
"TX": 19,
|
||||||
"DIR_PIN": 4,
|
"DIR_PIN": 4,
|
||||||
"baud": 9600,
|
"baud": 19200,
|
||||||
"protocol": "SERIAL_8N2",
|
"protocol": "SERIAL_8N1",
|
||||||
"debug": 1
|
"debug": 1
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
@@ -37,7 +37,7 @@
|
|||||||
"title": "EctoControlAdapter",
|
"title": "EctoControlAdapter",
|
||||||
"moduleDesc": "Управление отопительным котлом через адаптер EctoControl по протоколам OpenTherm, eBUS, Navien. Посредством Modbus RTU. Разъем 4P4C: 1-Желтый(красный)+12V; 2-Белый-GND; 3-Зелёный-A; 4-Коричневый(Синий)-B",
|
"moduleDesc": "Управление отопительным котлом через адаптер EctoControl по протоколам OpenTherm, eBUS, Navien. Посредством Modbus RTU. Разъем 4P4C: 1-Желтый(красный)+12V; 2-Белый-GND; 3-Зелёный-A; 4-Коричневый(Синий)-B",
|
||||||
"propInfo": {
|
"propInfo": {
|
||||||
"addr": "Адрес slave",
|
"addr": "Адрес slave, что бы узнать адрес - в конфиге адрес 0 и смотреть лог (требуется проверка)",
|
||||||
"int": "Количество секунд между опросами датчика.",
|
"int": "Количество секунд между опросами датчика.",
|
||||||
"RX": "Пин RX",
|
"RX": "Пин RX",
|
||||||
"TX": "Пин TX",
|
"TX": "Пин TX",
|
||||||
|
|||||||
Reference in New Issue
Block a user