Skip to content

Commit 52384e4

Browse files
committed
Fix #2725
Bug: pushPixels will swap bytes, so bytes got swapped twice.
1 parent 6342bfc commit 52384e4

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

Processors/TFT_eSPI_ESP32_S3.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -644,10 +644,13 @@ void TFT_eSPI::pushPixelsDMA(uint16_t* image, uint32_t len)
644644
// small transfers are performed using a blocking call until DMA capacity is reached.
645645
// User sketch can prevent blocking by managing pixel count and splitting into blocks
646646
// of 32768 pixels maximum. (equivalent to an area of ~320 x 100 pixels)
647+
bool temp = _swapBytes;
648+
_swapBytes = false;
647649
while(len>0x4000) { // Transfer 16 bit pixels in blocks if len*2 over 65536 bytes
648650
pushPixels(image, 0x400);
649651
len -= 0x400; image+= 0x400; // Arbitrarily send 1K pixel blocks (2Kbytes)
650652
}
653+
_swapBytes = temp;
651654

652655
esp_err_t ret;
653656
static spi_transaction_t trans;
@@ -685,10 +688,13 @@ void TFT_eSPI::pushImageDMA(int32_t x, int32_t y, int32_t w, int32_t h, uint16_t
685688
// small transfers are performed using a blocking call until DMA capacity is reached.
686689
// User sketch can prevent blocking by managing pixel count and splitting into blocks
687690
// of 32768 pixels maximum. (equivalent to an area of ~320 x 100 pixels)
691+
bool temp = _swapBytes;
692+
_swapBytes = false;
688693
while(len>0x4000) { // Transfer 16 bit pixels in blocks if len*2 over 65536 bytes
689694
pushPixels(buffer, 0x400);
690695
len -= 0x400; buffer+= 0x400; // Arbitrarily send 1K pixel blocks (2Kbytes)
691696
}
697+
_swapBytes = temp;
692698

693699
esp_err_t ret;
694700
static spi_transaction_t trans;
@@ -770,10 +776,13 @@ void TFT_eSPI::pushImageDMA(int32_t x, int32_t y, int32_t w, int32_t h, uint16_t
770776
// small transfers are performed using a blocking call until DMA capacity is reached.
771777
// User sketch can prevent blocking by managing pixel count and splitting into blocks
772778
// of 32768 pixels maximum. (equivalent to an area of ~320 x 100 pixels)
779+
bool temp = _swapBytes;
780+
_swapBytes = false;
773781
while(len>0x4000) { // Transfer 16 bit pixels in blocks if len*2 over 65536 bytes
774782
pushPixels(buffer, 0x400);
775783
len -= 0x400; buffer+= 0x400; // Arbitrarily send 1K pixel blocks (2Kbytes)
776784
}
785+
_swapBytes = temp;
777786

778787
esp_err_t ret;
779788
static spi_transaction_t trans;

0 commit comments

Comments
 (0)