From 363f1348e294347151ec54dace3618c57b10a64e Mon Sep 17 00:00:00 2001 From: TOKITA Hiroshi Date: Mon, 21 Aug 2023 20:15:38 +0900 Subject: [PATCH] zephyrSerial: Fix misdetection arduino_serial1 DT_NODE_EXISTS value is true even if the status is disabled, so it caused misdetection. Use DT_NODE_HAS_STATUS to detect the status of the arduino_serial1 node is ok. --- cores/arduino/zephyrSerial.cpp | 2 +- cores/arduino/zephyrSerial.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/cores/arduino/zephyrSerial.cpp b/cores/arduino/zephyrSerial.cpp index f9d79f1c..d2568267 100644 --- a/cores/arduino/zephyrSerial.cpp +++ b/cores/arduino/zephyrSerial.cpp @@ -186,7 +186,7 @@ arduino::ZephyrSerial Serial(DEVICE_DT_GET(DT_PHANDLE_BY_IDX(DT_PATH(zephyr_user DT_FOREACH_PROP_ELEM(DT_PATH(zephyr_user), serials, DECLARE_SERIAL_N) #endif // PROP_LEN(serials) > 1 -#elif DT_NODE_EXISTS(DT_NODELABEL(arduino_serial)) +#elif DT_NODE_HAS_STATUS(DT_NODELABEL(arduino_serial), okay) /* If serials node is not defined, tries to use arduino_serial */ arduino::ZephyrSerial Serial(DEVICE_DT_GET(DT_NODELABEL(arduino_serial))); #else diff --git a/cores/arduino/zephyrSerial.h b/cores/arduino/zephyrSerial.h index 72703504..b62e54f6 100644 --- a/cores/arduino/zephyrSerial.h +++ b/cores/arduino/zephyrSerial.h @@ -92,7 +92,7 @@ DT_FOREACH_PROP_ELEM(DT_PATH(zephyr_user), serials, DECLARE_EXTERN_SERIAL_N) #undef EXTERN_SERIAL_N #undef SERIAL_DEFINED_0 #endif -#elif DT_NODE_EXISTS(DT_NODELABEL(arduino_serial)) +#elif DT_NODE_HAS_STATUS(DT_NODELABEL(arduino_serial), okay) extern arduino::ZephyrSerial Serial; #else extern arduino::ZephyrSerialStub Serial;