AP_CANManager: disable SLCAN when armed
this disables SLCAN if enabled using CAN_SLCAN_CPORT and SERIALn_PROTOCOL=22 when we are armed, to reduce load on the CAN thread from the very inefficient SLCAN processing
This commit is contained in:
parent
5c7a2b6369
commit
57c873d304
@ -511,12 +511,17 @@ inline void SLCAN::CANIface::addByte(const uint8_t byte)
|
|||||||
|
|
||||||
void SLCAN::CANIface::update_slcan_port()
|
void SLCAN::CANIface::update_slcan_port()
|
||||||
{
|
{
|
||||||
|
const bool armed = hal.util->get_soft_armed();
|
||||||
if (_set_by_sermgr) {
|
if (_set_by_sermgr) {
|
||||||
// Once we pick SerialManager path we hold on
|
if (armed && _port != nullptr) {
|
||||||
// to that until reboot
|
// auto-disable when armed
|
||||||
|
_port->lock_port(0, 0);
|
||||||
|
_port = nullptr;
|
||||||
|
_set_by_sermgr = false;
|
||||||
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (_port == nullptr) {
|
if (_port == nullptr && !armed) {
|
||||||
_port = AP::serialmanager().find_serial(AP_SerialManager::SerialProtocol_SLCAN, 0);
|
_port = AP::serialmanager().find_serial(AP_SerialManager::SerialProtocol_SLCAN, 0);
|
||||||
if (_port != nullptr) {
|
if (_port != nullptr) {
|
||||||
_port->lock_port(_serial_lock_key, _serial_lock_key);
|
_port->lock_port(_serial_lock_key, _serial_lock_key);
|
||||||
|
Loading…
Reference in New Issue
Block a user