Skip to content

Commit

Permalink
AP_Mount: Conditionally define serial_instance to fix unused variab…
Browse files Browse the repository at this point in the history
…le compile error

- Wrapped the definition of `serial_instance` with preprocessor directives to ensure it is only defined when necessary.
- This resolves the compile error caused by the unused variable when no features requiring `serial_instance` are enabled.
  • Loading branch information
mduclehcm committed Jul 23, 2024
1 parent b6adb4c commit b6e614b
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion libraries/AP_Mount/AP_Mount.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ AP_Mount::AP_Mount()
}
_singleton = this;

AP_Param::setup_object_defaults(this, var_info);
AP_Param::setup_object_defaults(this, var_info);
}

// init - detect and initialise all mounts
Expand All @@ -63,8 +63,13 @@ void AP_Mount::init()
// primary is reset to the first instantiated mount
bool primary_set = false;

#if HAL_MOUNT_STORM32SERIAL_ENABLED || \
HAL_MOUNT_SIYI_ENABLED || \
HAL_MOUNT_VIEWPRO_ENABLED || \
HAL_MOUNT_TOPOTEK_ENABLED
// keep track of number of serial instances for initialisation
uint8_t serial_instance = 0;
#endif

// create each instance
for (uint8_t instance=0; instance<AP_MOUNT_MAX_INSTANCES; instance++) {
Expand Down

0 comments on commit b6e614b

Please sign in to comment.