Skip to content

Commit

Permalink
SUKU button step helper fuction added to button and encoder elements
Browse files Browse the repository at this point in the history
  • Loading branch information
SukuWc committed Sep 16, 2024
1 parent 4e9781e commit 519f0c4
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 1 deletion.
3 changes: 2 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,8 @@
"bit": "c",
"grid_ui_system.h": "c",
"grid_esp32_module_tek1.h": "c",
"grid_ui_lcd.h": "c"
"grid_ui_lcd.h": "c",
"semaphore": "c"
},
"files.exclude": {
".archive": true,
Expand Down
9 changes: 9 additions & 0 deletions grid_common/grid_ui_button.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,9 @@ void grid_ui_button_store_input(uint8_t input_channel, uint64_t* last_real_time,
#define GRID_LUA_FNC_B_BUTTON_STATE_short "bst"
#define GRID_LUA_FNC_B_BUTTON_STATE_human "button_state"

#define GRID_LUA_FNC_B_BUTTON_STEP_short "bstp"
#define GRID_LUA_FNC_B_BUTTON_STEP_human "button_step"

// Button parameters
#define GRID_LUA_FNC_B_LIST_length 8

Expand Down Expand Up @@ -82,6 +85,12 @@ void grid_ui_button_store_input(uint8_t input_channel, uint64_t* last_real_time,
" GRID_LUA_FNC_B_BUTTON_STATE_short "=function (self,a) return " \
"gtv(self.index, " GRID_LUA_FNC_B_BUTTON_STATE_helper ", a) end, \
\
" GRID_LUA_FNC_B_BUTTON_STEP_short " =function (self) " \
"local steps, min, max, value = self:" GRID_LUA_FNC_B_BUTTON_MODE_short "(), self:" GRID_LUA_FNC_B_BUTTON_MIN_short "(), self:" GRID_LUA_FNC_B_BUTTON_MAX_short \
"(), self:" GRID_LUA_FNC_B_BUTTON_VALUE_short "() " \
"return value // ((max - min) // steps) " \
"end, \
\
" GRID_LUA_FNC_A_INIT_short " = function (self) print('undefined action') end, \
" GRID_LUA_FNC_A_BUTTON_short " = function (self) print('undefined action') end,\
" GRID_LUA_FNC_A_TIMER_short " = function (self) print('undefined action') end,\
Expand Down
9 changes: 9 additions & 0 deletions grid_common/grid_ui_encoder.h
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,9 @@ void grid_ui_encoder_store_input(uint8_t input_channel, uint64_t* encoder_last_r
#define GRID_LUA_FNC_E_ENCODER_SENSITIVITY_short "ese"
#define GRID_LUA_FNC_E_ENCODER_SENSITIVITY_human "encoder_sensitivity"

#define GRID_LUA_FNC_E_BUTTON_STEP_short "bstp"
#define GRID_LUA_FNC_E_BUTTON_STEP_human "button_step"

// Encoder parameters
#define GRID_LUA_FNC_E_LIST_length 17

Expand Down Expand Up @@ -148,6 +151,12 @@ void grid_ui_encoder_store_input(uint8_t input_channel, uint64_t* encoder_last_r
" GRID_LUA_FNC_E_ENCODER_SENSITIVITY_short "=function (self,a) return " \
"gtv(self.index, " GRID_LUA_FNC_E_ENCODER_SENSITIVITY_helper ", a) end, \
\
" GRID_LUA_FNC_E_BUTTON_STEP_short " =function (self) " \
"local steps, min, max, value = self:" GRID_LUA_FNC_B_BUTTON_MODE_short "(), self:" GRID_LUA_FNC_B_BUTTON_MIN_short "(), self:" GRID_LUA_FNC_B_BUTTON_MAX_short \
"(), self:" GRID_LUA_FNC_B_BUTTON_VALUE_short "() " \
"return value // ((max - min) // steps) " \
"end, \
\
" GRID_LUA_FNC_A_INIT_short " = function (self) print('undefined action') end,\
" GRID_LUA_FNC_A_ENCODER_short " = function (self) print('undefined action') end,\
" GRID_LUA_FNC_A_BUTTON_short " = function (self) print('undefined action') end,\
Expand Down

0 comments on commit 519f0c4

Please sign in to comment.