altos: Fix up HAS_FLIGHT_DEBUG
authorKeith Packard <keithp@keithp.com>
Sun, 19 Sep 2021 23:28:22 +0000 (16:28 -0700)
committerKeith Packard <keithp@keithp.com>
Sun, 19 Sep 2021 23:31:14 +0000 (16:31 -0700)
Some printf formats weren't right.

Signed-off-by: Keith Packard <keithp@keithp.com>
src/kernel/ao_flight.c
src/kernel/ao_sample.c

index 3c1067cb44e9e079675d863a2eb38368e096e733..4a7055c415e80d9eef3d86eacae715ce4f8b416b 100644 (file)
@@ -461,7 +461,7 @@ ao_flight(void)
 #if HAS_FLIGHT_DEBUG
                case ao_flight_test:
 #if HAS_GYRO
-                       printf ("angle %4d pitch %7d yaw %7d roll %7d\n",
+                       printf ("angle %4d pitch %7ld yaw %7ld roll %7ld\n",
                                ao_sample_orient,
                                ((ao_sample_pitch << 9) - ao_ground_pitch) >> 9,
                                ((ao_sample_yaw << 9) - ao_ground_yaw) >> 9,
@@ -492,14 +492,14 @@ ao_flight_dump(void)
        printf ("sample:\n");
        printf ("  tick        %d\n", ao_sample_tick);
 #if HAS_BARO
-       printf ("  raw pres    %d\n", ao_sample_pres);
+       printf ("  raw pres    %ld\n", ao_sample_pres);
 #endif
 #if HAS_ACCEL
        printf ("  raw accel   %d\n", ao_sample_accel);
 #endif
 #if HAS_BARO
-       printf ("  ground pres %d\n", ao_ground_pres);
-       printf ("  ground alt  %d\n", ao_ground_height);
+       printf ("  ground pres %ld\n", ao_ground_pres);
+       printf ("  ground alt  %ld\n", ao_ground_height);
 #endif
 #if HAS_ACCEL
        printf ("  raw accel   %d\n", ao_sample_accel);
@@ -508,8 +508,8 @@ ao_flight_dump(void)
 #endif
 
 #if HAS_BARO
-       printf ("  alt         %d\n", ao_sample_alt);
-       printf ("  height      %d\n", ao_sample_height);
+       printf ("  alt         %ld\n", ao_sample_alt);
+       printf ("  height      %ld\n", ao_sample_height);
 #endif
 
 #if HAS_ACCEL
@@ -518,12 +518,12 @@ ao_flight_dump(void)
 
 
        printf ("kalman:\n");
-       printf ("  height      %d\n", ao_height);
+       printf ("  height      %ld\n", ao_height);
        printf ("  speed       %d.%02d\n", int_part(ao_speed), frac_part(ao_speed));
        printf ("  accel       %d.%02d\n", int_part(ao_accel), frac_part(ao_accel));
-       printf ("  max_height  %d\n", ao_max_height);
-       printf ("  avg_height  %d\n", ao_avg_height);
-       printf ("  error_h     %d\n", ao_error_h);
+       printf ("  max_height  %ld\n", ao_max_height);
+       printf ("  avg_height  %ld\n", ao_avg_height);
+       printf ("  error_h     %ld\n", ao_error_h);
 #if !HAS_ACCEL
        printf ("  error_avg   %d\n", ao_error_h_sq_avg);
 #endif
@@ -543,6 +543,7 @@ static void
 ao_orient_test_select(void)
 {
        ao_orient_test = !ao_orient_test;
+       printf("orient test %d\n", ao_orient_test);
 }
 
 const struct ao_cmds ao_flight_cmds[] = {
index 2c77c36920ed5755046e158c9e32f4e92e2d9aae..9ddbfd8eace7453a6f359267a866cf0972b40c61 100644 (file)
@@ -252,11 +252,13 @@ ao_sample_preflight_set(void)
         */
        ao_quaternion_vectors_to_rotation(&ao_rotation, &up, &orient);
 #if HAS_FLIGHT_DEBUG
-       if (ao_orient_test)
+       if (ao_orient_test) {
                printf("\n\treset across %d through %d along %d\n",
                       (ao_ground_accel_across - ao_config.accel_zero_across),
                       (ao_ground_accel_through - ao_config.accel_zero_through),
                       (ao_ground_accel_along - ao_config.accel_zero_along));
+               fflush(stdout);
+       }
 #endif
 
        ao_sample_compute_orient();
@@ -266,7 +268,6 @@ ao_sample_preflight_set(void)
 }
 
 #if HAS_GYRO
-
 #define TIME_DIV       200.0f
 
 static void
@@ -295,6 +296,7 @@ ao_sample_rotate(void)
                        (int) (y * 1000),
                        (int) (z * 1000),
                        ao_sample_orient);
+               fflush(stdout);
        }
 #endif
        ao_sample_compute_orient();