small refactoring

This commit is contained in:
merlokk 2017-10-13 13:13:13 +03:00
commit 1abc4144ee

View file

@ -271,15 +271,17 @@ int main(int argc, char* argv[]) {
set_my_executable_path(); set_my_executable_path();
// open uart // open uart
if (!waitCOMPort) {
sp = uart_open(argv[1]);
} else {
int openCount = 0; int openCount = 0;
do { do {
sp = uart_open(argv[1]); sp = uart_open(argv[1]);
if (sp != INVALID_SERIAL_PORT && sp != CLAIMED_SERIAL_PORT)
break;
msleep(1000); msleep(1000);
printf("."); printf(".");
} while(waitCOMPort && (++openCount < 20)); } while(++openCount < 20 && (sp == INVALID_SERIAL_PORT || sp == CLAIMED_SERIAL_PORT));
printf("\n"); printf("\n");
}
// check result of uart opening // check result of uart opening
if (sp == INVALID_SERIAL_PORT) { if (sp == INVALID_SERIAL_PORT) {