Filament sensor cleanup

This commit is contained in:
Scott Lahteine
2021-02-28 19:50:17 -06:00
committed by Scott Lahteine
parent fbb30a2570
commit fd5f1f1f5d
8 changed files with 20 additions and 20 deletions

View File

@@ -192,11 +192,7 @@ bool load_filament(const float &slow_load_length/*=0*/, const float &fast_load_l
KEEPALIVE_STATE(PAUSED_FOR_USER);
wait_for_user = true; // LCD click or M108 will clear this
#if ENABLED(HOST_PROMPT_SUPPORT)
const char tool = '0'
#if NUM_RUNOUT_SENSORS > 1
+ active_extruder
#endif
;
const char tool = '0' + TERN0(MULTI_FILAMENT_SENSOR, active_extruder);
host_prompt_do(PROMPT_USER_CONTINUE, PSTR("Load Filament T"), tool, CONTINUE_STR);
#endif

View File

@@ -88,11 +88,7 @@ void event_filament_runout() {
TERN_(EXTENSIBLE_UI, ExtUI::onFilamentRunout(ExtUI::getActiveTool()));
#if EITHER(HOST_PROMPT_SUPPORT, HOST_ACTION_COMMANDS)
const char tool = '0'
#if NUM_RUNOUT_SENSORS > 1
+ active_extruder
#endif
;
const char tool = '0' + TERN0(MULTI_FILAMENT_SENSOR, active_extruder);
#endif
//action:out_of_filament

View File

@@ -230,7 +230,7 @@ class FilamentSensorBase {
change = old_state ^ new_state;
old_state = new_state;
#ifdef FILAMENT_RUNOUT_SENSOR_DEBUG
#if ENABLED(FILAMENT_RUNOUT_SENSOR_DEBUG)
if (change) {
SERIAL_ECHOPGM("Motion detected:");
LOOP_L_N(e, NUM_RUNOUT_SENSORS)
@@ -266,12 +266,12 @@ class FilamentSensorBase {
private:
static inline bool poll_runout_state(const uint8_t extruder) {
const uint8_t runout_states = poll_runout_states();
#if NUM_RUNOUT_SENSORS == 1
UNUSED(extruder);
#else
#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
}
@@ -282,7 +282,7 @@ class FilamentSensorBase {
static inline void run() {
const bool out = poll_runout_state(active_extruder);
if (!out) filament_present(active_extruder);
#ifdef FILAMENT_RUNOUT_SENSOR_DEBUG
#if ENABLED(FILAMENT_RUNOUT_SENSOR_DEBUG)
static bool was_out = false;
if (out != was_out) {
was_out = out;
@@ -315,7 +315,7 @@ class FilamentSensorBase {
}
static inline void run() {
#ifdef FILAMENT_RUNOUT_SENSOR_DEBUG
#if ENABLED(FILAMENT_RUNOUT_SENSOR_DEBUG)
static millis_t t = 0;
const millis_t ms = millis();
if (ELAPSED(ms, t)) {