Browse Source

Merge pull request #432 from PavelSindler/invalid_gcodes

invalid / unknown gcodes reported on serial
XPila 7 years ago
parent
commit
556205d993
1 changed files with 13 additions and 4 deletions
  1. 13 4
      Firmware/Marlin_main.cpp

+ 13 - 4
Firmware/Marlin_main.cpp

@@ -3851,7 +3851,10 @@ void process_commands()
 		eeprom_update_byte((unsigned char *)EEPROM_FARM_MODE, farm_mode);
 		lcd_update(2);
 		break;
-
+	default:
+		printf("Unknown G code: ");
+		printf(cmdbuffer + bufindr + CMDHDRSIZE);
+		printf("\n");
 
 
 
@@ -3868,7 +3871,10 @@ void process_commands()
 	   
 	 /*for (++strchr_pointer; *strchr_pointer == ' ' || *strchr_pointer == '\t'; ++strchr_pointer);*/
 	  if (*(strchr_pointer+index) < '0' || *(strchr_pointer+index) > '9') {
-		  SERIAL_ECHOLNPGM("Invalid M code");
+		  printf("Invalid M code: ");
+		  printf(cmdbuffer + bufindr + CMDHDRSIZE);
+		  printf("\n");
+
 	  } else
     switch((int)code_value())
     {
@@ -5948,7 +5954,7 @@ case 404:  //M404 Enter the nominal filament width (3mm, 1.75mm ) N<3.0> or disp
 		if(lcd_commands_type == 0)	lcd_commands_type = LCD_COMMAND_LONG_PAUSE_RESUME;
 	}
 	break;
-            
+
 #ifdef LIN_ADVANCE
     case 900: // M900: Set LIN_ADVANCE options.
         gcode_M900();
@@ -6169,7 +6175,10 @@ case 404:  //M404 Enter the nominal filament width (3mm, 1.75mm ) N<3.0> or disp
       gcode_LastN = Stopped_gcode_LastN;
       FlushSerialRequestResend();
     break;
-	default: SERIAL_ECHOLNPGM("Invalid M code.");
+	default: 
+		printf("Unknown M code: ");
+		printf(cmdbuffer + bufindr + CMDHDRSIZE);
+		printf("\n");
     }
 	
   } // end if(code_seen('M')) (end of M codes)