@@ -5276,13 +5276,12 @@ void loop() {
52765276 printToWebClient (" - " );
52775277 printToWebClient_prognrdescaddr ();
52785278 printFmtToWebClient (" \r\n 0x%08X\r\n " , c);
5279- int outBufLen = strlen (outBuf);
5280- bin2hex (outBuf + outBufLen, tx_msg, tx_msg[bus->getLen_idx ()]+bus->getBusType (), ' ' );
5281- printToWebClient (outBuf + outBufLen);
5279+ bin2hex (outBuf, tx_msg, tx_msg[bus->getLen_idx ()]+bus->getBusType (), ' ' );
5280+ printToWebClient (outBuf);
52825281 printToWebClient (" \r\n " );
5283- bin2hex (outBuf + outBufLen , msg, msg[bus->getLen_idx ()]+bus->getBusType (), ' ' );
5284- printToWebClient (outBuf + outBufLen );
5285- outBuf[outBufLen ] = 0 ;
5282+ bin2hex (outBuf, msg, msg[bus->getLen_idx ()]+bus->getBusType (), ' ' );
5283+ printToWebClient (outBuf);
5284+ outBuf[0 ] = 0 ;
52865285 printToWebClient (" \r\n " );
52875286 }
52885287 forcedflushToWebClient (); // browser will build page immediately
@@ -5297,7 +5296,6 @@ void loop() {
52975296 printToWebClient (" \r\n Complete dump:\r\n " );
52985297 c = 0 ;
52995298 unsigned long timeout = 0 ;
5300- int outBufLen = strlen (outBuf);
53015299
53025300 uint32_t cmd_ids[] = {0x053D0001 , 0x053D0064 , 0x05000066 , 0x05000068 , 0x05000069 , 0x06000066 , 0x05000094 , 0x05000095 , 0x05000096 , 0x05000097 };
53035301 for (uint i = 0 ; i<sizeof (cmd_ids)/sizeof (cmd_ids[0 ]); i++) {
@@ -5309,9 +5307,8 @@ void loop() {
53095307 }
53105308 printTelegram (tx_msg, -1 );
53115309 printTelegram (msg, -1 );
5312- outBufLen = strlen (outBuf);
5313- bin2hex (outBuf + outBufLen, msg, msg[bus->getLen_idx ()]+bus->getBusType (), ' ' );
5314- printToWebClient (outBuf + outBufLen);
5310+ bin2hex (outBuf, msg, msg[bus->getLen_idx ()]+bus->getBusType (), ' ' );
5311+ printToWebClient (outBuf);
53155312 printToWebClient (" \r\n " );
53165313 }
53175314 flushToWebClient ();
@@ -5404,13 +5401,12 @@ void loop() {
54045401 }
54055402 }
54065403 if (valid_response) {
5407- outBufLen = strlen (outBuf);
5408- int hex_len = bin2hex (outBuf + outBufLen, msg, msg[bus->getLen_idx ()] + bus->getBusType (), ' ' );
5404+ int hex_len = bin2hex (outBuf, msg, msg[bus->getLen_idx ()] + bus->getBusType (), ' ' );
54095405 if (hex_len == 0 ) {
54105406 printToWebClient (" Invalid telegram received: " );
5411- bin2hex (outBuf + outBufLen , msg, 10 , ' ' ); // Only first 10 bytes printed
5407+ bin2hex (outBuf, msg, 10 , ' ' ); // Only first 10 bytes printed
54125408 }
5413- printToWebClient (outBuf + outBufLen );
5409+ printToWebClient (outBuf);
54145410 } else {
54155411 printToWebClient (" [Timeout] No valid response after retries.\r\n " );
54165412 }
@@ -5441,21 +5437,19 @@ void loop() {
54415437
54425438 int length = msg[bus->getLen_idx ()] + bus->getBusType ();
54435439
5444- outBufLen = strlen (outBuf);
54455440 if (length == 0 || length < 10 ) {
54465441 printToWebClient (" Invalid telegram received: " );
5447- bin2hex (outBuf + outBufLen , msg, 10 , ' ' ); // Only first 10 bytes printed
5448- printToWebClient (outBuf + outBufLen );
5442+ bin2hex (outBuf, msg, 10 , ' ' ); // Only first 10 bytes printed
5443+ printToWebClient (outBuf);
54495444 printToWebClient (" \r\n " );
54505445 } else {
5451- bin2hex (outBuf + outBufLen , msg, length, ' ' );
5452- printToWebClient (outBuf + outBufLen );
5446+ bin2hex (outBuf, msg, length, ' ' );
5447+ printToWebClient (outBuf);
54535448 printToWebClient (" \r\n " );
54545449 }
54555450 flushToWebClient ();
54565451 }
5457- outBufLen = strlen (outBuf);
5458- outBuf[outBufLen] = 0 ;
5452+ outBuf[0 ] = 0 ;
54595453 } else {
54605454 printlnToDebug (" No response to dump request:" );
54615455 bus->print (tx_msg);
0 commit comments