Various fixes for MarlinUI and ExtUI (#12439)
This commit is contained in:
committed by
Scott Lahteine
parent
d3605cfc26
commit
c1e17037e5
@ -94,6 +94,7 @@ static struct {
|
||||
} flags;
|
||||
|
||||
namespace ExtUI {
|
||||
|
||||
#ifdef __SAM3X8E__
|
||||
/**
|
||||
* Implement a special millis() to allow time measurement
|
||||
@ -134,12 +135,7 @@ namespace ExtUI {
|
||||
return (uint32_t)(currTime / (F_CPU / 8000));
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
// TODO: Implement for AVR
|
||||
FORCE_INLINE uint32_t safe_millis() { return millis(); }
|
||||
|
||||
#endif
|
||||
#endif // __SAM3X8E__
|
||||
|
||||
void delay_us(unsigned long us) {
|
||||
DELAY_US(us);
|
||||
@ -287,12 +283,14 @@ namespace ExtUI {
|
||||
}
|
||||
|
||||
void setActiveTool(const extruder_t extruder, bool no_move) {
|
||||
const uint8_t e = extruder - E0;
|
||||
#if DO_SWITCH_EXTRUDER || ENABLED(SWITCHING_NOZZLE) || ENABLED(PARKING_EXTRUDER)
|
||||
if (e != active_extruder)
|
||||
tool_change(e, 0, no_move);
|
||||
#if EXTRUDERS > 1
|
||||
const uint8_t e = extruder - E0;
|
||||
#if DO_SWITCH_EXTRUDER || ENABLED(SWITCHING_NOZZLE) || ENABLED(PARKING_EXTRUDER)
|
||||
if (e != active_extruder)
|
||||
tool_change(e, 0, no_move);
|
||||
#endif
|
||||
active_extruder = e;
|
||||
#endif
|
||||
active_extruder = e;
|
||||
}
|
||||
|
||||
extruder_t getActiveTool() {
|
||||
@ -533,24 +531,26 @@ namespace ExtUI {
|
||||
|
||||
float getFeedrate_percent() { return feedrate_percentage; }
|
||||
|
||||
void enqueueCommands(progmem_str gcode) {
|
||||
enqueue_and_echo_commands_P((PGM_P)gcode);
|
||||
void enqueueCommands_P(PGM_P const gcode) {
|
||||
enqueue_and_echo_commands_P(gcode);
|
||||
}
|
||||
|
||||
bool isAxisPositionKnown(const axis_t axis) {
|
||||
return TEST(axis_known_position, axis);
|
||||
}
|
||||
|
||||
progmem_str getFirmwareName_str() {
|
||||
return F("Marlin " SHORT_BUILD_VERSION);
|
||||
PGM_P getFirmwareName_str() {
|
||||
static const char firmware_name[] PROGMEM = "Marlin " SHORT_BUILD_VERSION;
|
||||
return firmware_name;
|
||||
}
|
||||
|
||||
void setTargetTemp_celsius(float value, const heater_t heater) {
|
||||
#if HAS_HEATED_BED
|
||||
if (heater == BED)
|
||||
thermalManager.setTargetBed(clamp(value,0,200));
|
||||
if (heater == BED)
|
||||
thermalManager.setTargetBed(clamp(value,0,200));
|
||||
else
|
||||
#endif
|
||||
thermalManager.setTargetHotend(clamp(value,0,500), heater - H0);
|
||||
thermalManager.setTargetHotend(clamp(value,0,500), heater - H0);
|
||||
}
|
||||
|
||||
void setTargetTemp_celsius(float value, const extruder_t extruder) {
|
||||
@ -579,7 +579,7 @@ namespace ExtUI {
|
||||
}
|
||||
|
||||
bool isPrinting() {
|
||||
return (planner.movesplanned() || IS_SD_PRINTING() || isPrintingFromMedia());
|
||||
return (planner.movesplanned() || isPrintingFromMedia() || IFSD(IS_SD_PRINTING(), false));
|
||||
}
|
||||
|
||||
bool isMediaInserted() {
|
||||
@ -593,19 +593,20 @@ namespace ExtUI {
|
||||
#if ENABLED(PARK_HEAD_ON_PAUSE)
|
||||
enqueue_and_echo_commands_P(PSTR("M125"));
|
||||
#endif
|
||||
ExtUI::onStatusChanged(PSTR(MSG_PRINT_PAUSED));
|
||||
ui.set_status_P(PSTR(MSG_PRINT_PAUSED));
|
||||
#endif
|
||||
}
|
||||
|
||||
void resumePrint() {
|
||||
#if ENABLED(SDSUPPORT)
|
||||
ui.set_status_P(PSTR(MSG_FILAMENT_CHANGE_RESUME_1));
|
||||
#if ENABLED(PARK_HEAD_ON_PAUSE)
|
||||
wait_for_heatup = wait_for_user = false;
|
||||
enqueue_and_echo_commands_P(PSTR("M24"));
|
||||
#else
|
||||
card.startFileprint();
|
||||
print_job_timer.start();
|
||||
#endif
|
||||
ExtUI::onStatusChanged(PSTR(MSG_PRINTING));
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -613,7 +614,7 @@ namespace ExtUI {
|
||||
#if ENABLED(SDSUPPORT)
|
||||
wait_for_heatup = wait_for_user = false;
|
||||
card.flag.abort_sd_printing = true;
|
||||
ExtUI::onStatusChanged(PSTR(MSG_PRINT_ABORTED));
|
||||
ui.set_status_P(PSTR(MSG_PRINT_ABORTED));
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -621,7 +622,7 @@ namespace ExtUI {
|
||||
|
||||
void FileList::refresh() { num_files = 0xFFFF; }
|
||||
|
||||
bool FileList::seek(uint16_t pos, bool skip_range_check) {
|
||||
bool FileList::seek(const uint16_t pos, const bool skip_range_check) {
|
||||
#if ENABLED(SDSUPPORT)
|
||||
if (!skip_range_check && pos > (count() - 1)) return false;
|
||||
const uint16_t nr =
|
||||
@ -632,6 +633,8 @@ namespace ExtUI {
|
||||
|
||||
card.getfilename_sorted(nr);
|
||||
return card.filename && card.filename[0] != '\0';
|
||||
#else
|
||||
return false;
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -671,7 +674,7 @@ namespace ExtUI {
|
||||
#endif
|
||||
}
|
||||
|
||||
void FileList::changeDir(const char *dirname) {
|
||||
void FileList::changeDir(const char * const dirname) {
|
||||
#if ENABLED(SDSUPPORT)
|
||||
card.chdir(dirname);
|
||||
num_files = 0xFFFF;
|
||||
@ -713,20 +716,6 @@ void MarlinUI::update() {
|
||||
ExtUI::onIdle();
|
||||
}
|
||||
|
||||
void MarlinUI::setstatus(const char * const message, const bool persist/*=false*/) { ExtUI::onStatusChanged(message); }
|
||||
void MarlinUI::setstatusPGM(PGM_P const message, int8_t level/*=0*/) { ExtUI::onStatusChanged((progmem_str)message); }
|
||||
void MarlinUI::setalertstatusPGM(PGM_P const message) { setstatusPGM(message, 0); }
|
||||
|
||||
void MarlinUI::status_printf_P(const uint8_t level, const char * const fmt, ...) {
|
||||
char buff[64];
|
||||
va_list args;
|
||||
va_start(args, fmt);
|
||||
vsnprintf_P(buff, sizeof(buff), fmt, args);
|
||||
va_end(args);
|
||||
buff[63] = '\0';
|
||||
ExtUI::onStatusChanged(buff);
|
||||
}
|
||||
|
||||
void MarlinUI::kill_screen(PGM_P const msg) {
|
||||
if (!flags.printer_killed) {
|
||||
flags.printer_killed = true;
|
||||
|
Reference in New Issue
Block a user