Go Down

Topic: [RE-SOLVED] UTFT myGLCD bitmap image not displaying (Read 240 times) previous topic - next topic

XRAD

Yes I researched this for a while, can't find answer. I am using newest 565 converter from:
http://www.rinkydinkelectronics.com/t_imageconverter565.php   to create .c file from 100x60 or so jpg. No issue there.  I am using a Teensy 3.2 with only 37% prog storage and 9% dynamic mem used.
I am using UTFT and I do not want to use SD card for one image, I would like to use onboard teensy mem.  Using ILI9341 320x240 TFT, screen works without issue.

I can get an older "icon" image to display, but not my small 565 converted jpg image.

WORKS with zero issues:
Code: [Select]


extern unsigned short icon[0x400];


myGLCD.drawBitmap (32, 32, 32, 32, icon);  //(x,y,width,height, image.c)


//.c file in .ino folder
// Generated by  : ImageConverter 565 v1.0
// Generated from: taskmgr.png
// Time generated: 11.10.2010 22:51:23
// Size          : 2 048 Bytes

const unsigned short icon[0x400] ={
0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, etc.....
};





DOES NOT WORK:

Code: [Select]


extern const unsigned int engsml[6400];  // compiles no issue
//extern unsigned int engsml[6400]; // compiles
//extern unsigned int engsml[];// compiles

myGLCD.drawBitmap (32, 32, 100, 64, engsml); // does not compile

//.c file in .ino folder
// Generated by   : ImageConverter 565 Online
// Generated from : engsml.jpg
// Time generated : Mon, 10 Dec 18 02:37:35 +0100  (Server timezone: CET)
// Image Size     : 100x64 pixels
// Memory usage   : 12800 bytes


#if defined(__AVR__)
    #include <avr/pgmspace.h>
#elif defined(__PIC32MX__)
    #define PROGMEM
#elif defined(__arm__)
    #define PROGMEM
#endif

const unsigned short engsml[6400] PROGMEM={
//const unsigned short engsml[6400] ={                    // does not work
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, etc.....
};




compile error says I need to add the other three arguments for degrees and rotation so I did this and no compile:

Code: [Select]


myGLCD.drawBitmap (32, 32, 100, 64, radioactive,0,0,0);




Thx in advance for any pointers......

PaulS

const unsigned short icon[0x400] ={
extern const unsigned int engsml[6400];  // compiles no issue
Why did you change the type?

Where IS engsm declared? What type is it there?
The art of getting good answers lies in asking good questions.

XRAD

#2
Dec 10, 2018, 01:15 pm Last Edit: Dec 10, 2018, 01:34 pm by XRAD
Thx for reply! I used as a short test example for image  "icon" from:

https://codebender.cc/example/UTFT/chipKit:UTFT_Bitmap#UTFT_Bitmap.ino

which uses declaration:
Code: [Select]

extern unsigned short icon[0x400];// this declaration which was not changed and works


and in the loop:

Code: [Select]

myGLCD.drawBitmap (x, y, size, size, icon);



this works fine to display the 'icon' image .c file which was loaded into my sketch folder.


my issue is using larger, or for some reason not correctly allocated into memory, MY image .c file. I tried different types for the SECOND example in first post thinking that I did not create the correct type........at first I thought my initial image was too big for 'short'  so I made  the smaller 6400 image and did try several types (which come from some examples on the net using const and int ) which compiled (so I thought images were loaded into flash memory). I also tried :

Code: [Select]

extern unsigned short engsml[6400];


this did not work either when I added

Code: [Select]

myGLCD.drawBitmap (32, 32, 100, 64, engsml);


....But I will try again!

I did not post my entire sketch because the rest of it has nothing really to do with showing the .c file and it is 800 lines long.  I am trying to add my one engsml.c  image to show once during setup.


gfvalvo

I did not post my entire sketch because the rest of it has nothing really to do with showing the .c file and it is 800 lines long.
Then post an MCVE.

Also, it's much more useful to post actual (and complete) compiler error messages rather than just saying "it didn't work".
No technical questions via PM. They will be ignored. Post your questions in the forum so that all may learn.

XRAD

Thx!

I will post MCVE.....but in the trimmed down version, it is only going to add the object/ wiring to the TFT. 

I did give the error code :

compile error says I need to 'add the other three arguments for degrees and x y rotation' so I did this and no compile:

myGLCD.drawBitmap (32, 32, 100, 64, radioactive,0,0,0);

Error only comes up with my bitmap call......


I will add any errors that come up with the MCVE.


XRAD

Darn it! too simple a fix.  Not sure why I thought I needed the wrong 'type' except that I cut and pasted out of another sketch and got way sidetracked on file size... Paul was right on as usual......


This works fine with ALL my images tested up to 320x240:

Code: [Select]


#include <UTFT.h>

UTFT myGLCD(ILI9341_S5P, 7,  14,  10,   8,   9); // (ILI9341_S5P, MOSI, SCK, CS, RST,DC)

extern unsigned short icon[0x400];//  2048 bytes
//extern unsigned short radioactive[];// 32768 bytes
//extern unsigned short ENGSMALL[];//  132480 bytes

void setup() {
  myGLCD.InitLCD();
  myGLCD.clrScr();

  myGLCD.drawBitmap(32, 32, 32, 32, icon);
  //myGLCD.drawBitmap  (100, 50, 128, 128, radioactive);
  //myGLCD.drawBitmap (0, 0, 320, 207,ENGSMALL);
}

void loop() {
}

Go Up