IDEX Improvements (#11848)

This commit is contained in:
Roxy-3D
2018-09-17 01:06:22 -05:00
committed by Scott Lahteine
parent 39732838b4
commit 0780913848
24 changed files with 285 additions and 115 deletions

View File

@@ -62,22 +62,31 @@ class FilamentRunoutSensor {
#else
// Read the sensor for the active extruder
bool is_out;
switch (active_extruder) {
case 0: is_out = READ(FIL_RUNOUT_PIN) == FIL_RUNOUT_INVERTING; break;
case 1: is_out = READ(FIL_RUNOUT2_PIN) == FIL_RUNOUT_INVERTING; break;
#if NUM_RUNOUT_SENSORS > 2
case 2: is_out = READ(FIL_RUNOUT3_PIN) == FIL_RUNOUT_INVERTING; break;
#if NUM_RUNOUT_SENSORS > 3
case 3: is_out = READ(FIL_RUNOUT4_PIN) == FIL_RUNOUT_INVERTING; break;
#if NUM_RUNOUT_SENSORS > 4
case 4: is_out = READ(FIL_RUNOUT5_PIN) == FIL_RUNOUT_INVERTING; break;
#if NUM_RUNOUT_SENSORS > 5
case 5: is_out = READ(FIL_RUNOUT6_PIN) == FIL_RUNOUT_INVERTING; break;
#endif
#endif
#endif
#endif
#if ENABLED(DUAL_X_CARRIAGE)
const bool out1 = READ(FIL_RUNOUT_PIN ) == FIL_RUNOUT_INVERTING,
out2 = READ(FIL_RUNOUT2_PIN) == FIL_RUNOUT_INVERTING;
if (extruder_duplication_enabled)
is_out = out1 || out2;
else
is_out = active_extruder ? out2 : out1;
#else
switch (active_extruder) {
case 0: is_out = READ(FIL_RUNOUT_PIN) == FIL_RUNOUT_INVERTING; break;
case 1: is_out = READ(FIL_RUNOUT2_PIN) == FIL_RUNOUT_INVERTING; break;
#if NUM_RUNOUT_SENSORS > 2
case 2: is_out = READ(FIL_RUNOUT3_PIN) == FIL_RUNOUT_INVERTING; break;
#if NUM_RUNOUT_SENSORS > 3
case 3: is_out = READ(FIL_RUNOUT4_PIN) == FIL_RUNOUT_INVERTING; break;
#if NUM_RUNOUT_SENSORS > 4
case 4: is_out = READ(FIL_RUNOUT5_PIN) == FIL_RUNOUT_INVERTING; break;
#if NUM_RUNOUT_SENSORS > 5
case 5: is_out = READ(FIL_RUNOUT6_PIN) == FIL_RUNOUT_INVERTING; break;
#endif // > 5
#endif // > 4
#endif // > 3
#endif // > 2
}
#endif
#endif
return (is_out ? ++runout_count : (runout_count = 0)) > FIL_RUNOUT_THRESHOLD;
}