diff --git a/Marlin/Configuration.h b/Marlin/Configuration.h index 72ec272b4d999..0330b75fbdd33 100644 --- a/Marlin/Configuration.h +++ b/Marlin/Configuration.h @@ -3225,6 +3225,12 @@ // //#define NEXTION_TFT +// +// PanelDue touch controller by Escher3D +// http://escher3d.com/pages/order/products/product2.php +// +//#define PANELDUE + // // Third-party or vendor-customized controller interfaces. // Sources should be installed in 'src/lcd/extui'. diff --git a/Marlin/src/gcode/gcode.cpp b/Marlin/src/gcode/gcode.cpp index 1ff643dc21748..080131b335f7b 100644 --- a/Marlin/src/gcode/gcode.cpp +++ b/Marlin/src/gcode/gcode.cpp @@ -865,6 +865,10 @@ void GcodeSuite::process_parsed_command(const bool no_ok/*=false*/) { case 407: M407(); break; // M407: Display measured filament diameter #endif + #if ENABLED(PANELDUE) + case 408: M408(); break; // M408: Report machine state in JSON format + #endif + #if HAS_FILAMENT_SENSOR case 412: M412(); break; // M412: Enable/Disable filament runout detection #endif diff --git a/Marlin/src/gcode/gcode.h b/Marlin/src/gcode/gcode.h index 8004187903ddb..866549aa03e70 100644 --- a/Marlin/src/gcode/gcode.h +++ b/Marlin/src/gcode/gcode.h @@ -233,6 +233,7 @@ * M405 - Enable Filament Sensor flow control. "M405 D". (Requires FILAMENT_WIDTH_SENSOR) * M406 - Disable Filament Sensor flow control. (Requires FILAMENT_WIDTH_SENSOR) * M407 - Display measured filament diameter in millimeters. (Requires FILAMENT_WIDTH_SENSOR) + * M408 - Report machine state in JSON format. (Requires PANELDUE) * M410 - Quickstop. Abort all planned moves. * M412 - Enable / Disable Filament Runout Detection. (Requires FILAMENT_RUNOUT_SENSOR) * M413 - Enable / Disable Power-Loss Recovery. (Requires POWER_LOSS_RECOVERY) @@ -1034,6 +1035,10 @@ class GcodeSuite { static void M407(); #endif + #if ENABLED(PANELDUE) + static void M408(); + #endif + #if HAS_FILAMENT_SENSOR static void M412(); static void M412_report(const bool forReplay=true); diff --git a/Marlin/src/gcode/lcd/M408.cpp b/Marlin/src/gcode/lcd/M408.cpp new file mode 100644 index 0000000000000..31fadd9b23e2b --- /dev/null +++ b/Marlin/src/gcode/lcd/M408.cpp @@ -0,0 +1,186 @@ +/** + * Marlin 3D Printer Firmware + * Copyright (c) 2022 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 . + * + */ + +#include "../../inc/MarlinConfig.h" + +#if ENABLED(PANELDUE) + +#include "../gcode.h" +#include "../../module/planner.h" +#include "../../module/printcounter.h" +#include "../../module/temperature.h" +#include "../../sd/cardreader.h" +#include "../../lcd/marlinui.h" + +#if ENABLED(LCD_SET_PROGRESS_MANUALLY) + extern uint8_t progress_bar_percent; +#endif + +/** + * M408: Report machine state in JSON format for PanelDue + * + * S