AP_ExternalAHRS: avoid uart owner issue

ensure we own uart before read
This commit is contained in:
Andrew Tridgell 2023-12-07 15:27:16 +11:00
parent da1066124e
commit 2842166b06
2 changed files with 4 additions and 0 deletions

View File

@ -156,6 +156,8 @@ bool AP_ExternalAHRS_InertialLabs::check_uart()
if (!setup_complete) {
return false;
}
// ensure we own the uart
uart->begin(0);
uint32_t n = uart->available();
if (n == 0) {
return false;

View File

@ -208,6 +208,8 @@ bool AP_ExternalAHRS_VectorNav::check_uart()
return false;
}
WITH_SEMAPHORE(state.sem);
// ensure we own the uart
uart->begin(0);
uint32_t n = uart->available();
if (n == 0) {
return false;