Skip to content

Commit

Permalink
SUKU lcd element created, vsnx hwcfg trick removed
Browse files Browse the repository at this point in the history
  • Loading branch information
SukuWc committed Sep 2, 2024
1 parent b287439 commit fe6b724
Show file tree
Hide file tree
Showing 9 changed files with 87 additions and 6 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/protocol_converter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ on:
- 'grid_common/grid_ui_encoder.h'
- 'grid_common/grid_ui_endless.h'
- 'grid_common/grid_ui_potmeter.h'
- 'grid_common/grid_ui_lcd.h'
- '.github/workflows/protocol_converter.yml'
- '.github/workflows/protocol_converter.py'
- '.github/workflows/documentation_validator.sh'
Expand All @@ -46,7 +47,7 @@ jobs:
- uses: actions/setup-python@v2
- name: Setup python
run: |
python ./.github/workflows/protocol_converter.py ./grid_common/grid_protocol.h,./grid_common/grid_ui_system.h,./grid_common/grid_ui_button.h,./grid_common/grid_ui_encoder.h,./grid_common/grid_ui_endless.h,./grid_common/grid_ui_potmeter.h grid-protocol/src/grid_protocol_bot.json grid-protocol/grid-protocol/lists.py
python ./.github/workflows/protocol_converter.py ./grid_common/grid_protocol.h,./grid_common/grid_ui_system.h,./grid_common/grid_ui_button.h,./grid_common/grid_ui_encoder.h,./grid_common/grid_ui_endless.h,./grid_common/grid_ui_potmeter.h,./grid_common/grid_ui_lcd.h grid-protocol/src/grid_protocol_bot.json grid-protocol/grid-protocol/lists.py
- name: Check file
run: |
Expand Down
3 changes: 2 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,8 @@
"grid_d51.h": "c",
"grid_ui_encoder.h": "c",
"grid_ui_endless.h": "c",
"bit": "c"
"bit": "c",
"grid_ui_system.h": "c"
},
"files.exclude": {
".archive": true,
Expand Down
1 change: 1 addition & 0 deletions grid_common/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ idf_component_register(
"grid_ui_endless.c"
"grid_ui_potmeter.c"
"grid_ui_system.c"
"grid_ui_lcd.c"
"grid_module.c"
"grid_lua_api.c"

Expand Down
1 change: 1 addition & 0 deletions grid_common/grid_module.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
#include "grid_ui_button.h"
#include "grid_ui_encoder.h"
#include "grid_ui_endless.h"
#include "grid_ui_lcd.h"
#include "grid_ui_potmeter.h"
#include "grid_ui_system.h"

Expand Down
4 changes: 0 additions & 4 deletions grid_common/grid_port.c
Original file line number Diff line number Diff line change
Expand Up @@ -876,10 +876,6 @@ void grid_protocol_nvm_store_succcess_callback(uint8_t lastheader_id) {

void grid_protocol_send_heartbeat(uint8_t heartbeat_type, uint32_t hwcfg) {

if (hwcfg == GRID_MODULE_VSN1_RevA || hwcfg == GRID_MODULE_VSN1R_RevA || hwcfg == GRID_MODULE_VSN2_RevA) {
hwcfg = GRID_MODULE_TEK1_RevA;
}

uint8_t portstate = 0;

for (uint8_t i = 0; i < 4; i++) {
Expand Down
1 change: 1 addition & 0 deletions grid_common/grid_protocol.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
#define GRID_PARAMETER_ELEMENT_BUTTON 2
#define GRID_PARAMETER_ELEMENT_ENCODER 3
#define GRID_PARAMETER_ELEMENT_ENDLESS 4
#define GRID_PARAMETER_ELEMENT_LCD 5

// must not change because it would break profiles
#define GRID_PARAMETER_EVENT_INIT 0
Expand Down
41 changes: 41 additions & 0 deletions grid_common/grid_ui_lcd.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
#include "grid_ui_lcd.h"

#include "grid_ain.h"
#include "grid_lua_api.h"
#include "grid_protocol.h"
#include "grid_ui.h"
#include <stdint.h>
#include <stdlib.h>
#include <string.h>

extern uint8_t grid_platform_get_adc_bit_depth();

extern void grid_platform_printf(char const* fmt, ...);

const char grid_ui_lcd_init_actionstring[] = GRID_ACTIONSTRING_LCD_INIT;

void grid_ui_element_lcd_init(struct grid_ui_element* ele) {

ele->type = GRID_PARAMETER_ELEMENT_LCD;

ele->event_list_length = 1;

ele->event_list = malloc(ele->event_list_length * sizeof(struct grid_ui_event));
grid_ui_event_init(ele, 0, GRID_PARAMETER_EVENT_INIT, GRID_LUA_FNC_A_INIT_short, grid_ui_lcd_init_actionstring); // Element Initialization Event

ele->template_initializer = &grid_ui_element_lcd_template_parameter_init;
ele->template_parameter_list_length = GRID_LUA_FNC_L_LIST_length;

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

void grid_ui_element_lcd_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_L_ELEMENT_INDEX_index] = element_index;
}
36 changes: 36 additions & 0 deletions grid_common/grid_ui_lcd.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
#pragma once

#ifndef GRID_UI_LCD_H_INCLUDED
#define GRID_UI_LCD_H_INCLUDED

#include "grid_ui.h"
#include <stdint.h>

void grid_ui_element_lcd_init(struct grid_ui_element* ele);

void grid_ui_element_lcd_template_parameter_init(struct grid_ui_template_buffer* buf);

#define GRID_LUA_FNC_L_ELEMENT_INDEX_index 0
#define GRID_LUA_FNC_L_ELEMENT_INDEX_helper "0"
#define GRID_LUA_FNC_L_ELEMENT_INDEX_short "ind"
#define GRID_LUA_FNC_L_ELEMENT_INDEX_human "element_index"

#define GRID_LUA_FNC_L_LIST_length 1

// LCD init function
#define GRID_LUA_LCD_META_init \
"lcd_meta = { __index = { \
\
" GRID_LUA_FNC_L_ELEMENT_INDEX_short "=function (self,a) return " \
"gtv(self.index, " GRID_LUA_FNC_L_ELEMENT_INDEX_helper ", a) end, \
\
" GRID_LUA_FNC_A_INIT_short " = function (self) print('undefined action') end, \
\
gtt = function (self,a) " GRID_LUA_FNC_G_TIMER_START_short "(self.index,a) end,\
gtp = function (self) " GRID_LUA_FNC_G_TIMER_STOP_short "(self.index) end,\
get = function (self,a) " GRID_LUA_FNC_G_EVENT_TRIGGER_short "(self.index,a) end\
}}"

#define GRID_ACTIONSTRING_LCD_INIT "<?lua --[[@cb]] --[[lcd init]] ?>"

#endif
3 changes: 3 additions & 0 deletions grid_make/gcc/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ usb/class/midi/usb_protocol_midi.o \
../grid_common/grid_ui_endless.o \
../grid_common/grid_ui_potmeter.o \
../grid_common/grid_ui_system.o \
../grid_common/grid_ui_lcd.o \
../grid_common/grid_module.o \
../grid_common/grid_lua.o \
../grid_common/grid_lua_api.o \
Expand Down Expand Up @@ -101,6 +102,7 @@ OBJS_AS_ARGS += \
"../grid_common/grid_ui_endless.o" \
"../grid_common/grid_ui_potmeter.o" \
"../grid_common/grid_ui_system.o" \
"../grid_common/grid_ui_lcd.o" \
"../grid_common/grid_module.o" \
"../grid_common/grid_lua.o" \
"../grid_common/grid_lua_api.o" \
Expand Down Expand Up @@ -186,6 +188,7 @@ DEPS_AS_ARGS += \
"../grid_common/grid_ui_endless.d" \
"../grid_common/grid_ui_potmeter.d" \
"../grid_common/grid_ui_system.d" \
"../grid_common/grid_ui_lcd.d" \
"../grid_common/grid_module.d" \
"../grid_common/grid_lua.d" \
"../grid_common/grid_lua_api.d" \
Expand Down

0 comments on commit fe6b724

Please sign in to comment.