Skip to content

feat(c6): enable auto-rotation + imu debug command#71

Open
crilam wants to merge 4 commits into
HermannBjorgvin:mainfrom
crilam:feat/c6-rotation-and-imu-debug
Open

feat(c6): enable auto-rotation + imu debug command#71
crilam wants to merge 4 commits into
HermannBjorgvin:mainfrom
crilam:feat/c6-rotation-and-imu-debug

Conversation

@crilam

@crilam crilam commented Jun 9, 2026

Copy link
Copy Markdown

Summary

  • C6 auto-rotation: The rotation strip buffer (37 KB) fits in the ESP32-C6's internal SRAM. No PSRAM is needed. This enables full IMU-driven auto-rotation on the waveshare_amoled_216_c6 board, matching the behaviour of the S3 port. A BOARD_ROTATION_OFFSET of 3 (270° CW) is applied to correct for the IMU being mounted at a different angle relative to the display on the C6 carrier PCB (verified on hardware).
  • imu serial debug command: A new imu_hal_print_debug() HAL function (and matching imu serial command) prints raw accelerometer values, the current rotation quadrant, and the candidate state. Useful for diagnosing auto-rotation issues on any board without reflashing.

Test plan

  • Flash waveshare_amoled_216_c6 and verify splash/usage screens render correctly at rest
  • Rotate device 90°/180°/270° and confirm display follows with ~300 ms hysteresis
  • Type imu in serial monitor and confirm output shows ax/ay/az + rotation state
  • Confirm waveshare_amoled_216 and waveshare_amoled_18 still build and imu command compiles on both

🤖 Generated with Claude Code

crilam and others added 4 commits June 9, 2026 12:53
Exposes raw accelerometer values, current rotation quadrant, and
candidate state via a new `imu` serial command (alongside the existing
`screenshot` command). Useful for diagnosing auto-rotation issues
without reflashing.

All three board ports implement imu_hal_print_debug(): full data on
the S3 2.16 (which has active rotation), and a no-op stub on the 1.8
and C6 boards where rotation was previously disabled.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
The rotation strip buffer (37 KB) fits comfortably in the C6's internal
SRAM alongside the rest of the firmware (~93 KB used of 320 KB). No
PSRAM or external storage is needed.

Changes:
- display.cpp: allocate rot_buf from MALLOC_CAP_INTERNAL, copy
  rotate_strip() + display_hal_tick() ramp logic from the S3 port
- imu.cpp: replace init-only stub with full QMI8658 auto-rotation
  implementation (same logic as waveshare_amoled_216)
- board.h: set BOARD_HAS_ROTATION=1, add BOARD_ROTATION_OFFSET=3 to
  correct for the IMU being mounted 270° CW relative to the display
  on the C6 carrier PCB (verified on hardware)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
OpenSCAD model for two-piece kickstand with detent hinge:
- clawdmeter_stand.scad: parametric model with 36-tooth detent disc
  (10° increments), M3 bolt lock, snap-fit cradle, pliable leg
- README.md: comprehensive assembly, printing, and usage guide

Features:
- Tilt-adjustable via detent positions + M3 bolt lock
- Folds flat for storage (0° to ~90° range)
- Snap-fit device retention (no tools needed)
- Rubber pad feet for desk stability
- USB-C cable hangs free from bottom

Export STLs via OpenSCAD GUI or CLI before printing.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Y axis was inverted on the C6 PCB mounting. Invert the sign check in
accel_to_rotation() to compensate: (ay > 0) now returns 1 instead of 3,
and (ay < 0) returns 3 instead of 1.

With inverted Y-axis and BOARD_ROTATION_OFFSET=3, all four orientations
now rotate correctly:
- Pantalla hacia usuario (ay>0, raw=1) → rotation=0°
- Pantalla hacia abajo (ay<0, raw=3) → rotation=180°
- Costado (ax±, raw=0/2) → rotation=270°/90°

Verified on hardware with 'imu' serial command across all positions.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@HermannBjorgvin

Copy link
Copy Markdown
Owner

Your test plan is unchecked. Could you test and let me know if I can merge it?

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.

2 participants