From fc77afd93e331f4e82ade35437ed5ffb2987df8a Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Sun, 13 Mar 2022 19:57:01 -0500 Subject: [PATCH] misc. cleanup --- Marlin/Configuration.h | 21 +- Marlin/src/core/utility.cpp | 4 +- Marlin/src/feature/mmu/mmu2.cpp | 2 +- Marlin/src/feature/pause.cpp | 25 +- Marlin/src/feature/runout.cpp | 10 +- Marlin/src/feature/runout.h | 247 ++++++++---------- Marlin/src/gcode/feature/pause/M600.cpp | 2 +- Marlin/src/gcode/feature/runout/M591.cpp | 52 ++-- Marlin/src/gcode/gcode.h | 2 +- Marlin/src/inc/Conditionals_LCD.h | 20 +- Marlin/src/inc/Conditionals_adv.h | 5 +- Marlin/src/inc/SanityCheck.h | 74 +++++- Marlin/src/lcd/e3v2/proui/endstop_diag.cpp | 2 +- .../generic/endstop_state_screen.cpp | 12 +- Marlin/src/lcd/extui/ui_api.h | 1 - Marlin/src/module/endstops.cpp | 25 +- Marlin/src/module/settings.cpp | 84 +++--- buildroot/tests/BIGTREE_GTR_V1_0 | 6 +- .../tests/BIGTREE_GTR_V1_0_usb_flash_drive | 1 + buildroot/tests/DUE | 2 +- buildroot/tests/mega2560 | 7 +- buildroot/tests/rambo | 2 +- 22 files changed, 297 insertions(+), 309 deletions(-) diff --git a/Marlin/Configuration.h b/Marlin/Configuration.h index 865a975b2e..af31343880 100644 --- a/Marlin/Configuration.h +++ b/Marlin/Configuration.h @@ -1466,13 +1466,12 @@ */ //#define FILAMENT_RUNOUT_SENSOR #if ENABLED(FILAMENT_RUNOUT_SENSOR) - #define FIL_RUNOUT_ENABLED_DEFAULT { true } // Default state for sensors E0, E1[, E2, E3] // Enable the sensor on startup. Override with M591 followed by M500. - - #define FILAMENT_RUNOUT_DEFAULT_MODE {1} // Array set that will take the place of FIL_RUNOUT_STATE and FIL_RUNOUT_ENABLED_DEFAULT as this code matures - #define FIL_RUNOUT_PULLUP // Use internal pullup for filament runout pins. - //#define FIL_RUNOUT_PULLDOWN // Use internal pulldown for filament runout pins. - //#define WATCH_ALL_RUNOUT_SENSORS // Execute runout script on any triggering sensor, not only for the active extruder. - // This is automatically enabled for MIXING_EXTRUDERs. + #define FIL_RUNOUT_ENABLED { true } // Default enabled state for sensors E0[, E1[, E2[, E3...]]]. Override with M591 followed by M500. + #define FIL_RUNOUT_MODE { 1 } // Default mode for sensors E0[, E1[, E2[, E3...]]]. 0:NONE 1:Switch NO 2:Switch NC 7:Motion Sensor + #define FIL_RUNOUT_PULLUP // Use internal pullup for filament runout pins. + //#define FIL_RUNOUT_PULLDOWN // Use internal pulldown for filament runout pins. + //#define WATCH_ALL_RUNOUT_SENSORS // Execute runout script on any triggering sensor, not only for the active extruder. + // This is automatically enabled for MIXING_EXTRUDERs. // Override individually if the runout sensors vary //#define FIL_RUNOUT1_PULLUP @@ -1507,12 +1506,12 @@ // After a runout is detected, continue printing this length of filament // before executing the runout script. Useful for a sensor at the end of // a feed tube. Requires 4 bytes SRAM per sensor, plus 4 bytes overhead. - #define FILAMENT_RUNOUT_DISTANCE_MM {15} + #define FIL_RUNOUT_DISTANCE_MM { 15 } - #ifdef FILAMENT_RUNOUT_DISTANCE_MM + #ifdef FIL_RUNOUT_DISTANCE_MM // Enable this option to use an encoder disc that toggles the runout pin - // as the filament moves. (Be sure to set FILAMENT_RUNOUT_DISTANCE_MM - // large enough to avoid false positives.) + // as the filament moves. (Be sure to make FIL_RUNOUT_DISTANCE_MM long + // enough to avoid false positives.) //#define FILAMENT_MOTION_SENSOR #endif #endif diff --git a/Marlin/src/core/utility.cpp b/Marlin/src/core/utility.cpp index 59e59d4cb7..e3dab5aded 100644 --- a/Marlin/src/core/utility.cpp +++ b/Marlin/src/core/utility.cpp @@ -94,9 +94,9 @@ void safe_delay(millis_t ms) { SERIAL_ECHOPGM(" (Aligned With"); if (probe.offset_xy.y > 0) - SERIAL_ECHOF(F(TERN(IS_SCARA, "-Distal", "-Back"))); + SERIAL_ECHOPGM(TERN(IS_SCARA, "-Distal", "-Back")); else if (probe.offset_xy.y < 0) - SERIAL_ECHOF(F(TERN(IS_SCARA, "-Proximal", "-Front"))); + SERIAL_ECHOPGM(TERN(IS_SCARA, "-Proximal", "-Front")); else if (probe.offset_xy.x != 0) SERIAL_ECHOPGM("-Center"); diff --git a/Marlin/src/feature/mmu/mmu2.cpp b/Marlin/src/feature/mmu/mmu2.cpp index 2bb69fa9c6..911464a5e2 100644 --- a/Marlin/src/feature/mmu/mmu2.cpp +++ b/Marlin/src/feature/mmu/mmu2.cpp @@ -140,7 +140,7 @@ uint8_t MMU2::get_current_tool() { } #if EITHER(HAS_PRUSA_MMU2S, MMU_EXTRUDER_SENSOR) - #define FILAMENT_PRESENT() (READ(FIL_RUNOUT1_PIN) != (runout.mode[0]==2 ? HIGH, LOW)) + #define FILAMENT_PRESENT() (READ(FIL_RUNOUT1_PIN) != runout.out_state()) #endif void MMU2::mmu_loop() { diff --git a/Marlin/src/feature/pause.cpp b/Marlin/src/feature/pause.cpp index 7333613c83..34ebcbc7f0 100644 --- a/Marlin/src/feature/pause.cpp +++ b/Marlin/src/feature/pause.cpp @@ -208,31 +208,22 @@ bool load_filament(const_float_t slow_load_length/*=0*/, const_float_t fast_load while (wait_for_user) { impatient_beep(max_beep_count); #if BOTH(FILAMENT_CHANGE_RESUME_ON_INSERT, FILAMENT_RUNOUT_SENSOR) - #if ENABLED(MULTI_FILAMENT_SENSOR) - #define _CASE_RUNOUT(N) case N: pin = FIL_RUNOUT##N##_PIN; break; + #if MULTI_FILAMENT_SENSOR LOOP_S_LE_N(i, 1, NUM_RUNOUT_SENSORS) { 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 } - if(runout.mode[i-1]==1) - state = HIGH; - else - state = LOW; - if(runout.mode[i-1]!=0 && runout.mode[i-1]!=7 && extDigitalRead(pin) != state) + const uint8_t rm = runout.mode[i - 1]; + if (rm != 0 && rm != 7 && extDigitalRead(pin) != runout.out_state(i - 1)) wait_for_user = false; } - #undef _CASE_RUNOUT - #else { - uint8_t state; - if(runout.mode[active_extruder]==1) - state = HIGH; - else - state = LOW; - if (READ(FIL_RUNOUT_PIN) != state) wait_for_user = false; - } + #else + 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 332890c0ef..96238c0f80 100644 --- a/Marlin/src/feature/runout.cpp +++ b/Marlin/src/feature/runout.cpp @@ -32,9 +32,9 @@ FilamentMonitor runout; -bool FilamentMonitorBase::enabled[NUM_RUNOUT_SENSORS] = {true}, - FilamentMonitorBase::filament_ran_out; // = false -uint8_t FilamentMonitorBase::mode[NUM_RUNOUT_SENSORS] = FILAMENT_RUNOUT_DEFAULT_MODE; // Initialized by settings.load +bool FilamentMonitorBase::enabled[NUM_RUNOUT_SENSORS], // Initialized by settings.load + FilamentMonitorBase::filament_ran_out; // = false +uint8_t FilamentMonitorBase::mode[NUM_RUNOUT_SENSORS]; // Initialized by settings.load #if ENABLED(HOST_ACTION_COMMANDS) bool FilamentMonitorBase::host_handling; // = false #endif @@ -45,12 +45,10 @@ uint8_t FilamentMonitorBase::mode[NUM_RUNOUT_SENSORS] = FILAMENT_RUNOUT_DEFAULT_ #include "../core/debug_out.h" #endif - -float RunoutResponseDelayed::runout_distance_mm[NUM_RUNOUT_SENSORS] = FILAMENT_RUNOUT_DISTANCE_MM; +float RunoutResponseDelayed::runout_distance_mm[NUM_RUNOUT_SENSORS]; // Initialized by settings.load volatile float RunoutResponseDelayed::runout_mm_countdown[NUM_RUNOUT_SENSORS]; uint8_t FilamentSensorCore::motion_detected; - // // Filament Runout event handler // diff --git a/Marlin/src/feature/runout.h b/Marlin/src/feature/runout.h index 7867809232..a898cb33de 100644 --- a/Marlin/src/feature/runout.h +++ b/Marlin/src/feature/runout.h @@ -64,7 +64,9 @@ extern FilamentMonitor runout; class FilamentMonitorBase { public: static bool enabled[NUM_RUNOUT_SENSORS], filament_ran_out; - static uint8_t mode[NUM_RUNOUT_SENSORS]; + static uint8_t mode[NUM_RUNOUT_SENSORS]; // 0:NONE 1:Switch NC 2:Switch NO 7:Motion Sensor + + static uint8_t out_state(const uint8_t e=0) { return mode[e] == 2 ? HIGH : LOW; } #if ENABLED(HOST_ACTION_COMMANDS) static bool host_handling; @@ -94,12 +96,9 @@ 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); - } - - static float& runout_distance(uint8_t extruder=0) { return response.runout_distance_mm[extruder]; } - static void set_runout_distance(const_float_t mm, uint8_t extruder=0) { response.runout_distance_mm[extruder] = mm; } + 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. @@ -210,151 +209,125 @@ class FilamentSensorBase { // Return a bitmask of runout flag states (1 bits always indicates runout) static uint8_t poll_runout_states() { - return poll_runout_pins() ^ uint8_t(0 - #if NUM_RUNOUT_SENSORS >= 1 - | ((runout.mode[0]==2) ? 0 : _BV(1 - 1)) - #endif - #if NUM_RUNOUT_SENSORS >= 2 - | ((runout.mode[1]==2) ? 0 : _BV(2 - 1)) - #endif - #if NUM_RUNOUT_SENSORS >= 3 - | ((runout.mode[2]==2) ? 0 : _BV(3 - 1)) - #endif - #if NUM_RUNOUT_SENSORS >= 4 - | ((runout.mode[3]==2) ? 0 : _BV(4 - 1)) - #endif - #if NUM_RUNOUT_SENSORS >= 5 - | ((runout.mode[4]==2) ? 0 : _BV(5 - 1)) - #endif - #if NUM_RUNOUT_SENSORS >= 6 - | ((runout.mode[5]==2) ? 0 : _BV(6 - 1)) - #endif - #if NUM_RUNOUT_SENSORS >= 7 - | ((runout.mode[6]==2) ? 0 : _BV(7 - 1)) - #endif - #if NUM_RUNOUT_SENSORS >= 8 - | ((runout.mode[7]==2) ? 0 : _BV(8 - 1)) - #endif - ); + #define _OR_INVERT(N) | (runout.out_state(N) ? 0 : _BV(N)) + return poll_runout_pins() ^ uint8_t(0 REPEAT_1(NUM_RUNOUT_SENSORS, _OR_INVERT)); + #undef _OR_INVERT } }; - class FilamentSensorCore : public FilamentSensorBase { - private: - static uint8_t motion_detected; +class FilamentSensorCore : 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 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; - const uint8_t new_state = poll_runout_pins(), - change = old_state ^ new_state; - old_state = new_state; + static void poll_motion_sensor() { + static uint8_t old_state; + const uint8_t new_state = poll_runout_pins(), + change = old_state ^ new_state; + old_state = new_state; - #if ENABLED(FILAMENT_RUNOUT_SENSOR_DEBUG) - if (change) { - SERIAL_ECHOPGM("Motion detected:"); - LOOP_L_N(e, NUM_RUNOUT_SENSORS) - if (TEST(change, e)) SERIAL_CHAR(' ', '0' + e); - SERIAL_EOL(); - } - #endif - - motion_detected |= change; - } - - public: - static void block_completed(const block_t * const b) { - if (runout.mode[active_extruder]!=7) return; - // If the sensor wheel has moved since the last call to - // this method reset the runout counter for the extruder. - if (TEST(motion_detected, b->extruder)) - filament_present(b->extruder); - - // Clear motion triggers for next block - motion_detected = 0; - } - - static void run() { - if(runout.mode[active_extruder]==7) - { - poll_motion_sensor(); + #if ENABLED(FILAMENT_RUNOUT_SENSOR_DEBUG) + if (change) { + SERIAL_ECHOPGM("Motion detected:"); + LOOP_L_N(e, NUM_RUNOUT_SENSORS) + if (TEST(change, e)) SERIAL_CHAR(' ', '0' + e); + SERIAL_EOL(); } - else if(runout.mode[active_extruder]!=0) { - LOOP_L_N(s, NUM_RUNOUT_SENSORS) { - const bool out = poll_runout_state(s); - if (!out) filament_present(s); - #if ENABLED(FILAMENT_RUNOUT_SENSOR_DEBUG) - static uint8_t was_out; // = 0 - if (out != TEST(was_out, s)) { - TBI(was_out, s); - SERIAL_ECHOLNF(F("Filament Sensor "), AS_DIGIT(s), out ? F(" OUT") : F(" IN")); - } - #endif - } + #endif + + motion_detected |= change; + } + + public: + static void block_completed(const block_t * const b) { + if (runout.mode[active_extruder] != 7) return; + + // If the sensor wheel has moved since the last call to + // this method reset the runout counter for the extruder. + if (TEST(motion_detected, b->extruder)) + filament_present(b->extruder); + + // Clear motion triggers for next block + motion_detected = 0; + } + + static void run() { + if (runout.mode[active_extruder] == 7) { + poll_motion_sensor(); + } + else if (runout.mode[active_extruder] != 0) { + LOOP_L_N(s, NUM_RUNOUT_SENSORS) { + const bool out = poll_runout_state(s); + if (!out) filament_present(s); + #if ENABLED(FILAMENT_RUNOUT_SENSOR_DEBUG) + static uint8_t was_out; // = 0 + if (out != TEST(was_out, s)) { + TBI(was_out, s); + SERIAL_ECHOLNF(F("Filament Sensor "), AS_DIGIT(s), out ? F(" OUT") : F(" IN")); + } + #endif } } - }; - - + } +}; /********************************* RESPONSE TYPE *********************************/ - // 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 volatile float runout_mm_countdown[NUM_RUNOUT_SENSORS]; +// 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 volatile float runout_mm_countdown[NUM_RUNOUT_SENSORS]; - public: - static float runout_distance_mm[NUM_RUNOUT_SENSORS]; + public: + static float runout_distance_mm[NUM_RUNOUT_SENSORS]; - static void reset() { - LOOP_L_N(i, NUM_RUNOUT_SENSORS) filament_present(i); - } + static void reset() { + LOOP_L_N(i, NUM_RUNOUT_SENSORS) filament_present(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; - LOOP_L_N(i, NUM_RUNOUT_SENSORS) - SERIAL_ECHOF(i ? F(", ") : F("Remaining mm: "), runout_mm_countdown[i]); - SERIAL_EOL(); - } - #endif - } - - static uint8_t has_run_out() { - uint8_t runout_flags = 0; - LOOP_L_N(i, NUM_RUNOUT_SENSORS) if (runout_mm_countdown[i] < 0) SBI(runout_flags, i); - return runout_flags; - } - - static void filament_present(const uint8_t extruder) { - runout_mm_countdown[extruder] = runout_distance_mm[extruder]; - } - - static void block_completed(const block_t * const b) { - if (b->steps.x || b->steps.y || b->steps.z || did_pause_print) { // Allow pause purge move to re-trigger runout state - // Only trigger on extrusion with XYZ movement to allow filament change and retract/recover. - const uint8_t e = b->extruder; - const int32_t steps = b->steps.e; - runout_mm_countdown[e] -= (TEST(b->direction_bits, E_AXIS) ? -steps : steps) * planner.mm_per_step[E_AXIS_N(e)]; + 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; + LOOP_L_N(i, NUM_RUNOUT_SENSORS) + SERIAL_ECHOF(i ? F(", ") : F("Remaining mm: "), runout_mm_countdown[i]); + SERIAL_EOL(); } - } - }; + #endif + } + static uint8_t has_run_out() { + uint8_t runout_flags = 0; + LOOP_L_N(i, NUM_RUNOUT_SENSORS) if (runout_mm_countdown[i] < 0) SBI(runout_flags, i); + return runout_flags; + } + + static void filament_present(const uint8_t extruder) { + runout_mm_countdown[extruder] = runout_distance_mm[extruder]; + } + + static void block_completed(const block_t * const b) { + if (b->steps.x || b->steps.y || b->steps.z || did_pause_print) { // Allow pause purge move to re-trigger runout state + // Only trigger on extrusion with XYZ movement to allow filament change and retract/recover. + const uint8_t e = b->extruder; + const int32_t steps = b->steps.e; + runout_mm_countdown[e] -= (TEST(b->direction_bits, E_AXIS) ? -steps : steps) * planner.mm_per_step[E_AXIS_N(e)]; + } + } +}; diff --git a/Marlin/src/gcode/feature/pause/M600.cpp b/Marlin/src/gcode/feature/pause/M600.cpp index 0b5a4d8c03..e97cc25e99 100644 --- a/Marlin/src/gcode/feature/pause/M600.cpp +++ b/Marlin/src/gcode/feature/pause/M600.cpp @@ -88,7 +88,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) == (runout.mode[1]==2 ? HIGH, LOW) ? 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/M591.cpp b/Marlin/src/gcode/feature/runout/M591.cpp index e4a7e5b59d..0751de879a 100644 --- a/Marlin/src/gcode/feature/runout/M591.cpp +++ b/Marlin/src/gcode/feature/runout/M591.cpp @@ -27,13 +27,8 @@ #include "../../gcode.h" #include "../../../feature/runout.h" - -void GcodeSuite::M412() { - SERIAL_ECHOLNPGM_P("M412 is Deprecated, please us M591."); - M591(); -} /** - 591: Configure filament runout detection + * M591: Configure filament runout detection * * Parameters * R : Reset the runout sensor @@ -41,41 +36,33 @@ void GcodeSuite::M412() { * H : Enable/disable host handling of filament runout * L : Extra distance to continue after runout is triggered or motion interval * D : Alias for L - * P : Mode : - 0 = none - 1 = simple sensor (high signal when filament present) - 2 = simple sensor (low signal when filament present) - 7 = motion encoder sensor + * P : Mode 0 = NONE + * 1 = Switch NO (HIGH = filament present) + * 2 = Switch NC (LOW = filament present) + * 7 = Encoder / Motion Sensor */ void GcodeSuite::M591() { - #if HOTENDS > 1 - if(parser.seen("E")) - const uint8_t tool = parser.value_ushort(); - else - tool = active_extruder; - #else - const uint8_t tool = 0; - #endif - - if (parser.seen("RSDP" - TERN_(HOST_ACTION_COMMANDS, "H") - )) { + 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 NUM_RUNOUT_SENSORS > 1 + const uint8_t tool = parser.ushortval('E', active_extruder); + #else + constexpr uint8_t tool = 0; + #endif if (seenS) runout.enabled[tool] = parser.value_bool(); if (parser.seen('D')) runout.set_runout_distance(parser.value_linear_units(), tool); if (parser.seen('L')) runout.set_runout_distance(parser.value_linear_units(), tool); if (parser.seen('P')) { - uint8_t tmp_mode = parser.value_int(); - if(tmp_mode < 3 || tmp_mode==7) { + const uint8_t tmp_mode = parser.value_int(); + if (tmp_mode < 3 || tmp_mode == 7) { runout.mode[tool] = tmp_mode; runout.reset(); } } - } else { SERIAL_ECHO_START(); @@ -93,15 +80,16 @@ void GcodeSuite::M591() { void GcodeSuite::M591_report(const bool forReplay/*=true*/) { report_heading_etc(forReplay, F(STR_FILAMENT_RUNOUT_SENSOR)); - LOOP_S_L_N(e, 1, HOTENDS) - SERIAL_ECHOPGM( - " M591 E", e - , " S", runout.enabled[e] + LOOP_S_L_N(e, 1, NUM_RUNOUT_SENSORS) + SERIAL_ECHOLNPGM( + " M591" + #if NUM_RUNOUT_SENSORS > 1 + " 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.h b/Marlin/src/gcode/gcode.h index 46f4a5ddce..1e15756f24 100644 --- a/Marlin/src/gcode/gcode.h +++ b/Marlin/src/gcode/gcode.h @@ -978,7 +978,7 @@ private: #endif #if HAS_FILAMENT_SENSOR - static void M412(); + static void M412() { M591(); } static void M591(); static void M591_report(const bool forReplay=true); #endif diff --git a/Marlin/src/inc/Conditionals_LCD.h b/Marlin/src/inc/Conditionals_LCD.h index e2b643ae73..fb52d1d2f2 100644 --- a/Marlin/src/inc/Conditionals_LCD.h +++ b/Marlin/src/inc/Conditionals_LCD.h @@ -832,10 +832,14 @@ /** * Fill in undefined Filament Sensor options */ -#ifndef NUM_RUNOUT_SENSORS - #define NUM_RUNOUT_SENSORS E_STEPPERS -#endif #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_PULLUP #define FIL_RUNOUT1_PULLUP FIL_RUNOUT_PULLUP @@ -845,6 +849,7 @@ #endif #endif #if NUM_RUNOUT_SENSORS >= 2 + #define MULTI_FILAMENT_SENSOR 1 #ifndef FIL_RUNOUT2_PULLUP #define FIL_RUNOUT2_PULLUP FIL_RUNOUT_PULLUP #endif @@ -885,7 +890,6 @@ #endif #endif #if NUM_RUNOUT_SENSORS >= 7 - #ifndef FIL_RUNOUT7_PULLUP #define FIL_RUNOUT7_PULLUP FIL_RUNOUT_PULLUP #endif @@ -901,14 +905,6 @@ #define FIL_RUNOUT8_PULLDOWN FIL_RUNOUT_PULLDOWN #endif #endif - - #define HAS_FILAMENT_SENSOR 1 - #if NUM_RUNOUT_SENSORS > 1 - #define MULTI_FILAMENT_SENSOR 1 - #endif - #if ENABLED(MIXING_EXTRUDER) - #define WATCH_ALL_RUNOUT_SENSORS - #endif #endif // FILAMENT_RUNOUT_SENSOR // Homing to Min or Max diff --git a/Marlin/src/inc/Conditionals_adv.h b/Marlin/src/inc/Conditionals_adv.h index d0004658ce..2219f311e0 100644 --- a/Marlin/src/inc/Conditionals_adv.h +++ b/Marlin/src/inc/Conditionals_adv.h @@ -95,11 +95,12 @@ #undef PID_EXTRUSION_SCALING #undef LIN_ADVANCE #undef FILAMENT_RUNOUT_SENSOR + #undef FIL_RUNOUT_ENABLED + #undef FIL_RUNOUT_MODE + #undef FIL_RUNOUT_DISTANCE_MM #undef ADVANCED_PAUSE_FEATURE - #undef FILAMENT_RUNOUT_DISTANCE_MM #undef FILAMENT_LOAD_UNLOAD_GCODES #undef DISABLE_INACTIVE_EXTRUDER - #undef FILAMENT_LOAD_UNLOAD_GCODES #undef EXTRUDER_RUNOUT_PREVENT #undef PREVENT_COLD_EXTRUSION #undef PREVENT_LENGTHY_EXTRUDE diff --git a/Marlin/src/inc/SanityCheck.h b/Marlin/src/inc/SanityCheck.h index 9f7b9fb056..f281038bae 100644 --- a/Marlin/src/inc/SanityCheck.h +++ b/Marlin/src/inc/SanityCheck.h @@ -561,9 +561,9 @@ #error "SHORT_MANUAL_Z_MOVE is now FINE_MANUAL_MOVE, applying to Z on most printers." #elif defined(FIL_RUNOUT_INVERTING) #if FIL_RUNOUT_INVERTING - #error "FIL_RUNOUT_INVERTING true is now FILAMENT_RUNOUT_DEFAULT_MODE {HIGH}." + #error "FIL_RUNOUT_INVERTING true is now FIL_RUNOUT_MODE {HIGH}." #else - #error "FIL_RUNOUT_INVERTING false is now FILAMENT_RUNOUT_DEFAULT_MODE {LOW}." + #error "FIL_RUNOUT_INVERTING false is now FIL_RUNOUT_MODE {LOW}." #endif #elif defined(ASSISTED_TRAMMING_MENU_ITEM) #error "ASSISTED_TRAMMING_MENU_ITEM is deprecated and should be removed." @@ -1002,16 +1002,68 @@ static_assert(Y_MAX_LENGTH >= Y_BED_SIZE, "Movement bounds (Y_MIN_POS, Y_MAX_POS #error "You can't enable FIL_RUNOUT8_PULLUP and FIL_RUNOUT8_PULLDOWN at the same time." #elif DISABLED(ADVANCED_PAUSE_FEATURE) static_assert(nullptr == strstr(FILAMENT_RUNOUT_SCRIPT, "M600"), "ADVANCED_PAUSE_FEATURE is required to use M600 with FILAMENT_RUNOUT_SENSOR."); - #elif ANY(FIL_RUNOUT_STATE, FIL_RUNOUT1_STATE, FIL_RUNOUT2_STATE, FIL_RUNOUT3_STATE, FIL_RUNOUT4_STATE, FIL_RUNOUT5_STATE, FIL_RUNOUT6_STATE, FIL_RUNOUT7_STATE, FIL_RUNOUT8_STATE) - #error "FIL_RUNOUT#_STATE is Now set with FILAMENT_RUNOUT_DEFAULT_MODE" + #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 #endif - - constexpr uint8_t frdm[] = FILAMENT_RUNOUT_DEFAULT_MODE; - static_assert(COUNT(frdm) == NUM_RUNOUT_SENSORS, "FILAMENT_RUNOUT_DEFAULT_MODE must have NUM_RUNOUT_SENSORS values."); - constexpr bool fred[] = FIL_RUNOUT_ENABLED_DEFAULT; - static_assert(COUNT(fred) == NUM_RUNOUT_SENSORS, "FIL_RUNOUT_ENABLED_DEFAULT must have NUM_RUNOUT_SENSORS values."); - constexpr float frd[] = FILAMENT_RUNOUT_DISTANCE_MM; - static_assert(COUNT(frd) == NUM_RUNOUT_SENSORS, "FILAMENT_RUNOUT_DISTANCE_MM must have NUM_RUNOUT_SENSORS values."); #endif /** diff --git a/Marlin/src/lcd/e3v2/proui/endstop_diag.cpp b/Marlin/src/lcd/e3v2/proui/endstop_diag.cpp index ab42b2f1d8..2e4ab6a79c 100644 --- a/Marlin/src/lcd/e3v2/proui/endstop_diag.cpp +++ b/Marlin/src/lcd/e3v2/proui/endstop_diag.cpp @@ -100,7 +100,7 @@ void ESDiagClass::Update() { ES_REPORT(Z_MIN); #endif #if HAS_FILAMENT_SENSOR - draw_es_state(READ(FIL_RUNOUT1_PIN) != (runout.mode[0]==2 ? HIGH, LOW); + draw_es_state(READ(FIL_RUNOUT1_PIN) != runout.out_state()); #endif DWIN_UpdateLCD(); } 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 c7042e760e..fdc5764db9 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 @@ -51,13 +51,7 @@ void EndstopStatesScreen::onRedraw(draw_mode_t) { #define PIN_ENABLED(X,Y,LABEL,PIN,INV) cmd.enabled(1).colors(READ(PIN##_PIN) != INV ? action_btn : normal_btn).PIN_BTN(X,Y,PIN,LABEL); #define PIN_DISABLED(X,Y,LABEL,PIN) cmd.enabled(0).PIN_BTN(X,Y,PIN,LABEL); - cmd.font( - #if ENABLED(TOUCH_UI_PORTRAIT) - font_large - #else - font_medium - #endif - ) + cmd.font(TERN(TOUCH_UI_PORTRAIT, font_large, font_medium)) .text(BTN_POS(1,1), BTN_SIZE(6,1), GET_TEXT_F(MSG_LCD_ENDSTOPS)) .font(font_tiny); #if HAS_X_MAX @@ -91,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 BOTH(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/ui_api.h b/Marlin/src/lcd/extui/ui_api.h index 3d87d0208e..3ccf6dea70 100644 --- a/Marlin/src/lcd/extui/ui_api.h +++ b/Marlin/src/lcd/extui/ui_api.h @@ -300,7 +300,6 @@ namespace ExtUI { void setFilamentRunoutState(const bool); float getFilamentRunoutDistance_mm(); void setFilamentRunoutDistance_mm(const_float_t); - #endif #if ENABLED(CASE_LIGHT_ENABLE) diff --git a/Marlin/src/module/endstops.cpp b/Marlin/src/module/endstops.cpp index 4fae1d4ad2..f41a6c9f87 100644 --- a/Marlin/src/module/endstops.cpp +++ b/Marlin/src/module/endstops.cpp @@ -575,34 +575,29 @@ void _O2 Endstops::report_states() { print_es_state(PROBE_TRIGGERED(), F(STR_Z_PROBE)); #endif #if HAS_FILAMENT_SENSOR - #define _CASE_RUNOUT(N) case N: pin = FIL_RUNOUT##N##_PIN; break; LOOP_S_LE_N(i, 1, NUM_RUNOUT_SENSORS) { 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 } - if(runout.mode[i-1]==1) - state = HIGH; - else - state = LOW; + const uint8_t rm = runout.mode[i - 1], + state = runout.out_state(i - 1); SERIAL_ECHOPGM(STR_FILAMENT); if (i > 1) SERIAL_CHAR(' ', '0' + i); SERIAL_ECHOPGM(": "); - if(runout.mode[i-1]==0) - SERIAL_ECHOLNF(F("DISABLED")); - else if(runout.mode[i-1]==7) { - SERIAL_ECHOF(F("MOTION : ")); - print_es_state(extDigitalRead(pin) != state); + if (rm == 0) + SERIAL_ECHOLNPGM("DISABLED"); + else if (rm == 7) { + SERIAL_ECHOPGM("MOTION : "); + print_es_state(extDigitalRead(pin) == state); } - else if(extDigitalRead(pin) != state) - SERIAL_ECHOLNF(F("PRESENT")); else - SERIAL_ECHOLNF(F("MISSING")); + SERIAL_ECHOLNPGM_P(extDigitalRead(pin) == state ? PSTR("MISSING") : PSTR("PRESENT")); } - #undef _CASE_RUNOUT #endif TERN_(BLTOUCH, bltouch._reset_SW_mode()); diff --git a/Marlin/src/module/settings.cpp b/Marlin/src/module/settings.cpp index 11084e325a..7c10698ccc 100644 --- a/Marlin/src/module/settings.cpp +++ b/Marlin/src/module/settings.cpp @@ -112,9 +112,9 @@ #if HAS_FILAMENT_SENSOR #include "../feature/runout.h" - #ifndef FIL_RUNOUT_ENABLED_DEFAULT - #define FIL_RUNOUT_ENABLED_DEFAULT true - #endif + #define NRS NUM_RUNOUT_SENSORS +#else + #define NRS 1 #endif #if ENABLED(EXTRA_LIN_ADVANCE_K) @@ -235,9 +235,9 @@ typedef struct SettingsDataStruct { // // FILAMENT_RUNOUT_SENSOR // - bool runout_sensor_enabled[NUM_RUNOUT_SENSORS]; // M591 S - float runout_distance_mm[NUM_RUNOUT_SENSORS]; // M591 D - uint8_t runout_mode[NUM_RUNOUT_SENSORS]; // M591 P + bool runout_enabled[NRS]; // M591 S + float runout_distance_mm[NRS]; // M591 D + uint8_t runout_mode[NRS]; // M591 P // // ENABLE_LEVELING_FADE_HEIGHT @@ -793,20 +793,15 @@ void MarlinSettings::postprocess() { // Filament Runout Sensor // { + _FIELD_TEST(runout_enabled); #if HAS_FILAMENT_SENSOR - LOOP_S_L_N(e, 0, NUM_RUNOUT_SENSORS) - EEPROM_WRITE(runout.enabled[e]); - LOOP_S_L_N(e, 0, NUM_RUNOUT_SENSORS) - EEPROM_WRITE(runout.runout_distance(e)); - LOOP_S_L_N(e, 0, NUM_RUNOUT_SENSORS) - EEPROM_WRITE(runout.mode[e]); + LOOP_L_N(e, NRS) EEPROM_WRITE(runout.enabled[e]); + LOOP_L_N(e, NRS) EEPROM_WRITE(runout.runout_distance(e)); + LOOP_L_N(e, NRS) EEPROM_WRITE(runout.mode[e]); #else - LOOP_S_L_N(e, 0, NUM_RUNOUT_SENSORS) - EEPROM_WRITE((int8_t)-1)); - LOOP_S_L_N(e, 0, NUM_RUNOUT_SENSORS) - EEPROM_WRITE((float)-0.0f)); - LOOP_S_L_N(e, 0, NUM_RUNOUT_SENSORS) - EEPROM_WRITE((uint8_t)0)); + EEPROM_WRITE((int8_t)-1); + EEPROM_WRITE((float)-0.0f); + EEPROM_WRITE((uint8_t)0); #endif } @@ -1713,27 +1708,28 @@ void MarlinSettings::postprocess() { // Filament Runout Sensor // { - int8_t runout_sensor_enabled[NUM_RUNOUT_SENSORS]; - _FIELD_TEST(runout_sensor_enabled); - LOOP_S_L_N(e, 0, NUM_RUNOUT_SENSORS) - EEPROM_READ(runout_sensor_enabled); - float runout_distance_mm[NUM_RUNOUT_SENSORS]; - LOOP_S_L_N(e, 0, NUM_RUNOUT_SENSORS) - EEPROM_READ(runout_distance_mm[e]); - uint8_t runout_mode[NUM_RUNOUT_SENSORS]; - LOOP_S_L_N(e, 0, NUM_RUNOUT_SENSORS) - EEPROM_READ(runout_mode[e]); + _FIELD_TEST(runout_enabled); + + int8_t runout_enabled[NRS]; + float runout_distance_mm[NRS]; + uint8_t runout_mode[NRS]; + + LOOP_S_L_N(e, 0, NRS) EEPROM_READ(runout_enabled[e]); + LOOP_S_L_N(e, 0, NRS) EEPROM_READ(runout_distance_mm[e]); + LOOP_S_L_N(e, 0, NRS) EEPROM_READ(runout_mode[e]); #if HAS_FILAMENT_SENSOR - LOOP_S_L_N(e, 0, NUM_RUNOUT_SENSORS) - runout.enabled[e] = runout_sensor_enabled[e] < 0 ? FIL_RUNOUT_ENABLED_DEFAULT : runout_sensor_enabled[e]; - LOOP_S_L_N(e, 0, NUM_RUNOUT_SENSORS) - if (!validating) runout.set_runout_distance(runout_distance_mm[e], e); - LOOP_S_L_N(e, 0, NUM_RUNOUT_SENSORS) - if (!validating) runout.mode[e] = runout_mode[e]; - runout.reset(); + if (!validating) { + LOOP_S_L_N(e, 0, NRS) { + if (runout_enabled[e] >= 0) { + runout.enabled[e] = (runout_enabled[e] > 0); + runout.set_runout_distance(runout_distance_mm[e], e); + runout.mode[e] = runout_mode[e]; + } + } + runout.reset(); + } #endif - } // @@ -2798,13 +2794,15 @@ void MarlinSettings::reset() { // #if HAS_FILAMENT_SENSOR - LOOP_S_L_N(e, 0, NUM_RUNOUT_SENSORS) - runout.enabled[e] = FIL_RUNOUT_ENABLED_DEFAULT; - LOOP_S_L_N(e, 0, NUM_RUNOUT_SENSORS) - runout.set_runout_distance(FILAMENT_RUNOUT_DISTANCE_MM, e); - LOOP_S_L_N(e, 0, NUM_RUNOUT_SENSORS) - runout.mode[e] = FILAMENT_RUNOUT_DEFAULT_MODE; - + constexpr bool fred[] = FIL_RUNOUT_ENABLED; + constexpr uint8_t frm[] = FIL_RUNOUT_MODE; + constexpr float frd[] = FIL_RUNOUT_DISTANCE_MM; + static_assert(COUNT(fred) == NRS, "FIL_RUNOUT_ENABLED must have NUM_RUNOUT_SENSORS values."); + static_assert(COUNT(frm) == NRS, "FIL_RUNOUT_MODE must have NUM_RUNOUT_SENSORS values."); + static_assert(COUNT(frd) == NRS, "FIL_RUNOUT_DISTANCE_MM must have NUM_RUNOUT_SENSORS values."); + COPY(runout.enabled, fred); + COPY(runout.mode, frm); + LOOP_L_N(e, NRS) runout.set_runout_distance(frd[e], e); runout.reset(); #endif diff --git a/buildroot/tests/BIGTREE_GTR_V1_0 b/buildroot/tests/BIGTREE_GTR_V1_0 index 19ed4b6964..a64f30b4f9 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_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 48fbc10c8c..3e819ba85e 100755 --- a/buildroot/tests/BIGTREE_GTR_V1_0_usb_flash_drive +++ b/buildroot/tests/BIGTREE_GTR_V1_0_usb_flash_drive @@ -16,6 +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_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 9b968cbd8d..7251cd8669 100755 --- a/buildroot/tests/DUE +++ b/buildroot/tests/DUE @@ -19,7 +19,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 f71ba0999e..ad08b7487f 100755 --- a/buildroot/tests/mega2560 +++ b/buildroot/tests/mega2560 @@ -53,6 +53,7 @@ restore_configs opt_set MOTHERBOARD BOARD_AZTEEG_X3_PRO NUM_SERVOS 1 \ EXTRUDERS 5 TEMP_SENSOR_1 1 TEMP_SENSOR_2 1 TEMP_SENSOR_3 1 TEMP_SENSOR_4 1 \ NUM_RUNOUT_SENSORS 5 FIL_RUNOUT2_PIN 44 FIL_RUNOUT3_PIN 45 FIL_RUNOUT4_PIN 46 FIL_RUNOUT5_PIN 47 \ + FIL_RUNOUT_ENABLED '{ true, true, true, true, true }' FIL_RUNOUT_MODE '{ 1, 2, 7, 0, 1 }' 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 DEACTIVATE_SERVOS_AFTER_MOVE AUTO_BED_LEVELING_3POINT DEBUG_LEVELING_FEATURE \ EEPROM_SETTINGS EEPROM_CHITCHAT M114_DETAIL AUTO_REPORT_POSITION \ @@ -66,9 +67,9 @@ exec_test $1 $2 "Multiple runout sensors (x5) | Distinct runout states" "$3" # Mixing Extruder with 5 steppers, Greek # restore_configs -opt_set MOTHERBOARD BOARD_AZTEEG_X3_PRO MIXING_STEPPERS 5 LCD_LANGUAGE ru \ - NUM_RUNOUT_SENSORS E_STEPPERS REDUNDANT_PART_COOLING_FAN 1 \ - FIL_RUNOUT2_PIN 16 FIL_RUNOUT3_PIN 17 FIL_RUNOUT4_PIN 4 FIL_RUNOUT5_PIN 5 +opt_set MOTHERBOARD BOARD_AZTEEG_X3_PRO MIXING_STEPPERS 5 LCD_LANGUAGE ru REDUNDANT_PART_COOLING_FAN 1 \ + FIL_RUNOUT2_PIN 16 FIL_RUNOUT3_PIN 17 FIL_RUNOUT4_PIN 4 FIL_RUNOUT5_PIN 5 \ + FIL_RUNOUT_ENABLED '{ true, true, true, true, true }' FIL_RUNOUT_MODE '{ 1, 2, 7, 0, 1 }' FIL_RUNOUT_DISTANCE_MM '{ 15, 15, 15, 15, 15 }' opt_enable MIXING_EXTRUDER GRADIENT_MIX GRADIENT_VTOOL CR10_STOCKDISPLAY \ USE_CONTROLLER_FAN CONTROLLER_FAN_EDITABLE CONTROLLER_FAN_IGNORE_Z \ FILAMENT_RUNOUT_SENSOR ADVANCED_PAUSE_FEATURE NOZZLE_PARK_FEATURE diff --git a/buildroot/tests/rambo b/buildroot/tests/rambo index e696dce96e..f5b822f691 100755 --- a/buildroot/tests/rambo +++ b/buildroot/tests/rambo @@ -25,7 +25,7 @@ opt_enable USE_ZMAX_PLUG REPRAP_DISCOUNT_SMART_CONTROLLER LCD_PROGRESS_BAR LCD_P NEOPIXEL_LED NEOPIXEL_PIN CASE_LIGHT_ENABLE CASE_LIGHT_USE_NEOPIXEL CASE_LIGHT_MENU \ PID_PARAMS_PER_HOTEND PID_AUTOTUNE_MENU PID_EDIT_MENU LCD_SHOW_E_TOTAL \ PRINTCOUNTER SERVICE_NAME_1 SERVICE_INTERVAL_1 LEVEL_BED_CORNERS LEVEL_CENTER_TOO \ - NOZZLE_PARK_FEATURE FILAMENT_RUNOUT_SENSOR FILAMENT_RUNOUT_DISTANCE_MM \ + NOZZLE_PARK_FEATURE FILAMENT_RUNOUT_SENSOR FIL_RUNOUT_DISTANCE_MM \ ADVANCED_PAUSE_FEATURE FILAMENT_LOAD_UNLOAD_GCODES FILAMENT_UNLOAD_ALL_EXTRUDERS \ PASSWORD_FEATURE PASSWORD_ON_STARTUP PASSWORD_ON_SD_PRINT_MENU PASSWORD_AFTER_SD_PRINT_END PASSWORD_AFTER_SD_PRINT_ABORT \ AUTO_BED_LEVELING_BILINEAR Z_MIN_PROBE_REPEATABILITY_TEST DISTINCT_E_FACTORS \