async fn control_and_log(class: &mut CdcAcmClass<'static, Driver<'static>>) -> !Expand description
Runs the DTR/RTS state machine and drains the log ring into the host.
Both roles live in one task because the line poll needs &class while
the log flush needs &mut class — a single &mut serves both (dtr()
and rts() take &self).
The future is a select of two branches:
- a deadline-based 10 ms timer that re-checks the control lines (the deadline is only re-armed when the timer actually fired, so log traffic can never starve the esptool reset walk), and
- a log flush that copies one chunk out of the ring and awaits
write_packet. Bytes are only committed after the driver accepted the packet, so a cancelled flush (timer branch won) loses nothing and duplicates nothing.
The flush has no connection gate: before the host has configured us the endpoint is disabled and the write errors out right away (the flush then waits a poll interval instead of spinning, so the timer branch keeps running), and an idle ring waits 10 ms between polls instead of spinning.