From bce8103cac6ce4d511b9c161c26797c10b3e970b Mon Sep 17 00:00:00 2001 From: Baldanos Date: Thu, 23 Jan 2025 22:16:47 +0100 Subject: [PATCH] Active polling of Ardulink device --- minichlink/ardulink.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/minichlink/ardulink.c b/minichlink/ardulink.c index 24819c13..b7d37b66 100644 --- a/minichlink/ardulink.c +++ b/minichlink/ardulink.c @@ -103,15 +103,18 @@ int ArdulinkSetupInterface( void * dev ) // Let the bootloader do its thing. MCF.DelayUS(dev, 3UL*1000UL*1000UL); + serial_dev_write(&((ardulink_ctx_t*)dev)->serial, "?", 1); + if (serial_dev_read(&((ardulink_ctx_t*)dev)->serial, &first, 1) == -1) { perror("read"); return -1; } - if (first != '!') { + if (first != '!' && first != '+') { fprintf(stderr, "Ardulink: not the sync character.\n"); return -1; } + serial_dev_flush_rx(&((ardulink_ctx_t*)dev)->serial); return 0; }