избавление от двух файлов

This commit is contained in:
Dmitry Borisenko
2022-09-29 19:43:37 +02:00
parent cacfae9435
commit 27e30ab0ff
9 changed files with 59 additions and 28 deletions

View File

@@ -599,16 +599,16 @@ int IoTScenario::getLastChar() {
LastChar = file.read();
if (LastChar == 10) curLine++;
return LastChar;
} else
} else
return EOF;
} else if (mode == 1) {
if (charCount < strFromFile.length()) {
LastChar = strFromFile.charAt(charCount);
//Serial.printf("%d, ", LastChar);
// Serial.printf("%d, ", LastChar);
if (LastChar == 10) curLine++;
charCount++;
return LastChar;
} else
} else
return EOF;
} else {
return EOF;
@@ -980,6 +980,12 @@ void IoTScenario::loadScenario(String fileName) { // подготавливае
return;
}
strFromFile = file.readString();
strFromFile.replace("{\"scen\":\"", "");
strFromFile.replace("\\n", "\n");
strFromFile.replace("\\\"", "\"");
strFromFile.replace(";", " ");
strFromFile.replace("\\t", " ");
strFromFile.remove(strFromFile.length() - 2, 2);
Serial.printf("strFromFile: %s, %s\n", strFromFile.c_str(), fileName.c_str());
file.close();
}