Fix up pause trigger, adjust config options minor changes
This commit is contained in:
+2
-12
@@ -1466,46 +1466,36 @@
|
||||
*/
|
||||
//#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_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_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.
|
||||
// This is automatically enabled for MIXING_EXTRUDERs.
|
||||
|
||||
// Override individually if the runout sensors vary
|
||||
//#define FIL_RUNOUT1_STATE LOW
|
||||
//#define FIL_RUNOUT1_PULLUP
|
||||
//#define FIL_RUNOUT1_PULLDOWN
|
||||
|
||||
//#define FIL_RUNOUT2_STATE LOW
|
||||
//#define FIL_RUNOUT2_PULLUP
|
||||
//#define FIL_RUNOUT2_PULLDOWN
|
||||
|
||||
//#define FIL_RUNOUT3_STATE LOW
|
||||
//#define FIL_RUNOUT3_PULLUP
|
||||
//#define FIL_RUNOUT3_PULLDOWN
|
||||
|
||||
//#define FIL_RUNOUT4_STATE LOW
|
||||
//#define FIL_RUNOUT4_PULLUP
|
||||
//#define FIL_RUNOUT4_PULLDOWN
|
||||
|
||||
//#define FIL_RUNOUT5_STATE LOW
|
||||
//#define FIL_RUNOUT5_PULLUP
|
||||
//#define FIL_RUNOUT5_PULLDOWN
|
||||
|
||||
//#define FIL_RUNOUT6_STATE LOW
|
||||
//#define FIL_RUNOUT6_PULLUP
|
||||
//#define FIL_RUNOUT6_PULLDOWN
|
||||
|
||||
//#define FIL_RUNOUT7_STATE LOW
|
||||
//#define FIL_RUNOUT7_PULLUP
|
||||
//#define FIL_RUNOUT7_PULLDOWN
|
||||
|
||||
//#define FIL_RUNOUT8_STATE LOW
|
||||
//#define FIL_RUNOUT8_PULLUP
|
||||
//#define FIL_RUNOUT8_PULLDOWN
|
||||
|
||||
@@ -1517,7 +1507,7 @@
|
||||
// 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}
|
||||
#define FILAMENT_RUNOUT_DISTANCE_MM {15}
|
||||
|
||||
#ifdef FILAMENT_RUNOUT_DISTANCE_MM
|
||||
// Enable this option to use an encoder disc that toggles the runout pin
|
||||
|
||||
@@ -209,12 +209,30 @@ bool load_filament(const_float_t slow_load_length/*=0*/, const_float_t fast_load
|
||||
impatient_beep(max_beep_count);
|
||||
#if BOTH(FILAMENT_CHANGE_RESUME_ON_INSERT, FILAMENT_RUNOUT_SENSOR)
|
||||
#if ENABLED(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)
|
||||
#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;
|
||||
REPEAT_1(NUM_RUNOUT_SENSORS, _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)
|
||||
wait_for_user = false;
|
||||
}
|
||||
#else
|
||||
if (READ(FIL_RUNOUT_PIN) != FIL_RUNOUT_STATE) 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;
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
idle_no_sleep();
|
||||
|
||||
@@ -32,9 +32,9 @@
|
||||
|
||||
FilamentMonitor runout;
|
||||
|
||||
bool FilamentMonitorBase::enabled[HOTENDS] = {true},
|
||||
bool FilamentMonitorBase::enabled[NUM_RUNOUT_SENSORS] = {true},
|
||||
FilamentMonitorBase::filament_ran_out; // = false
|
||||
uint8_t FilamentMonitorBase::mode[HOTENDS] = FILAMENT_RUNOUT_DEFAULT_MODE; // Initialized by settings.load
|
||||
uint8_t FilamentMonitorBase::mode[NUM_RUNOUT_SENSORS] = FILAMENT_RUNOUT_DEFAULT_MODE; // Initialized by settings.load
|
||||
#if ENABLED(HOST_ACTION_COMMANDS)
|
||||
bool FilamentMonitorBase::host_handling; // = false
|
||||
#endif
|
||||
@@ -46,8 +46,8 @@ uint8_t FilamentMonitorBase::mode[HOTENDS] = FILAMENT_RUNOUT_DEFAULT_MODE; // In
|
||||
#endif
|
||||
|
||||
|
||||
float RunoutResponseDelayed::runout_distance_mm[HOTENDS] = FILAMENT_RUNOUT_DISTANCE_MM;
|
||||
volatile float RunoutResponseDelayed::runout_mm_countdown[HOTENDS];
|
||||
float RunoutResponseDelayed::runout_distance_mm[NUM_RUNOUT_SENSORS] = FILAMENT_RUNOUT_DISTANCE_MM;
|
||||
volatile float RunoutResponseDelayed::runout_mm_countdown[NUM_RUNOUT_SENSORS];
|
||||
uint8_t FilamentSensorCore::motion_detected;
|
||||
|
||||
|
||||
|
||||
@@ -63,8 +63,8 @@ extern FilamentMonitor runout;
|
||||
|
||||
class FilamentMonitorBase {
|
||||
public:
|
||||
static bool enabled[HOTENDS], filament_ran_out;
|
||||
static uint8_t mode[HOTENDS];
|
||||
static bool enabled[NUM_RUNOUT_SENSORS], filament_ran_out;
|
||||
static uint8_t mode[NUM_RUNOUT_SENSORS];
|
||||
|
||||
#if ENABLED(HOST_ACTION_COMMANDS)
|
||||
static bool host_handling;
|
||||
@@ -319,7 +319,7 @@ class FilamentSensorBase {
|
||||
static volatile float runout_mm_countdown[NUM_RUNOUT_SENSORS];
|
||||
|
||||
public:
|
||||
static float runout_distance_mm[HOTENDS];
|
||||
static float runout_distance_mm[NUM_RUNOUT_SENSORS];
|
||||
|
||||
static void reset() {
|
||||
LOOP_L_N(i, NUM_RUNOUT_SENSORS) filament_present(i);
|
||||
|
||||
@@ -832,11 +832,11 @@
|
||||
/**
|
||||
* Fill in undefined Filament Sensor options
|
||||
*/
|
||||
#ifndef NUM_RUNOUT_SENSORS
|
||||
#define NUM_RUNOUT_SENSORS E_STEPPERS
|
||||
#endif
|
||||
#if ENABLED(FILAMENT_RUNOUT_SENSOR)
|
||||
#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
|
||||
@@ -845,9 +845,6 @@
|
||||
#endif
|
||||
#endif
|
||||
#if NUM_RUNOUT_SENSORS >= 2
|
||||
#ifndef FIL_RUNOUT2_STATE
|
||||
#define FIL_RUNOUT2_STATE FIL_RUNOUT_STATE
|
||||
#endif
|
||||
#ifndef FIL_RUNOUT2_PULLUP
|
||||
#define FIL_RUNOUT2_PULLUP FIL_RUNOUT_PULLUP
|
||||
#endif
|
||||
@@ -856,9 +853,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
|
||||
@@ -867,9 +861,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
|
||||
@@ -878,9 +869,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
|
||||
@@ -889,9 +877,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
|
||||
@@ -900,9 +885,7 @@
|
||||
#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
|
||||
@@ -911,9 +894,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
|
||||
@@ -921,6 +901,14 @@
|
||||
#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
|
||||
|
||||
@@ -543,16 +543,6 @@
|
||||
#define HAS_SERVICE_INTERVALS 1
|
||||
#endif
|
||||
|
||||
#if ENABLED(FILAMENT_RUNOUT_SENSOR)
|
||||
#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
|
||||
|
||||
// Probe Temperature Compensation
|
||||
#if !TEMP_SENSOR_PROBE
|
||||
#undef PTC_PROBE
|
||||
|
||||
@@ -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 FIL_RUNOUT_STATE HIGH."
|
||||
#error "FIL_RUNOUT_INVERTING true is now FILAMENT_RUNOUT_DEFAULT_MODE {HIGH}."
|
||||
#else
|
||||
#error "FIL_RUNOUT_INVERTING false is now FIL_RUNOUT_STATE LOW."
|
||||
#error "FIL_RUNOUT_INVERTING false is now FILAMENT_RUNOUT_DEFAULT_MODE {LOW}."
|
||||
#endif
|
||||
#elif defined(ASSISTED_TRAMMING_MENU_ITEM)
|
||||
#error "ASSISTED_TRAMMING_MENU_ITEM is deprecated and should be removed."
|
||||
@@ -1002,7 +1002,16 @@ 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"
|
||||
#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
|
||||
|
||||
/**
|
||||
|
||||
@@ -80,9 +80,6 @@ void ChironTFT::Startup() {
|
||||
OUT_WRITE(OUTAGECON_PIN, HIGH);
|
||||
#endif
|
||||
|
||||
// Filament runout is handled by Marlin settings in Configuration.h
|
||||
// opt_set FIL_RUNOUT_STATE HIGH // Pin state indicating that filament is NOT present.
|
||||
// opt_enable FIL_RUNOUT_PULLUP
|
||||
TFTSer.begin(115200);
|
||||
|
||||
// wait for the TFT panel to initialise and finish the animation
|
||||
|
||||
@@ -235,9 +235,9 @@ typedef struct SettingsDataStruct {
|
||||
//
|
||||
// FILAMENT_RUNOUT_SENSOR
|
||||
//
|
||||
bool runout_sensor_enabled[HOTENDS]; // M591 S
|
||||
float runout_distance_mm[HOTENDS]; // M591 D
|
||||
uint8_t runout_mode[HOTENDS]; // M591 P
|
||||
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
|
||||
|
||||
//
|
||||
// ENABLE_LEVELING_FADE_HEIGHT
|
||||
@@ -794,18 +794,18 @@ void MarlinSettings::postprocess() {
|
||||
//
|
||||
{
|
||||
#if HAS_FILAMENT_SENSOR
|
||||
LOOP_S_L_N(e, 0, HOTENDS)
|
||||
LOOP_S_L_N(e, 0, NUM_RUNOUT_SENSORS)
|
||||
EEPROM_WRITE(runout.enabled[e]);
|
||||
LOOP_S_L_N(e, 0, HOTENDS)
|
||||
LOOP_S_L_N(e, 0, NUM_RUNOUT_SENSORS)
|
||||
EEPROM_WRITE(runout.runout_distance(e));
|
||||
LOOP_S_L_N(e, 0, HOTENDS)
|
||||
LOOP_S_L_N(e, 0, NUM_RUNOUT_SENSORS)
|
||||
EEPROM_WRITE(runout.mode[e]);
|
||||
#else
|
||||
LOOP_S_L_N(e, 0, HOTENDS)
|
||||
LOOP_S_L_N(e, 0, NUM_RUNOUT_SENSORS)
|
||||
EEPROM_WRITE((int8_t)-1));
|
||||
LOOP_S_L_N(e, 0, HOTENDS)
|
||||
LOOP_S_L_N(e, 0, NUM_RUNOUT_SENSORS)
|
||||
EEPROM_WRITE((float)-0.0f));
|
||||
LOOP_S_L_N(e, 0, HOTENDS)
|
||||
LOOP_S_L_N(e, 0, NUM_RUNOUT_SENSORS)
|
||||
EEPROM_WRITE((uint8_t)0));
|
||||
#endif
|
||||
}
|
||||
@@ -1713,23 +1713,23 @@ void MarlinSettings::postprocess() {
|
||||
// Filament Runout Sensor
|
||||
//
|
||||
{
|
||||
int8_t runout_sensor_enabled[HOTENDS];
|
||||
int8_t runout_sensor_enabled[NUM_RUNOUT_SENSORS];
|
||||
_FIELD_TEST(runout_sensor_enabled);
|
||||
LOOP_S_L_N(e, 0, HOTENDS)
|
||||
LOOP_S_L_N(e, 0, NUM_RUNOUT_SENSORS)
|
||||
EEPROM_READ(runout_sensor_enabled);
|
||||
float runout_distance_mm[HOTENDS];
|
||||
LOOP_S_L_N(e, 0, HOTENDS)
|
||||
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[HOTENDS];
|
||||
LOOP_S_L_N(e, 0, HOTENDS)
|
||||
uint8_t runout_mode[NUM_RUNOUT_SENSORS];
|
||||
LOOP_S_L_N(e, 0, NUM_RUNOUT_SENSORS)
|
||||
EEPROM_READ(runout_mode[e]);
|
||||
|
||||
#if HAS_FILAMENT_SENSOR
|
||||
LOOP_S_L_N(e, 0, HOTENDS)
|
||||
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, HOTENDS)
|
||||
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, HOTENDS)
|
||||
LOOP_S_L_N(e, 0, NUM_RUNOUT_SENSORS)
|
||||
if (!validating) runout.mode[e] = runout_mode[e];
|
||||
runout.reset();
|
||||
#endif
|
||||
@@ -2798,11 +2798,11 @@ void MarlinSettings::reset() {
|
||||
//
|
||||
|
||||
#if HAS_FILAMENT_SENSOR
|
||||
LOOP_S_L_N(e, 0, HOTENDS)
|
||||
LOOP_S_L_N(e, 0, NUM_RUNOUT_SENSORS)
|
||||
runout.enabled[e] = FIL_RUNOUT_ENABLED_DEFAULT;
|
||||
LOOP_S_L_N(e, 0, HOTENDS)
|
||||
LOOP_S_L_N(e, 0, NUM_RUNOUT_SENSORS)
|
||||
runout.set_runout_distance(FILAMENT_RUNOUT_DISTANCE_MM, e);
|
||||
LOOP_S_L_N(e, 0, HOTENDS)
|
||||
LOOP_S_L_N(e, 0, NUM_RUNOUT_SENSORS)
|
||||
runout.mode[e] = FILAMENT_RUNOUT_DEFAULT_MODE;
|
||||
|
||||
runout.reset();
|
||||
|
||||
Reference in New Issue
Block a user