altos: HMC5883 output order is X Z Y
authorKeith Packard <keithp@keithp.com>
Mon, 12 Jun 2017 05:34:11 +0000 (22:34 -0700)
committerKeith Packard <keithp@keithp.com>
Mon, 12 Jun 2017 05:54:22 +0000 (22:54 -0700)
Re-label everything to have the correct names. This doesn't actually
change the code at all, so the eeprom and telemetry is all compatible.

Matching changes on the host side will be required to actually process
the data correctly, of course.

Signed-off-by: Keith Packard <keithp@keithp.com>
src/drivers/ao_hmc5883.c
src/drivers/ao_hmc5883.h
src/kernel/ao_log.h
src/kernel/ao_log_mega.c
src/kernel/ao_telemetry.c
src/kernel/ao_telemetry.h

index 9f1131d6b607671883f2c933a35279e5ae59539b..c33aa536fde6578d8aaed0bac73454b181fcf93b 100644 (file)
@@ -143,10 +143,8 @@ static struct ao_task ao_hmc5883_task;
 static void
 ao_hmc5883_show(void)
 {
-       struct ao_data  sample;
-       ao_data_get(&sample);
-       printf ("X: %d Y: %d Z: %d missed irq: %lu\n",
-               sample.hmc5883.x, sample.hmc5883.y, sample.hmc5883.z, ao_hmc5883_missed_irq);
+       printf ("X: %d Z: %d Y: %d missed irq: %lu\n",
+               ao_hmc5883_current.x, ao_hmc5883_current.z, ao_hmc5883_current.y, ao_hmc5883_missed_irq);
 }
 
 static const struct ao_cmds ao_hmc5883_cmds[] = {
index 78637b029ead55cd988f3421d4624d0225dc974c..b90733df0968e09a19cf97e582c03e247aa94193 100644 (file)
@@ -77,7 +77,7 @@
 #define HMC5883_ID_C           12
 
 struct ao_hmc5883_sample {
-       int16_t         x, y, z;
+       int16_t         x, z, y;
 };
 
 extern struct ao_hmc5883_sample        ao_hmc5883_current;
index 5c568c99e9e3bdd34906c14c92a1bf30d0f27a17..241ba7d71217243e2076d9b7a7039145030cca2b 100644 (file)
@@ -252,8 +252,8 @@ struct ao_log_mega {
                        int16_t         gyro_y;         /* 20 */
                        int16_t         gyro_z;         /* 22 */
                        int16_t         mag_x;          /* 24 */
-                       int16_t         mag_y;          /* 26 */
-                       int16_t         mag_z;          /* 28 */
+                       int16_t         mag_z;          /* 26 */
+                       int16_t         mag_y;          /* 28 */
                        int16_t         accel;          /* 30 */
                } sensor;       /* 32 */
                /* AO_LOG_TEMP_VOLT */
index a0212198d3a0ae70128fc3198d259c14b9446ccb..b86abe7af8ebec882225c88c4f5e34619ff13195 100644 (file)
@@ -135,8 +135,8 @@ ao_log(void)
 #endif
 #if HAS_HMC5883
                                log.u.sensor.mag_x = ao_data_ring[ao_log_data_pos].hmc5883.x;
-                               log.u.sensor.mag_y = ao_data_ring[ao_log_data_pos].hmc5883.y;
                                log.u.sensor.mag_z = ao_data_ring[ao_log_data_pos].hmc5883.z;
+                               log.u.sensor.mag_y = ao_data_ring[ao_log_data_pos].hmc5883.y;
 #endif
                                log.u.sensor.accel = ao_data_accel(&ao_data_ring[ao_log_data_pos]);
                                ao_log_mega(&log);
index a4c73a869343152800c030bac0490ff3cc1e30e0..2ae1e41bb42ffb31701176424c461831c52d98b6 100644 (file)
@@ -160,8 +160,8 @@ ao_send_mega_sensor(void)
 
 #if HAS_HMC5883
        telemetry.mega_sensor.mag_x = packet->hmc5883.x;
-       telemetry.mega_sensor.mag_y = packet->hmc5883.y;
        telemetry.mega_sensor.mag_z = packet->hmc5883.z;
+       telemetry.mega_sensor.mag_y = packet->hmc5883.y;
 #endif
 
        ao_telemetry_send();
index 45aaeb075c2f6d7deb9b0ddda379d37a5feb30b9..23e3ed7db7c4a5309f4b76bc7d5db6da424a0a86 100644 (file)
@@ -198,8 +198,8 @@ struct ao_telemetry_mega_sensor {
        int16_t         gyro_z;         /* 24 */
 
        int16_t         mag_x;          /* 26 */
-       int16_t         mag_y;          /* 28 */
-       int16_t         mag_z;          /* 30 */
+       int16_t         mag_z;          /* 28 */
+       int16_t         mag_y;          /* 30 */
        /* 32 */
 };