Hello
I have two buttons
lv_obj_add_event_cb(ui_screenMusical, setMusicalMode, LV_EVENT_SCREEN_LOADED, NULL);
lv_obj_add_event_cb(ui_screenHistory, setHistoryMode, LV_EVENT_SCREEN_LOADED, NULL);
Functions are
void setMusicalMode(lv_event_t *e)
{
currentFolder = "/m";
setRootDirectory(currentFolder);
playFirstMP3IfAvailable();
}
void setHistoryMode(lv_event_t *e)
{
currentFolder = "/h";
setRootDirectory(currentFolder);
playFirstMP3IfAvailable();
}
I want to regroup those 2 functions in one called setMode
void setMode(const String &mode, lv_event_t event) {
currentFolder = mode; // Set the current folder to /m or /h
setRootDirectory(currentFolder);
playFirstMP3IfAvailable();
}
const String musicalModeData = "/m";
const String historyModeData = "/h";
lv_obj_add_event_cb(ui_screenMusical, setMode, LV_EVENT_SCREEN_LOADED, &musicalModeData);
lv_obj_add_event_cb(ui_ScreenHistory, setMode, LV_EVENT_SCREEN_LOADED, &historyModeData);
But It does not work like I thought.
Can you tell me how to do that ?
Regards