Hi I am really quite stumped by this as when I first use the writeRect method it draws the image fine but subsequent attempts draws a dark rectangle with scrolling diagonal red lines.
The first attempt thta works calls the DisplayStatus method which in turn calls the Show_BTDiscovery method and it works fine.
Then later my main code calls Show_BTDiscovery directly and this is when it doesn't work.
The main code reads and parses data from serial3 which is connected to an ESP32. On boot the ESP32 does a BT discovery to try and find a known device to connect to and sends status notifications over the serial line.
The image byte arrays were created using http://www.rinkydinkelectronics.com/_t_doimageconverter565.php which works very well and each of the images can be displayed fine by the DisplayStatus method by not independently later on.
I am using a Teensy 4.1 with the Arduino IDE on the Teensy side and Espressif IDF on the ESP32 side.
Up to now I have had no problem with the graphics on the display and can plot lines and draw circles and rectangles etc with no problem.
I am using this driver as I have the display on the 2nd SPI interface as the normal can only work with the 1st SPI interface.
I thought maybe it worked because of something to do with the fill screen so i tried with a fill screen in each of the methods and it didn't work still.
Here is a link to a very short video clip showing the problem
On the top far right you can see briefly a red BT symbol before it gets overwritten by a black rectangle with scrolling lines.
Every time the same method call is made with true so should be displaying the same symbol all the time.
Another clip showing the graphics etc working fine on the display before I decided to add notifications so I could see what was going on with the Bluetooth.
I am obviously doing something stupid but i can't for the life of me work it out.
Actually I should mention it has an audio shield on it as well but I don't think it is related to that.
The first attempt thta works calls the DisplayStatus method which in turn calls the Show_BTDiscovery method and it works fine.
Then later my main code calls Show_BTDiscovery directly and this is when it doesn't work.
The main code reads and parses data from serial3 which is connected to an ESP32. On boot the ESP32 does a BT discovery to try and find a known device to connect to and sends status notifications over the serial line.
The image byte arrays were created using http://www.rinkydinkelectronics.com/_t_doimageconverter565.php which works very well and each of the images can be displayed fine by the DisplayStatus method by not independently later on.
I am using a Teensy 4.1 with the Arduino IDE on the Teensy side and Espressif IDF on the ESP32 side.
Up to now I have had no problem with the graphics on the display and can plot lines and draw circles and rectangles etc with no problem.
I am using this driver as I have the display on the 2nd SPI interface as the normal can only work with the 1st SPI interface.
I thought maybe it worked because of something to do with the fill screen so i tried with a fill screen in each of the methods and it didn't work still.
Here is a link to a very short video clip showing the problem
On the top far right you can see briefly a red BT symbol before it gets overwritten by a black rectangle with scrolling lines.
Every time the same method call is made with true so should be displaying the same symbol all the time.
Another clip showing the graphics etc working fine on the display before I decided to add notifications so I could see what was going on with the Bluetooth.
I am obviously doing something stupid but i can't for the life of me work it out.
Actually I should mention it has an audio shield on it as well but I don't think it is related to that.
Code:
#define TFT_SCLK 27 // SCLK can also use pin 14
#define TFT_MOSI 26 // MOSI can also use pin 7
#define TFT_MISO 39 // MOSI can also use pin 7
#define TFT_CS 22 // CS & DC can use pins 2, 6, 9, 10, 15, 20, 21, 22, 23
#define TFT_DC 40 // but certain pairs must NOT be used: 2+10, 6+9, 20+23, 21+22
#define TFT_RST 255 // RST can use any pin
#define SD_CS 10 // CS for SD card on audio board
void DisplaySelection::init()
{
tft = new ILI9341_t3n(TFT_CS, TFT_DC, TFT_RST, TFT_MOSI, TFT_SCLK, TFT_MISO);
tft->begin();
tft->setRotation(3);
ts.begin(SPI1);
DisplayStatus();
}
void DisplaySelection::Show_BTDiscovery(bool show)
{
if (show)
{
tft->writeRect(300, 2, 17, 21, (uint16_t*)bluetooth2_sym);
} else
{
tft->fillRect(300, 2, 17, 21, ILI9341_WHITE);
}
}
void DisplaySelection::ShowDC_BTSym(bool show)
{
if (show)
{
tft->writeRect(300, 2, 17, 21, (uint16_t*)bluetooth_sym);
} else
{
tft->fillRect(300, 2, 17, 21, ILI9341_WHITE);
}
}
void DisplaySelection::ShowApp_BTSym(bool show)
{
if (show)
{
tft->writeRect(280, 2, 17, 21, (uint16_t*)bluetooth_sym);
} else
{
tft->fillRect(280, 2, 17, 21, ILI9341_WHITE);
}
}
void DisplaySelection::ShowApp_MuteSym(bool show)
{
if (show)
{
tft->writeRect(260, 2, 18, 21, (uint16_t*)mute);
} else
{
tft->fillRect(260, 2, 18, 21, ILI9341_WHITE);
}
}
void DisplaySelection::DisplayStatus()
{
tft->fillScreen(ILI9341_WHITE);
Show_BTDiscovery(true);
ShowApp_BTSym(true);
ShowApp_MuteSym(true);
tft->setTextColor(ILI9341_BLACK, ILI9341_WHITE);
tft->setTextSize(2);
tft->setCursor(2, 2);
tft->printf("Vol %3.2f", voiceVolumeParam->Value());
}
Last edited: