diff --git a/conf/autopilot/fixedwing.makefile b/conf/autopilot/fixedwing.makefile index 8b2808e155..bc717e9fc4 100644 --- a/conf/autopilot/fixedwing.makefile +++ b/conf/autopilot/fixedwing.makefile @@ -10,7 +10,7 @@ CFG_FIXEDWING=$(PAPARAZZI_SRC)/conf/autopilot/subsystems/fixedwing SRC_FIXEDWING=. -SRC_ARCH=$(SRC_FIXEDWING)/arch/$(ARCH) +SRC_ARCH=arch/$(ARCH) SRC_FIXEDWING_TEST=$(SRC_FIXEDWING)/ SRC_FIRMWARE=firmwares/fixedwing diff --git a/conf/autopilot/setup.makefile b/conf/autopilot/setup.makefile index 02fa4b7fee..e3c3b31579 100644 --- a/conf/autopilot/setup.makefile +++ b/conf/autopilot/setup.makefile @@ -3,8 +3,9 @@ # # +SRC_ARCH=arch/$(ARCH) -CFG_SETUP=$(PAPARAZZI_SRC)/conf/autopilot/subsystems/SETUP +CFG_SETUP=$(PAPARAZZI_SRC)/conf/autopilot/subsystems/setup SRC_SETUP=. @@ -49,9 +50,36 @@ usb_tunnel_1.srcs += sys_time.c $(SRC_ARCH)/sys_time_hw.c $(SRC_ARCH)/armVIC.c + +ifeq ($(ACTUATORS),) + ifeq ($(BOARD),tiny) + ifeq ($(BOARD_VERSION),1.1) + include $(CFG_SETUP)/actuators_4015.makefile + else + ifeq ($(BOARD_VERSION),0.99) + include $(CFG_SETUP)/actuators_4015.makefile + else + include $(CFG_SETUP)/actuators_4017.makefile + endif + endif + endif + ifeq ($(BOARD),twog) + include $(CFG_SETUP)/actuators_4017.makefile + endif + + ifeq ($(BOARD),lisa_l) + include $(CFG_SETUP)/actuators_direct.makefile + endif + +else + include $(CFG_SETUP)/$(ACTUATORS).makefile +endif + + # a test program to setup actuators -setup_actuators.CFLAGS += -DFBW -DLED -DTIME_LED=1 -DACTUATORS=\"servos_4017_hw.h\" -DSERVOS_4017 +setup_actuators.CFLAGS += -DFBW -DLED -DTIME_LED=1 setup_actuators.CFLAGS += -DUSE_UART1 -DUART1_BAUD=B57600 -DDOWNLINK_DEVICE=Uart1 -DPPRZ_UART=Uart1 setup_actuators.CFLAGS += -DDOWNLINK -DDOWNLINK_TRANSPORT=PprzTransport -DDATALINK=PPRZ setup_actuators.CFLAGS += -DDOWNLINK_FBW_DEVICE=Uart1 -DDOWNLINK_AP_DEVICE=Uart1 -setup_actuators.srcs += sys_time.c $(SRC_ARCH)/sys_time_hw.c $(SRC_ARCH)/armVIC.c pprz_transport.c downlink.c actuators.c setup_actuators.c $(SRC_ARCH)/uart_hw.c $(SRC_ARCH)/servos_4017_hw.c main.c +setup_actuators.CFLAGS += $(SETUP_INC) -Ifirmwares/fixedwing +setup_actuators.srcs += sys_time.c $(SRC_ARCH)/sys_time_hw.c $(SRC_ARCH)/armVIC.c pprz_transport.c downlink.c setup_actuators.c $(SRC_ARCH)/uart_hw.c firmwares/fixedwing/main.c diff --git a/conf/autopilot/subsystems/setup/actuators_4015.makefile b/conf/autopilot/subsystems/setup/actuators_4015.makefile new file mode 100644 index 0000000000..64f188656f --- /dev/null +++ b/conf/autopilot/subsystems/setup/actuators_4015.makefile @@ -0,0 +1,5 @@ +# for Tiny v1.1 + +$(TARGET).CFLAGS += -DACTUATORS=\"servos_4015_MAT_hw.h\" -DSERVOS_4015_MAT +$(TARGET).srcs += $(SRC_ARCH)/servos_4015_MAT_hw.c actuators.c + diff --git a/conf/autopilot/subsystems/setup/actuators_4017.makefile b/conf/autopilot/subsystems/setup/actuators_4017.makefile new file mode 100644 index 0000000000..cab5136fc8 --- /dev/null +++ b/conf/autopilot/subsystems/setup/actuators_4017.makefile @@ -0,0 +1,5 @@ +# for Tiny v2 or Twog v1 + +$(TARGET).CFLAGS += -DACTUATORS=\"servos_4017_hw.h\" -DSERVOS_4017 +$(TARGET).srcs += $(SRC_ARCH)/servos_4017_hw.c actuators.c + diff --git a/conf/autopilot/subsystems/setup/actuators_direct.makefile b/conf/autopilot/subsystems/setup/actuators_direct.makefile new file mode 100644 index 0000000000..07865d71d1 --- /dev/null +++ b/conf/autopilot/subsystems/setup/actuators_direct.makefile @@ -0,0 +1,13 @@ +# for lisa_l + +$(TARGET).CFLAGS += -DACTUATORS=\"servos_direct_hw.h\" -DSERVOS_DIRECT +$(TARGET).srcs += $(SRC_ARCH)/servos_direct_hw.c actuators.c + + +# TODO TODO UGLY HACK: We re-use the booz actuators: Should become universal actuator code!! +# Carefull: paths might get broken with this silly rotorcraft/fixedwing mixup of directories + +ifeq ($(ARCH), stm32) +$(TARGET).srcs += firmwares/rotorcraft/actuators/arch/stm32/actuators_pwm_arch.c +$(TARGET).CFLAGS += -Ifirmwares/rotorcraft/actuators/arch/stm32 +endif diff --git a/sw/airborne/firmwares/fixedwing/guidance/guidance_v_n.c b/sw/airborne/firmwares/fixedwing/guidance/guidance_v_n.c index 4e15561d24..66b382041d 100644 --- a/sw/airborne/firmwares/fixedwing/guidance/guidance_v_n.c +++ b/sw/airborne/firmwares/fixedwing/guidance/guidance_v_n.c @@ -33,7 +33,7 @@ #include "estimator.h" #include "nav.h" #include "generated/airframe.h" -#include "autopilot.h" +#include "firmwares/fixedwing/autopilot.h" /* mode */ uint8_t v_ctl_mode; diff --git a/sw/airborne/firmwares/fixedwing/main_ap.c b/sw/airborne/firmwares/fixedwing/main_ap.c index 7b1eef509c..ace3d94f68 100644 --- a/sw/airborne/firmwares/fixedwing/main_ap.c +++ b/sw/airborne/firmwares/fixedwing/main_ap.c @@ -45,7 +45,7 @@ #include "gyro.h" #include "ap_downlink.h" #include "nav.h" -#include "autopilot.h" +#include "firmwares/fixedwing/autopilot.h" #include "estimator.h" #include "generated/settings.h" #include "link_mcu.h" diff --git a/sw/airborne/firmwares/fixedwing/main_fbw.c b/sw/airborne/firmwares/fixedwing/main_fbw.c index d3954ce44d..ed29dab3e6 100644 --- a/sw/airborne/firmwares/fixedwing/main_fbw.c +++ b/sw/airborne/firmwares/fixedwing/main_fbw.c @@ -50,7 +50,7 @@ #include "firmwares/fixedwing/actuators.h" #include "subsystems/radio_control.h" #include "fbw_downlink.h" -#include "autopilot.h" +#include "firmwares/fixedwing/autopilot.h" #include "paparazzi.h" #include "estimator.h" diff --git a/sw/airborne/firmwares/fixedwing/stabilization/stabilization_adaptive.c b/sw/airborne/firmwares/fixedwing/stabilization/stabilization_adaptive.c index bc8d33725a..0594546b02 100644 --- a/sw/airborne/firmwares/fixedwing/stabilization/stabilization_adaptive.c +++ b/sw/airborne/firmwares/fixedwing/stabilization/stabilization_adaptive.c @@ -36,7 +36,7 @@ #include "nav.h" #include "generated/airframe.h" #include "firmwares/fixedwing/guidance/guidance_v.h" -#include "autopilot.h" +#include "firmwares/fixedwing/autopilot.h" /* outer loop parameters */