mirror of
https://github.com/HASwitchPlate/openHASP.git
synced 2025-07-27 05:06:44 +00:00
Tidy up code
This commit is contained in:
parent
57435c6c33
commit
e07857533a
@ -24,6 +24,10 @@
|
|||||||
|
|
||||||
#include "hasplib.h"
|
#include "hasplib.h"
|
||||||
|
|
||||||
|
#define HASP_NUM_PAGE_PREV (HASP_NUM_PAGES + 1)
|
||||||
|
#define HASP_NUM_PAGE_BACK (HASP_NUM_PAGES + 2)
|
||||||
|
#define HASP_NUM_PAGE_NEXT (HASP_NUM_PAGES + 3)
|
||||||
|
|
||||||
const char** btnmatrix_default_map; // memory pointer to lvgl default btnmatrix map
|
const char** btnmatrix_default_map; // memory pointer to lvgl default btnmatrix map
|
||||||
// static unsigned long last_change_event = 0;
|
// static unsigned long last_change_event = 0;
|
||||||
static bool last_press_was_short = false; // Avoid SHORT + UP double events
|
static bool last_press_was_short = false; // Avoid SHORT + UP double events
|
||||||
@ -370,14 +374,18 @@ void generic_event_handler(lv_obj_t* obj, lv_event_t event)
|
|||||||
if(obj->user_data.actionid) {
|
if(obj->user_data.actionid) {
|
||||||
if(eventid == HASP_EVENT_UP || eventid == HASP_EVENT_SHORT) {
|
if(eventid == HASP_EVENT_UP || eventid == HASP_EVENT_SHORT) {
|
||||||
lv_scr_load_anim_t transitionid = (lv_scr_load_anim_t)obj->user_data.transitionid;
|
lv_scr_load_anim_t transitionid = (lv_scr_load_anim_t)obj->user_data.transitionid;
|
||||||
if(obj->user_data.actionid == HASP_NUM_PAGES + 1) {
|
switch(obj->user_data.actionid) {
|
||||||
haspPages.prev(transitionid);
|
case HASP_NUM_PAGE_PREV:
|
||||||
} else if(obj->user_data.actionid == HASP_NUM_PAGES + 2) {
|
haspPages.prev(transitionid);
|
||||||
haspPages.back(transitionid);
|
break;
|
||||||
} else if(obj->user_data.actionid == HASP_NUM_PAGES + 3) {
|
case HASP_NUM_PAGE_BACK:
|
||||||
haspPages.next(transitionid);
|
haspPages.back(transitionid);
|
||||||
} else {
|
break;
|
||||||
haspPages.set(obj->user_data.actionid, transitionid);
|
case HASP_NUM_PAGE_NEXT:
|
||||||
|
haspPages.next(transitionid);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
haspPages.set(obj->user_data.actionid, transitionid);
|
||||||
}
|
}
|
||||||
dispatch_output_current_page();
|
dispatch_output_current_page();
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user