Skip to content

Commit 715959d

Browse files
authored
v2.6
1 parent 4948f52 commit 715959d

File tree

6 files changed

+116
-208
lines changed

6 files changed

+116
-208
lines changed

globals.h

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,9 @@
1010

1111
#pragma once
1212

13-
//#define DEV_ONLY // leave commented out
13+
#if __has_include("./devUtilities.cpp")
14+
//#define DEV_ONLY
15+
#endif
1416
#ifdef DEV_ONLY
1517
// to compile with -Wall -Werror=all -Wextra
1618
#pragma GCC diagnostic error "-Wformat=2"
@@ -200,6 +202,7 @@ bool startStorage();
200202
bool startWebServer();
201203
void stopPing();
202204
void syncToBrowser(uint32_t browserUTC);
205+
char* toCase(char *s, bool toLower = true);
203206
char* trim(char* str);
204207
bool updateConfigVect(const char* variable, const char* value);
205208
void updateStatus(const char* variable, const char* _value, bool fromUser = true);
@@ -339,8 +342,7 @@ extern char messageLog[];
339342
extern uint16_t mlogEnd;
340343
extern bool timeSynchronized;
341344
extern bool monitorOpen;
342-
extern const uint8_t setupPage_html_gz[];
343-
extern const size_t setupPage_html_gz_len;
345+
extern const char* setupPage_html;
344346
extern const char* otaPage_html;
345347
extern const char* failPageS_html;
346348
extern const char* failPageE_html;

prefs.cpp

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,7 @@ static void loadVectItem(const std::string keyValGrpLabel) {
131131
static void saveConfigVect() {
132132
File file = STORAGE.open(CONFIG_FILE_PATH, FILE_WRITE);
133133
char configLine[FILE_NAME_LEN + 101];
134+
int cfgCnt = 0;
134135
if (!file) LOG_WRN("Failed to save to configs file");
135136
else {
136137
sort(configs.begin(), configs.end());
@@ -142,8 +143,9 @@ static void saveConfigVect() {
142143
snprintf(configLine, FILE_NAME_LEN + 100, "%s%c%.*s%c%s%c%s%c%s\n", row[0].c_str(), DELIM, strlen(row[1].c_str()), FILLSTAR, DELIM, row[2].c_str(), DELIM, row[3].c_str(), DELIM, row[4].c_str());
143144
else snprintf(configLine, FILE_NAME_LEN + 100, "%s%c%s%c%s%c%s%c%s\n", row[0].c_str(), DELIM, row[1].c_str(), DELIM, row[2].c_str(), DELIM, row[3].c_str(), DELIM, row[4].c_str());
144145
file.write((uint8_t*)configLine, strlen(configLine));
146+
cfgCnt++;
145147
}
146-
LOG_ALT("Config file saved");
148+
LOG_ALT("Config file saved %d entries", cfgCnt);
147149
}
148150
file.close();
149151
}
@@ -485,7 +487,14 @@ static bool checkConfigFile() {
485487
file = STORAGE.open(CONFIG_FILE_PATH, FILE_WRITE);
486488
if (file) {
487489
// apply initial defaults
488-
file.write((uint8_t*)appConfig, strlen(appConfig));
490+
uint8_t* p = (uint8_t*)appConfig;
491+
int cfgLen = strlen(appConfig);
492+
while (cfgLen > 0) {
493+
int toWrite = min(512, cfgLen);
494+
file.write(p, toWrite);
495+
p += toWrite;
496+
cfgLen -= toWrite;
497+
}
489498
sprintf(hostName, "%s_%012llX", APP_NAME, ESP.getEfuseMac());
490499
char cfg[100];
491500
sprintf(cfg, "appId~%s~99~~na\n", APP_NAME);

0 commit comments

Comments
 (0)