diff --git a/Marlin/src/lcd/language/language_en.h b/Marlin/src/lcd/language/language_en.h index 8e912da352..feb24d3f6f 100644 --- a/Marlin/src/lcd/language/language_en.h +++ b/Marlin/src/lcd/language/language_en.h @@ -427,7 +427,7 @@ namespace Language_en { PROGMEM Language_Str MSG_PAUSE_PRINT = _UxGT("Pause Print"); PROGMEM Language_Str MSG_RESUME_PRINT = _UxGT("Resume Print"); PROGMEM Language_Str MSG_STOP_PRINT = _UxGT("Stop Print"); - PROGMEM Language_Str MSG_OBJECT_CANCEL = _UxGT("Cancel Object"); + PROGMEM Language_Str MSG_CANCEL_OBJECT = _UxGT("Cancel Object"); PROGMEM Language_Str MSG_OUTAGE_RECOVERY = _UxGT("Outage Recovery"); PROGMEM Language_Str MSG_MEDIA_MENU = _UxGT("Print from Media"); PROGMEM Language_Str MSG_NO_MEDIA = _UxGT("No Media"); diff --git a/Marlin/src/lcd/menu/menu.cpp b/Marlin/src/lcd/menu/menu.cpp index eac5b7b2d7..3c300843e0 100644 --- a/Marlin/src/lcd/menu/menu.cpp +++ b/Marlin/src/lcd/menu/menu.cpp @@ -25,7 +25,6 @@ #if HAS_LCD_MENU #include "menu.h" -#include "../ultralcd.h" #include "../../module/planner.h" #include "../../module/motion.h" #include "../../module/printcounter.h" diff --git a/Marlin/src/lcd/menu/menu.h b/Marlin/src/lcd/menu/menu.h index 175e8a8435..3fe14f45fe 100644 --- a/Marlin/src/lcd/menu/menu.h +++ b/Marlin/src/lcd/menu/menu.h @@ -365,12 +365,6 @@ class MenuItem_bool { ++_thisItemNr; \ } while(0) -#define MENU_ITEM_ADDON_START(X) do{ \ - if (ui.should_draw() && _menuLineNr == _thisItemNr - 1) { \ - SETCURSOR(X, _lcdLineNr) - -#define MENU_ITEM_ADDON_END() } }while(0) - #define STATIC_ITEM(LABEL, V...) STATIC_ITEM_P(GET_TEXT(LABEL), ##V) #define MENU_ITEM_P(TYPE, PLABEL, V...) _MENU_ITEM_P(TYPE, false, PLABEL, ##V) diff --git a/Marlin/src/lcd/menu/menu_addon.h b/Marlin/src/lcd/menu/menu_addon.h new file mode 100644 index 0000000000..e7553293a1 --- /dev/null +++ b/Marlin/src/lcd/menu/menu_addon.h @@ -0,0 +1,33 @@ +/** + * 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 . + * + */ +#pragma once + +#include "../lcdprint.h" +#if HAS_GRAPHICAL_LCD + #include "../dogm/ultralcd_DOGM.h" +#endif + +#define MENU_ITEM_ADDON_START(X) do{ \ + if (ui.should_draw() && _menuLineNr == _thisItemNr - 1) { \ + SETCURSOR(X, _lcdLineNr) + +#define MENU_ITEM_ADDON_END() } }while(0) diff --git a/Marlin/src/lcd/menu/menu_advanced.cpp b/Marlin/src/lcd/menu/menu_advanced.cpp index d5e8524e55..2f4e37d125 100644 --- a/Marlin/src/lcd/menu/menu_advanced.cpp +++ b/Marlin/src/lcd/menu/menu_advanced.cpp @@ -654,7 +654,7 @@ void menu_advanced_settings() { #endif #if ENABLED(CANCEL_OBJECTS) - SUBMENU(MSG_CANCELOBJECTS, [](){ editable.int8 = -1; goto_screen(menu_cancelobject); }); + SUBMENU(MSG_CANCEL_OBJECT, [](){ editable.int8 = -1; ui.goto_screen(menu_cancelobject); }); #endif #if ENABLED(DAC_STEPPER_CURRENT) diff --git a/Marlin/src/lcd/menu/menu_cancelobject.cpp b/Marlin/src/lcd/menu/menu_cancelobject.cpp index 215854b708..09b1bc55e5 100644 --- a/Marlin/src/lcd/menu/menu_cancelobject.cpp +++ b/Marlin/src/lcd/menu/menu_cancelobject.cpp @@ -29,6 +29,7 @@ #if HAS_LCD_MENU && ENABLED(CANCEL_OBJECTS) #include "menu.h" +#include "menu_addon.h" #include "../../feature/cancel_object.h" @@ -39,15 +40,15 @@ // void menu_cancelobject() { START_MENU(); - MENU_BACK(MSG_MAIN); + BACK_ITEM(MSG_MAIN); - GCODES_ITEM(MSG_OBJECT_CANCEL, PSTR("M486 C")); + GCODES_ITEM(MSG_CANCEL_OBJECT, PSTR("M486 C")); // Draw cancelable items in a loop for (int8_t i = 0; i < cancelable.object_count; i++) { if (!TEST(cancelable.canceled, i)) { editable.int8 = i; - ACTION_ITEM(MSG_OBJECT_CANCEL, [](){ + ACTION_ITEM(MSG_CANCEL_OBJECT, [](){ cancelable.cancel_object(editable.int8); ui.quick_feedback(); }); @@ -58,7 +59,7 @@ void menu_cancelobject() { } /* - MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(int3, MSG_OBJECT_CANCEL, &editable.int8, -1, 32, [](){ + MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(int3, MSG_CANCEL_OBJECT, &editable.int8, -1, 32, [](){ if (editable.int8 > -1) { cancelable.cancel_object(editable.int8); ui.quick_feedback(); diff --git a/Marlin/src/lcd/menu/menu_mixer.cpp b/Marlin/src/lcd/menu/menu_mixer.cpp index 430d2886fc..52348980df 100644 --- a/Marlin/src/lcd/menu/menu_mixer.cpp +++ b/Marlin/src/lcd/menu/menu_mixer.cpp @@ -29,11 +29,9 @@ #if HAS_LCD_MENU && ENABLED(MIXING_EXTRUDER) #include "menu.h" -#include "../../feature/mixing.h" +#include "menu_addon.h" -#include "../dogm/ultralcd_DOGM.h" -#include "../ultralcd.h" -#include "../lcdprint.h" +#include "../../feature/mixing.h" #define CHANNEL_MIX_EDITING !DUAL_MIXING_EXTRUDER diff --git a/Marlin/src/lcd/menu/menu_motion.cpp b/Marlin/src/lcd/menu/menu_motion.cpp index d37d304bb4..4f44a1143e 100644 --- a/Marlin/src/lcd/menu/menu_motion.cpp +++ b/Marlin/src/lcd/menu/menu_motion.cpp @@ -29,12 +29,7 @@ #if HAS_LCD_MENU #include "menu.h" - -#include "../lcdprint.h" - -#if HAS_GRAPHICAL_LCD - #include "../dogm/ultralcd_DOGM.h" -#endif +#include "menu_addon.h" #include "../../module/motion.h"