Skip to content

Commit 600429a

Browse files
committed
Cancel Objects followup
1 parent e690471 commit 600429a

8 files changed

+43
-23
lines changed

Marlin/src/lcd/language/language_en.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -427,7 +427,7 @@ namespace Language_en {
427427
PROGMEM Language_Str MSG_PAUSE_PRINT = _UxGT("Pause Print");
428428
PROGMEM Language_Str MSG_RESUME_PRINT = _UxGT("Resume Print");
429429
PROGMEM Language_Str MSG_STOP_PRINT = _UxGT("Stop Print");
430-
PROGMEM Language_Str MSG_OBJECT_CANCEL = _UxGT("Cancel Object");
430+
PROGMEM Language_Str MSG_CANCEL_OBJECT = _UxGT("Cancel Object");
431431
PROGMEM Language_Str MSG_OUTAGE_RECOVERY = _UxGT("Outage Recovery");
432432
PROGMEM Language_Str MSG_MEDIA_MENU = _UxGT("Print from Media");
433433
PROGMEM Language_Str MSG_NO_MEDIA = _UxGT("No Media");

Marlin/src/lcd/menu/menu.cpp

-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@
2525
#if HAS_LCD_MENU
2626

2727
#include "menu.h"
28-
#include "../ultralcd.h"
2928
#include "../../module/planner.h"
3029
#include "../../module/motion.h"
3130
#include "../../module/printcounter.h"

Marlin/src/lcd/menu/menu.h

-6
Original file line numberDiff line numberDiff line change
@@ -365,12 +365,6 @@ class MenuItem_bool {
365365
++_thisItemNr; \
366366
} while(0)
367367

368-
#define MENU_ITEM_ADDON_START(X) do{ \
369-
if (ui.should_draw() && _menuLineNr == _thisItemNr - 1) { \
370-
SETCURSOR(X, _lcdLineNr)
371-
372-
#define MENU_ITEM_ADDON_END() } }while(0)
373-
374368
#define STATIC_ITEM(LABEL, V...) STATIC_ITEM_P(GET_TEXT(LABEL), ##V)
375369

376370
#define MENU_ITEM_P(TYPE, PLABEL, V...) _MENU_ITEM_P(TYPE, false, PLABEL, ##V)

Marlin/src/lcd/menu/menu_addon.h

+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
/**
2+
* Marlin 3D Printer Firmware
3+
* Copyright (c) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
4+
*
5+
* Based on Sprinter and grbl.
6+
* Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
7+
*
8+
* This program is free software: you can redistribute it and/or modify
9+
* it under the terms of the GNU General Public License as published by
10+
* the Free Software Foundation, either version 3 of the License, or
11+
* (at your option) any later version.
12+
*
13+
* This program is distributed in the hope that it will be useful,
14+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
15+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16+
* GNU General Public License for more details.
17+
*
18+
* You should have received a copy of the GNU General Public License
19+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
20+
*
21+
*/
22+
#pragma once
23+
24+
#include "../lcdprint.h"
25+
#if HAS_GRAPHICAL_LCD
26+
#include "../dogm/ultralcd_DOGM.h"
27+
#endif
28+
29+
#define MENU_ITEM_ADDON_START(X) do{ \
30+
if (ui.should_draw() && _menuLineNr == _thisItemNr - 1) { \
31+
SETCURSOR(X, _lcdLineNr)
32+
33+
#define MENU_ITEM_ADDON_END() } }while(0)

Marlin/src/lcd/menu/menu_advanced.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -654,7 +654,7 @@ void menu_advanced_settings() {
654654
#endif
655655

656656
#if ENABLED(CANCEL_OBJECTS)
657-
SUBMENU(MSG_CANCELOBJECTS, [](){ editable.int8 = -1; goto_screen(menu_cancelobject); });
657+
SUBMENU(MSG_CANCEL_OBJECT, [](){ editable.int8 = -1; ui.goto_screen(menu_cancelobject); });
658658
#endif
659659

660660
#if ENABLED(DAC_STEPPER_CURRENT)

Marlin/src/lcd/menu/menu_cancelobject.cpp

+5-4
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
#if HAS_LCD_MENU && ENABLED(CANCEL_OBJECTS)
3030

3131
#include "menu.h"
32+
#include "menu_addon.h"
3233

3334
#include "../../feature/cancel_object.h"
3435

@@ -39,15 +40,15 @@
3940
//
4041
void menu_cancelobject() {
4142
START_MENU();
42-
MENU_BACK(MSG_MAIN);
43+
BACK_ITEM(MSG_MAIN);
4344

44-
GCODES_ITEM(MSG_OBJECT_CANCEL, PSTR("M486 C"));
45+
GCODES_ITEM(MSG_CANCEL_OBJECT, PSTR("M486 C"));
4546

4647
// Draw cancelable items in a loop
4748
for (int8_t i = 0; i < cancelable.object_count; i++) {
4849
if (!TEST(cancelable.canceled, i)) {
4950
editable.int8 = i;
50-
ACTION_ITEM(MSG_OBJECT_CANCEL, [](){
51+
ACTION_ITEM(MSG_CANCEL_OBJECT, [](){
5152
cancelable.cancel_object(editable.int8);
5253
ui.quick_feedback();
5354
});
@@ -58,7 +59,7 @@ void menu_cancelobject() {
5859
}
5960

6061
/*
61-
MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(int3, MSG_OBJECT_CANCEL, &editable.int8, -1, 32, [](){
62+
MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(int3, MSG_CANCEL_OBJECT, &editable.int8, -1, 32, [](){
6263
if (editable.int8 > -1) {
6364
cancelable.cancel_object(editable.int8);
6465
ui.quick_feedback();

Marlin/src/lcd/menu/menu_mixer.cpp

+2-4
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,9 @@
2929
#if HAS_LCD_MENU && ENABLED(MIXING_EXTRUDER)
3030

3131
#include "menu.h"
32-
#include "../../feature/mixing.h"
32+
#include "menu_addon.h"
3333

34-
#include "../dogm/ultralcd_DOGM.h"
35-
#include "../ultralcd.h"
36-
#include "../lcdprint.h"
34+
#include "../../feature/mixing.h"
3735

3836
#define CHANNEL_MIX_EDITING !DUAL_MIXING_EXTRUDER
3937

Marlin/src/lcd/menu/menu_motion.cpp

+1-6
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,7 @@
2929
#if HAS_LCD_MENU
3030

3131
#include "menu.h"
32-
33-
#include "../lcdprint.h"
34-
35-
#if HAS_GRAPHICAL_LCD
36-
#include "../dogm/ultralcd_DOGM.h"
37-
#endif
32+
#include "menu_addon.h"
3833

3934
#include "../../module/motion.h"
4035

0 commit comments

Comments
 (0)