diff --git a/.github/workflows/tagging.yml b/.github/workflows/tagging.yml index 82fb7a0..a7e1035 100644 --- a/.github/workflows/tagging.yml +++ b/.github/workflows/tagging.yml @@ -22,8 +22,9 @@ jobs: - name: Upload artifacts uses: actions/upload-artifact@v4 with: + retention-days: 1 name: build-outputs - path: .pio + path: .pio/**/*.bin build: needs: prepare @@ -48,7 +49,7 @@ jobs: - name: Install esptools.py run: pip install --upgrade esptool - name: Create merged firmware binary - run: mkdir -p ${{ matrix.chip.name }}_${{ matrix.epd_variant }} && esptool.py --chip ${{ matrix.chip.version }} merge_bin -o ${{ matrix.chip.name }}_${{ matrix.epd_variant }}/${{ matrix.chip.name }}_${{ matrix.epd_variant }}.bin --flash_mode dio 0x0000 .pio/build/${{ matrix.chip.name }}_${{ matrix.epd_variant }}/bootloader.bin 0x8000 .pio/build/${{ matrix.chip.name }}_${{ matrix.epd_variant }}/partitions.bin 0xe000 ~/.pio/boot_app0.bin 0x10000 .pio/build/${{ matrix.chip.name }}_${{ matrix.epd_variant }}/firmware.bin 0x369000 .pio/build/${{ matrix.chip.name }}_${{ matrix.epd_variant }}/littlefs.bin + run: mkdir -p ${{ matrix.chip.name }}_${{ matrix.epd_variant }} && esptool.py --chip ${{ matrix.chip.version }} merge_bin -o ${{ matrix.chip.name }}_${{ matrix.epd_variant }}/${{ matrix.chip.name }}_${{ matrix.epd_variant }}.bin --flash_mode dio 0x0000 .pio/build/${{ matrix.chip.name }}_${{ matrix.epd_variant }}/bootloader.bin 0x8000 .pio/build/${{ matrix.chip.name }}_${{ matrix.epd_variant }}/partitions.bin 0xe000 .pio/boot_app0.bin 0x10000 .pio/build/${{ matrix.chip.name }}_${{ matrix.epd_variant }}/firmware.bin 0x369000 .pio/build/${{ matrix.chip.name }}_${{ matrix.epd_variant }}/littlefs.bin - name: Create checksum for merged binary run: shasum -a 256 ${{ matrix.chip.name }}_${{ matrix.epd_variant }}/${{ matrix.chip.name }}_${{ matrix.epd_variant }}.bin | awk '{print $1}' > ${{ matrix.chip.name }}_${{ matrix.epd_variant }}/${{ matrix.chip.name }}_${{ matrix.epd_variant }}.sha256 diff --git a/src/webserver.cpp b/src/webserver.cpp index 7d31f7f..590b1bf 100644 --- a/src/webserver.cpp +++ b/src/webserver.cpp @@ -2,7 +2,9 @@ #include AsyncWebServer server(80); -String uintSettings[] = {SETTING_ROW1_CONTENT, SETTING_ROW2_CONTENT, SETTING_ROW3_CONTENT}; +const String uintSettings[] = {SETTING_ROW1_CONTENT, SETTING_ROW2_CONTENT, SETTING_ROW3_CONTENT}; +const String stringSettings[] = {SETTING_CURRENCY}; +const String boolSettings[] = {}; void setupWebserver() { @@ -36,6 +38,16 @@ void onApiSettingsGet(AsyncWebServerRequest *request) root[setting] = preferences.getUInt(setting.c_str()); } + for (String setting : stringSettings) + { + root[setting] = preferences.getString(setting.c_str()); + } + + for (String setting : boolSettings) + { + root[setting] = preferences.getBool(setting.c_str()); + } + AsyncResponseStream *response = request->beginResponseStream("application/json"); serializeJson(root, *response); @@ -57,6 +69,26 @@ void onApiSettingsPatch(AsyncWebServerRequest *request, JsonVariant &json) } } + for (String setting : stringSettings) + { + if (settings.containsKey(setting)) + { + preferences.putString(setting.c_str(), settings[setting].as()); + Serial.printf("Setting %s to %s\r\n", setting.c_str(), + settings[setting].as()); + } + } + + for (String setting : boolSettings) + { + if (settings.containsKey(setting)) + { + preferences.putBool(setting.c_str(), settings[setting].as()); + Serial.printf("Setting %s to %d\r\n", setting.c_str(), + settings[setting].as()); + } + } + request->send(200); }