From 58757c1975a6bd7db17d44d104fcd94a99681561 Mon Sep 17 00:00:00 2001 From: mrfaptastic <12006953+mrfaptastic@users.noreply.github.com> Date: Wed, 25 Jan 2023 22:37:52 +0000 Subject: Use PLL_F160M_CLK as clock source on S3 --- src/platforms/esp32/RGB_HUB75_PINS.png | Bin 0 -> 10405 bytes src/platforms/esp32s3/gdma_lcd_parallel16.cpp | 36 +++++++++++++++++++++----- src/platforms/esp32s3/gdma_lcd_parallel16.hpp | 5 ++-- 3 files changed, 32 insertions(+), 9 deletions(-) create mode 100644 src/platforms/esp32/RGB_HUB75_PINS.png diff --git a/src/platforms/esp32/RGB_HUB75_PINS.png b/src/platforms/esp32/RGB_HUB75_PINS.png new file mode 100644 index 0000000..2dc609e Binary files /dev/null and b/src/platforms/esp32/RGB_HUB75_PINS.png differ diff --git a/src/platforms/esp32s3/gdma_lcd_parallel16.cpp b/src/platforms/esp32s3/gdma_lcd_parallel16.cpp index 314bb99..6daedba 100644 --- a/src/platforms/esp32s3/gdma_lcd_parallel16.cpp +++ b/src/platforms/esp32s3/gdma_lcd_parallel16.cpp @@ -30,8 +30,8 @@ // static const char* TAG = "gdma_lcd_parallel16"; //#endif - static int _dmadesc_a_idx = 0; - static int _dmadesc_b_idx = 0; + //static int _dmadesc_a_idx = 0; + //static int _dmadesc_b_idx = 0; dma_descriptor_t desc; // DMA descriptor for testing @@ -98,22 +98,44 @@ //LCD_CAM.lcd_clock.clk_en = 0; // Enable peripheral clock // LCD_CAM_LCD_CLK_SEL Select LCD module source clock. 0: clock source is disabled. 1: XTAL_CLK. 2: PLL_D2_CLK. 3: PLL_F160M_CLK. (R/W) - LCD_CAM.lcd_clock.lcd_clk_sel = 2; + LCD_CAM.lcd_clock.lcd_clk_sel = 3; // Use 160Mhz Clock Source + LCD_CAM.lcd_clock.lcd_ck_out_edge = 0; // PCLK low in 1st half cycle LCD_CAM.lcd_clock.lcd_ck_idle_edge = 0; // PCLK low idle - LCD_CAM.lcd_clock.lcd_clk_equ_sysclk = 0; // PCLK = CLK / (CLKCNT_N+1) + + LCD_CAM.lcd_clock.lcd_clkcnt_n = 1; // Should never be zero + + //LCD_CAM.lcd_clock.lcd_clk_equ_sysclk = 0; // PCLK = CLK / (CLKCNT_N+1) + LCD_CAM.lcd_clock.lcd_clk_equ_sysclk = 1; // PCLK = CLK / 1 (... so 160Mhz still) if (_cfg.psram_clk_override) // fastest speed I can get PSRAM to work before nothing shows { - LCD_CAM.lcd_clock.lcd_clkm_div_num = 4; + ESP_LOGI("S3", "DMA buffer is on PSRAM. Limiting clockspeed...."); + LCD_CAM.lcd_clock.lcd_clkm_div_num = 10; //16mhz is the fasted the Octal PSRAM can support it seems } else { + + auto freq = (_cfg.bus_freq); + + auto _div_num = 8; // 20Mhz + if (freq < 20000000L) + { + _div_num = 12; // 13Mhz + } + else if (freq > 20000000L) + { + _div_num = 6; // 26Mhz --- likely to have noise without a good connection + } + //LCD_CAM.lcd_clock.lcd_clkm_div_num = lcd_clkm_div_num; - LCD_CAM.lcd_clock.lcd_clkm_div_num = 3; + LCD_CAM.lcd_clock.lcd_clkm_div_num = _div_num; //3; + } - ESP_LOGI("S3", "Clock divider is %d", LCD_CAM.lcd_clock.lcd_clkm_div_num); + ESP_LOGI("S3", "Clock divider is %d", LCD_CAM.lcd_clock.lcd_clkm_div_num); + + ESP_LOGD("S3", "Resulting output clock frequency: %d Mhz", (160000000L/LCD_CAM.lcd_clock.lcd_clkm_div_num)); LCD_CAM.lcd_clock.lcd_clkm_div_a = 1; // 0/1 fractional divide diff --git a/src/platforms/esp32s3/gdma_lcd_parallel16.hpp b/src/platforms/esp32s3/gdma_lcd_parallel16.hpp index 3cb94e8..3d47c22 100644 --- a/src/platforms/esp32s3/gdma_lcd_parallel16.hpp +++ b/src/platforms/esp32s3/gdma_lcd_parallel16.hpp @@ -157,8 +157,9 @@ gdma_channel_handle_t dma_chan; uint32_t _dmadesc_count = 0; // number of dma decriptors - // uint32_t _dmadesc_a_idx = 0; - //uint32_t _dmadesc_b_idx = 0; + + uint32_t _dmadesc_a_idx = 0; + uint32_t _dmadesc_b_idx = 0; HUB75_DMA_DESCRIPTOR_T* _dmadesc_a = nullptr; HUB75_DMA_DESCRIPTOR_T* _dmadesc_b = nullptr; -- cgit v1.3.1 From ace8d938eeba00842a9c8729c425b75971f0aba8 Mon Sep 17 00:00:00 2001 From: mrfaptastic <12006953+mrfaptastic@users.noreply.github.com> Date: Wed, 25 Jan 2023 23:46:34 +0000 Subject: Update ESP32-HUB75-MatrixPanel-I2S-DMA.h --- src/ESP32-HUB75-MatrixPanel-I2S-DMA.h | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/ESP32-HUB75-MatrixPanel-I2S-DMA.h b/src/ESP32-HUB75-MatrixPanel-I2S-DMA.h index 2b76152..ab232b9 100644 --- a/src/ESP32-HUB75-MatrixPanel-I2S-DMA.h +++ b/src/ESP32-HUB75-MatrixPanel-I2S-DMA.h @@ -202,7 +202,7 @@ struct HUB75_I2S_CFG { /** * I2S clock speed selector */ - enum clk_speed {HZ_10M=10000000, HZ_15M=15000000, HZ_20M=20000000}; + enum clk_speed {HZ_8M=8000000, HZ_10M=10000000, HZ_15M=15000000, HZ_20M=20000000}; // Structure Variables @@ -342,6 +342,11 @@ class MatrixPanel_I2S_DMA { if (m_cfg.driver) shiftDriver(m_cfg); + #if defined(SPIRAM_DMA_BUFFER) + // Trick library into dropping colour depth slightly when using PSRAM. + // Actual output clockrate override occurs in configureDMA + m_cfg.i2sspeed = HUB75_I2S_CFG::HZ_8M; + #endif /* As DMA buffers are dynamically allocated, we must allocated in begin() * Ref: https://github.com/espressif/arduino-esp32/issues/831 -- cgit v1.3.1 From c66b592e9fcde0767aa8dc912100c25433c8c5db Mon Sep 17 00:00:00 2001 From: mrfaptastic <12006953+mrfaptastic@users.noreply.github.com> Date: Sat, 28 Jan 2023 21:54:09 +0000 Subject: It's 'COLOR' --- doc/BuildOptions.md | 6 +- src/ESP32-HUB75-MatrixPanel-I2S-DMA.cpp | 131 +++++++++++++++----------------- src/ESP32-HUB75-MatrixPanel-I2S-DMA.h | 46 ++++++----- 3 files changed, 91 insertions(+), 92 deletions(-) diff --git a/doc/BuildOptions.md b/doc/BuildOptions.md index a5bbe64..9069b83 100644 --- a/doc/BuildOptions.md +++ b/doc/BuildOptions.md @@ -24,11 +24,11 @@ build_flags = | **USE_GFX_ROOT** | Use [lightweight](https://github.com/mrfaptastic/Adafruit_GFX_Lite) version of AdafuitGFX, without Adafruit BusIO extensions | You **must** install [Adafruit_GFX_Lite](https://github.com/mrfaptastic/Adafruit_GFX_Lite) library instead of original AdafruitGFX| | **NO_GFX** | Build without AdafuitGFX API, only native methods supported based on manipulating DMA buffer. I.e. no methods of drawing circles/shapes, typing text or using fonts!!! This might save some resources for applications using it's own internal graphics buffer or working solely with per-pixel manipulation. | Use this if you rely on FastLED, Neomatrix or any other API. For example [Aurora](/examples/AuroraDemo/) effects can work fine w/o AdafruitGFX. | | **NO_FAST_FUNCTIONS** | Do not build auxiliary speed-optimized functions. Those are used to speed-up operations like drawing straight lines or rectangles. Otherwise lines/shapes are drawn using drawPixel() method. The trade-off for speed is RAM/code-size, take it or leave it ;) | If you are not using AdafruitGFX than you probably do not need this either| -|**NO_CIE1931**|Do not use LED brightness [compensation](https://ledshield.wordpress.com/2012/11/13/led-brightness-to-your-eye-gamma-correction-no/) described in [CIE 1931](https://en.wikipedia.org/wiki/CIE_1931_color_space). Normally library would adjust every pixel's RGB888 so that luminance (or brightness control) for the corresponding LED's would appear 'linear' to the human's eye. I.e. a white dot with rgb(128,128,128) would seem to be at 50% brightness between rgb(0,0,0) and rgb(255,255,255). Normally you would like to keep this enabled by default. Not only it makes brightness control "linear", it also makes colors more vivid, otherwise it looks brighter but 'bleached'.|You might want to turn it off in some special cases like: | -| **FORCE_COLOUR_DEPTH** |In some cases the library may reduce colour fidelity to increase the refresh rate (i.e. reduce visible flicker). This is most likely to occur with a large chain of panels. However, if you want to force pure 24bpp colour, at the expense of likely noticeable flicker, then set this defined. |Not required in 99% of cases. +|**NO_CIE1931**|Do not use LED brightness [compensation](https://ledshield.wordpress.com/2012/11/13/led-brightness-to-your-eye-gamma-correction-no/) described in [CIE 1931](https://en.wikipedia.org/wiki/CIE_1931_color_space). Normally library would adjust every pixel's RGB888 so that luminance (or brightness control) for the corresponding LED's would appear 'linear' to the human's eye. I.e. a white dot with rgb(128,128,128) would seem to be at 50% brightness between rgb(0,0,0) and rgb(255,255,255). Normally you would like to keep this enabled by default. Not only it makes brightness control "linear", it also makes colours more vivid, otherwise it looks brighter but 'bleached'.|You might want to turn it off in some special cases like: | +| **FORCE_COLOR_DEPTH** |In some cases the library may reduce colour fidelity to increase the refresh rate (i.e. reduce visible flicker). This is most likely to occur with a large chain of panels. However, if you want to force pure 24bpp colour, at the expense of likely noticeable flicker, then set this defined. |Not required in 99% of cases. ## Build-time variables | Flag | Description | Note | | :------------ |---------------|-----| -| **PIXEL_COLOR_DEPTH_BITS=8** | Color depth per color per pixel in range 2-8. More bit's - more natural color. But on the other hand every additional bit: | For large chains of panels (i.e. 6 x 64x64 panels) you WILL need to reduce the colour depth, or likely run out of memory. Default is 8 bits per colour per pixel, i.e. TrueColor 24 bit RGB.

For higher resolutions, from 64x64 and above it is not possible to provide full 24 bits colour without significant flickering OR reducing dynamic range in shadows. In that case using 5-6 bits at high res make very small difference to the human’s eye actually. Refer to the [I2S memcalc](i2s_memcalc.md) for more details. +| **PIXEL_COLOR_DEPTH_BITS=8** | Colour depth per pixel in range 2-8. More bit's - more natural colour. But on the other hand every additional bit: | For large chains of panels (i.e. 6 x 64x64 panels) you WILL need to reduce the colour depth, or likely run out of memory. Default is 8 bits per colour per pixel, i.e. True colour 24 bit RGB.

For higher resolutions, from 64x64 and above it is not possible to provide full 24 bits colour without significant flickering OR reducing dynamic range in shadows. In that case using 5-6 bits at high res make very small difference to the human’s eye actually. Refer to the [I2S memcalc](i2s_memcalc.md) for more details. diff --git a/src/ESP32-HUB75-MatrixPanel-I2S-DMA.cpp b/src/ESP32-HUB75-MatrixPanel-I2S-DMA.cpp index 4778c5b..b8fcf55 100644 --- a/src/ESP32-HUB75-MatrixPanel-I2S-DMA.cpp +++ b/src/ESP32-HUB75-MatrixPanel-I2S-DMA.cpp @@ -23,29 +23,29 @@ #endif /* This library is designed to take an 8 bit / 1 byte value (0-255) for each R G B colour sub-pixel. - * The PIXEL_COLOUR_DEPTH_BITS should always be '8' as a result. + * The PIXEL_COLOR_DEPTH_BITS should always be '8' as a result. * However, if the library is to be used with lower colour depth (i.e. 6 bit colour), then we need to ensure the 8-bit value passed to the colour masking * is adjusted accordingly to ensure the LSB's are shifted left to MSB, by the difference. Otherwise the colours will be all screwed up. */ -#if PIXEL_COLOUR_DEPTH_BITS > 8 - #error "Color depth bits cannot be greater than 8." -#elif PIXEL_COLOUR_DEPTH_BITS < 2 +#if PIXEL_COLOR_DEPTH_BITS > 8 + #error "Colour depth bits cannot be greater than 8." +#elif PIXEL_COLOR_DEPTH_BITS < 2 #error "Colour depth bits cannot be less than 2." #endif -#if PIXEL_COLOUR_DEPTH_BITS != 8 - #define MASK_OFFSET (8 - PIXEL_COLOUR_DEPTH_BITS) +#if PIXEL_COLOR_DEPTH_BITS != 8 + #define MASK_OFFSET (8 - PIXEL_COLOR_DEPTH_BITS) #define PIXEL_COLOUR_MASK_BIT(colour_depth_index) (1 << (colour_depth_index + MASK_OFFSET)) - //static constexpr uint8_t const MASK_OFFSET = 8-PIXEL_COLOUR_DEPTH_BITS; + //static constexpr uint8_t const MASK_OFFSET = 8-PIXEL_COLOR_DEPTH_BITS; #else #define PIXEL_COLOUR_MASK_BIT(colour_depth_index) (1 << (colour_depth_index)) #endif /* - #if PIXEL_COLOUR_DEPTH_BITS < 8 + #if PIXEL_COLOR_DEPTH_BITS < 8 uint8_t mask = (1 << (colour_depth_idx+MASK_OFFSET)); // expect 24 bit colour (8 bits per RGB subpixel) #else - uint8_t mask = (1 << (colour_depth_idx)); // expect 24 bit color (8 bits per RGB subpixel) + uint8_t mask = (1 << (colour_depth_idx)); // expect 24 bit colour (8 bits per RGB subpixel) #endif */ @@ -65,11 +65,11 @@ bool MatrixPanel_I2S_DMA::allocateDMAmemory() size_t allocated_fb_memory = 0; for (int malloc_num =0; malloc_num < ROWS_PER_FRAME; ++malloc_num) { - auto ptr = std::make_shared(PIXELS_PER_ROW, PIXEL_COLOUR_DEPTH_BITS, m_cfg.double_buff); + auto ptr = std::make_shared(PIXELS_PER_ROW, PIXEL_COLOR_DEPTH_BITS, m_cfg.double_buff); if (ptr->data == nullptr) { - ESP_LOGE("I2S-DMA", "CRITICAL ERROR: Not enough memory for requested colour depth! Please reduce PIXEL_COLOUR_DEPTH_BITS value.\r\n"); + ESP_LOGE("I2S-DMA", "CRITICAL ERROR: Not enough memory for requested colour depth! Please reduce PIXEL_COLOR_DEPTH_BITS value.\r\n"); ESP_LOGE("I2S-DMA", "Could not allocate rowBitStruct %d!.\r\n", malloc_num); return false; @@ -83,7 +83,7 @@ bool MatrixPanel_I2S_DMA::allocateDMAmemory() ESP_LOGI("I2S-DMA", "Allocating %d bytes memory for DMA BCM framebuffer(s).", allocated_fb_memory); // calculate the lowest LSBMSB_TRANSITION_BIT value that will fit in memory that will meet or exceed the configured refresh rate -#if !defined(FORCE_COLOUR_DEPTH) +#if !defined(FORCE_COLOR_DEPTH) ESP_LOGI("I2S-DMA", "Minimum visual refresh rate (scan rate from panel top to bottom) requested: %d Hz", m_cfg.min_refresh_rate); @@ -92,11 +92,11 @@ bool MatrixPanel_I2S_DMA::allocateDMAmemory() int nsPerLatch = ((PIXELS_PER_ROW + CLKS_DURING_LATCH) * psPerClock) / 1000; // add time to shift out LSBs + LSB-MSB transition bit - this ignores fractions... - int nsPerRow = PIXEL_COLOUR_DEPTH_BITS * nsPerLatch; + int nsPerRow = PIXEL_COLOR_DEPTH_BITS * nsPerLatch; // add time to shift out MSBs - for(int i=lsbMsbTransitionBit + 1; i m_cfg.min_refresh_rate) break; - if(lsbMsbTransitionBit < PIXEL_COLOUR_DEPTH_BITS - 1) + if(lsbMsbTransitionBit < PIXEL_COLOR_DEPTH_BITS - 1) lsbMsbTransitionBit++; else break; @@ -126,7 +126,7 @@ bool MatrixPanel_I2S_DMA::allocateDMAmemory() * memory allocation of the DMA linked list memory structure. */ int numDMAdescriptorsPerRow = 1; - for(int i=lsbMsbTransitionBit + 1; isize() > DMA_MAX ) { - ESP_LOGW("I2S-DMA", "rowColorDepthStruct struct is too large, split DMA payload required. Adding %d DMA descriptors\n", PIXEL_COLOUR_DEPTH_BITS-1); + ESP_LOGW("I2S-DMA", "rowBits struct is too large to fit in one DMA transfer payload, splitting required. Adding %d DMA descriptors\n", PIXEL_COLOR_DEPTH_BITS-1); - numDMAdescriptorsPerRow += PIXEL_COLOUR_DEPTH_BITS-1; + numDMAdescriptorsPerRow += PIXEL_COLOR_DEPTH_BITS-1; // Note: If numDMAdescriptorsPerRow is even just one descriptor too large, DMA linked list will not correctly loop. } @@ -173,7 +173,7 @@ void MatrixPanel_I2S_DMA::configureDMA(const HUB75_I2S_CFG& _cfg) int current_dmadescriptor_offset = 0; // HACK: If we need to split the payload in 1/2 so that it doesn't breach DMA_MAX, lets do it by the colour_depth. - int num_dma_payload_colour_depths = PIXEL_COLOUR_DEPTH_BITS; + int num_dma_payload_colour_depths = PIXEL_COLOR_DEPTH_BITS; if ( dma_buff.rowBits[0]->size() > DMA_MAX ) { num_dma_payload_colour_depths = 1; } @@ -199,7 +199,7 @@ void MatrixPanel_I2S_DMA::configureDMA(const HUB75_I2S_CFG& _cfg) if ( dma_buff.rowBits[0]->size() > DMA_MAX ) { - for (int cd = 1; cd < PIXEL_COLOUR_DEPTH_BITS; cd++) + for (int cd = 1; cd < PIXEL_COLOR_DEPTH_BITS; cd++) { dma_bus.create_dma_desc_link(dma_buff.rowBits[row]->getDataPtr(cd, 0), dma_buff.rowBits[row]->size(num_dma_payload_colour_depths), false); @@ -213,7 +213,7 @@ void MatrixPanel_I2S_DMA::configureDMA(const HUB75_I2S_CFG& _cfg) } // row depth struct - for(int i=lsbMsbTransitionBit + 1; igetDataPtr(i, 0), dma_buff.rowBits[row]->size(PIXEL_COLOUR_DEPTH_BITS - i), false); + dma_bus.create_dma_desc_link(dma_buff.rowBits[row]->getDataPtr(i, 0), dma_buff.rowBits[row]->size(PIXEL_COLOR_DEPTH_BITS - i), false); if (m_cfg.double_buff) { - dma_bus.create_dma_desc_link(dma_buff.rowBits[row]->getDataPtr(i, 1), dma_buff.rowBits[row]->size(PIXEL_COLOUR_DEPTH_BITS - i), true ); + dma_bus.create_dma_desc_link(dma_buff.rowBits[row]->getDataPtr(i, 1), dma_buff.rowBits[row]->size(PIXEL_COLOR_DEPTH_BITS - i), true ); } current_dmadescriptor_offset++; @@ -311,7 +311,7 @@ void IRAM_ATTR MatrixPanel_I2S_DMA::updateMatrixDMABuffer(uint16_t x_coord, uint /* LED Brightness Compensation. Because if we do a basic "red & mask" for example, * we'll NEVER send the dimmest possible colour, due to binary skew. - * i.e. It's almost impossible for colour_depth_idx of 0 to be sent out to the MATRIX unless the 'value' of a color is exactly '1' + * i.e. It's almost impossible for colour_depth_idx of 0 to be sent out to the MATRIX unless the 'value' of a colour is exactly '1' * https://ledshield.wordpress.com/2012/11/13/led-brightness-to-your-eye-gamma-correction-no/ */ #ifndef NO_CIE1931 @@ -351,17 +351,10 @@ void IRAM_ATTR MatrixPanel_I2S_DMA::updateMatrixDMABuffer(uint16_t x_coord, uint } // Iterating through colour depth bits, which we assume are 8 bits per RGB subpixel (24bpp) - uint8_t colour_depth_idx = PIXEL_COLOUR_DEPTH_BITS; + uint8_t colour_depth_idx = PIXEL_COLOR_DEPTH_BITS; do { --colour_depth_idx; -/* -// uint8_t mask = (1 << (colour_depth_idx COLOR_DEPTH_LESS_THAN_8BIT_ADJUST)); // expect 24 bit colour (8 bits per RGB subpixel) - #if PIXEL_COLOUR_DEPTH_BITS < 8 - uint8_t mask = (1 << (colour_depth_idx+MASK_OFFSET)); // expect 24 bit colour (8 bits per RGB subpixel) - #else - uint8_t mask = (1 << (colour_depth_idx)); // expect 24 bit color (8 bits per RGB subpixel) - #endif -*/ + uint8_t mask = PIXEL_COLOUR_MASK_BIT(colour_depth_idx); uint16_t RGB_output_bits = 0; @@ -376,7 +369,7 @@ void IRAM_ATTR MatrixPanel_I2S_DMA::updateMatrixDMABuffer(uint16_t x_coord, uint // Get the contents at this address, - // it would represent a vector pointing to the full row of pixels for the specified color depth bit at Y coordinate + // it would represent a vector pointing to the full row of pixels for the specified colour depth bit at Y coordinate ESP32_I2S_DMA_STORAGE_TYPE *p = getRowDataPtr(y_coord, colour_depth_idx, back_buffer_id); @@ -404,13 +397,13 @@ void MatrixPanel_I2S_DMA::updateMatrixDMABuffer(uint8_t red, uint8_t green, uint blue = lumConvTab[blue]; #endif - for(uint8_t colour_depth_idx=0; colour_depth_idxcolour_depth; do { --colouridx; - // switch pointer to a row for a specific color index + // switch pointer to a row for a specific colour index row = dma_buff.rowBits[row_idx]->getDataPtr(colouridx, _buff_id); /* @@ -617,12 +610,12 @@ void MatrixPanel_I2S_DMA::brtCtrlOE(int brt, const bool _buff_id){ do { --row_idx; - // let's set OE control bits for specific pixels in each color_index subrows + // let's set OE control bits for specific pixels in each colour_index subrows uint8_t colouridx = dma_buff.rowBits[row_idx]->colour_depth; do { --colouridx; - // switch pointer to a row for a specific color index + // switch pointer to a row for a specific colour index ESP32_I2S_DMA_STORAGE_TYPE* row = dma_buff.rowBits[row_idx]->getDataPtr(colouridx, _buff_id); int x_coord = dma_buff.rowBits[row_idx]->width; @@ -668,7 +661,7 @@ void MatrixPanel_I2S_DMA::brtCtrlOE(int brt, const bool _buff_id){ } while(colouridx); - // switch pointer to a row for a specific color index + // switch pointer to a row for a specific colour index #if defined(SPIRAM_DMA_BUFFER) ESP32_I2S_DMA_STORAGE_TYPE* row_hack = dma_buff.rowBits[row_idx]->getDataPtr(colouridx, _buff_id); Cache_WriteBack_Addr((uint32_t)row_hack, sizeof(ESP32_I2S_DMA_STORAGE_TYPE) * ((dma_buff.rowBits[row_idx]->width * dma_buff.rowBits[row_idx]->colour_depth)-1)) ; @@ -698,10 +691,10 @@ void MatrixPanel_I2S_DMA::brtCtrlOEv2(uint8_t brt, const int _buff_id) { do { --row_idx; - // let's set OE control bits for specific pixels in each color_index subrows + // let's set OE control bits for specific pixels in each colour_index subrows uint8_t colouridx = dma_buff.rowBits[row_idx]->colour_depth; do { - // Multiply brightness according to index of bitplane (color index subrow) + // Multiply brightness according to index of bitplane (colour index subrow) // in respect of accumulating LED intensities with Binary-Coded Modulation: // bitplane 0 is 1/1 of total brightness; bitplane 1 is 1/2; bitplane 2 is 1/4, etc // accumulating all of them together means we will get only ~1/4 of the total brightness. @@ -717,7 +710,7 @@ void MatrixPanel_I2S_DMA::brtCtrlOEv2(uint8_t brt, const int _buff_id) { int brightness_in_x_pixels = (PIXELS_PER_ROW * brt) >> (8 + rightshift); --colouridx; - // switch pointer to a row for a specific color index + // switch pointer to a row for a specific colour index ESP32_I2S_DMA_STORAGE_TYPE* row = dma_buff.rowBits[row_idx]->getDataPtr(colouridx, _buff_id); int x_coord = dma_buff.rowBits[row_idx]->width; @@ -769,7 +762,7 @@ void MatrixPanel_I2S_DMA::brtCtrlOEv2(uint8_t brt, const int _buff_id) { } while(colouridx); - // switch pointer to a row for a specific color index + // switch pointer to a row for a specific colour index #if defined(SPIRAM_DMA_BUFFER) ESP32_I2S_DMA_STORAGE_TYPE* row_hack = dma_buff.rowBits[row_idx]->getDataPtr(colouridx, _buff_id); Cache_WriteBack_Addr((uint32_t)row_hack, sizeof(ESP32_I2S_DMA_STORAGE_TYPE) * ((dma_buff.rowBits[row_idx]->width * dma_buff.rowBits[row_idx]->colour_depth)-1)) ; @@ -828,7 +821,7 @@ uint8_t MatrixPanel_I2S_DMA::setLatBlanking(uint8_t pulses){ * @param x_coord - line start coordinate x * @param y_coord - line start coordinate y * @param l - line length - * @param r,g,b, - RGB888 color + * @param r,g,b, - RGB888 colour */ void MatrixPanel_I2S_DMA::hlineDMA(int16_t x_coord, int16_t y_coord, int16_t l, uint8_t red, uint8_t green, uint8_t blue){ if ( !initialized ) @@ -858,18 +851,18 @@ void MatrixPanel_I2S_DMA::hlineDMA(int16_t x_coord, int16_t y_coord, int16_t l, y_coord -= ROWS_PER_FRAME; } - // Iterating through color depth bits (8 iterations) - uint8_t colour_depth_idx = PIXEL_COLOUR_DEPTH_BITS; + // Iterating through colour depth bits (8 iterations) + uint8_t colour_depth_idx = PIXEL_COLOR_DEPTH_BITS; do { --colour_depth_idx; // let's precalculate RGB1 and RGB2 bits than flood it over the entire DMA buffer uint16_t RGB_output_bits = 0; // uint8_t mask = (1 << colour_depth_idx COLOR_DEPTH_LESS_THAN_8BIT_ADJUST); - // #if PIXEL_COLOUR_DEPTH_BITS < 8 - // uint8_t mask = (1 << (colour_depth_idx+MASK_OFFSET)); // expect 24 bit color (8 bits per RGB subpixel) + // #if PIXEL_COLOR_DEPTH_BITS < 8 + // uint8_t mask = (1 << (colour_depth_idx+MASK_OFFSET)); // expect 24 bit colour (8 bits per RGB subpixel) // #else - // uint8_t mask = (1 << (colour_depth_idx)); // expect 24 bit color (8 bits per RGB subpixel) + // uint8_t mask = (1 << (colour_depth_idx)); // expect 24 bit colour (8 bits per RGB subpixel) // #endif uint8_t mask = PIXEL_COLOUR_MASK_BIT(colour_depth_idx); @@ -880,10 +873,10 @@ void MatrixPanel_I2S_DMA::hlineDMA(int16_t x_coord, int16_t y_coord, int16_t l, RGB_output_bits |= (bool)(green & mask); // -BG RGB_output_bits <<= 1; RGB_output_bits |= (bool)(red & mask); // BGR - RGB_output_bits <<= _colourbitoffset; // shift color bits to the required position + RGB_output_bits <<= _colourbitoffset; // shift colour bits to the required position // Get the contents at this address, - // it would represent a vector pointing to the full row of pixels for the specified color depth bit at Y coordinate + // it would represent a vector pointing to the full row of pixels for the specified colour depth bit at Y coordinate ESP32_I2S_DMA_STORAGE_TYPE *p = dma_buff.rowBits[y_coord]->getDataPtr(colour_depth_idx, back_buffer_id); // inlined version works slower here, dunno why :( // ESP32_I2S_DMA_STORAGE_TYPE *p = getRowDataPtr(y_coord, colour_depth_idx, back_buffer_id); @@ -903,10 +896,10 @@ void MatrixPanel_I2S_DMA::hlineDMA(int16_t x_coord, int16_t y_coord, int16_t l, */ uint16_t &v = p[ESP32_TX_FIFO_POSITION_ADJUST(_x)]; - v &= _colourbitclear; // reset color bits - v |= RGB_output_bits; // set new color bits + v &= _colourbitclear; // reset colour bits + v |= RGB_output_bits; // set new colour bits } while(_l); // iterate pixels in a row - } while(colour_depth_idx); // end of color depth loop (8) + } while(colour_depth_idx); // end of colour depth loop (8) } // hlineDMA() @@ -915,7 +908,7 @@ void MatrixPanel_I2S_DMA::hlineDMA(int16_t x_coord, int16_t y_coord, int16_t l, * @param x_coord - line start coordinate x * @param y_coord - line start coordinate y * @param l - line length - * @param r,g,b, - RGB888 color + * @param r,g,b, - RGB888 colour */ void MatrixPanel_I2S_DMA::vlineDMA(int16_t x_coord, int16_t y_coord, int16_t l, uint8_t red, uint8_t green, uint8_t blue){ if ( !initialized ) @@ -944,16 +937,16 @@ void MatrixPanel_I2S_DMA::vlineDMA(int16_t x_coord, int16_t y_coord, int16_t l, */ x_coord = ESP32_TX_FIFO_POSITION_ADJUST(x_coord); - uint8_t colour_depth_idx = PIXEL_COLOUR_DEPTH_BITS; - do { // Iterating through color depth bits (8 iterations) + uint8_t colour_depth_idx = PIXEL_COLOR_DEPTH_BITS; + do { // Iterating through colour depth bits (8 iterations) --colour_depth_idx; // let's precalculate RGB1 and RGB2 bits than flood it over the entire DMA buffer // uint8_t mask = (1 << colour_depth_idx COLOR_DEPTH_LESS_THAN_8BIT_ADJUST); - // #if PIXEL_COLOUR_DEPTH_BITS < 8 - // uint8_t mask = (1 << (colour_depth_idx+MASK_OFFSET)); // expect 24 bit color (8 bits per RGB subpixel) + // #if PIXEL_COLOR_DEPTH_BITS < 8 + // uint8_t mask = (1 << (colour_depth_idx+MASK_OFFSET)); // expect 24 bit colour (8 bits per RGB subpixel) // #else - // uint8_t mask = (1 << (colour_depth_idx)); // expect 24 bit color (8 bits per RGB subpixel) + // uint8_t mask = (1 << (colour_depth_idx)); // expect 24 bit colour (8 bits per RGB subpixel) // #endif uint8_t mask = PIXEL_COLOUR_MASK_BIT(colour_depth_idx); @@ -978,7 +971,7 @@ void MatrixPanel_I2S_DMA::vlineDMA(int16_t x_coord, int16_t y_coord, int16_t l, } // Get the contents at this address, - // it would represent a vector pointing to the full row of pixels for the specified color depth bit at Y coordinate + // it would represent a vector pointing to the full row of pixels for the specified colour depth bit at Y coordinate //ESP32_I2S_DMA_STORAGE_TYPE *p = getRowDataPtr(_y, colour_depth_idx, back_buffer_id); ESP32_I2S_DMA_STORAGE_TYPE *p = dma_buff.rowBits[_y]->getDataPtr(colour_depth_idx, back_buffer_id); @@ -986,7 +979,7 @@ void MatrixPanel_I2S_DMA::vlineDMA(int16_t x_coord, int16_t y_coord, int16_t l, p[x_coord] |= RGB_output_bits; // set new RGB bits ++_y; } while(++_l!=l); // iterate pixels in a col - } while(colour_depth_idx); // end of color depth loop (8) + } while(colour_depth_idx); // end of colour depth loop (8) } // vlineDMA() @@ -995,9 +988,9 @@ void MatrixPanel_I2S_DMA::vlineDMA(int16_t x_coord, int16_t y_coord, int16_t l, * this works much faster than multiple consecutive per-pixel calls to updateMatrixDMABuffer() * @param int16_t x, int16_t y - coordinates of a top-left corner * @param int16_t w, int16_t h - width and height of a rectangular, min is 1 px - * @param uint8_t r - RGB888 color - * @param uint8_t g - RGB888 color - * @param uint8_t b - RGB888 color + * @param uint8_t r - RGB888 colour + * @param uint8_t g - RGB888 colour + * @param uint8_t b - RGB888 colour */ void MatrixPanel_I2S_DMA::fillRectDMA(int16_t x, int16_t y, int16_t w, int16_t h, uint8_t r, uint8_t g, uint8_t b){ diff --git a/src/ESP32-HUB75-MatrixPanel-I2S-DMA.h b/src/ESP32-HUB75-MatrixPanel-I2S-DMA.h index ab232b9..bce0cde 100644 --- a/src/ESP32-HUB75-MatrixPanel-I2S-DMA.h +++ b/src/ESP32-HUB75-MatrixPanel-I2S-DMA.h @@ -64,12 +64,17 @@ #define MATRIX_ROWS_IN_PARALLEL 2 #endif -// 8bit per RGB color = 24 bit/per pixel, +// 8bit per RGB colour = 24 bit/per pixel, // might be reduced to save DMA RAM -#ifndef PIXEL_COLOUR_DEPTH_BITS - #define PIXEL_COLOUR_DEPTH_BITS 8 +#ifdef PIXEL_COLOUR_DEPTH_BITS + #define PIXEL_COLOR_DEPTH_BITS PIXEL_COLOUR_DEPTH_BITS #endif +#ifndef PIXEL_COLOR_DEPTH_BITS + #define PIXEL_COLOR_DEPTH_BITS 8 +#endif + + /***************************************************************************************/ /* Definitions below should NOT be ever changed without rewriting library logic */ #define ESP32_I2S_DMA_STORAGE_TYPE uint16_t // DMA output of one uint16_t at a time. @@ -124,7 +129,7 @@ struct rowBitStruct { ESP32_I2S_DMA_STORAGE_TYPE *data; /** @brief - returns size of row of data vectorfor a SINGLE buff - * size (in bytes) of a vector holding full DMA data for a row of pixels with _dpth color bits + * size (in bytes) of a vector holding full DMA data for a row of pixels with _dpth colour bits * a SINGLE buffer only size is accounted, when using double buffers it actually takes twice as much space * but returned size is for a half of double-buffer * @@ -133,7 +138,7 @@ struct rowBitStruct { */ size_t size(uint8_t _dpth=0 ) { if (!_dpth) _dpth = colour_depth; return width * _dpth * sizeof(ESP32_I2S_DMA_STORAGE_TYPE); }; - /** @brief - returns pointer to the row's data vector beginning at pixel[0] for _dpth color bit + /** @brief - returns pointer to the row's data vector beginning at pixel[0] for _dpth colour bit * default - returns pointer to the data vector's head * NOTE: this call might be very slow in loops. Due to poor instruction caching in esp32 it might be required a reread from flash * every loop cycle, better use inlined #define instead in such cases @@ -170,7 +175,7 @@ struct rowBitStruct { * are contained in parallel within the one uint16_t that is sent in parallel to the HUB75). * * This structure isn't actually allocated in one memory block anymore, as the library now allocates - * memory per row (per rowColorDepthStruct) instead. + * memory per row (per rowBits) instead. */ struct frameStruct { uint8_t rows=0; // number of rows held in current frame, not used actually, just to keep the idea of struct @@ -267,7 +272,8 @@ struct HUB75_I2S_CFG { mx_height(_h), chain_length(_chain), gpio(_pinmap), - driver(_drv), i2sspeed(_i2sspeed), + driver(_drv), + i2sspeed(_i2sspeed), double_buff(_dbuff), latch_blanking(_latblk), clkphase(_clockphase), @@ -452,7 +458,7 @@ class MatrixPanel_I2S_DMA { void drawIcon (int *ico, int16_t x, int16_t y, int16_t cols, int16_t rows); - // Color 444 is a 4 bit scale, so 0 to 15, color 565 takes a 0-255 bit value, so scale up by 255/15 (i.e. 17)! + // Colour 444 is a 4 bit scale, so 0 to 15, colour 565 takes a 0-255 bit value, so scale up by 255/15 (i.e. 17)! static uint16_t color444(uint8_t r, uint8_t g, uint8_t b) { return color565(r*17,g*17,b*17); } // Converts RGB888 to RGB565 @@ -463,7 +469,7 @@ class MatrixPanel_I2S_DMA { /** * @brief - convert RGB565 to RGB888 - * @param uint16_t color - RGB565 input color + * @param uint16_t colour - RGB565 input colour * @param uint8_t &r, &g, &b - refs to variables where converted colors would be emplaced */ static void color565to888(const uint16_t color, uint8_t &r, uint8_t &g, uint8_t &b); @@ -602,9 +608,9 @@ class MatrixPanel_I2S_DMA { Bus_Parallel16 dma_bus; /** - * @brief - clears and reinitializes color/control data in DMA buffs + * @brief - clears and reinitializes colour/control data in DMA buffs * When allocated, DMA buffs might be dirty, so we need to blank it and initialize ABCDE,LAT,OE control bits. - * Those control bits are constants during the entire DMA sweep and never changed when updating just pixel color data + * Those control bits are constants during the entire DMA sweep and never changed when updating just pixel colour data * so we could set it once on DMA buffs initialization and forget. * This effectively clears buffers to blank BLACK and makes it ready to display output. * (Brightness control via OE bit manipulation is another case) @@ -618,7 +624,7 @@ class MatrixPanel_I2S_DMA { void updateMatrixDMABuffer(uint8_t red, uint8_t green, uint8_t blue); /** - * wipes DMA buffer(s) and reset all color/service bits + * wipes DMA buffer(s) and reset all colour/service bits */ inline void resetbuffers(){ @@ -639,7 +645,7 @@ class MatrixPanel_I2S_DMA { * @param x_ccord - line start coordinate x * @param y_ccord - line start coordinate y * @param l - line length - * @param r,g,b, - RGB888 color + * @param r,g,b, - RGB888 colour */ void hlineDMA(int16_t x_coord, int16_t y_coord, int16_t l, uint8_t red, uint8_t green, uint8_t blue); @@ -648,7 +654,7 @@ class MatrixPanel_I2S_DMA { * @param x_ccord - line start coordinate x * @param y_ccord - line start coordinate y * @param l - line length - * @param r,g,b, - RGB888 color + * @param r,g,b, - RGB888 colour */ void vlineDMA(int16_t x_coord, int16_t y_coord, int16_t l, uint8_t red, uint8_t green, uint8_t blue); @@ -657,9 +663,9 @@ class MatrixPanel_I2S_DMA { * uses Fast H/V line draw internally, works faster than multiple consecutive pixel by pixel calls to updateMatrixDMABuffer() * @param int16_t x, int16_t y - coordinates of a top-left corner * @param int16_t w, int16_t h - width and height of a rectangular, min is 1 px - * @param uint8_t r - RGB888 color - * @param uint8_t g - RGB888 color - * @param uint8_t b - RGB888 color + * @param uint8_t r - RGB888 colour + * @param uint8_t g - RGB888 colour + * @param uint8_t b - RGB888 colour */ void fillRectDMA(int16_t x_coord, int16_t y_coord, int16_t w, int16_t h, uint8_t r, uint8_t g, uint8_t b); #endif @@ -743,7 +749,7 @@ class MatrixPanel_I2S_DMA { /** * @brief - convert RGB565 to RGB888 - * @param uint16_t color - RGB565 input color + * @param uint16_t colour - RGB565 input colour * @param uint8_t &r, &g, &b - refs to variables where converted colours would be emplaced */ inline void MatrixPanel_I2S_DMA::color565to888(const uint16_t color, uint8_t &r, uint8_t &g, uint8_t &b){ @@ -792,7 +798,7 @@ inline void MatrixPanel_I2S_DMA::fillScreen(CRGB color) #endif -// Pass 8-bit (each) R,G,B, get back 16-bit packed color +// Pass 8-bit (each) R,G,B, get back 16-bit packed colour //https://github.com/squix78/ILI9341Buffer/blob/master/ILI9341_SPI.cpp inline uint16_t MatrixPanel_I2S_DMA::color565(uint8_t r, uint8_t g, uint8_t b) { return ((r & 0xF8) << 8) | ((g & 0xFC) << 3) | (b >> 3); @@ -861,7 +867,7 @@ inline void MatrixPanel_I2S_DMA::drawIcon (int *ico, int16_t x, int16_t y, int16 only one line is showed at a time, and the display looks like every pixel is driven at the same time. Now, the RGB inputs for these types of displays are digital, meaning each red, green and blue subpixel can only be on or off. This leads to a - color palette of 8 pixels, not enough to display nice pictures. To get around this, we use binary code modulation. + colour palette of 8 pixels, not enough to display nice pictures. To get around this, we use binary code modulation. Binary code modulation is somewhat like PWM, but easier to implement in our case. First, we define the time we would refresh the display without binary code modulation as the 'frame time'. For, say, a four-bit binary code modulation, the frame time is divided into 15 ticks of equal length. -- cgit v1.3.1 From a367a055c9c27478b35ff53ad395034866e259d9 Mon Sep 17 00:00:00 2001 From: Elliot Matson <1711604+elliotmatson@users.noreply.github.com> Date: Sun, 29 Jan 2023 10:18:23 -0600 Subject: Fix printf formatting These lines threw errors with Arduino as an ESP-IDF component, looks like Arduino might be automatically casting them? --- src/platforms/esp32/esp32_i2s_parallel_dma.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/platforms/esp32/esp32_i2s_parallel_dma.cpp b/src/platforms/esp32/esp32_i2s_parallel_dma.cpp index 6b64200..f74274e 100644 --- a/src/platforms/esp32/esp32_i2s_parallel_dma.cpp +++ b/src/platforms/esp32/esp32_i2s_parallel_dma.cpp @@ -291,7 +291,7 @@ static void IRAM_ATTR irq_hndlr(void* arg) { // if we use I2S1 (default) ///auto _div_num = 80000000L/freq; - ESP_LOGD("ESP32", "i2s pll_d2_clock clkm_div_num is: %d", _div_num); + ESP_LOGD("ESP32", "i2s pll_d2_clock clkm_div_num is: %ld", _div_num); dev->clkm_conf.clka_en=1; // Use the 80mhz system clock (PLL_D2_CLK) when '0' dev->clkm_conf.clkm_div_a = 1; // Clock denominator @@ -304,7 +304,7 @@ static void IRAM_ATTR irq_hndlr(void* arg) { // if we use I2S1 (default) output_freq = output_freq + 0; // work around arudino 'unused var' issue if debug isn't enabled. - ESP_LOGI("ESP32/S2", "Output frequency is %d Mhz??", (output_freq/1000000/i2s_parallel_get_memory_width(ESP32_I2S_DEVICE, 16))); + ESP_LOGI("ESP32/S2", "Output frequency is %ld Mhz??", (output_freq/1000000/i2s_parallel_get_memory_width(ESP32_I2S_DEVICE, 16))); // Setup i2s clock @@ -662,4 +662,4 @@ static void IRAM_ATTR irq_hndlr(void* arg) { // if we use I2S1 (default) -#endif \ No newline at end of file +#endif -- cgit v1.3.1 From 734816f5f39a2111d68246a85b416873b9f1757e Mon Sep 17 00:00:00 2001 From: Elliot Matson Date: Sun, 29 Jan 2023 20:11:02 -0600 Subject: test with new deps --- examples/PIO_TestPatterns/platformio.ini | 25 +++---------------------- 1 file changed, 3 insertions(+), 22 deletions(-) diff --git a/examples/PIO_TestPatterns/platformio.ini b/examples/PIO_TestPatterns/platformio.ini index 3505b2d..d30d57f 100644 --- a/examples/PIO_TestPatterns/platformio.ini +++ b/examples/PIO_TestPatterns/platformio.ini @@ -9,6 +9,9 @@ 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 @@ -19,22 +22,12 @@ monitor_filters = esp32_exception_decoder 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] @@ -43,8 +36,6 @@ build_flags = -DNO_GFX -DNO_FAST_FUNCTIONS -DNO_CIE1931 -lib_deps = - ${env.lib_deps} ; Virtual Panel test [env:vpane] @@ -52,11 +43,6 @@ 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] @@ -66,11 +52,6 @@ build_flags = -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) ;[env:idfarduino] -- cgit v1.3.1 From f6ac9357c90a5f32b1732723a621e22a59076052 Mon Sep 17 00:00:00 2001 From: Elliot Matson Date: Sun, 29 Jan 2023 20:25:59 -0600 Subject: Use proper ci matrix --- .github/workflows/pio_build.yml | 6 ++++++ examples/PIO_TestPatterns/platformio.ini | 35 -------------------------------- examples/PIO_TestPatterns/src/main.cpp | 6 +++--- 3 files changed, 9 insertions(+), 38 deletions(-) diff --git a/.github/workflows/pio_build.yml b/.github/workflows/pio_build.yml index 39901f9..6258798 100644 --- a/.github/workflows/pio_build.yml +++ b/.github/workflows/pio_build.yml @@ -18,7 +18,13 @@ jobs: matrix: example: - "examples/PIO_TestPatterns" + no_gfx: ["", -DNO_GFX] + no_fast_functions: ["", -DFAST_FUNCTIONS] + no_cie1931: ["", -DNO_CIE1931] + virtual_panel: ["", -DVIRTUAL_PANEL] + env: + PLATFORMIO_BUILD_FLAGS: ${{ matrix.no_gfx }} ${{ matrix.no_fast_functions }} ${{ matrix.no_cie1931 }} ${{ matrix.virtual_panel steps: - uses: actions/checkout@v2 - name: Cache pip diff --git a/examples/PIO_TestPatterns/platformio.ini b/examples/PIO_TestPatterns/platformio.ini index d30d57f..379d2bb 100644 --- a/examples/PIO_TestPatterns/platformio.ini +++ b/examples/PIO_TestPatterns/platformio.ini @@ -18,41 +18,6 @@ upload_speed = 460800 monitor_speed = 115200 monitor_filters = esp32_exception_decoder -[env:esp32] -build_flags = - ${env.build_flags} - -DTEST_FASTLINES - -[env:debug] -build_flags = - ${env.build_flags} - -DTEST_FASTLINES - -DSERIAL_DEBUG - -; build without GFX functions -[env:minimal] -build_flags = - ${env.build_flags} - -DNO_GFX - -DNO_FAST_FUNCTIONS - -DNO_CIE1931 - -; Virtual Panel test -[env:vpane] -build_flags = - ${env.build_flags} - -DNO_FAST_FUNCTIONS - -DVIRTUAL_PANE - -; Virtual Panel test -[env:vpane_minimal] -build_flags = - ${env.build_flags} - -DVIRTUAL_PANE - -DNO_GFX - -DNO_FAST_FUNCTIONS - -DNO_CIE1931 - ; PIO CI can't handle IDF git modules properly (yet) ;[env:idfarduino] ;platform = espressif32 diff --git a/examples/PIO_TestPatterns/src/main.cpp b/examples/PIO_TestPatterns/src/main.cpp index 6325b63..ef43fe3 100644 --- a/examples/PIO_TestPatterns/src/main.cpp +++ b/examples/PIO_TestPatterns/src/main.cpp @@ -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(); -- cgit v1.3.1 From 51e44ce4b8e1b59caf44e64908a9c54f8aad2b59 Mon Sep 17 00:00:00 2001 From: Elliot Matson Date: Sun, 29 Jan 2023 20:26:47 -0600 Subject: Github copilot lied to me --- .github/workflows/pio_build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pio_build.yml b/.github/workflows/pio_build.yml index 6258798..d587b37 100644 --- a/.github/workflows/pio_build.yml +++ b/.github/workflows/pio_build.yml @@ -24,7 +24,7 @@ jobs: virtual_panel: ["", -DVIRTUAL_PANEL] env: - PLATFORMIO_BUILD_FLAGS: ${{ matrix.no_gfx }} ${{ matrix.no_fast_functions }} ${{ matrix.no_cie1931 }} ${{ matrix.virtual_panel + PLATFORMIO_BUILD_FLAGS: ${{ matrix.no_gfx }} ${{ matrix.no_fast_functions }} ${{ matrix.no_cie1931 }} ${{ matrix.virtual_panel }} steps: - uses: actions/checkout@v2 - name: Cache pip -- cgit v1.3.1 From 0323b728aed9d542de75f5f6b0bf67070f616bbb Mon Sep 17 00:00:00 2001 From: Elliot Matson Date: Sun, 29 Jan 2023 20:28:31 -0600 Subject: Fix env's --- examples/PIO_TestPatterns/platformio.ini | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/examples/PIO_TestPatterns/platformio.ini b/examples/PIO_TestPatterns/platformio.ini index 379d2bb..7150f4c 100644 --- a/examples/PIO_TestPatterns/platformio.ini +++ b/examples/PIO_TestPatterns/platformio.ini @@ -1,9 +1,9 @@ [platformio] -;default_envs = esp32 +default_envs = esp32 description = HUB75 ESP32 I2S DMA test patterns example ;src_dir = src -[env] +[env:esp32] framework = arduino platform = espressif32 board = wemos_d1_mini32 -- cgit v1.3.1 From e7f2ac6805f158b4a8628daab89be1b12bcc0bdf Mon Sep 17 00:00:00 2001 From: Elliot Matson Date: Sun, 29 Jan 2023 20:30:47 -0600 Subject: Just to be sure --- .github/workflows/pio_build.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/pio_build.yml b/.github/workflows/pio_build.yml index d587b37..96631f2 100644 --- a/.github/workflows/pio_build.yml +++ b/.github/workflows/pio_build.yml @@ -26,6 +26,8 @@ jobs: env: PLATFORMIO_BUILD_FLAGS: ${{ matrix.no_gfx }} ${{ matrix.no_fast_functions }} ${{ matrix.no_cie1931 }} ${{ matrix.virtual_panel }} steps: + - name: Show Build Flags + run: echo $PLATFORMIO_BUILD_FLAGS - uses: actions/checkout@v2 - name: Cache pip uses: actions/cache@v2 -- cgit v1.3.1 From 2a85977eba64709d600f574ee1d620bd978f038c Mon Sep 17 00:00:00 2001 From: Elliot Matson Date: Sun, 29 Jan 2023 20:33:37 -0600 Subject: fix flags --- .github/workflows/pio_build.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/pio_build.yml b/.github/workflows/pio_build.yml index 96631f2..43f9de7 100644 --- a/.github/workflows/pio_build.yml +++ b/.github/workflows/pio_build.yml @@ -19,9 +19,9 @@ jobs: example: - "examples/PIO_TestPatterns" no_gfx: ["", -DNO_GFX] - no_fast_functions: ["", -DFAST_FUNCTIONS] + no_fast_functions: ["", -DNO_FAST_FUNCTIONS] no_cie1931: ["", -DNO_CIE1931] - virtual_panel: ["", -DVIRTUAL_PANEL] + virtual_panel: ["", -DVIRTUAL_PANE] env: PLATFORMIO_BUILD_FLAGS: ${{ matrix.no_gfx }} ${{ matrix.no_fast_functions }} ${{ matrix.no_cie1931 }} ${{ matrix.virtual_panel }} -- cgit v1.3.1 From 84c2fbf755e68c5689209a9e56dc1e6ca3e73156 Mon Sep 17 00:00:00 2001 From: Elliot Matson Date: Sun, 29 Jan 2023 20:36:36 -0600 Subject: continue jobs on error --- .github/workflows/pio_build.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/pio_build.yml b/.github/workflows/pio_build.yml index 43f9de7..60a9cf7 100644 --- a/.github/workflows/pio_build.yml +++ b/.github/workflows/pio_build.yml @@ -14,6 +14,7 @@ jobs: build: runs-on: ubuntu-latest + continue-on-error: true strategy: matrix: example: -- cgit v1.3.1 From bc3f2ce5c036bc1ca15d792d403a490f2324973c Mon Sep 17 00:00:00 2001 From: Elliot Matson <1711604+elliotmatson@users.noreply.github.com> Date: Sun, 29 Jan 2023 20:41:58 -0600 Subject: Create dependabot.yml --- .github/dependabot.yml | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 .github/dependabot.yml diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..90e05c4 --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,11 @@ +# To get started with Dependabot version updates, you'll need to specify which +# package ecosystems to update and where the package manifests are located. +# Please see the documentation for all configuration options: +# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates + +version: 2 +updates: + - package-ecosystem: "github-actions" # See documentation for possible values + directory: "/" # Location of package manifests + schedule: + interval: "weekly" -- cgit v1.3.1 From 960e7b1768917234ae860d699d69c25f363cbb04 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 30 Jan 2023 02:42:17 +0000 Subject: Bump actions/checkout from 2 to 3 Bumps [actions/checkout](https://github.com/actions/checkout) from 2 to 3. - [Release notes](https://github.com/actions/checkout/releases) - [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md) - [Commits](https://github.com/actions/checkout/compare/v2...v3) --- updated-dependencies: - dependency-name: actions/checkout dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] --- .github/workflows/pio_build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pio_build.yml b/.github/workflows/pio_build.yml index 60a9cf7..316b803 100644 --- a/.github/workflows/pio_build.yml +++ b/.github/workflows/pio_build.yml @@ -29,7 +29,7 @@ jobs: steps: - name: Show Build Flags run: echo $PLATFORMIO_BUILD_FLAGS - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - name: Cache pip uses: actions/cache@v2 with: -- cgit v1.3.1 From ab13f2692d94812f195403941cc9a7352416adb7 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 30 Jan 2023 02:42:20 +0000 Subject: Bump actions/setup-python from 2 to 4 Bumps [actions/setup-python](https://github.com/actions/setup-python) from 2 to 4. - [Release notes](https://github.com/actions/setup-python/releases) - [Commits](https://github.com/actions/setup-python/compare/v2...v4) --- updated-dependencies: - dependency-name: actions/setup-python dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] --- .github/workflows/pio_build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pio_build.yml b/.github/workflows/pio_build.yml index 60a9cf7..378d51c 100644 --- a/.github/workflows/pio_build.yml +++ b/.github/workflows/pio_build.yml @@ -42,7 +42,7 @@ jobs: path: ~/.platformio key: ${{ runner.os }}-${{ hashFiles('**/lockfiles') }} - name: Set up Python 3.x - uses: actions/setup-python@v2 + uses: actions/setup-python@v4 with: python-version: '3.x' - name: Install Platformio -- cgit v1.3.1 From fe1ebbe40f9801263b456bb4d96395ef711dff74 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 30 Jan 2023 02:42:23 +0000 Subject: Bump actions/cache from 2 to 3 Bumps [actions/cache](https://github.com/actions/cache) from 2 to 3. - [Release notes](https://github.com/actions/cache/releases) - [Changelog](https://github.com/actions/cache/blob/main/RELEASES.md) - [Commits](https://github.com/actions/cache/compare/v2...v3) --- updated-dependencies: - dependency-name: actions/cache dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] --- .github/workflows/pio_build.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/pio_build.yml b/.github/workflows/pio_build.yml index 60a9cf7..192b022 100644 --- a/.github/workflows/pio_build.yml +++ b/.github/workflows/pio_build.yml @@ -31,13 +31,13 @@ jobs: run: echo $PLATFORMIO_BUILD_FLAGS - uses: actions/checkout@v2 - name: Cache pip - uses: actions/cache@v2 + uses: actions/cache@v3 with: path: ~/.cache/pip key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }} restore-keys: ${{ runner.os }}-pip- - name: Cache PlatformIO - uses: actions/cache@v2 + uses: actions/cache@v3 with: path: ~/.platformio key: ${{ runner.os }}-${{ hashFiles('**/lockfiles') }} -- cgit v1.3.1 From 15a5aa4ec123b06b1d6e90b8a9bc846821b613d0 Mon Sep 17 00:00:00 2001 From: Elliot Matson Date: Sun, 29 Jan 2023 20:44:02 -0600 Subject: update --- .github/workflows/pio_build.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/pio_build.yml b/.github/workflows/pio_build.yml index 6ad6e7a..4aed7ab 100644 --- a/.github/workflows/pio_build.yml +++ b/.github/workflows/pio_build.yml @@ -24,8 +24,6 @@ jobs: no_cie1931: ["", -DNO_CIE1931] virtual_panel: ["", -DVIRTUAL_PANE] - env: - PLATFORMIO_BUILD_FLAGS: ${{ matrix.no_gfx }} ${{ matrix.no_fast_functions }} ${{ matrix.no_cie1931 }} ${{ matrix.virtual_panel }} steps: - name: Show Build Flags run: echo $PLATFORMIO_BUILD_FLAGS @@ -52,6 +50,7 @@ jobs: pio update - name: Run PlatformIO env: + PLATFORMIO_BUILD_FLAGS: ${{ matrix.no_gfx }} ${{ matrix.no_fast_functions }} ${{ matrix.no_cie1931 }} ${{ matrix.virtual_panel }} PLATFORMIO_CI_SRC: ${{ matrix.example }} run: | pio ci -c ${{ matrix.example }}/platformio.ini \ No newline at end of file -- cgit v1.3.1 From 1ca5ee92c8d14dd74fa30092a9896f18748d8dcf Mon Sep 17 00:00:00 2001 From: Elliot Matson Date: Sun, 29 Jan 2023 20:49:18 -0600 Subject: Add exclusions --- .github/workflows/pio_build.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/pio_build.yml b/.github/workflows/pio_build.yml index 4aed7ab..8430a52 100644 --- a/.github/workflows/pio_build.yml +++ b/.github/workflows/pio_build.yml @@ -23,6 +23,9 @@ jobs: no_fast_functions: ["", -DNO_FAST_FUNCTIONS] no_cie1931: ["", -DNO_CIE1931] virtual_panel: ["", -DVIRTUAL_PANE] + exclude: + - no_fast_functions: "" + virtual_panel: -DVIRTUAL_PANE steps: - name: Show Build Flags -- cgit v1.3.1 From 28acbea6d368ad931e39c5a6561d52aeeddda8f3 Mon Sep 17 00:00:00 2001 From: Elliot Matson Date: Sun, 29 Jan 2023 20:52:35 -0600 Subject: Clean up older PIO actions --- .github/workflows/pio_build.yml | 27 +++++++++------------------ 1 file changed, 9 insertions(+), 18 deletions(-) diff --git a/.github/workflows/pio_build.yml b/.github/workflows/pio_build.yml index 8430a52..127694a 100644 --- a/.github/workflows/pio_build.yml +++ b/.github/workflows/pio_build.yml @@ -28,32 +28,23 @@ jobs: virtual_panel: -DVIRTUAL_PANE steps: - - name: Show Build Flags - run: echo $PLATFORMIO_BUILD_FLAGS - - uses: actions/checkout@v3 - - name: Cache pip + - name: Checkout + uses: actions/checkout@v3 + - name: Cache pip and platformio uses: actions/cache@v3 with: - path: ~/.cache/pip - key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }} - restore-keys: ${{ runner.os }}-pip- - - name: Cache PlatformIO - uses: actions/cache@v3 - with: - path: ~/.platformio - key: ${{ runner.os }}-${{ hashFiles('**/lockfiles') }} + path: | + ~/.cache/pip + ~/.platformio/.cache + key: ${{ runner.os }}-pio - name: Set up Python 3.x uses: actions/setup-python@v4 with: python-version: '3.x' - name: Install Platformio - run: | - python -m pip install --upgrade pip - pip install --upgrade platformio - pio update + run: pip install --upgrade platformio - name: Run PlatformIO env: PLATFORMIO_BUILD_FLAGS: ${{ matrix.no_gfx }} ${{ matrix.no_fast_functions }} ${{ matrix.no_cie1931 }} ${{ matrix.virtual_panel }} PLATFORMIO_CI_SRC: ${{ matrix.example }} - run: | - pio ci -c ${{ matrix.example }}/platformio.ini \ No newline at end of file + run: pio ci -c ${{ matrix.example }}/platformio.ini \ No newline at end of file -- cgit v1.3.1 From a775b3a62ea2405afe20363fbfdbe1ff6c956bd9 Mon Sep 17 00:00:00 2001 From: Elliot Matson Date: Sun, 29 Jan 2023 20:54:37 -0600 Subject: testing time with cache --- .github/workflows/pio_build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pio_build.yml b/.github/workflows/pio_build.yml index 127694a..e15bf15 100644 --- a/.github/workflows/pio_build.yml +++ b/.github/workflows/pio_build.yml @@ -13,7 +13,7 @@ on: jobs: build: - runs-on: ubuntu-latest + runs-on: ubuntu-latest continue-on-error: true strategy: matrix: -- cgit v1.3.1 From 035e0e0d2f772e92ecec49ffc0484e5e910a7fb6 Mon Sep 17 00:00:00 2001 From: Elliot Matson Date: Sun, 29 Jan 2023 21:03:19 -0600 Subject: restructure for esp-idf --- .github/workflows/pio_build.yml | 2 +- examples/PIO_TestPatterns/platformio.ini | 15 ++++++--------- 2 files changed, 7 insertions(+), 10 deletions(-) diff --git a/.github/workflows/pio_build.yml b/.github/workflows/pio_build.yml index e15bf15..252febe 100644 --- a/.github/workflows/pio_build.yml +++ b/.github/workflows/pio_build.yml @@ -47,4 +47,4 @@ jobs: env: PLATFORMIO_BUILD_FLAGS: ${{ matrix.no_gfx }} ${{ matrix.no_fast_functions }} ${{ matrix.no_cie1931 }} ${{ matrix.virtual_panel }} PLATFORMIO_CI_SRC: ${{ matrix.example }} - run: pio ci -c ${{ matrix.example }}/platformio.ini \ No newline at end of file + run: pio ci -e esp32 -c ${{ matrix.example }}/platformio.ini \ No newline at end of file diff --git a/examples/PIO_TestPatterns/platformio.ini b/examples/PIO_TestPatterns/platformio.ini index 7150f4c..6d154a2 100644 --- a/examples/PIO_TestPatterns/platformio.ini +++ b/examples/PIO_TestPatterns/platformio.ini @@ -3,8 +3,7 @@ default_envs = esp32 description = HUB75 ESP32 I2S DMA test patterns example ;src_dir = src -[env:esp32] -framework = arduino +[env] platform = espressif32 board = wemos_d1_mini32 lib_deps = @@ -13,24 +12,22 @@ lib_deps = 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] +framework = arduino + ; PIO CI can't handle IDF git modules properly (yet) -;[env:idfarduino] -;platform = espressif32 +[env:esp32idf] ;platform_packages = ; ; use a special branch ; framework-arduinoespressif32 @ https://github.com/espressif/arduino-esp32.git#idf-release/v4.4 -;framework = arduino, espidf +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 -- cgit v1.3.1 From 9b706f9599e90dfe4cc2a95a643c94225e52ab49 Mon Sep 17 00:00:00 2001 From: Elliot Matson Date: Sun, 29 Jan 2023 21:07:24 -0600 Subject: test esp-idf --- .github/workflows/pio_build.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/pio_build.yml b/.github/workflows/pio_build.yml index 252febe..edc157c 100644 --- a/.github/workflows/pio_build.yml +++ b/.github/workflows/pio_build.yml @@ -46,5 +46,6 @@ jobs: - name: Run PlatformIO env: PLATFORMIO_BUILD_FLAGS: ${{ matrix.no_gfx }} ${{ matrix.no_fast_functions }} ${{ matrix.no_cie1931 }} ${{ matrix.virtual_panel }} - PLATFORMIO_CI_SRC: ${{ matrix.example }} - run: pio ci -e esp32 -c ${{ matrix.example }}/platformio.ini \ No newline at end of file +# PLATFORMIO_CI_SRC: ${{ matrix.example }} +# run: pio ci -e esp32 -c ${{ matrix.example }}/platformio.ini + run: pio run -d ${{ matrix.example }} -e esp32idf -c ${{ matrix.example }}/platformio.ini \ No newline at end of file -- cgit v1.3.1 From 0f62898bae25753937e4479e525182bd38dc14c9 Mon Sep 17 00:00:00 2001 From: Elliot Matson Date: Sun, 29 Jan 2023 21:09:10 -0600 Subject: fix includes --- examples/PIO_TestPatterns/src/main.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/examples/PIO_TestPatterns/src/main.cpp b/examples/PIO_TestPatterns/src/main.cpp index ef43fe3..cb132e3 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 #include #include #include #include #include "sdkconfig.h" -*/ + #include #include "xtensa/core-macros.h" #ifdef VIRTUAL_PANE -- cgit v1.3.1 From 6378731cbcb39da81fdb94aacebe6e99c3f310b6 Mon Sep 17 00:00:00 2001 From: Elliot Matson Date: Sun, 29 Jan 2023 21:20:47 -0600 Subject: Fix sdkconfig --- .github/workflows/pio_build.yml | 2 +- examples/PIO_TestPatterns/sdkconfig.defaults | 3 ++- examples/PIO_TestPatterns/src/main.cpp | 1 + 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/pio_build.yml b/.github/workflows/pio_build.yml index edc157c..ed37c86 100644 --- a/.github/workflows/pio_build.yml +++ b/.github/workflows/pio_build.yml @@ -13,7 +13,7 @@ on: jobs: build: - runs-on: ubuntu-latest + runs-on: ubuntu-latest continue-on-error: true strategy: matrix: 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 cb132e3..e8611ae 100644 --- a/examples/PIO_TestPatterns/src/main.cpp +++ b/examples/PIO_TestPatterns/src/main.cpp @@ -8,6 +8,7 @@ #include #include #include "sdkconfig.h" +// IDF #include #include "xtensa/core-macros.h" -- cgit v1.3.1 From 2c86ceee73a45193e7c31c1f6d6558c77c95c085 Mon Sep 17 00:00:00 2001 From: Elliot Matson Date: Sun, 29 Jan 2023 21:25:24 -0600 Subject: does CI work now? --- .github/workflows/pio_build.yml | 5 +++-- examples/PIO_TestPatterns/src/main.cpp | 5 ++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/pio_build.yml b/.github/workflows/pio_build.yml index ed37c86..1df24f3 100644 --- a/.github/workflows/pio_build.yml +++ b/.github/workflows/pio_build.yml @@ -46,6 +46,7 @@ jobs: - name: Run PlatformIO env: PLATFORMIO_BUILD_FLAGS: ${{ matrix.no_gfx }} ${{ matrix.no_fast_functions }} ${{ matrix.no_cie1931 }} ${{ matrix.virtual_panel }} -# PLATFORMIO_CI_SRC: ${{ matrix.example }} + PLATFORMIO_CI_SRC: ${{ matrix.example }} # run: pio ci -e esp32 -c ${{ matrix.example }}/platformio.ini - run: pio run -d ${{ matrix.example }} -e esp32idf -c ${{ matrix.example }}/platformio.ini \ No newline at end of file + run: pio ci -e esp32idf -c ${{ matrix.example }}/platformio.ini +# run: pio run -d ${{ matrix.example }} -e esp32idf -c ${{ matrix.example }}/platformio.ini \ No newline at end of file diff --git a/examples/PIO_TestPatterns/src/main.cpp b/examples/PIO_TestPatterns/src/main.cpp index e8611ae..83abcc3 100644 --- a/examples/PIO_TestPatterns/src/main.cpp +++ b/examples/PIO_TestPatterns/src/main.cpp @@ -1,14 +1,13 @@ // 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 #include #include #include #include "sdkconfig.h" -// IDF +//#endif #include #include "xtensa/core-macros.h" -- cgit v1.3.1 From 9901c2352d9ad9b33e46688c5dbfb2bf7c5e68fa Mon Sep 17 00:00:00 2001 From: Elliot Matson Date: Sun, 29 Jan 2023 21:39:05 -0600 Subject: verbose --- .github/workflows/pio_build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pio_build.yml b/.github/workflows/pio_build.yml index 1df24f3..a2e9190 100644 --- a/.github/workflows/pio_build.yml +++ b/.github/workflows/pio_build.yml @@ -48,5 +48,5 @@ jobs: PLATFORMIO_BUILD_FLAGS: ${{ matrix.no_gfx }} ${{ matrix.no_fast_functions }} ${{ matrix.no_cie1931 }} ${{ matrix.virtual_panel }} PLATFORMIO_CI_SRC: ${{ matrix.example }} # run: pio ci -e esp32 -c ${{ matrix.example }}/platformio.ini - run: pio ci -e esp32idf -c ${{ matrix.example }}/platformio.ini + run: pio ci -v -e esp32idf -c ${{ matrix.example }}/platformio.ini # run: pio run -d ${{ matrix.example }} -e esp32idf -c ${{ matrix.example }}/platformio.ini \ No newline at end of file -- cgit v1.3.1 From fda92b77af1a341c8f55ee04100b099222cb898a Mon Sep 17 00:00:00 2001 From: Elliot Matson Date: Sun, 29 Jan 2023 21:53:57 -0600 Subject: Add final switch to IDF --- .github/workflows/pio_build.yml | 14 ++++++++++---- examples/PIO_TestPatterns/src/main.cpp | 4 ++-- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/.github/workflows/pio_build.yml b/.github/workflows/pio_build.yml index a2e9190..af4cb29 100644 --- a/.github/workflows/pio_build.yml +++ b/.github/workflows/pio_build.yml @@ -23,6 +23,7 @@ jobs: no_fast_functions: ["", -DNO_FAST_FUNCTIONS] no_cie1931: ["", -DNO_CIE1931] virtual_panel: ["", -DVIRTUAL_PANE] + idf: [true, false] exclude: - no_fast_functions: "" virtual_panel: -DVIRTUAL_PANE @@ -43,10 +44,15 @@ jobs: python-version: '3.x' - name: Install Platformio run: pip install --upgrade platformio - - name: Run PlatformIO + - name: Run PlatformIO CI (Arduino) + if: ${{ !matrix.idf}} env: PLATFORMIO_BUILD_FLAGS: ${{ matrix.no_gfx }} ${{ matrix.no_fast_functions }} ${{ matrix.no_cie1931 }} ${{ matrix.virtual_panel }} PLATFORMIO_CI_SRC: ${{ matrix.example }} -# run: pio ci -e esp32 -c ${{ matrix.example }}/platformio.ini - run: pio ci -v -e esp32idf -c ${{ matrix.example }}/platformio.ini -# run: pio run -d ${{ matrix.example }} -e esp32idf -c ${{ matrix.example }}/platformio.ini \ No newline at end of file + run: pio ci -e esp32 -c ${{ matrix.example }}/platformio.ini + - name: Run PlatformIO CI (ESP-IDF) + if: ${{ matrix.idf }} + env: + PLATFORMIO_BUILD_FLAGS: -DIDF_BUILD ${{ matrix.no_gfx }} ${{ matrix.no_fast_functions }} ${{ matrix.no_cie1931 }} ${{ matrix.virtual_panel }} + # pio ci doesn't use our sdkconfig, so we have to use pio run + run: pio run -d ${{ matrix.example }} -e esp32idf -c ${{ matrix.example }}/platformio.ini diff --git a/examples/PIO_TestPatterns/src/main.cpp b/examples/PIO_TestPatterns/src/main.cpp index 83abcc3..40d077e 100644 --- a/examples/PIO_TestPatterns/src/main.cpp +++ b/examples/PIO_TestPatterns/src/main.cpp @@ -1,13 +1,13 @@ // How to use this library with a FM6126 panel, thanks goes to: // https://github.com/hzeller/rpi-rgb-led-matrix/issues/746 -//#ifdef IDF_BUILD +#ifdef IDF_BUILD #include #include #include #include #include "sdkconfig.h" -//#endif +#endif #include #include "xtensa/core-macros.h" -- cgit v1.3.1 From a85b0e649ffa9da618b1610cecd212b72800d3bc Mon Sep 17 00:00:00 2001 From: Elliot Matson Date: Sun, 29 Jan 2023 22:02:30 -0600 Subject: A bit of cleanup and re-ordering --- .github/workflows/pio_build.yml | 11 +++++------ examples/PIO_TestPatterns/platformio.ini | 10 ---------- 2 files changed, 5 insertions(+), 16 deletions(-) diff --git a/.github/workflows/pio_build.yml b/.github/workflows/pio_build.yml index af4cb29..d64bda4 100644 --- a/.github/workflows/pio_build.yml +++ b/.github/workflows/pio_build.yml @@ -14,16 +14,15 @@ jobs: build: runs-on: ubuntu-latest - continue-on-error: true strategy: matrix: - example: - - "examples/PIO_TestPatterns" + framework: ["Arduino", "IDF"] no_gfx: ["", -DNO_GFX] no_fast_functions: ["", -DNO_FAST_FUNCTIONS] no_cie1931: ["", -DNO_CIE1931] virtual_panel: ["", -DVIRTUAL_PANE] - idf: [true, false] + example: + - "examples/PIO_TestPatterns" exclude: - no_fast_functions: "" virtual_panel: -DVIRTUAL_PANE @@ -45,13 +44,13 @@ jobs: - name: Install Platformio run: pip install --upgrade platformio - name: Run PlatformIO CI (Arduino) - if: ${{ !matrix.idf}} + if: ${{ matrix.framework == 'Arduino'}} env: PLATFORMIO_BUILD_FLAGS: ${{ matrix.no_gfx }} ${{ matrix.no_fast_functions }} ${{ matrix.no_cie1931 }} ${{ matrix.virtual_panel }} PLATFORMIO_CI_SRC: ${{ matrix.example }} run: pio ci -e esp32 -c ${{ matrix.example }}/platformio.ini - name: Run PlatformIO CI (ESP-IDF) - if: ${{ matrix.idf }} + if: ${{ matrix.framework == 'IDF'}} env: PLATFORMIO_BUILD_FLAGS: -DIDF_BUILD ${{ matrix.no_gfx }} ${{ matrix.no_fast_functions }} ${{ matrix.no_cie1931 }} ${{ matrix.virtual_panel }} # pio ci doesn't use our sdkconfig, so we have to use pio run diff --git a/examples/PIO_TestPatterns/platformio.ini b/examples/PIO_TestPatterns/platformio.ini index 6d154a2..185513a 100644 --- a/examples/PIO_TestPatterns/platformio.ini +++ b/examples/PIO_TestPatterns/platformio.ini @@ -19,15 +19,5 @@ monitor_filters = esp32_exception_decoder [env:esp32] framework = arduino -; PIO CI can't handle IDF git modules properly (yet) [env:esp32idf] -;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 -- cgit v1.3.1 From 572e310fc49f7f03cd94a031373490facd0d3a4a Mon Sep 17 00:00:00 2001 From: mrfaptastic <12006953+mrfaptastic@users.noreply.github.com> Date: Mon, 30 Jan 2023 04:19:26 +0000 Subject: Update BuildOptions.md --- doc/BuildOptions.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/doc/BuildOptions.md b/doc/BuildOptions.md index 9069b83..b2fbf03 100644 --- a/doc/BuildOptions.md +++ b/doc/BuildOptions.md @@ -15,6 +15,9 @@ build_flags = -DNO_GFX=1 (etc.....) ``` +Or if using Arduino: 'Tools' menu > 'Core Debug Level' > Select 'Debug' + +... and use the Serial output to see the debug information. ## Build flags -- cgit v1.3.1 From fbce0fdcbce1d57ee6b45f94b2ae78a8e593cd1c Mon Sep 17 00:00:00 2001 From: mrfaptastic <12006953+mrfaptastic@users.noreply.github.com> Date: Tue, 31 Jan 2023 21:14:52 +0000 Subject: Document SPIRAM_DMA_BUFFER compile option Use SPIRAM/PSRAM for the HUB75 DMA buffer and not internal SRAM. ONLY SUPPORTED ON ESP32-S3 VARIANTS WITH OCTAL (not quad!) SPIRAM/PSRAM, as ony OCTAL PSRAM an provide the required data rate / bandwidth to drive the panels adequately. --- doc/BuildOptions.md | 1 + 1 file changed, 1 insertion(+) diff --git a/doc/BuildOptions.md b/doc/BuildOptions.md index b2fbf03..d620d52 100644 --- a/doc/BuildOptions.md +++ b/doc/BuildOptions.md @@ -29,6 +29,7 @@ Or if using Arduino: 'Tools' menu > 'Core Debug Level' > Select 'Debug' | **NO_FAST_FUNCTIONS** | Do not build auxiliary speed-optimized functions. Those are used to speed-up operations like drawing straight lines or rectangles. Otherwise lines/shapes are drawn using drawPixel() method. The trade-off for speed is RAM/code-size, take it or leave it ;) | If you are not using AdafruitGFX than you probably do not need this either| |**NO_CIE1931**|Do not use LED brightness [compensation](https://ledshield.wordpress.com/2012/11/13/led-brightness-to-your-eye-gamma-correction-no/) described in [CIE 1931](https://en.wikipedia.org/wiki/CIE_1931_color_space). Normally library would adjust every pixel's RGB888 so that luminance (or brightness control) for the corresponding LED's would appear 'linear' to the human's eye. I.e. a white dot with rgb(128,128,128) would seem to be at 50% brightness between rgb(0,0,0) and rgb(255,255,255). Normally you would like to keep this enabled by default. Not only it makes brightness control "linear", it also makes colours more vivid, otherwise it looks brighter but 'bleached'.|You might want to turn it off in some special cases like:
  • Using some other overlay lib for intermediate calculations that makes it's own compensation, like FastLED's [dimming functions](http://fastled.io/docs/3.1/group___dimming.html).
  • running at low colour depth's - it **might** (or might not) look better in shadows, darker gradients w/o compensation, try it
  • you run for as bright output as possible, no matter what (make sure you have proper powering)
  • you run for speed/save resources at all costs
| | **FORCE_COLOR_DEPTH** |In some cases the library may reduce colour fidelity to increase the refresh rate (i.e. reduce visible flicker). This is most likely to occur with a large chain of panels. However, if you want to force pure 24bpp colour, at the expense of likely noticeable flicker, then set this defined. |Not required in 99% of cases. +| **SPIRAM_DMA_BUFFER** |Use SPIRAM/PSRAM for the HUB75 DMA buffer and not internal SRAM. ONLY SUPPORTED ON ESP32-S3 VARIANTS WITH OCTAL (not quad!) SPIRAM/PSRAM, as ony OCTAL PSRAM an provide the required data rate / bandwidth to drive the panels adequately.|ONLY SUPPORTED ON ESP32-S3 VARIANTS WITH OCTAL (not quad) SPIRAM/PSRAM ## Build-time variables -- cgit v1.3.1 From f0929dc13552abf00917304ff04f1c76302632dc Mon Sep 17 00:00:00 2001 From: mrfaptastic <12006953+mrfaptastic@users.noreply.github.com> Date: Tue, 31 Jan 2023 21:23:55 +0000 Subject: Update README.md Include additional commentary on using SPIRAM/PSRAM --- README.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 4f4fd67..55568db 100644 --- a/README.md +++ b/README.md @@ -38,12 +38,12 @@ This ESP32 Arduino/IDF library for HUB75 / HUB75E connector type 64x32 RGB LED 1 - **CIE 1931** luminance [correction](https://ledshield.wordpress.com/2012/11/13/led-brightness-to-your-eye-gamma-correction-no/) (aka natural LED dimming) - **Adafruit GFX API** - library could be build with AdafruitGFX, simplified GFX or without GFX API at all -If you wanna ask "*...OK, OK, than what's the price for those features?*" I'll tell you - "[memory](/doc/memcalc.md), you pay it all by precious MCU's memory for DMA buffer". +If you wanna ask "*...OK, OK, than what's the price for those features?*" I'll tell you - "[memory](/doc/memcalc.md), you pay it all by precious MCU's internal memory (SRAM) for the DMA buffer". Please use the ['Memory Calculator'](/doc/memcalc.md) to see what is actually achievable with a typical ESP32. - ![Memory Calculator](doc/memcalc.jpg) +Note: Things are better for more recent ESP32 variants, refer [below](#memory-constraints) on how to use external SPIRAM/PSRAM for the DMA buffer which drives the HUB75 panels. ## ESP32 Supported @@ -148,9 +148,9 @@ Although Arduino IDE does not [seem](https://github.com/arduino/Arduino/issues/4 ## Memory constraints If you are going to use large/combined panels make sure to check for [memory constraints](/doc/i2s_memcalc.md). -NOTE: You can use PSRAM to expand the amount of memory available only on the ESP32-S3 and with Octal SPI-RAM (ESP32 S3 N8R8 variant). However, due to bandwidth limitations, the maximum output frequency is 10Mhz, which will limit the real world number of panels that can be chained without the refresh rate being impacted. +NOTE: You can use SPIRAM/PSRAM to drive the HUB75 DMA buffer only on the ESP32-S3 and with Octal SPI-RAM (i.e. ESP32 S3 N8R8 variant). However, due to bandwidth limitations, the maximum output frequency is limited to approx. 16Mhz, which will limit the real world number of panels that can be chained without flicker being obvious. This is enabled at compile time, refer to [the build options](/doc/BuildOptions.md) to enable. -For all other ESP32 variants (like the most popular ‘original’ ESP32), the hardware [only allows DMA transfer from *internal* SRAM](https://github.com/mrfaptastic/ESP32-HUB75-MatrixPanel-I2S-DMA/issues/55), so you will be limited to the 200KB or so of usable SRAM of the ESP32 regardless of how many megabytes of PSRAM you may have connected. +For all other ESP32 variants (like the most popular ‘original’ ESP32), [only *internal* SRAM can be used](https://github.com/mrfaptastic/ESP32-HUB75-MatrixPanel-I2S-DMA/issues/55), so you will be limited to the ~200KB or so of 'free' SRAM regardless of how many megabytes of SPIRAM/PSRAM you may have connected. ## Can I use with a larger panel (i.e. 64x64px square panel)? If you want to use with a 64x64 pixel panel (typically a HUB75*E* panel) you MUST configure a valid *E_PIN* to your ESP32 and connect it to the E pin of the HUB75 panel! Hence the 'E' in 'HUB75E' -- cgit v1.3.1 From a0f9ab6830e5377bf0799f46356781807482e3fc Mon Sep 17 00:00:00 2001 From: mrfaptastic <12006953+mrfaptastic@users.noreply.github.com> Date: Tue, 31 Jan 2023 21:29:32 +0000 Subject: Update BuildOptions.md --- doc/BuildOptions.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/BuildOptions.md b/doc/BuildOptions.md index d620d52..aa31ab7 100644 --- a/doc/BuildOptions.md +++ b/doc/BuildOptions.md @@ -29,7 +29,7 @@ Or if using Arduino: 'Tools' menu > 'Core Debug Level' > Select 'Debug' | **NO_FAST_FUNCTIONS** | Do not build auxiliary speed-optimized functions. Those are used to speed-up operations like drawing straight lines or rectangles. Otherwise lines/shapes are drawn using drawPixel() method. The trade-off for speed is RAM/code-size, take it or leave it ;) | If you are not using AdafruitGFX than you probably do not need this either| |**NO_CIE1931**|Do not use LED brightness [compensation](https://ledshield.wordpress.com/2012/11/13/led-brightness-to-your-eye-gamma-correction-no/) described in [CIE 1931](https://en.wikipedia.org/wiki/CIE_1931_color_space). Normally library would adjust every pixel's RGB888 so that luminance (or brightness control) for the corresponding LED's would appear 'linear' to the human's eye. I.e. a white dot with rgb(128,128,128) would seem to be at 50% brightness between rgb(0,0,0) and rgb(255,255,255). Normally you would like to keep this enabled by default. Not only it makes brightness control "linear", it also makes colours more vivid, otherwise it looks brighter but 'bleached'.|You might want to turn it off in some special cases like:
  • Using some other overlay lib for intermediate calculations that makes it's own compensation, like FastLED's [dimming functions](http://fastled.io/docs/3.1/group___dimming.html).
  • running at low colour depth's - it **might** (or might not) look better in shadows, darker gradients w/o compensation, try it
  • you run for as bright output as possible, no matter what (make sure you have proper powering)
  • you run for speed/save resources at all costs
| | **FORCE_COLOR_DEPTH** |In some cases the library may reduce colour fidelity to increase the refresh rate (i.e. reduce visible flicker). This is most likely to occur with a large chain of panels. However, if you want to force pure 24bpp colour, at the expense of likely noticeable flicker, then set this defined. |Not required in 99% of cases. -| **SPIRAM_DMA_BUFFER** |Use SPIRAM/PSRAM for the HUB75 DMA buffer and not internal SRAM. ONLY SUPPORTED ON ESP32-S3 VARIANTS WITH OCTAL (not quad!) SPIRAM/PSRAM, as ony OCTAL PSRAM an provide the required data rate / bandwidth to drive the panels adequately.|ONLY SUPPORTED ON ESP32-S3 VARIANTS WITH OCTAL (not quad) SPIRAM/PSRAM +| **SPIRAM_FRAMEBUFFER** |Use SPIRAM/PSRAM for the HUB75 DMA buffer and not internal SRAM. ONLY SUPPORTED ON ESP32-S3 VARIANTS WITH OCTAL (not quad!) SPIRAM/PSRAM, as ony OCTAL PSRAM an provide the required data rate / bandwidth to drive the panels adequately.|ONLY SUPPORTED ON ESP32-S3 VARIANTS WITH OCTAL (not quad) SPIRAM/PSRAM ## Build-time variables -- cgit v1.3.1 From 15763b12b115c71f4a8327dde16adb8f5cf461dd Mon Sep 17 00:00:00 2001 From: mrfaptastic <12006953+mrfaptastic@users.noreply.github.com> Date: Wed, 1 Feb 2023 21:04:19 +0000 Subject: Update documentation on higher scan rate panels Also breaks the VirtualMatrixPanel backward compatibility for 1/4 scan panels. --- README.md | 115 +++++++++------- doc/ScanRateGraphic.jpg | Bin 0 -> 113911 bytes doc/ScanRateGraphic.odp | Bin 0 -> 35732 bytes examples/Four_Scan_Panel/Four_Scan_Panel.ino | 153 +++++++++++++++++++++ examples/Four_Scan_Panel/README.md | 7 + .../One_Eight_1_8_ScanPanel.ino | 151 -------------------- examples/One_Eight_1_8_ScanPanel/README.md | 7 - src/ESP32-VirtualMatrixPanel-I2S-DMA.h | 32 +++-- 8 files changed, 242 insertions(+), 223 deletions(-) create mode 100644 doc/ScanRateGraphic.jpg create mode 100644 doc/ScanRateGraphic.odp create mode 100644 examples/Four_Scan_Panel/Four_Scan_Panel.ino create mode 100644 examples/Four_Scan_Panel/README.md delete mode 100644 examples/One_Eight_1_8_ScanPanel/One_Eight_1_8_ScanPanel.ino delete mode 100644 examples/One_Eight_1_8_ScanPanel/README.md diff --git a/README.md b/README.md index 55568db..31ca561 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# HUB75 RGB LED matrix library utilizing ESP32 DMA Engine +# HUB75 RGB LED matrix panel library utilizing ESP32 DMA __[BUILD OPTIONS](/doc/BuildOptions.md) | [EXAMPLES](/examples/README.md)__ | [![PlatformIO CI](https://github.com/mrfaptastic/ESP32-HUB75-MatrixPanel-DMA/actions/workflows/pio_build.yml/badge.svg)](https://github.com/mrfaptastic/ESP32-HUB75-MatrixPanel-DMA/actions/workflows/pio_build.yml) @@ -28,43 +28,57 @@ __[BUILD OPTIONS](/doc/BuildOptions.md) | [EXAMPLES](/examples/README.md)__ | [! - [Thank you!](#thank-you) ## Introduction -This ESP32 Arduino/IDF library for HUB75 / HUB75E connector type 64x32 RGB LED 1/16 Scan OR 64x64 RGB LED 1/32 Scan LED Matrix Panel, utilities the DMA functionality provided by the ESP32's 'LCD Mode'. +* This is an ESP32 Arduino/IDF library for HUB75 / HUB75E RGB LED panels. +* This library 'out of the box' (mostly) supports HUB75 panels where TWO rows/lines are updated in parallel... referred to as 'two scan' panels within this library's documentation. +* 'Four scan' panels are also supported - but please refer to the Four Scan Panel example. +* The library uses the DMA functionality provided by the ESP32's 'LCD Mode' for faster output. ### Features -- **Low CPU overhead** - once initialized pixel data is pumped to the matrix inputs via DMA engine directly from memory -- **Fast** - updating pixel data involves only bit-wise logic over DMA buffer memory, no pins manipulation or blocking IO -- **Full screen BCM** - library utilizes [binary-code modulation](http://www.batsocks.co.uk/readme/art_bcm_5.htm) to render pixel color depth / brightness over the entire matrix -- **Variable color depth** - up to TrueColor 24 bits output is possible depending on matrix size/refresh rate required -- **CIE 1931** luminance [correction](https://ledshield.wordpress.com/2012/11/13/led-brightness-to-your-eye-gamma-correction-no/) (aka natural LED dimming) -- **Adafruit GFX API** - library could be build with AdafruitGFX, simplified GFX or without GFX API at all +- **Low CPU overhead** - Pixel data is sent directly with the use of hardware-backed DMA, no CPU involvement +- **Fast** - Updating pixel data involves only bit-wise logic over DMA buffer memory, no pins manipulation or blocking IO +- **Full screen BCM** - Library utilizes [binary-code modulation](http://www.batsocks.co.uk/readme/art_bcm_5.htm) to render pixel color depth / brightness over the entire matrix to give reasonable colour depth +- **Variable color depth** - Up to TrueColor 24 bits output is possible depending on matrix size/refresh rate required +- **CIE 1931** luminance [correction](https://ledshield.wordpress.com/2012/11/13/led-brightness-to-your-eye-gamma-correction-no/) (aka natural LED dimming) implemented +- **Adafruit GFX API** - Library can be built with AdafruitGFX, simplified GFX or without a GFX API at all + +## ESP32 variants supported +* Original ESP32 - That being the ESP-WROOM-32 module with ESP32‑D0WDQ6 chip from ~2017. +* ESP32-S2; and +* ESP32-S3 -If you wanna ask "*...OK, OK, than what's the price for those features?*" I'll tell you - "[memory](/doc/memcalc.md), you pay it all by precious MCU's internal memory (SRAM) for the DMA buffer". +RISC-V ESP32's (like the C3) are not supported as they do not have the hardware 'LCD mode' required for this library. -Please use the ['Memory Calculator'](/doc/memcalc.md) to see what is actually achievable with a typical ESP32. -![Memory Calculator](doc/memcalc.jpg) +## Memory is required! +"*What's the price for those features?*" - It's [memory](/doc/memcalc.md), you pay it all by precious MCU's internal memory (SRAM) for the DMA buffer". -Note: Things are better for more recent ESP32 variants, refer [below](#memory-constraints) on how to use external SPIRAM/PSRAM for the DMA buffer which drives the HUB75 panels. +A typical 64x32px panel at 24bpp colour uses about 20kB of internal memory. +Please use the ['Memory Calculator'](/doc/memcalc.md) to see what is *typically* achievable with the typical ESP32. ![Memory Calculator](doc/memcalc.jpg) -## ESP32 Supported -This library supports the: -* Original ESP32 - That being the ESP-WROOM-32 module with ESP32‑D0WDQ6 chip from 2017. This MCU has 520kB of SRAM which is much more than all the recent 'reboots' of the ESP32 such as the S2, S3 etc. -* ESP32-S2; and -* ESP32-S3 +For the ESP32-S3 only, you can use SPIRAM/PSRAM to drive the HUB75 DMA buffer when using **Octal SPI-RAM** (i.e. ESP32 S3 N8R8 variant). However, due to bandwidth limitations, the maximum output frequency is limited to approx. 13Mhz, which will limit the real-world number of panels that can be chained without flicker. + +To enable PSRAM support on the ESP32-S3, refer to [the build options](/doc/BuildOptions.md) to enable. -RISC-V ESP32's (like the C3) are not, and will never be supported as they do not have parallel DMA output required for this library. +For all other ESP32 variants (like the most popular ‘original’ ESP32), [only *internal* SRAM can be used](https://github.com/mrfaptastic/ESP32-HUB75-MatrixPanel-I2S-DMA/issues/55), so you will be limited to the ~200KB or so of 'free' SRAM (because of the memory used for your sketch amongst other things) regardless of how many megabytes of SPIRAM/PSRAM you may have connected. -## Panels Supported -* 64x32 (width x height) pixel 1/16 Scan LED Matrix 'Indoor' Panel, such as this [typical RGB panel available for purchase](https://www.aliexpress.com/item/256-128mm-64-32-pixels-1-16-Scan-Indoor-3in1-SMD2121-RGB-full-color-P4-led/32810362851.html). -* 64x64 pixel 1/32 Scan LED Matrix 'Indoor' Panel. -* 32x16 pixel 1/4 Scan LED Matrix 'Indoor' Panel using an ingenious workaround as demonstrated in the 32x16_1_4_ScanPanel example. -* 126x64 [SM5266P](https://github.com/mrfaptastic/ESP32-HUB75-MatrixPanel-I2S-DMA/issues/164) 1/32 Scan Panel + +## Suported panels +### Parallel scan lines +* 'Two scan' panels where **two** rows/lines are updated in parallel. + * 64x32 (width x height) 'Indoor' panels, such as this [typical RGB panel available for purchase](https://www.aliexpress.com/item/256-128mm-64-32-pixels-1-16-Scan-Indoor-3in1-SMD2121-RGB-full-color-P4-led/32810362851.html). Often also referred to as 1/16 'scan panel' as every 16th row is updated in parallel (hence why I refer to it as 'two scan') + * 64x64 pixel 1/32 Scan LED Matrix 'Indoor' Panel + +* 'Four scan' panels where **four** rows/lines are updated in parallel. + * 32x16 pixel 1/4 Scan LED Matrix 'Indoor' Panel using an ingenious workaround as demonstrated in the Four_Scan_Panel example. + * 126x64 [SM5266P](https://github.com/mrfaptastic/ESP32-HUB75-MatrixPanel-I2S-DMA/issues/164) Ones interested in internals of such matrices could find [this article](https://www.sparkfun.com/news/2650) useful. Due to the high-speed optimized nature of this library, only specific panels are supported. Please do not raise issues with respect to panels not supported on the list below. -## Panel driver chips known to be working well +![Panel Scan Types](doc/ScanRateGraphic.jpg) + +### Driver chips known to be working well * ICND2012 * [RUC7258](http://www.ruichips.com/en/products.html?cateid=17496) @@ -72,28 +86,19 @@ Due to the high-speed optimized nature of this library, only specific panels are * SM5266P ## Panels Not Supported -* 1/8 Scan LED Matrix Panels are not supported. * RUL5358 / SHIFTREG_ABC_BIN_DE based panels are not supported. * ICN2053 / FM6353 based panels - Refer to [this library](https://github.com/LAutour/ESP32-HUB75-MatrixPanel-DMA-ICN2053), which is a fork of this library ( [discussion link](https://github.com/mrfaptastic/ESP32-HUB75-MatrixPanel-DMA/discussions/324)). * Any other panel not listed above. Please use an [alternative library](https://github.com/2dom/PxMatrix) if you bought one of these. -## Cool uses of this library -There are a number of great looking LED graphical display projects which leverage this library, these include: -* [128x64 Morph Clock](https://github.com/bogd/esp32-morphing-clock) -* [FFT Audio Visualisation](https://github.com/mrfaptastic/ESP32-HUB75-MatrixPanel-I2S-DMA/discussions/149) -* [Clock, GIF Animator and Audio Visualiser](https://github.com/mrfaptastic/ESP32-HUB75-MatrixPanel-I2S-DMA/discussions/153) -* [Aurora Audio Visualiser](https://github.com/mrfaptastic/ESP32-HUB75-MatrixPanel-I2S-DMA/discussions/188) -* [Big Visualisation](https://github.com/mrfaptastic/ESP32-HUB75-MatrixPanel-I2S-DMA/discussions/155) -* [Clockwise](https://jnthas.github.io/clockwise/) - # Getting Started ## 1. Library Installation -* Dependency: You will need to install Adafruit_GFX from the "Library > Manage Libraries" menu. -* Download and unzip this repository into your Arduino/libraries folder (or better still, use the Arduino 'add library from .zip' option. -* Library also tested to work fine with PlatformIO, install into your PlatformIO projects' lib/ folder as appropriate. Or just add it into [platformio.ini](/doc/BuildOptions.md) [lib_depth](https://docs.platformio.org/en/latest/projectconf/section_env_library.html#lib-deps) section. +* Dependancy: You will need to install Adafruit_GFX from the "Library > Manage Libraries" menu. +* Install this library from the Arduino Library manager. + +Library also tested to work fine with PlatformIO, install into your PlatformIO projects' lib/ folder as appropriate. Or just add it into [platformio.ini](/doc/BuildOptions.md) [lib_depth](https://docs.platformio.org/en/latest/projectconf/section_env_library.html#lib-deps) section. ## 2. Wiring the ESP32/ESP32-S2/ESP32-S3 to an LED Matrix Panel @@ -113,7 +118,7 @@ If you want to change the GPIO mapping at runtime, simply provide the wanted pin #define B_PIN 19 #define C_PIN 5 #define D_PIN 17 -#define E_PIN -1 // required for 1/32 scan panels, like 64x64. Any available pin would do, i.e. IO32 +#define E_PIN -1 // required for 1/32 scan panels, like 64x64px. Any available pin would do, i.e. IO32 #define LAT_PIN 4 #define OE_PIN 15 #define CLK_PIN 16 @@ -136,25 +141,18 @@ Various people have created PCBs for which one can simply connect an ESP32 to a Please contact or order these products from the respective authors. +### Can I use with a larger panel (i.e. 64x64px square panel)? +If you want to use with a 64x64 pixel panel (typically a HUB75*E* panel) you MUST configure a valid *E_PIN* to your ESP32 and connect it to the E pin of the HUB75 panel! Hence the 'E' in 'HUB75E' + + ## 3. Run a Test Sketch Below is a bare minimum sketch to draw a single white dot in the top left. You must call begin() before you call ANY pixel-drawing (fonts, lines, colours etc.) function of the MatrixPanel_I2S_DMA class. Once this is working, refer to the [PIO Test Patterns](/examples/PIO_TestPatterns) example. This sketch draws simple colors/lines/gradients over the entire matrix and it could help to troubleshoot various issues with ghosting, flickering, etc... ->Note: Requires the use of [PlatformIO](https://platformio.org/), which you should probably use if you aren't already. -# More Information -## Build-time options -Although Arduino IDE does not [seem](https://github.com/arduino/Arduino/issues/421) to offer any way of specifying compile-time options for external libs there are other IDE's (like [PlatformIO](https://platformio.org/)/[Eclipse](https://www.eclipse.org/ide/)) that could use that. Check [Build Options](doc/BuildOptions.md) document for reference. - -## Memory constraints -If you are going to use large/combined panels make sure to check for [memory constraints](/doc/i2s_memcalc.md). - -NOTE: You can use SPIRAM/PSRAM to drive the HUB75 DMA buffer only on the ESP32-S3 and with Octal SPI-RAM (i.e. ESP32 S3 N8R8 variant). However, due to bandwidth limitations, the maximum output frequency is limited to approx. 16Mhz, which will limit the real world number of panels that can be chained without flicker being obvious. This is enabled at compile time, refer to [the build options](/doc/BuildOptions.md) to enable. -For all other ESP32 variants (like the most popular ‘original’ ESP32), [only *internal* SRAM can be used](https://github.com/mrfaptastic/ESP32-HUB75-MatrixPanel-I2S-DMA/issues/55), so you will be limited to the ~200KB or so of 'free' SRAM regardless of how many megabytes of SPIRAM/PSRAM you may have connected. - -## Can I use with a larger panel (i.e. 64x64px square panel)? -If you want to use with a 64x64 pixel panel (typically a HUB75*E* panel) you MUST configure a valid *E_PIN* to your ESP32 and connect it to the E pin of the HUB75 panel! Hence the 'E' in 'HUB75E' +Note: Requires the use of [PlatformIO](https://platformio.org/), which you should probably use if you aren't already. +# Further information ## Can I chain panels? Yes! @@ -168,7 +166,7 @@ Resolutions beyond 128x64 are more likely to result in crashes due to [memory](/ ![ezgif com-video-to-gif](https://user-images.githubusercontent.com/12006953/89837358-b64c0480-db60-11ea-870d-4b6482068a3b.gif) - ## Panel Brightness +## Adjusting Panel Brightness By default you should not need to change / set the brightness value (which is 128 or 50%) as it should be sufficient for most purposes. Brightness can be changed by calling `setPanelBrightness(xx)` or `setBrightness8(xx)`. @@ -185,7 +183,8 @@ Serial.begin(115200); ``` ![Brightness Samples](https://user-images.githubusercontent.com/55933003/211192894-f90311f5-b6fe-4665-bf26-2f363bb36047.png) - +## Build-time options +Although Arduino IDE does not [seem](https://github.com/arduino/Arduino/issues/421) to offer any way of specifying compile-time options for external libs there are other IDE's (like [PlatformIO](https://platformio.org/)/[Eclipse](https://www.eclipse.org/ide/)) that could use that. Check [Build Options](doc/BuildOptions.md) document for reference. ## Latch blanking If you are facing issues with image ghosting when pixels has clones with horizontal offset, than you try to change Latch blanking value. Latch blanking controls for how many clock pulses matrix output is disabled via EO signal before/after toggling LAT signal. It hides row bits transitioning and different panels may require longer times for proper operation. Default value is 1 clock before/after LAT row transition. This could be controlled with `MatrixPanel_I2S_DMA::setLatBlanking(uint8_t v)`. v could be between 1 to 4, default is 1, larger values won't give any benefit other than reducing brightness. @@ -209,6 +208,16 @@ This project was inspired by: * 'SmartMatrix': https://github.com/pixelmatix/SmartMatrix/tree/teensylc * Sprite_TM's demo implementation here: https://www.esp32.com/viewtopic.php?f=17&t=3188 + +## Cool uses of this library +There are a number of great looking LED graphical display projects which leverage this library, these include: +* [128x64 Morph Clock](https://github.com/bogd/esp32-morphing-clock) +* [FFT Audio Visualisation](https://github.com/mrfaptastic/ESP32-HUB75-MatrixPanel-I2S-DMA/discussions/149) +* [Clock, GIF Animator and Audio Visualiser](https://github.com/mrfaptastic/ESP32-HUB75-MatrixPanel-I2S-DMA/discussions/153) +* [Aurora Audio Visualiser](https://github.com/mrfaptastic/ESP32-HUB75-MatrixPanel-I2S-DMA/discussions/188) +* [Big Visualisation](https://github.com/mrfaptastic/ESP32-HUB75-MatrixPanel-I2S-DMA/discussions/155) +* [Clockwise](https://jnthas.github.io/clockwise/) + # Thank you! * [Brian Lough](https://www.tindie.com/stores/brianlough/) ([youtube link](https://www.youtube.com/c/brianlough)) for providing code contributions, hardware and suggestions * [Vortigont](https://github.com/vortigont) for his game changing code contributions and performance optimisations diff --git a/doc/ScanRateGraphic.jpg b/doc/ScanRateGraphic.jpg new file mode 100644 index 0000000..a875316 Binary files /dev/null and b/doc/ScanRateGraphic.jpg differ diff --git a/doc/ScanRateGraphic.odp b/doc/ScanRateGraphic.odp new file mode 100644 index 0000000..84b98a1 Binary files /dev/null and b/doc/ScanRateGraphic.odp differ diff --git a/examples/Four_Scan_Panel/Four_Scan_Panel.ino b/examples/Four_Scan_Panel/Four_Scan_Panel.ino new file mode 100644 index 0000000..856d7e5 --- /dev/null +++ b/examples/Four_Scan_Panel/Four_Scan_Panel.ino @@ -0,0 +1,153 @@ +/************************************************************************* + * Description: + * + * The underlying implementation of the ESP32-HUB75-MatrixPanel-I2S-DMA only + * 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 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. + * + **************************************************************************/ +#include "ESP32-HUB75-MatrixPanel-I2S-DMA.h" + +/* Use the Virtual Display class to re-map co-ordinates such that they draw + * correctly on a 32x16 1/8 Scan panel (or chain of such panels). + */ +#include "ESP32-VirtualMatrixPanel-I2S-DMA.h" + + + // Panel configuration + #define PANEL_RES_X 64 // Number of pixels wide of each INDIVIDUAL panel module. + #define PANEL_RES_Y 32 // Number of pixels tall of each INDIVIDUAL panel module. + + + #define NUM_ROWS 1 // Number of rows of chained INDIVIDUAL PANELS + #define NUM_COLS 2 // Number of INDIVIDUAL PANELS per ROW + + // ^^^ NOTE: DEFAULT EXAMPLE SETUP IS FOR A CHAIN OF TWO x 1/8 SCAN PANELS + + // Change this to your needs, for details on VirtualPanel pls read the PDF! + #define SERPENT true + #define TOPDOWN false + + // placeholder for the matrix object + MatrixPanel_I2S_DMA *dma_display = nullptr; + + // placeholder for the virtual display object + VirtualMatrixPanel *FourScanPanel = nullptr; + + /****************************************************************************** + * Setup! + ******************************************************************************/ + void setup() + { + delay(250); + + Serial.begin(115200); + Serial.println(""); Serial.println(""); Serial.println(""); + Serial.println("*****************************************************"); + Serial.println("* 1/8 Scan Panel Demonstration *"); + Serial.println("*****************************************************"); + +/* + // 62x32 1/8 Scan Panels don't have a D and E pin! + + HUB75_I2S_CFG::i2s_pins _pins = { + R1_PIN, G1_PIN, B1_PIN, R2_PIN, G2_PIN, B2_PIN, + A_PIN, B_PIN, C_PIN, D_PIN, E_PIN, + LAT_PIN, OE_PIN, CLK_PIN + }; +*/ + HUB75_I2S_CFG mxconfig( + PANEL_RES_X*2, // DO NOT CHANGE THIS + PANEL_RES_Y/2, // DO NOT CHANGE THIS + NUM_ROWS*NUM_COLS // DO NOT CHANGE THIS + //,_pins // Uncomment to enable custom pins + ); + + mxconfig.clkphase = false; // Change this if you see pixels showing up shifted wrongly by one column the left or right. + + //mxconfig.driver = HUB75_I2S_CFG::FM6126A; // in case that we use panels based on FM6126A chip, we can set it here before creating MatrixPanel_I2S_DMA object + + // OK, now we can create our matrix object + dma_display = new MatrixPanel_I2S_DMA(mxconfig); + + // let's adjust default brightness to about 75% + dma_display->setBrightness8(96); // range is 0-255, 0 - 0%, 255 - 100% + + // Allocate memory and start DMA display + if( not dma_display->begin() ) + Serial.println("****** !KABOOM! I2S memory allocation failed ***********"); + + + dma_display->clearScreen(); + delay(500); + + // 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! + FourScanPanel->setPhysicalPanelScanRate(FOUR_SCAN_32PX_HIGH); + } + + + void loop() { + + // What the panel sees from the DMA engine! + for (int i=PANEL_RES_X*2+10; i< PANEL_RES_X*(NUM_ROWS*NUM_COLS)*2; i++) + { + dma_display->drawLine(i, 0, i, 7, dma_display->color565(255, 0, 0)); // red + delay(10); + } + + dma_display->clearScreen(); + delay(1000); +/* + // Try again using the pixel / dma memory remapper + for (int i=PANEL_RES_X+5; i< (PANEL_RES_X*2)-1; i++) + { + FourScanPanel->drawLine(i, 0, i, 7, dma_display->color565(0, 0, 255)); // blue + delay(10); + } +*/ + + // Try again using the pixel / dma memory remapper + int offset = PANEL_RES_X*((NUM_ROWS*NUM_COLS)-1); + for (int i=0; i< PANEL_RES_X; i++) + { + 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); + } + + delay(1000); + + + // Print on each chained panel 1/8 module! + // This only really works for a single horizontal chain + for (int i = 0; i < NUM_ROWS*NUM_COLS; i++) + { + 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) + 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 + FourScanPanel->drawLine(0,0, FourScanPanel->width()-1, FourScanPanel->height()-1, FourScanPanel->color565(255,255,255)); + } + + delay(2000); + dma_display->clearScreen(); + + } // end loop diff --git a/examples/Four_Scan_Panel/README.md b/examples/Four_Scan_Panel/README.md new file mode 100644 index 0000000..2fd55b9 --- /dev/null +++ b/examples/Four_Scan_Panel/README.md @@ -0,0 +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. + +## 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/One_Eight_1_8_ScanPanel/One_Eight_1_8_ScanPanel.ino b/examples/One_Eight_1_8_ScanPanel/One_Eight_1_8_ScanPanel.ino deleted file mode 100644 index d44bb76..0000000 --- a/examples/One_Eight_1_8_ScanPanel/One_Eight_1_8_ScanPanel.ino +++ /dev/null @@ -1,151 +0,0 @@ -/************************************************************************* - * 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. - * - * However, it is possible to connect 1/8 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. - * - **************************************************************************/ -#include "ESP32-HUB75-MatrixPanel-I2S-DMA.h" - -/* Use the Virtual Display class to re-map co-ordinates such that they draw - * correctly on a 32x16 1/8 Scan panel (or chain of such panels). - */ -#include "ESP32-VirtualMatrixPanel-I2S-DMA.h" - - - // Panel configuration - #define PANEL_RES_X 64 // Number of pixels wide of each INDIVIDUAL panel module. - #define PANEL_RES_Y 32 // Number of pixels tall of each INDIVIDUAL panel module. - - - #define NUM_ROWS 1 // Number of rows of chained INDIVIDUAL PANELS - #define NUM_COLS 2 // Number of INDIVIDUAL PANELS per ROW - - // ^^^ NOTE: DEFAULT EXAMPLE SETUP IS FOR A CHAIN OF TWO x 1/8 SCAN PANELS - - // Change this to your needs, for details on VirtualPanel pls read the PDF! - #define SERPENT true - #define TOPDOWN false - - // placeholder for the matrix object - MatrixPanel_I2S_DMA *dma_display = nullptr; - - // placeholder for the virtual display object - VirtualMatrixPanel *OneEightMatrixDisplay = nullptr; - - /****************************************************************************** - * Setup! - ******************************************************************************/ - void setup() - { - delay(250); - - Serial.begin(115200); - Serial.println(""); Serial.println(""); Serial.println(""); - Serial.println("*****************************************************"); - Serial.println("* 1/8 Scan Panel Demonstration *"); - Serial.println("*****************************************************"); - -/* - // 62x32 1/8 Scan Panels don't have a D and E pin! - - HUB75_I2S_CFG::i2s_pins _pins = { - R1_PIN, G1_PIN, B1_PIN, R2_PIN, G2_PIN, B2_PIN, - A_PIN, B_PIN, C_PIN, D_PIN, E_PIN, - LAT_PIN, OE_PIN, CLK_PIN - }; -*/ - HUB75_I2S_CFG mxconfig( - PANEL_RES_X*2, // DO NOT CHANGE THIS - PANEL_RES_Y/2, // DO NOT CHANGE THIS - NUM_ROWS*NUM_COLS // DO NOT CHANGE THIS - //,_pins // Uncomment to enable custom pins - ); - - mxconfig.clkphase = false; // Change this if you see pixels showing up shifted wrongly by one column the left or right. - - //mxconfig.driver = HUB75_I2S_CFG::FM6126A; // in case that we use panels based on FM6126A chip, we can set it here before creating MatrixPanel_I2S_DMA object - - // OK, now we can create our matrix object - dma_display = new MatrixPanel_I2S_DMA(mxconfig); - - // let's adjust default brightness to about 75% - dma_display->setBrightness8(96); // range is 0-255, 0 - 0%, 255 - 100% - - // Allocate memory and start DMA display - if( not dma_display->begin() ) - Serial.println("****** !KABOOM! I2S memory allocation failed ***********"); - - - 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); - - // THE IMPORTANT BIT BELOW! - OneEightMatrixDisplay->setPhysicalPanelScanRate(ONE_EIGHT_32); - } - - - void loop() { - - // What the panel sees from the DMA engine! - for (int i=PANEL_RES_X*2+10; i< PANEL_RES_X*(NUM_ROWS*NUM_COLS)*2; i++) - { - dma_display->drawLine(i, 0, i, 7, dma_display->color565(255, 0, 0)); // red - delay(10); - } - - dma_display->clearScreen(); - delay(1000); -/* - // 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 - delay(10); - } -*/ - - // Try again using the pixel / dma memory remapper - 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 - delay(10); - } - - delay(1000); - - - // Print on each chained panel 1/8 module! - // 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); - - // 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)); - - // White line from top left to bottom right - OneEightMatrixDisplay->drawLine(0,0, OneEightMatrixDisplay->width()-1, OneEightMatrixDisplay->height()-1, OneEightMatrixDisplay->color565(255,255,255)); - } - - delay(2000); - dma_display->clearScreen(); - - } // end loop diff --git a/examples/One_Eight_1_8_ScanPanel/README.md b/examples/One_Eight_1_8_ScanPanel/README.md deleted file mode 100644 index 2fd55b9..0000000 --- a/examples/One_Eight_1_8_ScanPanel/README.md +++ /dev/null @@ -1,7 +0,0 @@ -# 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. - -## 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/src/ESP32-VirtualMatrixPanel-I2S-DMA.h b/src/ESP32-VirtualMatrixPanel-I2S-DMA.h index b2aba42..c79c376 100644 --- a/src/ESP32-VirtualMatrixPanel-I2S-DMA.h +++ b/src/ESP32-VirtualMatrixPanel-I2S-DMA.h @@ -9,9 +9,17 @@ grid. However, the function of this class has expanded now to also manage - the output for 1/16 scan panels, as the core DMA library is designed - ONLY FOR 1/16 scan matrix panels. - + the output for + + 1) HALF scan panels = Two rows updated in parallel. + * 64px high panel = (incorrectly) referred to as 1/32 scan + * 32px high panel = (incorrectly) referred to as 1/16 scan + * 16px high panel = (incorrectly) referred to as 1/8 scan + + 2) FOUR scan panels = Four rows updated in parallel + * 32px high panel = (incorrectly) referred to as 1/8 scan + * 16px high panel = (incorrectly) referred to as 1/4 scan + YouTube: https://www.youtube.com/brianlough Tindie: https://www.tindie.com/stores/brianlough/ Twitter: https://twitter.com/witnessmenow @@ -36,9 +44,9 @@ struct VirtualCoords enum PANEL_SCAN_RATE { - NORMAL_ONE_SIXTEEN, - ONE_EIGHT_32, - ONE_EIGHT_16 + NORMAL_TWO_SCAN, NORMAL_ONE_SIXTEEN, // treated as the same + FOUR_SCAN_32PX_HIGH, + FOUR_SCAN_16PX_HIGH }; #ifdef USE_GFX_ROOT @@ -129,7 +137,7 @@ protected: bool _chain_top_down = false; // is the ESP at the top or bottom of the matrix of devices? bool _rotate = false; - PANEL_SCAN_RATE _panelScanRate = NORMAL_ONE_SIXTEEN; + PANEL_SCAN_RATE _panelScanRate = NORMAL_TWO_SCAN; }; // end Class header @@ -198,18 +206,18 @@ inline VirtualCoords VirtualMatrixPanel::getCoords(int16_t &x, int16_t &y) coords.y = (panelResY - 1) - coords.y; } - /* START: Pixel remapping AGAIN to convert 1/16 SCAN output that the + /* START: Pixel remapping AGAIN to convert 1/2 SCAN output that the * the underlying hardware library is designed for (because - * there's only 2 x RGB pins... and convert this to 1/8 or something + * there's only 2 x RGB pins... and convert this to 1/4 or something */ - if (_panelScanRate == ONE_EIGHT_32) + if (_panelScanRate == FOUR_SCAN_32PX_HIGH) { /* Convert Real World 'VirtualMatrixPanel' co-ordinates (i.e. Real World pixel you're looking at on the panel or chain of panels, per the chaining configuration) to a 1/8 panels double 'stretched' and 'squished' coordinates which is what needs to be sent from the DMA buffer. - Note: Look at the One_Eight_1_8_ScanPanel code and you'll see that the DMA buffer is setup + Note: Look at the FourScanPanel example code and you'll see that the DMA buffer is setup as if the panel is 2 * W and 0.5 * H ! */ @@ -238,7 +246,7 @@ inline VirtualCoords VirtualMatrixPanel::getCoords(int16_t &x, int16_t &y) Serial.print("to ("); Serial.print(coords.x, DEC); Serial.print(","); Serial.print(coords.y, DEC); Serial.println(") "); */ } - else if (_panelScanRate == ONE_EIGHT_16) + else if (_panelScanRate == FOUR_SCAN_16PX_HIGH) { if ((y & 8) == 0) { -- cgit v1.3.1 From fe89cc9e17ef9d3a71464da34d55ff558947c1de Mon Sep 17 00:00:00 2001 From: mrfaptastic <12006953+mrfaptastic@users.noreply.github.com> Date: Wed, 1 Feb 2023 21:06:08 +0000 Subject: Update README.md #386 --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 31ca561..c32b4af 100644 --- a/README.md +++ b/README.md @@ -49,7 +49,7 @@ __[BUILD OPTIONS](/doc/BuildOptions.md) | [EXAMPLES](/examples/README.md)__ | [! RISC-V ESP32's (like the C3) are not supported as they do not have the hardware 'LCD mode' required for this library. ## Memory is required! -"*What's the price for those features?*" - It's [memory](/doc/memcalc.md), you pay it all by precious MCU's internal memory (SRAM) for the DMA buffer". +"*What's the price for those features?*" - It's [memory](/doc/memcalc.md), you pay it all by precious MCU's internal memory (SRAM) for the DMA buffer. A typical 64x32px panel at 24bpp colour uses about 20kB of internal memory. -- cgit v1.3.1 From ecc6ef169a93921ad3d4e0bd7540e27be045d624 Mon Sep 17 00:00:00 2001 From: mrfaptastic <12006953+mrfaptastic@users.noreply.github.com> Date: Wed, 1 Feb 2023 21:15:06 +0000 Subject: Update README.md --- examples/Four_Scan_Panel/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/Four_Scan_Panel/README.md b/examples/Four_Scan_Panel/README.md index 2fd55b9..7df7617 100644 --- a/examples/Four_Scan_Panel/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). -- cgit v1.3.1 From 37dd23333965bb4acaee739c54ffc6d7f2486761 Mon Sep 17 00:00:00 2001 From: Elliot Matson <1711604+elliotmatson@users.noreply.github.com> Date: Wed, 1 Feb 2023 19:00:41 -0600 Subject: Prevent CI from running on README/docs updates --- .github/workflows/pio_build.yml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/.github/workflows/pio_build.yml b/.github/workflows/pio_build.yml index d64bda4..06729b5 100644 --- a/.github/workflows/pio_build.yml +++ b/.github/workflows/pio_build.yml @@ -7,8 +7,16 @@ name: PlatformIO CI on: push: branches: [ master, dev ] + paths-ignore: + - '**.md' + - 'doc/**' + - '.github/**' pull_request: branches: [ master, dev ] + paths-ignore: + - '**.md' + - 'doc/**' + - '.github/**' jobs: build: -- cgit v1.3.1 From 62eafc3efb857290cf1dd9cd4aaab1a0fc57646a Mon Sep 17 00:00:00 2001 From: Elliot Matson <1711604+elliotmatson@users.noreply.github.com> Date: Wed, 1 Feb 2023 19:10:26 -0600 Subject: Another ESP_LOG formatting fix CI doesn't cover the S2 or S3 models, I might see if I can fix that soon --- src/platforms/esp32s3/gdma_lcd_parallel16.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/platforms/esp32s3/gdma_lcd_parallel16.cpp b/src/platforms/esp32s3/gdma_lcd_parallel16.cpp index 6daedba..d773b55 100644 --- a/src/platforms/esp32s3/gdma_lcd_parallel16.cpp +++ b/src/platforms/esp32s3/gdma_lcd_parallel16.cpp @@ -135,7 +135,7 @@ } ESP_LOGI("S3", "Clock divider is %d", LCD_CAM.lcd_clock.lcd_clkm_div_num); - ESP_LOGD("S3", "Resulting output clock frequency: %d Mhz", (160000000L/LCD_CAM.lcd_clock.lcd_clkm_div_num)); + ESP_LOGD("S3", "Resulting output clock frequency: %ld Mhz", (160000000L/LCD_CAM.lcd_clock.lcd_clkm_div_num)); LCD_CAM.lcd_clock.lcd_clkm_div_a = 1; // 0/1 fractional divide @@ -463,4 +463,4 @@ } // end flip -#endif \ No newline at end of file +#endif -- cgit v1.3.1 From 0a44e210beba1fe14df4d2fa9d77b217b6bb1077 Mon Sep 17 00:00:00 2001 From: mrfaptastic <12006953+mrfaptastic@users.noreply.github.com> Date: Fri, 3 Feb 2023 21:37:19 +0000 Subject: Update esp32_i2s_parallel_dma.hpp Makes ESP32_I2S_DEVICE adjustable via compile time define on ESP32 (original) --- src/platforms/esp32/esp32_i2s_parallel_dma.hpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/platforms/esp32/esp32_i2s_parallel_dma.hpp b/src/platforms/esp32/esp32_i2s_parallel_dma.hpp index 0fb68d2..dd6c1f3 100644 --- a/src/platforms/esp32/esp32_i2s_parallel_dma.hpp +++ b/src/platforms/esp32/esp32_i2s_parallel_dma.hpp @@ -49,7 +49,9 @@ Contributors: #define DMA_MAX (4096-4) -#define ESP32_I2S_DEVICE I2S_NUM_0 +#ifndef ESP32_I2S_DEVICE + #define ESP32_I2S_DEVICE I2S_NUM_0 +#endif // The type used for this SoC #define HUB75_DMA_DESCRIPTOR_T lldesc_t @@ -144,4 +146,4 @@ i2s_dev_t* getDev(); - }; \ No newline at end of file + }; -- cgit v1.3.1 From 29e04d916a5e88bf2f81f026a0a6ff9ba28d722f Mon Sep 17 00:00:00 2001 From: mrfaptastic <12006953+mrfaptastic@users.noreply.github.com> Date: Fri, 3 Feb 2023 22:04:55 +0000 Subject: Update ESP32-VirtualMatrixPanel-I2S-DMA.h --- src/ESP32-VirtualMatrixPanel-I2S-DMA.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ESP32-VirtualMatrixPanel-I2S-DMA.h b/src/ESP32-VirtualMatrixPanel-I2S-DMA.h index c79c376..ea49388 100644 --- a/src/ESP32-VirtualMatrixPanel-I2S-DMA.h +++ b/src/ESP32-VirtualMatrixPanel-I2S-DMA.h @@ -206,7 +206,7 @@ inline VirtualCoords VirtualMatrixPanel::getCoords(int16_t &x, int16_t &y) coords.y = (panelResY - 1) - coords.y; } - /* START: Pixel remapping AGAIN to convert 1/2 SCAN output that the + /* START: Pixel remapping AGAIN to convert TWO parallel scanline output that the * the underlying hardware library is designed for (because * there's only 2 x RGB pins... and convert this to 1/4 or something */ -- cgit v1.3.1