modbus support

This commit is contained in:
Dmitry Borisenko
2020-09-18 02:26:34 +03:00
parent 734f3e1b36
commit 3d1f1ec524
35 changed files with 3310 additions and 1 deletions

View File

@@ -43,6 +43,8 @@ void cmd_init() {
sCmd.addCommand("bmp280-temp", bmp280Temp);
sCmd.addCommand("bmp280-press", bmp280Press);
sCmd.addCommand("modbus", modbus);
handle_time_init();
}

View File

@@ -0,0 +1,20 @@
#include "ItemsCmd.h"
#include "items/SensorModbusClass.h"
//#ifdef SensorModbusEnabled
//=========================================Модуль ультрозвукового дальномера==================================================================
//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();
mySensorModbus.SensorModbusRead(key, 1, 0);
}
//#endif