1
0
mirror of https://github.com/MarlinFirmware/Marlin.git synced 2024-11-26 21:36:21 +00:00

Add heater timeouts to ExtUI (#13970)

- Add local UI methods to get heater timeout state.
- Add methods to resume timed-out heaters.
- Re-enable heaters on UI temperature request.
- Make `ExtUI` show a dialog box if pause needs a button press after reheat.
This commit is contained in:
Marcio Teixeira 2019-05-10 14:56:13 -06:00 committed by Scott Lahteine
parent fa3739aa23
commit 227f29090d
3 changed files with 69 additions and 34 deletions

View File

@ -49,6 +49,10 @@
#include "host_actions.h"
#endif
#if ENABLED(EXTENSIBLE_UI)
#include "../lcd/extensible_ui/ui_api.h"
#endif
#include "../lcd/ultralcd.h"
#include "../libs/buzzer.h"
#include "../libs/nozzle.h"
@ -538,6 +542,9 @@ void wait_for_confirmation(const bool is_reload/*=false*/, const int8_t max_beep
#if ENABLED(HOST_PROMPT_SUPPORT)
host_prompt_do(PROMPT_USER_CONTINUE, PSTR("Reheating"));
#endif
#if ENABLED(EXTENSIBLE_UI)
ExtUI::onStatusChanged(PSTR("Reheating..."));
#endif
// Re-enable the heaters if they timed out
HOTEND_LOOP() thermalManager.reset_heater_idle_timer(e);
@ -555,6 +562,9 @@ void wait_for_confirmation(const bool is_reload/*=false*/, const int8_t max_beep
#if ENABLED(HOST_PROMPT_SUPPORT)
host_prompt_do(PROMPT_USER_CONTINUE, PSTR("Reheat Done"), PSTR("Continue"));
#endif
#if ENABLED(EXTENSIBLE_UI)
ExtUI::onUserConfirmRequired("Reheat finished.");
#endif
wait_for_user = true;
nozzle_timed_out = false;

View File

@ -148,9 +148,7 @@ namespace ExtUI {
}
#endif // __SAM3X8E__
void delay_us(unsigned long us) {
DELAY_US(us);
}
void delay_us(unsigned long us) { DELAY_US(us); }
void delay_ms(unsigned long ms) {
if (flags.printer_killed)
@ -164,14 +162,49 @@ namespace ExtUI {
thermalManager.manage_heater();
}
float getActualTemp_celsius(const heater_t heater) {
return heater == BED ?
void enableHeater(const extruder_t extruder) {
#if HEATER_IDLE_HANDLER
thermalManager.reset_heater_idle_timer(extruder - E0);
#endif
}
void enableHeater(const heater_t heater) {
#if HEATER_IDLE_HANDLER
#if HAS_HEATED_BED
thermalManager.degBed()
#else
0
if (heater == BED)
thermalManager.reset_bed_idle_timer();
else
#endif
: thermalManager.degHotend(heater - H0);
thermalManager.reset_heater_idle_timer(heater - H0);
#endif
}
bool isHeaterIdle(const extruder_t extruder) {
return false
#if HEATER_IDLE_HANDLER
|| thermalManager.hotend_idle[extruder - E0].timed_out
#endif
;
}
bool isHeaterIdle(const heater_t heater) {
return (false
#if HEATER_IDLE_HANDLER
|| (heater == BED ? (false
#if HAS_HEATED_BED
|| thermalManager.bed_idle.timed_out
#endif
) : thermalManager.hotend_idle[heater - H0].timed_out)
#endif
);
}
float getActualTemp_celsius(const heater_t heater) {
return heater == BED ? (0
#if HAS_HEATED_BED
+ thermalManager.degBed()
#endif
) : thermalManager.degHotend(heater - H0);
}
float getActualTemp_celsius(const extruder_t extruder) {
@ -179,13 +212,11 @@ namespace ExtUI {
}
float getTargetTemp_celsius(const heater_t heater) {
return heater == BED ?
return heater == BED ? (0
#if HAS_HEATED_BED
thermalManager.degTargetBed()
#else
0
+ thermalManager.degTargetBed()
#endif
: thermalManager.degTargetHotend(heater - H0);
) : thermalManager.degTargetHotend(heater - H0);
}
float getTargetTemp_celsius(const extruder_t extruder) {
@ -252,8 +283,7 @@ namespace ExtUI {
}
#endif
if (!flags.manual_motion)
set_destination_from_current();
if (!flags.manual_motion) set_destination_from_current();
destination[axis] = clamp(position, min, max);
flags.manual_motion = true;
}
@ -261,8 +291,7 @@ namespace ExtUI {
void setAxisPosition_mm(const float position, const extruder_t extruder) {
setActiveTool(extruder, true);
if (!flags.manual_motion)
set_destination_from_current();
if (!flags.manual_motion) set_destination_from_current();
destination[E_AXIS] = position;
flags.manual_motion = true;
}
@ -303,8 +332,7 @@ namespace ExtUI {
#if EXTRUDERS > 1
const uint8_t e = extruder - E0;
#if DO_SWITCH_EXTRUDER || EITHER(SWITCHING_NOZZLE, PARKING_EXTRUDER)
if (e != active_extruder)
tool_change(e, 0, no_move);
if (e != active_extruder) tool_change(e, 0, no_move);
#endif
active_extruder = e;
#endif
@ -341,13 +369,8 @@ namespace ExtUI {
}
#if HAS_SOFTWARE_ENDSTOPS
bool getSoftEndstopState() {
return soft_endstops_enabled;
}
void setSoftEndstopState(const bool value) {
soft_endstops_enabled = value;
}
bool getSoftEndstopState() { return soft_endstops_enabled; }
void setSoftEndstopState(const bool value) { soft_endstops_enabled = value; }
#endif
#if HAS_TRINAMIC
@ -513,13 +536,8 @@ namespace ExtUI {
void setFilamentRunoutEnabled(const bool value) { runout.enabled = value; }
#ifdef FILAMENT_RUNOUT_DISTANCE_MM
float getFilamentRunoutDistance_mm() {
return runout.runout_distance();
}
void setFilamentRunoutDistance_mm(const float value) {
runout.set_runout_distance(clamp(value, 0, 999));
}
float getFilamentRunoutDistance_mm() { return runout.runout_distance(); }
void setFilamentRunoutDistance_mm(const float value) { runout.set_runout_distance(clamp(value, 0, 999)); }
#endif
#endif
@ -761,6 +779,7 @@ namespace ExtUI {
void setTargetTemp_celsius(float value, const heater_t heater) {
constexpr int16_t heater_maxtemp[HOTENDS] = ARRAY_BY_HOTENDS(HEATER_0_MAXTEMP, HEATER_1_MAXTEMP, HEATER_2_MAXTEMP, HEATER_3_MAXTEMP, HEATER_4_MAXTEMP);
const int16_t e = heater - H0;
enableHeater(heater);
#if HAS_HEATED_BED
if (heater == BED)
thermalManager.setTargetBed(clamp(value, 0, BED_MAXTEMP - 10));
@ -772,6 +791,7 @@ namespace ExtUI {
void setTargetTemp_celsius(float value, const extruder_t extruder) {
constexpr int16_t heater_maxtemp[HOTENDS] = ARRAY_BY_HOTENDS(HEATER_0_MAXTEMP, HEATER_1_MAXTEMP, HEATER_2_MAXTEMP, HEATER_3_MAXTEMP, HEATER_4_MAXTEMP);
const int16_t e = extruder - E0;
enableHeater(extruder);
thermalManager.setTargetHotend(clamp(value, 0, heater_maxtemp[e] - 15), e);
}

View File

@ -70,6 +70,11 @@ namespace ExtUI {
void enqueueCommands_P(PGM_P const);
bool commandsInQueue();
bool isHeaterIdle(const heater_t);
bool isHeaterIdle(const extruder_t);
void enableHeater(const heater_t);
void enableHeater(const extruder_t);
/**
* Getters and setters
* Should be used by the EXTENSIBLE_UI to query or change Marlin's state.