From d39c4fe62853536b3cafd4129ef470b682194474 Mon Sep 17 00:00:00 2001
From: Kevin O'Connor <kevin@koconnor.net>
Date: Tue, 3 Mar 2020 21:09:52 -0500
Subject: [PATCH] menu: Disable support for "deck" and "card" menu items

Disable support for customizing the main lcd display content via the
menu system.  Advise users to use the new display_data config sections
as a replacement.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
---
 config/example-menu.cfg        |  50 -----
 docs/Config_Changes.md         |   4 +
 klippy/extras/display/menu.cfg | 381 ---------------------------------
 klippy/extras/display/menu.py  |   4 +-
 4 files changed, 6 insertions(+), 433 deletions(-)

diff --git a/config/example-menu.cfg b/config/example-menu.cfg
index 2015bad69..03dff9659 100644
--- a/config/example-menu.cfg
+++ b/config/example-menu.cfg
@@ -9,8 +9,6 @@
 #   input - same like 'command' but has value changing capabilities
 #   list - menu element container, with entry and exit gcode triggers
 #   vsdcard - same as 'list' but will append files from virtual sdcard
-#   deck - special container for custom screens (cards) has entry and exit gcode triggers.
-#   card - special content card for custom screens. Can only be used in 'deck'!
 
 #[menu item1]
 #type: item
@@ -155,51 +153,3 @@
 #
 #   When element name stars with . then menu system will add parent
 #   container config name as prefix to element name (delimited by space)
-
-#[menu infodeck]
-#type: deck
-#name:
-#cursor:
-#width:
-#scroll:
-#enable:
-#enter_gcode
-#leave_gcode
-#longpress_menu:
-#   Entry point to menu container. When this attribute is set then
-#   long press > 0.8s will initiate this menu container if not in edit mode.
-#   The default is disabled. This parameter is optional.
-#items:
-#   It accepts only 'card' elements. You are able to switch between different card screens
-#   by using encoder or up/down buttons.
-#content:
-#   It allows quickly define single card decks by adding content directly to deck.
-#   You have to remove deck item attribute and use named items in content.
-#   The menu functionality will then internally create one card item for this deck.
-#   This is optional.
-
-#[menu card1]
-#type: card
-#name:
-#content:
-#   Card screen content. Each line represents display line.
-#   Quotes can be used in the beginning and end of line.
-#   Rendered elements are available for output formatting as {0}..{x}. It's always string type.
-#   It's possible directly use menu item names in content by leaving items attribute out or empty
-#   and use menu items names directly in content as {msg,xpos|ypos}. The menu functionality will then
-#   internally build a item list and replace names with indexes in content.
-#   This is optional.
-#items:
-#   List of elements in card. Each line represents a single index for content formatting.
-#   It's possible to show multiple elements in one place by separating them with comma on single line.
-#   If first element is integer then timed cycle is used (integer value is cycle time in seconds)
-#   If no integer element then first enabled element is shown.
-#   In cycler multiple elements can be grouped into one postition by separating them with |
-#   This way only simple menu items can be grouped.
-#   Example: 5,prt_time, prt_progress - elements prt_time and prt_progress are switched after 5s
-#   Example: msg,xpos|ypos - elements xpos and ypos are grouped and showed together when msg is disabled.
-#use_cursor:
-#   This attribute accepts static boolean value.
-#   When enabled the menu system uses a cursor instead of blinking to visualize item selection
-#   and edit mode for this card. Cursor and placeholder is always added as item name prefix.
-#   The default is False. This parameter is optional.
diff --git a/docs/Config_Changes.md b/docs/Config_Changes.md
index 9aca674b5..71107462d 100644
--- a/docs/Config_Changes.md
+++ b/docs/Config_Changes.md
@@ -6,6 +6,10 @@ All dates in this document are approximate.
 
 # Changes
 
+20200303: The menu "deck" and "card" options were removed. To
+customize the layout of an lcd screen use the new display_data config
+sections (see config/example-extras.cfg for the details).
+
 20200109:  The bed_mesh module now references the probe's location
 in for the mesh configuration.  As such, some configuration options
 have been renamed to more accurately reflect their intended
diff --git a/klippy/extras/display/menu.cfg b/klippy/extras/display/menu.cfg
index 3d4e90c4e..d9f7906be 100644
--- a/klippy/extras/display/menu.cfg
+++ b/klippy/extras/display/menu.cfg
@@ -639,384 +639,3 @@ scroll: true
 type: command
 name: Dump parameters
 gcode: MENU DO=dump
-
-### info screens ###
-[menu __screen2004_static]
-type: deck
-name: Deck (static)
-longpress_menu: __main
-items: __card2004_static
-
-[menu __screen2004_input]
-type: deck
-name: Deck (input)
-longpress_menu: __main
-items: __card2004_input
-
-[menu __screen1604_static]
-type: deck
-name: Deck (static)
-longpress_menu: __main
-items: __card1604_static
-
-[menu __screen1604_input]
-type: deck
-name: Deck (input)
-longpress_menu: __main
-items: __card1604_input
-
-[menu __screen_test]
-type: deck
-name: Deck (test)
-longpress_menu: __main
-items: __card1, __card2, __card3
-
-### deck cards ###
-
-### special characters for hd44780
-# \x00 - thermometer
-# \x01 - heater_bed
-# \x02 - speed_factor
-# \x03 - clock
-# \x04 - degrees
-# \x05 - usb
-# \x06 - sdcard
-# \x07 - fan
-# \x7e - right arrow
-
-[menu __card2004_static]
-type: card
-name: Card 20x04
-content:
-    "\x00{0:3s}\x04\x7e{1:3s}\x04   {2}"
-    "\x01{3:3s}\x04\x7e{4:3s}\x04   \xa5{8}"
-    "\x07{6}  \x02{5} {7}"
-    "{9}"
-items:
-    __card_hotend0_current
-    __card_hotend0_target
-    __card_zpos
-    __card_hotbed_current
-    __card_hotbed_target
-    __card_frpeed
-    __card_fnspeed
-    5,__card_prt_time, __card_usb_progress, __card_sdcard_progress
-    __card_status
-    __card_msg,__card_xpos|__card_ypos|__card_epos
-
-[menu __card1604_static]
-type: card
-name: Card 16x04
-content:
-    "E{0:3s}/{1:3s} {2}"
-    "B{3:3s}/{4:3s} fr{5}"
-    "fn{6}   {7}"
-    "[{8}] {9}"
-items:
-    __card_hotend0_current
-    __card_hotend0_target
-    __card_zpos
-    __card_hotbed_current
-    __card_hotbed_target
-    __card_frpeed
-    __card_fnspeed
-    5,__card_prt_time_2, __card_usb_progress_2, __card_sdcard_progress_2
-    __card_status_slim
-    __card_msg_slim,__card_xpos|__card_ypos
-
-[menu __card2004_input]
-type: card
-name: Card 20x04
-content:
-    "\x00{0:3s}\x04\x7e{1:3s}\x04   {2}"
-    "\x01{3:3s}\x04\x7e{4:3s}\x04   \xa5{8}"
-    "\x07{6}  \x02{5} {7}"
-    "{9}"
-items:
-    __card_hotend0_current
-    __card_hotend0_target_in
-    __card_zpos
-    __card_hotbed_current
-    __card_hotbed_target_in
-    __card_frpeed_in
-    __card_fnspeed
-    5,__card_prt_time, __card_usb_progress, __card_sdcard_progress
-    __card_status
-    __card_msg,__card_xpos|__card_ypos|__card_epos
-
-[menu __card1604_input]
-type: card
-name: Card 16x04
-content:
-    "E{0:3s}/{1:3s} {2}"
-    "B{3:3s}/{4:3s} fr{5}"
-    "fn{6}   {7}"
-    "[{8}] {9}"
-items:
-    __card_hotend0_current
-    __card_hotend0_target_in
-    __card_zpos
-    __card_hotbed_current
-    __card_hotbed_target_in
-    __card_frpeed_in
-    __card_fnspeed
-    5,__card_prt_time_2, __card_usb_progress_2, __card_sdcard_progress_2
-    __card_status_slim
-    __card_msg,__card_xpos|__card_ypos
-
-[menu __card1]
-type: card
-name: Card 1
-content:
-    "E0:{0:3s}/{1:3s} B:{4:3s}/{5:3s}"
-    "E1:{2:3s}/{3:3s} {6}"
-    "Fr{7}Fn{8} {9}"
-    "{10}"
-
-items:
-    __card_hotend0_current
-    __card_hotend0_target
-    __card_hotend1_current
-    __card_hotend1_target
-    __card_hotbed_current
-    __card_hotbed_target
-    __card_zpos
-    __card_frpeed_in
-    __card_fnspeed_in
-    5,__card_prt_time, __card_usb_progress, __card_sdcard_progress
-    __card_msg
-
-[menu __card2]
-type: card
-name: Card 2
-content:
-    "E:{0:3s}/{1:3s} B:{2:3s}/{3:3s}"
-    "{4}{5}{6}"
-    "Fr{7} {8} T{9}"
-    "{10}"
-items:
-    __card_hotend0_current
-    __card_hotend0_target
-    __card_hotbed_current
-    __card_hotbed_target
-    __card_xpos
-    __card_ypos
-    __card_zpos
-    __card_frpeed_in
-    __card_usb_progress_2, __card_sdcard_progress_2
-    __card_prt_time_2
-    __card_msg
-
-[menu __card3]
-type: card
-name: Card 3
-content:
-    "Example card :)"
-    "Try this menu."
-    "({0})"
-items:
-    __test
-
-### card items ###
-
-[menu __card_hotend0_current]
-type: item
-enable: extruder.is_enabled
-name: "{1:3.0f}"
-parameter: extruder.temperature
-transform: abs()
-
-[menu __card_hotend0_target]
-type: item
-enable: extruder.is_enabled
-name: "{1:3.0f}"
-parameter: extruder.target
-transform: abs()
-
-[menu __card_hotend0_target_in]
-type: input
-enable: extruder.is_enabled
-name: "{1:3.0f}"
-parameter: extruder.target
-transform: abs()
-input_min: 0
-input_max: 250
-input_step: 1
-gcode: M104 T0 S{0:.0f}
-
-[menu __card_hotend1_current]
-type: item
-enable: extruder1.is_enabled
-name: "{1:3.0f}"
-parameter: extruder1.temperature
-transform: abs()
-
-[menu __card_hotend1_target]
-type: item
-enable: extruder1.is_enabled
-name: "{1:3.0f}"
-parameter: extruder1.target
-transform: abs()
-
-[menu __card_hotend1_target_in]
-type: input
-enable: extruder1.is_enabled
-name: "{1:3.0f}"
-parameter: extruder1.target
-transform: abs()
-input_min: 0
-input_max: 250
-input_step: 1
-gcode: M104 T1 S{0:.0f}
-
-[menu __card_hotbed_current]
-type: item
-enable: heater_bed.is_enabled
-name: "{1:3.0f}"
-parameter: heater_bed.temperature
-transform: abs()
-
-[menu __card_hotbed_target]
-type: item
-enable: heater_bed.is_enabled
-name: "{1:3.0f}"
-parameter: heater_bed.target
-transform: abs()
-
-[menu __card_hotbed_target_in]
-type: input
-enable: heater_bed.is_enabled
-name: "{1:3.0f}"
-parameter: heater_bed.target
-transform: abs()
-input_min: 0
-input_max: 250
-input_step: 1
-gcode: M140 S{0:.0f}
-
-[menu __card_zpos]
-type: item
-name: "Z{0:06.2f}"
-parameter: toolhead.zpos
-
-[menu __card_xpos]
-type: item
-name: "X{0:05.1f}{2}"
-parameter: toolhead.xpos, menu.is20xx
-transform:
-    1.choose('',' ')
-
-[menu __card_ypos]
-type: item
-name: "Y{0:05.1f}{2}"
-parameter: toolhead.ypos, menu.is20xx
-transform:
-    1.choose('',' ')
-
-[menu __card_epos]
-type: item
-name: "E{0:05.1f}{2}"
-parameter: toolhead.epos, menu.is20xx
-transform:
-    1.choose('',' ')
-
-[menu __card_frpeed]
-type: item
-name: "{0:4.0%}"
-parameter: gcode.speed_factor
-
-[menu __card_fnspeed]
-type: item
-name: "{0:4.0%}"
-parameter: fan.speed
-
-[menu __card_frpeed_in]
-type: input
-name: "{0:4.0%}"
-parameter: gcode.speed_factor
-transform:
-    map(0,1,0,255)
-input_min: 0
-input_max: 1
-input_step: 0.01
-gcode: M220 S{1:d}
-
-[menu __card_fnspeed_in]
-type: input
-enable: fan.is_enabled
-name: "{0:4.0%}"
-parameter: fan.speed
-transform:
-    map(0,1,0,255)
-input_min: 0
-input_max: 1
-input_step: 0.01
-gcode: M106 S{1:d}
-
-[menu __card_prt_time]
-type: item
-name: "\x03{1:02d}:{2:02d}"
-transform:
-    minutes()
-    seconds()
-parameter: toolhead.printing_time
-
-[menu __card_prt_time_2]
-type: item
-name: "T{1:02d}:{2:02d}"
-transform:
-    minutes()
-    seconds()
-parameter: toolhead.printing_time
-
-[menu __card_usb_progress]
-type: item
-enable: !virtual_sdcard.progress, display.progress
-name: "\x05{0:3.0f}%"
-parameter: display.progress
-
-[menu __card_sdcard_progress]
-type: item
-enable: virtual_sdcard.is_enabled, virtual_sdcard.progress
-name: "\x06{0:3.0f}%"
-parameter: virtual_sdcard.progress
-
-[menu __card_usb_progress_2]
-type: item
-#enable: !virtual_sdcard.progress,display.progress
-name: "pr{0:3.0f}%"
-parameter: display.progress
-
-[menu __card_sdcard_progress_2]
-type: item
-enable: virtual_sdcard.is_enabled, virtual_sdcard.progress
-name: "pr{0:3.0f}%"
-parameter: virtual_sdcard.progress
-
-[menu __card_msg]
-enable: display.message
-type: item
-scroll: true
-width: 20
-name: "{0}"
-parameter: display.message
-
-[menu __card_msg_slim]
-enable: display.message
-type: item
-scroll: true
-width: 12
-name: "{0}"
-parameter: display.message
-
-[menu __card_status]
-type: item
-name: "{0}"
-width: 5
-parameter: toolhead.status
-
-[menu __card_status_slim]
-type: item
-name: "{0}"
-width: 1
-parameter: toolhead.status
diff --git a/klippy/extras/display/menu.py b/klippy/extras/display/menu.py
index c7ac05c1a..139989c92 100644
--- a/klippy/extras/display/menu.py
+++ b/klippy/extras/display/menu.py
@@ -957,8 +957,8 @@ menu_items = {
     'input': MenuInput,
     'list': MenuList,
     'vsdcard': MenuVSDCard,
-    'deck': MenuDeck,
-    'card': MenuCard
+    #'deck': MenuDeck,
+    #'card': MenuCard
 }
 
 MENU_UPDATE_DELAY = .100