diff --git a/data b/data index 1b8ab93..dcdf989 160000 --- a/data +++ b/data @@ -1 +1 @@ -Subproject commit 1b8ab93da64dd7383a2fb34c967b75fdab072718 +Subproject commit dcdf98964a42ccd83b2d2501bbed46a640bbc300 diff --git a/lib/btclock/data_handler.cpp b/lib/btclock/data_handler.cpp index fc5f4e8..764417f 100644 --- a/lib/btclock/data_handler.cpp +++ b/lib/btclock/data_handler.cpp @@ -1,11 +1,11 @@ #include "data_handler.hpp" -std::array parsePriceData(std::uint32_t price, char currencySymbol) +std::array parsePriceData(std::uint32_t price, char currencySymbol, bool useSuffixFormat) { std::array ret; std::string priceString; - if (std::to_string(price).length() >= NUM_SCREENS) { - priceString = formatNumberWithSuffix(price, NUM_SCREENS-2); + if (std::to_string(price).length() >= NUM_SCREENS || useSuffixFormat) { + priceString = currencySymbol + formatNumberWithSuffix(price, NUM_SCREENS-2); } else { priceString = currencySymbol + std::to_string(price); } diff --git a/lib/btclock/data_handler.hpp b/lib/btclock/data_handler.hpp index 1531c96..b31cfe7 100644 --- a/lib/btclock/data_handler.hpp +++ b/lib/btclock/data_handler.hpp @@ -5,7 +5,7 @@ #include "utils.hpp" -std::array parsePriceData(std::uint32_t price, char currencySymbol); +std::array parsePriceData(std::uint32_t price, char currencySymbol, bool useSuffixFormat = false); std::array parseSatsPerCurrency(std::uint32_t price, char currencySymbol, bool withSatsSymbol); std::array parseBlockHeight(std::uint32_t blockHeight); std::array parseHalvingCountdown(std::uint32_t blockHeight, bool asBlocks); diff --git a/src/lib/led_handler.cpp b/src/lib/led_handler.cpp index 56b9b69..a809e75 100644 --- a/src/lib/led_handler.cpp +++ b/src/lib/led_handler.cpp @@ -10,6 +10,11 @@ void ledTask(void *parameter) { if (ledTaskQueue != NULL) { if (xQueueReceive(ledTaskQueue, &ledTaskParams, portMAX_DELAY) == pdPASS) { + + if (preferences.getBool("disableLeds", false)) { + continue; + } + uint32_t oldLights[NEOPIXEL_COUNT]; // get current state diff --git a/src/lib/screen_handler.cpp b/src/lib/screen_handler.cpp index 7007d11..d1215f6 100644 --- a/src/lib/screen_handler.cpp +++ b/src/lib/screen_handler.cpp @@ -34,7 +34,7 @@ void workerTask(void *pvParameters) { priceSymbol = '['; } if (getCurrentScreen() == SCREEN_BTC_TICKER) { - taskEpdContent = parsePriceData(price, priceSymbol); + taskEpdContent = parsePriceData(price, priceSymbol, preferences.getBool("suffixPrice", false)); } else if (getCurrentScreen() == SCREEN_MSCW_TIME) { taskEpdContent = parseSatsPerCurrency(price, priceSymbol, preferences.getBool("useSatsSymbol", false)); } else { diff --git a/src/lib/webserver.cpp b/src/lib/webserver.cpp index eded90f..6255416 100644 --- a/src/lib/webserver.cpp +++ b/src/lib/webserver.cpp @@ -320,7 +320,8 @@ void onApiSettingsPatch(AsyncWebServerRequest *request, JsonVariant &json) { String boolSettings[] = {"fetchEurPrice", "ledTestOnPower", "ledFlashOnUpd", "mdnsEnabled", "otaEnabled", "stealFocus", - "mcapBigChar", "useSatsSymbol", "useBlkCountdown"}; + "mcapBigChar", "useSatsSymbol", "useBlkCountdown", + "suffixPrice", "disableLeds"}; for (String setting : boolSettings) { if (settings.containsKey(setting)) { @@ -409,6 +410,8 @@ void onApiSettingsGet(AsyncWebServerRequest *request) { root["fetchEurPrice"] = preferences.getBool("fetchEurPrice", false); root["useSatsSymbol"] = preferences.getBool("useSatsSymbol", false); root["useBlkCountdown"] = preferences.getBool("useBlkCountdown", false); + root["suffixPrice"] = preferences.getBool("suffixPrice", false); + root["disableLeds"] = preferences.getBool("disableLeds", false); root["hostnamePrefix"] = preferences.getString("hostnamePrefix", "btclock"); root["hostname"] = getMyHostname();