From c3f7146f037f3ccaba4b12b5dcc4a3e0f40fd045 Mon Sep 17 00:00:00 2001 From: Randy Mackay Date: Mon, 9 Sep 2013 15:57:54 +0900 Subject: [PATCH] Copter: improve check of frame type to catch spelling errors --- ArduCopter/ArduCopter.pde | 20 ++++++++------------ ArduCopter/defines.h | 15 ++++++++------- 2 files changed, 16 insertions(+), 19 deletions(-) diff --git a/ArduCopter/ArduCopter.pde b/ArduCopter/ArduCopter.pde index c8466e61a8..0d14d78921 100644 --- a/ArduCopter/ArduCopter.pde +++ b/ArduCopter/ArduCopter.pde @@ -438,24 +438,20 @@ static struct { //////////////////////////////////////////////////////////////////////////////// #if FRAME_CONFIG == QUAD_FRAME #define MOTOR_CLASS AP_MotorsQuad -#endif -#if FRAME_CONFIG == TRI_FRAME +#elif FRAME_CONFIG == TRI_FRAME #define MOTOR_CLASS AP_MotorsTri -#endif -#if FRAME_CONFIG == HEXA_FRAME +#elif FRAME_CONFIG == HEXA_FRAME #define MOTOR_CLASS AP_MotorsHexa -#endif -#if FRAME_CONFIG == Y6_FRAME +#elif FRAME_CONFIG == Y6_FRAME #define MOTOR_CLASS AP_MotorsY6 -#endif -#if FRAME_CONFIG == OCTA_FRAME +#elif FRAME_CONFIG == OCTA_FRAME #define MOTOR_CLASS AP_MotorsOcta -#endif -#if FRAME_CONFIG == OCTA_QUAD_FRAME +#elif FRAME_CONFIG == OCTA_QUAD_FRAME #define MOTOR_CLASS AP_MotorsOctaQuad -#endif -#if FRAME_CONFIG == HELI_FRAME +#elif FRAME_CONFIG == HELI_FRAME #define MOTOR_CLASS AP_MotorsHeli +#else + #error Unrecognised frame type #endif #if FRAME_CONFIG == HELI_FRAME // helicopter constructor requires more arguments diff --git a/ArduCopter/defines.h b/ArduCopter/defines.h index 6aeb7260f1..cd2a631453 100644 --- a/ArduCopter/defines.h +++ b/ArduCopter/defines.h @@ -75,13 +75,14 @@ #define AUX_SWITCH_HIGH 2 // indicates auxiliar switch is in the high position (pwm >1800) // Frame types -#define QUAD_FRAME 0 -#define TRI_FRAME 1 -#define HEXA_FRAME 2 -#define Y6_FRAME 3 -#define OCTA_FRAME 4 -#define HELI_FRAME 5 -#define OCTA_QUAD_FRAME 6 +#define UNDEFINED_FRAME 0 +#define QUAD_FRAME 1 +#define TRI_FRAME 2 +#define HEXA_FRAME 3 +#define Y6_FRAME 4 +#define OCTA_FRAME 5 +#define HELI_FRAME 6 +#define OCTA_QUAD_FRAME 7 #define PLUS_FRAME 0 #define X_FRAME 1