Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add multiscreen message with Cont.|Cancel #4817

Merged
merged 2 commits into from
Dec 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 12 additions & 13 deletions Firmware/messages.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ const char MSG_BED_LEVELING_FAILED_POINT_LOW[] PROGMEM_I1 = ISTR("Bed leveling f
const char MSG_BED_SKEW_OFFSET_DETECTION_FITTING_FAILED[] PROGMEM_I1 = ISTR("XYZ calibration failed. Please consult the manual."); ////MSG_BED_SKEW_OFFSET_DETECTION_FITTING_FAILED c=20 r=8
const char MSG_BELT_STATUS[] PROGMEM_I1 = ISTR("Belt status");////MSG_BELT_STATUS c=18
const char MSG_EJECT[] PROGMEM_I1 = ISTR("Eject"); ////MSG_EJECT c=9
const char MSG_CANCEL[] PROGMEM_I1 = ISTR(">Cancel");////MSG_CANCEL c=10
const char MSG_CANCEL[] PROGMEM_I1 = ISTR("Cancel");////MSG_CANCEL c=9
const char MSG_CALIBRATE_Z_AUTO[] PROGMEM_I1 = ISTR("Calibrating Z"); ////MSG_CALIBRATE_Z_AUTO c=20 r=2
const char MSG_CARD_MENU[] PROGMEM_I1 = ISTR("Print from SD"); ////MSG_CARD_MENU c=18
const char MSG_CHECKING_X[] PROGMEM_I1 = ISTR("Checking X axis"); ////MSG_CHECKING_X c=20
Expand Down Expand Up @@ -149,16 +149,15 @@ const char MSG_NONE[] PROGMEM_I1 = ISTR("None"); ////MSG_NONE c=8
const char MSG_WARN[] PROGMEM_I1 = ISTR("Warn"); ////MSG_WARN c=8
const char MSG_STRICT[] PROGMEM_I1 = ISTR("Strict"); ////MSG_STRICT c=8
const char MSG_MODEL[] PROGMEM_I1 = ISTR("Model"); ////MSG_MODEL c=8
const char MSG_GCODE_DIFF_PRINTER_CONTINUE[] PROGMEM_I1 = ISTR("G-code sliced for a different printer type. Continue?"); ////MSG_GCODE_DIFF_PRINTER_CONTINUE c=20 r=3
const char MSG_GCODE_DIFF_PRINTER_CANCELLED[] PROGMEM_I1 =ISTR("G-code sliced for a different printer type. Please re-slice the model again. Print cancelled."); ////MSG_GCODE_DIFF_PRINTER_CANCELLED c=20 r=8
const char MSG_GCODE_NEWER_FIRMWARE_CONTINUE[] PROGMEM_I1 = ISTR("G-code sliced for a newer firmware. Continue?"); ////MSG_GCODE_NEWER_FIRMWARE_CONTINUE c=20 r=3
const char MSG_GCODE_NEWER_FIRMWARE_CANCELLED[] PROGMEM_I1 = ISTR("G-code sliced for a newer firmware. Please update the firmware. Print cancelled."); ////MSG_GCODE_NEWER_FIRMWARE_CANCELLED c=20 r=8
const char MSG_GCODE_DIFF_CONTINUE[] PROGMEM_I1 = ISTR("G-code sliced for a different level. Continue?"); ////MSG_GCODE_DIFF_CONTINUE c=20 r=3
const char MSG_GCODE_DIFF_CANCELLED[] PROGMEM_I1 = ISTR("G-code sliced for a different level. Please re-slice the model again. Print cancelled."); ////MSG_GCODE_DIFF_CANCELLED c=20 r=8
const char MSG_MISSING_FILAMENT_CONTINUE[] PROGMEM_I1 = ISTR("There is no filament loaded. Continue?"); ////MSG_MISSING_FILAMENT_CONTINUE c=20 r=3
const char MSG_MISSING_FILAMENT_CANCELLED[] PROGMEM_I1 = ISTR("There is no filament loaded. Print cancelled."); ////MSG_MISSING_FILAMENT_CANCELLED c=20 r=8
const char MSG_NOZZLE_DIFFERS_CONTINUE[] PROGMEM_I1 = ISTR("Nozzle diameter differs from the G-code. Continue?"); ////MSG_NOZZLE_DIFFERS_CONTINUE c=20 r=3
const char MSG_NOZZLE_DIFFERS_CANCELLED[] PROGMEM_I1 = ISTR("Nozzle diameter differs from the G-code. Please check the value in settings. Print cancelled."); ////MSG_NOZZLE_DIFFERS_CANCELLED c=20 r=8
const char MSG_GCODE_DIFF_PRINTER_CONTINUE[] PROGMEM_I1 = ISTR("G-code sliced for a different printer type."); ////MSG_GCODE_DIFF_PRINTER_CONTINUE c=20 r=3
const char MSG_GCODE_DIFF_PRINTER_CANCELLED[] PROGMEM_I1 =ISTR("G-code sliced for a different printer type. Please re-slice the model again."); ////MSG_GCODE_DIFF_PRINTER_CANCELLED c=20 r=8
const char MSG_GCODE_NEWER_FIRMWARE_CONTINUE[] PROGMEM_I1 = ISTR("G-code sliced for a newer firmware."); ////MSG_GCODE_NEWER_FIRMWARE_CONTINUE c=20 r=3
const char MSG_GCODE_NEWER_FIRMWARE_CANCELLED[] PROGMEM_I1 = ISTR("G-code sliced for a newer firmware. Please update the firmware."); ////MSG_GCODE_NEWER_FIRMWARE_CANCELLED c=20 r=8
const char MSG_GCODE_DIFF_CONTINUE[] PROGMEM_I1 = ISTR("G-code sliced for a different level."); ////MSG_GCODE_DIFF_CONTINUE c=20 r=3
const char MSG_GCODE_DIFF_CANCELLED[] PROGMEM_I1 = ISTR("G-code sliced for a different level. Please re-slice the model again."); ////MSG_GCODE_DIFF_CANCELLED c=20 r=8
const char MSG_MISSING_FILAMENT[] PROGMEM_I1 = ISTR("There is no filament loaded."); ////MSG_MISSING_FILAMENT c=20 r=3
const char MSG_NOZZLE_DIFFERS_CONTINUE[] PROGMEM_I1 = ISTR("Nozzle diameter differs from the G-code."); ////MSG_NOZZLE_DIFFERS_CONTINUE c=20 r=3
const char MSG_NOZZLE_DIFFERS_CANCELLED[] PROGMEM_I1 = ISTR("Nozzle diameter differs from the G-code. Please check the value in settings."); ////MSG_NOZZLE_DIFFERS_CANCELLED c=20 r=8
const char MSG_NOZZLE_DIAMETER[] PROGMEM_I1 = ISTR("Nozzle d."); ////MSG_NOZZLE_DIAMETER c=10
const char MSG_MMU_MODE[] PROGMEM_I1 = ISTR("MMU Mode"); ////MSG_MMU_MODE c=8
const char MSG_SD_CARD[] PROGMEM_I1 = ISTR("SD card"); ////MSG_SD_CARD c=8
Expand Down Expand Up @@ -295,7 +294,7 @@ extern const char MSG_MODE_CHANGE_IN_PROGRESS [] PROGMEM_I1 = ISTR("Mode change
extern const char MSG_COPY_SEL_LANG [] PROGMEM_I1 = ISTR("Copy selected language?"); ////MSG_COPY_SEL_LANG c=20 r=3
extern const char MSG_SHEET_OFFSET [] PROGMEM_I1 = ISTR("Sheet %.7s\nZ offset: %+1.3fmm\n%cContinue\n%cReset"); ////MSG_SHEET_OFFSET c=20 r=4
extern const char MSG_PLEASE_LOAD_PLA [] PROGMEM_I1 = ISTR("Please load filament first."); ////MSG_PLEASE_LOAD_PLA c=20 r=4
extern const char MSG_WIZARD_RERUN [] PROGMEM_I1 = ISTR("Running Wizard will delete current calibration results and start from the beginning. Continue?"); ////MSG_WIZARD_RERUN c=20 r=7
extern const char MSG_WIZARD_RERUN [] PROGMEM_I1 = ISTR("Running Wizard will delete current calibration results and start from the beginning."); ////MSG_WIZARD_RERUN c=20 r=7
extern const char MSG_MMU_INSERT_FILAMENT_FIRST_TUBE [] PROGMEM_I1 = ISTR("Please insert filament into the first tube of the MMU, then press the knob to load it."); ////MSG_MMU_INSERT_FILAMENT_FIRST_TUBE c=20 r=6
extern const char MSG_WIZARD_LOAD_FILAMENT [] PROGMEM_I1 = ISTR("Please insert filament into the extruder, then press the knob to load it."); ////MSG_WIZARD_LOAD_FILAMENT c=20 r=6
extern const char MSG_WIZARD_V2_CAL [] PROGMEM_I1 = ISTR("Now I will calibrate distance between tip of the nozzle and heatbed surface."); ////MSG_WIZARD_V2_CAL c=20 r=8
Expand Down Expand Up @@ -372,7 +371,7 @@ extern const char MSG_SELFTEST_CHECK_HOTEND [] PROGMEM_I1 = ISTR("Checking hoten
extern const char MSG_SELFTEST_CHECK_ALLCORRECT [] PROGMEM_I1 = ISTR("All correct"); ////MSG_SELFTEST_CHECK_ALLCORRECT c=20
extern const char MSG_CALIBRATING_HOME [] PROGMEM_I1 = ISTR("Calibrating home"); ////MSG_CALIBRATING_HOME c=20
extern const char MSG_CHECKING_FILE [] PROGMEM_I1 = ISTR("Checking file"); ////MSG_CHECKING_FILE c=17
extern const char MSG_FILE_INCOMPLETE [] PROGMEM_I1 = ISTR("File incomplete. Continue anyway?"); ////MSG_FILE_INCOMPLETE c=20 r=3
extern const char MSG_FILE_INCOMPLETE [] PROGMEM_I1 = ISTR("File incomplete."); ////MSG_FILE_INCOMPLETE c=20 r=3
extern const char MSG_SD_REMOVED [] PROGMEM_I1 = ISTR("Card removed"); ////MSG_SD_REMOVED c=20
extern const char MSG_NEW_FIRMWARE_AVAILABLE [] PROGMEM_I1 = ISTR("New firmware version available:"); ////MSG_NEW_FIRMWARE_AVAILABLE c=20 r=2
extern const char MSG_NEW_FIRMWARE_PLEASE_UPGRADE [] PROGMEM_I1 = ISTR("Please upgrade."); ////MSG_NEW_FIRMWARE_PLEASE_UPGRADE c=20
Expand Down
3 changes: 1 addition & 2 deletions Firmware/messages.h
Original file line number Diff line number Diff line change
Expand Up @@ -157,8 +157,7 @@ extern const char MSG_GCODE_NEWER_FIRMWARE_CONTINUE[];
extern const char MSG_GCODE_NEWER_FIRMWARE_CANCELLED[];
extern const char MSG_GCODE_DIFF_CONTINUE[];
extern const char MSG_GCODE_DIFF_CANCELLED[];
extern const char MSG_MISSING_FILAMENT_CONTINUE[];
extern const char MSG_MISSING_FILAMENT_CANCELLED[];
extern const char MSG_MISSING_FILAMENT[];
extern const char MSG_NOZZLE_DIFFERS_CONTINUE[];
extern const char MSG_NOZZLE_DIFFERS_CANCELLED[];
extern const char MSG_NOZZLE_DIAMETER[];
Expand Down
20 changes: 16 additions & 4 deletions Firmware/ultralcd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1977,7 +1977,8 @@ void mFilamentItem(uint16_t nTemp, uint16_t nTempBed)
lcd_draw_update = 1;

lcd_clear();
lcd_puts_at_P(0, 3, _T(MSG_CANCEL));
lcd_puts_at_P(0,3, PSTR(">"));
lcd_puts_at_P(1, 3, _T(MSG_CANCEL));

lcd_set_cursor(0, 1);
switch (eFilamentAction)
Expand Down Expand Up @@ -3053,6 +3054,17 @@ uint8_t lcd_show_multiscreen_message_yes_no_and_wait_P(const char *msg, bool all
{
return lcd_show_multiscreen_message_with_choices_and_wait_P(msg, allow_timeouting, default_selection, _T(MSG_YES), _T(MSG_NO), nullptr, 10);
}
//! @brief Show multiple screen message with yes and no possible choices and wait with possible timeout
//! @param msg Message to show. If NULL, do not clear the screen and handle choice selection only.
//! @param allow_timeouting if true, allows time outing of the screen
//! @param default_selection if 0, 'Yes' choice is selected by default, otherwise 'No' choice is preselected
//! @retval 0 cont choice selected by user
//! @retval 1 cancel choice selected by user
//! @retval 0xFF button timeout (only possible if allow_timeouting is true)
uint8_t lcd_show_multiscreen_message_cont_cancel_and_wait_P(const char *msg, bool allow_timeouting, uint8_t default_selection) //currently just max. n*4 + 3 lines supported (set in language header files)
{
return lcd_show_multiscreen_message_with_choices_and_wait_P(msg, allow_timeouting, default_selection, _T(MSG_CONTINUE_SHORT), _T(MSG_CANCEL), nullptr, 10);
}
//! @brief Show a two-choice prompt on the last line of the LCD
//! @param selected Show first choice as selected if true, the second otherwise
//! @param first_choice text caption of first possible choice
Expand Down Expand Up @@ -3628,7 +3640,7 @@ void lcd_v2_calibration() {
if (MMU2::mmu2.Enabled()) {
const uint8_t filament = choose_menu_P(
_T(MSG_SELECT_FILAMENT),
MSG_FILAMENT,(_T(MSG_CANCEL)+1)); //Hack to reuse MSG but strip 1st char off
MSG_FILAMENT,_T(MSG_CANCEL));
if (filament < MMU_FILAMENT_COUNT) {
lay1cal_filament = filament;
} else {
Expand Down Expand Up @@ -3671,7 +3683,7 @@ void lcd_wizard() {
bool result = true;
if (calibration_status_get(CALIBRATION_WIZARD_STEPS)) {
// calibration already performed: ask before clearing the previous status
result = !lcd_show_multiscreen_message_yes_no_and_wait_P(_T(MSG_WIZARD_RERUN), false);
result = !lcd_show_multiscreen_message_cont_cancel_and_wait_P(_T(MSG_WIZARD_RERUN), false);
}
if (result) {
calibration_status_clear(CALIBRATION_WIZARD_STEPS);
Expand Down Expand Up @@ -7124,7 +7136,7 @@ static void menu_action_sdfile(const char* filename)
}

if (!check_file(selected_filename)) {
result = !lcd_show_multiscreen_message_yes_no_and_wait_P(_T(MSG_FILE_INCOMPLETE), false);
result = !lcd_show_multiscreen_message_cont_cancel_and_wait_P(_T(MSG_FILE_INCOMPLETE), false);
lcd_update_enable(true);
}
if (result) {
Expand Down
1 change: 1 addition & 0 deletions Firmware/ultralcd.h
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ extern uint8_t lcd_show_multiscreen_message_with_choices_and_wait_P(
const char * const first_choice, const char * const second_choice, const char * const third_choice = nullptr,
uint8_t second_col = 7);
extern uint8_t lcd_show_multiscreen_message_yes_no_and_wait_P(const char *msg, bool allow_timeouting = true, uint8_t default_selection = LCD_MIDDLE_BUTTON_CHOICE);
extern uint8_t lcd_show_multiscreen_message_cont_cancel_and_wait_P(const char *msg, bool allow_timeouting = true, uint8_t default_selection = LCD_MIDDLE_BUTTON_CHOICE);
// Ask the user to move the Z axis up to the end stoppers and let
// the user confirm that it has been done.

Expand Down
6 changes: 3 additions & 3 deletions Firmware/util.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@ void fCheckModeInit() {
static void render_M862_warnings(const char* warning, const char* strict, uint8_t check)
{
if (check == 1) { // Warning, stop print if user selects 'No'
if (lcd_show_multiscreen_message_yes_no_and_wait_P(warning, true, LCD_LEFT_BUTTON_CHOICE) == LCD_MIDDLE_BUTTON_CHOICE) {
if (lcd_show_multiscreen_message_cont_cancel_and_wait_P(warning, true, LCD_LEFT_BUTTON_CHOICE) == LCD_MIDDLE_BUTTON_CHOICE) {
lcd_print_stop();
}
} else if (check == 2) { // Strict, always stop print
Expand Down Expand Up @@ -385,8 +385,8 @@ bool filament_presence_check() {
}

render_M862_warnings(
_T(MSG_MISSING_FILAMENT_CONTINUE)
,_T(MSG_MISSING_FILAMENT_CANCELLED)
_T(MSG_MISSING_FILAMENT)
,_T(MSG_MISSING_FILAMENT) //Identical messages
,(uint8_t)oCheckFilament
);

Expand Down
41 changes: 14 additions & 27 deletions lang/po/Firmware.pot
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@ msgstr ""
msgid "%s level expected"
msgstr ""

#. MSG_CANCEL c=10
#. MSG_CANCEL c=9
#: ../../Firmware/messages.cpp:22 ../../Firmware/ultralcd.cpp:1986
#: ../../Firmware/ultralcd.cpp:3623
msgid ">Cancel"
msgid "Cancel"
msgstr ""

#. MSG_BABYSTEPPING_Z c=13
Expand Down Expand Up @@ -727,7 +727,7 @@ msgstr ""

#. MSG_FILE_INCOMPLETE c=20 r=3
#: ../../Firmware/messages.cpp:375 ../../Firmware/ultralcd.cpp:7119
msgid "File incomplete. Continue anyway?"
msgid "File incomplete."
msgstr ""

#. MSG_FINISHING_MOVEMENTS c=20
Expand Down Expand Up @@ -778,40 +778,34 @@ msgstr ""

#. MSG_GCODE_DIFF_CONTINUE c=20 r=3
#: ../../Firmware/messages.cpp:156 ../../Firmware/util.cpp:417
msgid "G-code sliced for a different level. Continue?"
msgid "G-code sliced for a different level."
msgstr ""

#. MSG_GCODE_DIFF_CANCELLED c=20 r=8
#: ../../Firmware/messages.cpp:157 ../../Firmware/util.cpp:418
msgid ""
"G-code sliced for a different level. Please re-slice the model again. Print "
"cancelled."
msgid "G-code sliced for a different level. Please re-slice the model again."
msgstr ""

#. MSG_GCODE_DIFF_PRINTER_CONTINUE c=20 r=3
#: ../../Firmware/messages.cpp:152 ../../Firmware/util.cpp:319
#: ../../Firmware/util.cpp:436
msgid "G-code sliced for a different printer type. Continue?"
msgid "G-code sliced for a different printer type."
msgstr ""

#. MSG_GCODE_DIFF_PRINTER_CANCELLED c=20 r=8
#: ../../Firmware/messages.cpp:153 ../../Firmware/util.cpp:320
#: ../../Firmware/util.cpp:437
msgid ""
"G-code sliced for a different printer type. Please re-slice the model again."
" Print cancelled."
msgid "G-code sliced for a different printer type. Please re-slice the model again."
msgstr ""

#. MSG_GCODE_NEWER_FIRMWARE_CONTINUE c=20 r=3
#: ../../Firmware/messages.cpp:154 ../../Firmware/util.cpp:369
msgid "G-code sliced for a newer firmware. Continue?"
msgid "G-code sliced for a newer firmware."
msgstr ""

#. MSG_GCODE_NEWER_FIRMWARE_CANCELLED c=20 r=8
#: ../../Firmware/messages.cpp:155 ../../Firmware/util.cpp:370
msgid ""
"G-code sliced for a newer firmware. Please update the firmware. Print "
"cancelled."
msgid "G-code sliced for a newer firmware. Please update the firmware."
msgstr ""

#. MSG_HW_SETUP c=18
Expand Down Expand Up @@ -1373,14 +1367,12 @@ msgstr ""

#. MSG_NOZZLE_DIFFERS_CONTINUE c=20 r=3
#: ../../Firmware/messages.cpp:160 ../../Firmware/util.cpp:296
msgid "Nozzle diameter differs from the G-code. Continue?"
msgid "Nozzle diameter differs from the G-code."
msgstr ""

#. MSG_NOZZLE_DIFFERS_CANCELLED c=20 r=8
#: ../../Firmware/messages.cpp:161 ../../Firmware/util.cpp:297
msgid ""
"Nozzle diameter differs from the G-code. Please check the value in settings."
" Print cancelled."
msgid "Nozzle diameter differs from the G-code. Please check the value in settings."
msgstr ""

#. MSG_NOZZLE_CNG_COOLDOWN c=20 r=3
Expand Down Expand Up @@ -1828,7 +1820,7 @@ msgstr ""
#: ../../Firmware/messages.cpp:298 ../../Firmware/ultralcd.cpp:3666
msgid ""
"Running Wizard will delete current calibration results and start from the "
"beginning. Continue?"
"beginning."
msgstr ""

#. MSG_SD_CARD c=8
Expand Down Expand Up @@ -2175,14 +2167,9 @@ msgid ""
"chapter)."
msgstr ""

#. MSG_MISSING_FILAMENT_CONTINUE c=20 r=3
#. MSG_MISSING_FILAMENT c=20 r=3
#: ../../Firmware/messages.cpp:158 ../../Firmware/util.cpp:388
msgid "There is no filament loaded. Continue?"
msgstr ""

#. MSG_MISSING_FILAMENT_CANCELLED c=20 r=8
#: ../../Firmware/messages.cpp:159 ../../Firmware/util.cpp:389
msgid "There is no filament loaded. Print cancelled."
msgid "There is no filament loaded."
msgstr ""

#. MSG_FOLLOW_Z_CALIBRATION_FLOW c=20 r=8
Expand Down
Loading
Loading