From: Keith Packard Date: Sun, 19 Sep 2021 21:50:28 +0000 (-0700) Subject: altos: Support normalized axes in mpu6000 and mmc5983 X-Git-Tag: 1.9.8~1^2~23 X-Git-Url: https://git.gag.com/?p=fw%2Faltos;a=commitdiff_plain;h=8a830c7f9ed41565c72edb85852e2df8bfa351f5 altos: Support normalized axes in mpu6000 and mmc5983 For monitor idle, devices selecting 'normalized' log format also get 'normalized' command mode. This reports data in a standard format, along/across/through instead of raw device axes which depend on how the part is mounted. Signed-off-by: Keith Packard --- diff --git a/src/drivers/ao_mmc5983.c b/src/drivers/ao_mmc5983.c index e27051a5..5d97d757 100644 --- a/src/drivers/ao_mmc5983.c +++ b/src/drivers/ao_mmc5983.c @@ -202,9 +202,10 @@ static struct ao_task ao_mmc5983_task; static void ao_mmc5983_show(void) { - printf ("X: %d Z: %d Y: %d id: %d\n", - ao_mmc5983_current.x, ao_mmc5983_current.z, ao_mmc5983_current.y, - product_id); + printf ("MMC5983: %d %d %d\n", + ao_mmc5983_along(&ao_mmc5983_current), + ao_mmc5983_across(&ao_mmc5983_current), + ao_mmc5983_through(&ao_mmc5983_current)); } static const struct ao_cmds ao_mmc5983_cmds[] = { diff --git a/src/drivers/ao_mpu6000.c b/src/drivers/ao_mpu6000.c index dd3da8de..79658c55 100644 --- a/src/drivers/ao_mpu6000.c +++ b/src/drivers/ao_mpu6000.c @@ -357,14 +357,23 @@ static struct ao_task ao_mpu6000_task; static void ao_mpu6000_show(void) { - printf ("Accel: %7d %7d %7d Gyro: %7d %7d %7d id %02x\n", +#ifdef AO_LOG_NORMALIZED + printf ("MPU6000: %7d %7d %7d %7d %7d %7d\n", + ao_mpu6000_along(&ao_mpu6000_current), + ao_mpu6000_across(&ao_mpu6000_current), + ao_mpu6000_through(&ao_mpu6000_current), + ao_mpu6000_roll(&ao_mpu6000_current), + ao_mpu6000_pitch(&ao_mpu6000_current), + ao_mpu6000_yaw(&ao_mpu6000_current)); +#else + printf ("Accel: %7d %7d %7d Gyro: %7d %7d %7d\n", ao_mpu6000_current.accel_x, ao_mpu6000_current.accel_y, ao_mpu6000_current.accel_z, ao_mpu6000_current.gyro_x, ao_mpu6000_current.gyro_y, - ao_mpu6000_current.gyro_z, - mpu_id); + ao_mpu6000_current.gyro_z); +#endif } static const struct ao_cmds ao_mpu6000_cmds[] = {