TFT_eSPI tft.drawWideLine() problem

Hi,
I must be doing something wrong here as I can't get the tft.drawWideLine to work as I think that it should.

Using original ESP32 dev kit.
TFT_eSPI V2.5.0
Arduino IDE 2.1.0
ESP32 board manager 2.0.11
ST7796 driver for 4" TFT display

So I just want to display a border using tft.drawSmoothRoundRect(5, 5, 10, 6, 470, 310, TFT_BLUE);
This appears to work fine.

And then I want to split this into 9 sections using four lines, and here's where the problems come.

Here's the code:

#include <TFT_eSPI.h> 

TFT_eSPI tft = TFT_eSPI();

void setup() {

  tft.begin();
  tft.setRotation(1);
  tft.fillScreen(TFT_WHITE);
  
  tft.drawSmoothRoundRect(5, 5, 10, 6, 470, 310, TFT_BLUE);

  tft.drawWideLine(165, 5, 165, 315, 5, TFT_BLUE); // First vertical line
  delay(500);
  tft.drawWideLine(325, 5, 325, 315, 5, TFT_BLUE); // Second vertical line
  delay(500);
  tft.drawWideLine(5, 108, 475, 108, 5, TFT_BLUE); // First horizontal line
  delay(500);
  tft.drawWideLine(5, 213, 475, 213, 5, TFT_BLUE); // Second horizontal line
  delay(500);
}

void loop() {
  
}

The delay(500); in between the line functions may seems strange, but if I don't any delay then it only draws the first line. Even if I put the code in the loop and not setup.

And even with then, the two vertical lines are as expected, but the horizontal lines are only 1 pixel tall, so just a very thin line. and the lines seems to start about x=3 (not 5) and end about x=477 (not 475).

Very confused. What am I doing wrong?

Cheers,

Matt

Would you show your wiring?

@xfpd
Can't take a pic right now. But I'm sure that there's nothing wrong with the wiring as it's been running fine. I just wanted to change the look of the display.
Matt

Fixed.
Just had to put the background colour in as well.

tft.drawWideLine(165, 5, 165, 315, 5, TFT_BLUE, TFT_WHITE);

All working as expected (hoped) now.

Cheers,

Matt

1 Like

I see you found the issue. Cool. The wiring request is so others can make a testing mockup, not saying an incorrect wiring.

@xfpd
Oh I see.
I can do that later if still helpful to others