Quellcode durchsuchen

Merge pull request #7920 from thinkyhead/bf2_neopixel_full

[2.0.x] Move FILAMENT_RUNOUT_SENSOR to a feature
Scott Lahteine vor 7 Jahren
Ursprung
Commit
1f5c432e29

+ 4
- 16
Marlin/src/Marlin.cpp Datei anzeigen

@@ -126,6 +126,10 @@
126 126
   #include "feature/pause.h"
127 127
 #endif
128 128
 
129
+#if ENABLED(FILAMENT_RUNOUT_SENSOR)
130
+  #include "feature/runout.h"
131
+#endif
132
+
129 133
 #if ENABLED(TEMP_STAT_LEDS)
130 134
   #include "feature/leds/tempstat.h"
131 135
 #endif
@@ -179,10 +183,6 @@ volatile bool wait_for_heatup = true;
179 183
 millis_t max_inactive_time = 0,
180 184
          stepper_inactive_time = (DEFAULT_STEPPER_DEACTIVE_TIME) * 1000UL;
181 185
 
182
-#if ENABLED(FILAMENT_RUNOUT_SENSOR)
183
-  static bool filament_ran_out = false;
184
-#endif
185
-
186 186
 #if ENABLED(ADVANCED_PAUSE_FEATURE)
187 187
   AdvancedPauseMenuResponse advanced_pause_menu_response;
188 188
 #endif
@@ -307,18 +307,6 @@ void quickstop_stepper() {
307 307
   SYNC_PLAN_POSITION_KINEMATIC();
308 308
 }
309 309
 
310
-#if ENABLED(FILAMENT_RUNOUT_SENSOR)
311
-
312
-  void handle_filament_runout() {
313
-    if (!filament_ran_out) {
314
-      filament_ran_out = true;
315
-      enqueue_and_echo_commands_P(PSTR(FILAMENT_RUNOUT_SCRIPT));
316
-      stepper.synchronize();
317
-    }
318
-  }
319
-
320
-#endif // FILAMENT_RUNOUT_SENSOR
321
-
322 310
 void enable_all_steppers() {
323 311
   enable_X();
324 312
   enable_Y();

+ 0
- 4
Marlin/src/Marlin.h Datei anzeigen

@@ -166,10 +166,6 @@ void kill(const char*);
166 166
 
167 167
 void quickstop_stepper();
168 168
 
169
-#if ENABLED(FILAMENT_RUNOUT_SENSOR)
170
-  void handle_filament_runout();
171
-#endif
172
-
173 169
 extern bool Running;
174 170
 inline bool IsRunning() { return  Running; }
175 171
 inline bool IsStopped() { return !Running; }

+ 4
- 0
Marlin/src/feature/pause.cpp Datei anzeigen

@@ -37,6 +37,10 @@
37 37
 #include "../module/printcounter.h"
38 38
 #include "../module/temperature.h"
39 39
 
40
+#if ENABLED(FILAMENT_RUNOUT_SENSOR)
41
+  #include "../feature/runout.h"
42
+#endif
43
+
40 44
 #if ENABLED(ULTIPANEL)
41 45
   #include "../lcd/ultralcd.h"
42 46
 #endif

+ 44
- 0
Marlin/src/feature/runout.cpp Datei anzeigen

@@ -0,0 +1,44 @@
1
+/**
2
+ * Marlin 3D Printer Firmware
3
+ * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
4
+ *
5
+ * Based on Sprinter and grbl.
6
+ * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm
7
+ *
8
+ * This program is free software: you can redistribute it and/or modify
9
+ * it under the terms of the GNU General Public License as published by
10
+ * the Free Software Foundation, either version 3 of the License, or
11
+ * (at your option) any later version.
12
+ *
13
+ * This program is distributed in the hope that it will be useful,
14
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16
+ * GNU General Public License for more details.
17
+ *
18
+ * You should have received a copy of the GNU General Public License
19
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
20
+ *
21
+ */
22
+
23
+/**
24
+ * feature/runout.cpp - Runout sensor support
25
+ */
26
+
27
+#include "../inc/MarlinConfig.h"
28
+
29
+#if ENABLED(FILAMENT_RUNOUT_SENSOR)
30
+
31
+#include "../module/stepper.h"
32
+#include "../gcode/queue.h"
33
+
34
+bool filament_ran_out = false;
35
+
36
+void handle_filament_runout() {
37
+  if (!filament_ran_out) {
38
+    filament_ran_out = true;
39
+    enqueue_and_echo_commands_P(PSTR(FILAMENT_RUNOUT_SCRIPT));
40
+    stepper.synchronize();
41
+  }
42
+}
43
+
44
+#endif // FILAMENT_RUNOUT_SENSOR

+ 34
- 0
Marlin/src/feature/runout.h Datei anzeigen

@@ -0,0 +1,34 @@
1
+/**
2
+ * Marlin 3D Printer Firmware
3
+ * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
4
+ *
5
+ * Based on Sprinter and grbl.
6
+ * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm
7
+ *
8
+ * This program is free software: you can redistribute it and/or modify
9
+ * it under the terms of the GNU General Public License as published by
10
+ * the Free Software Foundation, either version 3 of the License, or
11
+ * (at your option) any later version.
12
+ *
13
+ * This program is distributed in the hope that it will be useful,
14
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16
+ * GNU General Public License for more details.
17
+ *
18
+ * You should have received a copy of the GNU General Public License
19
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
20
+ *
21
+ */
22
+
23
+/**
24
+ * feature/runout.h - Runout sensor support
25
+ */
26
+
27
+#ifndef _RUNOUT_H_
28
+#define _RUNOUT_H_
29
+
30
+extern bool filament_ran_out;
31
+
32
+void handle_filament_runout();
33
+
34
+#endif // _RUNOUT_H_

Laden…
Abbrechen
Speichern