|
@@ -48,6 +48,24 @@
|
48
|
48
|
|
49
|
49
|
void event_filament_runout();
|
50
|
50
|
|
|
51
|
+template<class RESPONSE_T, class SENSOR_T>
|
|
52
|
+class TFilamentMonitor;
|
|
53
|
+class FilamentSensorEncoder;
|
|
54
|
+class FilamentSensorSwitch;
|
|
55
|
+class RunoutResponseDelayed;
|
|
56
|
+class RunoutResponseDebounced;
|
|
57
|
+
|
|
58
|
+/********************************* TEMPLATE SPECIALIZATION *********************************/
|
|
59
|
+
|
|
60
|
+typedef TFilamentMonitor<
|
|
61
|
+ TERN(HAS_FILAMENT_RUNOUT_DISTANCE, RunoutResponseDelayed, RunoutResponseDebounced),
|
|
62
|
+ TERN(FILAMENT_MOTION_SENSOR, FilamentSensorEncoder, FilamentSensorSwitch)
|
|
63
|
+ > FilamentMonitor;
|
|
64
|
+
|
|
65
|
+extern FilamentMonitor runout;
|
|
66
|
+
|
|
67
|
+/*******************************************************************************************/
|
|
68
|
+
|
51
|
69
|
class FilamentMonitorBase {
|
52
|
70
|
public:
|
53
|
71
|
static bool enabled, filament_ran_out;
|
|
@@ -121,7 +139,13 @@ class TFilamentMonitor : public FilamentMonitorBase {
|
121
|
139
|
|
122
|
140
|
class FilamentSensorBase {
|
123
|
141
|
protected:
|
124
|
|
- static void filament_present(const uint8_t extruder);
|
|
142
|
+ /**
|
|
143
|
+ * Called by FilamentSensorSwitch::run when filament is detected.
|
|
144
|
+ * Called by FilamentSensorEncoder::block_completed when motion is detected.
|
|
145
|
+ */
|
|
146
|
+ static inline void filament_present(const uint8_t extruder) {
|
|
147
|
+ runout.filament_present(extruder); // ...which calls response.filament_present(extruder)
|
|
148
|
+ }
|
125
|
149
|
|
126
|
150
|
public:
|
127
|
151
|
static inline void setup() {
|
|
@@ -311,12 +335,3 @@ class FilamentSensorBase {
|
311
|
335
|
};
|
312
|
336
|
|
313
|
337
|
#endif // !HAS_FILAMENT_RUNOUT_DISTANCE
|
314
|
|
-
|
315
|
|
-/********************************* TEMPLATE SPECIALIZATION *********************************/
|
316
|
|
-
|
317
|
|
-typedef TFilamentMonitor<
|
318
|
|
- TERN(HAS_FILAMENT_RUNOUT_DISTANCE, RunoutResponseDelayed, RunoutResponseDebounced),
|
319
|
|
- TERN(FILAMENT_MOTION_SENSOR, FilamentSensorEncoder, FilamentSensorSwitch)
|
320
|
|
- > FilamentMonitor;
|
321
|
|
-
|
322
|
|
-extern FilamentMonitor runout;
|