ESP32_TFT_library icon indicating copy to clipboard operation
ESP32_TFT_library copied to clipboard

Is the function TFT_invertDisplay() missing the disp_select() ?

Open Francois-Belanger opened this issue 5 years ago • 1 comments

Great library :-) Just that I had to invert the colour for a new LCD and that function didn't work. I had to change to this.

void TFT_invertDisplay(const uint8_t mode) { if (disp_select() != ESP_OK) { printf("TFT_invertDisplay ERROR !!!!\n"); return; }

if ( mode == INVERT_ON ) disp_spi_transfer_cmd(TFT_INVONN); else disp_spi_transfer_cmd(TFT_INVOFF);

disp_deselect(); }

Is it ok ?

Thanks for the great work.

Francois-Belanger avatar Jul 20 '18 01:07 Francois-Belanger

Adding disp_select() to TFT_invertDisplay solved my problem. Likely also needed for TFT_setGammaCurve

// Send the command to invert all of the colors. // Input: i 0 to disable inversion; non-zero to enable inversion //========================================== void TFT_invertDisplay(const uint8_t mode) { if (disp_select() == ESP_OK) { if ( mode == INVERT_ON ) disp_spi_transfer_cmd(TFT_INVONN); else disp_spi_transfer_cmd(TFT_INVOFF); disp_deselect(); } }

// Select gamma curve // Input: gamma = 0~3 //================================== void TFT_setGammaCurve(uint8_t gm) { uint8_t gamma_curve = 1 << (gm & 0x03); if (disp_select() == ESP_OK) { disp_spi_transfer_cmd_data(TFT_CMD_GAMMASET, &gamma_curve, 1); disp_deselect(); } }

jas39 avatar Sep 10 '19 20:09 jas39