Skip to content

Commit 4a7324c

Browse files
committed
Wait for one second for Serial to open, otherwise proceed with startup.
The purpose of this commit is to ensure that the system runs through initialisation at power-up, even if no one opens a serial connection.
1 parent 70a243a commit 4a7324c

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

examples/opta_opcua_server/opta_opcua_server.ino

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -105,9 +105,8 @@ static PinStatus arduino_opta_digital_read(pin_size_t const pin)
105105
void setup()
106106
{
107107
Serial.begin(115200);
108-
//auto const start = millis();
109-
//for (; !Serial && (millis() - start) < 1000; ) { }
110-
while (!Serial) { }
108+
auto const start = millis();
109+
for (; !Serial && (millis() - start) < 1000; ) { }
111110

112111
#if USE_MODBUS_SENSOR_MD02
113112
RS485.setDelays(MODBUS_PRE_DELAY_BR, MODBUS_POST_DELAY_BR);

0 commit comments

Comments
 (0)