AP_Proximity: fix fallthrough in proximity switch

in the case that cygbot was selected but not compiled in we would try to insantiate a DroneCAN backend
This commit is contained in:
Peter Barker 2023-04-06 08:56:53 +10:00 committed by Peter Barker
parent 95354ac572
commit 4a29a57d8d
4 changed files with 7 additions and 5 deletions

View File

@ -173,8 +173,8 @@ void AP_Proximity::init()
}
break;
case Type::CYGBOT_D1:
#if AP_PROXIMITY_CYGBOT_ENABLED
case Type::CYGBOT_D1:
if (AP_Proximity_Cygbot_D1::detect(serial_instance)) {
state[instance].instance = instance;
drivers[instance] = new AP_Proximity_Cygbot_D1(*this, state[instance], params[instance], serial_instance);

View File

@ -59,7 +59,9 @@ public:
SITL = 10,
AirSimSITL = 12,
#endif
#if AP_PROXIMITY_CYGBOT_ENABLED
CYGBOT_D1 = 13,
#endif
DroneCAN = 14,
};

View File

@ -2,10 +2,6 @@
#include "AP_Proximity.h"
#ifndef AP_PROXIMITY_CYGBOT_ENABLED
#define AP_PROXIMITY_CYGBOT_ENABLED HAL_PROXIMITY_ENABLED
#endif
#if (HAL_PROXIMITY_ENABLED && AP_PROXIMITY_CYGBOT_ENABLED)
#include "AP_Proximity_Backend_Serial.h"

View File

@ -5,3 +5,7 @@
#ifndef HAL_PROXIMITY_ENABLED
#define HAL_PROXIMITY_ENABLED (!HAL_MINIMIZE_FEATURES && BOARD_FLASH_SIZE > 1024)
#endif
#ifndef AP_PROXIMITY_CYGBOT_ENABLED
#define AP_PROXIMITY_CYGBOT_ENABLED HAL_PROXIMITY_ENABLED
#endif