Skip to content

Commit 2dfda67

Browse files
committed
correction
1 parent 0cb5208 commit 2dfda67

8 files changed

Lines changed: 17 additions & 70 deletions

File tree

Marlin/Configuration.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2044,7 +2044,8 @@
20442044
*/
20452045
//#define FILAMENT_RUNOUT_SENSOR
20462046
#if ENABLED(FILAMENT_RUNOUT_SENSOR)
2047-
#define FIL_RUNOUT_ENABLED_DEFAULT true // Enable the sensor on startup. Override with M412 followed by M500.
2047+
#define FIL_RUNOUT_ENABLED_DEFAULT true // Enable sensor monitoring on startup. Override with M412 followed by M500.
2048+
#define FIL_RUNOUT_ENABLED { true } // Individual runout sensors default enabled state. Override with M591 followed by M500.
20482049
#define NUM_RUNOUT_SENSORS 1 // Number of sensors, up to one per extruder. Define a FIL_RUNOUT#_PIN for each.
20492050

20502051
#define FIL_RUNOUT_STATE LOW // Pin state indicating that filament is NOT present.

Marlin/src/feature/runout.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,9 @@
3232

3333
FilamentMonitor runout;
3434

35-
// enabled[] and monitoring are initialized by settings.load() / settings defaults.
3635
// Default: master monitoring on, all sensors individually enabled, mode RM_NONE.
37-
bool FilamentMonitorBase::enabled[NUM_RUNOUT_SENSORS], // initialized by settings
38-
FilamentMonitorBase::monitoring, // initialized by settings
36+
bool FilamentMonitorBase::monitoring, // initialized by settings
37+
FilamentMonitorBase::enabled[NUM_RUNOUT_SENSORS], // initialized by settings
3938
FilamentMonitorBase::filament_ran_out; // = false
4039

4140
RunoutMode FilamentMonitorBase::mode[NUM_RUNOUT_SENSORS]; // initialized by settings

Marlin/src/inc/Changes.h

Lines changed: 0 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -765,48 +765,6 @@
765765
#error "MP_SCARA is now just SCARA."
766766
#elif defined(HAS_PIN_27_BOARD)
767767
#error "HAS_PIN_27_BOARD is now USE_PIN_27_BOARD."
768-
#elif defined(FIL_RUNOUT2_STATE)
769-
#if FIL_RUNOUT2_STATE
770-
#error "FIL_RUNOUT2_STATE HIGH is replaced by FIL_RUNOUT_MODE { n, 2, ... }."
771-
#else
772-
#error "FIL_RUNOUT2_STATE LOW is replaced by FIL_RUNOUT_MODE { n, 1, ... }."
773-
#endif
774-
#elif defined(FIL_RUNOUT3_STATE)
775-
#if FIL_RUNOUT3_STATE
776-
#error "FIL_RUNOUT3_STATE HIGH is replaced by FIL_RUNOUT_MODE { n, n, 2, ... }."
777-
#else
778-
#error "FIL_RUNOUT3_STATE LOW is replaced by FIL_RUNOUT_MODE { n, n, 1, ... }."
779-
#endif
780-
#elif defined(FIL_RUNOUT4_STATE)
781-
#if FIL_RUNOUT4_STATE
782-
#error "FIL_RUNOUT4_STATE HIGH is replaced by FIL_RUNOUT_MODE { n, n, n, 2, ... }."
783-
#else
784-
#error "FIL_RUNOUT4_STATE LOW is replaced by FIL_RUNOUT_MODE { n, n, n, 1, ... }."
785-
#endif
786-
#elif defined(FIL_RUNOUT5_STATE)
787-
#if FIL_RUNOUT5_STATE
788-
#error "FIL_RUNOUT5_STATE HIGH is replaced by FIL_RUNOUT_MODE { n, n, n, n, 2, ... }."
789-
#else
790-
#error "FIL_RUNOUT5_STATE LOW is replaced by FIL_RUNOUT_MODE { n, n, n, n, 1, ... }."
791-
#endif
792-
#elif defined(FIL_RUNOUT6_STATE)
793-
#if FIL_RUNOUT6_STATE
794-
#error "FIL_RUNOUT6_STATE HIGH is replaced by FIL_RUNOUT_MODE { n, n, n, n, n, 2, ... }."
795-
#else
796-
#error "FIL_RUNOUT6_STATE LOW is replaced by FIL_RUNOUT_MODE { n, n, n, n, n, 1, ... }."
797-
#endif
798-
#elif defined(FIL_RUNOUT7_STATE)
799-
#if FIL_RUNOUT7_STATE
800-
#error "FIL_RUNOUT7_STATE HIGH is replaced by FIL_RUNOUT_MODE { n, n, n, n, n, n, 2, ... }."
801-
#else
802-
#error "FIL_RUNOUT7_STATE LOW is replaced by FIL_RUNOUT_MODE { n, n, n, n, n, n, 1, ... }."
803-
#endif
804-
#elif defined(FIL_RUNOUT8_STATE)
805-
#if FIL_RUNOUT8_STATE
806-
#error "FIL_RUNOUT8_STATE HIGH is replaced by FIL_RUNOUT_MODE { n, n, n, n, n, n, n, 2 }."
807-
#else
808-
#error "FIL_RUNOUT8_STATE LOW is replaced by FIL_RUNOUT_MODE { n, n, n, n, n, n, n, 1 }."
809-
#endif
810768
#endif
811769

812770
// SDSS renamed to SD_SS_PIN

Marlin/src/inc/Conditionals-4-adv.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -989,7 +989,7 @@
989989
#if NUM_RUNOUT_SENSORS > 1
990990
#define MULTI_FILAMENT_SENSOR 1
991991
#endif
992-
#if FILAMENT_RUNOUT_DISTANCE_MM
992+
#ifdef FILAMENT_RUNOUT_DISTANCE_MM
993993
#define HAS_FILAMENT_RUNOUT_DISTANCE 1
994994
#endif
995995
#if ENABLED(MIXING_EXTRUDER)

Marlin/src/inc/SanityCheck.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -533,6 +533,8 @@ static_assert(COUNT(arm) == LOGICAL_AXES, "AXIS_RELATIVE_MODES must contain " _L
533533
#error "You can't enable FIL_RUNOUT7_PULLUP and FIL_RUNOUT7_PULLDOWN at the same time."
534534
#elif ALL(FIL_RUNOUT8_PULLUP, FIL_RUNOUT8_PULLDOWN)
535535
#error "You can't enable FIL_RUNOUT8_PULLUP and FIL_RUNOUT8_PULLDOWN at the same time."
536+
#elif FILAMENT_RUNOUT_DISTANCE_MM < 0
537+
#error "FILAMENT_RUNOUT_DISTANCE_MM must be >= 0."
536538
#elif DISABLED(ADVANCED_PAUSE_FEATURE) && defined(FILAMENT_RUNOUT_SCRIPT)
537539
static_assert(nullptr == strstr(FILAMENT_RUNOUT_SCRIPT, "M600"), "FILAMENT_RUNOUT_SCRIPT cannot make use of M600 unless ADVANCED_PAUSE_FEATURE is enabled");
538540
#elif DGUS_LCD_UI_MKS
@@ -803,8 +805,6 @@ static_assert(COUNT(arm) == LOGICAL_AXES, "AXIS_RELATIVE_MODES must contain " _L
803805
#elif HAS_FILAMENT_RUNOUT_DISTANCE
804806
#error "MIXING_EXTRUDER is incompatible with FILAMENT_RUNOUT_DISTANCE_MM."
805807
#endif
806-
#elif defined(FILAMENT_RUNOUT_DISTANCE_MM) && FILAMENT_RUNOUT_DISTANCE_MM < 0
807-
#error "FILAMENT_RUNOUT_DISTANCE_MM must be >= 0."
808808
#endif
809809

810810
/**

Marlin/src/lcd/dwin/jyersui/dwin.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2955,7 +2955,7 @@ void JyersDWIN::menuItemHandler(const uint8_t menu, const uint8_t item, bool dra
29552955
drawCheckbox(row, runout.monitoring);
29562956
}
29572957
else {
2958-
runout.monitoring = !runout.monitoring;
2958+
FLIP(runout.monitoring)
29592959
drawCheckbox(row, runout.monitoring);
29602960
}
29612961
break;
@@ -3952,7 +3952,7 @@ void JyersDWIN::menuItemHandler(const uint8_t menu, const uint8_t item, bool dra
39523952
drawCheckbox(row, runout.monitoring);
39533953
}
39543954
else {
3955-
runout.monitoring = !runout.monitoring;
3955+
FLIP(runout.monitoring);
39563956
drawCheckbox(row, runout.monitoring);
39573957
}
39583958
break;

Marlin/src/lcd/dwin/proui/dwin.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2302,7 +2302,7 @@ void setMoveZ() { hmiValue.axis = Z_AXIS; setPFloatOnClick(Z_MIN_POS, Z_MAX_POS,
23022302
#if HAS_FILAMENT_SENSOR
23032303
void setRunoutEnable() {
23042304
runout.reset();
2305-
runout.monitoring = !runout.monitoring;
2305+
FLIP(runout.monitoring);
23062306
showCheckboxLine(runout.monitoring);
23072307
}
23082308
#if HAS_FILAMENT_RUNOUT_DISTANCE

Marlin/src/module/settings.cpp

Lines changed: 7 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -262,8 +262,6 @@ typedef struct SettingsDataStruct {
262262
#if ENABLED(FILAMENT_SWITCH_AND_MOTION)
263263
float runout_motion_distance_mm; // M412 L
264264
#endif
265-
#else
266-
uint8_t runout_placeholder[3]; // Keeps layout stable when sensor disabled
267265
#endif
268266

269267
//
@@ -984,10 +982,10 @@ void MarlinSettings::postprocess() {
984982
//
985983
#if HAS_FILAMENT_SENSOR
986984
{
987-
bool runout_enabled[NUM_RUNOUT_SENSORS];
988-
bool runout_monitoring;
985+
bool runout_monitoring;
986+
bool runout_enabled[NUM_RUNOUT_SENSORS];
989987
#if HAS_FILAMENT_RUNOUT_DISTANCE
990-
float runout_distance_mm[NUM_RUNOUT_SENSORS];
988+
float runout_distance_mm[NUM_RUNOUT_SENSORS];
991989
#endif
992990
uint8_t runout_mode[NUM_RUNOUT_SENSORS];
993991
for (uint8_t e = 0; e < NUM_RUNOUT_SENSORS; ++e) {
@@ -1009,12 +1007,6 @@ void MarlinSettings::postprocess() {
10091007
EEPROM_WRITE(runout.motion_distance());
10101008
#endif
10111009
}
1012-
#else
1013-
{
1014-
uint8_t runout_placeholder[3] = { 0 };
1015-
_FIELD_TEST(runout_placeholder);
1016-
EEPROM_WRITE(runout_placeholder);
1017-
}
10181010
#endif
10191011

10201012
//
@@ -2095,12 +2087,6 @@ void MarlinSettings::postprocess() {
20952087
runout.reset();
20962088
}
20972089
}
2098-
#else
2099-
{
2100-
uint8_t runout_placeholder[3];
2101-
_FIELD_TEST(runout_placeholder);
2102-
EEPROM_READ(runout_placeholder);
2103-
}
21042090
#endif
21052091

21062092
//
@@ -4204,7 +4190,10 @@ void MarlinSettings::reset() {
42044190
//
42054191
// Filament Runout Sensor
42064192
//
4207-
TERN_(HAS_FILAMENT_SENSOR, gcode.M591_report(forReplay));
4193+
#if HAS_FILAMENT_SENSOR
4194+
gcode.M412_report(forReplay);
4195+
gcode.M591_report(forReplay);
4196+
#endif
42084197

42094198
#if HAS_ETHERNET
42104199
CONFIG_ECHO_HEADING("Ethernet");

0 commit comments

Comments
 (0)