Skip to content

Commit

Permalink
Copter: reorder initialisation of member variables to make -Werror=re…
Browse files Browse the repository at this point in the history
…order work
  • Loading branch information
peterbarker committed Nov 12, 2024
1 parent 8a58642 commit 6ee1d94
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 9 deletions.
19 changes: 10 additions & 9 deletions ArduCopter/Parameters.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand Down
5 changes: 5 additions & 0 deletions ArduCopter/Parameters.h
Original file line number Diff line number Diff line change
Expand Up @@ -499,6 +499,11 @@ class ParametersG2 {
// 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;
Expand Down

0 comments on commit 6ee1d94

Please sign in to comment.