From 554bd1257d1a1f3fa445fd66b1e6f6d8dcaf3ad7 Mon Sep 17 00:00:00 2001 From: Martin Budden Date: Sat, 29 Jul 2017 21:02:10 +0100 Subject: [PATCH] Reduced MAX_SUPPORTED_MOTORS from 12 to 8 --- src/main/drivers/pwm_output.h | 14 +++------- src/main/drivers/pwm_output_counts.h | 31 +++++++++++++++++++++++ src/main/flight/mixer.h | 3 +++ src/main/target/STM32F3DISCOVERY/target.h | 2 ++ src/main/target/common_fc_pre.h | 1 - 5 files changed, 40 insertions(+), 11 deletions(-) create mode 100644 src/main/drivers/pwm_output_counts.h diff --git a/src/main/drivers/pwm_output.h b/src/main/drivers/pwm_output.h index 4dff00fbc3..d1adea22af 100644 --- a/src/main/drivers/pwm_output.h +++ b/src/main/drivers/pwm_output.h @@ -17,18 +17,12 @@ #pragma once +#include "platform.h" + #include "drivers/io_types.h" -#include "timer.h" +#include "drivers/pwm_output_counts.h" +#include "drivers/timer.h" -#ifndef MAX_SUPPORTED_MOTORS -#define MAX_SUPPORTED_MOTORS 12 -#endif - -#if defined(USE_QUAD_MIXER_ONLY) -#define MAX_SUPPORTED_SERVOS 1 -#else -#define MAX_SUPPORTED_SERVOS 8 -#endif #define DSHOT_MAX_COMMAND 47 diff --git a/src/main/drivers/pwm_output_counts.h b/src/main/drivers/pwm_output_counts.h new file mode 100644 index 0000000000..96345020c7 --- /dev/null +++ b/src/main/drivers/pwm_output_counts.h @@ -0,0 +1,31 @@ +/* + * This file is part of Cleanflight. + * + * Cleanflight is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Cleanflight is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Cleanflight. If not, see . + */ + +#pragma once + +#include "platform.h" + + +#if defined(USE_QUAD_MIXER_ONLY) +#define MAX_SUPPORTED_MOTORS 4 +#define MAX_SUPPORTED_SERVOS 1 +#else +#ifndef MAX_SUPPORTED_MOTORS +#define MAX_SUPPORTED_MOTORS 8 +#endif +#define MAX_SUPPORTED_SERVOS 8 +#endif diff --git a/src/main/flight/mixer.h b/src/main/flight/mixer.h index ad0ae8042d..4e11c84e15 100644 --- a/src/main/flight/mixer.h +++ b/src/main/flight/mixer.h @@ -17,7 +17,10 @@ #pragma once +#include "platform.h" + #include "config/parameter_group.h" +#include "drivers/pwm_output_counts.h" #include "drivers/io_types.h" #include "drivers/pwm_output.h" diff --git a/src/main/target/STM32F3DISCOVERY/target.h b/src/main/target/STM32F3DISCOVERY/target.h index b0de8205f1..bfb1dd705d 100644 --- a/src/main/target/STM32F3DISCOVERY/target.h +++ b/src/main/target/STM32F3DISCOVERY/target.h @@ -181,6 +181,8 @@ #define USE_SERIAL_4WAY_BLHELI_INTERFACE +#define MAX_SUPPORTED_MOTORS 12 + // IO - 303 in 100pin package #define TARGET_IO_PORTA 0xffff #define TARGET_IO_PORTB 0xffff diff --git a/src/main/target/common_fc_pre.h b/src/main/target/common_fc_pre.h index d5104588f1..f23a130f35 100644 --- a/src/main/target/common_fc_pre.h +++ b/src/main/target/common_fc_pre.h @@ -36,7 +36,6 @@ // Using RX DMA disables the use of receive callbacks #define USE_UART1_RX_DMA #define USE_UART1_TX_DMA -#define MAX_SUPPORTED_MOTORS 8 #endif #ifdef STM32F3