Default Filament Runout Sensor enabled state (#19013)
This commit is contained in:
committed by
Scott Lahteine
parent
5a7979b435
commit
16c1e80491
@ -106,6 +106,9 @@
|
||||
|
||||
#if HAS_FILAMENT_SENSOR
|
||||
#include "../feature/runout.h"
|
||||
#ifndef FIL_RUNOUT_ENABLED_DEFAULT
|
||||
#define FIL_RUNOUT_ENABLED_DEFAULT true
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if ENABLED(EXTRA_LIN_ADVANCE_K)
|
||||
@ -646,15 +649,16 @@ void MarlinSettings::postprocess() {
|
||||
#if HAS_FILAMENT_SENSOR
|
||||
const bool &runout_sensor_enabled = runout.enabled;
|
||||
#else
|
||||
constexpr bool runout_sensor_enabled = true;
|
||||
constexpr int8_t runout_sensor_enabled = -1;
|
||||
#endif
|
||||
_FIELD_TEST(runout_sensor_enabled);
|
||||
EEPROM_WRITE(runout_sensor_enabled);
|
||||
|
||||
#if HAS_FILAMENT_RUNOUT_DISTANCE
|
||||
const float &runout_distance_mm = runout.runout_distance();
|
||||
#else
|
||||
constexpr float runout_distance_mm = 0;
|
||||
#endif
|
||||
_FIELD_TEST(runout_sensor_enabled);
|
||||
EEPROM_WRITE(runout_sensor_enabled);
|
||||
EEPROM_WRITE(runout_distance_mm);
|
||||
}
|
||||
|
||||
@ -1518,13 +1522,12 @@ void MarlinSettings::postprocess() {
|
||||
// Filament Runout Sensor
|
||||
//
|
||||
{
|
||||
#if HAS_FILAMENT_SENSOR
|
||||
const bool &runout_sensor_enabled = runout.enabled;
|
||||
#else
|
||||
bool runout_sensor_enabled;
|
||||
#endif
|
||||
int8_t runout_sensor_enabled;
|
||||
_FIELD_TEST(runout_sensor_enabled);
|
||||
EEPROM_READ(runout_sensor_enabled);
|
||||
#if HAS_FILAMENT_SENSOR
|
||||
runout.enabled = runout_sensor_enabled < 0 ? FIL_RUNOUT_ENABLED_DEFAULT : runout_sensor_enabled;
|
||||
#endif
|
||||
|
||||
TERN_(HAS_FILAMENT_SENSOR, if (runout.enabled) runout.reset());
|
||||
|
||||
@ -2476,7 +2479,7 @@ void MarlinSettings::reset() {
|
||||
//
|
||||
|
||||
#if HAS_FILAMENT_SENSOR
|
||||
runout.enabled = true;
|
||||
runout.enabled = FIL_RUNOUT_ENABLED_DEFAULT;
|
||||
runout.reset();
|
||||
TERN_(HAS_FILAMENT_RUNOUT_DISTANCE, runout.set_runout_distance(FILAMENT_RUNOUT_DISTANCE_MM));
|
||||
#endif
|
||||
|
Reference in New Issue
Block a user