[ESP8266] Change default platform to not using 2nd heap

This commit is contained in:
TD-er
2023-11-15 13:29:12 +01:00
parent 3475de24ca
commit 5a4c64abf2
3 changed files with 22 additions and 24 deletions
+4 -4
View File
@@ -4,10 +4,10 @@
[regular_platform]
build_flags = ${core_stage_2ndheap.build_flags}
platform = ${core_stage_2ndheap.platform}
platform_packages = ${core_stage_2ndheap.platform_packages}
lib_ignore = ${core_stage_2ndheap.lib_ignore}
build_flags = ${core_stage.build_flags}
platform = ${core_stage.platform}
platform_packages = ${core_stage.platform_packages}
lib_ignore = ${core_stage.lib_ignore}
[regular_platform_alt_wifi]
build_flags = ${core_2_7_4_alt_wifi.build_flags}
+7 -5
View File
@@ -148,14 +148,16 @@ Web_StreamingBuffer& Web_StreamingBuffer::addString(const String& a) {
unsigned int pos = 0;
while (pos < length) {
if (flush_step == 0) {
if (flush_step <= 0) {
flush();
flush_step = CHUNKED_BUFFER_SIZE;
} else {
// Just copy per byte instead of using substring as substring needs to allocate memory.
this->buf += a[pos];
++pos;
--flush_step;
const int remaining = length - pos;
const int fetchLength = flush_step >= remaining ? remaining : flush_step;
const char* ch = a.begin() + pos;
this->buf.concat(ch, static_cast<unsigned int>(fetchLength));
pos += fetchLength;
flush_step -= fetchLength;
}
}
return *this;
+11 -15
View File
@@ -33,16 +33,15 @@ void handle_rules() {
if (!isLoggedIn() || !Settings.UseRules) { return; }
navMenuIndex = MENU_INDEX_RULES;
const uint8_t rulesSet = getFormItemInt(F("set"), 1);
const int rulesSet = getFormItemInt(F("set"), 1);
# if defined(ESP8266)
String fileName = F("rules");
# endif // if defined(ESP8266)
# if defined(ESP32)
String fileName = F("/rules");
# endif // if defined(ESP32)
fileName += rulesSet;
fileName += F(".txt");
const String fileName = strformat(
#ifdef ESP8266
F("rules%d.txt")
#else
F("/rules%d.txt")
#endif
, rulesSet);
String error;
@@ -50,9 +49,7 @@ void handle_rules() {
if (!fileExists(fileName))
{
if (loglevelActiveFor(LOG_LEVEL_INFO)) {
String log = F("Rules : Create new file: ");
log += fileName;
addLogMove(LOG_LEVEL_INFO, log);
addLogMove(LOG_LEVEL_INFO, concat(F("Rules : Create new file: %s"), fileName));
}
fs::File f = tryOpenFile(fileName, "w");
@@ -74,14 +71,13 @@ void handle_rules() {
addHtml(F("<form id='rulesselect' name='rulesselect' method='get'>"));
{
// Place combo box in its own scope to release these arrays as soon as possible
uint8_t choice = rulesSet;
int choice = rulesSet;
String options[RULESETS_MAX];
int optionValues[RULESETS_MAX];
for (uint8_t x = 0; x < RULESETS_MAX; x++)
{
options[x] = F("Rules Set ");
options[x] += x + 1;
options[x] = concat(F("Rules Set "), x+1);
optionValues[x] = x + 1;
}