diff --git a/platformio.ini b/platformio.ini index 6b3ca84..0cfd3b5 100644 --- a/platformio.ini +++ b/platformio.ini @@ -55,7 +55,7 @@ build_flags = -DLAST_BUILD_TIME=$UNIX_TIME -D IS_S3 -D IS_BW - -D CONFIG_FREERTOS_USE_TRACE_FACILITY +# -D CONFIG_FREERTOS_USE_TRACE_FACILITY -D WITH_RGB_LED -D NEOPIXEL_COUNT=4 -DASYNCWEBSERVER_REGEX diff --git a/src/shared.hpp b/src/shared.hpp index 6f9143d..ae4b845 100644 --- a/src/shared.hpp +++ b/src/shared.hpp @@ -41,13 +41,13 @@ extern Adafruit_NeoPixel pixels; #endif extern std::map screenNameMap; -const int SCREEN_BLOCK_HEIGHT = 0; -const int SCREEN_MSCW_TIME = 1; -const int SCREEN_BTC_TICKER = 2; -const int SCREEN_TIME = 3; -const int SCREEN_HALVING_COUNTDOWN = 4; -const int SCREEN_COUNTDOWN = 98; -const int SCREEN_CUSTOM = 99; -const int screens[5] = { SCREEN_BLOCK_HEIGHT, SCREEN_MSCW_TIME, SCREEN_BTC_TICKER, SCREEN_TIME, SCREEN_HALVING_COUNTDOWN }; +const PROGMEM int SCREEN_BLOCK_HEIGHT = 0; +const PROGMEM int SCREEN_MSCW_TIME = 1; +const PROGMEM int SCREEN_BTC_TICKER = 2; +const PROGMEM int SCREEN_TIME = 3; +const PROGMEM int SCREEN_HALVING_COUNTDOWN = 4; +const PROGMEM int SCREEN_COUNTDOWN = 98; +const PROGMEM int SCREEN_CUSTOM = 99; +const PROGMEM int screens[5] = { SCREEN_BLOCK_HEIGHT, SCREEN_MSCW_TIME, SCREEN_BTC_TICKER, SCREEN_TIME, SCREEN_HALVING_COUNTDOWN }; const uint screenCount = sizeof(screens) / sizeof(int); \ No newline at end of file diff --git a/src/tasks/blocknotify.cpp b/src/tasks/blocknotify.cpp index 54caca3..7b11418 100644 --- a/src/tasks/blocknotify.cpp +++ b/src/tasks/blocknotify.cpp @@ -37,8 +37,7 @@ void checkBitcoinBlock(void *pvParameters) http.addHeader("User-Agent", "BTClock/1.0"); String payload = "{\"jsonrpc\":\"1.0\",\"id\":\"current_block_height\",\"method\":\"getblockcount\",\"params\":[]}"; - String auth = preferences.getString("rpcUser", BITCOIND_RPC_USER) + ":" + preferences.getString("rpcPass", BITCOIND_RPC_PASS); - String authEncoded = base64::encode(auth); + String authEncoded = base64::encode(preferences.getString("rpcUser", BITCOIND_RPC_USER) + ":" + preferences.getString("rpcPass", BITCOIND_RPC_PASS)); http.addHeader("Authorization", "Basic " + authEncoded); int httpCode = http.POST(payload); @@ -68,7 +67,8 @@ void checkBitcoinBlock(void *pvParameters) } else { - Serial.println("Error in HTTP request to mempool API"); + Serial.print(F("Error in HTTP request to mempool API: ")); + Serial.println(http.errorToString(httpCode)); } http.end(); diff --git a/src/tasks/epd.cpp b/src/tasks/epd.cpp index 4ca9b0c..0abb996 100644 --- a/src/tasks/epd.cpp +++ b/src/tasks/epd.cpp @@ -217,7 +217,6 @@ void taskEpd(void *pvParameters) if (updatedThisCycle && preferences.getBool("ledFlashOnUpd", false)) { xTaskNotifyGive(ledHandlerTaskHandle); - Serial.println("Flash leds"); } #endif diff --git a/src/tasks/get_price.cpp b/src/tasks/get_price.cpp index ce4efcf..63d9f15 100644 --- a/src/tasks/get_price.cpp +++ b/src/tasks/get_price.cpp @@ -1,6 +1,6 @@ #include "get_price.hpp" -const char *apiUrl = "https://api.coindesk.com/v1/bpi/currentprice/USD.json"; +const PROGMEM char *apiUrl = "https://api.coindesk.com/v1/bpi/currentprice/USD.json"; std::vector priceEventCallbacks; // Define a vector to hold multiple event callbacks TaskHandle_t getPriceTaskHandle; @@ -41,7 +41,7 @@ void taskGetPrice(void *pvParameters) } else { - Serial.print("Error retrieving BTC/USD price. HTTP status code: "); + Serial.print(F("Error retrieving BTC/USD price. HTTP status code: ")); Serial.println(httpCode); } diff --git a/src/tasks/led_handler.cpp b/src/tasks/led_handler.cpp index 0cf911a..e0f3598 100644 --- a/src/tasks/led_handler.cpp +++ b/src/tasks/led_handler.cpp @@ -5,8 +5,8 @@ TaskHandle_t ledHandlerTaskHandle = NULL; void ledHandlerTask(void *parameter) { - int dir = 5; - int bright = 0; + const int dir = 5; + const int bright = 0; while (1) { ulTaskNotifyTake(pdTRUE, portMAX_DELAY);