|
@ -106,6 +106,9 @@ |
|
|
|
|
|
|
|
|
#if HAS_FILAMENT_SENSOR |
|
|
#if HAS_FILAMENT_SENSOR |
|
|
#include "../feature/runout.h" |
|
|
#include "../feature/runout.h" |
|
|
|
|
|
#ifndef FIL_RUNOUT_ENABLED_DEFAULT |
|
|
|
|
|
#define FIL_RUNOUT_ENABLED_DEFAULT true |
|
|
|
|
|
#endif |
|
|
#endif |
|
|
#endif |
|
|
|
|
|
|
|
|
#if ENABLED(EXTRA_LIN_ADVANCE_K) |
|
|
#if ENABLED(EXTRA_LIN_ADVANCE_K) |
|
@ -646,15 +649,16 @@ void MarlinSettings::postprocess() { |
|
|
#if HAS_FILAMENT_SENSOR |
|
|
#if HAS_FILAMENT_SENSOR |
|
|
const bool &runout_sensor_enabled = runout.enabled; |
|
|
const bool &runout_sensor_enabled = runout.enabled; |
|
|
#else |
|
|
#else |
|
|
constexpr bool runout_sensor_enabled = true; |
|
|
constexpr int8_t runout_sensor_enabled = -1; |
|
|
#endif |
|
|
#endif |
|
|
|
|
|
_FIELD_TEST(runout_sensor_enabled); |
|
|
|
|
|
EEPROM_WRITE(runout_sensor_enabled); |
|
|
|
|
|
|
|
|
#if HAS_FILAMENT_RUNOUT_DISTANCE |
|
|
#if HAS_FILAMENT_RUNOUT_DISTANCE |
|
|
const float &runout_distance_mm = runout.runout_distance(); |
|
|
const float &runout_distance_mm = runout.runout_distance(); |
|
|
#else |
|
|
#else |
|
|
constexpr float runout_distance_mm = 0; |
|
|
constexpr float runout_distance_mm = 0; |
|
|
#endif |
|
|
#endif |
|
|
_FIELD_TEST(runout_sensor_enabled); |
|
|
|
|
|
EEPROM_WRITE(runout_sensor_enabled); |
|
|
|
|
|
EEPROM_WRITE(runout_distance_mm); |
|
|
EEPROM_WRITE(runout_distance_mm); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
@ -1518,13 +1522,12 @@ void MarlinSettings::postprocess() { |
|
|
// Filament Runout Sensor
|
|
|
// Filament Runout Sensor
|
|
|
//
|
|
|
//
|
|
|
{ |
|
|
{ |
|
|
#if HAS_FILAMENT_SENSOR |
|
|
int8_t runout_sensor_enabled; |
|
|
const bool &runout_sensor_enabled = runout.enabled; |
|
|
|
|
|
#else |
|
|
|
|
|
bool runout_sensor_enabled; |
|
|
|
|
|
#endif |
|
|
|
|
|
_FIELD_TEST(runout_sensor_enabled); |
|
|
_FIELD_TEST(runout_sensor_enabled); |
|
|
EEPROM_READ(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()); |
|
|
TERN_(HAS_FILAMENT_SENSOR, if (runout.enabled) runout.reset()); |
|
|
|
|
|
|
|
@ -2476,7 +2479,7 @@ void MarlinSettings::reset() { |
|
|
//
|
|
|
//
|
|
|
|
|
|
|
|
|
#if HAS_FILAMENT_SENSOR |
|
|
#if HAS_FILAMENT_SENSOR |
|
|
runout.enabled = true; |
|
|
runout.enabled = FIL_RUNOUT_ENABLED_DEFAULT; |
|
|
runout.reset(); |
|
|
runout.reset(); |
|
|
TERN_(HAS_FILAMENT_RUNOUT_DISTANCE, runout.set_runout_distance(FILAMENT_RUNOUT_DISTANCE_MM)); |
|
|
TERN_(HAS_FILAMENT_RUNOUT_DISTANCE, runout.set_runout_distance(FILAMENT_RUNOUT_DISTANCE_MM)); |
|
|
#endif |
|
|
#endif |
|
|