mirror of
https://github.com/ArduPilot/ardupilot
synced 2025-01-08 17:08:28 -04:00
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
501d0d8759
commit
ca0cd9a7e8
@ -133,7 +133,7 @@ const AP_Param::GroupInfo SIM::var_info[] = {
|
|||||||
// @Param: CAN_TYPE1
|
// @Param: CAN_TYPE1
|
||||||
// @DisplayName: transport type for first CAN interface
|
// @DisplayName: transport type for first CAN interface
|
||||||
// @Description: transport type for first CAN interface
|
// @Description: transport type for first CAN interface
|
||||||
// @Values: 0:MulticastUDP,1:SocketCAN
|
// @Values: 0:None,1:MulticastUDP,2:SocketCAN
|
||||||
// @User: Advanced
|
// @User: Advanced
|
||||||
AP_GROUPINFO("CAN_TYPE1", 30, SIM, can_transport[0], uint8_t(CANTransport::MulticastUDP)),
|
AP_GROUPINFO("CAN_TYPE1", 30, SIM, can_transport[0], uint8_t(CANTransport::MulticastUDP)),
|
||||||
#endif
|
#endif
|
||||||
@ -142,7 +142,7 @@ const AP_Param::GroupInfo SIM::var_info[] = {
|
|||||||
// @Param: CAN_TYPE2
|
// @Param: CAN_TYPE2
|
||||||
// @DisplayName: transport type for second CAN interface
|
// @DisplayName: transport type for second CAN interface
|
||||||
// @Description: transport type for second CAN interface
|
// @Description: transport type for second CAN interface
|
||||||
// @Values: 0:MulticastUDP,1:SocketCAN
|
// @Values: 0:None,1:MulticastUDP,2:SocketCAN
|
||||||
// @User: Advanced
|
// @User: Advanced
|
||||||
AP_GROUPINFO("CAN_TYPE2", 31, SIM, can_transport[1], uint8_t(CANTransport::MulticastUDP)),
|
AP_GROUPINFO("CAN_TYPE2", 31, SIM, can_transport[1], uint8_t(CANTransport::MulticastUDP)),
|
||||||
#endif
|
#endif
|
||||||
|
@ -229,8 +229,9 @@ public:
|
|||||||
|
|
||||||
#if HAL_NUM_CAN_IFACES
|
#if HAL_NUM_CAN_IFACES
|
||||||
enum class CANTransport : uint8_t {
|
enum class CANTransport : uint8_t {
|
||||||
MulticastUDP = 0,
|
None = 0,
|
||||||
SocketCAN = 1
|
MulticastUDP = 1,
|
||||||
|
SocketCAN = 2,
|
||||||
};
|
};
|
||||||
AP_Enum<CANTransport> can_transport[HAL_NUM_CAN_IFACES];
|
AP_Enum<CANTransport> can_transport[HAL_NUM_CAN_IFACES];
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
Reference in New Issue
Block a user