diff --git a/.github/workflows/docker-image.yml b/.github/workflows/docker-image.yml index cde5ed7..dbe940f 100644 --- a/.github/workflows/docker-image.yml +++ b/.github/workflows/docker-image.yml @@ -25,7 +25,7 @@ jobs: #定义工作流程 run: git config --global --add safe.directory /__w/uv-k5-firmware-chinese/uv-k5-firmware-chinese - name: Make #执行 make 命令 - run: make both #编译项目 + run: make bothandlayoutkeyupdown #编译项目 - name: size #计算 firmware 大小 run: arm-none-eabi-size firmware #使用 arm-none-eabi-size 命令计算固件大小 diff --git a/Makefile b/Makefile index 08db9d7..165c6de 100644 --- a/Makefile +++ b/Makefile @@ -54,7 +54,9 @@ ENABLE_CHINESE_FULL = 4 ENABLE_DOCK ?= 0 ENABLE_CUSTOM_SIDEFUNCTIONS ?= 1 ENABLE_SIDEFUNCTIONS_SEND ?= 1 -ENABLE_BLOCK ?= 0 +ENABLE_BLOCK ?= 0 + +ENABLE_LAYOUT_KEY_UP_DOWN ?= 0 # ---- DEBUGGING ---- ENABLE_AM_FIX_SHOW_DATA ?= 0 @@ -63,6 +65,15 @@ ENABLE_TIMER ?= 0 ############################################################# PACKED_FILE_SUFFIX = LOSEHU117P6 + +ifeq ($(ENABLE_LAYOUT_KEY_UP_DOWN),1) + PACKED_FILE_SUFFIX := $(PACKED_FILE_SUFFIX)LU +endif + +ifeq ($(ENABLE_LAYOUT_KEY_UP_DOWN),2) + PACKED_FILE_SUFFIX := $(PACKED_FILE_SUFFIX)LD +endif + ifeq ($(ENABLE_CHINESE_FULL),1) $(info font1) PACKED_FILE_SUFFIX = font1 @@ -293,7 +304,7 @@ CFLAGS += -Wextra # 设置PACKED_FILE_SUFFIX,根据ENABLE_CHINESE_FULL的值设置不同的后缀 CFLAGS += -DENABLE_EEPROM_TYPE=$(ENABLE_EEPROM_TYPE) - +CFLAGS += -DENABLE_LAYOUT_KEY_UP_DOWN=$(ENABLE_LAYOUT_KEY_UP_DOWN) CFLAGS += -DENABLE_CHINESE_FULL=$(ENABLE_CHINESE_FULL) CFLAGS += -DPACKED_FILE_SUFFIX=\"$(PACKED_FILE_SUFFIX)\" CFLAGS += -DPRINTF_INCLUDE_CONFIG_H @@ -514,11 +525,20 @@ full: $(MAKE) build ENABLE_CHINESE_FULL=2 $(MAKE) build ENABLE_CHINESE_FULL=3 $(MAKE) build ENABLE_CHINESE_FULL=4 + both: $(RM) *.bin $(MAKE) build ENABLE_CHINESE_FULL=0 $(MAKE) build ENABLE_CHINESE_FULL=4 +bothandlayoutkeyupdown: + $(RM) *.bin + $(MAKE) build ENABLE_CHINESE_FULL=0 + $(MAKE) build ENABLE_CHINESE_FULL=4 + $(MAKE) build ENABLE_CHINESE_FULL=0 ENABLE_LAYOUT_KEY_UP_DOWN=1 + $(MAKE) build ENABLE_CHINESE_FULL=0 ENABLE_LAYOUT_KEY_UP_DOWN=2 + $(MAKE) build ENABLE_CHINESE_FULL=4 ENABLE_LAYOUT_KEY_UP_DOWN=1 + $(MAKE) build ENABLE_CHINESE_FULL=4 ENABLE_LAYOUT_KEY_UP_DOWN=2 all: $(MAKE) build diff --git a/app/menu.c b/app/menu.c index ccbfc25..cba656b 100644 --- a/app/menu.c +++ b/app/menu.c @@ -1675,8 +1675,12 @@ static void MENU_Key_UP_DOWN(bool bKeyPressed, bool bKeyHeld, int8_t Direction) } if (!gIsInSubMenu) { +#if ENABLE_LAYOUT_KEY_UP_DOWN==0 gMenuCursor = NUMBER_AddWithWraparound(gMenuCursor, -Direction, 0, gMenuListCount - 1); - +#endif +#if ENABLE_LAYOUT_KEY_UP_DOWN!=0 + gMenuCursor = NUMBER_AddWithWraparound(gMenuCursor, Direction, 0, gMenuListCount - 1); +#endif gFlagRefreshSetting = true; gRequestDisplayScreen = DISPLAY_MENU; diff --git a/driver/keyboard.c b/driver/keyboard.c index 9af3e9d..833894d 100644 --- a/driver/keyboard.c +++ b/driver/keyboard.c @@ -70,19 +70,29 @@ static const struct { { // Second row .set_to_zero_mask = ~(1u << GPIOA_PIN_KEYBOARD_5) & 0xffff, .pins = { +#if ENABLE_LAYOUT_KEY_UP_DOWN!=1 { .key = KEY_UP, .pin = GPIOA_PIN_KEYBOARD_0}, - { .key = KEY_2 , .pin = GPIOA_PIN_KEYBOARD_1}, - { .key = KEY_5 , .pin = GPIOA_PIN_KEYBOARD_2}, - { .key = KEY_8 , .pin = GPIOA_PIN_KEYBOARD_3} +#endif +#if ENABLE_LAYOUT_KEY_UP_DOWN==1 + { .key = KEY_DOWN, .pin = GPIOA_PIN_KEYBOARD_0}, +#endif + { .key = KEY_2, .pin = GPIOA_PIN_KEYBOARD_1}, + { .key = KEY_5, .pin = GPIOA_PIN_KEYBOARD_2}, + { .key = KEY_8, .pin = GPIOA_PIN_KEYBOARD_3} } }, { // Third row .set_to_zero_mask = ~(1u << GPIOA_PIN_KEYBOARD_6) & 0xffff, .pins = { +#if ENABLE_LAYOUT_KEY_UP_DOWN!=1 { .key = KEY_DOWN, .pin = GPIOA_PIN_KEYBOARD_0}, - { .key = KEY_3 , .pin = GPIOA_PIN_KEYBOARD_1}, - { .key = KEY_6 , .pin = GPIOA_PIN_KEYBOARD_2}, - { .key = KEY_9 , .pin = GPIOA_PIN_KEYBOARD_3} +#endif +#if ENABLE_LAYOUT_KEY_UP_DOWN==1 + { .key = KEY_UP, .pin = GPIOA_PIN_KEYBOARD_0}, +#endif + { .key = KEY_3, .pin = GPIOA_PIN_KEYBOARD_1}, + { .key = KEY_6, .pin = GPIOA_PIN_KEYBOARD_2}, + { .key = KEY_9, .pin = GPIOA_PIN_KEYBOARD_3} } }, { // Fourth row @@ -90,8 +100,8 @@ static const struct { .pins = { { .key = KEY_EXIT, .pin = GPIOA_PIN_KEYBOARD_0}, { .key = KEY_STAR, .pin = GPIOA_PIN_KEYBOARD_1}, - { .key = KEY_0 , .pin = GPIOA_PIN_KEYBOARD_2}, - { .key = KEY_F , .pin = GPIOA_PIN_KEYBOARD_3} + { .key = KEY_0, .pin = GPIOA_PIN_KEYBOARD_2}, + { .key = KEY_F, .pin = GPIOA_PIN_KEYBOARD_3} } } };