Description
Hi, I am using the elecrow 5 inch Display. I wan´t to save a data string in the flash memory, when a button is pressed, by using the libary Preferences.h.
Sometimes the Display is flickering and i don´t know how to prevent the problem.
What MCU/Processor/Board and compiler are you using?
ESP32 / VSC
What LVGL version are you using?
8.3.6
What do you want to achieve?
Stop flickering when save data.
What have you tried so far?
Code to reproduce
Add a code snippet which can run in the simulator. It should contain only the relevant code that compiles without errors when separated from your main code base.
The code block(s) should be formatted like:
/*You code here*/
void SaveData(int Dataseparated,bool newData)
{
buffer[100];
char text[20];
char Ventilnummer[20] = “Ventil”;
if(newData)
{
Dataseparated[CHANGED] = 1;
}
sprintf(text, "%d,",Dataseparated[POSI]);
strcpy(buffer,text);
for(int i = 1; i < ANZAHLSPEICHERSTELLEN; i++)
{
sprintf(text,"%d,",Dataseparated[i]);
strcat(buffer,text);
}
//Serial.print("gespeicherte Daten:");
//Serial.println(buffer);
preferences.begin("Ventildata",false);
sprintf(Ventilnummer,"Ventil%d",Dataseparated[POSI]);
preferences.putString(Ventilnummer,buffer);
preferences.end();
}
void eventButtonSpeichern(lv_event_t * e)
{
lv_event_code_t event_code = lv_event_get_code(e);
if(event_code == LV_EVENT_RELEASED && speichern)
{
SaveData(Data->Dataseparated,true);
speichern = false;
lv_obj_set_style_bg_color(buttonSpeichern,lv_palette_main(LV_PALETTE_GREY),LV_PART_MAIN);
}
}
Screenshot and/or video
If possible, add screenshots and/or videos about the current state.