按键锁定改回以前逻辑

This commit is contained in:
wu58430 2023-12-03 08:29:30 +08:00
parent 57f77ec984
commit 8d67ff068c
2 changed files with 16 additions and 23 deletions

View file

@ -20,19 +20,8 @@
</configurations>
</component>
<component name="ChangeListManager">
<list default="true" id="cea36e80-e289-4d69-9030-7186d540ac0e" name="更改" comment="fix https://github.com/losehu/uv-k5-firmware-chinese/issues/4">
<list default="true" id="cea36e80-e289-4d69-9030-7186d540ac0e" name="更改" comment="修复切换调制模式时亚音消失问题">
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/app/app.c" beforeDir="false" afterPath="$PROJECT_DIR$/app/app.c" afterDir="false" />
<change beforePath="$PROJECT_DIR$/app/menu.c" beforeDir="false" afterPath="$PROJECT_DIR$/app/menu.c" afterDir="false" />
<change beforePath="$PROJECT_DIR$/app/uart.c" beforeDir="false" afterPath="$PROJECT_DIR$/app/uart.c" afterDir="false" />
<change beforePath="$PROJECT_DIR$/board.c" beforeDir="false" afterPath="$PROJECT_DIR$/board.c" afterDir="false" />
<change beforePath="$PROJECT_DIR$/board.h" beforeDir="false" afterPath="$PROJECT_DIR$/board.h" afterDir="false" />
<change beforePath="$PROJECT_DIR$/main.c" beforeDir="false" afterPath="$PROJECT_DIR$/main.c" afterDir="false" />
<change beforePath="$PROJECT_DIR$/radio.c" beforeDir="false" afterPath="$PROJECT_DIR$/radio.c" afterDir="false" />
<change beforePath="$PROJECT_DIR$/settings.c" beforeDir="false" afterPath="$PROJECT_DIR$/settings.c" afterDir="false" />
<change beforePath="$PROJECT_DIR$/settings.h" beforeDir="false" afterPath="$PROJECT_DIR$/settings.h" afterDir="false" />
<change beforePath="$PROJECT_DIR$/ui/main.c" beforeDir="false" afterPath="$PROJECT_DIR$/ui/main.c" afterDir="false" />
<change beforePath="$PROJECT_DIR$/ui/menu.c" beforeDir="false" afterPath="$PROJECT_DIR$/ui/menu.c" afterDir="false" />
</list>
<option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" />
@ -136,7 +125,7 @@
<workItem from="1701325367312" duration="22657000" />
<workItem from="1701413653518" duration="3544000" />
<workItem from="1701430185864" duration="10115000" />
<workItem from="1701559895523" duration="1725000" />
<workItem from="1701559895523" duration="3042000" />
</task>
<task id="LOCAL-00001" summary="bug fix">
<created>1701136012311</created>
@ -271,7 +260,14 @@
<option name="project" value="LOCAL" />
<updated>1701484068802</updated>
</task>
<option name="localTasksCounter" value="20" />
<task id="LOCAL-00020" summary="修复切换调制模式时亚音消失问题">
<created>1701562094909</created>
<option name="number" value="00020" />
<option name="presentableId" value="LOCAL-00020" />
<option name="project" value="LOCAL" />
<updated>1701562094909</updated>
</task>
<option name="localTasksCounter" value="21" />
<servers />
</component>
<component name="TypeScriptGeneratedFilesManager">
@ -294,6 +290,7 @@
<MESSAGE value="fix bug" />
<MESSAGE value="掃描下翻譯" />
<MESSAGE value="fix https://github.com/losehu/uv-k5-firmware-chinese/issues/4" />
<option name="LAST_COMMIT_MESSAGE" value="fix https://github.com/losehu/uv-k5-firmware-chinese/issues/4" />
<MESSAGE value="修复切换调制模式时亚音消失问题" />
<option name="LAST_COMMIT_MESSAGE" value="修复切换调制模式时亚音消失问题" />
</component>
</project>

View file

@ -1786,15 +1786,11 @@ static void ProcessKey(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
// KEY_MENU has a special treatment here, because we want to pass hold event to ACTION_Handle
// but we don't want it to complain when initial press happens
// we want to react on realese instead
else if ( // pass side buttons
!(Key == KEY_SIDE1 && !bKeyHeld)) // pass KEY_MENU held
else if (Key != KEY_SIDE1 && Key != KEY_SIDE2 && // pass side buttons
!(Key == KEY_MENU && bKeyHeld)) // pass KEY_MENU held
{
// if (!(Key == KEY_SIDE1&&bKeyHeld)&&(!bKeyPressed || (Key == KEY_SIDE1 && bKeyPressed)) && // prevent released or held, prevent KEY_MENU pressed
// !(Key == KEY_SIDE1 && !bKeyPressed)) // pass KEY_MENU released
// return;
if (!(Key == KEY_SIDE1) && !(bKeyPressed != 0))
// if (Key == KEY_SIDE1 == 0 && !bKeyPressed != 0) // pass KEY_MENU released
if ((!bKeyPressed || bKeyHeld || (Key == KEY_MENU && bKeyPressed)) && // prevent released or held, prevent KEY_MENU pressed
!(Key == KEY_MENU && !bKeyPressed)) // pass KEY_MENU released
return;
// keypad is locked, tell the user