mirror of
https://github.com/MarlinFirmware/Marlin.git
synced 2024-11-23 12:04:19 +00:00
Handle runout in runout.cpp
This commit is contained in:
parent
72d791a736
commit
0322348924
@ -155,7 +155,7 @@ void HAL_idletask() {
|
|||||||
// a PC via USB.
|
// a PC via USB.
|
||||||
// Other HALs use IS_SD_PRINTING() and IS_SD_FILE_OPEN() to check for access but
|
// Other HALs use IS_SD_PRINTING() and IS_SD_FILE_OPEN() to check for access but
|
||||||
// this will not reliably detect delete operations. To be safe we will lock
|
// this will not reliably detect delete operations. To be safe we will lock
|
||||||
// the disk if Marlin has it mounted. Unfortuately there is currently no way
|
// the disk if Marlin has it mounted. Unfortunately there is currently no way
|
||||||
// to unmount the disk from the LCD menu.
|
// to unmount the disk from the LCD menu.
|
||||||
// if (IS_SD_PRINTING() || IS_SD_FILE_OPEN())
|
// if (IS_SD_PRINTING() || IS_SD_FILE_OPEN())
|
||||||
if (card.isMounted())
|
if (card.isMounted())
|
||||||
|
@ -233,7 +233,7 @@ void HAL_idletask() {
|
|||||||
// a PC via USB.
|
// a PC via USB.
|
||||||
// Other HALs use IS_SD_PRINTING() and IS_SD_FILE_OPEN() to check for access but
|
// Other HALs use IS_SD_PRINTING() and IS_SD_FILE_OPEN() to check for access but
|
||||||
// this will not reliably detect delete operations. To be safe we will lock
|
// this will not reliably detect delete operations. To be safe we will lock
|
||||||
// the disk if Marlin has it mounted. Unfortuately there is currently no way
|
// the disk if Marlin has it mounted. Unfortunately there is currently no way
|
||||||
// to unmount the disk from the LCD menu.
|
// to unmount the disk from the LCD menu.
|
||||||
// if (IS_SD_PRINTING() || IS_SD_FILE_OPEN())
|
// if (IS_SD_PRINTING() || IS_SD_FILE_OPEN())
|
||||||
/* copy from lpc1768 framework, should be fixed later for process SHARED_SD_CARD*/
|
/* copy from lpc1768 framework, should be fixed later for process SHARED_SD_CARD*/
|
||||||
|
@ -173,10 +173,6 @@
|
|||||||
#include "feature/prusa_MMU2/mmu2.h"
|
#include "feature/prusa_MMU2/mmu2.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if ENABLED(EXTENSIBLE_UI)
|
|
||||||
#include "lcd/extensible_ui/ui_api.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if HAS_DRIVER(L6470)
|
#if HAS_DRIVER(L6470)
|
||||||
#include "libs/L6470/L6470_Marlin.h"
|
#include "libs/L6470/L6470_Marlin.h"
|
||||||
#endif
|
#endif
|
||||||
@ -330,71 +326,6 @@ void disable_all_steppers() {
|
|||||||
disable_e_steppers();
|
disable_e_steppers();
|
||||||
}
|
}
|
||||||
|
|
||||||
#if HAS_FILAMENT_SENSOR
|
|
||||||
|
|
||||||
void event_filament_runout() {
|
|
||||||
|
|
||||||
#if ENABLED(ADVANCED_PAUSE_FEATURE)
|
|
||||||
if (did_pause_print) return; // Action already in progress. Purge triggered repeated runout.
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if ENABLED(EXTENSIBLE_UI)
|
|
||||||
ExtUI::onFilamentRunout(ExtUI::getActiveTool());
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if EITHER(HOST_PROMPT_SUPPORT, HOST_ACTION_COMMANDS)
|
|
||||||
const char tool = '0'
|
|
||||||
#if NUM_RUNOUT_SENSORS > 1
|
|
||||||
+ active_extruder
|
|
||||||
#endif
|
|
||||||
;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
//action:out_of_filament
|
|
||||||
#if ENABLED(HOST_PROMPT_SUPPORT)
|
|
||||||
host_prompt_reason = PROMPT_FILAMENT_RUNOUT;
|
|
||||||
host_action_prompt_end();
|
|
||||||
host_action_prompt_begin(PSTR("FilamentRunout T"), false);
|
|
||||||
SERIAL_CHAR(tool);
|
|
||||||
SERIAL_EOL();
|
|
||||||
host_action_prompt_show();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
const bool run_runout_script = !runout.host_handling;
|
|
||||||
|
|
||||||
#if ENABLED(HOST_ACTION_COMMANDS)
|
|
||||||
if (run_runout_script
|
|
||||||
&& ( strstr(FILAMENT_RUNOUT_SCRIPT, "M600")
|
|
||||||
|| strstr(FILAMENT_RUNOUT_SCRIPT, "M125")
|
|
||||||
#if ENABLED(ADVANCED_PAUSE_FEATURE)
|
|
||||||
|| strstr(FILAMENT_RUNOUT_SCRIPT, "M25")
|
|
||||||
#endif
|
|
||||||
)
|
|
||||||
) {
|
|
||||||
host_action_paused(false);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
// Legacy Repetier command for use until newer version supports standard dialog
|
|
||||||
// To be removed later when pause command also triggers dialog
|
|
||||||
#ifdef ACTION_ON_FILAMENT_RUNOUT
|
|
||||||
host_action(PSTR(ACTION_ON_FILAMENT_RUNOUT " T"), false);
|
|
||||||
SERIAL_CHAR(tool);
|
|
||||||
SERIAL_EOL();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
host_action_pause(false);
|
|
||||||
}
|
|
||||||
SERIAL_ECHOPGM(" " ACTION_REASON_ON_FILAMENT_RUNOUT " ");
|
|
||||||
SERIAL_CHAR(tool);
|
|
||||||
SERIAL_EOL();
|
|
||||||
#endif // HOST_ACTION_COMMANDS
|
|
||||||
|
|
||||||
if (run_runout_script)
|
|
||||||
queue.inject_P(PSTR(FILAMENT_RUNOUT_SCRIPT));
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif // HAS_FILAMENT_SENSOR
|
|
||||||
|
|
||||||
#if ENABLED(G29_RETRY_AND_RECOVER)
|
#if ENABLED(G29_RETRY_AND_RECOVER)
|
||||||
|
|
||||||
void event_probe_failure() {
|
void event_probe_failure() {
|
||||||
|
@ -371,10 +371,6 @@ void protected_pin_err();
|
|||||||
inline void suicide() { OUT_WRITE(SUICIDE_PIN, LOW); }
|
inline void suicide() { OUT_WRITE(SUICIDE_PIN, LOW); }
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if HAS_FILAMENT_SENSOR
|
|
||||||
void event_filament_runout();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if ENABLED(G29_RETRY_AND_RECOVER)
|
#if ENABLED(G29_RETRY_AND_RECOVER)
|
||||||
void event_probe_recover();
|
void event_probe_recover();
|
||||||
void event_probe_failure();
|
void event_probe_failure();
|
||||||
|
@ -58,4 +58,79 @@ void FilamentSensorBase::filament_present(const uint8_t extruder) {
|
|||||||
int8_t RunoutResponseDebounced::runout_count; // = 0
|
int8_t RunoutResponseDebounced::runout_count; // = 0
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
//
|
||||||
|
// Filament Runout event handler
|
||||||
|
//
|
||||||
|
#include "../Marlin.h"
|
||||||
|
#include "../gcode/queue.h"
|
||||||
|
|
||||||
|
#if ENABLED(HOST_ACTION_COMMANDS)
|
||||||
|
#include "host_actions.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if ENABLED(EXTENSIBLE_UI)
|
||||||
|
#include "../lcd/extensible_ui/ui_api.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
void event_filament_runout() {
|
||||||
|
|
||||||
|
#if ENABLED(ADVANCED_PAUSE_FEATURE)
|
||||||
|
if (did_pause_print) return; // Action already in progress. Purge triggered repeated runout.
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if ENABLED(EXTENSIBLE_UI)
|
||||||
|
ExtUI::onFilamentRunout(ExtUI::getActiveTool());
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if EITHER(HOST_PROMPT_SUPPORT, HOST_ACTION_COMMANDS)
|
||||||
|
const char tool = '0'
|
||||||
|
#if NUM_RUNOUT_SENSORS > 1
|
||||||
|
+ active_extruder
|
||||||
|
#endif
|
||||||
|
;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
//action:out_of_filament
|
||||||
|
#if ENABLED(HOST_PROMPT_SUPPORT)
|
||||||
|
host_prompt_reason = PROMPT_FILAMENT_RUNOUT;
|
||||||
|
host_action_prompt_end();
|
||||||
|
host_action_prompt_begin(PSTR("FilamentRunout T"), false);
|
||||||
|
SERIAL_CHAR(tool);
|
||||||
|
SERIAL_EOL();
|
||||||
|
host_action_prompt_show();
|
||||||
|
#endif
|
||||||
|
|
||||||
|
const bool run_runout_script = !runout.host_handling;
|
||||||
|
|
||||||
|
#if ENABLED(HOST_ACTION_COMMANDS)
|
||||||
|
if (run_runout_script
|
||||||
|
&& ( strstr(FILAMENT_RUNOUT_SCRIPT, "M600")
|
||||||
|
|| strstr(FILAMENT_RUNOUT_SCRIPT, "M125")
|
||||||
|
#if ENABLED(ADVANCED_PAUSE_FEATURE)
|
||||||
|
|| strstr(FILAMENT_RUNOUT_SCRIPT, "M25")
|
||||||
|
#endif
|
||||||
|
)
|
||||||
|
) {
|
||||||
|
host_action_paused(false);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
// Legacy Repetier command for use until newer version supports standard dialog
|
||||||
|
// To be removed later when pause command also triggers dialog
|
||||||
|
#ifdef ACTION_ON_FILAMENT_RUNOUT
|
||||||
|
host_action(PSTR(ACTION_ON_FILAMENT_RUNOUT " T"), false);
|
||||||
|
SERIAL_CHAR(tool);
|
||||||
|
SERIAL_EOL();
|
||||||
|
#endif
|
||||||
|
|
||||||
|
host_action_pause(false);
|
||||||
|
}
|
||||||
|
SERIAL_ECHOPGM(" " ACTION_REASON_ON_FILAMENT_RUNOUT " ");
|
||||||
|
SERIAL_CHAR(tool);
|
||||||
|
SERIAL_EOL();
|
||||||
|
#endif // HOST_ACTION_COMMANDS
|
||||||
|
|
||||||
|
if (run_runout_script)
|
||||||
|
queue.inject_P(PSTR(FILAMENT_RUNOUT_SCRIPT));
|
||||||
|
}
|
||||||
|
|
||||||
#endif // HAS_FILAMENT_SENSOR
|
#endif // HAS_FILAMENT_SENSOR
|
||||||
|
@ -46,6 +46,8 @@
|
|||||||
#define FILAMENT_RUNOUT_THRESHOLD 5
|
#define FILAMENT_RUNOUT_THRESHOLD 5
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
void event_filament_runout();
|
||||||
|
|
||||||
class FilamentMonitorBase {
|
class FilamentMonitorBase {
|
||||||
public:
|
public:
|
||||||
static bool enabled, filament_ran_out;
|
static bool enabled, filament_ran_out;
|
||||||
|
@ -102,15 +102,20 @@ void GcodeSuite::M701() {
|
|||||||
#if ENABLED(PRUSA_MMU2)
|
#if ENABLED(PRUSA_MMU2)
|
||||||
mmu2.load_filament_to_nozzle(target_extruder);
|
mmu2.load_filament_to_nozzle(target_extruder);
|
||||||
#else
|
#else
|
||||||
constexpr float slow_load_length = FILAMENT_CHANGE_SLOW_LOAD_LENGTH;
|
constexpr float purge_length = ADVANCED_PAUSE_PURGE_LENGTH,
|
||||||
const float fast_load_length = ABS(parser.seen('L') ? parser.value_axis_units(E_AXIS)
|
slow_load_length = FILAMENT_CHANGE_SLOW_LOAD_LENGTH;
|
||||||
: fc_settings[active_extruder].load_length);
|
const float fast_load_length = ABS(parser.seen('L') ? parser.value_axis_units(E_AXIS)
|
||||||
load_filament(slow_load_length, fast_load_length, ADVANCED_PAUSE_PURGE_LENGTH, FILAMENT_CHANGE_ALERT_BEEPS,
|
: fc_settings[active_extruder].load_length);
|
||||||
true, thermalManager.still_heating(target_extruder), PAUSE_MODE_LOAD_FILAMENT
|
load_filament(
|
||||||
#if ENABLED(DUAL_X_CARRIAGE)
|
slow_load_length, fast_load_length, purge_length,
|
||||||
, target_extruder
|
FILAMENT_CHANGE_ALERT_BEEPS,
|
||||||
#endif
|
true, // show_lcd
|
||||||
);
|
thermalManager.still_heating(target_extruder), // pause_for_user
|
||||||
|
PAUSE_MODE_LOAD_FILAMENT // pause_mode
|
||||||
|
#if ENABLED(DUAL_X_CARRIAGE)
|
||||||
|
, target_extruder // Dual X target
|
||||||
|
#endif
|
||||||
|
);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Restore Z axis
|
// Restore Z axis
|
||||||
|
Loading…
Reference in New Issue
Block a user