diff --git a/ArduCopter/Parameters.cpp b/ArduCopter/Parameters.cpp index ef7f785bea..fd5eea3e86 100644 --- a/ArduCopter/Parameters.cpp +++ b/ArduCopter/Parameters.cpp @@ -1240,8 +1240,11 @@ const AP_Param::GroupInfo ParametersG2::var_info2[] = { /* constructor for g2 object */ -ParametersG2::ParametersG2(void) - : command_model_pilot(PILOT_Y_RATE_DEFAULT, PILOT_Y_EXPO_DEFAULT, 0.0f) +ParametersG2::ParametersG2(void) : + unused_integer{17} +#if HAL_BUTTON_ENABLED + ,button_ptr(&copter.button) +#endif #if AP_TEMPCALIBRATION_ENABLED , temp_calibration() #endif @@ -1257,15 +1260,15 @@ ParametersG2::ParametersG2(void) #if MODE_SMARTRTL_ENABLED ,smart_rtl() #endif +#if USER_PARAMS_ENABLED + ,user_parameters() +#endif #if MODE_FLOWHOLD_ENABLED ,mode_flowhold_ptr(&copter.mode_flowhold) #endif #if MODE_FOLLOW_ENABLED ,follow() #endif -#if USER_PARAMS_ENABLED - ,user_parameters() -#endif #if AUTOTUNE_ENABLED ,autotune_ptr(&copter.mode_autotune.autotune) #endif @@ -1275,13 +1278,9 @@ ParametersG2::ParametersG2(void) #if MODE_AUTOROTATE_ENABLED ,arot() #endif -#if HAL_BUTTON_ENABLED - ,button_ptr(&copter.button) -#endif #if MODE_ZIGZAG_ENABLED ,mode_zigzag_ptr(&copter.mode_zigzag) #endif - #if MODE_ACRO_ENABLED || MODE_SPORT_ENABLED ,command_model_acro_rp(ACRO_RP_RATE_DEFAULT, ACRO_RP_EXPO_DEFAULT, 0.0f) #endif @@ -1290,6 +1289,8 @@ ParametersG2::ParametersG2(void) ,command_model_acro_y(ACRO_Y_RATE_DEFAULT, ACRO_Y_EXPO_DEFAULT, 0.0f) #endif + ,command_model_pilot(PILOT_Y_RATE_DEFAULT, PILOT_Y_EXPO_DEFAULT, 0.0f) + #if WEATHERVANE_ENABLED ,weathervane() #endif diff --git a/ArduCopter/Parameters.h b/ArduCopter/Parameters.h index 7ba292bc5f..0cf0a8cb51 100644 --- a/ArduCopter/Parameters.h +++ b/ArduCopter/Parameters.h @@ -499,6 +499,11 @@ public: // altitude at which nav control can start in takeoff AP_Float wp_navalt_min; + // unused_integer simply exists so that the constructor for + // ParametersG2 can be created with a relatively easy syntax in + // the face of many #ifs: + uint8_t unused_integer; + // button checking #if HAL_BUTTON_ENABLED AP_Button *button_ptr;