@@ -780,6 +780,12 @@ bool sendRemoteCommand(const char * commandString)
780780 commandTXBuffer[commandTXHead++] = commandString[x];
781781 commandTXHead %= sizeof (commandTXBuffer);
782782 }
783+ if (settings.debugSerial )
784+ {
785+ systemPrint (" sendRemoteCommand moved " );
786+ systemPrint (commandLength);
787+ systemPrintln (" from commandBuffer into commandTXBuffer" );
788+ }
783789 remoteCommandResponse = false ;
784790 return true ;
785791}
@@ -812,8 +818,20 @@ void checkCommand()
812818 char * commandString;
813819 int index;
814820 int prefixLength;
821+ PrinterEndpoints responseDestination;
822+ uint16_t responseLength;
815823 bool success;
816824
825+ // Save previous index
826+ if (settings.debugSerial )
827+ {
828+ responseDestination = printerEndpoint;
829+ if (responseDestination == PRINT_TO_SERIAL)
830+ responseLength = txHead;
831+ else
832+ responseLength = commandTXHead;
833+ }
834+
817835 // Zero terminate the string
818836 success = false ;
819837 commandBuffer[commandLength] = 0 ;
@@ -860,6 +878,28 @@ void checkCommand()
860878 systemPrintln (" ERROR" );
861879 commandComplete (false );
862880 }
881+
882+ // Display the response
883+ printerEndpoint = PRINT_TO_SERIAL;
884+ if (settings.debugSerial )
885+ {
886+ uint16_t tail;
887+ tail = responseLength;
888+ if (responseDestination == PRINT_TO_SERIAL)
889+ {
890+ responseLength = (txHead + sizeof (serialTransmitBuffer) - responseLength) % sizeof (serialTransmitBuffer);
891+ systemPrint (" checkCommand placed " );
892+ systemPrint (responseLength);
893+ systemPrintln (" command response bytes into serialTransmitBuffer" );
894+ }
895+ else
896+ {
897+ responseLength = (commandTXHead + sizeof (commandTXBuffer) - responseLength) % sizeof (commandTXBuffer);
898+ systemPrint (" checkCommand placed " );
899+ systemPrint (responseLength);
900+ systemPrintln (" command response bytes into commandTXBuffer" );
901+ }
902+ }
863903 outputSerialData (true );
864904 petWDT ();
865905
@@ -911,6 +951,17 @@ char * trimCommand()
911951 int index;
912952 int j;
913953
954+ // Remove the comment
955+ for (index = 0 ; index < commandLength; index++)
956+ {
957+ if (commandBuffer[index] == ' #' )
958+ {
959+ commandBuffer[index] = 0 ;
960+ commandLength = index;
961+ break ;
962+ }
963+ }
964+
914965 // Remove the white space
915966 for (index = 0 ; index < commandLength; index++)
916967 {
0 commit comments