1
0
mirror of https://github.com/MarlinFirmware/Marlin.git synced 2024-11-23 20:18:52 +00:00

Print progress enhancements (#14647)

This commit is contained in:
Marcio Teixeira 2019-07-17 02:12:39 -06:00 committed by Scott Lahteine
parent ebb1a7dc1f
commit 27c487bab7
13 changed files with 31 additions and 17 deletions

View File

@ -28,6 +28,9 @@
*/
void GcodeSuite::M117() {
ui.set_status(parser.string_arg);
if (parser.string_arg && parser.string_arg[0])
ui.set_status(parser.string_arg);
else
ui.reset_status();
}

View File

@ -22,7 +22,7 @@
#include "../../inc/MarlinConfig.h"
#if ENABLED(LCD_SET_PROGRESS_MANUALLY) && EITHER(EXTENSIBLE_UI, ULTRA_LCD)
#if ENABLED(LCD_SET_PROGRESS_MANUALLY)
#include "../gcode.h"
#include "../../lcd/ultralcd.h"
@ -42,4 +42,4 @@ void GcodeSuite::M73() {
ui.set_progress(parser.value_byte());
}
#endif // LCD_SET_PROGRESS_MANUALLY && (EXTENSIBLE_UI || ULTRA_LCD)
#endif // LCD_SET_PROGRESS_MANUALLY

View File

@ -26,6 +26,7 @@
#include "../gcode.h"
#include "../../sd/cardreader.h"
#include "../../lcd/ultralcd.h"
/**
* M23: Open a file
@ -36,6 +37,10 @@ void GcodeSuite::M23() {
// Simplify3D includes the size, so zero out all spaces (#7227)
for (char *fn = parser.string_arg; *fn; ++fn) if (*fn == ' ') *fn = '\0';
card.openFile(parser.string_arg, true);
#if ENABLED(LCD_SET_PROGRESS_MANUALLY)
ui.set_progress(0);
#endif
}
#endif // SDSUPPORT

View File

@ -125,7 +125,7 @@ void GcodeSuite::M109() {
print_job_timer.start();
#endif
#if EITHER(ULTRA_LCD, EXTENSIBLE_UI)
#if HAS_DISPLAY
if (thermalManager.isHeatingHotend(target_extruder) || !no_wait_for_cooling)
thermalManager.set_heating_message(target_extruder);
#endif

View File

@ -204,6 +204,10 @@ void MarlinUI::goto_screen(screenFunc_t screen, const uint16_t encoder/*=0*/, co
lcd_z_fade_height = planner.z_fade_height;
#endif
#if ENABLED(LCD_SET_PROGRESS_MANUALLY)
progress_reset();
#endif
#if BOTH(DOUBLECLICK_FOR_Z_BABYSTEPPING, BABYSTEPPING)
static millis_t doubleclick_expire_ms = 0;
// Going to menu_main from status screen? Remember first click time.

View File

@ -1522,13 +1522,15 @@ void MarlinUI::update() {
uint8_t MarlinUI::get_progress() {
#if ENABLED(LCD_SET_PROGRESS_MANUALLY)
uint8_t &progress = progress_bar_percent;
#define _PLIMIT(P) ((P) & 0x7F)
#else
#define _PLIMIT(P) P
uint8_t progress = 0;
#endif
#if ENABLED(SDSUPPORT)
if (IS_SD_PRINTING()) progress = card.percentDone();
#endif
return progress;
return _PLIMIT(progress);
}
#endif

View File

@ -298,6 +298,8 @@ public:
#if ENABLED(LCD_SET_PROGRESS_MANUALLY)
static uint8_t progress_bar_percent;
static void set_progress(const uint8_t progress) { progress_bar_percent = _MIN(progress, 100); }
static void set_progress_done() { set_progress(0x80 + 100); }
static bool progress_reset() { if (progress_bar_percent & 0x80) set_progress(0); }
#endif
static uint8_t get_progress();
#else

View File

@ -51,7 +51,7 @@
#include "../feature/bltouch.h"
#endif
#if EITHER(ULTRA_LCD, EXTENSIBLE_UI)
#if HAS_DISPLAY
#include "../lcd/ultralcd.h"
#endif
@ -1044,7 +1044,7 @@ bool axis_unhomed_error(const bool x/*=true*/, const bool y/*=true*/, const bool
if (zz) SERIAL_CHAR('Z');
SERIAL_ECHOLNPGM(" " MSG_FIRST);
#if EITHER(ULTRA_LCD, EXTENSIBLE_UI)
#if HAS_DISPLAY
ui.status_printf_P(0, PSTR(MSG_HOME " %s%s%s " MSG_FIRST), xx ? MSG_X : "", yy ? MSG_Y : "", zz ? MSG_Z : "");
#endif
return true;

View File

@ -2923,7 +2923,7 @@ void Temperature::isr() {
#endif // AUTO_REPORT_TEMPERATURES
#if EITHER(ULTRA_LCD, EXTENSIBLE_UI)
#if HAS_DISPLAY
void Temperature::set_heating_message(const uint8_t e) {
const bool heating = isHeatingHotend(e);
#if HOTENDS > 1

View File

@ -785,7 +785,7 @@ class Temperature {
#endif
#endif
#if EITHER(ULTRA_LCD, EXTENSIBLE_UI)
#if HAS_DISPLAY
static void set_heating_message(const uint8_t e);
#endif

View File

@ -982,7 +982,7 @@ void tool_change(const uint8_t tmp_extruder, bool no_move/*=false*/) {
singlenozzle_temp[active_extruder] = thermalManager.temp_hotend[0].target;
if (singlenozzle_temp[tmp_extruder] && singlenozzle_temp[tmp_extruder] != singlenozzle_temp[active_extruder]) {
thermalManager.setTargetHotend(singlenozzle_temp[tmp_extruder], 0);
#if EITHER(ULTRA_LCD, EXTENSIBLE_UI)
#if HAS_DISPLAY
thermalManager.set_heating_message(0);
#endif
(void)thermalManager.wait_for_hotend(0, false); // Wait for heating or cooling

View File

@ -1008,18 +1008,16 @@ void CardReader::printingHasFinished() {
#endif
print_job_timer.stop();
if (print_job_timer.duration() > 60) queue.inject_P(PSTR("M31"));
queue.enqueue_now_P(print_job_timer.duration() > 60 ? PSTR("M31") : PSTR("M117"));
#if ENABLED(SDCARD_SORT_ALPHA)
presort();
#endif
#if EITHER(ULTRA_LCD, EXTENSIBLE_UI) && ENABLED(LCD_SET_PROGRESS_MANUALLY)
ui.progress_bar_percent = 0;
#if ENABLED(LCD_SET_PROGRESS_MANUALLY)
ui.set_progress_done();
#endif
ui.reset_status();
#if ENABLED(SD_REPRINT_LAST_SELECTED_FILE)
ui.reselect_last_file();
#endif

View File

@ -31,7 +31,7 @@
#include "Sd2Card_FlashDrive.h"
#if EITHER(ULTRA_LCD, EXTENSIBLE_UI)
#if HAS_DISPLAY
#include "../../lcd/ultralcd.h"
#endif
@ -63,7 +63,7 @@ void Sd2Card::idle() {
SERIAL_ECHOPGM("Starting USB host...");
if (!usb.start()) {
SERIAL_ECHOPGM(" Failed. Retrying in 2s.");
#if EITHER(ULTRA_LCD, EXTENSIBLE_UI)
#if HAS_DISPLAY
LCD_MESSAGEPGM("USB start failed");
#endif
state = USB_HOST_DELAY_INIT;