@@ -219,34 +219,33 @@ void USBPort::handle()
219219 {
220220 // error, discard data
221221 // display bad msg
222- // if (findhash < (sizeof(cbuf)-100))
223- char errbuf[1024 ];
224- char errbuf2[1024 ];
225- char hexbuf[1024 ];
226- char charbuf[1024 ];
227- int hexlen = 0 ;
228- int charlen = 0 ;
229-
230- for (int i = 0 ; i < m_unprocessedSize && hexlen < (int )sizeof (hexbuf) - 3 ; ++i)
231- {
232- hexlen += snprintf (hexbuf + hexlen, sizeof (hexbuf) - hexlen, " %02X " , (unsigned char )m_inBufferUnprocessed[i]);
233- charlen += snprintf (charbuf + charlen, sizeof (charbuf) - charlen, " %c" , isprint (m_inBufferUnprocessed[i]) ? m_inBufferUnprocessed[i] : ' .' );
234- }
235- snprintf (errbuf,sizeof (errbuf), " %s: Receive ERROR: bad msg format: len= %d %.*s" , m_port_name.c_str (), m_unprocessedSize, 3 *m_unprocessedSize, hexbuf);
236- snprintf (errbuf2,sizeof (errbuf2), " %.*s" , m_unprocessedSize, charbuf);
237- // check for boot messages from ESP32
238- if (charbuf[0 ] == ' :' || charbuf[0 ] == ' D' || charbuf[0 ] == ' d' || charbuf[0 ] == ' e' || charbuf[0 ] == ' S' )
239- {
240- // these are boot messages from ESP32
241- if (m_log) m_log->info (errbuf2, __FILENAME__,__LINE__);
242- if (m_log) m_log->info (errbuf);
243- }
244- else {
245- // unknown messages
246- if (m_log) m_log->error (errbuf2, __FILENAME__,__LINE__);
247- if (m_log) m_log->error (errbuf);
248- }
249- m_unprocessedSize = 0 ;
222+ char errbuf[1024 ];
223+ char errbuf2[1024 ];
224+ char hexbuf[1024 ];
225+ char charbuf[1024 ];
226+ int hexlen = 0 ;
227+ int charlen = 0 ;
228+
229+ for (int i = 0 ; i < m_unprocessedSize && hexlen < (int )sizeof (hexbuf) - 3 ; ++i)
230+ {
231+ hexlen += snprintf (hexbuf + hexlen, sizeof (hexbuf) - hexlen, " %02X " , (unsigned char )m_inBufferUnprocessed[i]);
232+ charlen += snprintf (charbuf + charlen, sizeof (charbuf) - charlen, " %c" , isprint (m_inBufferUnprocessed[i]) ? m_inBufferUnprocessed[i] : ' .' );
233+ }
234+ snprintf (errbuf,sizeof (errbuf), " %s: Receive ERROR: bad msg format: len= %d %.*s" , m_port_name.c_str (), m_unprocessedSize, 3 *m_unprocessedSize, hexbuf);
235+ snprintf (errbuf2,sizeof (errbuf2), " %.*s" , m_unprocessedSize, charbuf);
236+ // check for boot messages from ESP32
237+ if (charbuf[0 ] == ' :' || charbuf[0 ] == ' D' || charbuf[0 ] == ' d' || charbuf[0 ] == ' e' || charbuf[0 ] == ' S' )
238+ {
239+ // these are boot messages from ESP32
240+ if (m_log) m_log->info (errbuf2, __FILENAME__,__LINE__);
241+ if (m_log) m_log->info (errbuf);
242+ }
243+ else {
244+ // unknown messages
245+ if (m_log) m_log->error (errbuf2, __FILENAME__,__LINE__);
246+ if (m_log) m_log->error (errbuf);
247+ }
248+ m_unprocessedSize = 0 ;
250249 }
251250 }
252251 // adjust the data in inbuf
0 commit comments