Issue #12 — Roll displayed as pitch: - Firmware was sending r=pitch_rate (wrong). Changed to r=roll_deg*10. - mpu6000.c: add roll complementary filter (accel atan2(ay,az) + gyro gy integration, same COMP_ALPHA=0.98 as pitch). - IMUData: add roll and yaw fields. - UI: updateIMU() now uses data.r/10 for roll (not client-side filter that computed from ax/ay/az which firmware never sent). - Three.js: roll -> rotation.z (banking), pitch -> rotation.x (tipping) — axes were already correct, fix was the firmware data. Issue #13 — Add yaw telemetry: - Firmware: gyro Z integration (gz * dt) → s_yaw, sent as y=yaw_deg*10. Gyro-only, drifts — no magnetometer. - IMUData: yaw field added. - UI: yaw -> rotation.y (spinning on vertical axis). Displayed in HUD. - UI: YAW RESET button captures current yaw as new zero reference (client-side offset, no new firmware command needed). Closes #12, #13. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
20 lines
511 B
C
20 lines
511 B
C
#ifndef MPU6000_H
|
|
#define MPU6000_H
|
|
|
|
#include <stdint.h>
|
|
#include <stdbool.h>
|
|
|
|
typedef struct {
|
|
float pitch; // degrees, filtered (complementary filter)
|
|
float pitch_rate; // degrees/sec (raw gyro pitch axis)
|
|
float roll; // degrees, filtered (complementary filter)
|
|
float yaw; // degrees, gyro-integrated (drifts — no magnetometer)
|
|
float accel_x; // g
|
|
float accel_z; // g
|
|
} IMUData;
|
|
|
|
bool mpu6000_init(void);
|
|
void mpu6000_read(IMUData *data);
|
|
|
|
#endif
|