Merge pull request #237 from mrfaptastic/dev

Better CI checks
This commit is contained in:
mrfaptastic 2022-01-13 15:31:58 +00:00 committed by GitHub
commit 3487a3565d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 140 additions and 32 deletions

View file

@ -17,7 +17,7 @@ __[BUILD](/doc/BuildOptions.md) | [EXAMPLES](/examples/README.md)__ | [![Platfor
* [2. Wiring ESP32 with the LED Matrix Panel](#2-wiring-esp32-with-the-led-matrix-panel) * [2. Wiring ESP32 with the LED Matrix Panel](#2-wiring-esp32-with-the-led-matrix-panel)
* [3. Run a Test Sketch](#3-run-a-test-sketch) * [3. Run a Test Sketch](#3-run-a-test-sketch)
- [More Information](#more-information) - [More Information](#more-information)
* [Build-time options](#build-time-options) * [Build-time options](#doc/BuildOptions.md)
* [Memory constraints](#memory-constraints) * [Memory constraints](#memory-constraints)
* [Can I use with a larger panel (i.e. 64x64px square panel)?](#can-i-use-with-a-larger-panel-ie-64x64px-square-panel) * [Can I use with a larger panel (i.e. 64x64px square panel)?](#can-i-use-with-a-larger-panel-ie-64x64px-square-panel)
* [Can I chain panels?](#can-i-chain-panels) * [Can I chain panels?](#can-i-chain-panels)

View file

@ -2,6 +2,8 @@
Simple solid colors, gradients and test line patterns, could be used to test matrices for proper operation, flickering and estimate fillrate timings. Simple solid colors, gradients and test line patterns, could be used to test matrices for proper operation, flickering and estimate fillrate timings.
It is also used in CI test builds to check different build flags scenarios.
Should be build and uploaded as a [platformio](https://platformio.org/) project Should be build and uploaded as a [platformio](https://platformio.org/) project

View file

@ -1,29 +1,76 @@
[platformio] [platformio]
default_envs = esp32 ;default_envs = esp32
description = HUB75 ESP32 I2S DMA test patterns example
;src_dir = src
[env] [env]
framework = arduino framework = arduino
platform = espressif32 platform = espressif32
board_build.filesystem = littlefs
board = wemos_d1_mini32 board = wemos_d1_mini32
lib_deps = lib_deps =
FastLED fastled/FastLED
https://github.com/mrfaptastic/ESP32-HUB75-MatrixPanel-I2S-DMA.git
build_flags = build_flags =
; -DSERIAL_DEBUG=1 upload_speed = 460800
upload_speed = 921600
monitor_speed = 115200 monitor_speed = 115200
monitor_filters = esp32_exception_decoder monitor_filters = esp32_exception_decoder
[env:esp32] [env:esp32]
build_flags = build_flags =
${env.build_flags} ${env.build_flags}
;-DUSE_FASTLINES -DTEST_FASTLINES
-DNO_GFX
lib_deps = lib_deps =
${env.lib_deps} ${env.lib_deps}
; use dev version of the lib Wire
https://github.com/mrfaptastic/ESP32-HUB75-MatrixPanel-I2S-DMA.git 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
; PIO CI can't handle IDF git modules properly (yet) ; PIO CI can't handle IDF git modules properly (yet)
;[env:idfarduino] ;[env:idfarduino]

View file

@ -11,8 +11,11 @@
*/ */
#include <Arduino.h> #include <Arduino.h>
#include "xtensa/core-macros.h" #include "xtensa/core-macros.h"
#ifdef VIRTUAL_PANE
#include <ESP32-VirtualMatrixPanel-I2S-DMA.h>
#else
#include <ESP32-HUB75-MatrixPanel-I2S-DMA.h> #include <ESP32-HUB75-MatrixPanel-I2S-DMA.h>
#endif
#include "main.h" #include "main.h"
// HUB75E pinout // HUB75E pinout
@ -44,25 +47,38 @@
*/ */
// Configure for your panel(s) as appropriate! // Configure for your panel(s) as appropriate!
#define PIN_E 32
#define PANEL_WIDTH 64 #define PANEL_WIDTH 64
#define PANEL_HEIGHT 64 // Panel height of 64 will required PIN_E to be defined. #define PANEL_HEIGHT 64 // Panel height of 64 will required PIN_E to be defined.
#ifdef VIRTUAL_PANE
#define PANELS_NUMBER 4 // Number of chained panels, if just a single panel, obviously set to 1
#else
#define PANELS_NUMBER 2 // Number of chained panels, if just a single panel, obviously set to 1 #define PANELS_NUMBER 2 // Number of chained panels, if just a single panel, obviously set to 1
#define PIN_E 32 #endif
#define PANE_WIDTH PANEL_WIDTH * PANELS_NUMBER #define PANE_WIDTH PANEL_WIDTH * PANELS_NUMBER
#define PANE_HEIGHT PANEL_HEIGHT #define PANE_HEIGHT PANEL_HEIGHT
// patten change delay
#define PATTERN_DELAY 2000
#define NUM_LEDS PANE_WIDTH*PANE_HEIGHT #define NUM_LEDS PANE_WIDTH*PANE_HEIGHT
// do tests using fast-line methods #ifdef VIRTUAL_PANE
#define USE_FASTLINES #define NUM_ROWS 2 // Number of rows of chained INDIVIDUAL PANELS
#define NUM_COLS 2 // Number of INDIVIDUAL PANELS per ROW
#define PANEL_CHAIN NUM_ROWS*NUM_COLS // total number of panels chained one to another
// Change this to your needs, for details on VirtualPanel pls read the PDF!
#define SERPENT true
#define TOPDOWN false
#endif
#ifdef VIRTUAL_PANE
VirtualMatrixPanel *matrix = nullptr;
MatrixPanel_I2S_DMA *chain = nullptr;
#else
MatrixPanel_I2S_DMA *matrix = nullptr; MatrixPanel_I2S_DMA *matrix = nullptr;
#endif
// patten change delay
#define PATTERN_DELAY 2000
uint16_t time_counter = 0, cycles = 0, fps = 0; uint16_t time_counter = 0, cycles = 0, fps = 0;
unsigned long fps_timer; unsigned long fps_timer;
@ -77,6 +93,8 @@ uint32_t ccount1, ccount2;
uint8_t color1 = 0, color2 = 0, color3 = 0; uint8_t color1 = 0, color2 = 0, color3 = 0;
uint16_t x,y; uint16_t x,y;
const char *str = "* ESP32 I2S DMA *";
void setup(){ void setup(){
Serial.begin(BAUD_RATE); Serial.begin(BAUD_RATE);
@ -89,23 +107,31 @@ void setup(){
mxconfig.gpio.e = PIN_E; mxconfig.gpio.e = PIN_E;
mxconfig.driver = HUB75_I2S_CFG::FM6126A; // for panels using FM6126A chips mxconfig.driver = HUB75_I2S_CFG::FM6126A; // for panels using FM6126A chips
#ifndef VIRTUAL_PANE
matrix = new MatrixPanel_I2S_DMA(mxconfig); matrix = new MatrixPanel_I2S_DMA(mxconfig);
matrix->begin(); matrix->begin();
matrix->setBrightness8(255); matrix->setBrightness8(255);
#else
// longer latch blanking could help to eliminate ghosting in some cases chain = new MatrixPanel_I2S_DMA(mxconfig);
//matrix->setLatBlanking(2); chain->begin();
chain->setBrightness8(255);
// create VirtualDisplay object based on our newly created dma_display object
matrix = new VirtualMatrixPanel((*chain), NUM_ROWS, NUM_COLS, PANEL_WIDTH, PANEL_HEIGHT, SERPENT, TOPDOWN);
#endif
ledbuff = (CRGB *)malloc(NUM_LEDS * sizeof(CRGB)); // allocate buffer for some tests ledbuff = (CRGB *)malloc(NUM_LEDS * sizeof(CRGB)); // allocate buffer for some tests
buffclear(ledbuff); buffclear(ledbuff);
} }
uint8_t wheelval = 0;
void loop(){ void loop(){
Serial.printf("Cycle: %d\n", ++cycles); Serial.printf("Cycle: %d\n", ++cycles);
#ifndef NO_GFX
drawText(wheelval++);
#endif
Serial.print("Estimating clearScreen() - "); Serial.print("Estimating clearScreen() - ");
ccount1 = XTHAL_GET_CCOUNT(); ccount1 = XTHAL_GET_CCOUNT();
matrix->clearScreen(); matrix->clearScreen();
@ -126,7 +152,7 @@ void loop(){
delay(5000); delay(5000);
*/ */
#ifndef VIRTUAL_PANE
// simple solid colors // simple solid colors
Serial.println("Fill screen: RED"); Serial.println("Fill screen: RED");
matrix->fillScreenRGB888(255, 0, 0); matrix->fillScreenRGB888(255, 0, 0);
@ -137,7 +163,7 @@ void loop(){
Serial.println("Fill screen: BLUE"); Serial.println("Fill screen: BLUE");
matrix->fillScreenRGB888(0, 0, 255); matrix->fillScreenRGB888(0, 0, 255);
delay(PATTERN_DELAY); delay(PATTERN_DELAY);
#endif
for (uint8_t i=5; i; --i){ for (uint8_t i=5; i; --i){
Serial.print("Estimating single drawPixelRGB888(r, g, b) ticks: "); Serial.print("Estimating single drawPixelRGB888(r, g, b) ticks: ");
@ -157,6 +183,7 @@ void loop(){
t2 = micros()-t1; t2 = micros()-t1;
Serial.printf("%lu us, %u ticks\n\n", t2, ccount1); Serial.printf("%lu us, %u ticks\n\n", t2, ccount1);
#ifndef VIRTUAL_PANE
// Bare fillscreen(r, g, b) // Bare fillscreen(r, g, b)
Serial.print("Estimating fillscreenRGB888(r, g, b) time: "); Serial.print("Estimating fillscreenRGB888(r, g, b) time: ");
t1 = micros(); t1 = micros();
@ -167,7 +194,7 @@ void loop(){
s1+=t2; s1+=t2;
Serial.printf("%lu us, avg: %lu, ccnt: %d\n", t2, s1/cycles, ccount2); Serial.printf("%lu us, avg: %lu, ccnt: %d\n", t2, s1/cycles, ccount2);
delay(PATTERN_DELAY); delay(PATTERN_DELAY);
#endif
Serial.print("Estimating full-screen fillrate with looped drawPixelRGB888(): "); Serial.print("Estimating full-screen fillrate with looped drawPixelRGB888(): ");
y = PANE_HEIGHT; y = PANE_HEIGHT;
@ -214,7 +241,7 @@ void loop(){
delay(PATTERN_DELAY); delay(PATTERN_DELAY);
// //
#ifdef USE_FASTLINES #ifdef TEST_FASTLINES
// Fillrate for fillRect() function // Fillrate for fillRect() function
Serial.print("Estimating fullscreen fillrate with fillRect() time: "); Serial.print("Estimating fullscreen fillrate with fillRect() time: ");
t1 = micros(); t1 = micros();
@ -266,7 +293,7 @@ void loop(){
Serial.printf("%lu us, %u ticks\n", t2, ccount1); Serial.printf("%lu us, %u ticks\n", t2, ccount1);
delay(PATTERN_DELAY); delay(PATTERN_DELAY);
#ifdef USE_FASTLINES #ifdef TEST_FASTLINES
Serial.println("Estimating V-lines with vlineDMA(): "); // Serial.println("Estimating V-lines with vlineDMA(): "); //
matrix->fillScreen(0); matrix->fillScreen(0);
color2 = random8(); color2 = random8();
@ -320,7 +347,7 @@ void loop(){
Serial.printf("%lu us, %u ticks\n", t2, ccount1); Serial.printf("%lu us, %u ticks\n", t2, ccount1);
delay(PATTERN_DELAY); delay(PATTERN_DELAY);
#ifdef USE_FASTLINES #ifdef TEST_FASTLINES
Serial.println("Estimating H-lines with hlineDMA(): "); Serial.println("Estimating H-lines with hlineDMA(): ");
matrix->fillScreen(0); matrix->fillScreen(0);
color2 = random8(); color2 = random8();
@ -396,3 +423,33 @@ uint16_t XY16( uint16_t x, uint16_t y)
return 0; return 0;
} }
} }
#ifdef NO_GFX
void drawText(int colorWheelOffset){}
#else
void drawText(int colorWheelOffset){
// draw some text
matrix->setTextSize(1); // size 1 == 8 pixels high
matrix->setTextWrap(false); // Don't wrap at end of line - will do ourselves
matrix->setCursor(5, 5); // start at top left, with 5,5 pixel of spacing
uint8_t w = 0;
for (w=0; w<strlen(str); w++) {
matrix->setTextColor(colorWheel((w*32)+colorWheelOffset));
matrix->print(str[w]);
}
}
#endif
uint16_t colorWheel(uint8_t pos) {
if(pos < 85) {
return matrix->color565(pos * 3, 255 - pos * 3, 0);
} else if(pos < 170) {
pos -= 85;
return matrix->color565(255 - pos * 3, 0, pos * 3);
} else {
pos -= 170;
return matrix->color565(0, pos * 3, 255 - pos * 3);
}
}

View file

@ -6,3 +6,5 @@
void buffclear(CRGB *buf); void buffclear(CRGB *buf);
uint16_t XY16( uint16_t x, uint16_t y); uint16_t XY16( uint16_t x, uint16_t y);
void mxfill(CRGB *leds); void mxfill(CRGB *leds);
uint16_t colorWheel(uint8_t pos);
void drawText(int colorWheelOffset);