diff --git a/sw/airborne/autopilot/Makefile b/sw/airborne/autopilot/Makefile index 69b30762b8..da2305eefd 100644 --- a/sw/airborne/autopilot/Makefile +++ b/sw/airborne/autopilot/Makefile @@ -35,12 +35,6 @@ TARGET = autopilot LOW_FUSE = e0 HIGH_FUSE = 99 -ifeq ($(CTL_BRD_VERSION),V1_1) -LOW_FUSE = ff -HIGH_FUSE = 89 -CTL_BRD_FLAGS=-DCTL_BRD_V1_1 -endif - ifeq ($(SIMUL),1) SIMUL_FLAGS= -DSIMUL endif diff --git a/sw/airborne/autopilot/adc.c b/sw/airborne/autopilot/adc.c index 436d608787..447c9f2d6c 100644 --- a/sw/airborne/autopilot/adc.c +++ b/sw/airborne/autopilot/adc.c @@ -50,13 +50,7 @@ #define ANALOG_PORT_DIR DDRF -#ifdef CTL_BRD_V1_1 -#define ANALOG_VREF 0 -#endif - -#if defined CTL_BRD_V1_2 || defined CTL_BRD_V1_2_1 #define ANALOG_VREF _BV(REFS0) -#endif uint16_t adc_samples[ NB_ADC ]; diff --git a/sw/airborne/autopilot/autopilot.h b/sw/airborne/autopilot/autopilot.h index 04678478cc..1f8c366cb8 100644 --- a/sw/airborne/autopilot/autopilot.h +++ b/sw/airborne/autopilot/autopilot.h @@ -98,9 +98,6 @@ extern bool_t launch; #define CheckEvent(_event) (_event ? _event = FALSE, TRUE : FALSE) -#ifdef CTL_BRD_V1_1 -extern struct adc_buf buf_bat; -#endif void periodic_task( void ); void use_gps_pos(void); diff --git a/sw/airborne/autopilot/estimator.c b/sw/airborne/autopilot/estimator.c index 7f1d43480c..5dde117502 100644 --- a/sw/airborne/autopilot/estimator.c +++ b/sw/airborne/autopilot/estimator.c @@ -148,6 +148,15 @@ void estimator_update_state_infrared( void ) { estimator_theta = rad_of_ir * ir_pitch; } + +#include "link_fbw.h" +void estimator_update_state_3DMG ( void ) { + estimator_phi = from_fbw.euler[0]; + estimator_psi = from_fbw.euler[1]; + estimator_theta = from_fbw.euler[2]; +} + + #define INIT_WEIGHT 100. /* The number of times the initial value has to be taken */ #define RHO 0.999 /* The higher, the slower the estimation is changing */ diff --git a/sw/airborne/autopilot/main.c b/sw/airborne/autopilot/main.c index 6da5e4895a..7ed585fd01 100644 --- a/sw/airborne/autopilot/main.c +++ b/sw/airborne/autopilot/main.c @@ -492,7 +492,9 @@ inline void periodic_task( void ) { } case 2: ir_update(); +#ifndef IMU_TYPE_3DMG estimator_update_state_infrared(); +#endif roll_pitch_pid_run(); /* Set desired_aileron & desired_elevator */ to_fbw.channels[RADIO_THROTTLE] = desired_gaz; /* desired_gaz is set upon GPS message reception */ to_fbw.channels[RADIO_ROLL] = desired_aileron; diff --git a/sw/airborne/autopilot/mainloop.c b/sw/airborne/autopilot/mainloop.c index bd95852753..ff923f9cb6 100644 --- a/sw/airborne/autopilot/mainloop.c +++ b/sw/airborne/autopilot/mainloop.c @@ -58,9 +58,6 @@ int main( void ) { timer_init(); modem_init(); adc_init(); -#ifdef CTL_BRD_V1_1 - adc_buf_channel(ADC_CHANNEL_BAT, &buf_bat, DEFAULT_AV_NB_SAMPLE); -#endif spi_init(); link_fbw_init(); gps_init(); @@ -103,7 +100,7 @@ int main( void ) { radio_control_task(); #ifdef IMU_TYPE_3DMG DOWNLINK_SEND_IMU_3DMG(&from_fbw.euler_dot[0], &from_fbw.euler_dot[1], &from_fbw.euler_dot[2], &from_fbw.euler[0], &from_fbw.euler[1], &from_fbw.euler[2]); - + estimator_update_state_3DMG(); #endif } } diff --git a/sw/airborne/autopilot/modem.h b/sw/airborne/autopilot/modem.h index 2d84056e16..3299b49383 100644 --- a/sw/airborne/autopilot/modem.h +++ b/sw/airborne/autopilot/modem.h @@ -53,16 +53,6 @@ extern uint8_t ck_a, ck_b; #define MODEM_TX_EN 7 #define MODEM_TX_DATA 6 -#ifdef CTL_BRD_V1_1 -#define MODEM_CLK_DDR DDRD -#define MODEM_CLK_PORT PORTD -#define MODEM_CLK 0 -#define MODEM_CLK_INT INT0 -#define MODEM_CLK_INT_REG EICRA -#define MODEM_CLK_INT_CFG _BV(ISC01) -#define MODEM_CLK_INT_SIG SIG_INTERRUPT0 -#endif /* CTL_BRD_V1_1 */ - #ifdef CTL_BRD_V1_2 #define MODEM_CLK_DDR DDRD #define MODEM_CLK_PORT PORTD