MarlinUI support for up to 5 Material Presets (#18488)

- Add `I` preset parameter to `G26`, `M106`, `M140`, and `M190`.
- Extend menu items to permit a string interpolation.
- Keep material names in a list and interpolate in menu items.
- Extend material presets to support up to 5 predefined materials.

Co-authored-by: Scott Lahteine <thinkyhead@users.noreply.github.com>
This commit is contained in:
Giuliano Zaro
2020-07-09 10:11:57 +02:00
committed by GitHub
parent abc5c93986
commit b0c6cfb051
51 changed files with 1179 additions and 870 deletions

View File

@@ -86,10 +86,6 @@ MarlinUI ui;
}
#endif
#if PREHEAT_COUNT
preheat_t MarlinUI::material_preset[PREHEAT_COUNT]; // Initialized by settings.load()
#endif
#if HAS_SPI_LCD
#if HAS_GRAPHICAL_LCD
@@ -153,6 +149,33 @@ millis_t MarlinUI::next_button_update_ms; // = 0
volatile int8_t encoderDiff; // Updated in update_buttons, added to encoderPosition every LCD update
#endif
#if PREHEAT_COUNT
preheat_t MarlinUI::material_preset[PREHEAT_COUNT]; // Initialized by settings.load()
PGM_P MarlinUI::get_preheat_label(const uint8_t m) {
#ifdef PREHEAT_1_LABEL
static PGMSTR(preheat_0_label, PREHEAT_1_LABEL);
#endif
#ifdef PREHEAT_2_LABEL
static PGMSTR(preheat_1_label, PREHEAT_2_LABEL);
#endif
#ifdef PREHEAT_3_LABEL
static PGMSTR(preheat_2_label, PREHEAT_3_LABEL);
#endif
#ifdef PREHEAT_4_LABEL
static PGMSTR(preheat_3_label, PREHEAT_4_LABEL);
#endif
#ifdef PREHEAT_5_LABEL
static PGMSTR(preheat_4_label, PREHEAT_5_LABEL);
#endif
#define _PLBL(N) preheat_##N##_label,
static PGM_P const preheat_labels[PREHEAT_COUNT] PROGMEM = { REPEAT(PREHEAT_COUNT, _PLBL) };
return (PGM_P)pgm_read_ptr(&preheat_labels[m]);
}
#endif
#if ENABLED(SDSUPPORT)
#include "../sd/cardreader.h"