From 180832ef0c68321b6077b22f859848eb3f566fee Mon Sep 17 00:00:00 2001 From: InsanityAutomation Date: Sat, 3 Feb 2024 14:22:22 -0500 Subject: [PATCH] First Pass M591 Import --- Marlin/src/feature/host_actions.cpp | 2 +- Marlin/src/feature/mmu/mmu2.cpp | 2 +- Marlin/src/feature/pause.cpp | 17 +- Marlin/src/feature/runout.cpp | 19 +- Marlin/src/feature/runout.h | 288 +++++------------- Marlin/src/gcode/feature/pause/M600.cpp | 2 +- .../feature/runout/{M412.cpp => M591.cpp} | 61 ++-- Marlin/src/gcode/gcode.cpp | 5 + Marlin/src/gcode/gcode.h | 9 +- Marlin/src/gcode/host/M115.cpp | 2 +- Marlin/src/inc/Conditionals_LCD.h | 56 ++-- Marlin/src/inc/Conditionals_adv.h | 3 - Marlin/src/inc/SanityCheck.h | 65 +++- Marlin/src/lcd/e3v2/jyersui/dwin.cpp | 10 +- Marlin/src/lcd/e3v2/proui/dwin.cpp | 6 +- Marlin/src/lcd/e3v2/proui/endstop_diag.cpp | 2 +- .../generic/endstop_state_screen.cpp | 4 +- .../generic/filament_runout_screen.cpp | 25 +- Marlin/src/lcd/extui/ui_api.cpp | 19 +- Marlin/src/lcd/extui/ui_api.h | 13 +- Marlin/src/lcd/language/language_en.h | 8 + Marlin/src/lcd/menu/menu_advanced.cpp | 57 +++- Marlin/src/lcd/menu/menu_configuration.cpp | 2 +- Marlin/src/lcd/menu/menu_filament.cpp | 11 +- Marlin/src/module/endstops.cpp | 30 +- Marlin/src/module/settings.cpp | 51 ++-- Marlin/src/module/stepper.cpp | 4 +- buildroot/tests/BIGTREE_GTR_V1_0 | 6 +- .../tests/BIGTREE_GTR_V1_0_usb_flash_drive | 2 +- buildroot/tests/DUE | 2 +- buildroot/tests/mega2560 | 4 +- 31 files changed, 410 insertions(+), 377 deletions(-) rename Marlin/src/gcode/feature/runout/{M412.cpp => M591.cpp} (53%) diff --git a/Marlin/src/feature/host_actions.cpp b/Marlin/src/feature/host_actions.cpp index 538aa92e91..898ae2f85c 100644 --- a/Marlin/src/feature/host_actions.cpp +++ b/Marlin/src/feature/host_actions.cpp @@ -197,7 +197,7 @@ void HostUI::action(FSTR_P const fstr, const bool eol) { #endif #if HAS_FILAMENT_SENSOR if (runout.filament_ran_out) { // Disable a triggered sensor - runout.enabled = false; + runout.enabled[active_extruder] = false; runout.reset(); } #endif diff --git a/Marlin/src/feature/mmu/mmu2.cpp b/Marlin/src/feature/mmu/mmu2.cpp index 5ef56c7eac..6245e828fd 100644 --- a/Marlin/src/feature/mmu/mmu2.cpp +++ b/Marlin/src/feature/mmu/mmu2.cpp @@ -135,7 +135,7 @@ void MMU2::reset() { int8_t MMU2::get_current_tool() { return extruder == MMU2_NO_TOOL ? -1 : extruder; } #if ANY(HAS_PRUSA_MMU2S, MMU_EXTRUDER_SENSOR) - #define FILAMENT_PRESENT() (READ(FIL_RUNOUT1_PIN) != FIL_RUNOUT1_STATE) + #define FILAMENT_PRESENT() (READ(FIL_RUNOUT1_PIN) != runout.out_state()) #else #define FILAMENT_PRESENT() true #endif diff --git a/Marlin/src/feature/pause.cpp b/Marlin/src/feature/pause.cpp index 74a4f236c0..2464646c53 100644 --- a/Marlin/src/feature/pause.cpp +++ b/Marlin/src/feature/pause.cpp @@ -214,12 +214,21 @@ bool load_filament(const_float_t slow_load_length/*=0*/, const_float_t fast_load impatient_beep(max_beep_count); #if ALL(FILAMENT_CHANGE_RESUME_ON_INSERT, FILAMENT_RUNOUT_SENSOR) #if MULTI_FILAMENT_SENSOR - #define _CASE_INSERTED(N) case N-1: if (READ(FIL_RUNOUT##N##_PIN) != FIL_RUNOUT##N##_STATE) wait_for_user = false; break; - switch (active_extruder) { - REPEAT_1(NUM_RUNOUT_SENSORS, _CASE_INSERTED) + LOOP_S_LE_N(i, 1, NUM_RUNOUT_SENSORS) { + pin_t pin; + switch (i) { + default: continue; + #define _CASE_RUNOUT(N) case N: pin = FIL_RUNOUT##N##_PIN; break; + REPEAT_1(NUM_RUNOUT_SENSORS, _CASE_RUNOUT) + #undef _CASE_RUNOUT + } + const RunoutMode rm = runout.mode[i - 1]; + if (rm != RM_NONE && rm != RM_MOTION_SENSOR && extDigitalRead(pin) != runout.out_state(i - 1)) + wait_for_user = false; } #else - if (READ(FIL_RUNOUT_PIN) != FIL_RUNOUT_STATE) wait_for_user = false; + if (READ(FIL_RUNOUT_PIN) != runout.out_state(active_extruder)) + wait_for_user = false; #endif #endif idle_no_sleep(); diff --git a/Marlin/src/feature/runout.cpp b/Marlin/src/feature/runout.cpp index 2bcb47e99a..d2ec10daec 100644 --- a/Marlin/src/feature/runout.cpp +++ b/Marlin/src/feature/runout.cpp @@ -32,9 +32,9 @@ FilamentMonitor runout; -bool FilamentMonitorBase::enabled = true, - FilamentMonitorBase::filament_ran_out; // = false - +bool FilamentMonitorBase::enabled[NUM_RUNOUT_SENSORS], // Initialized by settings.load + FilamentMonitorBase::filament_ran_out; // = false +RunoutMode FilamentMonitorBase::mode[NUM_RUNOUT_SENSORS]; // Initialized by settings.load #if ENABLED(HOST_ACTION_COMMANDS) bool FilamentMonitorBase::host_handling; // = false #endif @@ -45,15 +45,10 @@ bool FilamentMonitorBase::enabled = true, #include "../core/debug_out.h" #endif -#if HAS_FILAMENT_RUNOUT_DISTANCE - float RunoutResponseDelayed::runout_distance_mm = FILAMENT_RUNOUT_DISTANCE_MM; - countdown_t RunoutResponseDelayed::mm_countdown; - #if ENABLED(FILAMENT_MOTION_SENSOR) - uint8_t FilamentSensorEncoder::motion_detected; - #endif -#else - int8_t RunoutResponseDebounced::runout_count[NUM_RUNOUT_SENSORS]; // = 0 -#endif +float RunoutResponseDelayed::runout_distance_mm[NUM_RUNOUT_SENSORS]; // Initialized by settings.load +countdown_t RunoutResponseDelayed::mm_countdown; +uint8_t FilamentSensorCore::motion_detected; +int8_t RunoutResponseDelayed::runout_count[NUM_RUNOUT_SENSORS]; // = 0 // // Filament Runout event handler diff --git a/Marlin/src/feature/runout.h b/Marlin/src/feature/runout.h index c95c39f273..0a3084dbaa 100644 --- a/Marlin/src/feature/runout.h +++ b/Marlin/src/feature/runout.h @@ -44,12 +44,6 @@ #define FILAMENT_RUNOUT_THRESHOLD 5 #endif -#if ENABLED(FILAMENT_MOTION_SENSOR) - #define HAS_FILAMENT_MOTION 1 -#endif -#if DISABLED(FILAMENT_MOTION_SENSOR) || ENABLED(FILAMENT_SWITCH_AND_MOTION) - #define HAS_FILAMENT_SWITCH 1 -#endif typedef Flags< #if NUM_MOTION_SENSORS > NUM_RUNOUT_SENSORS @@ -64,24 +58,38 @@ inline bool should_monitor_runout() { return did_pause_print || printingIsActive template class TFilamentMonitor; -class FilamentSensor; +class FilamentSensorCore; class RunoutResponseDelayed; class RunoutResponseDebounced; /********************************* TEMPLATE SPECIALIZATION *********************************/ typedef TFilamentMonitor< - TERN(HAS_FILAMENT_RUNOUT_DISTANCE, RunoutResponseDelayed, RunoutResponseDebounced), - FilamentSensor + RunoutResponseDelayed, + FilamentSensorCore > FilamentMonitor; extern FilamentMonitor runout; /*******************************************************************************************/ +enum RunoutMode : uint8_t { + RM_NONE, + RM_OUT_ON_LOW, + RM_OUT_ON_HIGH, + RM_RESERVED3, + RM_RESERVED4, + RM_RESERVED5, + RM_RESERVED6, + RM_MOTION_SENSOR +}; + class FilamentMonitorBase { public: - static bool enabled, filament_ran_out; + static bool enabled[NUM_RUNOUT_SENSORS], filament_ran_out; + static RunoutMode mode[NUM_RUNOUT_SENSORS]; + + static uint8_t out_state(const uint8_t e=0) { return mode[e] == RM_OUT_ON_HIGH ? HIGH : LOW; } #if ENABLED(HOST_ACTION_COMMANDS) static bool host_handling; @@ -111,24 +119,14 @@ class TFilamentMonitor : public FilamentMonitorBase { // Call this method when filament is present, // so the response can reset its counter. - static void filament_present(const uint8_t extruder) { - response.filament_present(extruder); - } - #if ENABLED(FILAMENT_SWITCH_AND_MOTION) - static void filament_motion_present(const uint8_t extruder) { - response.filament_motion_present(extruder); - } - #endif - - #if HAS_FILAMENT_RUNOUT_DISTANCE - static float& runout_distance() { return response.runout_distance_mm; } - static void set_runout_distance(const_float_t mm) { response.runout_distance_mm = mm; } - #endif + static void filament_present(const uint8_t e) { response.filament_present(e); } + static float& runout_distance(const uint8_t e=0) { return response.runout_distance_mm[e]; } + static void set_runout_distance(const_float_t mm, const uint8_t e=0) { response.runout_distance_mm[e] = mm; } // Handle a block completion. RunoutResponseDelayed uses this to // add up the length of filament moved while the filament is out. static void block_completed(const block_t * const b) { - if (enabled) { + if (enabled[active_extruder]) { response.block_completed(b); sensor.block_completed(b); } @@ -137,11 +135,11 @@ class TFilamentMonitor : public FilamentMonitorBase { // Give the response a chance to update its counter. static void run() { if (enabled && !filament_ran_out && should_monitor_runout()) { - TERN_(HAS_FILAMENT_RUNOUT_DISTANCE, cli()); // Prevent RunoutResponseDelayed::block_completed from accumulating here + cli(); // Prevent RunoutResponseDelayed::block_completed from accumulating here response.run(); sensor.run(); const runout_flags_t runout_flags = response.has_run_out(); - TERN_(HAS_FILAMENT_RUNOUT_DISTANCE, sei()); + sei(); #if MULTI_FILAMENT_SENSOR #if ENABLED(WATCH_ALL_RUNOUT_SENSORS) const bool ran_out = bool(runout_flags); // any sensor triggers @@ -182,11 +180,6 @@ class FilamentSensorBase { static void filament_present(const uint8_t extruder) { runout.filament_present(extruder); // ...which calls response.filament_present(extruder) } - #if ENABLED(FILAMENT_SWITCH_AND_MOTION) - static void filament_motion_present(const uint8_t extruder) { - runout.filament_motion_present(extruder); // ...which calls response.filament_motion_present(extruder) - } - #endif public: static void setup() { @@ -212,7 +205,7 @@ class FilamentSensorBase { // Return a bitmask of runout flag states (1 bits always indicates runout) static uint8_t poll_runout_states() { - #define _INVERT_BIT(N) | (FIL_RUNOUT##N##_STATE ? 0 : _BV(N - 1)) + #define _INVERT_BIT(N) | (runout.out_state(N-1) ? 0 : _BV(N-1)) return poll_runout_pins() ^ uint8_t(0 REPEAT_1(NUM_RUNOUT_SENSORS, _INVERT_BIT)); #undef _INVERT_BIT } @@ -234,17 +227,21 @@ class FilamentSensorBase { #endif }; -#if HAS_FILAMENT_MOTION +class FilamentSensorCore : public FilamentSensorBase { + private: + static uint8_t motion_detected; - /** - * This sensor uses a magnetic encoder disc and a Hall effect - * sensor (or a slotted disc and optical sensor). The state - * will toggle between 0 and 1 on filament movement. It can detect - * filament runout and stripouts or jams. - */ - class FilamentSensorEncoder : public FilamentSensorBase { - private: - static uint8_t motion_detected; + static bool poll_runout_state(const uint8_t extruder) { + const uint8_t runout_states = poll_runout_states(); + #if MULTI_FILAMENT_SENSOR + if ( !TERN0(DUAL_X_CARRIAGE, idex_is_duplicating()) + && !TERN0(MULTI_NOZZLE_DUPLICATION, extruder_duplication_enabled) + ) return TEST(runout_states, extruder); // A specific extruder ran out + #else + UNUSED(extruder); + #endif + return !!runout_states; // Any extruder ran out + } static void poll_motion_sensor() { static uint8_t old_state; @@ -252,14 +249,14 @@ class FilamentSensorBase { change = old_state ^ new_state; old_state = new_state; - #if ENABLED(FILAMENT_RUNOUT_SENSOR_DEBUG) - if (change) { - SERIAL_ECHOPGM("Motion detected:"); - for (uint8_t e = 0; e < TERN(FILAMENT_SWITCH_AND_MOTION, NUM_MOTION_SENSORS, NUM_RUNOUT_SENSORS); ++e) - if (TEST(change, e)) SERIAL_CHAR(' ', '0' + e); - SERIAL_EOL(); - } - #endif + #if ENABLED(FILAMENT_RUNOUT_SENSOR_DEBUG) + if (change) { + SERIAL_ECHOPGM("Motion detected:"); + for(uint8_t e = 0; e < NUM_RUNOUT_SENSORS; ++e) + if (TEST(change, e)) SERIAL_CHAR(' ', '0' + e); + SERIAL_EOL(); + } + #endif motion_detected |= change; } @@ -275,36 +272,12 @@ class FilamentSensorBase { motion_detected = 0; } - static void run() { poll_motion_sensor(); } - }; - -#endif // HAS_FILAMENT_MOTION - -#if HAS_FILAMENT_SWITCH - - /** - * This is a simple endstop switch in the path of the filament. - * It can detect filament runout, but not stripouts or jams. - */ - class FilamentSensorSwitch : public FilamentSensorBase { - private: - static bool poll_runout_state(const uint8_t extruder) { - const uint8_t runout_states = poll_runout_states(); - #if MULTI_FILAMENT_SENSOR - if ( !TERN0(DUAL_X_CARRIAGE, idex_is_duplicating()) - && !TERN0(MULTI_NOZZLE_DUPLICATION, extruder_duplication_enabled) - ) return TEST(runout_states, extruder); // A specific extruder ran out - #else - UNUSED(extruder); - #endif - return !!runout_states; // Any extruder ran out + static void run() { + if (runout.mode[active_extruder] == RM_MOTION_SENSOR) { + poll_motion_sensor(); } - - public: - static void block_completed(const block_t * const) {} - - static void run() { - for (uint8_t s = 0; s < NUM_RUNOUT_SENSORS; ++s) { + else if (runout.mode[active_extruder] != RM_NONE) { + for(uint8_t s = 0; s < NUM_RUNOUT_SENSORS; ++s) { const bool out = poll_runout_state(s); if (!out) filament_present(s); #if ENABLED(FILAMENT_RUNOUT_SENSOR_DEBUG) @@ -316,36 +289,13 @@ class FilamentSensorBase { #endif } } - }; + } +}; - #endif // HAS_FILAMENT_SWITCH - - /** - * This is a simple endstop switch in the path of the filament. - * It can detect filament runout, but not stripouts or jams. - */ - class FilamentSensor : public FilamentSensorBase { - private: - TERN_(HAS_FILAMENT_MOTION, static FilamentSensorEncoder encoder_sensor); - TERN_(HAS_FILAMENT_SWITCH, static FilamentSensorSwitch switch_sensor); - - public: - static void block_completed(const block_t * const b) { - TERN_(HAS_FILAMENT_MOTION, encoder_sensor.block_completed(b)); - TERN_(HAS_FILAMENT_SWITCH, switch_sensor.block_completed(b)); - } - - static void run() { - TERN_(HAS_FILAMENT_MOTION, encoder_sensor.run()); - TERN_(HAS_FILAMENT_SWITCH, switch_sensor.run()); - } - }; /********************************* RESPONSE TYPE *********************************/ -#if HAS_FILAMENT_RUNOUT_DISTANCE - - typedef struct { +typedef struct { float runout[NUM_RUNOUT_SENSORS]; Flags runout_reset; // Reset runout later #if ENABLED(FILAMENT_SWITCH_AND_MOTION) @@ -354,15 +304,16 @@ class FilamentSensorBase { #endif } countdown_t; - // RunoutResponseDelayed triggers a runout event only if the length - // of filament specified by FILAMENT_RUNOUT_DISTANCE_MM has been fed - // during a runout condition. - class RunoutResponseDelayed { - private: - static countdown_t mm_countdown; +// RunoutResponseDelayed triggers a runout event only if the length +// of filament specified by FIL_RUNOUT_DISTANCE_MM has been fed +// during a runout condition. +class RunoutResponseDelayed { + private: + static countdown_t mm_countdown; - public: - static float runout_distance_mm; + public: + static float runout_distance_mm[NUM_RUNOUT_SENSORS]; + static int8_t runout_count[NUM_RUNOUT_SENSORS]; static void reset() { for (uint8_t i = 0; i < NUM_RUNOUT_SENSORS; ++i) filament_present(i); @@ -371,116 +322,33 @@ class FilamentSensorBase { #endif } - static void run() { - #if ENABLED(FILAMENT_RUNOUT_SENSOR_DEBUG) - static millis_t t = 0; - const millis_t ms = millis(); - if (ELAPSED(ms, t)) { - t = millis() + 1000UL; - for (uint8_t i = 0; i < NUM_RUNOUT_SENSORS; ++i) - SERIAL_ECHO(i ? F(", ") : F("Runout remaining mm: "), mm_countdown.runout[i]); + static void run() { + #if ENABLED(FILAMENT_RUNOUT_SENSOR_DEBUG) + static millis_t t = 0; + const millis_t ms = millis(); + if (ELAPSED(ms, t)) { + t = millis() + 1000UL; + for(uint8_t i; i < NUM_RUNOUT_SENSORS; ++i) + SERIAL_ECHO(i ? F(", ") : F("Remaining mm: "), mm_countdown[i]); #if ENABLED(FILAMENT_SWITCH_AND_MOTION) for (uint8_t i = 0; i < NUM_MOTION_SENSORS; ++i) SERIAL_ECHO(i ? F(", ") : F("Motion remaining mm: "), mm_countdown.motion[i]); #endif - SERIAL_EOL(); - } - #endif - } - - static runout_flags_t has_run_out() { - runout_flags_t runout_flags{0}; - for (uint8_t i = 0; i < NUM_RUNOUT_SENSORS; ++i) if (mm_countdown.runout[i] < 0) runout_flags.set(i); - #if ENABLED(FILAMENT_SWITCH_AND_MOTION) - for (uint8_t i = 0; i < NUM_MOTION_SENSORS; ++i) if (mm_countdown.motion[i] < 0) runout_flags.set(i); - #endif - return runout_flags; - } - - static void filament_present(const uint8_t extruder) { - if (mm_countdown.runout[extruder] < runout_distance_mm || did_pause_print) { - // Reset runout only if it is smaller than runout_distance or printing is paused. - // On Bowden systems retract may be larger than runout_distance_mm, so if retract - // was added leave it in place, or the following unretract will cause runout event. - mm_countdown.runout[extruder] = runout_distance_mm; - mm_countdown.runout_reset.clear(extruder); - } - else { - // If runout is larger than runout distance, we cannot reset right now, as Bowden and retract - // distance larger than runout_distance_mm leads to negative runout right after unretract. - // But we cannot ignore filament_present event. After unretract, runout will become smaller - // than runout_distance_mm and should be reset after that. So activate delayed reset. - mm_countdown.runout_reset.set(extruder); - } - } - - #if ENABLED(FILAMENT_SWITCH_AND_MOTION) - static void filament_motion_present(const uint8_t extruder) { - // Same logic as filament_present - if (mm_countdown.motion[extruder] < runout_distance_mm || did_pause_print) { - mm_countdown.motion[extruder] = runout_distance_mm; - mm_countdown.motion_reset.clear(extruder); - } - else - mm_countdown.motion_reset.set(extruder); + SERIAL_EOL(); } #endif + } - static void block_completed(const block_t * const b) { - const int32_t esteps = b->steps.e; - if (!esteps) return; - - // No calculation unless paused or printing - if (!should_monitor_runout()) return; - - // No need to ignore retract/unretract movement since they complement each other - const uint8_t e = b->extruder; - const float mm = (b->direction_bits.e ? esteps : -esteps) * planner.mm_per_step[E_AXIS_N(e)]; - - if (e < NUM_RUNOUT_SENSORS) { - mm_countdown.runout[e] -= mm; - if (mm_countdown.runout_reset[e]) filament_present(e); // Reset pending. Try to reset. - } - - #if ENABLED(FILAMENT_SWITCH_AND_MOTION) - if (e < NUM_MOTION_SENSORS) { - mm_countdown.motion[e] -= mm; - if (mm_countdown.motion_reset[e]) filament_motion_present(e); // Reset pending. Try to reset. - } - #endif - } - }; - -#else // !HAS_FILAMENT_RUNOUT_DISTANCE - - // RunoutResponseDebounced triggers a runout event after a runout - // condition has been detected runout_threshold times in a row. - - class RunoutResponseDebounced { - private: - static constexpr int8_t runout_threshold = FILAMENT_RUNOUT_THRESHOLD; - static int8_t runout_count[NUM_RUNOUT_SENSORS]; - - public: - static void reset() { - for (uint8_t i = 0; i < NUM_RUNOUT_SENSORS; ++i) filament_present(i); - } - - static void run() { - for (uint8_t i = 0; i < NUM_RUNOUT_SENSORS; ++i) if (runout_count[i] >= 0) runout_count[i]--; - } - - static runout_flags_t has_run_out() { - runout_flags_t runout_flags{0}; + static runout_flags_t has_run_out() { + runout_flags_t runout_flags{0}; for (uint8_t i = 0; i < NUM_RUNOUT_SENSORS; ++i) if (runout_count[i] < 0) runout_flags.set(i); return runout_flags; - } + } static void block_completed(const block_t * const) { } static void filament_present(const uint8_t extruder) { - runout_count[extruder] = runout_threshold; + runout_count[extruder] = runout_distance_mm[extruder]; } }; -#endif // !HAS_FILAMENT_RUNOUT_DISTANCE diff --git a/Marlin/src/gcode/feature/pause/M600.cpp b/Marlin/src/gcode/feature/pause/M600.cpp index c42db203b6..4d0da2897d 100644 --- a/Marlin/src/gcode/feature/pause/M600.cpp +++ b/Marlin/src/gcode/feature/pause/M600.cpp @@ -94,7 +94,7 @@ void GcodeSuite::M600() { // In this case, for duplicating modes set DXC_ext to the extruder that ran out. #if MULTI_FILAMENT_SENSOR if (idex_is_duplicating()) - DXC_ext = (READ(FIL_RUNOUT2_PIN) == FIL_RUNOUT2_STATE) ? 1 : 0; + DXC_ext = (READ(FIL_RUNOUT2_PIN) == runout.out_state(1)) ? 1 : 0; #else DXC_ext = active_extruder; #endif diff --git a/Marlin/src/gcode/feature/runout/M412.cpp b/Marlin/src/gcode/feature/runout/M591.cpp similarity index 53% rename from Marlin/src/gcode/feature/runout/M412.cpp rename to Marlin/src/gcode/feature/runout/M591.cpp index 4cfb238309..b174f5006c 100644 --- a/Marlin/src/gcode/feature/runout/M412.cpp +++ b/Marlin/src/gcode/feature/runout/M591.cpp @@ -28,36 +28,46 @@ #include "../../../feature/runout.h" /** - * M412: Enable / Disable filament runout detection + * M591: Configure filament runout detection * * Parameters * R : Reset the runout sensor * S : Reset and enable/disable the runout sensor * H : Enable/disable host handling of filament runout - * D : Extra distance to continue after runout is triggered + * L : Extra distance to continue after runout is triggered or motion interval + * D : Alias for L + * P : Mode 0 = NONE + * 1 = Switch NO (HIGH = filament present) + * 2 = Switch NC (LOW = filament present) + * 3 = Encoder / Motion Sensor */ -void GcodeSuite::M412() { - if (parser.seen("RS" - TERN_(HAS_FILAMENT_RUNOUT_DISTANCE, "D") - TERN_(HOST_ACTION_COMMANDS, "H") - )) { +void GcodeSuite::M591() { + if (parser.seen("RSDP" TERN_(HOST_ACTION_COMMANDS, "H"))) { #if ENABLED(HOST_ACTION_COMMANDS) if (parser.seen('H')) runout.host_handling = parser.value_bool(); #endif const bool seenR = parser.seen_test('R'), seenS = parser.seen('S'); if (seenR || seenS) runout.reset(); - if (seenS) runout.enabled = parser.value_bool(); - #if HAS_FILAMENT_RUNOUT_DISTANCE - if (parser.seenval('D')) runout.set_runout_distance(parser.value_linear_units()); - #endif + const uint8_t tool = TERN0(MULTI_FILAMENT_SENSOR, parser.ushortval('E', active_extruder)); + if (seenS) runout.enabled[tool] = parser.value_bool(); + if (parser.seen('D') || parser.seen('L')) runout.set_runout_distance(parser.value_linear_units(), tool); + if (parser.seen('P')) { + const RunoutMode tmp_mode = (RunoutMode)parser.value_int(); + switch (tmp_mode) { + case RM_NONE ... RM_OUT_ON_HIGH: + case RM_MOTION_SENSOR: + runout.mode[tool] = tmp_mode; + runout.setup(); + default: break; + } + } } else { SERIAL_ECHO_START(); SERIAL_ECHOPGM("Filament runout "); - serialprint_onoff(runout.enabled); - #if HAS_FILAMENT_RUNOUT_DISTANCE - SERIAL_ECHOPGM(" ; Distance ", runout.runout_distance(), "mm"); - #endif + serialprint_onoff(runout.enabled[active_extruder]); + SERIAL_ECHOPGM(" ; Distance ", runout.runout_distance(active_extruder), "mm"); + SERIAL_ECHOPGM(" ; Mode ", runout.mode[active_extruder]); #if ENABLED(HOST_ACTION_COMMANDS) SERIAL_ECHOPGM(" ; Host handling "); serialprint_onoff(runout.host_handling); @@ -66,18 +76,19 @@ void GcodeSuite::M412() { } } -void GcodeSuite::M412_report(const bool forReplay/*=true*/) { +void GcodeSuite::M591_report(const bool forReplay/*=true*/) { TERN_(MARLIN_SMALL_BUILD, return); - report_heading_etc(forReplay, F(STR_FILAMENT_RUNOUT_SENSOR)); - SERIAL_ECHOPGM( - " M412 S", runout.enabled - #if HAS_FILAMENT_RUNOUT_DISTANCE - , " D", LINEAR_UNIT(runout.runout_distance()) - #endif - , " ; Sensor " - ); - serialprintln_onoff(runout.enabled); + for(int e=0; e < NUM_RUNOUT_SENSORS; e++) + SERIAL_ECHOLNPGM( + " M591" + #if MULTI_FILAMENT_SENSOR + " E", e, + #endif + " S", runout.enabled[e] + , " D", LINEAR_UNIT(runout.runout_distance(e)) + , " P", runout.mode[e] + ); } #endif // HAS_FILAMENT_SENSOR diff --git a/Marlin/src/gcode/gcode.cpp b/Marlin/src/gcode/gcode.cpp index 2a8bfa4e66..0d501dcd30 100644 --- a/Marlin/src/gcode/gcode.cpp +++ b/Marlin/src/gcode/gcode.cpp @@ -947,6 +947,11 @@ void GcodeSuite::process_parsed_command(const bool no_ok/*=false*/) { case 575: M575(); break; // M575: Set serial baudrate #endif + #if HAS_FILAMENT_SENSOR + case 412: M412(); break; // Alias to M591 + case 591: M591(); break; // M591 Configure filament runout detection + #endif + #if ENABLED(NONLINEAR_EXTRUSION) case 592: M592(); break; // M592: Nonlinear Extrusion control #endif diff --git a/Marlin/src/gcode/gcode.h b/Marlin/src/gcode/gcode.h index bb2f009994..332d97650f 100644 --- a/Marlin/src/gcode/gcode.h +++ b/Marlin/src/gcode/gcode.h @@ -234,7 +234,6 @@ * M406 - Disable Filament Sensor flow control. (Requires FILAMENT_WIDTH_SENSOR) * M407 - Display measured filament diameter in millimeters. (Requires FILAMENT_WIDTH_SENSOR) * M410 - Quickstop. Abort all planned moves. - * M412 - Enable / Disable Filament Runout Detection. (Requires FILAMENT_RUNOUT_SENSOR) * M413 - Enable / Disable Power-Loss Recovery. (Requires POWER_LOSS_RECOVERY) * M414 - Set language by index. (Requires LCD_LANGUAGE_2...) * M420 - Enable/Disable Leveling (with current values) S1=enable S0=disable (Requires MESH_BED_LEVELING or ABL) @@ -260,7 +259,8 @@ * M554 - Get or set IP gateway. (Requires enabled Ethernet port) * M569 - Enable stealthChop on an axis. (Requires at least one _DRIVER_TYPE to be TMC2130/2160/2208/2209/5130/5160) * M575 - Change the serial baud rate. (Requires BAUD_RATE_GCODE) - * M592 - Get or set nonlinear extrusion parameters. (Requires NONLINEAR_EXTRUSION) + * M591 - Configure Filament Runout Detection. (Requires FILAMENT_RUNOUT_SENSOR) +* M592 - Get or set nonlinear extrusion parameters. (Requires NONLINEAR_EXTRUSION) * M593 - Get or set input shaping parameters. (Requires INPUT_SHAPING_[XY]) * M600 - Pause for filament change: "M600 X Y Z E L". (Requires ADVANCED_PAUSE_FEATURE) * M603 - Configure filament change: "M603 T U L". (Requires ADVANCED_PAUSE_FEATURE) @@ -1036,8 +1036,9 @@ private: #endif #if HAS_FILAMENT_SENSOR - static void M412(); - static void M412_report(const bool forReplay=true); + static void M412() { M591(); } + static void M591(); + static void M591_report(const bool forReplay=true); #endif #if HAS_MULTI_LANGUAGE diff --git a/Marlin/src/gcode/host/M115.cpp b/Marlin/src/gcode/host/M115.cpp index 0d38d3147b..043fdda5c3 100644 --- a/Marlin/src/gcode/host/M115.cpp +++ b/Marlin/src/gcode/host/M115.cpp @@ -154,7 +154,7 @@ void GcodeSuite::M115() { // AUTOLEVEL (G29) cap_line(F("AUTOLEVEL"), ENABLED(HAS_AUTOLEVEL)); - // RUNOUT (M412, M600) + // RUNOUT (M591, M600) cap_line(F("RUNOUT"), ENABLED(FILAMENT_RUNOUT_SENSOR)); // Z_PROBE (G30) diff --git a/Marlin/src/inc/Conditionals_LCD.h b/Marlin/src/inc/Conditionals_LCD.h index 573cfb0d3c..5fb1924c2b 100644 --- a/Marlin/src/inc/Conditionals_LCD.h +++ b/Marlin/src/inc/Conditionals_LCD.h @@ -1214,10 +1214,14 @@ * Fill in undefined Filament Sensor options */ #if ENABLED(FILAMENT_RUNOUT_SENSOR) + #define HAS_FILAMENT_SENSOR 1 + #ifndef NUM_RUNOUT_SENSORS + #define NUM_RUNOUT_SENSORS E_STEPPERS + #endif + #if ENABLED(MIXING_EXTRUDER) + #define WATCH_ALL_RUNOUT_SENSORS + #endif #if NUM_RUNOUT_SENSORS >= 1 - #ifndef FIL_RUNOUT1_STATE - #define FIL_RUNOUT1_STATE FIL_RUNOUT_STATE - #endif #ifndef FIL_RUNOUT1_PULLUP #define FIL_RUNOUT1_PULLUP FIL_RUNOUT_PULLUP #endif @@ -1226,9 +1230,7 @@ #endif #endif #if NUM_RUNOUT_SENSORS >= 2 - #ifndef FIL_RUNOUT2_STATE - #define FIL_RUNOUT2_STATE FIL_RUNOUT_STATE - #endif + #define MULTI_FILAMENT_SENSOR 1 #ifndef FIL_RUNOUT2_PULLUP #define FIL_RUNOUT2_PULLUP FIL_RUNOUT_PULLUP #endif @@ -1237,9 +1239,6 @@ #endif #endif #if NUM_RUNOUT_SENSORS >= 3 - #ifndef FIL_RUNOUT3_STATE - #define FIL_RUNOUT3_STATE FIL_RUNOUT_STATE - #endif #ifndef FIL_RUNOUT3_PULLUP #define FIL_RUNOUT3_PULLUP FIL_RUNOUT_PULLUP #endif @@ -1248,9 +1247,6 @@ #endif #endif #if NUM_RUNOUT_SENSORS >= 4 - #ifndef FIL_RUNOUT4_STATE - #define FIL_RUNOUT4_STATE FIL_RUNOUT_STATE - #endif #ifndef FIL_RUNOUT4_PULLUP #define FIL_RUNOUT4_PULLUP FIL_RUNOUT_PULLUP #endif @@ -1259,9 +1255,6 @@ #endif #endif #if NUM_RUNOUT_SENSORS >= 5 - #ifndef FIL_RUNOUT5_STATE - #define FIL_RUNOUT5_STATE FIL_RUNOUT_STATE - #endif #ifndef FIL_RUNOUT5_PULLUP #define FIL_RUNOUT5_PULLUP FIL_RUNOUT_PULLUP #endif @@ -1270,9 +1263,6 @@ #endif #endif #if NUM_RUNOUT_SENSORS >= 6 - #ifndef FIL_RUNOUT6_STATE - #define FIL_RUNOUT6_STATE FIL_RUNOUT_STATE - #endif #ifndef FIL_RUNOUT6_PULLUP #define FIL_RUNOUT6_PULLUP FIL_RUNOUT_PULLUP #endif @@ -1281,9 +1271,6 @@ #endif #endif #if NUM_RUNOUT_SENSORS >= 7 - #ifndef FIL_RUNOUT7_STATE - #define FIL_RUNOUT7_STATE FIL_RUNOUT_STATE - #endif #ifndef FIL_RUNOUT7_PULLUP #define FIL_RUNOUT7_PULLUP FIL_RUNOUT_PULLUP #endif @@ -1292,9 +1279,6 @@ #endif #endif #if NUM_RUNOUT_SENSORS >= 8 - #ifndef FIL_RUNOUT8_STATE - #define FIL_RUNOUT8_STATE FIL_RUNOUT_STATE - #endif #ifndef FIL_RUNOUT8_PULLUP #define FIL_RUNOUT8_PULLUP FIL_RUNOUT_PULLUP #endif @@ -1909,6 +1893,30 @@ #define HAS_LED_POWEROFF_TIMEOUT 1 #endif +/*** TEMPORARY COMPATIBILITY ***/ + +#if HAS_FILAMENT_SENSOR + #ifndef FIL_RUNOUT_ENABLED + #if FIL_RUNOUT_ENABLED_DEFAULT + #define FIL_RUNOUT_ENABLED ARRAY_N_1(NUM_RUNOUT_SENSORS, true) + #else + #define FIL_RUNOUT_ENABLED ARRAY_N_1(NUM_RUNOUT_SENSORS, false) + #endif + #endif + #ifndef FIL_RUNOUT_MODE + #if FIL_RUNOUT_STATE + #define FIL_RUNOUT_MODE ARRAY_N_1(NUM_RUNOUT_SENSORS, 1) + #else + #define FIL_RUNOUT_MODE ARRAY_N_1(NUM_RUNOUT_SENSORS, 2) + #endif + #endif + #ifndef FIL_RUNOUT_DISTANCE_MM + #define FIL_RUNOUT_DISTANCE_MM ARRAY_N_1(NUM_RUNOUT_SENSORS, 10) + #endif + #undef FIL_RUNOUT_ENABLED_DEFAULT + #undef FIL_RUNOUT_STATE + #undef FILAMENT_RUNOUT_DISTANCE_MM +#endif #if ALL(SPI_FLASH, HAS_MEDIA, MARLIN_DEV_MODE) #define SPI_FLASH_BACKUP 1 #endif diff --git a/Marlin/src/inc/Conditionals_adv.h b/Marlin/src/inc/Conditionals_adv.h index ef0b18e4b7..0ea4a308d3 100644 --- a/Marlin/src/inc/Conditionals_adv.h +++ b/Marlin/src/inc/Conditionals_adv.h @@ -840,9 +840,6 @@ #if NUM_RUNOUT_SENSORS > 1 #define MULTI_FILAMENT_SENSOR 1 #endif - #ifdef FILAMENT_RUNOUT_DISTANCE_MM - #define HAS_FILAMENT_RUNOUT_DISTANCE 1 - #endif #if ENABLED(MIXING_EXTRUDER) #define WATCH_ALL_RUNOUT_SENSORS #endif diff --git a/Marlin/src/inc/SanityCheck.h b/Marlin/src/inc/SanityCheck.h index 6b9deef84d..cb26fa37fe 100644 --- a/Marlin/src/inc/SanityCheck.h +++ b/Marlin/src/inc/SanityCheck.h @@ -541,10 +541,71 @@ static_assert(COUNT(arm) == LOGICAL_AXES, "AXIS_RELATIVE_MODES must contain " _L #error "You can't enable FIL_RUNOUT7_PULLUP and FIL_RUNOUT7_PULLDOWN at the same time." #elif ALL(FIL_RUNOUT8_PULLUP, FIL_RUNOUT8_PULLDOWN) #error "You can't enable FIL_RUNOUT8_PULLUP and FIL_RUNOUT8_PULLDOWN at the same time." - #elif FILAMENT_RUNOUT_DISTANCE_MM < 0 - #error "FILAMENT_RUNOUT_DISTANCE_MM must be greater than or equal to zero." #elif DISABLED(ADVANCED_PAUSE_FEATURE) && defined(FILAMENT_RUNOUT_SCRIPT) static_assert(nullptr == strstr(FILAMENT_RUNOUT_SCRIPT, "M600"), "FILAMENT_RUNOUT_SCRIPT cannot make use of M600 unless ADVANCED_PAUSE_FEATURE is enabled"); + #elif defined(FIL_RUNOUT_ENABLED_DEFAULT) + #error "FIL_RUNOUT_ENABLED_DEFAULT is now set with the FILAMENT_RUNOUT_ENABLED array." + #elif defined(FILAMENT_RUNOUT_DISTANCE_MM) + #error "FILAMENT_RUNOUT_DISTANCE_MM is now set with the FIL_RUNOUT_DISTANCE_MM array." + #elif defined(FIL_RUNOUT_STATE) || defined(FIL_RUNOUT2_STATE) || defined(FIL_RUNOUT3_STATE) || defined(FIL_RUNOUT4_STATE) || defined(FIL_RUNOUT5_STATE) || defined(FIL_RUNOUT6_STATE) || defined(FIL_RUNOUT7_STATE) || defined(FIL_RUNOUT8_STATE) + #ifdef FIL_RUNOUT_STATE + #if FIL_RUNOUT_STATE + #error "FIL_RUNOUT_STATE HIGH is now set with FIL_RUNOUT_MODE { 2 ... }." + #else + #error "FIL_RUNOUT_STATE LOW is now set with FIL_RUNOUT_MODE { 1 ... }." + #endif + #endif + #ifdef FIL_RUNOUT2_STATE + #if FIL_RUNOUT2_STATE + #error "FIL_RUNOUT2_STATE HIGH is now set with FIL_RUNOUT_MODE { n, 2 ... }." + #else + #error "FIL_RUNOUT2_STATE LOW is now set with FIL_RUNOUT_MODE { n, 1 ... }." + #endif + #endif + #ifdef FIL_RUNOUT3_STATE + #if FIL_RUNOUT3_STATE + #error "FIL_RUNOUT3_STATE HIGH is now set with FIL_RUNOUT_MODE { n, n, 2 ... }." + #else + #error "FIL_RUNOUT3_STATE LOW is now set with FIL_RUNOUT_MODE { n, n, 1 ... }." + #endif + #endif + #ifdef FIL_RUNOUT4_STATE + #if FIL_RUNOUT4_STATE + #error "FIL_RUNOUT4_STATE HIGH is now set with FIL_RUNOUT_MODE { n, n, n, 2 ... }." + #else + #error "FIL_RUNOUT4_STATE LOW is now set with FIL_RUNOUT_MODE { n, n, n, 1 ... }." + #endif + #endif + #ifdef FIL_RUNOUT5_STATE + #if FIL_RUNOUT5_STATE + #error "FIL_RUNOUT5_STATE HIGH is now set with FIL_RUNOUT_MODE { n, n, n, n, 2 ... }." + #else + #error "FIL_RUNOUT5_STATE LOW is now set with FIL_RUNOUT_MODE { n, n, n, n, 1 ... }." + #endif + #endif + #ifdef FIL_RUNOUT6_STATE + #if FIL_RUNOUT6_STATE + #error "FIL_RUNOUT6_STATE HIGH is now set with FIL_RUNOUT_MODE { n, n, n, n, n, 2 ... }." + #else + #error "FIL_RUNOUT6_STATE LOW is now set with FIL_RUNOUT_MODE { n, n, n, n, n, 1 ... }." + #endif + #endif + #ifdef FIL_RUNOUT7_STATE + #if FIL_RUNOUT7_STATE + #error "FIL_RUNOUT7_STATE HIGH is now set with FIL_RUNOUT_MODE { n, n, n, n, n, n, 2 ... }." + #else + #error "FIL_RUNOUT7_STATE LOW is now set with FIL_RUNOUT_MODE { n, n, n, n, n, n, 1 ... }." + #endif + #endif + #ifdef FIL_RUNOUT8_STATE + #if FIL_RUNOUT8_STATE + #error "FIL_RUNOUT8_STATE HIGH is now set with FIL_RUNOUT_MODE { n, n, n, n, n, n, n, 2 ... }." + #else + #error "FIL_RUNOUT8_STATE LOW is now set with FIL_RUNOUT_MODE { n, n, n, n, n, n, n, 1 ... }." + #endif + #endif + #elif ENABLED(FILAMENT_MOTION_SENSOR) + #error "FILAMENT_MOTION_SENSOR is now set with FIL_RUNOUT_MODE { 7 ... }." #endif #endif diff --git a/Marlin/src/lcd/e3v2/jyersui/dwin.cpp b/Marlin/src/lcd/e3v2/jyersui/dwin.cpp index 2edc03dfd6..205f945c69 100644 --- a/Marlin/src/lcd/e3v2/jyersui/dwin.cpp +++ b/Marlin/src/lcd/e3v2/jyersui/dwin.cpp @@ -2957,11 +2957,11 @@ void JyersDWIN::menuItemHandler(const uint8_t menu, const uint8_t item, bool dra case ADVANCED_FILSENSORENABLED: if (draw) { drawMenuItem(row, ICON_Extruder, GET_TEXT_F(MSG_RUNOUT_SENSOR)); - drawCheckbox(row, runout.enabled); + drawCheckbox(row, runout.enabled[0]); } else { runout.enabled ^= true; - drawCheckbox(row, runout.enabled); + drawCheckbox(row, runout.enabled[0]); } break; @@ -3954,11 +3954,11 @@ void JyersDWIN::menuItemHandler(const uint8_t menu, const uint8_t item, bool dra case TUNE_FILSENSORENABLED: if (draw) { drawMenuItem(row, ICON_Extruder, GET_TEXT_F(MSG_RUNOUT_SENSOR)); - drawCheckbox(row, runout.enabled); + drawCheckbox(row, runout.enabled[0]); } else { - runout.enabled ^= true; - drawCheckbox(row, runout.enabled); + runout.enabled[0] ^= true; + drawCheckbox(row, runout.enabled[0]); } break; #endif diff --git a/Marlin/src/lcd/e3v2/proui/dwin.cpp b/Marlin/src/lcd/e3v2/proui/dwin.cpp index 2b691326c0..cdd9a6260a 100644 --- a/Marlin/src/lcd/e3v2/proui/dwin.cpp +++ b/Marlin/src/lcd/e3v2/proui/dwin.cpp @@ -2321,7 +2321,7 @@ void setMoveZ() { hmiValue.axis = Z_AXIS; setPFloatOnClick(Z_MIN_POS, Z_MAX_POS, #if HAS_FILAMENT_SENSOR void setRunoutEnable() { runout.reset(); - toggleCheckboxLine(runout.enabled); + toggleCheckboxLine(runout.enabled[0]); } #if HAS_FILAMENT_RUNOUT_DISTANCE void applyRunoutDistance() { runout.set_runout_distance(menuData.value / MINUNITMULT); } @@ -3318,7 +3318,7 @@ void drawFilSetMenu() { if (SET_MENU(filSetMenu, MSG_FILAMENT_SET, 9)) { BACK_ITEM(drawAdvancedSettingsMenu); #if HAS_FILAMENT_SENSOR - EDIT_ITEM(ICON_Runout, MSG_RUNOUT_SENSOR, onDrawChkbMenu, setRunoutEnable, &runout.enabled); + EDIT_ITEM(ICON_Runout, MSG_RUNOUT_SENSOR, onDrawChkbMenu, setRunoutEnable, &runout.enabled[0]); #endif #if HAS_FILAMENT_RUNOUT_DISTANCE EDIT_ITEM(ICON_Runout, MSG_RUNOUT_DISTANCE_MM, onDrawPFloatMenu, setRunoutDistance, &runout.runout_distance()); @@ -3409,7 +3409,7 @@ void drawTuneMenu() { MENU_ITEM(ICON_FilMan, MSG_FILAMENTCHANGE, onDrawMenuItem, changeFilament); #endif #if HAS_FILAMENT_SENSOR - EDIT_ITEM(ICON_Runout, MSG_RUNOUT_SENSOR, onDrawChkbMenu, setRunoutEnable, &runout.enabled); + EDIT_ITEM(ICON_Runout, MSG_RUNOUT_SENSOR, onDrawChkbMenu, setRunoutEnable, &runout.enabled[0]); #endif #if ENABLED(PROUI_ITEM_PLR) EDIT_ITEM(ICON_Pwrlossr, MSG_OUTAGE_RECOVERY, onDrawChkbMenu, setPwrLossr, &recovery.enabled); diff --git a/Marlin/src/lcd/e3v2/proui/endstop_diag.cpp b/Marlin/src/lcd/e3v2/proui/endstop_diag.cpp index 83b084ab0d..be606a5526 100644 --- a/Marlin/src/lcd/e3v2/proui/endstop_diag.cpp +++ b/Marlin/src/lcd/e3v2/proui/endstop_diag.cpp @@ -86,7 +86,7 @@ void ESDiag::update() { TERN_(USE_X_MIN, ES_REPORT(X_MIN)); TERN_(USE_X_MAX, ES_REPORT(X_MAX)); TERN_(USE_Y_MIN, ES_REPORT(Y_MIN)); TERN_(USE_Y_MAX, ES_REPORT(Y_MAX)); TERN_(USE_Z_MIN, ES_REPORT(Z_MIN)); TERN_(USE_Z_MAX, ES_REPORT(Z_MAX)); - TERN_(HAS_FILAMENT_SENSOR, draw_es_state(READ(FIL_RUNOUT1_PIN) != FIL_RUNOUT1_STATE)); + TERN_(HAS_FILAMENT_SENSOR, draw_es_state(READ(FIL_RUNOUT1_PIN) != runout.out_state()); dwinUpdateLCD(); } diff --git a/Marlin/src/lcd/extui/ftdi_eve_touch_ui/generic/endstop_state_screen.cpp b/Marlin/src/lcd/extui/ftdi_eve_touch_ui/generic/endstop_state_screen.cpp index 6105591d15..ced37d2626 100644 --- a/Marlin/src/lcd/extui/ftdi_eve_touch_ui/generic/endstop_state_screen.cpp +++ b/Marlin/src/lcd/extui/ftdi_eve_touch_ui/generic/endstop_state_screen.cpp @@ -85,12 +85,12 @@ void EndstopStatesScreen::onRedraw(draw_mode_t) { PIN_DISABLED(5, 3, PSTR(STR_Z_MIN), Z_MIN) #endif #if ENABLED(FILAMENT_RUNOUT_SENSOR) && PIN_EXISTS(FIL_RUNOUT) - PIN_ENABLED (1, 4, GET_TEXT_F(MSG_RUNOUT_1), FIL_RUNOUT, FIL_RUNOUT1_STATE) + PIN_ENABLED (1, 4, GET_TEXT_F(MSG_RUNOUT_1), FIL_RUNOUT, !runout.out_state()) #else PIN_DISABLED(1, 4, GET_TEXT_F(MSG_RUNOUT_1), FIL_RUNOUT) #endif #if ALL(HAS_MULTI_EXTRUDER, FILAMENT_RUNOUT_SENSOR) && PIN_EXISTS(FIL_RUNOUT2) - PIN_ENABLED (3, 4, GET_TEXT_F(MSG_RUNOUT_2), FIL_RUNOUT2, FIL_RUNOUT2_STATE) + PIN_ENABLED (3, 4, GET_TEXT_F(MSG_RUNOUT_2), FIL_RUNOUT2, !runout.out_state(1)) #else PIN_DISABLED(3, 4, GET_TEXT_F(MSG_RUNOUT_2), FIL_RUNOUT2) #endif diff --git a/Marlin/src/lcd/extui/ftdi_eve_touch_ui/generic/filament_runout_screen.cpp b/Marlin/src/lcd/extui/ftdi_eve_touch_ui/generic/filament_runout_screen.cpp index 0569b90032..a885d69cf5 100644 --- a/Marlin/src/lcd/extui/ftdi_eve_touch_ui/generic/filament_runout_screen.cpp +++ b/Marlin/src/lcd/extui/ftdi_eve_touch_ui/generic/filament_runout_screen.cpp @@ -34,27 +34,22 @@ void FilamentRunoutScreen::onRedraw(draw_mode_t what) { w.heading( GET_TEXT_F(MSG_FILAMENT)); w.toggle( 2, GET_TEXT_F(MSG_RUNOUT_SENSOR), getFilamentRunoutEnabled()); - #if HAS_FILAMENT_RUNOUT_DISTANCE - w.heading(GET_TEXT_F(MSG_RUNOUT_DISTANCE_MM)); - w.units(GET_TEXT_F(MSG_UNITS_MM)); - w.precision(0); - w.color(e_axis); - w.adjuster( 10, FPSTR(NUL_STR), getFilamentRunoutDistance_mm(), getFilamentRunoutEnabled()); - w.increments(); - #endif + w.heading(GET_TEXT_F(MSG_RUNOUT_DISTANCE_MM)); + w.units(GET_TEXT_F(MSG_UNITS_MM)); + w.precision(0); + w.color(e_axis); + w.adjuster( 10, FPSTR(NUL_STR), getFilamentRunoutDistance_mm(), getFilamentRunoutEnabled()); + w.increments(); + } bool FilamentRunoutScreen::onTouchHeld(uint8_t tag) { using namespace ExtUI; - #if HAS_FILAMENT_RUNOUT_DISTANCE - const float increment = getIncrement(); - #endif + const float increment = getIncrement(); switch (tag) { case 2: setFilamentRunoutEnabled(!getFilamentRunoutEnabled()); break; - #if HAS_FILAMENT_RUNOUT_DISTANCE - case 10: UI_DECREMENT(FilamentRunoutDistance_mm); break; - case 11: UI_INCREMENT(FilamentRunoutDistance_mm); break; - #endif + case 10: UI_DECREMENT(FilamentRunoutDistance_mm); break; + case 11: UI_INCREMENT(FilamentRunoutDistance_mm); break; default: return false; } diff --git a/Marlin/src/lcd/extui/ui_api.cpp b/Marlin/src/lcd/extui/ui_api.cpp index d89a09d8ad..d4dbd1401f 100644 --- a/Marlin/src/lcd/extui/ui_api.cpp +++ b/Marlin/src/lcd/extui/ui_api.cpp @@ -722,15 +722,22 @@ namespace ExtUI { } #if HAS_FILAMENT_SENSOR - bool getFilamentRunoutEnabled() { return runout.enabled; } - void setFilamentRunoutEnabled(const bool value) { runout.enabled = value; } + bool getFilamentRunoutEnabled(const extruder_t extruder/*=E0*/) { return (runout.enabled[extruder] && (runout.mode[extruder]!=0)); } + void setFilamentRunoutEnabled(const bool value, const extruder_t extruder/*=E0*/) { runout.enabled[extruder] = value; } bool getFilamentRunoutState() { return runout.filament_ran_out; } void setFilamentRunoutState(const bool value) { runout.filament_ran_out = value; } + float getFilamentRunoutDistance_mm() { return runout.runout_distance(); } + void setFilamentRunoutDistance_mm(const_float_t value) { runout.set_runout_distance(constrain(value, 0, 999)); } + int getRunoutMode(const extruder_t extruder/*=E0*/){ + return (int)runout.mode[extruder]; + } + void setRunoutMode(const int mode, const extruder_t extruder/*=E0*/){ + if((mode >= 0 && mode <=2) || mode==7) { + runout.mode[extruder] = (RunoutMode)mode; + runout.setup(); + } + } - #if HAS_FILAMENT_RUNOUT_DISTANCE - float getFilamentRunoutDistance_mm() { return runout.runout_distance(); } - void setFilamentRunoutDistance_mm(const_float_t value) { runout.set_runout_distance(constrain(value, 0, 999)); } - #endif #endif #if ENABLED(CASE_LIGHT_ENABLE) diff --git a/Marlin/src/lcd/extui/ui_api.h b/Marlin/src/lcd/extui/ui_api.h index 638f8d88b8..61b5c09f14 100644 --- a/Marlin/src/lcd/extui/ui_api.h +++ b/Marlin/src/lcd/extui/ui_api.h @@ -394,15 +394,14 @@ namespace ExtUI { // Filament Runout Sensor #if HAS_FILAMENT_SENSOR - bool getFilamentRunoutEnabled(); - void setFilamentRunoutEnabled(const bool); + bool getFilamentRunoutEnabled(const extruder_t extruder=E0); + void setFilamentRunoutEnabled(const bool, const extruder_t extruder=E0); bool getFilamentRunoutState(); void setFilamentRunoutState(const bool); - - #if HAS_FILAMENT_RUNOUT_DISTANCE - float getFilamentRunoutDistance_mm(); - void setFilamentRunoutDistance_mm(const_float_t); - #endif + float getFilamentRunoutDistance_mm(); + void setFilamentRunoutDistance_mm(const_float_t); + int getRunoutMode(const extruder_t extruder=E0); + void setRunoutMode(const int, const extruder_t extruder=E0); #endif // Case Light Control diff --git a/Marlin/src/lcd/language/language_en.h b/Marlin/src/lcd/language/language_en.h index f30b29dd4e..f4554e1d22 100644 --- a/Marlin/src/lcd/language/language_en.h +++ b/Marlin/src/lcd/language/language_en.h @@ -719,6 +719,14 @@ namespace LanguageNarrow_en { LSTR MSG_FILAMENT_CHANGE_NOZZLE = _UxGT(" Nozzle: "); LSTR MSG_RUNOUT_SENSOR = _UxGT("Runout Sensor"); LSTR MSG_RUNOUT_DISTANCE_MM = _UxGT("Runout Dist mm"); + LSTR MSG_RUNOUT_MODE = _UxGT("Runout Mode"); + LSTR MSG_RUNOUT_MODE_HIGH = _UxGT("Sensor High"); + LSTR MSG_RUNOUT_MODE_LOW = _UxGT("Sensor Low"); + LSTR MSG_RUNOUT_MODE_MOTION = _UxGT("Motion Encoder"); + LSTR MSG_RUNOUT_MODE_NONE = _UxGT("No Sensor"); + LSTR MSG_RUNOUT_ENABLE = _UxGT("Enable Runout"); + LSTR MSG_RUNOUT_ACTIVE = _UxGT("Runout Active"); + LSTR MSG_INVERT_EXTRUDER = _UxGT("Invert Extruder"); LSTR MSG_EXTRUDER_MIN_TEMP = _UxGT("Extruder Min Temp."); // ProUI LSTR MSG_FANCHECK = _UxGT("Fan Tacho Check"); LSTR MSG_KILL_HOMING_FAILED = _UxGT("Homing Failed"); diff --git a/Marlin/src/lcd/menu/menu_advanced.cpp b/Marlin/src/lcd/menu/menu_advanced.cpp index 903c857f59..3996a99764 100644 --- a/Marlin/src/lcd/menu/menu_advanced.cpp +++ b/Marlin/src/lcd/menu/menu_advanced.cpp @@ -45,7 +45,7 @@ #include "../../module/temperature.h" #endif -#if HAS_FILAMENT_RUNOUT_DISTANCE +#if HAS_FILAMENT_SENSOR #include "../../feature/runout.h" #endif @@ -99,6 +99,54 @@ void menu_backlash(); #endif +#if HAS_FILAMENT_SENSOR + + void set_runout_mode_none(const uint8_t e) { runout.mode[e] = RM_NONE; runout.setup(); } + void set_runout_mode_high(const uint8_t e) { runout.mode[e] = RM_OUT_ON_HIGH; runout.setup(); } + void set_runout_mode_low(const uint8_t e) { runout.mode[e] = RM_OUT_ON_LOW; runout.setup(); } + void set_runout_mode_motion(const uint8_t e) { runout.mode[e] = RM_MOTION_SENSOR; runout.setup(); } + + #define RUNOUT_EDIT_ITEMS(F) do{ \ + EDIT_ITEM(bool, MSG_RUNOUT_SENSOR, &runout.enabled[F]); \ + ACTION_ITEM(MSG_RUNOUT_MODE_NONE, []{ set_runout_mode_none(F); }); \ + ACTION_ITEM(MSG_RUNOUT_MODE_HIGH, []{ set_runout_mode_high(F); }); \ + ACTION_ITEM(MSG_RUNOUT_MODE_LOW, []{ set_runout_mode_low(F); }); \ + ACTION_ITEM(MSG_RUNOUT_MODE_MOTION, []{ set_runout_mode_motion(F); }); \ + editable.decimal = runout.runout_distance(F); \ + EDIT_ITEM_FAST(float3, MSG_RUNOUT_DISTANCE_MM, &editable.decimal, 1, 999, \ + []{ runout.set_runout_distance(editable.decimal, F); }, true \ + ); \ + }while(0) + + void menu_runout_config() { + START_MENU(); + BACK_ITEM(MSG_CONFIGURATION); + RUNOUT_EDIT_ITEMS(0); + #if NUM_RUNOUT_SENSORS > 1 + RUNOUT_EDIT_ITEMS(1); + #endif + #if NUM_RUNOUT_SENSORS > 2 + RUNOUT_EDIT_ITEMS(2); + #endif + #if NUM_RUNOUT_SENSORS > 3 + RUNOUT_EDIT_ITEMS(3); + #endif + #if NUM_RUNOUT_SENSORS > 4 + RUNOUT_EDIT_ITEMS(4); + #endif + #if NUM_RUNOUT_SENSORS > 5 + RUNOUT_EDIT_ITEMS(5); + #endif + #if NUM_RUNOUT_SENSORS > 6 + RUNOUT_EDIT_ITEMS(6); + #endif + #if NUM_RUNOUT_SENSORS > 7 + RUNOUT_EDIT_ITEMS(7); + #endif + END_MENU(); + } +#endif + #if DISABLED(NO_VOLUMETRICS) || ENABLED(ADVANCED_PAUSE_FEATURE) // // Advanced Settings > Filament @@ -152,11 +200,8 @@ void menu_backlash(); #endif #endif - #if HAS_FILAMENT_RUNOUT_DISTANCE - editable.decimal = runout.runout_distance(); - EDIT_ITEM_FAST(float3, MSG_RUNOUT_DISTANCE_MM, &editable.decimal, 1, 999, - []{ runout.set_runout_distance(editable.decimal); }, true - ); + #if HAS_FILAMENT_SENSOR + SUBMENU(MSG_RUNOUT_MODE, menu_runout_config); #endif END_MENU(); diff --git a/Marlin/src/lcd/menu/menu_configuration.cpp b/Marlin/src/lcd/menu/menu_configuration.cpp index bd5ed492a1..d5fca1f60a 100644 --- a/Marlin/src/lcd/menu/menu_configuration.cpp +++ b/Marlin/src/lcd/menu/menu_configuration.cpp @@ -634,7 +634,7 @@ void menu_configuration() { #endif #if HAS_FILAMENT_SENSOR - EDIT_ITEM(bool, MSG_RUNOUT_SENSOR, &runout.enabled, runout.reset); + EDIT_ITEM(bool, MSG_RUNOUT_SENSOR, &runout.enabled[active_extruder], runout.reset); #endif #if HAS_FANCHECK diff --git a/Marlin/src/lcd/menu/menu_filament.cpp b/Marlin/src/lcd/menu/menu_filament.cpp index 46ebf85ba4..37041e26ae 100644 --- a/Marlin/src/lcd/menu/menu_filament.cpp +++ b/Marlin/src/lcd/menu/menu_filament.cpp @@ -250,12 +250,6 @@ static FSTR_P pause_header() { }while(0) void menu_pause_option() { - #if HAS_FILAMENT_SENSOR - const bool still_out = runout.filament_ran_out; - #else - constexpr bool still_out = false; - #endif - START_MENU(); #if LCD_HEIGHT > 2 STATIC_ITEM(MSG_FILAMENT_CHANGE_OPTION_HEADER); @@ -263,8 +257,11 @@ void menu_pause_option() { ACTION_ITEM(MSG_FILAMENT_CHANGE_OPTION_PURGE, []{ pause_menu_response = PAUSE_RESPONSE_EXTRUDE_MORE; }); #if HAS_FILAMENT_SENSOR + const bool still_out = runout.filament_ran_out; if (still_out) - EDIT_ITEM(bool, MSG_RUNOUT_SENSOR, &runout.enabled, runout.reset); + EDIT_ITEM(bool, MSG_RUNOUT_SENSOR, &runout.enabled[active_extruder], runout.reset); + #else + constexpr bool still_out = false; #endif if (!still_out) diff --git a/Marlin/src/module/endstops.cpp b/Marlin/src/module/endstops.cpp index e9aafa49c8..bacc189a8e 100644 --- a/Marlin/src/module/endstops.cpp +++ b/Marlin/src/module/endstops.cpp @@ -504,22 +504,36 @@ void __O2 Endstops::report_states() { #if USE_CALIBRATION print_es_state(READ(CALIBRATION_PIN) != CALIBRATION_PIN_INVERTING, F(STR_CALIBRATION)); #endif - #if MULTI_FILAMENT_SENSOR + #if HAS_FILAMENT_SENSOR #define _CASE_RUNOUT(N) case N: pin = FIL_RUNOUT##N##_PIN; state = FIL_RUNOUT##N##_STATE; break; for (uint8_t i = 1; i <= NUM_RUNOUT_SENSORS; ++i) { pin_t pin; - uint8_t state; switch (i) { default: continue; + #define _CASE_RUNOUT(N) case N: pin = FIL_RUNOUT##N##_PIN; break; REPEAT_1(NUM_RUNOUT_SENSORS, _CASE_RUNOUT) + #undef _CASE_RUNOUT } - SERIAL_ECHOPGM(STR_FILAMENT); - if (i > 1) SERIAL_CHAR(' ', '0' + i); - print_es_state(extDigitalRead(pin) != state); + const RunoutMode rm = runout.mode[i - 1]; + const uint8_t outval = runout.out_state(i - 1); + + #if DISABLED(SLIM_LCD_MENUS) + SERIAL_ECHOPGM(STR_FILAMENT); + if (i > 1) SERIAL_CHAR(' ', '0' + i); + SERIAL_ECHOPGM(": "); + if (rm == RM_NONE) + SERIAL_ECHOLNPGM(STR_OFF); + else if (rm == RM_MOTION_SENSOR) { + SERIAL_ECHOPGM("MOTION : "); + print_es_state(extDigitalRead(pin) == outval); + } + else + SERIAL_ECHOLNPGM_P(extDigitalRead(pin) == outval ? PSTR("OUT") : PSTR("PRESENT")); + #else + print_es_state(extDigitalRead(pin) == outval, F(STR_FILAMENT)); + #endif } - #undef _CASE_RUNOUT - #elif HAS_FILAMENT_SENSOR - print_es_state(READ(FIL_RUNOUT1_PIN) != FIL_RUNOUT1_STATE, F(STR_FILAMENT)); + #endif TERN_(BLTOUCH, bltouch._reset_SW_mode()); diff --git a/Marlin/src/module/settings.cpp b/Marlin/src/module/settings.cpp index a553d56745..41001c8e1d 100644 --- a/Marlin/src/module/settings.cpp +++ b/Marlin/src/module/settings.cpp @@ -116,9 +116,6 @@ #if HAS_FILAMENT_SENSOR #include "../feature/runout.h" - #ifndef FIL_RUNOUT_ENABLED_DEFAULT - #define FIL_RUNOUT_ENABLED_DEFAULT true - #endif #endif #if ENABLED(ADVANCE_K_EXTRA) @@ -249,8 +246,11 @@ typedef struct SettingsDataStruct { // // FILAMENT_RUNOUT_SENSOR // - bool runout_sensor_enabled; // M412 S - float runout_distance_mm; // M412 D + #if HAS_FILAMENT_SENSOR + bool runout_enabled[NUM_RUNOUT_SENSORS]; // M591 S + float runout_distance_mm[NUM_RUNOUT_SENSORS]; // M591 D + uint8_t runout_mode[NUM_RUNOUT_SENSORS]; // M591 P + #endif // // ENABLE_LEVELING_FADE_HEIGHT @@ -1955,22 +1955,26 @@ void MarlinSettings::postprocess() { // // Filament Runout Sensor // + #if HAS_FILAMENT_SENSOR { - int8_t runout_sensor_enabled; - _FIELD_TEST(runout_sensor_enabled); - EEPROM_READ(runout_sensor_enabled); - #if HAS_FILAMENT_SENSOR - if (!validating) runout.enabled = runout_sensor_enabled < 0 ? FIL_RUNOUT_ENABLED_DEFAULT : runout_sensor_enabled; - #endif + bool runout_enabled[NUM_RUNOUT_SENSORS]; + float runout_distance_mm[NUM_RUNOUT_SENSORS]; + RunoutMode runout_mode[NUM_RUNOUT_SENSORS]; - TERN_(HAS_FILAMENT_SENSOR, if (runout.enabled) runout.reset()); - - float runout_distance_mm; + EEPROM_READ(runout_enabled); EEPROM_READ(runout_distance_mm); - #if HAS_FILAMENT_RUNOUT_DISTANCE - if (!validating) runout.set_runout_distance(runout_distance_mm); - #endif + EEPROM_READ(runout_mode); + + if (!validating) { + for(uint8_t e=0; e < NUM_RUNOUT_SENSORS; ++e) { + runout.enabled[e] = runout_enabled[e]; + runout.set_runout_distance(runout_distance_mm[e], e); + runout.mode[e] = runout_mode[e]; + } + runout.reset(); + } } + #endif // // Global Leveling @@ -3235,9 +3239,16 @@ void MarlinSettings::reset() { // #if HAS_FILAMENT_SENSOR - runout.enabled = FIL_RUNOUT_ENABLED_DEFAULT; + constexpr bool fred[] = FIL_RUNOUT_ENABLED; + constexpr uint8_t frm[] = FIL_RUNOUT_MODE; + constexpr float frd[] = FIL_RUNOUT_DISTANCE_MM; + static_assert(COUNT(fred) == NUM_RUNOUT_SENSORS, "FIL_RUNOUT_ENABLED must have NUM_RUNOUT_SENSORS values."); + static_assert(COUNT(frm) == NUM_RUNOUT_SENSORS, "FIL_RUNOUT_MODE must have NUM_RUNOUT_SENSORS values."); + static_assert(COUNT(frd) == NUM_RUNOUT_SENSORS, "FIL_RUNOUT_DISTANCE_MM must have NUM_RUNOUT_SENSORS values."); + COPY(runout.enabled, fred); + COPY(runout.mode, frm); + for(uint8_t e = 0; e < NUM_RUNOUT_SENSORS; ++e) runout.set_runout_distance(frd[e], e); runout.reset(); - TERN_(HAS_FILAMENT_RUNOUT_DISTANCE, runout.set_runout_distance(FILAMENT_RUNOUT_DISTANCE_MM)); #endif // @@ -4042,7 +4053,7 @@ void MarlinSettings::reset() { // // Filament Runout Sensor // - TERN_(HAS_FILAMENT_SENSOR, gcode.M412_report(forReplay)); + TERN_(HAS_FILAMENT_SENSOR, gcode.M591_report(forReplay)); #if HAS_ETHERNET CONFIG_ECHO_HEADING("Ethernet"); diff --git a/Marlin/src/module/stepper.cpp b/Marlin/src/module/stepper.cpp index f5a9f6d0a8..2e72b65491 100644 --- a/Marlin/src/module/stepper.cpp +++ b/Marlin/src/module/stepper.cpp @@ -128,7 +128,7 @@ Stepper stepper; // Singleton #include "../feature/mixing.h" #endif -#if HAS_FILAMENT_RUNOUT_DISTANCE +#if HAS_FILAMENT_SENSOR #include "../feature/runout.h" #endif @@ -2428,7 +2428,7 @@ hal_timer_t Stepper::block_phase_isr() { PAGE_SEGMENT_UPDATE_POS(E); } #endif - TERN_(HAS_FILAMENT_RUNOUT_DISTANCE, runout.block_completed(current_block)); + TERN_(HAS_FILAMENT_SENSOR, runout.block_completed(current_block)); discard_current_block(); } else { diff --git a/buildroot/tests/BIGTREE_GTR_V1_0 b/buildroot/tests/BIGTREE_GTR_V1_0 index dcfd2b3eef..33ce206bae 100755 --- a/buildroot/tests/BIGTREE_GTR_V1_0 +++ b/buildroot/tests/BIGTREE_GTR_V1_0 @@ -12,8 +12,10 @@ opt_set MOTHERBOARD BOARD_BTT_GTR_V1_0 SERIAL_PORT -1 \ # Not necessary to enable auto-fan for all extruders to hit problematic code paths opt_set E0_AUTO_FAN_PIN PC10 E1_AUTO_FAN_PIN PC11 E2_AUTO_FAN_PIN PC12 NEOPIXEL_PIN PF13 \ X_DRIVER_TYPE TMC2208 Y_DRIVER_TYPE TMC2130 \ - NUM_RUNOUT_SENSORS 8 FIL_RUNOUT_PIN 3 FIL_RUNOUT2_PIN 4 FIL_RUNOUT3_PIN 5 FIL_RUNOUT4_PIN 6 FIL_RUNOUT5_PIN 7 \ - FIL_RUNOUT6_PIN 8 FIL_RUNOUT7_PIN 9 FIL_RUNOUT8_PIN 10 FIL_RUNOUT4_STATE HIGH FIL_RUNOUT8_STATE HIGH \ + FIL_RUNOUT_ENABLED '{ true, true, true, true, true, true, true, true }' \ + FIL_RUNOUT_MODE '{ 1, 1, 1, 1, 1, 1, 1, 1 }' \ + FIL_RUNOUT_DISTANCE_MM '{ 0, 1, 5, 10, 5, 5, 5, 5 }' \ + FIL_RUNOUT_PIN 3 FIL_RUNOUT2_PIN 4 FIL_RUNOUT3_PIN 5 FIL_RUNOUT4_PIN 6 FIL_RUNOUT5_PIN 7 FIL_RUNOUT6_PIN 8 FIL_RUNOUT7_PIN 9 FIL_RUNOUT8_PIN 10 \ FILAMENT_RUNOUT_SCRIPT '"M600 T%c"' opt_enable REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER BLTOUCH NEOPIXEL_LED Z_SAFE_HOMING NOZZLE_PARK_FEATURE ADVANCED_PAUSE_FEATURE \ FILAMENT_RUNOUT_SENSOR FIL_RUNOUT4_PULLUP FIL_RUNOUT8_PULLUP FILAMENT_CHANGE_RESUME_ON_INSERT PAUSE_REHEAT_FAST_RESUME \ diff --git a/buildroot/tests/BIGTREE_GTR_V1_0_usb_flash_drive b/buildroot/tests/BIGTREE_GTR_V1_0_usb_flash_drive index 78aec13295..46264e7db4 100755 --- a/buildroot/tests/BIGTREE_GTR_V1_0_usb_flash_drive +++ b/buildroot/tests/BIGTREE_GTR_V1_0_usb_flash_drive @@ -16,7 +16,7 @@ opt_enable SDSUPPORT USB_FLASH_DRIVE_SUPPORT USE_OTG_USB_HOST \ opt_set E0_AUTO_FAN_PIN PC10 E1_AUTO_FAN_PIN PC11 E2_AUTO_FAN_PIN PC12 NEOPIXEL_PIN PF13 \ X_DRIVER_TYPE TMC2208 Y_DRIVER_TYPE TMC2130 \ FIL_RUNOUT_PIN 3 FIL_RUNOUT2_PIN 4 FIL_RUNOUT3_PIN 5 FIL_RUNOUT4_PIN 6 FIL_RUNOUT5_PIN 7 FIL_RUNOUT6_PIN 8 FIL_RUNOUT7_PIN 9 FIL_RUNOUT8_PIN 10 \ - FIL_RUNOUT4_STATE HIGH FIL_RUNOUT8_STATE HIGH + FIL_RUNOUT_MODE '{ 2, 2, 2, 1, 2, 2, 2, 1 }' FIL_RUNOUT_DISTANCE_MM '{ 0, 1, 5, 10, 5, 5, 5, 5 }' opt_enable FIL_RUNOUT4_PULLUP FIL_RUNOUT8_PULLUP exec_test $1 $2 "GTT GTR | OTG USB Flash Drive | 8 Extruders | Auto-Fan | Mixed TMC Drivers | Runout Sensors (distinct)" "$3" diff --git a/buildroot/tests/DUE b/buildroot/tests/DUE index 590d76606c..695f320831 100755 --- a/buildroot/tests/DUE +++ b/buildroot/tests/DUE @@ -20,7 +20,7 @@ opt_enable S_CURVE_ACCELERATION EEPROM_SETTINGS GCODE_MACROS \ EEPROM_SETTINGS SDSUPPORT BINARY_FILE_TRANSFER \ BLINKM PCA9533 PCA9632 RGB_LED RGB_LED_R_PIN RGB_LED_G_PIN RGB_LED_B_PIN \ NEOPIXEL_LED NEOPIXEL_PIN CASE_LIGHT_ENABLE CASE_LIGHT_USE_NEOPIXEL CASE_LIGHT_USE_RGB_LED CASE_LIGHT_MENU \ - NOZZLE_PARK_FEATURE ADVANCED_PAUSE_FEATURE FILAMENT_RUNOUT_DISTANCE_MM FILAMENT_RUNOUT_SENSOR \ + NOZZLE_PARK_FEATURE ADVANCED_PAUSE_FEATURE FILAMENT_RUNOUT_SENSOR FIL_RUNOUT_DISTANCE_MM \ AUTO_BED_LEVELING_BILINEAR Z_MIN_PROBE_REPEATABILITY_TEST DEBUG_LEVELING_FEATURE \ SKEW_CORRECTION SKEW_CORRECTION_FOR_Z SKEW_CORRECTION_GCODE CALIBRATION_GCODE \ BACKLASH_COMPENSATION BACKLASH_GCODE BAUD_RATE_GCODE BEZIER_CURVE_SUPPORT \ diff --git a/buildroot/tests/mega2560 b/buildroot/tests/mega2560 index d61f17b51c..7840649b1c 100755 --- a/buildroot/tests/mega2560 +++ b/buildroot/tests/mega2560 @@ -60,9 +60,9 @@ exec_test $1 $2 "Azteeg X3 Pro | EXTRUDERS 5 | RRDFGSC | UBL | LIN_ADVANCE | Sle # restore_configs opt_set MOTHERBOARD BOARD_AZTEEG_X3_PRO NUM_SERVOS 1 \ - EXTRUDERS 4 TEMP_SENSOR_1 1 TEMP_SENSOR_2 1 TEMP_SENSOR_3 1 TEMP_SENSOR_4 1 FAN_KICKSTART_TIME 500 \ + EXTRUDERS 4 TEMP_SENSOR_1 1 TEMP_SENSOR_2 1 TEMP_SENSOR_3 1 TEMP_SENSOR_4 1 \ NUM_RUNOUT_SENSORS 4 FIL_RUNOUT2_PIN 44 FIL_RUNOUT3_PIN 45 FIL_RUNOUT4_PIN 46 FIL_RUNOUT5_PIN 47 \ - FIL_RUNOUT3_STATE HIGH FILAMENT_RUNOUT_SCRIPT '"M600 T%c"' + FIL_RUNOUT_ENABLED '{ true, true, true, true }' FIL_RUNOUT_MODE '{ 1, 2, 7, 0 }' FIL_RUNOUT_DISTANCE_MM '{ 15, 15, 15, 15, 15 }' opt_enable VIKI2 BOOT_MARLIN_LOGO_ANIMATED SDSUPPORT AUTO_REPORT_SD_STATUS \ Z_PROBE_SERVO_NR Z_SERVO_ANGLES Z_SERVO_MEASURE_ANGLE DEACTIVATE_SERVOS_AFTER_MOVE Z_SERVO_DEACTIVATE_AFTER_STOW \ AUTO_BED_LEVELING_3POINT DEBUG_LEVELING_FEATURE PROBE_PT_1 PROBE_PT_2 PROBE_PT_3 \