src/teleballoon-v1.1: Use Tm style initial state stuff
authorKeith Packard <keithp@keithp.com>
Fri, 21 Oct 2011 21:58:26 +0000 (14:58 -0700)
committerKeith Packard <keithp@keithp.com>
Fri, 21 Oct 2011 21:58:26 +0000 (14:58 -0700)
Come up in pad mode unless someone talks to us while in idle mode.

Signed-off-by: Keith Packard <keithp@keithp.com>
src/teleballoon-v1.1/ao_balloon.c
src/teleballoon-v1.1/ao_teleballoon.c

index 08a3ae1e24c40755e3bded22182a1c39ca02687d..e89726552dce132bddaf0c4f09f6a45471c0b12a 100644 (file)
@@ -59,26 +59,7 @@ ao_flight(void)
                         *  - pad mode if we're upright,
                         *  - idle mode otherwise
                         */
                         *  - pad mode if we're upright,
                         *  - idle mode otherwise
                         */
-#if HAS_ACCEL
-                       if (ao_config.accel_plus_g == 0 ||
-                           ao_config.accel_minus_g == 0 ||
-                           ao_ground_accel < ao_config.accel_plus_g - ACCEL_NOSE_UP ||
-                           ao_ground_accel > ao_config.accel_minus_g + ACCEL_NOSE_UP)
-                       {
-                               /* Detected an accel value outside -1.5g to 1.5g
-                                * (or uncalibrated values), so we go into invalid mode
-                                */
-                               ao_flight_state = ao_flight_invalid;
-
-                               /* Turn on packet system in invalid mode on TeleMetrum */
-                               ao_packet_slave_start();
-                       } else
-#endif
-                               if (!ao_flight_force_idle
-#if HAS_ACCEL
-                                   && ao_ground_accel < ao_config.accel_plus_g + ACCEL_NOSE_UP
-#endif
-                                       )
+                       if (!ao_flight_force_idle)
                        {
                                /* Set pad mode - we can fly! */
                                ao_flight_state = ao_flight_pad;
                        {
                                /* Set pad mode - we can fly! */
                                ao_flight_state = ao_flight_pad;
@@ -89,10 +70,8 @@ ao_flight(void)
                                ao_usb_disable();
 #endif
 
                                ao_usb_disable();
 #endif
 
-#if !HAS_ACCEL
-                               /* Disable packet mode in pad state on TeleMini */
+                               /* Disable packet mode in pad state */
                                ao_packet_slave_stop();
                                ao_packet_slave_stop();
-#endif
 
                                /* Turn on telemetry system */
                                ao_rdf_set(1);
 
                                /* Turn on telemetry system */
                                ao_rdf_set(1);
@@ -104,11 +83,6 @@ ao_flight(void)
                                /* Set idle mode */
                                ao_flight_state = ao_flight_idle;
  
                                /* Set idle mode */
                                ao_flight_state = ao_flight_idle;
  
-#if HAS_ACCEL
-                               /* Turn on packet system in idle mode on TeleMetrum */
-                               ao_packet_slave_start();
-#endif
-
                                /* signal successful initialization by turning off the LED */
                                ao_led_off(AO_LED_RED);
                        }
                                /* signal successful initialization by turning off the LED */
                                ao_led_off(AO_LED_RED);
                        }
index a48e21d2302267b090a2a492c946dd968e131910..3f12a59cda41de833d70d87ce46cc85122d2d448 100644 (file)
@@ -65,7 +65,7 @@ main(void)
        ao_gps_report_init();
        ao_telemetry_init();
        ao_radio_init();
        ao_gps_report_init();
        ao_telemetry_init();
        ao_radio_init();
-       ao_packet_slave_init(FALSE);
+       ao_packet_slave_init(TRUE);
 #if HAS_DBG
        ao_dbg_init();
 #endif
 #if HAS_DBG
        ao_dbg_init();
 #endif