X-Git-Url: https://git.gag.com/?p=fw%2Faltos;a=blobdiff_plain;f=src%2Fkernel%2Fao_sample.c;fp=src%2Fkernel%2Fao_sample.c;h=874c91100a665ca1f0ec3680e4392ede174e9acc;hp=46771496b69a4745cd6ea24597f9fa048c7243ba;hb=f10009b07b651f69014ac5608f3ca29bce874c24;hpb=a7f1925b81a429d9f387f7e26433326e37c43d4f diff --git a/src/kernel/ao_sample.c b/src/kernel/ao_sample.c index 46771496..874c9110 100644 --- a/src/kernel/ao_sample.c +++ b/src/kernel/ao_sample.c @@ -57,6 +57,9 @@ angle_t ao_sample_orient; angle_t ao_sample_orients[AO_NUM_ORIENT]; uint8_t ao_sample_orient_pos; #endif +#ifdef HAS_MOTOR_PRESSURE +motor_pressure_t ao_sample_motor_pressure; +#endif uint8_t ao_sample_data; @@ -87,6 +90,10 @@ int32_t ao_ground_yaw; int32_t ao_ground_roll; #endif +#if HAS_MOTOR_PRESSURE +motor_pressure_t ao_ground_motor_pressure; +#endif + static uint8_t ao_preflight; /* in preflight mode */ static uint16_t nsamples; @@ -107,6 +114,9 @@ int32_t ao_sample_yaw_sum; int32_t ao_sample_roll_sum; static struct ao_quaternion ao_rotation; #endif +#if HAS_MOTOR_PRESSURE +int32_t ao_sample_motor_pressure_sum; +#endif #if HAS_FLIGHT_DEBUG extern uint8_t ao_orient_test; @@ -130,6 +140,9 @@ ao_sample_preflight_add(void) ao_sample_pitch_sum += ao_sample_pitch; ao_sample_yaw_sum += ao_sample_yaw; ao_sample_roll_sum += ao_sample_roll; +#endif +#if HAS_MOTOR_PRESSURE + ao_sample_motor_pressure_sum += ao_sample_motor_pressure; #endif ++nsamples; } @@ -199,6 +212,9 @@ ao_sample_preflight_set(void) ao_ground_accel_through = ao_sample_accel_through_sum >> 9; #endif +#if HAS_MOTOR_PRESSURE + ao_ground_motor_pressure = ao_sample_motor_pressure_sum >> 9; +#endif #if HAS_GYRO ao_ground_pitch = ao_sample_pitch_sum; ao_ground_yaw = ao_sample_yaw_sum; @@ -379,6 +395,9 @@ ao_sample(void) ao_sample_yaw = ao_data_yaw(ao_data); ao_sample_roll = ao_data_roll(ao_data); #endif +#if HAS_MOTOR_PRESSURE + ao_sample_motor_pressure = ao_data_motor_pressure(ao_data); +#endif if (ao_preflight) ao_sample_preflight();