lorenzo906 / m2tklib

Automatically exported from code.google.com/p/m2tklib
0 stars 0 forks source link

Weird behavior when using U8G low level graphics and m2_gh_u8g_bf #119

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
When using U8G drawing functions and m2_gh_u8g_bf (or m2_gh_u8g_bfs) behavior 
seen on video occurs. U8G drawings disappears when navigating through options.
This doesn't happens when using m2_gh_u8g_fb or m2_gh_u8g_ffs.

CODE:
=====

void desenha_tela_princial(void)
{
    if(m2_GetRoot() == &list_menu_principal)
    {
        u8g_DrawRFrame(&u8g, 0, 0, 128, 64, 2);
        u8g_DrawHLine(&u8g, 0, 8, 128);
        u8g_DrawHLine(&u8g, 0, 25, 128);

        FLAG_ATUALIZA_TELA = 0;
    } else if (m2_GetRoot() == &centered_vlist_button) {
        u8g_DrawRFrame(&u8g, 18,0, 110, 64, 2);
    }   
}

==========================================================================

while(1)
    {       
        chk_btns();                     
        m2_CheckKey();      
        m2_CheckKey();
        if (m2_HandleKey() != 0 || FLAG_ATUALIZA_TELA != 0) {       
            // picture loop starts here
            u8g_FirstPage(&u8g);
            do {                                                    
                m2_Draw();
                desenha_tela_princial();
                m2_CheckKey();
                chk_btns();             
            } while(u8g_NextPage(&u8g));        
        }   
    } 

Original issue reported on code.google.com by will...@curitiba.org on 18 Oct 2013 at 2:00

GoogleCodeExporter commented 8 years ago
Link to the video: http://www.youtube.com/watch?v=5M9oob-NKzU

Original comment by will...@curitiba.org on 18 Oct 2013 at 2:01

GoogleCodeExporter commented 8 years ago
hmm... not sure how i can track down the problem. I will try to reproduce this 
bug in my sdl simulation environment. But i do not know when i will be able to 
do this.

Original comment by olikr...@gmail.com on 18 Oct 2013 at 6:07

GoogleCodeExporter commented 8 years ago
Is there anything I can do to help?

Original comment by will...@curitiba.org on 18 Oct 2013 at 6:18

GoogleCodeExporter commented 8 years ago
A simple but complete example would be great. Maybe you can cut down the code 
to some little simple file, that still reproduces the bug.
The complete source mighte be usefull also... At the end i need something which 
gets compiled and makes the problem visible.

Original comment by olikr...@gmail.com on 18 Oct 2013 at 6:23

GoogleCodeExporter commented 8 years ago
I will provide it to you. I really have to say thanks. You are very kindly!

Original comment by will...@curitiba.org on 18 Oct 2013 at 6:40

GoogleCodeExporter commented 8 years ago
Maybe just a 
    u8g_SetDefaultForegroundColor(&u8g);
is missing. Will this help?

void desenha_tela_princial(void)
{
    if(m2_GetRoot() == &list_menu_principal)
    {
        u8g_SetDefaultForegroundColor(&u8g);

        u8g_DrawRFrame(&u8g, 0, 0, 128, 64, 2);
        u8g_DrawHLine(&u8g, 0, 8, 128);
        u8g_DrawHLine(&u8g, 0, 25, 128);

        FLAG_ATUALIZA_TELA = 0;
    } else if (m2_GetRoot() == ¢ered_vlist_button) {
        u8g_DrawRFrame(&u8g, 18,0, 110, 64, 2);
    }   
}

Original comment by olikr...@gmail.com on 20 Oct 2013 at 8:22

GoogleCodeExporter commented 8 years ago
Worked like a charm! I'm sorry, it was my mistake. Thanks.

Original comment by will...@curitiba.org on 21 Oct 2013 at 12:30

GoogleCodeExporter commented 8 years ago
well, maybe too less dokumentation saying that the u8g state is undefined after 
calling m2tklib draw procedures.

I will close this issue. 

Thanks for using m2tklib

Original comment by olikr...@gmail.com on 21 Oct 2013 at 1:47