Teensy 4.0, problem with the presentation of 2 pictures

Status
Not open for further replies.

Gary

Active member
Hi

I have a problem with my Teensy or my sketch. I use a 240x240 display ST7789. I have defined the Adafruit GFX and the ST7789 libraries.


The two pictures are activated with the code:

Code:
  tft.init(240, 240);  
  tft.fillScreen(ST77XX_WHITE);
  tft.setRotation(2);
  tft.writeRect(0, 0, 240 , 240, (uint16_t*)Logo240neu);

  delay(2000);

  tft.fillScreen(ST77XX_WHITE);
  tft.setRotation(2);
  tft.writeRect(0, 0, 240 , 240, (uint16_t*)Tacho240Print);

  delay(2000);

The first picture wasn't shown correct.

The Arduino IDE generate the following error:

In file included from C:\Users\FLIP S 14\Documents\Arduino\TeensyTestV6\TeensyTestV6.ino:27:0:


C:\Users\FLIPS1~1\AppData\Local\Temp\arduino_build_858168\sketch\Logo240neu.c:13:0: warning: "PROGMEM" redefined

#define PROGMEM

^

In file included from C:\Program Files (x86)\Arduino\hardware\teensy\avr\cores\teensy4/WProgram.h:41:0,

from C:\Users\FLIPS1~1\AppData\Local\Temp\arduino_build_858168\pch\Arduino.h:6:

C:\Program Files (x86)\Arduino\hardware\teensy\avr\cores\teensy4/avr/pgmspace.h:30:0: note: this is the location of the previous definition

#define PROGMEM __attribute__((section(".progmem")))


I have no idea why the picture wasn't shown correct. Someone of you an idea??


Greetings

Gray
 
Sorry probably can not help much without additional information, like was not shown correct is not descriptive. Was it just garbage? Was the screen a solid color? Were the lines not lining up with the previous one? ...

Could be the data is bad. I am assuming from your other messages it was an array of 240*240 16 bit color values in the 565 color format?

The interesting thing about PROGMEM, is that on T3.x this does not do anything, so the #define PROGMEM is what is typically used.

But on T4.x, it is used as a way to tell the compiler/linker that this object should stay in the flash image and not be copied down to the RAM memory... Note: when PROGMEM is used on AVR based Arduinos, this usually implies you have to do special things to access the memory. In our case there is one unified memory space, so you don't need all of the other macros that AVR boards use to access stuff stored in PROGMEM
 
Thanks

Hi Kurt

Thanks for your reply. I have tried to send the code many times to the Teensy. In every case there was a bad picture. Its looked like that there are many pictures at the same time.

Yesterday late evening I have tried a last attempt. After installing the Blink code, I have installed my code again. Then all pictures were shown correct.

I have no idea why, but now its all ok. In this cases I know that I am an absolut beginner..

Greetings
Gary
 
Glad it is working,

Also might help in cases like this to know for sure which ST7789 library you are using? Are you using the Adafruit library or are you using the one from Teensyduino: (ST7789_t3) ?

I am/was guessing ours you you mentioned writeRect and I don't remember Adafruit having that one.

EDIT:
Also if your pictures came from one of those utilities (website) that converts a bitmap to an array, that starts off looking something like:
Code:
#include <Arduino.h>
// Generated by   : ImageConverter 565 Online
// Generated from : Gauage.jpg
// Time generated : Wed, 18 Dec 19 04:53:08 +0100  (Server timezone: CET)
// Image Size     : 240x240 pixels
// Memory usage   : 115200 bytes


const unsigned short gauge[57600] PROGMEM={
I think this put in that 2nd #define for PROGMEM... If so I typically go in and remove it.
 
Status
Not open for further replies.
Back
Top