Skip to content

Fix D key starting OINK instead of DNH from IDLE#24

Closed
albertonoys wants to merge 1 commit into0ct0sec:mainfrom
albertonoys:fix/idle-dnh-mode-key
Closed

Fix D key starting OINK instead of DNH from IDLE#24
albertonoys wants to merge 1 commit into0ct0sec:mainfrom
albertonoys:fix/idle-dnh-mode-key

Conversation

@albertonoys
Copy link

@albertonoys albertonoys commented Jan 22, 2026

Problem:

  • Pressing D in IDLE mode starts OINK_MODE instead of DNH_MODE
  • Expected: IDLE → (D key) → DNH_MODE
  • Actual: IDLE → (D key) → DNH_MODE → OINK_MODE (immediately)

Root cause:

  • IDLE handler sets DNH_MODE but continues executing handleInput()
  • DNH mode handler runs in the same frame
  • DNH handler detects D key still pressed and switches to OINK_MODE
  • dWasPressed_dnh doesn't help because it's the first frame in DNH mode
  • Mode transition completes but input handler doesn't exit

Solution:

  • Add return after setMode(PorkchopMode::DNH_MODE) in IDLE handler
  • Prevents DNH handler from running until next frame
  • Matches existing pattern from OINK↔DNH transitions

Testing:

  • Tested on M5Cardputer ADV
  • Verified D key from IDLE now correctly enters DNH_MODE
  • Verified D key still toggles between OINK↔DNH as expected

Files changed:

  • src/core/porkchop.cpp: Added return statement at line 542

Prevent the key press in IDLE mode from being processed by the DNH
handler in the same frame, which immediately switches to OINK_MODE.
@albertonoys albertonoys closed this Feb 8, 2026
@albertonoys
Copy link
Author

Closing PR since this bug was already fixed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant