Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

M16 - Expected Printer Check #14924

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions Marlin/Configuration_adv.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
*/
Expand Down
4 changes: 4 additions & 0 deletions Marlin/src/gcode/gcode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
5 changes: 5 additions & 0 deletions Marlin/src/gcode/gcode.h
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -472,6 +473,10 @@ class GcodeSuite {
static void M12();
#endif

#if ENABLED(EXPECTED_PRINTER_CHECK)
static void M16();
#endif

static void M17();

static void M18_M84();
Expand Down
40 changes: 40 additions & 0 deletions Marlin/src/gcode/host/M16.cpp
Original file line number Diff line number Diff line change
@@ -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
3 changes: 3 additions & 0 deletions Marlin/src/gcode/parser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
1 change: 1 addition & 0 deletions Marlin/src/lcd/language/language_bg.h
Original file line number Diff line number Diff line change
Expand Up @@ -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("Неправилен принтер")
2 changes: 2 additions & 0 deletions Marlin/src/lcd/language/language_ca.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions Marlin/src/lcd/language/language_cz.h
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
2 changes: 2 additions & 0 deletions Marlin/src/lcd/language/language_da.h
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
2 changes: 2 additions & 0 deletions Marlin/src/lcd/language/language_de.h
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
2 changes: 2 additions & 0 deletions Marlin/src/lcd/language/language_el-gr.h
Original file line number Diff line number Diff line change
Expand Up @@ -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("Εσφαλμένος εκτυπωτής")
2 changes: 2 additions & 0 deletions Marlin/src/lcd/language/language_el.h
Original file line number Diff line number Diff line change
Expand Up @@ -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("Εσφαλμένος εκτυπωτής")
5 changes: 5 additions & 0 deletions Marlin/src/lcd/language/language_en.h
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
2 changes: 2 additions & 0 deletions Marlin/src/lcd/language/language_es.h
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
3 changes: 3 additions & 0 deletions Marlin/src/lcd/language/language_eu.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions Marlin/src/lcd/language/language_fi.h
Original file line number Diff line number Diff line change
Expand Up @@ -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")
2 changes: 2 additions & 0 deletions Marlin/src/lcd/language/language_fr.h
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
2 changes: 2 additions & 0 deletions Marlin/src/lcd/language/language_gl.h
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
2 changes: 2 additions & 0 deletions Marlin/src/lcd/language/language_hr.h
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
2 changes: 2 additions & 0 deletions Marlin/src/lcd/language/language_it.h
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 2 additions & 0 deletions Marlin/src/lcd/language/language_jp-kana.h
Original file line number Diff line number Diff line change
Expand Up @@ -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"
3 changes: 3 additions & 0 deletions Marlin/src/lcd/language/language_ko_KR.h
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
2 changes: 2 additions & 0 deletions Marlin/src/lcd/language/language_nl.h
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
2 changes: 2 additions & 0 deletions Marlin/src/lcd/language/language_pl.h
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
2 changes: 2 additions & 0 deletions Marlin/src/lcd/language/language_pt-br.h
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
2 changes: 2 additions & 0 deletions Marlin/src/lcd/language/language_pt.h
Original file line number Diff line number Diff line change
Expand Up @@ -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")
3 changes: 3 additions & 0 deletions Marlin/src/lcd/language/language_ru.h
Original file line number Diff line number Diff line change
Expand Up @@ -361,6 +361,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("Закончено")
Expand Down
2 changes: 2 additions & 0 deletions Marlin/src/lcd/language/language_sk.h
Original file line number Diff line number Diff line change
Expand Up @@ -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é")
Expand Down
3 changes: 3 additions & 0 deletions Marlin/src/lcd/language/language_tr.h
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
2 changes: 2 additions & 0 deletions Marlin/src/lcd/language/language_uk.h
Original file line number Diff line number Diff line change
Expand Up @@ -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("Завершено")
Expand Down
2 changes: 2 additions & 0 deletions Marlin/src/lcd/language/language_zh_CN.h
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
2 changes: 2 additions & 0 deletions Marlin/src/lcd/language/language_zh_TW.h
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
7 changes: 7 additions & 0 deletions config/default/Configuration_adv.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
*/
Expand Down
7 changes: 7 additions & 0 deletions config/examples/3DFabXYZ/Migbot/Configuration_adv.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
*/
Expand Down
7 changes: 7 additions & 0 deletions config/examples/AlephObjects/TAZ4/Configuration_adv.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
*/
Expand Down
7 changes: 7 additions & 0 deletions config/examples/Alfawise/U20/Configuration_adv.h
Original file line number Diff line number Diff line change
Expand Up @@ -2244,6 +2244,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
*/
Expand Down
7 changes: 7 additions & 0 deletions config/examples/AliExpress/UM2pExt/Configuration_adv.h
Original file line number Diff line number Diff line change
Expand Up @@ -2244,6 +2244,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
*/
Expand Down
Loading