mirror of
https://github.com/IoTManagerProject/IoTManager.git
synced 2026-06-10 20:09:19 +03:00
версия 420
This commit is contained in:
File diff suppressed because one or more lines are too long
@@ -4,7 +4,7 @@
|
|||||||
<meta charset="utf-8" />
|
<meta charset="utf-8" />
|
||||||
<meta name="viewport" content="width=device-width,initial-scale=1" />
|
<meta name="viewport" content="width=device-width,initial-scale=1" />
|
||||||
|
|
||||||
<title>IoT Manager 4.2.7</title>
|
<title>IoT Manager 4.2.8</title>
|
||||||
|
|
||||||
<link rel="icon" type="image/png" href="/favicon.ico" />
|
<link rel="icon" type="image/png" href="/favicon.ico" />
|
||||||
<link rel="stylesheet" href="/build/bundle.css" />
|
<link rel="stylesheet" href="/build/bundle.css" />
|
||||||
|
|||||||
@@ -455,16 +455,18 @@
|
|||||||
"num": 34
|
"num": 34
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "35. PWM ESP8266",
|
"name": "35. PWM ESP32",
|
||||||
"type": "Writing",
|
"type": "Writing",
|
||||||
"subtype": "Pwm8266",
|
"subtype": "Pwm32",
|
||||||
"id": "pwm",
|
"id": "pwm",
|
||||||
"widget": "range",
|
"widget": "range",
|
||||||
"page": "Кнопки",
|
"page": "Кнопки",
|
||||||
"descr": "PWM",
|
"descr": "PWM",
|
||||||
"int": 0,
|
"int": 0,
|
||||||
"pin": 15,
|
"pin": 2,
|
||||||
"freq": 5000,
|
"freq": 5000,
|
||||||
|
"ledChannel": 2,
|
||||||
|
"PWM_resolution": 10,
|
||||||
"val": 0,
|
"val": 0,
|
||||||
"apin": -1,
|
"apin": -1,
|
||||||
"num": 35
|
"num": 35
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
//Версия прошивки
|
//Версия прошивки
|
||||||
#define FIRMWARE_VERSION 419
|
#define FIRMWARE_VERSION 420
|
||||||
|
|
||||||
#ifdef esp8266_4mb
|
#ifdef esp8266_4mb
|
||||||
#define FIRMWARE_NAME "esp8266_4mb"
|
#define FIRMWARE_NAME "esp8266_4mb"
|
||||||
|
|||||||
@@ -18,4 +18,9 @@ void saveDataDB(String id, String data);
|
|||||||
String readDataDB(String id);
|
String readDataDB(String id);
|
||||||
extern void onFlashWrite();
|
extern void onFlashWrite();
|
||||||
|
|
||||||
String FileList(String path);
|
String FileList(String path);
|
||||||
|
|
||||||
|
extern void getFSInfo();
|
||||||
|
#ifdef ESP8266
|
||||||
|
extern bool getInfo(FSInfo& info);
|
||||||
|
#endif
|
||||||
@@ -21,7 +21,7 @@
|
|||||||
},
|
},
|
||||||
"projectProp": {
|
"projectProp": {
|
||||||
"platformio": {
|
"platformio": {
|
||||||
"default_envs": "esp8266_4mb",
|
"default_envs": "esp32_4mb",
|
||||||
"data_dir": "data_svelte"
|
"data_dir": "data_svelte"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ build_src_filter =
|
|||||||
${env:esp32_4mb_fromitems.build_src_filter}
|
${env:esp32_4mb_fromitems.build_src_filter}
|
||||||
|
|
||||||
[platformio]
|
[platformio]
|
||||||
default_envs = esp8266_4mb
|
default_envs = esp32_4mb
|
||||||
data_dir = data_svelte
|
data_dir = data_svelte
|
||||||
|
|
||||||
[common_env_data]
|
[common_env_data]
|
||||||
|
|||||||
@@ -4,6 +4,8 @@ void periodicTasksInit() {
|
|||||||
//задачи редкого выполнения
|
//задачи редкого выполнения
|
||||||
ts.add(
|
ts.add(
|
||||||
PTASK, 1000 * 30, [&](void*) {
|
PTASK, 1000 * 30, [&](void*) {
|
||||||
|
// fs
|
||||||
|
getFSInfo();
|
||||||
// heap
|
// heap
|
||||||
String heap = prettyBytes(ESP.getFreeHeap());
|
String heap = prettyBytes(ESP.getFreeHeap());
|
||||||
SerialPrint(F("i"), F("HEAP"), heap);
|
SerialPrint(F("i"), F("HEAP"), heap);
|
||||||
|
|||||||
@@ -170,6 +170,17 @@ void webSocketEvent(uint8_t num, WStype_t type, uint8_t* payload, size_t length)
|
|||||||
standWebSocket.sendTXT(num, settingsFlashJson);
|
standWebSocket.sendTXT(num, settingsFlashJson);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------//
|
||||||
|
// Страница веб интерфейса dev
|
||||||
|
//----------------------------------------------------------------------//
|
||||||
|
if (headerStr == "/dev|") {
|
||||||
|
standWebSocket.sendTXT(num, errorsHeapJson);
|
||||||
|
sendFileToWs("/layout.json", num, 1024);
|
||||||
|
standWebSocket.sendTXT(num, settingsFlashJson);
|
||||||
|
sendFileToWs("/config.json", num, 1024);
|
||||||
|
sendFileToWs("/items.json", num, 1024);
|
||||||
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------//
|
//----------------------------------------------------------------------//
|
||||||
// отдельные команды веб интерфейса
|
// отдельные команды веб интерфейса
|
||||||
//----------------------------------------------------------------------//
|
//----------------------------------------------------------------------//
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ void* getAPI_ButtonOut(String subtype, String params);
|
|||||||
void* getAPI_IoTServo(String subtype, String params);
|
void* getAPI_IoTServo(String subtype, String params);
|
||||||
void* getAPI_Mcp23017(String subtype, String params);
|
void* getAPI_Mcp23017(String subtype, String params);
|
||||||
void* getAPI_Mp3(String subtype, String params);
|
void* getAPI_Mp3(String subtype, String params);
|
||||||
void* getAPI_Pwm8266(String subtype, String params);
|
void* getAPI_Pwm32(String subtype, String params);
|
||||||
void* getAPI_TelegramLT(String subtype, String params);
|
void* getAPI_TelegramLT(String subtype, String params);
|
||||||
void* getAPI_Lcd2004(String subtype, String params);
|
void* getAPI_Lcd2004(String subtype, String params);
|
||||||
|
|
||||||
@@ -50,7 +50,7 @@ if ((tmpAPI = getAPI_ButtonOut(subtype, params)) != nullptr) return tmpAPI;
|
|||||||
if ((tmpAPI = getAPI_IoTServo(subtype, params)) != nullptr) return tmpAPI;
|
if ((tmpAPI = getAPI_IoTServo(subtype, params)) != nullptr) return tmpAPI;
|
||||||
if ((tmpAPI = getAPI_Mcp23017(subtype, params)) != nullptr) return tmpAPI;
|
if ((tmpAPI = getAPI_Mcp23017(subtype, params)) != nullptr) return tmpAPI;
|
||||||
if ((tmpAPI = getAPI_Mp3(subtype, params)) != nullptr) return tmpAPI;
|
if ((tmpAPI = getAPI_Mp3(subtype, params)) != nullptr) return tmpAPI;
|
||||||
if ((tmpAPI = getAPI_Pwm8266(subtype, params)) != nullptr) return tmpAPI;
|
if ((tmpAPI = getAPI_Pwm32(subtype, params)) != nullptr) return tmpAPI;
|
||||||
if ((tmpAPI = getAPI_TelegramLT(subtype, params)) != nullptr) return tmpAPI;
|
if ((tmpAPI = getAPI_TelegramLT(subtype, params)) != nullptr) return tmpAPI;
|
||||||
if ((tmpAPI = getAPI_Lcd2004(subtype, params)) != nullptr) return tmpAPI;
|
if ((tmpAPI = getAPI_Lcd2004(subtype, params)) != nullptr) return tmpAPI;
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
|||||||
@@ -290,4 +290,37 @@ String FileList(String path) {
|
|||||||
output += "]";
|
output += "]";
|
||||||
return output;
|
return output;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if defined(ESP8266)
|
||||||
|
bool getInfo(FSInfo& info) {
|
||||||
|
return FileFS.info(info);
|
||||||
|
}
|
||||||
|
// Информация о ФС
|
||||||
|
void getFSInfo() {
|
||||||
|
FSInfo buf;
|
||||||
|
if (getInfo(buf)) {
|
||||||
|
size_t totalBytes = buf.totalBytes; // всего
|
||||||
|
size_t usedBytes = buf.usedBytes; // использовано
|
||||||
|
// size_t maxOpenFiles = buf.maxOpenFiles; // лимит на открые файлы
|
||||||
|
// size_t blockSize = buf.blockSize;
|
||||||
|
// size_t pageSize = buf.pageSize;
|
||||||
|
// size_t maxPathLength = buf.maxPathLength; // лимит на пути и имена файлов
|
||||||
|
size_t freeBytes = totalBytes - usedBytes;
|
||||||
|
float freePer = ((float)freeBytes / totalBytes) * 100;
|
||||||
|
jsonWriteStr(errorsHeapJson, F("freeBytes"), String(freePer) + "% (" + prettyBytes(freeBytes) + ")");
|
||||||
|
} else {
|
||||||
|
SerialPrint("E", F("FS"), F("FS info error"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(ESP32)
|
||||||
|
void getFSInfo() {
|
||||||
|
size_t totalBytes = FileFS.totalBytes(); // всего
|
||||||
|
size_t usedBytes = FileFS.usedBytes(); // использовано
|
||||||
|
size_t freeBytes = totalBytes - usedBytes;
|
||||||
|
float freePer = ((float)freeBytes / totalBytes) * 100;
|
||||||
|
jsonWriteStr(errorsHeapJson, F("freeBytes"), String(freePer) + "% (" + prettyBytes(freeBytes) + ")");
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|||||||
@@ -24,29 +24,23 @@ void updateDeviceStatus() {
|
|||||||
WiFiClient client;
|
WiFiClient client;
|
||||||
HTTPClient http;
|
HTTPClient http;
|
||||||
http.begin(client, url);
|
http.begin(client, url);
|
||||||
// http.setAuthorization("admin", "admin");
|
http.addHeader("Content-Type", "application/x-www-form-urlencoded");
|
||||||
http.addHeader("Content-Type", "application/json");
|
String httpRequestData = "idesp=" + getChipId() +
|
||||||
// String mac = WiFi.macAddress().c_str();
|
"&nameesp=" + jsonReadStr(settingsFlashJson, F("name")) +
|
||||||
String json = "";
|
"&firmwarename=" + String(FIRMWARE_NAME) +
|
||||||
jsonWriteStr_(json, "idesp", getChipId());
|
"&firmwarever=" + String(FIRMWARE_VERSION) +
|
||||||
jsonWriteStr_(json, "nameesp", jsonReadStr(settingsFlashJson, F("name")));
|
"&rebootreason=" + ESP_getResetReason() +
|
||||||
jsonWriteStr_(json, "firmwarename", String(FIRMWARE_NAME));
|
"&uptime=" + jsonReadStr(errorsHeapJson, F("upt"));
|
||||||
jsonWriteStr_(json, "firmwarever", String(FIRMWARE_VERSION));
|
int httpResponseCode = http.POST(httpRequestData);
|
||||||
jsonWriteStr_(json, "rebootreason", ESP_getResetReason());
|
|
||||||
int httpCode = http.POST(json);
|
if (httpResponseCode > 0) {
|
||||||
// int httpCode = http.POST("?idesp=" + getChipId() +
|
ret = httpResponseCode;
|
||||||
// "&nameesp=" + jsonReadStr(settingsFlashJson, F("name")) +
|
if (httpResponseCode == HTTP_CODE_OK) {
|
||||||
// "&firmwarename=" + String(FIRMWARE_NAME) +
|
|
||||||
// "&firmwarever=" + String(FIRMWARE_VERSION) +
|
|
||||||
// "&rebootreason=" + ESP_getResetReason() + "");
|
|
||||||
if (httpCode > 0) {
|
|
||||||
ret = httpCode;
|
|
||||||
if (httpCode == HTTP_CODE_OK) {
|
|
||||||
String payload = http.getString();
|
String payload = http.getString();
|
||||||
ret += " " + payload;
|
ret += " " + payload;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
ret = http.errorToString(httpCode).c_str();
|
ret = http.errorToString(httpResponseCode).c_str();
|
||||||
}
|
}
|
||||||
http.end();
|
http.end();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user