M16 - Expected Printer Check (#14924)
This commit is contained in:
		
				
					committed by
					
						 Scott Lahteine
						Scott Lahteine
					
				
			
			
				
	
			
			
			
						parent
						
							a26b57a36d
						
					
				
				
					commit
					0fbb26c28f
				
			| @@ -2242,6 +2242,13 @@ | ||||
|  */ | ||||
| #define EXTENDED_CAPABILITIES_REPORT | ||||
|  | ||||
| /** | ||||
|  * Expected Printer Check | ||||
|  * Add the M16 G-code to compare a string to the MACHINE_NAME. | ||||
|  * M16 with a non-matching string causes the printer to halt. | ||||
|  */ | ||||
| //#define EXPECTED_PRINTER_CHECK | ||||
|  | ||||
| /** | ||||
|  * Disable all Volumetric extrusion options | ||||
|  */ | ||||
|   | ||||
| @@ -342,6 +342,10 @@ void GcodeSuite::process_parsed_command(const bool no_ok/*=false*/) { | ||||
|         case 12: M12(); break;                                    // M12: Synchronize and optionally force a CLC set | ||||
|       #endif | ||||
|  | ||||
|       #if ENABLED(EXPECTED_PRINTER_CHECK) | ||||
|         case 16: M16(); break;                                    // M16: Expected printer check | ||||
|       #endif | ||||
|  | ||||
|       case 17: M17(); break;                                      // M17: Enable all stepper motors | ||||
|  | ||||
|       #if ENABLED(SDSUPPORT) | ||||
|   | ||||
| @@ -83,6 +83,7 @@ | ||||
|  * M8   - Turn flood coolant ON. (Requires COOLANT_CONTROL) | ||||
|  * M9   - Turn coolant OFF. (Requires COOLANT_CONTROL) | ||||
|  * M12  - Set up closed loop control system. (Requires EXTERNAL_CLOSED_LOOP_CONTROLLER) | ||||
|  * M16  - Expected printer check. (Requires EXPECTED_PRINTER_CHECK) | ||||
|  * M17  - Enable/Power all stepper motors | ||||
|  * M18  - Disable all stepper motors; same as M84 | ||||
|  * M20  - List SD card. (Requires SDSUPPORT) | ||||
| @@ -472,6 +473,10 @@ private: | ||||
|     static void M12(); | ||||
|   #endif | ||||
|  | ||||
|   #if ENABLED(EXPECTED_PRINTER_CHECK) | ||||
|     static void M16(); | ||||
|   #endif | ||||
|  | ||||
|   static void M17(); | ||||
|  | ||||
|   static void M18_M84(); | ||||
|   | ||||
							
								
								
									
										40
									
								
								Marlin/src/gcode/host/M16.cpp
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										40
									
								
								Marlin/src/gcode/host/M16.cpp
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,40 @@ | ||||
| /** | ||||
|  * Marlin 3D Printer Firmware | ||||
|  * Copyright (c) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] | ||||
|  * | ||||
|  * Based on Sprinter and grbl. | ||||
|  * Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm | ||||
|  * | ||||
|  * This program is free software: you can redistribute it and/or modify | ||||
|  * it under the terms of the GNU General Public License as published by | ||||
|  * the Free Software Foundation, either version 3 of the License, or | ||||
|  * (at your option) any later version. | ||||
|  * | ||||
|  * This program is distributed in the hope that it will be useful, | ||||
|  * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||
|  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the | ||||
|  * GNU General Public License for more details. | ||||
|  * | ||||
|  * You should have received a copy of the GNU General Public License | ||||
|  * along with this program.  If not, see <http://www.gnu.org/licenses/>. | ||||
|  * | ||||
|  */ | ||||
|  | ||||
| #include "../../inc/MarlinConfigPre.h" | ||||
|  | ||||
| #if ENABLED(EXPECTED_PRINTER_CHECK) | ||||
|  | ||||
| #include "../gcode.h" | ||||
| #include "../../Marlin.h" | ||||
|  | ||||
| /** | ||||
|  * M16: Expected Printer Check | ||||
|  */ | ||||
| void GcodeSuite::M16() { | ||||
|  | ||||
|   if (strcmp_P(parser.string_arg, PSTR(MACHINE_NAME))) | ||||
|     kill(PSTR(MSG_EXPECTED_PRINTER)); | ||||
|  | ||||
| } | ||||
|  | ||||
| #endif | ||||
| @@ -225,6 +225,9 @@ void GCodeParser::parse(char *p) { | ||||
|       case 810: case 811: case 812: case 813: case 814: | ||||
|       case 815: case 816: case 817: case 818: case 819: | ||||
|     #endif | ||||
|     #if ENABLED(EXPECTED_PRINTER_CHECK) | ||||
|       case 16: | ||||
|     #endif | ||||
|     case 23: case 28: case 30: case 117: case 118: case 928: string_arg = p; return; | ||||
|     default: break; | ||||
|   } | ||||
|   | ||||
| @@ -144,3 +144,4 @@ | ||||
| #define MSG_DELTA_CALIBRATE_Y               _UxGT("Калибровка Y") | ||||
| #define MSG_DELTA_CALIBRATE_Z               _UxGT("Калибровка Z") | ||||
| #define MSG_DELTA_CALIBRATE_CENTER          _UxGT("Калибровка Център") | ||||
| #define MSG_EXPECTED_PRINTER                _UxGT("Неправилен принтер") | ||||
|   | ||||
| @@ -231,6 +231,8 @@ | ||||
| #define MSG_DAC_EEPROM_WRITE                _UxGT("DAC EEPROM Write") | ||||
| #define MSG_FILAMENT_CHANGE_OPTION_RESUME   _UxGT("Repren impressió") | ||||
|  | ||||
| #define MSG_EXPECTED_PRINTER                _UxGT("Impressora incorrecta") | ||||
|  | ||||
| // | ||||
| // Filament Change screens show up to 3 lines on a 4-line display | ||||
| //                        ...or up to 2 lines on a 3-line display | ||||
|   | ||||
| @@ -495,6 +495,8 @@ | ||||
| #define MSG_SNAKE                           _UxGT("Sn4k3") | ||||
| #define MSG_MAZE                            _UxGT("Bludiště") | ||||
|  | ||||
| #define MSG_EXPECTED_PRINTER                _UxGT("Nesprávná tiskárna") | ||||
|  | ||||
| #if LCD_HEIGHT >= 4 | ||||
|   // Up to 3 lines allowed | ||||
|   #define MSG_ADVANCED_PAUSE_WAITING_1      _UxGT("Stikněte tlačítko") | ||||
|   | ||||
| @@ -229,6 +229,8 @@ | ||||
|  | ||||
| #define MSG_FILAMENT_CHANGE_OPTION_RESUME   _UxGT("Forsæt print") | ||||
|  | ||||
| #define MSG_EXPECTED_PRINTER                _UxGT("Forkert printer") | ||||
|  | ||||
| #if LCD_HEIGHT >= 4 | ||||
|   #define MSG_FILAMENT_CHANGE_INIT_1          _UxGT("Vent på start") | ||||
|   #define MSG_FILAMENT_CHANGE_INIT_2          _UxGT("af filament") | ||||
|   | ||||
| @@ -409,6 +409,8 @@ | ||||
| #define MSG_CASE_LIGHT                      _UxGT("Beleuchtung") | ||||
| #define MSG_CASE_LIGHT_BRIGHTNESS           _UxGT("Helligkeit") | ||||
|  | ||||
| #define MSG_EXPECTED_PRINTER                _UxGT("Falscher Drucker") | ||||
|  | ||||
| #if LCD_WIDTH >= 20 | ||||
|   #define MSG_INFO_PRINT_COUNT              _UxGT("Gesamte Drucke") | ||||
|   #define MSG_INFO_COMPLETED_PRINTS         _UxGT("Komplette Drucke") | ||||
|   | ||||
| @@ -185,3 +185,5 @@ | ||||
| #define MSG_DELTA_CALIBRATE_Y               _UxGT("Βαθμονόμηση Y") | ||||
| #define MSG_DELTA_CALIBRATE_Z               _UxGT("Βαθμονόμηση Z") | ||||
| #define MSG_DELTA_CALIBRATE_CENTER          _UxGT("Βαθμονόμηση κέντρου") | ||||
|  | ||||
| #define MSG_EXPECTED_PRINTER                _UxGT("Εσφαλμένος εκτυπωτής") | ||||
|   | ||||
| @@ -186,3 +186,5 @@ | ||||
| #define MSG_DELTA_CALIBRATE_Y               _UxGT("Βαθμονόμηση Y") | ||||
| #define MSG_DELTA_CALIBRATE_Z               _UxGT("Βαθμονόμηση Z") | ||||
| #define MSG_DELTA_CALIBRATE_CENTER          _UxGT("Βαθμονόμηση κέντρου") | ||||
|  | ||||
| #define MSG_EXPECTED_PRINTER                _UxGT("Εσφαλμένος εκτυπωτής") | ||||
|   | ||||
| @@ -1164,6 +1164,11 @@ | ||||
| #ifndef MSG_CASE_LIGHT_BRIGHTNESS | ||||
|   #define MSG_CASE_LIGHT_BRIGHTNESS           _UxGT("Light Brightness") | ||||
| #endif | ||||
|  | ||||
| #ifndef MSG_EXPECTED_PRINTER | ||||
|   #define MSG_EXPECTED_PRINTER                 _UxGT("INCORRECT PRINTER") | ||||
| #endif | ||||
|  | ||||
| #if LCD_WIDTH >= 20 | ||||
|   #ifndef MSG_INFO_PRINT_COUNT | ||||
|     #define MSG_INFO_PRINT_COUNT              _UxGT("Print Count") | ||||
|   | ||||
| @@ -204,6 +204,8 @@ | ||||
| #define MSG_INFO_PROTOCOL                   _UxGT("Protocolo") | ||||
| #define MSG_CASE_LIGHT                      _UxGT("Luz cabina") | ||||
|  | ||||
| #define MSG_EXPECTED_PRINTER                _UxGT("Impresora incorrecta") | ||||
|  | ||||
| #if LCD_WIDTH >= 20 | ||||
|   #define MSG_INFO_PRINT_COUNT              _UxGT("Conteo de impresión") | ||||
|   #define MSG_INFO_COMPLETED_PRINTS         _UxGT("Completadas") | ||||
|   | ||||
| @@ -354,6 +354,9 @@ | ||||
| #define MSG_ERR_HOMING_FAILED               _UxGT("Hasi. huts egin du") | ||||
| #define MSG_ERR_PROBING_FAILED              _UxGT("Neurketak huts egin du") | ||||
| #define MSG_M600_TOO_COLD                   _UxGT("M600: hotzegi") | ||||
|  | ||||
| #define MSG_EXPECTED_PRINTER                _UxGT("Inprimagailu okerra") | ||||
|  | ||||
| // | ||||
| // Filament Change screens show up to 3 lines on a 4-line display | ||||
| //                        ...or up to 2 lines on a 3-line display | ||||
|   | ||||
| @@ -168,3 +168,5 @@ | ||||
| #define MSG_DELTA_CALIBRATE_Y               _UxGT("Kalibroi Y") | ||||
| #define MSG_DELTA_CALIBRATE_Z               _UxGT("Kalibroi Z") | ||||
| #define MSG_DELTA_CALIBRATE_CENTER          _UxGT("Kalibroi Center") | ||||
|  | ||||
| #define MSG_EXPECTED_PRINTER                _UxGT("Väärä tulostin") | ||||
|   | ||||
| @@ -409,6 +409,8 @@ | ||||
| #define MSG_CASE_LIGHT                      _UxGT("Lumière caisson") | ||||
| #define MSG_CASE_LIGHT_BRIGHTNESS           _UxGT("Luminosité") | ||||
|  | ||||
| #define MSG_EXPECTED_PRINTER                _UxGT("Imprimante incorrecte") | ||||
|  | ||||
| #if LCD_WIDTH >= 20 | ||||
|   #define MSG_INFO_PRINT_COUNT              _UxGT("Nbre impressions") | ||||
|   #define MSG_INFO_COMPLETED_PRINTS         _UxGT("Terminées") | ||||
|   | ||||
| @@ -225,6 +225,8 @@ | ||||
|  | ||||
| #define MSG_FILAMENT_CHANGE_OPTION_RESUME   _UxGT("Segue traballo") | ||||
|  | ||||
| #define MSG_EXPECTED_PRINTER                _UxGT("Impresora incorrecta") | ||||
|  | ||||
| #if LCD_HEIGHT >= 4 | ||||
|   // Up to 3 lines allowed | ||||
|   #define MSG_FILAMENT_CHANGE_INIT_1          _UxGT("Agarde para") | ||||
|   | ||||
| @@ -204,6 +204,8 @@ | ||||
| #define MSG_INFO_PROTOCOL                   _UxGT("Protokol") | ||||
| #define MSG_CASE_LIGHT                      _UxGT("Osvjetljenje") | ||||
|  | ||||
| #define MSG_EXPECTED_PRINTER                _UxGT("Neispravan pisač") | ||||
|  | ||||
| #if LCD_WIDTH >= 20 | ||||
|   #define MSG_INFO_PRINT_COUNT              _UxGT("Broj printova") | ||||
|   #define MSG_INFO_COMPLETED_PRINTS         _UxGT("Završeni") | ||||
|   | ||||
| @@ -494,6 +494,8 @@ | ||||
| #define MSG_SNAKE                           _UxGT("Sn4k3") | ||||
| #define MSG_MAZE                            _UxGT("Maze") | ||||
|  | ||||
| #define MSG_EXPECTED_PRINTER                _UxGT("Stampante errata") | ||||
|  | ||||
| // | ||||
| // Le schermate di Cambio Filamento possono visualizzare fino a 3 linee su un display a 4 righe | ||||
| //                                                  ...o fino a 2 linee su un display a 3 righe. | ||||
|   | ||||
| @@ -219,3 +219,5 @@ | ||||
| #define MSG_FILAMENT_CHANGE_LOAD_2          _UxGT("シバラクオマチクダサイ")            // "filament load" | ||||
| #define MSG_FILAMENT_CHANGE_RESUME_1        _UxGT("プリントヲサイカイシマス")           // "Wait for print" | ||||
| #define MSG_FILAMENT_CHANGE_RESUME_2        _UxGT("シバラクオマチクダサイ")            // "to resume" | ||||
|  | ||||
| #define MSG_EXPECTED_PRINTER                _UxGT("間違ったプリンター")               // "Wrong printer" | ||||
|   | ||||
| @@ -346,6 +346,9 @@ | ||||
| //#define MSG_INFO_PROTOCOL                 _UxGT("Protocol") | ||||
| //#define MSG_CASE_LIGHT                    _UxGT("Case light") | ||||
| //#define MSG_CASE_LIGHT_BRIGHTNESS         _UxGT("Light Brightness") | ||||
|  | ||||
| #define MSG_EXPECTED_PRINTER                _UxGT("잘못된 프린터") | ||||
|  | ||||
| #if LCD_WIDTH >= 20 | ||||
|   //#define MSG_INFO_PRINT_COUNT            _UxGT("Print Count") | ||||
|   //#define MSG_INFO_COMPLETED_PRINTS       _UxGT("Completed") | ||||
|   | ||||
| @@ -216,6 +216,8 @@ | ||||
| #define MSG_INFO_PROTOCOL                   _UxGT("Protocol") | ||||
| #define MSG_CASE_LIGHT                      _UxGT("Case licht") | ||||
|  | ||||
| #define MSG_EXPECTED_PRINTER                _UxGT("Onjuiste printer") | ||||
|  | ||||
| #if LCD_WIDTH >= 20 | ||||
|   #define MSG_INFO_PRINT_COUNT              _UxGT("Printed Aantal") | ||||
|   #define MSG_INFO_COMPLETED_PRINTS         _UxGT("Totaal Voltooid") | ||||
|   | ||||
| @@ -204,6 +204,8 @@ | ||||
| #define MSG_INFO_PROTOCOL                   _UxGT("Protokół") | ||||
| #define MSG_CASE_LIGHT                      _UxGT("Oświetlenie") | ||||
|  | ||||
| #define MSG_EXPECTED_PRINTER                _UxGT("Niepoprawna drukarka") | ||||
|  | ||||
| #if LCD_WIDTH >= 20 | ||||
|   #define MSG_INFO_PRINT_COUNT              _UxGT("Wydrukowano") | ||||
|   #define MSG_INFO_COMPLETED_PRINTS         _UxGT("Ukończono") | ||||
|   | ||||
| @@ -366,6 +366,8 @@ | ||||
| #define MSG_CASE_LIGHT                      _UxGT("Luz da Impressora") | ||||
| #define MSG_CASE_LIGHT_BRIGHTNESS           _UxGT("Intensidade Brilho") | ||||
|  | ||||
| #define MSG_EXPECTED_PRINTER                _UxGT("Impressora Incorreta") | ||||
|  | ||||
| #if LCD_WIDTH >= 20 | ||||
|   #define MSG_INFO_PRINT_COUNT              _UxGT("Total de Impressões") | ||||
|   #define MSG_INFO_COMPLETED_PRINTS         _UxGT("Realizadas") | ||||
|   | ||||
| @@ -185,3 +185,5 @@ | ||||
| #define MSG_DELTA_CALIBRATE_CENTER          _UxGT("Calibrar Centro") | ||||
|  | ||||
| #define MSG_LCD_ENDSTOPS                    _UxGT("Fim de curso") | ||||
|  | ||||
| #define MSG_EXPECTED_PRINTER                _UxGT("Impressora Incorreta") | ||||
|   | ||||
| @@ -372,6 +372,9 @@ | ||||
| #define MSG_INFO_PROTOCOL                   _UxGT("Протокол") | ||||
| #define MSG_CASE_LIGHT                      _UxGT("Подсветка корпуса") | ||||
| #define MSG_CASE_LIGHT_BRIGHTNESS           _UxGT("Яркость подсветки") | ||||
|  | ||||
| #define MSG_EXPECTED_PRINTER                _UxGT("Неверный принтер") | ||||
|  | ||||
| #if LCD_WIDTH >= 20 | ||||
|   #define MSG_INFO_PRINT_COUNT              _UxGT("Счётчик печати") | ||||
|   #define MSG_INFO_COMPLETED_PRINTS         _UxGT("Закончено") | ||||
|   | ||||
| @@ -415,6 +415,8 @@ | ||||
| #define MSG_CASE_LIGHT                      _UxGT("Osvetlenie") | ||||
| #define MSG_CASE_LIGHT_BRIGHTNESS           _UxGT("Jas svetla") | ||||
|  | ||||
| #define MSG_EXPECTED_PRINTER                _UxGT("Nesprávna tlačiareň") | ||||
|  | ||||
| #if LCD_WIDTH >= 20 | ||||
|   #define MSG_INFO_PRINT_COUNT              _UxGT("Počet tlačí") | ||||
|   #define MSG_INFO_COMPLETED_PRINTS         _UxGT("Dokončené") | ||||
|   | ||||
| @@ -362,6 +362,9 @@ | ||||
| #define MSG_INFO_PROTOCOL                   _UxGT("Protokol") | ||||
| #define MSG_CASE_LIGHT                      _UxGT("Aydınlatmayı Aç") | ||||
| #define MSG_CASE_LIGHT_BRIGHTNESS           _UxGT("Aydınlatma Parlaklğı") | ||||
|  | ||||
| #define MSG_EXPECTED_PRINTER                _UxGT("Yanlış Yazıcı") | ||||
|  | ||||
| #if LCD_WIDTH >= 20 | ||||
|   #define MSG_INFO_PRINT_COUNT              _UxGT("Baskı Sayısı") | ||||
|   #define MSG_INFO_COMPLETED_PRINTS         _UxGT("Tamamlanan") | ||||
|   | ||||
| @@ -192,6 +192,8 @@ | ||||
| #define MSG_INFO_PROTOCOL                   _UxGT("Протокол") | ||||
| #define MSG_CASE_LIGHT                      _UxGT("Підсвітка") | ||||
|  | ||||
| #define MSG_EXPECTED_PRINTER                _UxGT("Неправильний принтер") | ||||
|  | ||||
| #if LCD_WIDTH >= 20 | ||||
|   #define MSG_INFO_PRINT_COUNT              _UxGT("К-сть друків") | ||||
|   #define MSG_INFO_COMPLETED_PRINTS         _UxGT("Завершено") | ||||
|   | ||||
| @@ -323,6 +323,8 @@ | ||||
| #define MSG_CASE_LIGHT                      _UxGT("外壳灯") // "Case light" | ||||
| #define MSG_CASE_LIGHT_BRIGHTNESS           _UxGT("灯亮度") // "Light BRIGHTNESS" | ||||
|  | ||||
| #define MSG_EXPECTED_PRINTER                _UxGT("打印机不正确") // "The printer is incorrect" | ||||
|  | ||||
| #if LCD_WIDTH >= 20 | ||||
|   #define MSG_INFO_PRINT_COUNT              _UxGT("打印计数")  //"Print Count" | ||||
|   #define MSG_INFO_COMPLETED_PRINTS         _UxGT("完成了")  //"Completed" | ||||
|   | ||||
| @@ -323,6 +323,8 @@ | ||||
| #define MSG_CASE_LIGHT                      _UxGT("外殼燈") // "Case light" | ||||
| #define MSG_CASE_LIGHT_BRIGHTNESS           _UxGT("燈亮度") // "Light BRIGHTNESS" | ||||
|  | ||||
| #define MSG_EXPECTED_PRINTER                _UxGT("打印機不正確") // "The printer is incorrect" | ||||
|  | ||||
| #if LCD_WIDTH >= 20 | ||||
|   #define MSG_INFO_PRINT_COUNT              _UxGT("列印計數")  //"Print Count" | ||||
|   #define MSG_INFO_COMPLETED_PRINTS         _UxGT("已完成")  //"Completed" | ||||
|   | ||||
		Reference in New Issue
	
	Block a user