diff options
| author | Kouzerumatsu / Bananafox <46141631+Kouzeru@users.noreply.github.com> | 2023-02-08 22:37:12 +0800 |
|---|---|---|
| committer | Kouzerumatsu / Bananafox <46141631+Kouzeru@users.noreply.github.com> | 2023-02-08 22:37:12 +0800 |
| commit | d87ffe3be4121f2cc9c2aafaef62c2a51c160aa8 (patch) | |
| tree | 447a8c8fdd0fbe343c7ab7a17bb07a77fc8be18f /examples | |
| parent | 79e1897aed951e37ee14665b2e13d9c172c8cfaf (diff) | |
| parent | 859a25079944769bdf6a6bf1bc2f7b0db8111a5a (diff) | |
Merge branch 'master' of https://github.com/Kouzeru/ESP32-HUB75-MatrixPanel-DMA
Diffstat (limited to 'examples')
| -rw-r--r-- | examples/Four_Scan_Panel/Four_Scan_Panel.ino (renamed from examples/One_Eight_1_8_ScanPanel/One_Eight_1_8_ScanPanel.ino) | 40 | ||||
| -rw-r--r-- | examples/Four_Scan_Panel/README.md (renamed from examples/One_Eight_1_8_ScanPanel/README.md) | 2 | ||||
| -rw-r--r-- | examples/PIO_TestPatterns/platformio.ini | 81 | ||||
| -rw-r--r-- | examples/PIO_TestPatterns/sdkconfig.defaults | 3 | ||||
| -rw-r--r-- | examples/PIO_TestPatterns/src/main.cpp | 12 |
5 files changed, 37 insertions, 101 deletions
diff --git a/examples/One_Eight_1_8_ScanPanel/One_Eight_1_8_ScanPanel.ino b/examples/Four_Scan_Panel/Four_Scan_Panel.ino index d44bb76..856d7e5 100644 --- a/examples/One_Eight_1_8_ScanPanel/One_Eight_1_8_ScanPanel.ino +++ b/examples/Four_Scan_Panel/Four_Scan_Panel.ino @@ -2,12 +2,14 @@ * Description: * * The underlying implementation of the ESP32-HUB75-MatrixPanel-I2S-DMA only - * supports output to 1/16 or 1/32 scan panels - which means outputting - * two lines at the same time, 16 or 32 rows apart. This cannot be changed - * at the DMA layer as it would require a messy and complex rebuild of the - * library's DMA internals. + * supports output to HALF scan panels - which means outputting + * two lines at the same time, 16 or 32 rows apart if a 32px or 64px high panel + * respectively. + * This cannot be changed at the DMA layer as it would require a messy and complex + * rebuild of the library's internals. * - * However, it is possible to connect 1/8 scan panels to this same library and + * However, it is possible to connect QUARTER (i.e. FOUR lines updated in parallel) + * scan panels to this same library and * 'trick' the output to work correctly on these panels by way of adjusting the * pixel co-ordinates that are 'sent' to the ESP32-HUB75-MatrixPanel-I2S-DMA * library. @@ -39,7 +41,7 @@ MatrixPanel_I2S_DMA *dma_display = nullptr; // placeholder for the virtual display object - VirtualMatrixPanel *OneEightMatrixDisplay = nullptr; + VirtualMatrixPanel *FourScanPanel = nullptr; /****************************************************************************** * Setup! @@ -88,11 +90,11 @@ dma_display->clearScreen(); delay(500); - // create OneEightMatrixDisplaylay object based on our newly created dma_display object - OneEightMatrixDisplay = new VirtualMatrixPanel((*dma_display), NUM_ROWS, NUM_COLS, PANEL_RES_X, PANEL_RES_Y, SERPENT, TOPDOWN); + // create FourScanPanellay object based on our newly created dma_display object + FourScanPanel = new VirtualMatrixPanel((*dma_display), NUM_ROWS, NUM_COLS, PANEL_RES_X, PANEL_RES_Y, SERPENT, TOPDOWN); // THE IMPORTANT BIT BELOW! - OneEightMatrixDisplay->setPhysicalPanelScanRate(ONE_EIGHT_32); + FourScanPanel->setPhysicalPanelScanRate(FOUR_SCAN_32PX_HIGH); } @@ -111,7 +113,7 @@ // Try again using the pixel / dma memory remapper for (int i=PANEL_RES_X+5; i< (PANEL_RES_X*2)-1; i++) { - OneEightMatrixDisplay->drawLine(i, 0, i, 7, dma_display->color565(0, 0, 255)); // blue + FourScanPanel->drawLine(i, 0, i, 7, dma_display->color565(0, 0, 255)); // blue delay(10); } */ @@ -120,10 +122,10 @@ int offset = PANEL_RES_X*((NUM_ROWS*NUM_COLS)-1); for (int i=0; i< PANEL_RES_X; i++) { - OneEightMatrixDisplay->drawLine(i+offset, 0, i+offset, 7, dma_display->color565(0, 0, 255)); // blue - OneEightMatrixDisplay->drawLine(i+offset, 8, i+offset, 15, dma_display->color565(0, 128,0)); // g - OneEightMatrixDisplay->drawLine(i+offset, 16, i+offset, 23, dma_display->color565(128, 0,0)); // red - OneEightMatrixDisplay->drawLine(i+offset, 24, i+offset, 31, dma_display->color565(0, 128, 128)); // blue + FourScanPanel->drawLine(i+offset, 0, i+offset, 7, dma_display->color565(0, 0, 255)); // blue + FourScanPanel->drawLine(i+offset, 8, i+offset, 15, dma_display->color565(0, 128,0)); // g + FourScanPanel->drawLine(i+offset, 16, i+offset, 23, dma_display->color565(128, 0,0)); // red + FourScanPanel->drawLine(i+offset, 24, i+offset, 31, dma_display->color565(0, 128, 128)); // blue delay(10); } @@ -134,15 +136,15 @@ // This only really works for a single horizontal chain for (int i = 0; i < NUM_ROWS*NUM_COLS; i++) { - OneEightMatrixDisplay->setTextColor(OneEightMatrixDisplay->color565(255, 255, 255)); - OneEightMatrixDisplay->setCursor(i*PANEL_RES_X+7, OneEightMatrixDisplay->height()/3); + FourScanPanel->setTextColor(FourScanPanel->color565(255, 255, 255)); + FourScanPanel->setCursor(i*PANEL_RES_X+7, FourScanPanel->height()/3); // Red text inside red rect (2 pix in from edge) - OneEightMatrixDisplay->print("Panel " + String(i+1)); - OneEightMatrixDisplay->drawRect(1,1, OneEightMatrixDisplay->width()-2, OneEightMatrixDisplay->height()-2, OneEightMatrixDisplay->color565(255,0,0)); + FourScanPanel->print("Panel " + String(i+1)); + FourScanPanel->drawRect(1,1, FourScanPanel->width()-2, FourScanPanel->height()-2, FourScanPanel->color565(255,0,0)); // White line from top left to bottom right - OneEightMatrixDisplay->drawLine(0,0, OneEightMatrixDisplay->width()-1, OneEightMatrixDisplay->height()-1, OneEightMatrixDisplay->color565(255,255,255)); + FourScanPanel->drawLine(0,0, FourScanPanel->width()-1, FourScanPanel->height()-1, FourScanPanel->color565(255,255,255)); } delay(2000); diff --git a/examples/One_Eight_1_8_ScanPanel/README.md b/examples/Four_Scan_Panel/README.md index 2fd55b9..7df7617 100644 --- a/examples/One_Eight_1_8_ScanPanel/README.md +++ b/examples/Four_Scan_Panel/README.md @@ -1,7 +1,7 @@ # Using this library with 32x16 1/8 Scan Panels ## Problem -ESP32-HUB75-MatrixPanel-I2S-DMA library will not display output correctly with 1/8 scan panels such [as this](https://github.com/mrfaptastic/ESP32-HUB75-MatrixPanel-I2S-DMA/issues/154) by default. +ESP32-HUB75-MatrixPanel-I2S-DMA library will not display output correctly with 'Four Scan' or 1/8 scan panels such [as this](https://github.com/mrfaptastic/ESP32-HUB75-MatrixPanel-I2S-DMA/issues/154) by default. ## Solution It is possible to connect 1/8 scan panels to this library and 'trick' the output to work correctly on these panels by way of adjusting the pixel co-ordinates that are 'sent' to the underlying ESP32-HUB75-MatrixPanel-I2S-DMA library (in this example, it is the 'dmaOutput' class). diff --git a/examples/PIO_TestPatterns/platformio.ini b/examples/PIO_TestPatterns/platformio.ini index 3505b2d..185513a 100644 --- a/examples/PIO_TestPatterns/platformio.ini +++ b/examples/PIO_TestPatterns/platformio.ini @@ -1,90 +1,23 @@ [platformio] -;default_envs = esp32 +default_envs = esp32 description = HUB75 ESP32 I2S DMA test patterns example ;src_dir = src [env] -framework = arduino platform = espressif32 board = wemos_d1_mini32 lib_deps = fastled/FastLED + Wire + adafruit/Adafruit BusIO + adafruit/Adafruit GFX Library https://github.com/mrfaptastic/ESP32-HUB75-MatrixPanel-I2S-DMA.git -build_flags = upload_speed = 460800 monitor_speed = 115200 monitor_filters = esp32_exception_decoder [env:esp32] -build_flags = - ${env.build_flags} - -DTEST_FASTLINES -lib_deps = - ${env.lib_deps} - Wire - adafruit/Adafruit BusIO - adafruit/Adafruit GFX Library - -[env:debug] -build_flags = - ${env.build_flags} - -DTEST_FASTLINES - -DSERIAL_DEBUG -lib_deps = - ${env.lib_deps} - Wire - adafruit/Adafruit BusIO - adafruit/Adafruit GFX Library - -; build without GFX functions -[env:minimal] -build_flags = - ${env.build_flags} - -DNO_GFX - -DNO_FAST_FUNCTIONS - -DNO_CIE1931 -lib_deps = - ${env.lib_deps} - -; Virtual Panel test -[env:vpane] -build_flags = - ${env.build_flags} - -DNO_FAST_FUNCTIONS - -DVIRTUAL_PANE -lib_deps = - ${env.lib_deps} - Wire - adafruit/Adafruit BusIO - adafruit/Adafruit GFX Library - -; Virtual Panel test -[env:vpane_minimal] -build_flags = - ${env.build_flags} - -DVIRTUAL_PANE - -DNO_GFX - -DNO_FAST_FUNCTIONS - -DNO_CIE1931 -lib_deps = - ${env.lib_deps} - Wire - adafruit/Adafruit BusIO - adafruit/Adafruit GFX Library +framework = arduino -; PIO CI can't handle IDF git modules properly (yet) -;[env:idfarduino] -;platform = espressif32 -;platform_packages = -; ; use a special branch -; framework-arduinoespressif32 @ https://github.com/espressif/arduino-esp32.git#idf-release/v4.4 -;framework = arduino, espidf -;build_flags = -; ${env.build_flags} -; -DARDUINO=200 -; -DESP32 -; ;-DUSE_FASTLINES -; -DNO_GFX -;lib_deps = -; ${env.lib_deps} -; https://github.com/mrfaptastic/ESP32-HUB75-MatrixPanel-I2S-DMA.git +[env:esp32idf] +framework = arduino, espidf diff --git a/examples/PIO_TestPatterns/sdkconfig.defaults b/examples/PIO_TestPatterns/sdkconfig.defaults index 909461e..ee16cd3 100644 --- a/examples/PIO_TestPatterns/sdkconfig.defaults +++ b/examples/PIO_TestPatterns/sdkconfig.defaults @@ -15,4 +15,5 @@ CONFIG_ARDUHAL_PARTITION_SCHEME="default" CONFIG_AUTOCONNECT_WIFI=y CONFIG_ARDUINO_SELECTIVE_WiFi=y CONFIG_MBEDTLS_PSK_MODES=y -CONFIG_MBEDTLS_KEY_EXCHANGE_PSK=y
\ No newline at end of file +CONFIG_MBEDTLS_KEY_EXCHANGE_PSK=y +CONFIG_FREERTOS_HZ=1000
\ No newline at end of file diff --git a/examples/PIO_TestPatterns/src/main.cpp b/examples/PIO_TestPatterns/src/main.cpp index 6325b63..40d077e 100644 --- a/examples/PIO_TestPatterns/src/main.cpp +++ b/examples/PIO_TestPatterns/src/main.cpp @@ -1,14 +1,14 @@ // How to use this library with a FM6126 panel, thanks goes to: // https://github.com/hzeller/rpi-rgb-led-matrix/issues/746 -/* -// IDF +#ifdef IDF_BUILD #include <stdio.h> #include <freertos/FreeRTOS.h> #include <freertos/task.h> #include <driver/gpio.h> #include "sdkconfig.h" -*/ +#endif + #include <Arduino.h> #include "xtensa/core-macros.h" #ifdef VIRTUAL_PANE @@ -241,7 +241,7 @@ void loop(){ delay(PATTERN_DELAY); // -#ifdef TEST_FASTLINES +#ifndef NO_FAST_FUNCTIONS // Fillrate for fillRect() function Serial.print("Estimating fullscreen fillrate with fillRect() time: "); t1 = micros(); @@ -293,7 +293,7 @@ void loop(){ Serial.printf("%lu us, %u ticks\n", t2, ccount1); delay(PATTERN_DELAY); -#ifdef TEST_FASTLINES +#ifndef NO_FAST_FUNCTIONS Serial.println("Estimating V-lines with vlineDMA(): "); // matrix->fillScreen(0); color2 = random8(); @@ -347,7 +347,7 @@ void loop(){ Serial.printf("%lu us, %u ticks\n", t2, ccount1); delay(PATTERN_DELAY); -#ifdef TEST_FASTLINES +#ifndef NO_FAST_FUNCTIONS Serial.println("Estimating H-lines with hlineDMA(): "); matrix->fillScreen(0); color2 = random8(); |
