MMEdit V5.3.4


Author Message
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 11474
Posted: 08:46am 28 Oct 2025      

For reference this is the code handling this in the latest firmware
           if (Option.SerialConsole == 0 || Option.SerialConsole > 4)
           {
               if (tud_cdc_connected() && (tud_cdc_get_line_state() & 0x01)) //check for CDC enumerated and DTR asserted
               {
                   while (!tud_cdc_write_available()) //Buffer full or other CDC problem
                   {
                       busy_wait_us(250); // USB packets are every 1000mSec so no point checking immediately
                       if (!(tud_cdc_connected() && (tud_cdc_get_line_state() & 0x01))) //recheck for CDC enumerated and DTR asserted
{
                           break; //ignore the character if CDC no longer there
}
                   tud_cdc_write_char(c);
                   if (flush)
                   {
                       tud_cdc_write_flush();
                   }
               }
           }