mirror of
https://github.com/emsesp/EMS-ESP32.git
synced 2026-01-29 10:09:11 +03:00
@@ -37,7 +37,8 @@ build_flags = ${common.general_flags} ${common.build_flags_4m1m}
|
|||||||
|
|
||||||
[env]
|
[env]
|
||||||
framework = arduino
|
framework = arduino
|
||||||
platform = espressif8266@2.2.2 ; arduino core 2.5.2
|
;platform = espressif8266@2.2.2 ; arduino core 2.5.2
|
||||||
|
platform = espressif8266
|
||||||
;platform = https://github.com/platformio/platform-espressif8266#develop
|
;platform = https://github.com/platformio/platform-espressif8266#develop
|
||||||
;platform = https://github.com/platformio/platform-espressif8266#feature/stage
|
;platform = https://github.com/platformio/platform-espressif8266#feature/stage
|
||||||
lib_deps =
|
lib_deps =
|
||||||
|
|||||||
@@ -1472,8 +1472,8 @@ void MyESP::_heartbeatCheck(bool force) {
|
|||||||
uint32_t free_memory = ESP.getFreeHeap();
|
uint32_t free_memory = ESP.getFreeHeap();
|
||||||
uint8_t mem_available = 100 * free_memory / total_memory; // as a %
|
uint8_t mem_available = 100 * free_memory / total_memory; // as a %
|
||||||
|
|
||||||
StaticJsonDocument<200> doc;
|
StaticJsonDocument<MYESP_JSON_MAXSIZE_SMALL> doc;
|
||||||
JsonObject rootHeartbeat = doc.to<JsonObject>();
|
JsonObject rootHeartbeat = doc.to<JsonObject>();
|
||||||
|
|
||||||
rootHeartbeat["version"] = _app_version;
|
rootHeartbeat["version"] = _app_version;
|
||||||
rootHeartbeat["IP"] = WiFi.localIP().toString();
|
rootHeartbeat["IP"] = WiFi.localIP().toString();
|
||||||
@@ -2312,8 +2312,8 @@ void MyESP::_onWsEvent(AsyncWebSocket * server, AsyncWebSocketClient * client, A
|
|||||||
// handle ws from browser
|
// handle ws from browser
|
||||||
void MyESP::_procMsg(AsyncWebSocketClient * client, size_t sz) {
|
void MyESP::_procMsg(AsyncWebSocketClient * client, size_t sz) {
|
||||||
// We should always get a JSON object from browser, so parse it
|
// We should always get a JSON object from browser, so parse it
|
||||||
StaticJsonDocument<500> doc;
|
StaticJsonDocument<MYESP_JSON_MAXSIZE_MEDIUM> doc;
|
||||||
char json[sz + 1];
|
char json[sz + 1];
|
||||||
memcpy(json, (char *)(client->_tempObject), sz);
|
memcpy(json, (char *)(client->_tempObject), sz);
|
||||||
json[sz] = '\0';
|
json[sz] = '\0';
|
||||||
|
|
||||||
@@ -2410,8 +2410,7 @@ bool MyESP::_fs_sendConfig() {
|
|||||||
|
|
||||||
// send custom status via ws
|
// send custom status via ws
|
||||||
void MyESP::_sendCustomStatus() {
|
void MyESP::_sendCustomStatus() {
|
||||||
// StaticJsonDocument<300> doc;
|
DynamicJsonDocument doc(MYESP_JSON_MAXSIZE_LARGE);
|
||||||
DynamicJsonDocument doc(MYESP_JSON_MAXSIZE);
|
|
||||||
|
|
||||||
JsonObject root = doc.to<JsonObject>();
|
JsonObject root = doc.to<JsonObject>();
|
||||||
|
|
||||||
@@ -2427,7 +2426,7 @@ void MyESP::_sendCustomStatus() {
|
|||||||
(_web_callback_f)(root);
|
(_web_callback_f)(root);
|
||||||
}
|
}
|
||||||
|
|
||||||
char buffer[MYESP_JSON_MAXSIZE];
|
char buffer[MYESP_JSON_MAXSIZE_LARGE];
|
||||||
size_t len = serializeJson(root, buffer);
|
size_t len = serializeJson(root, buffer);
|
||||||
|
|
||||||
#ifdef MYESP_DEBUG
|
#ifdef MYESP_DEBUG
|
||||||
@@ -2536,9 +2535,9 @@ void MyESP::_printScanResult(int networksFound) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
StaticJsonDocument<400> doc;
|
StaticJsonDocument<MYESP_JSON_MAXSIZE_MEDIUM> doc;
|
||||||
JsonObject root = doc.to<JsonObject>();
|
JsonObject root = doc.to<JsonObject>();
|
||||||
root["command"] = "ssidlist";
|
root["command"] = "ssidlist";
|
||||||
|
|
||||||
JsonArray list = doc.createNestedArray("list");
|
JsonArray list = doc.createNestedArray("list");
|
||||||
for (int i = 0; i <= 5 && i < networksFound; ++i) {
|
for (int i = 0; i <= 5 && i < networksFound; ++i) {
|
||||||
@@ -2548,7 +2547,7 @@ void MyESP::_printScanResult(int networksFound) {
|
|||||||
item["rssi"] = WiFi.RSSI(indices[i]);
|
item["rssi"] = WiFi.RSSI(indices[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
char buffer[400];
|
char buffer[MYESP_JSON_MAXSIZE_MEDIUM];
|
||||||
size_t len = serializeJson(root, buffer);
|
size_t len = serializeJson(root, buffer);
|
||||||
_ws->textAll(buffer, len);
|
_ws->textAll(buffer, len);
|
||||||
}
|
}
|
||||||
@@ -2750,12 +2749,12 @@ void MyESP::_addMQTTLog(const char * topic, const char * payload, const MYESP_MQ
|
|||||||
|
|
||||||
// send UTC time via ws
|
// send UTC time via ws
|
||||||
void MyESP::_sendTime() {
|
void MyESP::_sendTime() {
|
||||||
StaticJsonDocument<100> doc;
|
StaticJsonDocument<MYESP_JSON_MAXSIZE_SMALL> doc;
|
||||||
JsonObject root = doc.to<JsonObject>();
|
JsonObject root = doc.to<JsonObject>();
|
||||||
root["command"] = "gettime";
|
root["command"] = "gettime";
|
||||||
root["epoch"] = now();
|
root["epoch"] = now();
|
||||||
|
|
||||||
char buffer[100];
|
char buffer[MYESP_JSON_MAXSIZE_SMALL];
|
||||||
size_t len = serializeJson(root, buffer);
|
size_t len = serializeJson(root, buffer);
|
||||||
_ws->textAll(buffer, len);
|
_ws->textAll(buffer, len);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -103,9 +103,11 @@ extern struct rst_info resetInfo;
|
|||||||
#define MQTT_DISCONNECT_EVENT 1
|
#define MQTT_DISCONNECT_EVENT 1
|
||||||
#define MQTT_MESSAGE_EVENT 2
|
#define MQTT_MESSAGE_EVENT 2
|
||||||
|
|
||||||
#define MYESP_JSON_MAXSIZE 2000 // for large Dynamic json files
|
#define MYESP_JSON_MAXSIZE_LARGE 2000 // for large Dynamic json files
|
||||||
#define MYESP_MQTTLOG_MAX 60 // max number of log entries for MQTT publishes and subscribes
|
#define MYESP_JSON_MAXSIZE_MEDIUM 800 // for medium Dynamic json files
|
||||||
#define MYESP_JSON_LOG_MAXSIZE 300 // max size of an JSON log entry
|
#define MYESP_JSON_MAXSIZE_SMALL 200 // for smaller Static json documents
|
||||||
|
|
||||||
|
#define MYESP_MQTTLOG_MAX 60 // max number of log entries for MQTT publishes and subscribes
|
||||||
|
|
||||||
#define MYESP_MQTT_PAYLOAD_ON '1' // for MQTT switch on
|
#define MYESP_MQTT_PAYLOAD_ON '1' // for MQTT switch on
|
||||||
#define MYESP_MQTT_PAYLOAD_OFF '0' // for MQTT switch off
|
#define MYESP_MQTT_PAYLOAD_OFF '0' // for MQTT switch off
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
#define APP_VERSION "1.9.4b24"
|
#define APP_VERSION "1.9.4b25"
|
||||||
|
|||||||
Reference in New Issue
Block a user