глобальное изменение системы обновления прошивки

This commit is contained in:
IoT Manager
2023-10-06 01:26:16 +02:00
parent c3a1f46b3a
commit eac446aa48
7 changed files with 136 additions and 215 deletions

View File

@@ -1,8 +1,8 @@
#pragma once
#include "Global.h"
//#include "Upgrade.h"
// #include "Upgrade.h"
#ifdef ESP8266
//#include "ESP8266.h"
// #include "ESP8266.h"
#else
#include <HTTPUpdate.h>
#endif
@@ -17,9 +17,9 @@ struct updateFirm {
extern void upgradeInit();
extern void getLastVersion();
extern void upgrade_firmware(int type);
extern bool upgradeFS();
extern bool upgradeBuild();
extern void upgrade_firmware(int type, String path);
extern bool upgradeFS(String path);
extern bool upgradeBuild(String path);
extern void restartEsp();
extern const String getBinPath(String file);

Binary file not shown.

Binary file not shown.

View File

@@ -1,5 +1,5 @@
{
"esp32_4mb": {
"esp8266_4mb": {
"0": "400"
}
}

View File

@@ -2,12 +2,12 @@
updateFirm update;
void upgrade_firmware(int type) {
void upgrade_firmware(int type, String path) {
putUserDataToRam();
// only build
if (type == 1) {
if (upgradeBuild()) {
if (upgradeBuild(path)) {
saveUserDataToFlash();
restartEsp();
}
@@ -15,7 +15,7 @@ void upgrade_firmware(int type) {
// only littlefs
else if (type == 2) {
if (upgradeFS()) {
if (upgradeFS(path)) {
saveUserDataToFlash();
restartEsp();
}
@@ -23,33 +23,33 @@ void upgrade_firmware(int type) {
// littlefs and build
else if (type == 3) {
if (upgradeFS()) {
if (upgradeFS(path)) {
saveUserDataToFlash();
if (upgradeBuild()) {
if (upgradeBuild(path)) {
restartEsp();
}
}
}
}
bool upgradeFS() {
bool upgradeFS(String path) {
bool ret = false;
WiFiClient wifiClient;
SerialPrint("!!!", F("Update"), F("Start upgrade FS..."));
SerialPrint("!!!", F("Update"), "Start upgrade FS... " + path);
handleUpdateStatus(true, UPDATE_FS_IN_PROGRESS);
if (getBinPath("") == "error") {
if (path == "") {
SerialPrint("E", F("Update"), F("FS Path error"));
handleUpdateStatus(true, PATH_ERROR);
return ret;
}
#ifdef ESP8266
ESPhttpUpdate.rebootOnUpdate(false);
t_httpUpdate_return retFS = ESPhttpUpdate.updateFS(wifiClient, getBinPath("littlefs.bin"));
t_httpUpdate_return retFS = ESPhttpUpdate.updateFS(wifiClient, path + "/littlefs.bin");
#endif
#ifdef ESP32
httpUpdate.rebootOnUpdate(false);
// обновляем little fs с помощью метода обновления spiffs
HTTPUpdateResult retFS = httpUpdate.updateSpiffs(wifiClient, getBinPath("littlefs.bin"));
// обновляем little fs с помощью метода обновления spiffs!!!!
HTTPUpdateResult retFS = httpUpdate.updateSpiffs(wifiClient, path + "/littlefs.bin");
#endif
// если FS обновилась успешно
@@ -59,28 +59,32 @@ bool upgradeFS() {
ret = true;
} else {
handleUpdateStatus(true, UPDATE_FS_FAILED);
if (retFS == HTTP_UPDATE_FAILED) {
SerialPrint("E", F("Update"), "HTTP_UPDATE_FAILED");
} else if (retFS == HTTP_UPDATE_NO_UPDATES) {
SerialPrint("E", F("Update"), "HTTP_UPDATE_NO_UPDATES");
}
}
return ret;
}
bool upgradeBuild() {
bool upgradeBuild(String path) {
bool ret = false;
WiFiClient wifiClient;
SerialPrint("!!!", F("Update"), F("Start upgrade BUILD..."));
SerialPrint("!!!", F("Update"), "Start upgrade BUILD... " + path);
handleUpdateStatus(true, UPDATE_BUILD_IN_PROGRESS);
if (getBinPath("") == "error") {
if (path == "") {
SerialPrint("E", F("Update"), F("Build Path error"));
handleUpdateStatus(true, PATH_ERROR);
return ret;
}
#if defined(esp8266_4mb) || defined(esp8266_16mb) || defined(esp8266_1mb) || defined(esp8266_1mb_ota) || defined(esp8266_2mb) || defined(esp8266_2mb_ota)
ESPhttpUpdate.rebootOnUpdate(false);
t_httpUpdate_return retBuild = ESPhttpUpdate.update(wifiClient, getBinPath("firmware.bin"));
t_httpUpdate_return retBuild = ESPhttpUpdate.update(wifiClient, path + "/firmware.bin");
#endif
#ifdef ESP32
httpUpdate.rebootOnUpdate(false);
HTTPUpdateResult retBuild = httpUpdate.update(wifiClient, getBinPath("firmware.bin"));
HTTPUpdateResult retBuild = httpUpdate.update(wifiClient, path + "/firmware.bin");
#endif
// если BUILD обновился успешно
@@ -90,6 +94,11 @@ bool upgradeBuild() {
ret = true;
} else {
handleUpdateStatus(true, UPDATE_BUILD_FAILED);
if (retBuild == HTTP_UPDATE_FAILED) {
SerialPrint("E", F("Update"), "HTTP_UPDATE_FAILED");
} else if (retBuild == HTTP_UPDATE_NO_UPDATES) {
SerialPrint("E", F("Update"), "HTTP_UPDATE_NO_UPDATES");
}
}
return ret;
}
@@ -100,22 +109,23 @@ void restartEsp() {
ESP.restart();
}
const String getBinPath(String file) {
String path = "error";
int targetVersion = 0;
String serverip;
if (jsonRead(errorsHeapJson, F("chver"), targetVersion)) {
if (targetVersion >= 400) {
if (jsonRead(settingsFlashJson, F("serverip"), serverip)) {
if (serverip != "") {
path = jsonReadStr(settingsFlashJson, F("serverip")) + "/iotm/" + String(FIRMWARE_NAME) + "/" + String(targetVersion) + "/" + file;
}
}
}
}
SerialPrint("i", F("Update"), "path: " + path);
return path;
}
// теперь путь к обнавленю прошивки мы получаем из веб интерфейса
// const String getBinPath(String file) {
// String path = "error";
// int targetVersion = 0;
// String serverip;
// if (jsonRead(errorsHeapJson, F("chver"), targetVersion)) {
// if (targetVersion >= 400) {
// if (jsonRead(settingsFlashJson, F("serverip"), serverip)) {
// if (serverip != "") {
// path = jsonReadStr(settingsFlashJson, F("serverip")) + "/iotm/" + String(FIRMWARE_NAME) + "/" + String(targetVersion) + "/" + file;
// }
// }
// }
// }
// SerialPrint("i", F("Update"), "path: " + path);
// return path;
// }
void putUserDataToRam() {
update.configJson = readFile("config.json", 4096);

View File

@@ -36,8 +36,7 @@ void webSocketEvent(uint8_t num, WStype_t type, uint8_t* payload,
case WStype_TEXT: {
bool endOfHeaderFound = false;
size_t maxAllowedHeaderSize =
15; // максимальное количество символов заголовка
size_t maxAllowedHeaderSize = 15; // максимальное количество символов заголовка
size_t headerLenth = 0;
String headerStr;
for (size_t i = 0; i <= maxAllowedHeaderSize; i++) {
@@ -59,8 +58,7 @@ void webSocketEvent(uint8_t num, WStype_t type, uint8_t* payload,
// публикация всех виджетов
if (headerStr == "/|") {
sendFileToWsByFrames("/layout.json", "layout", "", num,
WEB_SOCKETS_FRAME_SIZE);
sendFileToWsByFrames("/layout.json", "layout", "", num, WEB_SOCKETS_FRAME_SIZE);
}
if (headerStr == "/params|") {
@@ -107,14 +105,10 @@ void webSocketEvent(uint8_t num, WStype_t type, uint8_t* payload,
// отвечаем данными на запрос страницы
if (headerStr == "/config|") {
sendFileToWsByFrames("/items.json", "itemsj", "", num,
WEB_SOCKETS_FRAME_SIZE);
sendFileToWsByFrames("/widgets.json", "widget", "", num,
WEB_SOCKETS_FRAME_SIZE);
sendFileToWsByFrames("/config.json", "config", "", num,
WEB_SOCKETS_FRAME_SIZE);
sendFileToWsByFrames("/scenario.txt", "scenar", "", num,
WEB_SOCKETS_FRAME_SIZE);
sendFileToWsByFrames("/items.json", "itemsj", "", num, WEB_SOCKETS_FRAME_SIZE);
sendFileToWsByFrames("/widgets.json", "widget", "", num, WEB_SOCKETS_FRAME_SIZE);
sendFileToWsByFrames("/config.json", "config", "", num, WEB_SOCKETS_FRAME_SIZE);
sendFileToWsByFrames("/scenario.txt", "scenar", "", num, WEB_SOCKETS_FRAME_SIZE);
sendStringToWs("settin", settingsFlashJson, num);
}
@@ -222,10 +216,8 @@ void webSocketEvent(uint8_t num, WStype_t type, uint8_t* payload,
if (headerStr == "/dev|") {
sendStringToWs("errors", errorsHeapJson, num);
sendStringToWs("settin", settingsFlashJson, num);
sendFileToWsByFrames("/config.json", "config", "", num,
WEB_SOCKETS_FRAME_SIZE);
sendFileToWsByFrames("/items.json", "itemsj", "", num,
WEB_SOCKETS_FRAME_SIZE);
sendFileToWsByFrames("/config.json", "config", "", num, WEB_SOCKETS_FRAME_SIZE);
sendFileToWsByFrames("/items.json", "itemsj", "", num, WEB_SOCKETS_FRAME_SIZE);
// sendFileToWsByFrames("/layout.json", "layout", "", num,
// WEB_SOCKETS_FRAME_SIZE);
}
@@ -244,8 +236,7 @@ void webSocketEvent(uint8_t num, WStype_t type, uint8_t* payload,
// переписать любое поле в errors json
if (headerStr == "/rorre|") {
writeUint8tValueToJsonString(payload, length, headerLenth,
errorsHeapJson);
writeUint8tValueToJsonString(payload, length, headerLenth, errorsHeapJson);
}
// команда перезагрузки esp
@@ -260,7 +251,9 @@ void webSocketEvent(uint8_t num, WStype_t type, uint8_t* payload,
// команда обновления прошивки esp
if (headerStr == "/update|") {
upgrade_firmware(3);
String path;
writeUint8tToString(payload, length, headerLenth, path);
upgrade_firmware(3, path);
}
// Прием команд control c dashboard
@@ -270,9 +263,7 @@ void webSocketEvent(uint8_t num, WStype_t type, uint8_t* payload,
String key = selectFromMarkerToMarker(msg, "/", 0);
String value = selectFromMarkerToMarker(msg, "/", 1);
generateOrder(key, value);
SerialPrint(
"i", F("=>WS"),
"Msg from svelte web, WS No: " + String(num) + ", msg: " + msg);
SerialPrint("i", F("=>WS"), "Msg from svelte web, WS No: " + String(num) + ", msg: " + msg);
}
if (headerStr == "/tst|") {

View File

@@ -2,34 +2,26 @@
#include "utils/FileUtils.h"
// new================================================================================
String jsonReadStrDoc(DynamicJsonDocument &doc, String name)
{
String jsonReadStrDoc(DynamicJsonDocument &doc, String name) {
return doc[name].as<String>();
}
void jsonWriteStrDoc(DynamicJsonDocument &doc, String name, String value)
{
void jsonWriteStrDoc(DynamicJsonDocument &doc, String name, String value) {
doc[name] = value;
}
// new==============================================================================
bool jsonRead(const String &json, String key, long &value, bool e)
{
bool jsonRead(const String &json, String key, long &value, bool e) {
DynamicJsonDocument doc(JSON_BUFFER_SIZE);
DeserializationError error = deserializeJson(doc, json);
if (error)
{
if (e)
{
if (error) {
if (e) {
SerialPrint("E", F("jsonRead"), error.f_str());
jsonErrorDetected();
}
return false;
}
else if (!doc.containsKey(key))
{
if (e)
{
} else if (!doc.containsKey(key)) {
if (e) {
SerialPrint("E", F("jsonRead"), key + " missing in " + json);
jsonErrorDetected();
}
@@ -39,23 +31,17 @@ bool jsonRead(const String &json, String key, long &value, bool e)
return true;
}
bool jsonRead(const String &json, String key, float &value, bool e)
{
bool jsonRead(const String &json, String key, float &value, bool e) {
DynamicJsonDocument doc(JSON_BUFFER_SIZE);
DeserializationError error = deserializeJson(doc, json);
if (error)
{
if (e)
{
if (error) {
if (e) {
SerialPrint("E", F("jsonRead"), error.f_str());
jsonErrorDetected();
}
return false;
}
else if (!doc.containsKey(key))
{
if (e)
{
} else if (!doc.containsKey(key)) {
if (e) {
SerialPrint("E", F("jsonRead"), key + " missing in " + json);
jsonErrorDetected();
}
@@ -65,23 +51,17 @@ bool jsonRead(const String &json, String key, float &value, bool e)
return true;
}
bool jsonRead(const String &json, String key, String &value, bool e)
{
bool jsonRead(const String &json, String key, String &value, bool e) {
DynamicJsonDocument doc(JSON_BUFFER_SIZE);
DeserializationError error = deserializeJson(doc, json);
if (error)
{
if (e)
{
if (error) {
if (e) {
SerialPrint("E", F("jsonRead"), error.f_str());
jsonErrorDetected();
}
return false;
}
else if (!doc.containsKey(key))
{
if (e)
{
} else if (!doc.containsKey(key)) {
if (e) {
SerialPrint("E", F("jsonRead"), key + " missing in " + json);
jsonErrorDetected();
}
@@ -91,31 +71,24 @@ bool jsonRead(const String &json, String key, String &value, bool e)
return true;
}
bool jsonRead(const String &json, String key, bool &value, bool e)
{
bool jsonRead(const String &json, String key, bool &value, bool e) {
int lvalue = value;
bool ret = jsonRead(json, key, lvalue, e);
value = lvalue;
return ret;
}
bool jsonRead(const String &json, String key, int &value, bool e)
{
bool jsonRead(const String &json, String key, int &value, bool e) {
DynamicJsonDocument doc(JSON_BUFFER_SIZE);
DeserializationError error = deserializeJson(doc, json);
if (error)
{
if (e)
{
if (error) {
if (e) {
SerialPrint("E", F("jsonRead"), error.f_str());
jsonErrorDetected();
}
return false;
}
else if (!doc.containsKey(key))
{
if (e)
{
} else if (!doc.containsKey(key)) {
if (e) {
SerialPrint("E", F("jsonRead"), key + " missing in " + json);
jsonErrorDetected();
}
@@ -125,37 +98,28 @@ bool jsonRead(const String &json, String key, int &value, bool e)
return true;
}
bool jsonReadArray(const String &json, String key, std::vector<String> &jArray, bool e)
{
bool jsonReadArray(const String &json, String key, std::vector<String> &jArray, bool e) {
DynamicJsonDocument doc(JSON_BUFFER_SIZE);
DeserializationError error = deserializeJson(doc, json);
if (error)
{
if (e)
{
if (error) {
if (e) {
SerialPrint("E", F("jsonReadArray"), error.f_str());
jsonErrorDetected();
}
return false;
}
else if (!doc.containsKey(key))
{
if (e)
{
} else if (!doc.containsKey(key)) {
if (e) {
SerialPrint("E", F("jsonReadArray"), key + " missing in " + json);
jsonErrorDetected();
}
return false;
}
// SerialPrint("E", F("jsonReadArray"), key + " doc " + doc[key].as<String>());
if (doc[key].is<JsonArray>())
{
if (doc[key].is<JsonArray>()) {
for (int8_t i = 0; i < doc[key].size(); i++)
jArray.push_back(doc[key][i].as<String>());
// SerialPrint("E", F("jsonReadArray"), "isArray"+key + " doc " + doc[key].as<String>());
}
else
{
} else {
jArray.push_back(doc[key].as<String>());
// DynamicJsonDocument docArr(JSON_BUFFER_SIZE/5);
// jArray = doc[key].as<JsonArray>();
@@ -169,15 +133,12 @@ bool jsonReadArray(const String &json, String key, std::vector<String> &jArray,
}
// new==============================================================================
bool jsonWriteStr_(String &json, const String &key, const String &value, bool e)
{
bool jsonWriteStr_(String &json, const String &key, const String &value, bool e) {
bool ret = true;
DynamicJsonDocument doc(JSON_BUFFER_SIZE);
DeserializationError error = deserializeJson(doc, json);
if (error)
{
if (e)
{
if (error) {
if (e) {
SerialPrint("E", F("jsonWrite"), error.f_str());
jsonErrorDetected();
}
@@ -189,15 +150,12 @@ bool jsonWriteStr_(String &json, const String &key, const String &value, bool e)
return ret;
}
bool jsonWriteBool_(String &json, const String &key, bool value, bool e)
{
bool jsonWriteBool_(String &json, const String &key, bool value, bool e) {
bool ret = true;
DynamicJsonDocument doc(JSON_BUFFER_SIZE);
DeserializationError error = deserializeJson(doc, json);
if (error)
{
if (e)
{
if (error) {
if (e) {
SerialPrint("E", F("jsonWrite"), error.f_str());
jsonErrorDetected();
}
@@ -209,15 +167,12 @@ bool jsonWriteBool_(String &json, const String &key, bool value, bool e)
return ret;
}
bool jsonWriteInt_(String &json, const String &key, int value, bool e)
{
bool jsonWriteInt_(String &json, const String &key, int value, bool e) {
bool ret = true;
DynamicJsonDocument doc(JSON_BUFFER_SIZE);
DeserializationError error = deserializeJson(doc, json);
if (error)
{
if (e)
{
if (error) {
if (e) {
SerialPrint("E", F("jsonWrite"), error.f_str());
jsonErrorDetected();
}
@@ -229,15 +184,12 @@ bool jsonWriteInt_(String &json, const String &key, int value, bool e)
return ret;
}
bool jsonWriteFloat_(String &json, const String &key, float value, bool e)
{
bool jsonWriteFloat_(String &json, const String &key, float value, bool e) {
bool ret = true;
DynamicJsonDocument doc(JSON_BUFFER_SIZE);
DeserializationError error = deserializeJson(doc, json);
if (error)
{
if (e)
{
if (error) {
if (e) {
SerialPrint("E", F("jsonWrite"), error.f_str());
jsonErrorDetected();
}
@@ -249,29 +201,24 @@ bool jsonWriteFloat_(String &json, const String &key, float value, bool e)
return ret;
}
void writeUint8tValueToJsonString(uint8_t *payload, size_t length, size_t headerLenth, String &json)
{
void writeUint8tValueToJsonString(uint8_t *payload, size_t length, size_t headerLenth, String &json) {
String payloadStr;
payloadStr.reserve(length + 1);
for (size_t i = headerLenth; i < length; i++)
{
for (size_t i = headerLenth; i < length; i++) {
payloadStr += (char)payload[i];
}
jsonMergeObjects(json, payloadStr);
}
bool jsonMergeObjects(String &json1, String &json2, bool e)
{
bool jsonMergeObjects(String &json1, String &json2, bool e) {
bool ret = true;
DynamicJsonDocument doc1(JSON_BUFFER_SIZE);
DeserializationError error1 = deserializeJson(doc1, json1);
DynamicJsonDocument doc2(JSON_BUFFER_SIZE);
DeserializationError error2 = deserializeJson(doc2, json2);
jsonMergeDocs(doc1.as<JsonObject>(), doc2.as<JsonObject>());
if (error1 || error2)
{
if (e)
{
if (error1 || error2) {
if (e) {
SerialPrint("E", F("json"), "jsonMergeObjects error");
jsonErrorDetected();
}
@@ -282,23 +229,18 @@ bool jsonMergeObjects(String &json1, String &json2, bool e)
return ret;
}
void jsonMergeDocs(JsonObject dest, JsonObjectConst src)
{
for (auto kvp : src)
{
void jsonMergeDocs(JsonObject dest, JsonObjectConst src) {
for (auto kvp : src) {
dest[kvp.key()] = kvp.value();
}
}
// depricated======================================================================
String jsonReadStr(const String &json, String name, bool e)
{
String jsonReadStr(const String &json, String name, bool e) {
DynamicJsonDocument doc(JSON_BUFFER_SIZE);
DeserializationError error = deserializeJson(doc, json);
if (error)
{
if (e)
{
if (error) {
if (e) {
SerialPrint("E", F("jsonRead"), error.f_str());
jsonErrorDetected();
}
@@ -306,14 +248,11 @@ String jsonReadStr(const String &json, String name, bool e)
return doc[name].as<String>();
}
boolean jsonReadBool(const String &json, String name, bool e)
{
boolean jsonReadBool(const String &json, String name, bool e) {
DynamicJsonDocument doc(JSON_BUFFER_SIZE);
DeserializationError error = deserializeJson(doc, json);
if (error)
{
if (e)
{
if (error) {
if (e) {
SerialPrint("E", F("jsonRead"), error.f_str());
jsonErrorDetected();
}
@@ -321,14 +260,11 @@ boolean jsonReadBool(const String &json, String name, bool e)
return doc[name].as<bool>();
}
int jsonReadInt(const String &json, String name, bool e)
{
int jsonReadInt(const String &json, String name, bool e) {
DynamicJsonDocument doc(JSON_BUFFER_SIZE);
DeserializationError error = deserializeJson(doc, json);
if (error)
{
if (e)
{
if (error) {
if (e) {
SerialPrint("E", F("jsonRead"), error.f_str());
jsonErrorDetected();
}
@@ -336,14 +272,11 @@ int jsonReadInt(const String &json, String name, bool e)
return doc[name].as<int>();
}
long int jsonReadLInt(const String &json, String name, bool e)
{
long int jsonReadLInt(const String &json, String name, bool e) {
DynamicJsonDocument doc(JSON_BUFFER_SIZE);
DeserializationError error = deserializeJson(doc, json);
if (error)
{
if (e)
{
if (error) {
if (e) {
SerialPrint("E", F("jsonRead"), error.f_str());
jsonErrorDetected();
}
@@ -352,14 +285,11 @@ long int jsonReadLInt(const String &json, String name, bool e)
}
// depricated========================================================================
String jsonWriteStr(String &json, String name, String value, bool e)
{
String jsonWriteStr(String &json, String name, String value, bool e) {
DynamicJsonDocument doc(JSON_BUFFER_SIZE);
DeserializationError error = deserializeJson(doc, json);
if (error)
{
if (e)
{
if (error) {
if (e) {
SerialPrint("E", F("jsonWrite"), error.f_str());
jsonErrorDetected();
}
@@ -370,14 +300,11 @@ String jsonWriteStr(String &json, String name, String value, bool e)
return json;
}
String jsonWriteBool(String &json, String name, boolean value, bool e)
{
String jsonWriteBool(String &json, String name, boolean value, bool e) {
DynamicJsonDocument doc(JSON_BUFFER_SIZE);
DeserializationError error = deserializeJson(doc, json);
if (error)
{
if (e)
{
if (error) {
if (e) {
SerialPrint("E", F("jsonWrite"), error.f_str());
jsonErrorDetected();
}
@@ -388,14 +315,11 @@ String jsonWriteBool(String &json, String name, boolean value, bool e)
return json;
}
String jsonWriteInt(String &json, String name, int value, bool e)
{
String jsonWriteInt(String &json, String name, int value, bool e) {
DynamicJsonDocument doc(JSON_BUFFER_SIZE);
DeserializationError error = deserializeJson(doc, json);
if (error)
{
if (e)
{
if (error) {
if (e) {
SerialPrint("E", F("jsonWrite"), error.f_str());
jsonErrorDetected();
}
@@ -406,14 +330,11 @@ String jsonWriteInt(String &json, String name, int value, bool e)
return json;
}
String jsonWriteFloat(String &json, String name, float value, bool e)
{
String jsonWriteFloat(String &json, String name, float value, bool e) {
DynamicJsonDocument doc(JSON_BUFFER_SIZE);
DeserializationError error = deserializeJson(doc, json);
if (error)
{
if (e)
{
if (error) {
if (e) {
SerialPrint("E", F("jsonWrite"), error.f_str());
jsonErrorDetected();
}
@@ -424,8 +345,7 @@ String jsonWriteFloat(String &json, String name, float value, bool e)
return json;
}
void jsonErrorDetected()
{
void jsonErrorDetected() {
// пример как отправить ошибку с количеством
// jsonWriteInt(errorsHeapJson, F("jse2"), 1);
// int number = jsonReadInt(errorsHeapJson, F("jse2n"));