/* Main flight thread. */
enum ao_flight_state ao_flight_state; /* current flight state */
-uint16_t ao_boost_tick; /* time of most recent boost detect */
-uint16_t ao_launch_tick; /* time of first boost detect */
+AO_TICK_TYPE ao_boost_tick; /* time of most recent boost detect */
+AO_TICK_TYPE ao_launch_tick; /* time of first boost detect */
uint16_t ao_motor_number; /* number of motors burned so far */
#if HAS_SENSOR_ERRORS
* (15 seconds) has past.
*/
if ((ao_accel < AO_MSS_TO_ACCEL(-2.5)) ||
- (int16_t) (ao_sample_tick - ao_boost_tick) > BOOST_TICKS_MAX)
+ (AO_TICK_SIGNED) (ao_sample_tick - ao_boost_tick) > BOOST_TICKS_MAX)
{
#if HAS_ACCEL
#if HAS_BARO
* number of seconds.
*/
if (ao_config.apogee_lockout) {
- if ((int16_t) (ao_sample_tick - ao_launch_tick) <
+ if ((AO_TICK_SIGNED) (ao_sample_tick - ao_launch_tick) <
AO_SEC_TO_TICKS(ao_config.apogee_lockout))
break;
}
#define MAX_QUIET_ACCEL 2
- if ((int16_t) (ao_sample_tick - ao_interval_end) >= 0) {
+ if ((AO_TICK_SIGNED) (ao_sample_tick - ao_interval_end) >= 0) {
if (ao_interval_max_accel_along - ao_interval_min_accel_along <= ao_data_accel_to_sample(MAX_QUIET_ACCEL) &&
ao_interval_max_accel_across - ao_interval_min_accel_across <= ao_data_accel_to_sample(MAX_QUIET_ACCEL) &&
ao_interval_max_accel_through - ao_interval_min_accel_through <= ao_data_accel_to_sample(MAX_QUIET_ACCEL))
if (ao_avg_height > ao_interval_max_height)
ao_interval_max_height = ao_avg_height;
- if ((int16_t) (ao_sample_tick - ao_interval_end) >= 0) {
+ if ((AO_TICK_SIGNED) (ao_sample_tick - ao_interval_end) >= 0) {
if (ao_interval_max_height - ao_interval_min_height <= AO_M_TO_HEIGHT(4))
{
ao_flight_state = ao_flight_landed;
#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,
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);
#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
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
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[] = {