Skip to content

ESP32-P4 and ST7789 pushImage & setSwapBytes issue #758

@cniedzi

Description

@cniedzi

Carefully written Issues are more likely to be given priority.
丁寧に記述された報告は優先して対応される可能性が高くなります。

Environment ( 実行環境 )

Problem Description ( 問題の内容 )

When I try to display bitmaps smaller then 23 x 23 px using pushImage() they aren't displayed and the program freezes. When I comment respective pushImage command for small image, other bitmaps of the size at least 23 x 23 px are displayed, but they need to swap bytes for correct appearance (see the below image).
Image
Unfortunately, the command setSwapBytes() doesn't work and causes the program to freeze.

The code works perfectly well for ESP32-S3 and the same ST7789 display (see the below image).
Image

Expected Behavior ( 期待される動作 )

  1. All images are displayed correctly, no matter what size.
  2. The function setSwapBytes(true) displays images correctly

Actual Behavior ( 実際の動作 )

  1. Images smaller then 23 x 23 px aren't displayed and the program freezes.
  2. The function setSwapBytes(true) freezes the execution of the program.

Steps to reproduce ( 再現のための前提条件 )

  1. Connect ESP32-P4 to the ST7789 display
  2. Compile and run the code

My wiring:

#define TFT_DC 22
#define TFT_RST 23
#define TFT_CS 26
#define TFT_BL 21
#define TFT_MOSI 32 
#define TFT_SCLK 36 

Code to reproduce this issue ( 再現させるためのコード )

Config

LGFX(void)
  {
    { 
      auto cfg = _bus_instance.config();
      cfg.spi_host = SPI2_HOST;
      cfg.spi_mode = 0;
      cfg.freq_write = 80000000;
      cfg.freq_read  = 16000000;
      cfg.spi_3wire  = false;
      cfg.use_lock   = true;
      cfg.dma_channel = SPI_DMA_CH_AUTO;
      cfg.pin_sclk = TFT_SCLK;
      cfg.pin_mosi = TFT_MOSI;
      cfg.pin_miso = TFT_MISO;
      cfg.pin_dc   = TFT_DC;
      _bus_instance.config(cfg);
      _panel_instance.setBus(&_bus_instance);
    }
    { 
        auto cfg = _panel_instance.config();
        cfg.pin_cs           = TFT_CS;
        cfg.pin_rst          = TFT_RST;
        cfg.panel_width      = 240;
        cfg.panel_height     = 320;
        cfg.invert           = true;
        cfg.rgb_order        = false;
        _panel_instance.config(cfg);
    }
    setPanel(&_panel_instance);
  }

Code

// Dimensions    : 19x19 pixels
// Size          : 722 Bytes

const unsigned short Speaker[0x169] ={
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,   // 0x0010 (16)
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x9492, 0xFFFF, 0x9492, 0x0000,   // 0x0020 (32)
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x94B2, 0xFFFF,   // 0x0030 (48)
0xFFFF, 0x8C71, 0x0000, 0x0000, 0x39C7, 0xD6BA, 0x4A49, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,   // 0x0040 (64)
0x9CD3, 0xFFFF, 0xFFFF, 0xFFFF, 0x8C71, 0x0000, 0x0000, 0x2124, 0xEF7D, 0xFFFF, 0x2965, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,   // 0x0050 (80)
0x0000, 0x0000, 0x9CF3, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0x8C71, 0x0000, 0x0000, 0x0000, 0x2945, 0xFFDF, 0xD6BA, 0x0020, 0x0000,   // 0x0060 (96)
0x4A69, 0xB596, 0xBDF7, 0xBDF7, 0xD69A, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0x8C51, 0x0000, 0x9CD3, 0x7BEF, 0x0000, 0x6B4D,   // 0x0070 (112)
0xFFFF, 0x632C, 0x6B4D, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0x8C51, 0x0000, 0xBDF7,   // 0x0080 (128)
0xFFFF, 0x4A49, 0x0000, 0xE73C, 0xDEDB, 0xF79E, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF,   // 0x0090 (144)
0x8C71, 0x0000, 0x0861, 0xEF7D, 0xDEDB, 0x0000, 0x8430, 0xFFFF, 0xF79E, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF,   // 0x00A0 (160)
0xFFFF, 0xFFFF, 0xFFFF, 0x8C71, 0x0000, 0x0000, 0x8430, 0xFFFF, 0x10A2, 0x39E7, 0xFFFF, 0xF79E, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF,   // 0x00B0 (176)
0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0x8C71, 0x0000, 0x0000, 0x528A, 0xFFFF, 0x39C7, 0x2104, 0xFFFF, 0xF79E, 0xFFFF,   // 0x00C0 (192)
0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0x8C71, 0x0000, 0x0000, 0x528A, 0xFFFF, 0x39C7, 0x2104,   // 0x00D0 (208)
0xFFFF, 0xF7BE, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0x8C71, 0x0000, 0x0000, 0x8C51,   // 0x00E0 (224)
0xFFFF, 0x10A2, 0x39E7, 0xFFFF, 0xF79E, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0x8C71,   // 0x00F0 (240)
0x0000, 0x0861, 0xEF7D, 0xD6BA, 0x0000, 0x8430, 0xFFFF, 0x5AEB, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF,   // 0x0100 (256)
0xFFFF, 0xFFFF, 0x8C51, 0x0000, 0xBDF7, 0xFFFF, 0x4228, 0x0000, 0xEF5D, 0xDEDB, 0x0000, 0x4208, 0xA534, 0xB596, 0xB596, 0xC638,   // 0x0110 (272)
0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0x8C51, 0x0000, 0x9492, 0x73AE, 0x0000, 0x6B4D, 0xFFFF, 0x630C, 0x0000, 0x0000, 0x0000,   // 0x0120 (288)
0x0000, 0x0000, 0x0000, 0x94B2, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0x8C71, 0x0000, 0x0000, 0x0000, 0x2945, 0xFFDF, 0xD6BA, 0x0020,   // 0x0130 (304)
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x9492, 0xFFFF, 0xFFFF, 0xFFFF, 0x8C71, 0x0000, 0x0000, 0x2124, 0xF79E,   // 0x0140 (320)
0xFFFF, 0x2965, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x8C71, 0xFFFF, 0xFFFF, 0x8C71, 0x0000,   // 0x0150 (336)
0x0000, 0x31A6, 0xD6BA, 0x4228, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x8C51,   // 0x0160 (352)
0xFFFF, 0x9492, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, };


tft.init();
tft.setRotation(3);
tft.setSwapBytes(true);


unsigned short *_speaker_psram = (unsigned short *) ps_malloc(sizeof(Speaker));
memcpy(_speaker_psram, Speaker, sizeof(Speaker));
if (_speaker_psram != NULL) tft.pushImage(VOLUME_X_POS-25, VOLUME_Y_POS-19, 19, 19, _speaker_psram);

Metadata

Metadata

Assignees

No one assigned

    Labels

    pinnedexempt from stale botstaleInactive issues

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions