Skip to content

Conversation

@Shadowtrance
Copy link
Contributor

No description provided.

@coderabbitai
Copy link

coderabbitai bot commented Jan 2, 2026

📝 Walkthrough

Walkthrough

The 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)
Check name Status Explanation Resolution
Description check ❓ Inconclusive No pull request description was provided, making it impossible to assess relevance to the changeset. Add a description explaining why the up/down mappings were inverted and the expected behavior after this fix.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title 'Fix inverted up and down' directly relates to the main change: reversing horizontal movement mappings for up/down gestures and keys.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

@coderabbitai coderabbitai bot left a 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_left for 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_down

This suggests a 90-degree coordinate transformation between screen and game logic, but there's no documentation explaining why.

💡 Suggested improvements
  1. 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) {
  1. 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

📥 Commits

Reviewing files that changed from the base of the PR and between 6cb52d8 and 8afa083.

📒 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)

@Shadowtrance
Copy link
Contributor Author

Quiet rabbit! It works. 😝

@NellowTCS
Copy link

This made me so confused when I tried it out, haha, I thought it was just the CYD being resistive.

@KenVanHoeylandt KenVanHoeylandt merged commit 3bc1e7a into ByteWelder:main Jan 3, 2026
9 checks passed
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.

3 participants