Skip to content

Commit 1d38f48

Browse files
committed
AP_GPS: correct compilation when blended not compiled in
1 parent 261817c commit 1d38f48

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

libraries/AP_GPS/AP_GPS.cpp

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -429,13 +429,13 @@ void AP_GPS::convert_parameters()
429429

430430
// convert old Blended configuration into a defined backend type
431431
// PARAMETER_CONVERSION - Added: Dec-2024 for 4.6
432-
#if GPS_MAX_INSTANCES > 2
432+
#if AP_GPS_BLENDED_ENABLED
433433
if (_auto_switch == 2) {
434434
if (!params[2].type.configured()) {
435435
params[2].type.set_and_save(GPS_TYPE_BLENDED);
436436
}
437437
}
438-
#endif
438+
#endif // AP_GPS_BLENDED_ENABLED
439439
}
440440

441441
// return number of active GPS sensors. Note that if the first GPS
@@ -1009,16 +1009,18 @@ void AP_GPS::update_instance(uint8_t instance)
10091009
}
10101010

10111011
#if HAL_LOGGING_ENABLED
1012+
#if AP_GPS_BLENDED_ENABLED
10121013
if (type == GPS_TYPE_BLENDED) {
10131014
// Blended backend does its own logging:
10141015
data_should_be_logged = false;
10151016
}
1017+
#endif // AP_GPS_BLENDED_ENABLED
10161018
if (data_should_be_logged && should_log()) {
10171019
Write_GPS(instance);
10181020
}
1019-
#else
1020-
(void)data_should_be_logged;
10211021
#endif
1022+
// sometimes we don't do anything with data_should_be_logged
1023+
(void)data_should_be_logged;
10221024

10231025
#if AP_RTC_ENABLED
10241026
if (state[instance].status >= GPS_OK_FIX_3D) {
@@ -1927,13 +1929,15 @@ bool AP_GPS::pre_arm_checks(char failure_msg[], uint16_t failure_msg_len)
19271929
if (_auto_switch == 2) {
19281930
// ensure there is a blended backend
19291931
bool found = false;
1932+
#if AP_GPS_BLENDED_ENABLED
19301933
for (uint8_t i=0; i<GPS_MAX_INSTANCES; i++) {
19311934
// only care about configured type, not allocated type:
19321935
if (get_type(i) == GPS_TYPE_BLENDED) {
19331936
found = true;
19341937
break;
19351938
}
19361939
}
1940+
#endif // AP_GPS_BLENDED_ENABLED
19371941
if (!found) {
19381942
hal.util->snprintf(failure_msg, failure_msg_len, "GPS_AUTO_SWITCH is blended but no blended backend configured");
19391943
return false;

0 commit comments

Comments
 (0)