2020-09-18 02:26:34 +03:00
|
|
|
#include "items/SensorModbusClass.h"
|
2020-09-18 03:44:03 +03:00
|
|
|
|
|
|
|
|
#include "ItemsCmd.h"
|
2020-09-18 02:26:34 +03:00
|
|
|
//#ifdef SensorModbusEnabled
|
2020-09-18 02:32:37 +03:00
|
|
|
//=========================================Модуль modbus===================================================================================
|
2020-09-18 02:26:34 +03:00
|
|
|
//modbus;id;anydata;Сенсоры;Температура;order;addr[1];regaddr[0];c[1]
|
|
|
|
|
//=========================================================================================================================================
|
|
|
|
|
SensorModbusClass mySensorModbus;
|
|
|
|
|
|
|
|
|
|
void modbus() {
|
|
|
|
|
mySensorModbus.update();
|
|
|
|
|
String key = mySensorModbus.gkey();
|
|
|
|
|
sCmd.addCommand(key.c_str(), modbusReading);
|
|
|
|
|
mySensorModbus.SensorModbusInit();
|
|
|
|
|
mySensorModbus.clear();
|
|
|
|
|
}
|
|
|
|
|
void modbusReading() {
|
|
|
|
|
String key = sCmd.order();
|
2020-09-18 03:44:03 +03:00
|
|
|
String addr = sCmd.next();
|
|
|
|
|
String regaddr = sCmd.next();
|
|
|
|
|
mySensorModbus.SensorModbusRead(key, addr.toInt(), regaddr.toInt());
|
2020-09-18 02:26:34 +03:00
|
|
|
}
|
|
|
|
|
//#endif
|