diff --git a/platformio.ini b/platformio.ini index 518b64d..c027290 100644 --- a/platformio.ini +++ b/platformio.ini @@ -29,24 +29,7 @@ lib_deps = https://github.com/me-no-dev/ESPAsyncWebServer.git https://github.com/tzapu/WiFiManager.git#v2.0.16-rc.2 -[env:esp32doit-devkit-v1] -board = esp32doit-devkit-v1 -board_build.partitions = partition.csv -build_flags = - -D IS_BW - -D NO_MCP - -D CONFIG_FREERTOS_USE_TRACE_FACILITY - -D ASYNCWEBSERVER_REGEX - -D CONFIG_ASYNC_TCP_PRIORITY=500 - -[env:esp32doit-devkit-v1_3C] -board = esp32doit-devkit-v1 -board_build.partitions = partition.csv -build_flags = - -D IS_3C - -D CONFIG_FREERTOS_USE_TRACE_FACILITY - -[env:esp32wemos-s3-mini_BW] +[esp32wemos-s3-mini_BW_base] platform = espressif32 framework = arduino board = lolin_s3_mini @@ -65,43 +48,14 @@ build_flags = -D HOSTNAME="\"btclock3\"" -mfix-esp32-psram-cache-issue -[env:esp32wemos-s3-mini_3C] -platform = espressif32 -framework = arduino -board = lolin_s3_mini -board_build.partitions = partition.csv +[env:esp32wemos-s3-mini_BW] +extends = esp32wemos-s3-mini_BW_base build_flags = - -D NO_DISPLAY - -D IS_3C - -D IS_S3 - -D CONFIG_FREERTOS_USE_TRACE_FACILITY - -D WITH_RGB_LED - -D NEOPIXEL_COUNT=4 - -D WITH_BUTTONS - -DASYNCWEBSERVER_REGEX - -D HOSTNAME="\"btclock3c\"" - -D CONFIG_ASYNC_TCP_PRIORITY=500 + ${esp32wemos-s3-mini_BW_base.build_flags} + -D NUM_SCREENS=7 -[env:esp32doit-devkit-v1_nodisp] -board = esp32doit-devkit-v1 -board_build.partitions = partition.csv +[env:esp32wemos-s3-mini_BW_9disp] +extends = esp32wemos-s3-mini_BW_base build_flags = - -D NO_DISPLAY - -D CONFIG_FREERTOS_USE_TRACE_FACILITY - -[env:esp32_s3_devkit] -platform = espressif32 -board = esp32-s3-devkitc-1 -board_build.partitions = partition.csv -;upload_protocol = esp-builtin -build_flags = - -D NO_DISPLAY - -D NO_MCP - -D IS_BW - -D WITH_RGB_LED - -D NEOPIXEL_COUNT=1 - -D NEOPIXEL_PIN=38 - -D CONFIG_ASYNC_TCP_PRIORITY=500 - -DASYNCWEBSERVER_REGEX - -D HOSTNAME="\"btclocks3d\"" - + ${esp32wemos-s3-mini_BW_base.build_flags} + -D NUM_SCREENS=9 diff --git a/src/config.h b/src/config.h index 969f86c..e162a17 100644 --- a/src/config.h +++ b/src/config.h @@ -24,6 +24,4 @@ #define USER_AGENT "BTClock/1.0" -#define NUM_SCREENS 7 - #define I2C_DEV_ADDR 0x55 \ No newline at end of file diff --git a/src/main.cpp b/src/main.cpp index 029006b..9fea0ce 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -3,7 +3,6 @@ #include #include #include -// #include #include #ifdef CONFIG_BT_ENABLED @@ -18,7 +17,6 @@ #include "screens/blockheight.hpp" #include "screens/ticker.hpp" #include "screens/time.hpp" -//#include "screens/sats_per_dollar.hpp" #include "screens/halvingcountdown.hpp" #include "tasks/ha.hpp" diff --git a/src/tasks/epd.cpp b/src/tasks/epd.cpp index e67680a..1db30b4 100644 --- a/src/tasks/epd.cpp +++ b/src/tasks/epd.cpp @@ -1,56 +1,11 @@ #include "epd.hpp" #ifdef IS_S3 - -// GxEPD2_BW displays[NUM_SCREENS] = { -// GxEPD2_213_B74(&Native_Pin(EPD_CS[0]), &Native_Pin(EPD_DC), &MCP23X17_Pin(mcp, EPD_RESET_MPD[0]), &Native_Pin(EPD_BUSY[0])), -// GxEPD2_213_B74(&Native_Pin(EPD_CS[1]), &Native_Pin(EPD_DC), &MCP23X17_Pin(mcp, EPD_RESET_MPD[1]), &Native_Pin(EPD_BUSY[1])), -// GxEPD2_213_B74(&Native_Pin(EPD_CS[2]), &Native_Pin(EPD_DC), &MCP23X17_Pin(mcp, EPD_RESET_MPD[2]), &Native_Pin(EPD_BUSY[2])), -// GxEPD2_213_B74(&Native_Pin(EPD_CS[3]), &Native_Pin(EPD_DC), &MCP23X17_Pin(mcp, EPD_RESET_MPD[3]), &Native_Pin(EPD_BUSY[3])), -// GxEPD2_213_B74(&Native_Pin(EPD_CS[4]), &Native_Pin(EPD_DC), &MCP23X17_Pin(mcp, EPD_RESET_MPD[4]), &Native_Pin(EPD_BUSY[4])), -// GxEPD2_213_B74(&Native_Pin(EPD_CS[5]), &Native_Pin(EPD_DC), &MCP23X17_Pin(mcp, EPD_RESET_MPD[5]), &Native_Pin(EPD_BUSY[5])), -// GxEPD2_213_B74(&Native_Pin(EPD_CS[6]), &Native_Pin(EPD_DC), &MCP23X17_Pin(mcp, EPD_RESET_MPD[6]), &Native_Pin(EPD_BUSY[6])), -// }; - Native_Pin EPD_CS[NUM_SCREENS] = {Native_Pin(2), Native_Pin(4), Native_Pin(6), Native_Pin(10), Native_Pin(33), Native_Pin(21), Native_Pin(17)}; Native_Pin EPD_BUSY[NUM_SCREENS] = {Native_Pin(3), Native_Pin(5), Native_Pin(7), Native_Pin(9), Native_Pin(37), Native_Pin(18), Native_Pin(16)}; MCP23X17_Pin EPD_RESET_MPD[NUM_SCREENS] = {MCP23X17_Pin(mcp, 8), MCP23X17_Pin(mcp, 9), MCP23X17_Pin(mcp, 10), MCP23X17_Pin(mcp, 11), MCP23X17_Pin(mcp, 12), MCP23X17_Pin(mcp, 13), MCP23X17_Pin(mcp, 14)}; Native_Pin EPD_DC = Native_Pin(14); -// const char RST_PIN = 15; -#elif defined(IS_S2) - -// reversed -const int EPD_CS[7] = {17, 21, 33, 10, 6, 4, 2}; -const int EPD_BUSY[7] = {16, 18, 37, 9, 7, 5, 3}; -const int EPD_RESET_MPD[7] = {14, 13, 12, 11, 10, 9, 8}; - -// const int EPD_CS[7] = {1, 4, 6, 8, 10, 13, 40}; -// const int EPD_BUSY[7] = {3, 5, 7, 9, 11, 12, 39}; -const int EPD_DC = 14; -const int RST_PIN = 15; - -#elif defined(ARDUINO_ESP32S3_DEV) -const int EPD_CS[7] = {40, 39, 9, 10, 3, 8, 18}; -const int EPD_BUSY[7] = {4, 5, 6, 7, 15, 16, 17}; -const int EPD_RESET_MPD[7] = {8, 9, 10, 11, 12, 13, 14}; - -const int EPD_DC = 1; -const int RST_PIN = 2; - -#else -const int EPD_CS[7] = {21, 13, 5, 17, 4, 2, 15}; -const int EPD_BUSY[7] = {36, 39, 34, 35, 32, 33, 25}; - -// const int EPD_CS[7] = {4, 14, 5, 17, 16, 4, 15}; -// const int EPD_BUSY[7] = {5, 27, 34, 35, 32, 33, 25}; -const int EPD_RESET_MPD[7] = {8, 9, 10, 11, 12, 13, 14}; - -const int EPD_DC = 22; -const int RST_PIN = 2; -#endif - -#ifdef IS_BW GxEPD2_BW displays[NUM_SCREENS] = { GxEPD2_213_B74(&EPD_CS[0], &EPD_DC, &EPD_RESET_MPD[0], &EPD_BUSY[0]), @@ -62,23 +17,7 @@ GxEPD2_BW displays[NUM_SCREENS] = { GxEPD2_213_B74(&EPD_CS[6], &EPD_DC, &EPD_RESET_MPD[6], &EPD_BUSY[6]), }; -// GxEPD2_BW * displays2 = (GxEPD2_BW *) ps_malloc(7 * sizeof (GxEPD2_BW)); - const int SEM_WAIT_TIME = 10000; - -#else -GxEPD2_3C displays[7] = { - GxEPD2_213_Z98c(EPD_CS[0], EPD_DC, /*RST=*/-1, EPD_BUSY[0]), - GxEPD2_213_Z98c(EPD_CS[1], EPD_DC, /*RST=*/-1, EPD_BUSY[1]), - GxEPD2_213_Z98c(EPD_CS[2], EPD_DC, /*RST=*/-1, EPD_BUSY[2]), - GxEPD2_213_Z98c(EPD_CS[3], EPD_DC, /*RST=*/-1, EPD_BUSY[3]), - GxEPD2_213_Z98c(EPD_CS[4], EPD_DC, /*RST=*/-1, EPD_BUSY[4]), - GxEPD2_213_Z98c(EPD_CS[5], EPD_DC, /*RST=*/-1, EPD_BUSY[5]), - GxEPD2_213_Z98c(EPD_CS[6], EPD_DC, /*RST=*/-1, EPD_BUSY[6]), -}; - -const int SEM_WAIT_TIME = 30000; - #endif uint32_t lastFullRefresh[NUM_SCREENS]; @@ -87,9 +26,6 @@ std::array currentEpdContent; std::array epdContent; TaskHandle_t tasks[NUM_SCREENS]; SemaphoreHandle_t epdUpdateSemaphore[NUM_SCREENS]; -// - -// int *qrcode = (int *) ps_malloc(qrcodegen_BUFFER_LEN_MAX * sizeof(uint8_t)); void setupDisplays() { @@ -278,7 +214,7 @@ void updateDisplay(void *pvParameters) { currentEpdContent[epdIndex] = epdContent[epdIndex]; - // displays[epdIndex].init(0, false); + displays[epdIndex].init(0, false, 20); // Little longer reset duration because of MCP bool updatePartial = true; // Full Refresh every half hour