mirror of
https://github.com/IoTManagerProject/IoTManager.git
synced 2026-03-26 22:22:16 +03:00
248
This commit is contained in:
@@ -43,7 +43,7 @@
|
||||
},
|
||||
{
|
||||
"type": "h4",
|
||||
"title": "LittleFS version: 247"
|
||||
"title": "LittleFS version: 248"
|
||||
},
|
||||
{
|
||||
"type": "hr"
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
//=================Firmeare=================
|
||||
#define FIRMWARE_NAME "esp8266-iotm"
|
||||
#define FIRMWARE_VERSION 247
|
||||
#define FIRMWARE_VERSION 248
|
||||
#define FLASH_4MB true
|
||||
|
||||
//=================System===================
|
||||
@@ -25,7 +25,7 @@
|
||||
//#define WEBSOCKET_ENABLED
|
||||
//#define LAYOUT_IN_RAM
|
||||
//#define UDP_ENABLED
|
||||
//#define SSDP_EN
|
||||
#define SSDP_EN
|
||||
|
||||
//=========Sensors enable/disable===========
|
||||
#define TANK_LEVEL_SAMPLES 10
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
#pragma once
|
||||
#include <Arduino.h>
|
||||
|
||||
#include "Class/LineParsing.h"
|
||||
#include "Global.h"
|
||||
|
||||
@@ -26,18 +27,19 @@ class ButtonInClass : public LineParsing {
|
||||
if (but[switch_number]) {
|
||||
buttons[switch_number].update();
|
||||
if (buttons[switch_number].fell()) {
|
||||
}
|
||||
if (buttons[switch_number].rose()) {
|
||||
String key = jsonReadStr(configOptionJson, "switch_num_" + String(switch_number));
|
||||
state = !state;
|
||||
switchChangeVirtual(key, String(state));
|
||||
}
|
||||
if (buttons[switch_number].rose()) {
|
||||
}
|
||||
}
|
||||
switch_number++;
|
||||
if (switch_number == NUM_BUTTONS) {
|
||||
switch_number = 0;
|
||||
}
|
||||
}
|
||||
|
||||
void switchStateSetDefault() {
|
||||
if (_state != "") {
|
||||
switchChangeVirtual(_key, _state);
|
||||
@@ -47,7 +49,7 @@ class ButtonInClass : public LineParsing {
|
||||
void switchChangeVirtual(String key, String state) {
|
||||
eventGen(key, "");
|
||||
jsonWriteInt(configLiveJson, key, state.toInt());
|
||||
publishStatus(key, state);
|
||||
publishStatus(key, state);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
65
src/Web.cpp
65
src/Web.cpp
@@ -14,32 +14,8 @@ bool parseRequestForPreset(AsyncWebServerRequest* request, uint8_t& preset) {
|
||||
}
|
||||
|
||||
void web_init() {
|
||||
// dnsServer.start(53, "*", WiFi.softAPIP());
|
||||
// server.addHandler(new CaptiveRequestHandler(jsonReadStr(configSetupJson, "name").c_str())).setFilter(ON_AP_FILTER);
|
||||
|
||||
server.on("/restart", HTTP_GET, [](AsyncWebServerRequest* request) {
|
||||
if (request->hasArg("device")) {
|
||||
if (request->getParam("device")->value() == "ok") {
|
||||
ESP.restart();
|
||||
}
|
||||
request->send(200);
|
||||
};
|
||||
});
|
||||
|
||||
|
||||
server.on("/set", HTTP_GET, [](AsyncWebServerRequest* request) {
|
||||
//==============================presets===========================================================================================================
|
||||
//uint8_t preset;
|
||||
//if (parseRequestForPreset(request, preset)) {
|
||||
// SerialPrint("I","Web","activate #" + String(preset, DEC));
|
||||
// String configFile = DEVICE_CONFIG_FILE;
|
||||
// String scenarioFile = DEVICE_SCENARIO_FILE;
|
||||
// copyFile(getConfigFile(preset, CT_CONFIG), configFile);
|
||||
// copyFile(getConfigFile(preset, CT_SCENARIO), scenarioFile);
|
||||
// Device_init();
|
||||
// loadScenario();
|
||||
// request->redirect("/?set.device");
|
||||
//}
|
||||
|
||||
//==============================set.device.json====================================================================================================
|
||||
if (request->hasArg("addItem")) {
|
||||
String name = request->getParam("addItem")->value();
|
||||
@@ -84,32 +60,14 @@ void web_init() {
|
||||
request->send(200);
|
||||
}
|
||||
#endif
|
||||
//==============================udp settings=============================================
|
||||
//if (request->hasArg("udponoff")) {
|
||||
// bool value = request->getParam("udponoff")->value().toInt();
|
||||
// jsonWriteBool(configSetupJson, "udponoff", value);
|
||||
// saveConfig();
|
||||
// loadScenario();
|
||||
// request->send(200);
|
||||
//}
|
||||
//
|
||||
//if (request->hasArg("updatelist")) {
|
||||
// removeFile("/dev.csv");
|
||||
// addFileLn("dev.csv", "device id;device name;ip address");
|
||||
// request->redirect("/?set.udp");
|
||||
//}
|
||||
//
|
||||
//if (request->hasArg("updatepage")) {
|
||||
// request->redirect("/?set.udp");
|
||||
//}
|
||||
//
|
||||
//if (request->hasArg("devname")) {
|
||||
// jsonWriteStr(configSetupJson, "name", request->getParam("devname")->value());
|
||||
// saveConfig();
|
||||
// request->send(200);
|
||||
//}
|
||||
|
||||
//==============================wifi settings=============================================
|
||||
if (request->hasArg("devname")) {
|
||||
jsonWriteStr(configSetupJson, "name", request->getParam("devname")->value());
|
||||
saveConfig();
|
||||
request->send(200);
|
||||
}
|
||||
|
||||
if (request->hasArg("routerssid")) {
|
||||
jsonWriteStr(configSetupJson, "routerssid", request->getParam("routerssid")->value());
|
||||
saveConfig();
|
||||
@@ -169,6 +127,13 @@ void web_init() {
|
||||
request->send(200);
|
||||
}
|
||||
|
||||
if (request->hasArg("device")) {
|
||||
if (request->getParam("device")->value() == "ok") {
|
||||
ESP.restart();
|
||||
}
|
||||
request->send(200);
|
||||
}
|
||||
|
||||
//==============================mqtt settings=============================================
|
||||
|
||||
if (request->hasArg("mqttServer")) {
|
||||
@@ -209,7 +174,7 @@ void web_init() {
|
||||
}
|
||||
|
||||
if (request->hasArg("mqttcheck")) {
|
||||
String buf = "<button class=\"close\" onclick=\"toggle('my-block')\">×</button>" + getStateStr();
|
||||
String buf = "<button class=\"close\" onclick=\"toggle('my-block')\">×</button>" + getStateStr();
|
||||
|
||||
String payload = "{}";
|
||||
jsonWriteStr(payload, "title", buf);
|
||||
|
||||
Reference in New Issue
Block a user