This commit is contained in:
Dmitry Borisenko
2021-01-03 02:14:12 +01:00
parent 965b09cc78
commit 6ae001232d
7 changed files with 26 additions and 6 deletions

View File

@@ -10,7 +10,7 @@ bool getInfo(FSInfo& info) {
void getFSInfo() {
FSInfo buf;
if (getInfo(buf)) {
SerialPrint("I", F("FS"), F("Get FS info completed"));
//SerialPrint("I", F("FS"), F("Get FS info completed"));
size_t totalBytes = buf.totalBytes; // всего
size_t usedBytes = buf.usedBytes; // использовано

View File

@@ -35,8 +35,10 @@ void handleTelegram() {
prevMillis = millis();
if (myBot->getNewMessage(msg)) {
SerialPrint("->", "Telegram", "chat ID: " + String(msg.sender.id) + ", msg: " + String(msg.text));
jsonWriteInt(configSetupJson, "chatId", msg.sender.id);
saveConfig();
if (jsonReadBool(configSetupJson, "autos")) {
jsonWriteInt(configSetupJson, "chatId", msg.sender.id);
saveConfig();
}
telegramMsgParse(String(msg.text));
}
}
@@ -61,6 +63,7 @@ void telegramMsgParse(String msg) {
myBot->sendMessage(jsonReadInt(configSetupJson, "chatId"), list);
SerialPrint("<-", "Telegram", "chat ID: " + String(jsonReadInt(configSetupJson, "chatId")) + "\n" + list);
} else {
myBot->sendMessage(jsonReadInt(configSetupJson, "chatId"), "ID: " + chipId + ", Name: " + jsonReadStr(configSetupJson, F("name")));
myBot->sendMessage(jsonReadInt(configSetupJson, "chatId"), F("Wrong order, use /all to get all values, /get_id to get value, or /set_id_value to set value"));
}
}

View File

@@ -255,6 +255,12 @@ void web_init() {
saveConfig();
request->send(200);
}
if (request->hasArg("autos")) {
bool value = request->getParam("autos")->value().toInt();
jsonWriteBool(configSetupJson, "autos", value);
saveConfig();
request->send(200);
}
if (request->hasArg("chatId")) {
jsonWriteStr(configSetupJson, "chatId", request->getParam("chatId")->value());
saveConfig();

View File

@@ -62,15 +62,15 @@ void LoggingClass::execute(String keyOrValue) {
}
if (loggingValue != "") {
if (cnt >= _maxPoints) { //удаляем старую строку и добавляем новую
if (cnt >= _maxPoints) { //удаляем старую строку и добавляем новую
String logData = readFile(filename, 20480); //10240
SerialPrint("I", "Logging", "Free heap " + String(ESP.getFreeHeap()));
if (logData == "large") {
SerialPrint("E", "Logging", "File is very large");
}
//for (int i = 0; i < 5; i++) {
logData = deleteBeforeDelimiter(logData, "\r\n");
//}
if (timeNow->hasTimeSynced()) {
logData += timeNow->getTimeUnix() + " " + loggingValue + "\r\n";