Memory improvements

This commit is contained in:
fvanroie 2020-11-14 17:51:38 +01:00
parent 7d286c24bc
commit 6299927121
2 changed files with 5 additions and 11 deletions

View File

@ -90,10 +90,8 @@ static inline bool openFont(File & file, const char * filename)
static inline void initCharacterFrame(size_t size)
{
if(size > _lv_mem_get_size(charBitmap_p)) {
if(charBitmap_p)
lv_mem_realloc(charBitmap_p, size);
else
charBitmap_p = (uint8_t *)lv_mem_alloc(size);
if(charBitmap_p) lv_mem_free(charBitmap_p);
charBitmap_p = (uint8_t *)lv_mem_alloc(size);
}
_lv_memset_00(charBitmap_p, size); // init the bitmap to white
}

View File

@ -608,7 +608,6 @@ void IRAM_ATTR btn_event_handler(lv_obj_t * obj, lv_event_t event)
{
uint8_t eventid;
char buffer[64];
snprintf(buffer, sizeof(buffer), PSTR("HASP: "));
switch(event) {
case LV_EVENT_PRESSED:
@ -643,17 +642,14 @@ void IRAM_ATTR btn_event_handler(lv_obj_t * obj, lv_event_t event)
return;
case LV_EVENT_VALUE_CHANGED:
strcat_P(buffer, PSTR("Value Changed"));
Log.notice(TAG_HASP, buffer);
Log.warning(TAG_HASP, F("Value changed Event %d occured"), event);
return;
case LV_EVENT_DELETE:
strcat_P(buffer, PSTR("Object deleted"));
Log.notice(TAG_HASP, buffer, event);
Log.warning(TAG_HASP, F("Object deleted Event %d occured"), event);
return;
default:
strcat_P(buffer, PSTR("HASP : Unknown Event occured"));
Log.warning(TAG_HASP, buffer, event);
Log.warning(TAG_HASP, F("Unknown Event %d occured"), event);
return;
}