From 4ce69701621469dafdcf34652eb9379c64a738fe Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Sat, 18 Feb 2023 00:51:59 -0600 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20Add=20PANELDUE=20support?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/Configuration.h | 6 + Marlin/src/gcode/gcode.cpp | 4 + Marlin/src/gcode/gcode.h | 5 + Marlin/src/gcode/lcd/M408.cpp | 186 ++++++++++++++++ Marlin/src/gcode/sd/M20.cpp | 53 ++++- Marlin/src/inc/Conditionals-2-LCD.h | 4 +- Marlin/src/inc/SanityCheck.h | 1 + .../src/lcd/extui/paneldue/paneldue_extui.cpp | 199 ++++++++++++++++++ Marlin/src/sd/cardreader.cpp | 50 ++++- Marlin/src/sd/cardreader.h | 9 + buildroot/tests/mega2560 | 19 ++ ini/features.ini | 1 + 12 files changed, 529 insertions(+), 8 deletions(-) create mode 100644 Marlin/src/gcode/lcd/M408.cpp create mode 100644 Marlin/src/lcd/extui/paneldue/paneldue_extui.cpp diff --git a/Marlin/Configuration.h b/Marlin/Configuration.h index 64187f41bfcb0..ec50fc6847c37 100644 --- a/Marlin/Configuration.h +++ b/Marlin/Configuration.h @@ -3249,6 +3249,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 1ccb10753cbcc..2523788e5835d 100644 --- a/Marlin/src/gcode/gcode.cpp +++ b/Marlin/src/gcode/gcode.cpp @@ -870,6 +870,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 421dda9aec0fa..685800fa7aae3 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) @@ -1043,6 +1044,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