Compare commits

...

4 Commits

Author SHA1 Message Date
InsanityAutomation f3ed2473ea Update runout.h 2024-07-13 12:36:49 -04:00
InsanityAutomation 2a570b8983 Update runout.h 2024-07-13 12:36:48 -04:00
InsanityAutomation e8d124886e Pass 1 builds - Switch and Motion support dropped temporarily 2024-07-13 12:36:48 -04:00
InsanityAutomation 180832ef0c First Pass M591 Import 2024-07-13 12:36:48 -04:00
33 changed files with 412 additions and 419 deletions
+9 -57
View File
@@ -1908,12 +1908,11 @@
* RAMPS-based boards use SERVO3_PIN for the first runout sensor.
* For other boards you may need to define FIL_RUNOUT_PIN, FIL_RUNOUT2_PIN, etc.
*/
//#define FILAMENT_RUNOUT_SENSOR
#define FILAMENT_RUNOUT_SENSOR
#if ENABLED(FILAMENT_RUNOUT_SENSOR)
#define FIL_RUNOUT_ENABLED_DEFAULT true // Enable the sensor on startup. Override with M412 followed by M500.
#define NUM_RUNOUT_SENSORS 1 // Number of sensors, up to one per extruder. Define a FIL_RUNOUT#_PIN for each.
#define FIL_RUNOUT_ENABLED { true } // Default enabled state for sensors E0[, E1[, E2[, E3...]]]. Override with M591EnnSn followed by M500.
#define FIL_RUNOUT_MODE { 7 } // Default mode for sensors E0[, E1[, E2[, E3...]]]. 0:NONE 1:Switch NO 2:Switch NC 7:Motion Sensor Override with M591EnPnn
#define FIL_RUNOUT_STATE LOW // Pin state indicating that filament is NOT present.
#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.
@@ -1957,58 +1956,11 @@
// NOTE: After 'M412 H1' the host handles filament runout and this script does not apply.
#define FILAMENT_RUNOUT_SCRIPT "M600"
// 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 25
#ifdef FILAMENT_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.)
//#define FILAMENT_MOTION_SENSOR
#if ENABLED(FILAMENT_MOTION_SENSOR)
//#define FILAMENT_SWITCH_AND_MOTION
#if ENABLED(FILAMENT_SWITCH_AND_MOTION)
#define NUM_MOTION_SENSORS 1 // Number of sensors, up to one per extruder. Define a FIL_MOTION#_PIN for each.
//#define FIL_MOTION1_PIN -1
// Override individually if the motion sensors vary
//#define FIL_MOTION1_STATE LOW
//#define FIL_MOTION1_PULLUP
//#define FIL_MOTION1_PULLDOWN
//#define FIL_MOTION2_STATE LOW
//#define FIL_MOTION2_PULLUP
//#define FIL_MOTION2_PULLDOWN
//#define FIL_MOTION3_STATE LOW
//#define FIL_MOTION3_PULLUP
//#define FIL_MOTION3_PULLDOWN
//#define FIL_MOTION4_STATE LOW
//#define FIL_MOTION4_PULLUP
//#define FIL_MOTION4_PULLDOWN
//#define FIL_MOTION5_STATE LOW
//#define FIL_MOTION5_PULLUP
//#define FIL_MOTION5_PULLDOWN
//#define FIL_MOTION6_STATE LOW
//#define FIL_MOTION6_PULLUP
//#define FIL_MOTION6_PULLDOWN
//#define FIL_MOTION7_STATE LOW
//#define FIL_MOTION7_PULLUP
//#define FIL_MOTION7_PULLDOWN
//#define FIL_MOTION8_STATE LOW
//#define FIL_MOTION8_PULLUP
//#define FIL_MOTION8_PULLDOWN
#endif
#endif
#endif
// In Mode 1 or 2, continue printing this length of filament after a run out occurs before executing the
// runout script. Useful for a sensor at the end of a feed tube or debounce on a flakey sensor.
// In Mode 7, extrusion distance to expect a change of state.
// Override with M591EnLnn
#define FILAMENT_RUNOUT_DISTANCE_MM 5
#endif
//===========================================================================
@@ -2431,7 +2383,7 @@
* P1 Raise the nozzle always to Z-park height.
* P2 Raise the nozzle by Z-park amount, limited to Z_MAX_POS.
*/
//#define NOZZLE_PARK_FEATURE
#define NOZZLE_PARK_FEATURE
#if ENABLED(NOZZLE_PARK_FEATURE)
// Specify a park position as { X, Y, Z_raise }
+2 -2
View File
@@ -2655,7 +2655,7 @@
* Currently handles M108, M112, M410, M876
* NOTE: Not yet implemented for all platforms.
*/
//#define EMERGENCY_PARSER
#define EMERGENCY_PARSER
/**
* Realtime Reporting (requires EMERGENCY_PARSER)
@@ -2888,7 +2888,7 @@
*
* Enable PARK_HEAD_ON_PAUSE to add the G-code M125 Pause and Park.
*/
//#define ADVANCED_PAUSE_FEATURE
#define ADVANCED_PAUSE_FEATURE
#if ENABLED(ADVANCED_PAUSE_FEATURE)
#define PAUSE_PARK_RETRACT_FEEDRATE 60 // (mm/s) Initial retract feedrate.
#define PAUSE_PARK_RETRACT_LENGTH 2 // (mm) Initial retract.
+1 -1
View File
@@ -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
+1 -1
View File
@@ -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
+13 -4
View File
@@ -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();
+7 -12
View File
@@ -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
+65 -189
View File
@@ -40,16 +40,6 @@
#endif
//#define FILAMENT_RUNOUT_SENSOR_DEBUG
#ifndef FILAMENT_RUNOUT_THRESHOLD
#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
@@ -62,73 +52,65 @@ typedef Flags<
void event_filament_runout(const uint8_t extruder);
inline bool should_monitor_runout() { return did_pause_print || printingIsActive(); }
template<class RESPONSE_T, class SENSOR_T>
class TFilamentMonitor;
class FilamentSensor;
class RunoutResponseDelayed;
class RunoutResponseDebounced;
/********************************* TEMPLATE SPECIALIZATION *********************************/
typedef TFilamentMonitor<
TERN(HAS_FILAMENT_RUNOUT_DISTANCE, RunoutResponseDelayed, RunoutResponseDebounced),
FilamentSensor
> FilamentMonitor;
extern FilamentMonitor runout;
/*******************************************************************************************/
class FilamentMonitorBase {
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 FilamentSensor {
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;
#else
static constexpr bool host_handling = false;
#endif
};
template<class RESPONSE_T, class SENSOR_T>
class TFilamentMonitor : public FilamentMonitorBase {
private:
typedef RESPONSE_T response_t;
typedef SENSOR_T sensor_t;
static response_t response;
static sensor_t sensor;
public:
static void setup() {
sensor.setup();
#define _INIT_RUNOUT_PIN(P,S,U,D) do{ if (ENABLED(U)) SET_INPUT_PULLUP(P); else if (ENABLED(D)) SET_INPUT_PULLDOWN(P); else SET_INPUT(P); }while(0);
#define INIT_RUNOUT_PIN(N) _INIT_RUNOUT_PIN(FIL_RUNOUT##N##_PIN, FIL_RUNOUT##N##_STATE, FIL_RUNOUT##N##_PULLUP, FIL_RUNOUT##N##_PULLDOWN);
REPEAT_1(NUM_RUNOUT_SENSORS, INIT_RUNOUT_PIN)
#undef INIT_RUNOUT_PIN
#if ENABLED(FILAMENT_SWITCH_AND_MOTION)
#define INIT_MOTION_PIN(N) _INIT_RUNOUT_PIN(FIL_MOTION##N##_PIN, FIL_MOTION##N##_STATE, FIL_MOTION##N##_PULLUP, FIL_MOTION##N##_PULLDOWN);
REPEAT_1(NUM_MOTION_SENSORS, INIT_MOTION_PIN)
#undef INIT_MOTION_PIN
#endif
#undef _INIT_RUNOUT_PIN
reset();
}
static void reset() {
filament_ran_out = false;
response.reset();
for (uint8_t i = 0; i < NUM_RUNOUT_SENSORS; ++i) filament_present(i);
#if ENABLED(FILAMENT_SWITCH_AND_MOTION)
for (uint8_t i = 0; i < NUM_MOTION_SENSORS; ++i) filament_motion_present(i);
#endif
}
// 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) { filament_present(e); }
static float& runout_distance(const uint8_t e=0) { return runout_distance_mm[e]; }
static void set_runout_distance(const_float_t mm, const uint8_t e=0) { 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 +119,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
@@ -169,11 +151,7 @@ class TFilamentMonitor : public FilamentMonitorBase {
}
}
}
};
/*************************** FILAMENT PRESENCE SENSORS ***************************/
class FilamentSensorBase {
protected:
/**
* Called by FilamentSensorSwitch::run when filament is detected.
@@ -182,26 +160,8 @@ 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() {
#define _INIT_RUNOUT_PIN(P,S,U,D) do{ if (ENABLED(U)) SET_INPUT_PULLUP(P); else if (ENABLED(D)) SET_INPUT_PULLDOWN(P); else SET_INPUT(P); }while(0);
#define INIT_RUNOUT_PIN(N) _INIT_RUNOUT_PIN(FIL_RUNOUT##N##_PIN, FIL_RUNOUT##N##_STATE, FIL_RUNOUT##N##_PULLUP, FIL_RUNOUT##N##_PULLDOWN);
REPEAT_1(NUM_RUNOUT_SENSORS, INIT_RUNOUT_PIN)
#undef INIT_RUNOUT_PIN
#if ENABLED(FILAMENT_SWITCH_AND_MOTION)
#define INIT_MOTION_PIN(N) _INIT_RUNOUT_PIN(FIL_MOTION##N##_PIN, FIL_MOTION##N##_STATE, FIL_MOTION##N##_PULLUP, FIL_MOTION##N##_PULLDOWN);
REPEAT_1(NUM_MOTION_SENSORS, INIT_MOTION_PIN)
#undef INIT_MOTION_PIN
#endif
#undef _INIT_RUNOUT_PIN
}
// Return a bitmask of runout pin states
static uint8_t poll_runout_pins() {
@@ -212,12 +172,11 @@ 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
}
#if ENABLED(FILAMENT_SWITCH_AND_MOTION)
// Return a bitmask of motion pin states
static uint8_t poll_motion_pins() {
#define _OR_MOTION(N) | (READ(FIL_MOTION##N##_PIN) ? _BV((N) - 1) : 0)
@@ -231,20 +190,23 @@ class FilamentSensorBase {
return poll_motion_pins() ^ uint8_t(0 REPEAT_1(NUM_MOTION_SENSORS, _OR_MOTION));
#undef _OR_MOTION
}
#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;
@@ -275,36 +237,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 (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 (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 +254,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<NUM_RUNOUT_SENSORS> runout_reset; // Reset runout later
#if ENABLED(FILAMENT_SWITCH_AND_MOTION)
@@ -361,15 +276,9 @@ class FilamentSensorBase {
private:
static countdown_t mm_countdown;
public:
static float runout_distance_mm;
static void reset() {
for (uint8_t i = 0; i < NUM_RUNOUT_SENSORS; ++i) filament_present(i);
#if ENABLED(FILAMENT_SWITCH_AND_MOTION)
for (uint8_t i = 0; i < NUM_MOTION_SENSORS; ++i) filament_motion_present(i);
#endif
}
public:
static float runout_distance_mm[NUM_RUNOUT_SENSORS];
static int8_t runout_count[NUM_RUNOUT_SENSORS];
static void run() {
#if ENABLED(FILAMENT_RUNOUT_SENSOR_DEBUG)
@@ -398,11 +307,11 @@ class FilamentSensorBase {
}
static void filament_present(const uint8_t extruder) {
if (mm_countdown.runout[extruder] < runout_distance_mm || did_pause_print) {
if (mm_countdown.runout[extruder] < runout_distance_mm[extruder] || 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[extruder] = runout_distance_mm[extruder];
mm_countdown.runout_reset.clear(extruder);
}
else {
@@ -451,36 +360,3 @@ class FilamentSensorBase {
}
};
#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};
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;
}
};
#endif // !HAS_FILAMENT_RUNOUT_DISTANCE
+1 -1
View File
@@ -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
@@ -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<bool> : Reset and enable/disable the runout sensor
* H<bool> : Enable/disable host handling of filament runout
* D<linear> : Extra distance to continue after runout is triggered
* L<linear> : Extra distance to continue after runout is triggered or motion interval
* D<linear> : Alias for L
* P<index> : 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
+5 -4
View File
@@ -865,10 +865,6 @@ void GcodeSuite::process_parsed_command(const bool no_ok/*=false*/) {
case 407: M407(); break; // M407: Display measured filament diameter
#endif
#if HAS_FILAMENT_SENSOR
case 412: M412(); break; // M412: Enable/Disable filament runout detection
#endif
#if HAS_MULTI_LANGUAGE
case 414: M414(); break; // M414: Select multi language menu
#endif
@@ -947,6 +943,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
+5 -4
View File
@@ -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<pos> Y<pos> Z<raise> E<first_retract> L<later_retract>". (Requires ADVANCED_PAUSE_FEATURE)
* M603 - Configure filament change: "M603 T<tool> U<unload_length> L<load_length>". (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
+1 -1
View File
@@ -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)
+32 -24
View File
@@ -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
-3
View File
@@ -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
+63 -2
View File
@@ -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
+5 -5
View File
@@ -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
+3 -3
View File
@@ -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);
+1 -1
View File
@@ -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();
}
@@ -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
@@ -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;
}
+13 -6
View File
@@ -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)
+6 -7
View File
@@ -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
+8
View File
@@ -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");
+51 -6
View File
@@ -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();
+1 -1
View File
@@ -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
+4 -7
View File
@@ -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)
+26 -8
View File
@@ -58,6 +58,10 @@
#include "probe.h"
#endif
#if ENABLED(FILAMENT_RUNOUT_SENSOR)
#include "../feature/runout.h"
#endif
Endstops endstops;
// private:
@@ -504,22 +508,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());
+31 -20
View File
@@ -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");
+2 -2
View File
@@ -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 {
+4 -2
View File
@@ -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 \
@@ -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"
+1 -1
View File
@@ -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 \
+2 -2
View File
@@ -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 \