This commit is contained in:
Dmitry Borisenko
2020-12-16 19:28:44 +01:00
parent 2fc82c3311
commit 8f08459a5a
86 changed files with 17 additions and 3502 deletions

View File

@@ -9,7 +9,6 @@
#include "items/vLogging.h"
#include "items/vImpulsOut.h"
#include "items/vCountDown.h"
#include "items/SensorModbusClass.h"
void loopCmdAdd(const String& cmdStr) {
orderBuf += cmdStr;
@@ -88,11 +87,6 @@ void csvCmdExecute(String& cmdStr) {
else if (order == F("bmp280-press")) {
sCmd.addCommand(order.c_str(), bmp280Press);
}
#endif
#ifdef SensorModbusEnabled
else if (order == F("modbus")) {
sCmd.addCommand(order.c_str(), modbus);
}
#endif
else if (order == F("uptime")) {
sCmd.addCommand(order.c_str(), sysUptime);

View File

@@ -1,3 +1,4 @@
#include "Consts.h"
#ifdef uartEnable
#include "SoftUART.h"
#include "Global.h"

View File

@@ -1,11 +1,12 @@
#ifdef telegram
#include "Consts.h"
#ifdef telegramEnable
#include "Telegram.h"
CTBot* myBot{ nullptr };
void telegramInit() {
if (isTelegramEnabled()) {
telegramInitBeen = true;
sCmd.addCommand("telegram", sendTelegramMsg);
sCmd.addCommand("telegramEnable", sendTelegramMsg);
String token = jsonReadStr(configSetupJson, "telegramApi");
if (!myBot) {
myBot = new CTBot();

View File

@@ -3,7 +3,8 @@
#include "Utils/StringUtils.h"
static const uint8_t days_in_month[] = { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
static const char* week_days[7] = { "Sun", "Mon", "Tue", "Wed", "Thr", "Fri", "Sat" };
//static const char* week_days[7] = { "Sun", "Mon", "Tue", "Wed", "Thr", "Fri", "Sat" };
// String getTimeUnix() {
// time_t t;

View File

@@ -1,23 +0,0 @@
#include "Consts.h"
#ifdef SensorModbusEnabled
#include "items/SensorModbusClass.h"
#include "BufferExecute.h"
//=========================================Модуль modbus===================================================================================
//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();
String addr = sCmd.next();
String regaddr = sCmd.next();
mySensorModbus.SensorModbusRead(key, addr.toInt(), regaddr.toInt());
}
#endif

View File

@@ -50,7 +50,7 @@ void setup() {
itemsListInit();
espInit();
routerConnect();
#ifdef telegram
#ifdef telegramEnable
telegramInit();
#endif
uptime_init();
@@ -95,7 +95,7 @@ void loop() {
myNotAsyncActions->loop();
ts.update();
#ifdef telegram
#ifdef telegramEnable
handleTelegram();
#endif