diff --git a/conf/airframes/microjetI.xml b/conf/airframes/microjetI.xml
index ee217cda8a..b066aab957 100644
--- a/conf/airframes/microjetI.xml
+++ b/conf/airframes/microjetI.xml
@@ -54,11 +54,7 @@
-
-
-
-
-
+
diff --git a/sw/airborne/infrared.c b/sw/airborne/infrared.c
index 81c24325ce..2a663f8c75 100644
--- a/sw/airborne/infrared.c
+++ b/sw/airborne/infrared.c
@@ -139,16 +139,17 @@ float ir_360_vertical_correction;
* Initialize \a adc_buf_channel
*/
void ir_init(void) {
- RadOfIrFromContrast(IR_DEFAULT_CONTRAST);
#ifndef SITL
adc_buf_channel(ADC_CHANNEL_IR1, &buf_ir1, ADC_CHANNEL_IR_NB_SAMPLES);
adc_buf_channel(ADC_CHANNEL_IR2, &buf_ir2, ADC_CHANNEL_IR_NB_SAMPLES);
#endif
+
#ifdef ADC_CHANNEL_IR_TOP
adc_buf_channel(ADC_CHANNEL_IR_TOP, &buf_ir_top, ADC_CHANNEL_IR_NB_SAMPLES);
z_contrast_mode = Z_CONTRAST_DEFAULT;
#else
z_contrast_mode = 0;
+ RadOfIrFromContrast(IR_DEFAULT_CONTRAST);
#endif
ir_roll_neutral = RadOfDeg(IR_ROLL_NEUTRAL_DEFAULT);
@@ -172,13 +173,14 @@ void ir_init(void) {
ir_estimated_theta_pi_4 = IR_ESTIMATED_THETA_PI_4;
ir_estimated_theta_minus_pi_4 = IR_ESTIMATED_THETA_MINUS_PI_4;
- ir_contrast = IR_DEFAULT_CONTRAST;
- ir_rad_of_ir = IR_RAD_OF_IR_CONTRAST / IR_DEFAULT_CONTRAST;
-
ir_360_lateral_correction = IR_360_LATERAL_CORRECTION;
ir_360_longitudinal_correction = IR_360_LONGITUDINAL_CORRECTION;
ir_360_vertical_correction = IR_360_VERTICAL_CORRECTION;
+#ifndef ADC_CHANNEL_IR_TOP
+ ir_contrast = IR_DEFAULT_CONTRAST;
+ ir_rad_of_ir = IR_RAD_OF_IR_CONTRAST / IR_DEFAULT_CONTRAST;
+#endif
}
/** \brief Update \a ir_roll and ir_pitch from ADCs or from simulator
@@ -201,6 +203,10 @@ void ir_update(void) {
/** #else ir_roll set by simulator in sim_ir.c */
}
+
+uint8_t calib_status = NO_CALIB;
+
+#ifndef ADC_CHANNEL_IR_TOP
/** \brief Contrast measurement
* \note Plane must be nose down !
*/
@@ -214,8 +220,6 @@ static void ir_gain_calib(void) {
After, no more calibration is possible */
#define MAX_DELAY_FOR_CALIBRATION 10
-uint8_t calib_status = NO_CALIB;
-
/** \brief Calibrate contrast if paparazzi mode is
* set to auto1 before MAX_DELAY_FOR_CALIBRATION secondes */
/**User must put verticaly the uav (nose bottom) and push
@@ -242,6 +246,7 @@ void ground_calibrate( bool_t triggered ) {
break;
}
}
+#endif /* !ADC_CHANNEL_IR_TOP */
#define INIT_WEIGHT 100. /* The number of times the initial value has to be taken */
#define RHO 0.995 /* The higher, the slower the estimation is changing */
diff --git a/sw/airborne/main_ap.c b/sw/airborne/main_ap.c
index 0c76492437..9645ddf6e0 100644
--- a/sw/airborne/main_ap.c
+++ b/sw/airborne/main_ap.c
@@ -295,17 +295,19 @@ inline void telecommand_task( void ) {
if ( mode_changed )
PERIODIC_SEND_PPRZ_MODE();
- /** If Auto1 mode, compute \a desired_roll and \a desired_pitch from
+ /** In AUTO1 mode, compute roll setpoint and pitch setpoint from
* \a RADIO_ROLL and \a RADIO_PITCH \n
- * Else asynchronously set by \a course_pid_run
*/
if (pprz_mode == PPRZ_MODE_AUTO1) {
- /** In Auto1 mode, roll is bounded between [-AUTO1_MAX_ROLL;AUTO1_MAX_ROLL] */
+ /** Roll is bounded between [-AUTO1_MAX_ROLL;AUTO1_MAX_ROLL] */
h_ctl_roll_setpoint = FLOAT_OF_PPRZ(fbw_state->channels[RADIO_ROLL], 0., -AUTO1_MAX_ROLL);
- /** In Auto1 mode, pitch is bounded between [-AUTO1_MAX_PITCH;AUTO1_MAX_PITCH] */
+ /** Pitch is bounded between [-AUTO1_MAX_PITCH;AUTO1_MAX_PITCH] */
h_ctl_pitch_setpoint = FLOAT_OF_PPRZ(fbw_state->channels[RADIO_PITCH], 0., AUTO1_MAX_PITCH);
- }
+ } /** Else asynchronously set by \a h_ctl_course_loop() */
+
+ /** In AUTO1, throttle comes from RADIO_THROTTLE
+ In MANUAL, the value is copied to get it in the telemetry */
if (pprz_mode == PPRZ_MODE_MANUAL || pprz_mode == PPRZ_MODE_AUTO1) {
v_ctl_throttle_setpoint = fbw_state->channels[RADIO_THROTTLE];
}
@@ -317,7 +319,7 @@ inline void telecommand_task( void ) {
events_update();
if (!estimator_flight_time) {
-#ifdef INFRARED
+#if defined INFRARED && !ADC_CHANNEL_IR_TOP
ground_calibrate(STICK_PUSHED(fbw_state->channels[RADIO_ROLL]));
#endif
if (pprz_mode == PPRZ_MODE_AUTO2 && fbw_state->channels[RADIO_THROTTLE] > THROTTLE_THRESHOLD_TAKEOFF) {