mirror of
https://github.com/IoTManagerProject/IoTManager.git
synced 2026-03-30 20:09:14 +03:00
1 mb compiling version
This commit is contained in:
@@ -11,6 +11,8 @@ extern void clockInit();
|
||||
#include "sntp.h"
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
class Clock {
|
||||
private:
|
||||
Time_t _time_local;
|
||||
|
||||
@@ -42,37 +42,19 @@
|
||||
//#define SSDP_ENABLED
|
||||
|
||||
//=========Sensors enable/disable=================================================================================================================================
|
||||
#define LEVEL_ENABLED
|
||||
#define ANALOG_ENABLED
|
||||
#define DALLAS_ENABLED
|
||||
#define DHT_ENABLED
|
||||
#define BMP_ENABLED
|
||||
#define BME_ENABLED
|
||||
#define SensorBme280Enabled
|
||||
#define SensorBmp280Enabled
|
||||
#define SensorDhtEnabled
|
||||
#define PwmOutEnable
|
||||
//#define SensorModbusEnabled
|
||||
|
||||
//=========others=================================================================================================================================
|
||||
//#define telegram
|
||||
//#define uartEnable
|
||||
|
||||
|
||||
//=========Gears enable/disable===================================================================================================================================
|
||||
#define STEPPER_ENABLED
|
||||
#define SERVO_ENABLED
|
||||
|
||||
|
||||
//========Other enable/disable====================================================================================================================================
|
||||
#define LOGGING_ENABLED
|
||||
#define SERIAL_ENABLED
|
||||
#define PUSH_ENABLED
|
||||
|
||||
struct Time_t {
|
||||
uint8_t second;
|
||||
uint8_t minute;
|
||||
uint8_t hour;
|
||||
uint8_t day_of_week;
|
||||
uint8_t day_of_month;
|
||||
uint8_t month;
|
||||
uint16_t day_of_year;
|
||||
uint16_t year;
|
||||
unsigned long days;
|
||||
unsigned long valid;
|
||||
};
|
||||
|
||||
//================================================================================================================================================================
|
||||
enum TimerTask_t { WIFI_SCAN,
|
||||
WIFI_MQTT_CONNECTION_CHECK,
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
#include <ESPAsyncWebServer.h>
|
||||
//#include <FS.h>
|
||||
|
||||
#ifdef ESP8266
|
||||
#include <LittleFS.h>
|
||||
#endif
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#pragma once
|
||||
|
||||
#ifdef uartEnable
|
||||
#include "SoftwareSerial.h"
|
||||
|
||||
extern SoftwareSerial* myUART;
|
||||
@@ -7,3 +7,4 @@ extern SoftwareSerial* myUART;
|
||||
extern void uartInit();
|
||||
extern void uartHandle();
|
||||
extern void parse(String& incStr);
|
||||
#endif
|
||||
@@ -1,4 +1,5 @@
|
||||
#pragma once
|
||||
#ifdef telegram
|
||||
#include "Global.h"
|
||||
|
||||
extern void sendTelegramMsg();
|
||||
@@ -8,3 +9,4 @@ extern bool isTelegramEnabled();
|
||||
extern bool isTelegramInputOn();
|
||||
extern void telegramMsgParse(String msg);
|
||||
extern String returnListOfParams();
|
||||
#endif
|
||||
@@ -1,9 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
#include <Arduino.h>
|
||||
|
||||
//#include "FS.h"
|
||||
|
||||
#ifdef ESP32
|
||||
#include "LITTLEFS.h"
|
||||
#define LittleFS LITTLEFS
|
||||
|
||||
@@ -1,11 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
#include <Arduino.h>
|
||||
|
||||
#include "Consts.h"
|
||||
|
||||
//#include "FS.h"
|
||||
|
||||
#ifdef ESP32
|
||||
#include "LITTLEFS.h"
|
||||
#define LittleFS LITTLEFS
|
||||
|
||||
@@ -48,6 +48,22 @@ int getOffsetInMinutes(int timezone);
|
||||
/*
|
||||
* Разбивает время на составляющие
|
||||
*/
|
||||
|
||||
struct Time_t {
|
||||
uint8_t second;
|
||||
uint8_t minute;
|
||||
uint8_t hour;
|
||||
uint8_t day_of_week;
|
||||
uint8_t day_of_month;
|
||||
uint8_t month;
|
||||
uint16_t day_of_year;
|
||||
uint16_t year;
|
||||
unsigned long days;
|
||||
unsigned long valid;
|
||||
};
|
||||
|
||||
void breakEpochToTime(unsigned long epoch, Time_t& tm);
|
||||
|
||||
|
||||
|
||||
void timeInit();
|
||||
@@ -1,6 +1,7 @@
|
||||
#pragma once
|
||||
#include "Consts.h"
|
||||
#ifdef SensorBme280Enabled
|
||||
#include <Arduino.h>
|
||||
|
||||
#include "Class/LineParsing.h"
|
||||
#include "Global.h"
|
||||
#include "items/SensorConvertingClass.h"
|
||||
@@ -53,3 +54,4 @@ class SensorBme280Class : public SensorConvertingClass {
|
||||
}
|
||||
};
|
||||
extern SensorBme280Class mySensorBme280;
|
||||
#endif
|
||||
@@ -1,6 +1,7 @@
|
||||
#pragma once
|
||||
#include "Consts.h"
|
||||
#ifdef SensorBmp280Enabled
|
||||
#include <Arduino.h>
|
||||
|
||||
#include "Class/LineParsing.h"
|
||||
#include "Global.h"
|
||||
#include "items/SensorConvertingClass.h"
|
||||
@@ -46,3 +47,4 @@ class SensorBmp280Class : public SensorConvertingClass {
|
||||
}
|
||||
};
|
||||
extern SensorBmp280Class mySensorBmp280;
|
||||
#endif
|
||||
@@ -1,6 +1,7 @@
|
||||
#pragma once
|
||||
#include "Consts.h"
|
||||
#ifdef SensorDhtEnabled
|
||||
#include <Arduino.h>
|
||||
|
||||
#include "Class/LineParsing.h"
|
||||
#include "Global.h"
|
||||
#include "items/SensorConvertingClass.h"
|
||||
@@ -76,3 +77,4 @@ class SensorDhtClass : public SensorConvertingClass {
|
||||
}
|
||||
};
|
||||
extern SensorDhtClass mySensorDht;
|
||||
#endif
|
||||
@@ -1,9 +1,9 @@
|
||||
#ifdef modbus
|
||||
#pragma once
|
||||
#include "Consts.h"
|
||||
#ifdef SensorModbusEnabled
|
||||
#include <Arduino.h>
|
||||
#include <ModbusMaster.h>
|
||||
#include <SoftwareSerial.h>
|
||||
|
||||
#include "Class/LineParsing.h"
|
||||
#include "Global.h"
|
||||
#include "items/SensorConvertingClass.h"
|
||||
@@ -82,4 +82,8 @@ class SensorModbusClass : public SensorConvertingClass {
|
||||
}
|
||||
};
|
||||
extern SensorModbusClass mySensorModbus;
|
||||
|
||||
extern void modbus();
|
||||
extern void modbusReading();
|
||||
|
||||
#endif
|
||||
@@ -1,6 +1,7 @@
|
||||
#pragma once
|
||||
#include "Consts.h"
|
||||
#ifdef PwmOutEnable
|
||||
#include <Arduino.h>
|
||||
|
||||
#include "Global.h"
|
||||
|
||||
class PwmOut;
|
||||
@@ -27,3 +28,4 @@ extern MyPwmOutVector* myPwmOut;
|
||||
|
||||
extern void pwmOut();
|
||||
extern void pwmOutExecute();
|
||||
#endif
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
|
||||
[platformio]
|
||||
default_envs = esp8266
|
||||
default_envs = esp8266_01_1m
|
||||
;=============================================================================================================================================
|
||||
[common_env_data]
|
||||
lib_deps_external =
|
||||
@@ -38,7 +38,8 @@ framework = arduino
|
||||
;board = esp01_1m
|
||||
;board = esp12e
|
||||
board = nodemcuv2
|
||||
board_build.ldscript = eagle.flash.1m256.ld
|
||||
;board_build.ldscript = eagle.flash.1m256.ld
|
||||
board_build.ldscript = eagle.flash.1m512.ld
|
||||
platform = https://github.com/platformio/platform-espressif8266.git
|
||||
lib_deps =
|
||||
${common_env_data.lib_deps_external}
|
||||
@@ -47,12 +48,10 @@ lib_deps =
|
||||
ESPAsyncUDP
|
||||
EspSoftwareSerial
|
||||
CTBot
|
||||
SPIFFS
|
||||
monitor_filters = esp8266_exception_decoder
|
||||
upload_speed = 921600
|
||||
monitor_speed = 115200
|
||||
;board_build.filesystem = littlefs
|
||||
board_build.filesystem = SPIFFS
|
||||
board_build.filesystem = littlefs
|
||||
;=============================================================================================================================================
|
||||
[env:esp8266]
|
||||
framework = arduino
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
#include "items/vLogging.h"
|
||||
#include "items/vImpulsOut.h"
|
||||
#include "items/vCountDown.h"
|
||||
#include "items/SensorModbusClass.h"
|
||||
|
||||
void loopCmdAdd(const String& cmdStr) {
|
||||
orderBuf += cmdStr;
|
||||
@@ -41,9 +42,11 @@ void csvCmdExecute(String& cmdStr) {
|
||||
if (order == F("button-out")) {
|
||||
sCmd.addCommand(order.c_str(), buttonOut);
|
||||
}
|
||||
#ifdef PwmOutEnable
|
||||
else if (order == F("pwm-out")) {
|
||||
sCmd.addCommand(order.c_str(), pwmOut);
|
||||
}
|
||||
#endif
|
||||
else if (order == F("button-in")) {
|
||||
sCmd.addCommand(order.c_str(), buttonIn);
|
||||
}
|
||||
@@ -59,12 +62,15 @@ void csvCmdExecute(String& cmdStr) {
|
||||
else if (order == F("dallas-temp")) {
|
||||
sCmd.addCommand(order.c_str(), dallas);
|
||||
}
|
||||
#ifdef SensorDhtEnabled
|
||||
else if (order == F("dht-temp")) {
|
||||
sCmd.addCommand(order.c_str(), dhtTemp);
|
||||
}
|
||||
else if (order == F("dht-hum")) {
|
||||
sCmd.addCommand(order.c_str(), dhtHum);
|
||||
}
|
||||
#endif
|
||||
#ifdef SensorBme280Enabled
|
||||
else if (order == F("bme280-temp")) {
|
||||
sCmd.addCommand(order.c_str(), bme280Temp);
|
||||
}
|
||||
@@ -74,15 +80,20 @@ void csvCmdExecute(String& cmdStr) {
|
||||
else if (order == F("bme280-press")) {
|
||||
sCmd.addCommand(order.c_str(), bme280Press);
|
||||
}
|
||||
#endif
|
||||
#ifdef SensorBmp280Enabled
|
||||
else if (order == F("bmp280-temp")) {
|
||||
sCmd.addCommand(order.c_str(), bmp280Temp);
|
||||
}
|
||||
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);
|
||||
sCmd.addCommand(order.c_str(), modbus);
|
||||
}
|
||||
#endif
|
||||
else if (order == F("uptime")) {
|
||||
sCmd.addCommand(order.c_str(), sysUptime);
|
||||
}
|
||||
|
||||
@@ -76,11 +76,13 @@ void deviceInit() {
|
||||
inOutput_KeyList = "";
|
||||
inOutput_EnterCounter = -1;
|
||||
//======clear pwm params=======
|
||||
#ifdef PwmOutEnable
|
||||
if (myPwmOut != nullptr) {
|
||||
myPwmOut->clear();
|
||||
}
|
||||
pwmOut_KeyList = "";
|
||||
pwmOut_EnterCounter = -1;
|
||||
#endif
|
||||
//===================================
|
||||
if (myCountDown != nullptr) {
|
||||
myCountDown->clear();
|
||||
|
||||
@@ -19,34 +19,13 @@ void itemsListInit() {
|
||||
},
|
||||
nullptr);
|
||||
|
||||
#ifdef FLASH_SIZE_1MB
|
||||
myNotAsyncActions->add(
|
||||
do_addItem, [&](void*) {
|
||||
addItem(itemName);
|
||||
itemName = "";
|
||||
},
|
||||
nullptr);
|
||||
|
||||
myNotAsyncActions->add(
|
||||
do_addPreset, [&](void*) {
|
||||
addPreset(presetName);
|
||||
presetName = "";
|
||||
},
|
||||
nullptr);
|
||||
#endif
|
||||
SerialPrint("I", F("Items"), F("Items Init"));
|
||||
}
|
||||
|
||||
void addItem(String name) {
|
||||
#ifdef FLASH_SIZE_1MB
|
||||
String url = serverIP + F("/projects/iotmanager/config/items/") + name + ".txt";
|
||||
String item = getURL(url);
|
||||
Serial.println(url);
|
||||
if (item == "error") return;
|
||||
#endif
|
||||
#ifndef FLASH_SIZE_1MB
|
||||
|
||||
String item = readFile("items/" + name + ".txt", 1024);
|
||||
#endif
|
||||
|
||||
name = selectToMarker(name, "-");
|
||||
|
||||
@@ -81,34 +60,16 @@ void addItem(String name) {
|
||||
}
|
||||
|
||||
void addPreset(String name) {
|
||||
#ifdef FLASH_SIZE_1MB
|
||||
String url = serverIP + F("/projects/iotmanager/config/presets/") + name + ".txt";
|
||||
String preset = getURL(url);
|
||||
Serial.println(url);
|
||||
if (preset == "error") return;
|
||||
#endif
|
||||
#ifndef FLASH_SIZE_1MB
|
||||
String preset = readFile("presets/" + name + ".txt", 4048);
|
||||
#endif
|
||||
|
||||
addFile(DEVICE_CONFIG_FILE, "\n" + preset);
|
||||
Serial.println(preset);
|
||||
|
||||
name.replace(".c", ".s");
|
||||
|
||||
#ifdef FLASH_SIZE_1MB
|
||||
url = serverIP + F("/projects/iotmanager/config/presets/") + name + ".txt";
|
||||
String scenario = getURL(url);
|
||||
Serial.println(url);
|
||||
if (scenario == "error") return;
|
||||
#endif
|
||||
#ifndef FLASH_SIZE_1MB
|
||||
String scenario = readFile("presets/" + name + ".txt", 4048);
|
||||
#endif
|
||||
|
||||
removeFile(DEVICE_SCENARIO_FILE);
|
||||
|
||||
|
||||
addFile(DEVICE_SCENARIO_FILE, scenario);
|
||||
loadScenario();
|
||||
Serial.println(scenario);
|
||||
|
||||
@@ -124,10 +124,8 @@ void mqttCallback(char* topic, uint8_t* payload, size_t length) {
|
||||
SerialPrint("I", "MQTT", "Full update");
|
||||
publishWidgets();
|
||||
publishState();
|
||||
#ifdef LOGGING_ENABLED
|
||||
choose_log_date_and_send();
|
||||
#endif
|
||||
|
||||
choose_log_date_and_send();
|
||||
}
|
||||
|
||||
else if (topicStr.indexOf("control") != -1) {
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
#ifdef uartEnable
|
||||
#include "SoftUART.h"
|
||||
#include "Global.h"
|
||||
|
||||
@@ -8,7 +9,7 @@ HardwareSerial* myUART = nullptr;
|
||||
#endif
|
||||
|
||||
void uartInit() {
|
||||
if (!jsonReadBool(configSetupJson, "uart")) {
|
||||
if (!jsonReadBool(configSetupJson, "uartEnable")) {
|
||||
return;
|
||||
}
|
||||
if (!myUART) {
|
||||
@@ -25,7 +26,7 @@ void uartInit() {
|
||||
|
||||
void uartHandle() {
|
||||
if (myUART) {
|
||||
if (!jsonReadBool(configSetupJson, "uart")) {
|
||||
if (!jsonReadBool(configSetupJson, "uartEnable")) {
|
||||
return;
|
||||
}
|
||||
static String incStr;
|
||||
@@ -51,3 +52,4 @@ void parse(String& incStr) {
|
||||
SerialPrint("I", "=>UART", incStr);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -1,6 +1,5 @@
|
||||
#ifdef telegram
|
||||
#include "Telegram.h"
|
||||
|
||||
|
||||
CTBot* myBot{ nullptr };
|
||||
|
||||
void telegramInit() {
|
||||
@@ -120,3 +119,4 @@ String returnListOfParams() {
|
||||
}
|
||||
return out;
|
||||
}
|
||||
#endif
|
||||
44
src/Web.cpp
44
src/Web.cpp
@@ -20,24 +20,12 @@ void web_init() {
|
||||
server.on("/set", HTTP_GET, [](AsyncWebServerRequest* request) {
|
||||
//==============================set.device.json====================================================================================================
|
||||
if (request->hasArg("addItem")) {
|
||||
#ifdef FLASH_SIZE_1MB
|
||||
itemName = request->getParam("addItem")->value();
|
||||
myNotAsyncActions->make(do_addItem);
|
||||
#endif
|
||||
#ifndef FLASH_SIZE_1MB
|
||||
addItem(request->getParam("addItem")->value());
|
||||
#endif
|
||||
request->redirect("/?set.device");
|
||||
}
|
||||
|
||||
if (request->hasArg("addPreset")) {
|
||||
#ifdef FLASH_SIZE_1MB
|
||||
presetName = request->getParam("addPreset")->value();
|
||||
myNotAsyncActions->make(do_addPreset);
|
||||
#endif
|
||||
#ifndef FLASH_SIZE_1MB
|
||||
addPreset(request->getParam("addPreset")->value());
|
||||
#endif
|
||||
jsonWriteStr(configSetupJson, "warning1", F("<div style='margin-top:10px;margin-bottom:10px;'><font color='black'><p style='border: 1px solid #DCDCDC; border-radius: 3px; background-color: #ffc7c7; padding: 10px;'>Требуется перезагрузка</p></font></div>"));
|
||||
request->redirect("/?set.device");
|
||||
}
|
||||
@@ -109,12 +97,11 @@ void web_init() {
|
||||
request->send(200);
|
||||
}
|
||||
|
||||
#ifdef LOGGING_ENABLED
|
||||
|
||||
if (request->hasArg("cleanlog")) {
|
||||
cleanLogAndData();
|
||||
request->send(200);
|
||||
}
|
||||
#endif
|
||||
|
||||
//==============================wifi settings=============================================
|
||||
if (request->hasArg("devname")) {
|
||||
@@ -279,29 +266,37 @@ void web_init() {
|
||||
myNotAsyncActions->make(do_BUSSCAN);
|
||||
request->redirect("/?set.utilities");
|
||||
}
|
||||
if (request->hasArg("uart")) {
|
||||
bool value = request->getParam("uart")->value().toInt();
|
||||
jsonWriteBool(configSetupJson, "uart", value);
|
||||
if (request->hasArg("uartEnable")) {
|
||||
bool value = request->getParam("uartEnable")->value().toInt();
|
||||
jsonWriteBool(configSetupJson, "uartEnable", value);
|
||||
saveConfig();
|
||||
#ifdef uartEnable
|
||||
uartInit();
|
||||
#endif
|
||||
request->send(200);
|
||||
}
|
||||
if (request->hasArg("uartS")) {
|
||||
jsonWriteStr(configSetupJson, "uartS", request->getParam("uartS")->value());
|
||||
saveConfig();
|
||||
#ifdef uartEnable
|
||||
uartInit();
|
||||
#endif
|
||||
request->send(200);
|
||||
}
|
||||
if (request->hasArg("uartTX")) {
|
||||
jsonWriteStr(configSetupJson, "uartTX", request->getParam("uartTX")->value());
|
||||
saveConfig();
|
||||
#ifdef uartEnable
|
||||
uartInit();
|
||||
#endif
|
||||
request->send(200);
|
||||
}
|
||||
if (request->hasArg("uartRX")) {
|
||||
jsonWriteStr(configSetupJson, "uartRX", request->getParam("uartRX")->value());
|
||||
saveConfig();
|
||||
#ifdef uartEnable
|
||||
uartInit();
|
||||
#endif
|
||||
request->send(200);
|
||||
}
|
||||
|
||||
@@ -335,10 +330,13 @@ void web_init() {
|
||||
SerialPrint("I", "Update", "firmware version: " + String(lastVersion));
|
||||
|
||||
String msg = "";
|
||||
//if (FLASH_SIZE_1MB) {
|
||||
// msg = F("Обновление невозможно, память устройства 1 мб");
|
||||
//}
|
||||
//else {
|
||||
#ifdef FLASH_SIZE_1MB
|
||||
if (FLASH_SIZE_1MB) {
|
||||
msg = F("Обновление невозможно, память устройства 1 мб");
|
||||
}
|
||||
else {
|
||||
#endif
|
||||
|
||||
if (lastVersion == FIRMWARE_VERSION) {
|
||||
msg = F("Актуальная версия прошивки уже установлена.");
|
||||
}
|
||||
@@ -354,7 +352,9 @@ void web_init() {
|
||||
else if (lastVersion < FIRMWARE_VERSION) {
|
||||
msg = F("Ошибка версии. Попробуйте повторить позже...");
|
||||
}
|
||||
//}
|
||||
#ifdef FLASH_SIZE_1MB
|
||||
}
|
||||
#endif
|
||||
|
||||
// else if (lastVersion == "") {
|
||||
//msg = F("Нажмите на кнопку \"обновить прошивку\" повторно...");
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#include "Consts.h"
|
||||
#ifdef SensorBme280Enabled
|
||||
#include "items/SensorBme280Class.h"
|
||||
|
||||
#include "BufferExecute.h"
|
||||
//#ifdef SensorBme280Enabled
|
||||
//=========================================Модуль ультрозвукового дальномера==================================================================
|
||||
//bme280-temp;id;anydata;Сенсоры;Температура;order;c[1]
|
||||
//bme280-hum;id;anydata;Сенсоры;Температура;order;c[1]
|
||||
@@ -44,4 +44,4 @@ void bme280ReadingPress() {
|
||||
String key = sCmd.order();
|
||||
mySensorBme280.SensorBme280ReadPress(key);
|
||||
}
|
||||
//#endif
|
||||
#endif
|
||||
@@ -1,7 +1,7 @@
|
||||
#include "Consts.h"
|
||||
#ifdef SensorBmp280Enabled
|
||||
#include "items/SensorBmp280Class.h"
|
||||
|
||||
#include "BufferExecute.h"
|
||||
//#ifdef SensorBmp280Enabled
|
||||
//=========================================Модуль ультрозвукового дальномера==================================================================
|
||||
//bmp280-temp;id;anydata;Сенсоры;Температура;order;c[1]
|
||||
//bmp280-hum;id;anydata;Сенсоры;Температура;order;c[1]
|
||||
@@ -32,4 +32,4 @@ void bmp280ReadingPress() {
|
||||
String key = sCmd.order();
|
||||
mySensorBmp280.SensorBmp280ReadPress(key);
|
||||
}
|
||||
//#endif
|
||||
#endif
|
||||
@@ -1,7 +1,7 @@
|
||||
#include "Consts.h"
|
||||
#ifdef SensorDhtEnabled
|
||||
#include "items/SensorDhtClass.h"
|
||||
|
||||
#include "BufferExecute.h"
|
||||
//#ifdef SensorDhtEnabled
|
||||
//=========================================DHT Sensor==================================================================
|
||||
//dht-temp;id;anydata;Сенсоры;Температура;order;pin;type[dht11];c[1]
|
||||
//dht-hum;id;anydata;Сенсоры;Влажность;order;pin;type[dht11];c[1]
|
||||
@@ -32,4 +32,4 @@ void dhtReadingHum() {
|
||||
String key = sCmd.order();
|
||||
mySensorDht.SensorDhtReadHum(key);
|
||||
}
|
||||
//#endif
|
||||
#endif
|
||||
@@ -1,23 +1,23 @@
|
||||
//#include "items/SensorModbusClass.h"
|
||||
//
|
||||
//#include "BufferExecute.h"
|
||||
////#ifdef SensorModbusEnabled
|
||||
////=========================================Модуль 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
|
||||
#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
|
||||
@@ -21,12 +21,14 @@ ButtonOut::~ButtonOut() {}
|
||||
|
||||
void ButtonOut::execute(String state) {
|
||||
if (_type == "UART") {
|
||||
if (jsonReadBool(configSetupJson, "uart")) {
|
||||
if (jsonReadBool(configSetupJson, "uartEnable")) {
|
||||
#ifdef uartEnable
|
||||
if (myUART) {
|
||||
String msg = _key + " " + state;
|
||||
myUART->print(msg);
|
||||
SerialPrint("I", "<=UART", msg);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
if (state != "" && _pin != "") {
|
||||
|
||||
@@ -1,9 +1,13 @@
|
||||
|
||||
#include "Consts.h"
|
||||
#ifdef PwmOutEnable
|
||||
#include "items/vPwmOut.h"
|
||||
#include "Class/LineParsing.h"
|
||||
#include "Global.h"
|
||||
#include "BufferExecute.h"
|
||||
|
||||
#include <Arduino.h>
|
||||
|
||||
|
||||
//this class save data to flash
|
||||
PwmOut::PwmOut(unsigned int pin, String key) {
|
||||
_pin = pin;
|
||||
@@ -53,3 +57,4 @@ void pwmOutExecute() {
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -41,14 +41,18 @@ void setup() {
|
||||
setChipId();
|
||||
fileSystemInit();
|
||||
loadConfig();
|
||||
#ifdef uartEnable
|
||||
uartInit();
|
||||
#endif
|
||||
clockInit();
|
||||
timeInit();
|
||||
sensorsInit(); //Will be remooved
|
||||
itemsListInit();
|
||||
espInit();
|
||||
routerConnect();
|
||||
#ifdef telegram
|
||||
telegramInit();
|
||||
#endif
|
||||
uptime_init();
|
||||
upgradeInit();
|
||||
HttpServer::init();
|
||||
@@ -91,9 +95,13 @@ void loop() {
|
||||
myNotAsyncActions->loop();
|
||||
ts.update();
|
||||
|
||||
#ifdef telegram
|
||||
handleTelegram();
|
||||
#endif
|
||||
|
||||
#ifdef uartEnable
|
||||
uartHandle();
|
||||
#endif
|
||||
|
||||
if (myLogging != nullptr) {
|
||||
for (unsigned int i = 0; i < myLogging->size(); i++) {
|
||||
|
||||
Reference in New Issue
Block a user