mirror of https://github.com/ArduPilot/ardupilot
AP_HAL_SITL: allow disabling CAN interfaces
Also corrects an issue where setting an invalid type could result in undefined behavior.
This commit is contained in:
parent
ca0cd9a7e8
commit
1c54dd9e5d
|
@ -224,6 +224,10 @@ bool CANIface::init(const uint32_t bitrate, const OperatingMode mode)
|
||||||
transport = NEW_NOTHROW CAN_SocketCAN();
|
transport = NEW_NOTHROW CAN_SocketCAN();
|
||||||
#endif
|
#endif
|
||||||
break;
|
break;
|
||||||
|
case SITL::SIM::CANTransport::None:
|
||||||
|
default: // if user supplies an invalid value for the parameter
|
||||||
|
transport = nullptr;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
if (transport == nullptr) {
|
if (transport == nullptr) {
|
||||||
return false;
|
return false;
|
||||||
|
|
Loading…
Reference in New Issue