Skip to content

Commit 418e785

Browse files
committed
Merge remote-tracking branch 'upstream/status_led_brightness' into uat-xmas2024
2 parents 8b62a09 + 9ddb120 commit 418e785

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

src/provisioning/littlefs/WipperSnapper_LittleFS.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,12 @@ void WipperSnapper_LittleFS::parseSecrets() {
138138
"credentials!\n");
139139
}
140140

141+
// specify type of value for json key, by using the |operator to include
142+
// a typed default value equivalent of with .as<float> w/ default value
143+
// https://arduinojson.org/v7/api/jsonvariant/or/
144+
WS._config.status_pixel_brightness =
145+
doc["status_pixel_brightness"] | (float)STATUS_PIXEL_BRIGHTNESS_DEFAULT;
146+
141147
// Close the file
142148
secretsFile.close();
143149

src/provisioning/tinyusb/Wippersnapper_FS.cpp

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -325,7 +325,7 @@ void Wippersnapper_FS::createSecretsFile() {
325325
strcpy(secretsConfig.aio_key, "YOUR_IO_KEY_HERE");
326326
strcpy(secretsConfig.network.ssid, "YOUR_WIFI_SSID_HERE");
327327
strcpy(secretsConfig.network.pass, "YOUR_WIFI_PASS_HERE");
328-
secretsConfig.status_pixel_brightness = 0.2;
328+
secretsConfig.status_pixel_brightness = STATUS_PIXEL_BRIGHTNESS_DEFAULT;
329329

330330
// Serialize the struct to a JSON document
331331
JsonDocument doc;
@@ -452,6 +452,12 @@ void Wippersnapper_FS::parseSecrets() {
452452
"credentials!");
453453
}
454454

455+
// specify type of value for json key, by using the |operator to include
456+
// a typed default value equivalent of with .as<float> w/ default value
457+
// https://arduinojson.org/v7/api/jsonvariant/or/
458+
WS._config.status_pixel_brightness =
459+
doc["status_pixel_brightness"] | (float)STATUS_PIXEL_BRIGHTNESS_DEFAULT;
460+
455461
// Close secrets.json file
456462
secretsFile.close();
457463
}

0 commit comments

Comments
 (0)