Skip to content

Commit 18b65b4

Browse files
committed
build: update config files name
1 parent 606025a commit 18b65b4

File tree

4 files changed

+14
-14
lines changed

4 files changed

+14
-14
lines changed

data/config.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
{
2-
"currentActiveDeviceAddress": ""
2+
"ssid": "SSID",
3+
"password": "PASSWORD"
34
}

data/system.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"currentActiveDeviceAddress": ""
3+
}

data/wifi.json

Lines changed: 0 additions & 4 deletions
This file was deleted.

src/main.cpp

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -292,7 +292,7 @@ void generalTask(void *pvParameters) {
292292
currentActiveDeviceAddress = String(addresses[i].c_str());
293293
StaticJsonDocument<128> doc;
294294
if (SPIFFS.begin()) {
295-
File config = SPIFFS.open("/config.json", "w");
295+
File config = SPIFFS.open("/system.json", "w");
296296
doc["currentActiveDeviceAddress"] =
297297
currentActiveDeviceAddress;
298298
serializeJson(doc, config);
@@ -939,7 +939,7 @@ void switchDevice() {
939939
Serial.println("Address: " + (String)currentActiveDeviceAddress);
940940
if (SPIFFS.begin()) {
941941
StaticJsonDocument<128> doc;
942-
File config = SPIFFS.open("/config.json", "w");
942+
File config = SPIFFS.open("/system.json", "w");
943943
doc["currentActiveDeviceAddress"] = currentActiveDeviceAddress;
944944
serializeJson(doc, config);
945945
config.close();
@@ -1199,14 +1199,14 @@ void resetIdle() { sleepPreviousMillis = currentMillis; }
11991199
*
12001200
*/
12011201
void initWebServer() {
1202-
Serial.println("Loading \"wifi.json\" from SPIFFS...");
1203-
File file = SPIFFS.open("/wifi.json");
1202+
Serial.println("Loading \"config.json\" from SPIFFS...");
1203+
File file = SPIFFS.open("/config.json");
12041204
if (!file) {
12051205
Serial.println("Failed to open file for reading");
12061206
return;
12071207
}
12081208

1209-
Serial.println("Reading WIFI configuration from \"wifi.json\"...");
1209+
Serial.println("Reading WIFI configuration from \"config.json\"...");
12101210
String wifiConfigJSON = "";
12111211
while (file.available()) {
12121212
wifiConfigJSON += (char)file.read();
@@ -1427,14 +1427,14 @@ void initWebServer() {
14271427
String buffer;
14281428
DynamicJsonDocument doc(512);
14291429

1430-
Serial.println("Loading \"wifi.json\" from SPIFFS...");
1431-
File file = SPIFFS.open("/wifi.json");
1430+
Serial.println("Loading \"config.json\" from SPIFFS...");
1431+
File file = SPIFFS.open("/config.json");
14321432
if (!file) {
14331433
Serial.println("Failed to open file for reading");
14341434
return;
14351435
}
14361436

1437-
Serial.println("Reading WIFI configuration from \"wifi.json\"...");
1437+
Serial.println("Reading WIFI configuration from \"config.json\"...");
14381438
String wifiConfigJSON = "";
14391439
while (file.available()) {
14401440
wifiConfigJSON += (char)file.read();
@@ -1475,7 +1475,7 @@ void initWebServer() {
14751475
return;
14761476
}
14771477

1478-
const String filename = "wifi.json";
1478+
const String filename = "config.json";
14791479

14801480
File config = SPIFFS.open("/" + filename, "w");
14811481
if (!config) {

0 commit comments

Comments
 (0)