-
-
Notifications
You must be signed in to change notification settings - Fork 4
Fix inverted up and down #18
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
📝 WalkthroughWalkthroughThe changes modify input event handling in TwoElevenUi.c. Specifically, vertical gesture and keyboard inputs now map to reversed horizontal movements. LV_DIR_TOP and LV_KEY_UP now trigger move_right instead of move_left, while LV_DIR_BOTTOM and LV_KEY_DOWN now trigger move_left instead of move_right. Horizontal gesture and keyboard mappings remain unchanged. All subsequent control flow logic and public API signatures remain unmodified. Pre-merge checks❌ Failed checks (1 inconclusive)
✅ Passed checks (2 passed)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (2)
Apps/TwoEleven/main/Source/TwoElevenUi.c (2)
156-167: Fix addresses the inversion, but the coordinate mapping needs documentation.The swap of
move_right/move_leftfor vertical gestures correctly fixes the inversion mentioned in the PR title. However, the overall mapping is non-intuitive:
- Upward swipe (TOP) →
move_right- Downward swipe (BOTTOM) →
move_left- Leftward swipe (LEFT) →
move_up- Rightward swipe (RIGHT) →
move_downThis suggests a 90-degree coordinate transformation between screen and game logic, but there's no documentation explaining why.
💡 Suggested improvements
- Add a comment block explaining the coordinate transformation:
if (code == LV_EVENT_GESTURE) { game_2048->game_over = game_over(game_2048->matrix_size, (const uint16_t **)game_2048->matrix); if (!game_2048->game_over) { lv_dir_t dir = lv_indev_get_gesture_dir(lv_indev_active()); + // Note: Screen gestures are rotated 90° clockwise relative to game logic + // to accommodate the device's physical orientation during gameplay switch (dir) {
- Verify all four directions produce the expected tile movements by testing on the actual device.
178-193: Keyboard mappings correctly mirror the gesture fix.The keyboard handling changes are consistent with the gesture handling changes, ensuring both input methods behave identically. The same coordinate transformation applies here.
Consider adding a similar explanatory comment for the keyboard handling to match the gesture handling documentation suggested above.
📜 Review details
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
Apps/TwoEleven/main/Source/TwoElevenUi.c
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (7)
- GitHub Check: Build (SerialConsole)
- GitHub Check: Build (Diceware)
- GitHub Check: Build (TwoEleven)
- GitHub Check: Build (GPIO)
- GitHub Check: Build (HelloWorld)
- GitHub Check: Build (Calculator)
- GitHub Check: Build (GraphicsDemo)
|
Quiet rabbit! It works. 😝 |
|
This made me so confused when I tried it out, haha, I thought it was just the CYD being resistive. |
No description provided.