From 99ad231feb21d0824ae10123ffb53918490355d4 Mon Sep 17 00:00:00 2001 From: Felix Ruess Date: Fri, 3 Apr 2015 14:09:09 +0200 Subject: [PATCH] [conf] cleanup ahrs makefiles --- .../subsystems/fixedwing/ahrs_dcm.makefile | 1 - .../fixedwing/ahrs_float_cmpl_quat.makefile | 34 +++-------- .../fixedwing/ahrs_float_cmpl_rmat.makefile | 35 +++--------- .../fixedwing/ahrs_float_dcm.makefile | 47 --------------- .../subsystems/fixedwing/ahrs_gx3.makefile | 20 ------- .../fixedwing/ahrs_int_cmpl_quat.makefile | 33 +++-------- .../shared/ahrs_float_cmpl_quat.makefile | 13 ++--- .../shared/ahrs_float_cmpl_rmat.makefile | 12 ++-- .../subsystems/shared/ahrs_float_dcm.makefile | 57 +++++++++++++++++++ .../shared/ahrs_float_mlkf.makefile | 13 ++--- .../shared/ahrs_int_cmpl_euler.makefile | 12 ++-- .../shared/ahrs_int_cmpl_quat.makefile | 13 ++--- 12 files changed, 106 insertions(+), 184 deletions(-) delete mode 100644 conf/firmwares/subsystems/fixedwing/ahrs_dcm.makefile delete mode 100644 conf/firmwares/subsystems/fixedwing/ahrs_float_dcm.makefile delete mode 100644 conf/firmwares/subsystems/fixedwing/ahrs_gx3.makefile create mode 100644 conf/firmwares/subsystems/shared/ahrs_float_dcm.makefile diff --git a/conf/firmwares/subsystems/fixedwing/ahrs_dcm.makefile b/conf/firmwares/subsystems/fixedwing/ahrs_dcm.makefile deleted file mode 100644 index 485ecaef96..0000000000 --- a/conf/firmwares/subsystems/fixedwing/ahrs_dcm.makefile +++ /dev/null @@ -1 +0,0 @@ -$(error The ahrs_dcm subsystem has been renamed, please replace with in your airframe file.) diff --git a/conf/firmwares/subsystems/fixedwing/ahrs_float_cmpl_quat.makefile b/conf/firmwares/subsystems/fixedwing/ahrs_float_cmpl_quat.makefile index bbc70ddbc7..d8e29177bd 100644 --- a/conf/firmwares/subsystems/fixedwing/ahrs_float_cmpl_quat.makefile +++ b/conf/firmwares/subsystems/fixedwing/ahrs_float_cmpl_quat.makefile @@ -5,38 +5,20 @@ # AHRS_H_Z # +# for fixedwings disable mag by default USE_MAGNETOMETER ?= 0 -AHRS_ALIGNER_LED ?= none -AHRS_CFLAGS = -DUSE_AHRS -AHRS_CFLAGS += -DUSE_AHRS_ALIGNER -DAHRS_GRAVITY_UPDATE_COORDINATED_TURN -ifeq (,$(findstring $(USE_MAGNETOMETER),0 FALSE)) - AHRS_CFLAGS += -DUSE_MAGNETOMETER -else - AHRS_CFLAGS += -DAHRS_USE_GPS_HEADING +include $(CFG_SHARED)/ahrs_float_cmpl_quat.makefile + +# add some fixedwing specific flags +ifeq (,$(findstring $(TARGET),sim fbw)) +$(TARGET).CFLAGS += -DAHRS_GRAVITY_UPDATE_COORDINATED_TURN +ifneq (,$(findstring $(USE_MAGNETOMETER),0 FALSE)) +$(TARGET).CFLAGS += -DAHRS_USE_GPS_HEADING endif - -ifneq ($(AHRS_ALIGNER_LED),none) - AHRS_CFLAGS += -DAHRS_ALIGNER_LED=$(AHRS_ALIGNER_LED) endif -AHRS_CFLAGS += -DAHRS_TYPE_H=\"subsystems/ahrs/ahrs_float_cmpl_wrapper.h\" -AHRS_CFLAGS += -DAHRS_PROPAGATE_QUAT -AHRS_SRCS += subsystems/ahrs.c -AHRS_SRCS += subsystems/ahrs/ahrs_float_cmpl.c -AHRS_SRCS += subsystems/ahrs/ahrs_float_cmpl_wrapper.c -AHRS_SRCS += subsystems/ahrs/ahrs_aligner.c - -ap.CFLAGS += $(AHRS_CFLAGS) -ap.srcs += $(AHRS_SRCS) - -# -# NPS uses the real algorithm -# -nps.CFLAGS += $(AHRS_CFLAGS) -nps.srcs += $(AHRS_SRCS) - # # Simple simulation of the AHRS result # diff --git a/conf/firmwares/subsystems/fixedwing/ahrs_float_cmpl_rmat.makefile b/conf/firmwares/subsystems/fixedwing/ahrs_float_cmpl_rmat.makefile index 9a506757de..d24e521814 100644 --- a/conf/firmwares/subsystems/fixedwing/ahrs_float_cmpl_rmat.makefile +++ b/conf/firmwares/subsystems/fixedwing/ahrs_float_cmpl_rmat.makefile @@ -5,38 +5,20 @@ # AHRS_H_Z # +# for fixedwings disable mag by default USE_MAGNETOMETER ?= 0 -AHRS_ALIGNER_LED ?= none -AHRS_CFLAGS = -DUSE_AHRS -AHRS_CFLAGS += -DUSE_AHRS_ALIGNER -DAHRS_GRAVITY_UPDATE_COORDINATED_TURN -ifeq (,$(findstring $(USE_MAGNETOMETER),0 FALSE)) - AHRS_CFLAGS += -DUSE_MAGNETOMETER -else - AHRS_CFLAGS += -DAHRS_USE_GPS_HEADING +include $(CFG_SHARED)/ahrs_float_cmpl_rmat.makefile + +# add some fixedwing specific flags +ifeq (,$(findstring $(TARGET),sim fbw)) +$(TARGET).CFLAGS += -DAHRS_GRAVITY_UPDATE_COORDINATED_TURN +ifneq (,$(findstring $(USE_MAGNETOMETER),0 FALSE)) +$(TARGET).CFLAGS += -DAHRS_USE_GPS_HEADING endif - -ifneq ($(AHRS_ALIGNER_LED),none) - AHRS_CFLAGS += -DAHRS_ALIGNER_LED=$(AHRS_ALIGNER_LED) endif -AHRS_CFLAGS += -DAHRS_TYPE_H=\"subsystems/ahrs/ahrs_float_cmpl_wrapper.h\" -AHRS_CFLAGS += -DAHRS_PROPAGATE_RMAT -AHRS_SRCS += subsystems/ahrs.c -AHRS_SRCS += subsystems/ahrs/ahrs_float_cmpl.c -AHRS_SRCS += subsystems/ahrs/ahrs_float_cmpl_wrapper.c -AHRS_SRCS += subsystems/ahrs/ahrs_aligner.c - -ap.CFLAGS += $(AHRS_CFLAGS) -ap.srcs += $(AHRS_SRCS) - -# -# NPS uses the real algorithm -# -nps.CFLAGS += $(AHRS_CFLAGS) -nps.srcs += $(AHRS_SRCS) - # # Simple simulation of the AHRS result # @@ -48,4 +30,3 @@ ahrssim_srcs += $(SRC_SUBSYSTEMS)/ahrs/ahrs_sim.c sim.CFLAGS += $(ahrssim_CFLAGS) sim.srcs += $(ahrssim_srcs) - diff --git a/conf/firmwares/subsystems/fixedwing/ahrs_float_dcm.makefile b/conf/firmwares/subsystems/fixedwing/ahrs_float_dcm.makefile deleted file mode 100644 index 07861fcd6e..0000000000 --- a/conf/firmwares/subsystems/fixedwing/ahrs_float_dcm.makefile +++ /dev/null @@ -1,47 +0,0 @@ -# Hey Emacs, this is a -*- makefile -*- - -# attitude estimation for fixedwings via dcm algorithm - -USE_MAGNETOMETER ?= 0 -AHRS_ALIGNER_LED ?= none - -AHRS_CFLAGS += -DAHRS_TYPE_H=\"subsystems/ahrs/ahrs_float_dcm_wrapper.h\" -AHRS_CFLAGS += -DUSE_AHRS_ALIGNER -AHRS_CFLAGS += -DUSE_AHRS - -ifeq (,$(findstring $(USE_MAGNETOMETER),0 FALSE)) -AHRS_CFLAGS += -DUSE_MAGNETOMETER -endif - -AHRS_SRCS += $(SRC_SUBSYSTEMS)/ahrs.c -AHRS_SRCS += $(SRC_SUBSYSTEMS)/ahrs/ahrs_aligner.c -AHRS_SRCS += $(SRC_SUBSYSTEMS)/ahrs/ahrs_float_dcm.c -AHRS_SRCS += $(SRC_SUBSYSTEMS)/ahrs/ahrs_float_dcm_wrapper.c - - -ifneq ($(AHRS_ALIGNER_LED),none) - AHRS_CFLAGS += -DAHRS_ALIGNER_LED=$(AHRS_ALIGNER_LED) -endif - - -ap.CFLAGS += $(AHRS_CFLAGS) -ap.srcs += $(AHRS_SRCS) - -# -# NPS uses the real algorithm -# -nps.CFLAGS += $(AHRS_CFLAGS) -nps.srcs += $(AHRS_SRCS) - -# -# Simple simulation of the AHRS result -# -ahrssim_CFLAGS = -DAHRS_TYPE_H=\"subsystems/ahrs/ahrs_sim.h\" -ahrssim_CFLAGS += -DUSE_AHRS - -ahrssim_srcs = $(SRC_SUBSYSTEMS)/ahrs.c -ahrssim_srcs += $(SRC_SUBSYSTEMS)/ahrs/ahrs_sim.c - -sim.CFLAGS += $(ahrssim_CFLAGS) -sim.srcs += $(ahrssim_srcs) - diff --git a/conf/firmwares/subsystems/fixedwing/ahrs_gx3.makefile b/conf/firmwares/subsystems/fixedwing/ahrs_gx3.makefile deleted file mode 100644 index c20c52a23b..0000000000 --- a/conf/firmwares/subsystems/fixedwing/ahrs_gx3.makefile +++ /dev/null @@ -1,20 +0,0 @@ -# Fixedwing AHRS module for GX3 -# 2013, Utah State University, http://aggieair.usu.edu/ - -GX3_PORT ?= UART3 -GX3_BAUD ?= B921600 - -AHRS_CFLAGS = -DUSE_AHRS -AHRS_CFLAGS += -DUSE_IMU - -AHRS_CFLAGS += -DAHRS_TYPE_H=\"subsystems/ahrs/ahrs_gx3.h\" -AHRS_SRCS += $(SRC_SUBSYSTEMS)/ahrs.c -AHRS_SRCS += $(SRC_SUBSYSTEMS)/imu.c -AHRS_SRCS += subsystems/ahrs/ahrs_gx3.c - -GX3_PORT_LOWER=$(shell echo $(GX3_PORT) | tr A-Z a-z) -AHRS_CFLAGS += -DUSE_$(GX3_PORT) -D$(GX3_PORT)_BAUD=$(GX3_BAUD) -AHRS_CFLAGS += -DGX3_PORT=$(GX3_PORT_LOWER) - -ap.CFLAGS += $(AHRS_CFLAGS) -ap.srcs += $(AHRS_SRCS) diff --git a/conf/firmwares/subsystems/fixedwing/ahrs_int_cmpl_quat.makefile b/conf/firmwares/subsystems/fixedwing/ahrs_int_cmpl_quat.makefile index 429d5eb012..d354c659f8 100644 --- a/conf/firmwares/subsystems/fixedwing/ahrs_int_cmpl_quat.makefile +++ b/conf/firmwares/subsystems/fixedwing/ahrs_int_cmpl_quat.makefile @@ -5,37 +5,20 @@ # AHRS_H_Z # +# for fixedwings disable mag by default USE_MAGNETOMETER ?= 0 -AHRS_ALIGNER_LED ?= none -AHRS_CFLAGS = -DUSE_AHRS -AHRS_CFLAGS += -DUSE_AHRS_ALIGNER -DAHRS_GRAVITY_UPDATE_COORDINATED_TURN -ifeq (,$(findstring $(USE_MAGNETOMETER),0 FALSE)) - AHRS_CFLAGS += -DUSE_MAGNETOMETER -else - AHRS_CFLAGS += -DAHRS_USE_GPS_HEADING +include $(CFG_SHARED)/ahrs_int_cmpl_quat.makefile + +# add some fixedwing specific flags +ifeq (,$(findstring $(TARGET),sim fbw)) +$(TARGET).CFLAGS += -DAHRS_GRAVITY_UPDATE_COORDINATED_TURN +ifneq (,$(findstring $(USE_MAGNETOMETER),0 FALSE)) +$(TARGET).CFLAGS += -DAHRS_USE_GPS_HEADING endif - -ifneq ($(AHRS_ALIGNER_LED),none) - AHRS_CFLAGS += -DAHRS_ALIGNER_LED=$(AHRS_ALIGNER_LED) endif -AHRS_CFLAGS += -DAHRS_TYPE_H=\"subsystems/ahrs/ahrs_int_cmpl_quat_wrapper.h\" -AHRS_SRCS += subsystems/ahrs.c -AHRS_SRCS += subsystems/ahrs/ahrs_int_cmpl_quat.c -AHRS_SRCS += subsystems/ahrs/ahrs_int_cmpl_quat_wrapper.c -AHRS_SRCS += subsystems/ahrs/ahrs_aligner.c - -ap.CFLAGS += $(AHRS_CFLAGS) -ap.srcs += $(AHRS_SRCS) - -# -# NPS uses the real algorithm -# -nps.CFLAGS += $(AHRS_CFLAGS) -nps.srcs += $(AHRS_SRCS) - # # Simple simulation of the AHRS result # diff --git a/conf/firmwares/subsystems/shared/ahrs_float_cmpl_quat.makefile b/conf/firmwares/subsystems/shared/ahrs_float_cmpl_quat.makefile index a9c0506d63..a98395b107 100644 --- a/conf/firmwares/subsystems/shared/ahrs_float_cmpl_quat.makefile +++ b/conf/firmwares/subsystems/shared/ahrs_float_cmpl_quat.makefile @@ -40,11 +40,8 @@ AHRS_FC_SRCS += subsystems/ahrs/ahrs_float_cmpl.c AHRS_FC_SRCS += subsystems/ahrs/ahrs_float_cmpl_wrapper.c AHRS_FC_SRCS += subsystems/ahrs/ahrs_aligner.c -ap.CFLAGS += $(AHRS_FC_CFLAGS) -ap.srcs += $(AHRS_FC_SRCS) - -nps.CFLAGS += $(AHRS_FC_CFLAGS) -nps.srcs += $(AHRS_FC_SRCS) - -test_ahrs.CFLAGS += $(AHRS_FC_CFLAGS) -test_ahrs.srcs += $(AHRS_FC_SRCS) +# add it for all targets except sim and fbw +ifeq (,$(findstring $(TARGET),sim fbw)) +$(TARGET).CFLAGS += $(AHRS_FC_CFLAGS) +$(TARGET).srcs += $(AHRS_FC_SRCS) +endif diff --git a/conf/firmwares/subsystems/shared/ahrs_float_cmpl_rmat.makefile b/conf/firmwares/subsystems/shared/ahrs_float_cmpl_rmat.makefile index 24f6df2a8b..3b742585f1 100644 --- a/conf/firmwares/subsystems/shared/ahrs_float_cmpl_rmat.makefile +++ b/conf/firmwares/subsystems/shared/ahrs_float_cmpl_rmat.makefile @@ -39,11 +39,9 @@ AHRS_FC_SRCS += subsystems/ahrs/ahrs_float_cmpl.c AHRS_FC_SRCS += subsystems/ahrs/ahrs_float_cmpl_wrapper.c AHRS_FC_SRCS += subsystems/ahrs/ahrs_aligner.c -ap.CFLAGS += $(AHRS_FC_CFLAGS) -ap.srcs += $(AHRS_FC_SRCS) -nps.CFLAGS += $(AHRS_FC_CFLAGS) -nps.srcs += $(AHRS_FC_SRCS) - -test_ahrs.CFLAGS += $(AHRS_FC_CFLAGS) -test_ahrs.srcs += $(AHRS_FC_SRCS) +# add it for all targets except sim and fbw +ifeq (,$(findstring $(TARGET),sim fbw)) +$(TARGET).CFLAGS += $(AHRS_FC_CFLAGS) +$(TARGET).srcs += $(AHRS_FC_SRCS) +endif diff --git a/conf/firmwares/subsystems/shared/ahrs_float_dcm.makefile b/conf/firmwares/subsystems/shared/ahrs_float_dcm.makefile new file mode 100644 index 0000000000..9629a3ae6f --- /dev/null +++ b/conf/firmwares/subsystems/shared/ahrs_float_dcm.makefile @@ -0,0 +1,57 @@ +# Hey Emacs, this is a -*- makefile -*- + +# attitude estimation for fixedwings via dcm algorithm + +USE_MAGNETOMETER ?= 0 +AHRS_ALIGNER_LED ?= none + +AHRS_DCM_CFLAGS = -DUSE_AHRS +AHRS_DCM_CFLAGS += -DUSE_AHRS_ALIGNER + +ifeq (,$(findstring $(USE_MAGNETOMETER),0 FALSE)) + AHRS_DCM_CFLAGS += -DUSE_MAGNETOMETER +endif + +ifneq ($(AHRS_ALIGNER_LED),none) + AHRS_DCM_CFLAGS += -DAHRS_ALIGNER_LED=$(AHRS_ALIGNER_LED) +endif + +ifdef SECONDARY_AHRS +ifneq (,$(findstring $(SECONDARY_AHRS), dcm float_dcm)) +# this is the secondary AHRS +AHRS_DCM_CFLAGS += -DAHRS_SECONDARY_TYPE_H=\"subsystems/ahrs/ahrs_float_dcm_wrapper.h\" +AHRS_DCM_CFLAGS += -DSECONDARY_AHRS=ahrs_dcm +else +# this is the primary AHRS +AHRS_DCM_CFLAGS += -DAHRS_TYPE_H=\"subsystems/ahrs/ahrs_float_dcm_wrapper.h\" +AHRS_DCM_CFLAGS += -DPRIMARY_AHRS=ahrs_dcm +endif +else +# plain old single AHRS usage +AHRS_DCM_CFLAGS += -DAHRS_TYPE_H=\"subsystems/ahrs/ahrs_float_dcm_wrapper.h\" +endif + +AHRS_DCM_SRCS += $(SRC_SUBSYSTEMS)/ahrs.c +AHRS_DCM_SRCS += $(SRC_SUBSYSTEMS)/ahrs/ahrs_aligner.c +AHRS_DCM_SRCS += $(SRC_SUBSYSTEMS)/ahrs/ahrs_float_dcm.c +AHRS_DCM_SRCS += $(SRC_SUBSYSTEMS)/ahrs/ahrs_float_dcm_wrapper.c + +# add it for all targets except sim and fbw +ifeq (,$(findstring $(TARGET),sim fbw)) +$(TARGET).CFLAGS += $(AHRS_DCM_CFLAGS) +$(TARGET).srcs += $(AHRS_DCM_SRCS) +endif + + +# +# Simple simulation of the AHRS result +# +ahrssim_CFLAGS = -DAHRS_TYPE_H=\"subsystems/ahrs/ahrs_sim.h\" +ahrssim_CFLAGS += -DUSE_AHRS + +ahrssim_srcs = $(SRC_SUBSYSTEMS)/ahrs.c +ahrssim_srcs += $(SRC_SUBSYSTEMS)/ahrs/ahrs_sim.c + +sim.CFLAGS += $(ahrssim_CFLAGS) +sim.srcs += $(ahrssim_srcs) + diff --git a/conf/firmwares/subsystems/shared/ahrs_float_mlkf.makefile b/conf/firmwares/subsystems/shared/ahrs_float_mlkf.makefile index f6b0f28dec..b55c467a5f 100644 --- a/conf/firmwares/subsystems/shared/ahrs_float_mlkf.makefile +++ b/conf/firmwares/subsystems/shared/ahrs_float_mlkf.makefile @@ -38,11 +38,8 @@ AHRS_MLKF_SRCS += subsystems/ahrs/ahrs_float_mlkf.c AHRS_MLKF_SRCS += subsystems/ahrs/ahrs_float_mlkf_wrapper.c AHRS_MLKF_SRCS += subsystems/ahrs/ahrs_aligner.c -ap.CFLAGS += $(AHRS_MLKF_CFLAGS) -ap.srcs += $(AHRS_MLKF_SRCS) - -nps.CFLAGS += $(AHRS_MLKF_CFLAGS) -nps.srcs += $(AHRS_MLKF_SRCS) - -test_ahrs.CFLAGS += $(AHRS_MLKF_CFLAGS) -test_ahrs.srcs += $(AHRS_MLKF_SRCS) +# add it for all targets except sim and fbw +ifeq (,$(findstring $(TARGET),sim fbw)) +$(TARGET).CFLAGS += $(AHRS_MLKF_CFLAGS) +$(TARGET).srcs += $(AHRS_MLKF_SRCS) +endif diff --git a/conf/firmwares/subsystems/shared/ahrs_int_cmpl_euler.makefile b/conf/firmwares/subsystems/shared/ahrs_int_cmpl_euler.makefile index 7bbc52aa72..8c3fcc6b38 100644 --- a/conf/firmwares/subsystems/shared/ahrs_int_cmpl_euler.makefile +++ b/conf/firmwares/subsystems/shared/ahrs_int_cmpl_euler.makefile @@ -37,11 +37,12 @@ AHRS_ICE_SRCS += subsystems/ahrs/ahrs_int_cmpl_euler.c AHRS_ICE_SRCS += subsystems/ahrs/ahrs_int_cmpl_euler_wrapper.c AHRS_ICE_SRCS += subsystems/ahrs/ahrs_aligner.c -ap.CFLAGS += $(AHRS_ICE_CFLAGS) -ap.srcs += $(AHRS_ICE_SRCS) +# add it for all targets except sim and fbw +ifeq (,$(findstring $(TARGET),sim fbw)) +$(TARGET).CFLAGS += $(AHRS_ICE_CFLAGS) +$(TARGET).srcs += $(AHRS_ICE_SRCS) +endif -nps.CFLAGS += $(AHRS_ICE_CFLAGS) -nps.srcs += $(AHRS_ICE_SRCS) # # Simple simulation of the AHRS result @@ -54,6 +55,3 @@ ahrssim_srcs += $(SRC_SUBSYSTEMS)/ahrs/ahrs_sim.c sim.CFLAGS += $(ahrssim_CFLAGS) sim.srcs += $(ahrssim_srcs) - -test_ahrs.CFLAGS += $(AHRS_ICE_CFLAGS) -test_ahrs.srcs += $(AHRS_ICE_SRCS) diff --git a/conf/firmwares/subsystems/shared/ahrs_int_cmpl_quat.makefile b/conf/firmwares/subsystems/shared/ahrs_int_cmpl_quat.makefile index 850de721f6..3e4a1442fd 100644 --- a/conf/firmwares/subsystems/shared/ahrs_int_cmpl_quat.makefile +++ b/conf/firmwares/subsystems/shared/ahrs_int_cmpl_quat.makefile @@ -39,11 +39,8 @@ AHRS_ICQ_SRCS += subsystems/ahrs/ahrs_int_cmpl_quat.c AHRS_ICQ_SRCS += subsystems/ahrs/ahrs_int_cmpl_quat_wrapper.c AHRS_ICQ_SRCS += subsystems/ahrs/ahrs_aligner.c -ap.CFLAGS += $(AHRS_ICQ_CFLAGS) -ap.srcs += $(AHRS_ICQ_SRCS) - -nps.CFLAGS += $(AHRS_ICQ_CFLAGS) -nps.srcs += $(AHRS_ICQ_SRCS) - -test_ahrs.CFLAGS += $(AHRS_ICQ_CFLAGS) -test_ahrs.srcs += $(AHRS_ICQ_SRCS) +# add it for all targets except sim and fbw +ifeq (,$(findstring $(TARGET),sim fbw)) +$(TARGET).CFLAGS += $(AHRS_ICQ_CFLAGS) +$(TARGET).srcs += $(AHRS_ICQ_SRCS) +endif