ImpulseAdventure / GUIslice

GUIslice drag & drop embedded GUI in C for touchscreen TFT on Arduino, Raspberry Pi, ARM, ESP8266 / ESP32 / M5stack using Adafruit-GFX / TFT_eSPI / UTFT / SDL
https://www.impulseadventure.com/elec/guislice-gui.html
MIT License
1.17k stars 209 forks source link

Crashed when using TFT_ESPI Smooth Font with XKeyPadAlpha #401

Closed DynamicLoader closed 3 years ago

DynamicLoader commented 3 years ago

Describe the bug

When I click a InputText element which pre-set a string contained Chinese characters,XKeyPadAlpha is going to popup (grid has been drawn),then CPU 1 panic. Reported first here

Device hardware

Checklist to try first

Expected behavior

Well,no crash at that time.Characters that doesn't support in XKeyPadAlpha could be removed.

Initialization messages

GUIslice version [0.16.1.1]:

DynamicLoader commented 3 years ago

After remove unloadfont as here,the XKeyPadAlpha popuped normally and refresh speed returned normal.

@ImpulseAdventure Maybe you should fix this in API?

ImpulseAdventure commented 3 years ago

Thanks @Lucy2003 for pointing this out. I’ll definitely look into integrating the unloadfont fix that you and Paul have been trying out. As I won’t have access to the computer for testing until later next week, I will create a branch for you to confirm that it tests ok on your setup.

thx

DynamicLoader commented 3 years ago

Hi,

I'm sorry that I may have some delay since next week.I will do the test when I'm available.

ImpulseAdventure commented 3 years ago

Hi @Pconti31 and @Lucy2003 --

I have made some changes to the TFT_eSPI driver to address the loadFont / unloadFont optimization. Please try out the code in https://github.com/ImpulseAdventure/GUIslice/compare/WIP401-unloadFont

Note that I decided to save the font reference pointer rather than explicitly comparing the filename.

DynamicLoader commented 3 years ago

I am sorry to tell you that I can't compile these code. The compiler output:

{DIR}\libraries\GUIslice\src\GUIslice_drv_tft_espi.cpp: In function 'bool gslc_DrvDrawTxtAlign(gslc_tsGui*, int16_t, int16_t, int16_t, int16_t, int8_t, gslc_tsFont*, const char*, gslc_teTxtFlags, gslc_tsColor, gslc_tsColor)':

{DIR}\libraries\GUIslice\src\GUIslice_drv_tft_espi.cpp:429:40: error: invalid conversion from 'const void*' to 'void*' [-fpermissive]

           pDriver->pvFontLast = pFont->pvFont;

                                        ^

{DIR}\libraries\GUIslice\src\GUIslice_drv_tft_espi.cpp: In function 'bool gslc_DrvDrawTxt(gslc_tsGui*, int16_t, int16_t, gslc_tsFont*, const char*, gslc_teTxtFlags, gslc_tsColor, gslc_tsColor)':

{DIR}\libraries\GUIslice\src\GUIslice_drv_tft_espi.cpp:489:40: error: invalid conversion from 'const void*' to 'void*' [-fpermissive]

           pDriver->pvFontLast = pFont->pvFont;

                                        ^

That's a small problem.By modifing like the line below,I can compile it.

pDriver->pvFontLast = (void*)pFont->pvFont;

In the end,it works well.

ImpulseAdventure commented 3 years ago

Thanks @Lucy2003 -- that's good news...

Can you retry the latest version in the pull request here:

DynamicLoader commented 3 years ago

Ha,the updated code compiled withot any warning or error.And the code works well.

The issue had been solved.Thanks,@ImpulseAdventure .

ImpulseAdventure commented 3 years ago

Good to hear it! The changes have been merged now.