2.8" Capacitive Touch Screen v2 BMP Not Displaying Correctly

Post here about your Arduino projects, get help - for Adafruit customers!

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
SolarBlight
 
Posts: 12
Joined: Tue Sep 25, 2018 1:08 pm

2.8" Capacitive Touch Screen v2 BMP Not Displaying Correctly

Post by SolarBlight »

I just purchased the Adafruit 2.8" Capacitive Touch Screen v2 shield and mounted it on an Arduino Uno R3. I downloaded the Adafruit ILI9341 version 1.2.9 library, example code 'spitftbitmap' and uploaded the sketch to the Arduino. The sketch is supposed to display a bmp in a continuous loop. The bitmap first displays one quarter of the image at the bottom left-hand corner and afterwards it displays the full image and then one quarter of the bmp is displayed in the upper right-hand corner as shown in the photo sequence below. It seems like the origin of the BMP is moving up and over one half of the screen each time it redraws.

After searching the forum and internet I haven't found any similar problem. The only change that I've made to the code is commenting out the first 'for' loop in the image rotation section in the void loop.

The example sketch 'graphicstest' runs fine, so I'm not sure why 'spitftbitmap' doesn't work properly.



Code: Select all

void loop() {
  //for(uint8_t r=0; r<4; r++) {           //'for' loop commented out
    tft.setRotation(0);                        // *****Changed to '0', used to be 'r'    *******
    tft.fillScreen(ILI9341_BLUE);
    for(int8_t i=-2; i<1; i++) {
      bmpDraw("purple.bmp",
        (tft.width()  / 2) + (i * 120),
        (tft.height() / 2) + (i * 160));
    }
 // }                                                   //end of 'for' loop commented out
}
Attachments
display problem 1.jpg
display problem 1.jpg (23.17 KiB) Viewed 267 times
display problem 3.jpg
display problem 3.jpg (31.12 KiB) Viewed 267 times
display problem 5.jpg
display problem 5.jpg (31.1 KiB) Viewed 267 times

User avatar
adafruit_support_carter
 
Posts: 29457
Joined: Tue Nov 29, 2016 2:45 pm

Re: 2.8" Capacitive Touch Screen v2 BMP Not Displaying Corre

Post by adafruit_support_carter »

Does it work OK if you leave the loop in and run the example unmodified?

User avatar
SolarBlight
 
Posts: 12
Joined: Tue Sep 25, 2018 1:08 pm

Re: 2.8" Capacitive Touch Screen v2 BMP Not Displaying Corre

Post by SolarBlight »

No, I still get the same problem when adding the loop function back in the sketch. Is there anything else I can do to test it?

User avatar
adafruit_support_carter
 
Posts: 29457
Joined: Tue Nov 29, 2016 2:45 pm

Re: 2.8" Capacitive Touch Screen v2 BMP Not Displaying Corre

Post by adafruit_support_carter »

OK. I just tested this and I'm getting the same thing. I'm wondering if something has changed with the GFX library. I'll pass this on.

User avatar
adafruit2
 
Posts: 22187
Joined: Fri Mar 11, 2005 7:36 pm

Re: 2.8" Capacitive Touch Screen v2 BMP Not Displaying Corre

Post by adafruit2 »

its not rotating but it *is* supposed to be moving correctly.

"bmpDraw("purple.bmp",
(tft.width() / 2) + (i * 120),
(tft.height() / 2) + (i * 160));"

means draw in different quadants as i increments

do you need to display rotated bitmaps? if not, this doesnt matter
either way its something in our bitmap drawing that doesnt handle rotating, but the hardware is fine

User avatar
SolarBlight
 
Posts: 12
Joined: Tue Sep 25, 2018 1:08 pm

Re: 2.8" Capacitive Touch Screen v2 BMP Not Displaying Corre

Post by SolarBlight »

I don't want to display a rotating image just a static BMP.

User avatar
adafruit2
 
Posts: 22187
Joined: Fri Mar 11, 2005 7:36 pm

Re: 2.8" Capacitive Touch Screen v2 BMP Not Displaying Corre

Post by adafruit2 »

ok, well it works then?

User avatar
SolarBlight
 
Posts: 12
Joined: Tue Sep 25, 2018 1:08 pm

Re: 2.8" Capacitive Touch Screen v2 BMP Not Displaying Corre

Post by SolarBlight »

No, even if I put the for loop back in the code it still moves the point of origin and appears fractured.

User avatar
adafruit2
 
Posts: 22187
Joined: Fri Mar 11, 2005 7:36 pm

Re: 2.8" Capacitive Touch Screen v2 BMP Not Displaying Corre

Post by adafruit2 »

it should, its drawing in offset locations!

User avatar
SolarBlight
 
Posts: 12
Joined: Tue Sep 25, 2018 1:08 pm

Re: 2.8" Capacitive Touch Screen v2 BMP Not Displaying Corre

Post by SolarBlight »

Sorry I haven't been able to get back to you in a while. I don't want the TFT to draw in offset locations, is there something in the code I can change to just show the full STATIC bmp?

User avatar
adafruit2
 
Posts: 22187
Joined: Fri Mar 11, 2005 7:36 pm

Re: 2.8" Capacitive Touch Screen v2 BMP Not Displaying Corre

Post by adafruit2 »

remove the loop code - if this is your first arduino project you may want to try some simpler ones to start!

User avatar
SolarBlight
 
Posts: 12
Joined: Tue Sep 25, 2018 1:08 pm

Re: 2.8" Capacitive Touch Screen v2 BMP Not Displaying Corre

Post by SolarBlight »

Thanks for the help, I modified the code in the loop function and now it's working fine.

modified code:

Code: Select all

void loop() {
  //for(uint8_t r=0; r<4; r++) {                 // I want a still image so I commented out the rotation loop
    tft.setRotation(0);                              // fixed rotation to "0"
    tft.fillScreen(ILI9341_BLUE);
    for(int8_t i=-1; i<0; i++) {                 // Changed i=-2 to i=-1 and i<1 to i<0 so the FOR LOOP executes only once
      bmpDraw("flowers.bmp",0,0);
      // (tft.width()  / 2) + (i * 120),         // removed the x origin calculation and fixed it as "0" in bmpDraw function
      // (tft.height() / 2) + (i * 160));        // removed the y origin calculation and fixed it as "0" in bmpDraw function
    } 
}
flowersBMP small.jpg
flowersBMP small.jpg (101.34 KiB) Viewed 150 times

Locked
Please be positive and constructive with your questions and comments.

Return to “Arduino”