mirror of
https://github.com/btclock/btclock_v3.git
synced 2024-11-19 04:20:01 +01:00
Add functionality to disable all LEDs
This commit is contained in:
parent
969d2137c3
commit
3e00f1b4a6
2
data
2
data
@ -1 +1 @@
|
||||
Subproject commit 1b8ab93da64dd7383a2fb34c967b75fdab072718
|
||||
Subproject commit dcdf98964a42ccd83b2d2501bbed46a640bbc300
|
@ -1,11 +1,11 @@
|
||||
#include "data_handler.hpp"
|
||||
|
||||
std::array<std::string, NUM_SCREENS> parsePriceData(std::uint32_t price, char currencySymbol)
|
||||
std::array<std::string, NUM_SCREENS> parsePriceData(std::uint32_t price, char currencySymbol, bool useSuffixFormat)
|
||||
{
|
||||
std::array<std::string, NUM_SCREENS> 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);
|
||||
}
|
||||
|
@ -5,7 +5,7 @@
|
||||
|
||||
#include "utils.hpp"
|
||||
|
||||
std::array<std::string, NUM_SCREENS> parsePriceData(std::uint32_t price, char currencySymbol);
|
||||
std::array<std::string, NUM_SCREENS> parsePriceData(std::uint32_t price, char currencySymbol, bool useSuffixFormat = false);
|
||||
std::array<std::string, NUM_SCREENS> parseSatsPerCurrency(std::uint32_t price, char currencySymbol, bool withSatsSymbol);
|
||||
std::array<std::string, NUM_SCREENS> parseBlockHeight(std::uint32_t blockHeight);
|
||||
std::array<std::string, NUM_SCREENS> parseHalvingCountdown(std::uint32_t blockHeight, bool asBlocks);
|
||||
|
@ -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
|
||||
|
@ -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 {
|
||||
|
@ -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();
|
||||
|
Loading…
Reference in New Issue
Block a user