diff --git a/src/main/iidxio-ezusb/iidxio.c b/src/main/iidxio-ezusb/iidxio.c index 681594b..5017bed 100644 --- a/src/main/iidxio-ezusb/iidxio.c +++ b/src/main/iidxio-ezusb/iidxio.c @@ -90,6 +90,15 @@ bool iidx_io_init( void iidx_io_fini(void) { + // Pushing some final state before closing the IO to the actual outputs, e.g. lights on/off + // can be a bit finicky. Do a few polls to "enforce"/flush this final state + for (uint8_t i = 0; i < 5; i++) { + iidx_io_ep1_send(); + iidx_io_ep2_recv(); + + Sleep(10); + } + ezusb_close(iidx_io_ezusb_handle); iidx_io_ezusb_handle = INVALID_HANDLE_VALUE; }