Skip to content

Commit eb8ba21

Browse files
committed
~Destructor fix: free uart only if required
1 parent c6d8ed5 commit eb8ba21

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/BNO055ESP32.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,10 @@ BNO055::~BNO055() {
6262
} catch (std::exception &exc) {
6363
}
6464

65-
// free UART
66-
uart_driver_delete(_uartPort);
65+
if (!_i2cFlag) {
66+
// free UART
67+
uart_driver_delete(_uartPort);
68+
}
6769

6870
#ifndef BNO055_DEBUG_OFF
6971
ESP_LOGD(BNO055_LOG_TAG, "Destroyed");

0 commit comments

Comments
 (0)