From 5df7d06a6b8ae99aa2e965b9c603de94cf42f93d Mon Sep 17 00:00:00 2001 From: muramura Date: Thu, 31 Aug 2023 01:14:45 +0900 Subject: [PATCH] AP_Mount: Do not perform unnecessary processing --- libraries/AP_Mount/AP_Mount_Siyi.cpp | 6 ++++-- libraries/AP_Mount/AP_Mount_Viewpro.cpp | 5 +++-- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/libraries/AP_Mount/AP_Mount_Siyi.cpp b/libraries/AP_Mount/AP_Mount_Siyi.cpp index c8e2ae78d2f20b..3f00d1caa03e3a 100644 --- a/libraries/AP_Mount/AP_Mount_Siyi.cpp +++ b/libraries/AP_Mount/AP_Mount_Siyi.cpp @@ -38,9 +38,11 @@ void AP_Mount_Siyi::init() const AP_SerialManager& serial_manager = AP::serialmanager(); _uart = serial_manager.find_serial(AP_SerialManager::SerialProtocol_Gimbal, 0); - if (_uart != nullptr) { - _initialised = true; + if (_uart == nullptr) { + return; } + + _initialised = true; AP_Mount_Backend::init(); } diff --git a/libraries/AP_Mount/AP_Mount_Viewpro.cpp b/libraries/AP_Mount/AP_Mount_Viewpro.cpp index df163889b8f0ed..409d9cc27b4e8a 100644 --- a/libraries/AP_Mount/AP_Mount_Viewpro.cpp +++ b/libraries/AP_Mount/AP_Mount_Viewpro.cpp @@ -34,10 +34,11 @@ void AP_Mount_Viewpro::init() const AP_SerialManager& serial_manager = AP::serialmanager(); _uart = serial_manager.find_serial(AP_SerialManager::SerialProtocol_Gimbal, 0); - if (_uart != nullptr) { - _initialised = true; + if (_uart == nullptr) { + return; } + _initialised = true; AP_Mount_Backend::init(); }