diff --git a/components/tft/tftspi.c b/components/tft/tftspi.c index 77560b3..65c8060 100644 --- a/components/tft/tftspi.c +++ b/components/tft/tftspi.c @@ -757,19 +757,24 @@ void TFT_display_init() commandList(disp_spi, ST7789V_init); } else if (tft_disp_type == DISP_TYPE_ST7735) { + ret = disp_select(); + assert(ret==ESP_OK); commandList(disp_spi, STP7735_init); } else if (tft_disp_type == DISP_TYPE_ST7735R) { + ret = disp_select(); + assert(ret==ESP_OK); commandList(disp_spi, STP7735R_init); commandList(disp_spi, Rcmd2green); commandList(disp_spi, Rcmd3); } else if (tft_disp_type == DISP_TYPE_ST7735B) { + ret = disp_select(); + assert(ret==ESP_OK); commandList(disp_spi, STP7735R_init); commandList(disp_spi, Rcmd2red); commandList(disp_spi, Rcmd3); - uint8_t dt = 0xC0; - disp_select(); + uint8_t dt = 0xC0; disp_spi_transfer_cmd_data(TFT_MADCTL, &dt, 1); } else assert(0); diff --git a/components/tft/tftspi.h b/components/tft/tftspi.h index 5839b08..140d4c9 100644 --- a/components/tft/tftspi.h +++ b/components/tft/tftspi.h @@ -387,11 +387,15 @@ static const uint8_t ILI9488_init[] = { // Initialization commands for 7735B screens // ------------------------------------ static const uint8_t STP7735_init[] = { - 17, // 18 commands in list: +#if PIN_NUM_RST + 17, // 17 commands in list +#else + 18, // 18 commands in list: ST7735_SLPOUT , TFT_CMD_DELAY, // 2: Out of sleep mode, no args, w/delay 255, // 255 = 500 ms delay +#endif TFT_CMD_PIXFMT , 1+TFT_CMD_DELAY, // 3: Set color mode, 1 arg + delay: - 1, 0x06, // 18-bit color 6-6-6 color format + 0x06, // 18-bit color 6-6-6 color format 10, // 10 ms delay ST7735_FRMCTR1, 3+TFT_CMD_DELAY, // 4: Frame rate control, 3 args + delay: 0x00, // fastest refresh @@ -447,9 +451,13 @@ static const uint8_t STP7735_init[] = { // Init for 7735R, part 1 (red or green tab) // -------------------------------------- static const uint8_t STP7735R_init[] = { - 15, // 15 commands in list: +#if PIN_NUM_RST + 14, // 14 commands in list +#else + 15, // 15 commands in list: ST7735_SWRESET, TFT_CMD_DELAY, // 1: Software reset, 0 args, w/delay 150, // 150 ms delay +#endif ST7735_SLPOUT , TFT_CMD_DELAY, // 2: Out of sleep mode, 0 args, w/delay 255, // 500 ms delay ST7735_FRMCTR1, 3 , // 3: Frame rate ctrl - normal mode, 3 args: