Skip to content

Commit

Permalink
SUKU system element element_index template parameter implemented
Browse files Browse the repository at this point in the history
  • Loading branch information
SukuWc committed Aug 30, 2024
1 parent aff4112 commit f922745
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 2 deletions.
14 changes: 12 additions & 2 deletions grid_common/grid_ui_system.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,19 @@ void grid_ui_element_system_init(struct grid_ui_element* ele) {
grid_ui_event_init(ele, 2, GRID_PARAMETER_EVENT_MIDIRX, GRID_LUA_FNC_A_MIDIRX_short, grid_ui_system_midirx_actionstring); // Midi Receive
grid_ui_event_init(ele, 3, GRID_PARAMETER_EVENT_TIMER, GRID_LUA_FNC_A_TIMER_short, grid_ui_system_timer_actionstring);

ele->template_initializer = NULL;
ele->template_parameter_list_length = 0;
ele->template_initializer = &grid_ui_element_system_template_parameter_init;
ele->template_parameter_list_length = GRID_LUA_FNC_S_LIST_length;

ele->event_clear_cb = NULL;
ele->page_change_cb = NULL;
}

void grid_ui_element_system_template_parameter_init(struct grid_ui_template_buffer* buf) {

// printf("template parameter init\r\n");

uint8_t element_index = buf->parent->index;
int32_t* template_parameter_list = buf->template_parameter_list;

template_parameter_list[GRID_LUA_FNC_S_ELEMENT_INDEX_index] = element_index;
}
12 changes: 12 additions & 0 deletions grid_common/grid_ui_system.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,22 @@

void grid_ui_element_system_init(struct grid_ui_element* ele);

void grid_ui_element_system_template_parameter_init(struct grid_ui_template_buffer* buf);

#define GRID_LUA_FNC_S_ELEMENT_INDEX_index 0
#define GRID_LUA_FNC_S_ELEMENT_INDEX_helper "0"
#define GRID_LUA_FNC_S_ELEMENT_INDEX_short "ind"
#define GRID_LUA_FNC_S_ELEMENT_INDEX_human "element_index"

#define GRID_LUA_FNC_S_LIST_length 1

// System init function
#define GRID_LUA_SYS_META_init \
"system_meta = { __index = { \
\
" GRID_LUA_FNC_S_ELEMENT_INDEX_short "=function (self,a) return " \
"gtv(self.index, " GRID_LUA_FNC_S_ELEMENT_INDEX_helper ", a) end, \
\
" GRID_LUA_FNC_A_INIT_short " = function (self) print('undefined action') end, \
" GRID_LUA_FNC_A_MAPMODE_short " = function (self) print('undefined action') end,\
" GRID_LUA_FNC_A_MIDIRX_short " = function (self) print('undefined action') end,\
Expand Down

0 comments on commit f922745

Please sign in to comment.