From 2a210661c4dcda28d88ffca2f7e318bddb5c4d8d Mon Sep 17 00:00:00 2001 From: Vladimir Dronnikov Date: Sat, 28 Dec 2019 14:29:01 +0300 Subject: [PATCH] more robust port open for nano --- SourceCode/Linux/main.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/SourceCode/Linux/main.c b/SourceCode/Linux/main.c index b6755a1..cfb78ed 100644 --- a/SourceCode/Linux/main.c +++ b/SourceCode/Linux/main.c @@ -92,6 +92,8 @@ int main(int arg, char *argv[]) return 0; // Open comprt error } printf("Comport open:\n"); + // wait for port to settle + sleep(3); device = atoi(argv[3]); if(device == 0) @@ -187,6 +189,9 @@ void ProcessProgram() int len; unsigned char rx; len = RS232_PollComport(com, &rx, 1); + // do not eat CPU + if (len == 0) usleep(10000); + if(len > 0) { switch(rx)