It is currently 19 Sep 2017 13:27

All times are UTC + 1 hour




Post new topic Reply to topic  [ 3 posts ] 
Author Message
PostPosted: 05 Sep 2017 17:15 
Offline

Joined: 04 Aug 2017 18:07
Posts: 9
Hi all,
So I've created a paginated menu with 8 pages each capable of showing six 265-color thumbnails and titles, all of which are stored in a struct. (This is for a food cooker of sorts.)

struct MITEMS {
    unsigned long img[50];
    char name[50][18];
    unsigned long temp[50];
    int mins[50], secs[50];
} MenuItems;


In order to scroll through, I set the img[i] variable to the constant that is defined by VTFT for the location in the .RES file..

const unsigned long CLEGCA_bmp = 0x0000016C;
const unsigned long CSTRIP_bmp = 0x000119AA;
const unsigned long UNDEF_bmp  = 0x000692E0;


void populateFakeMenuItems(void) {
    int loops = 0;
    for (loops = 0; loops <= 50; loops++) {
        sprintf(MenuItems.name[loops], "[%d NOT SET]", loops + 1);
        MenuItems.img[loops] = UNDEF_bmp;
        MenuItems.temp[loops] = 335;
        MenuItems.mins[loops] = 2;
        MenuItems.secs[loops] = 0;
    }

    strcpy(MenuItems.name[0], "Chicken Legs");
    MenuItems.img[0] = CLEGCA_bmp;
    MenuItems.temp[0] = 335;
    MenuItems.mins[0] = 2;
    MenuItems.secs[0] = 0;

    strcpy(MenuItems.name[1], "Chicken Strips");
    MenuItems.img[1] = CSTRIP_bmp;
    MenuItems.temp[1] = 335;
    MenuItems.mins[1] = 2;
    MenuItems.secs[1] = 0;

... so on...


Based on an eveKey that is pressed, the code will set the image and text objects on the MenuScreen to the appropriate values contained in the struct.

void loadMenuScreen(int pgNum) {

    imgMenuA.Picture_Name = MenuItems.img[pgNum * 6];
...
    imgMenuF.Picture_Name = MenuItems.img[pgNum * 6 + 5];

    DrawScreenO(&MenuScreen, VTFT_LOAD_RES_NONE); //Images are shewed. (LOAD_RES_ALL is called by function loading this screen initially.)
//DrawScreenO(&MenuScreen, VTFT_LOAD_RES_ALL); //Takes longer because of re-loading..

    return;
}


My questions are: How can I improve load times? Am I doing this correctly? It seems to work well if I re-load the resources every time but there is a ~1sec delay between page flips.

One other thing to note: I have been able to call DrawScreenO(&MenuScreen, VTFT_LOAD_RES_ALL); on initially loading the MenuScreen from, say, HomeScreen, and then for page number changes calling loadMenuScreen(x) with DrawScreenO(&MenuScreen, VTFT_LOAD_RES_NONE); The only issue is that upon a page change all the images load instantly, but are skewed to the right.. odd. (see attached)

Attachment:
IMG_4250.JPG.jpg
IMG_4250.JPG.jpg [ 43.29 KiB | Viewed 1970 times ]
Attachment:
IMG_4249.JPG.jpg
IMG_4249.JPG.jpg [ 43.23 KiB | Viewed 1970 times ]


Any suggestions?

Thank you!
Harrison


Top
 Profile  
 
PostPosted: 08 Sep 2017 15:20 
Offline
mikroElektronika team
User avatar

Joined: 25 Jan 2008 09:56
Posts: 9319
Hi,

Please, can you record a video of this, so I could see this delay and understand the problem properly ?

Regards,
Filip.


Top
 Profile  
 
PostPosted: 15 Sep 2017 14:44 
Offline

Joined: 04 Aug 2017 18:07
Posts: 9
Sure, and thank you for your response!

https://youtu.be/FjF7g076Itw - Here is a video where DrawScreenO(...,LOAD_RES_ALL) is called when I press the MENU button and then after that when I press Next, Prev, or a page number, LOAD_RES_NONE is used.

https://youtu.be/7s7RyAv-X40 - In this video, DrawScreenO(...,LOAD_RES_ALL) is used each time a button is pressed. Everything looks great, but for the pages where different images are used (the first page) it takes more time to load. (See when I go back to page 1.

One additional thing- I set all images to visible=false, call DrawScreenO(...,VTFT_LOAD_RES_ALL) and then set visible=true for all images then call DrawScreenO(...,VTFT_LOAD_RES_NONE)

This seems to be the only way I can make it load without showing glitches... (Other glitches include the first image (drumstick chicken) being shown for all 6 images for a fraction of a second and then the rest will appear properly.)

menuPicsVisible(false);
DrawScreenO(&MenuScreen, VTFT_LOAD_RES_ALL);
menuPicsVisible(true);
DrawScreenO(&MenuScreen, VTFT_LOAD_RES_NONE);


This is all this function does, to avoid displaying glitches...
void menuPicsVisible(bool vis) {
    imgMenuA.Visible = vis;
    imgMenuB.Visible = vis;
    imgMenuC.Visible = vis;
    imgMenuD.Visible = vis;
    imgMenuE.Visible = vis;
    imgMenuF.Visible = vis;
    return;
}


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to: