瀏覽代碼

Merge pull request #7920 from thinkyhead/bf2_neopixel_full

[2.0.x] Move FILAMENT_RUNOUT_SENSOR to a feature
Scott Lahteine 7 年之前
父節點
當前提交
1f5c432e29
共有 5 個檔案被更改,包括 86 行新增20 行删除
  1. 4
    16
      Marlin/src/Marlin.cpp
  2. 0
    4
      Marlin/src/Marlin.h
  3. 4
    0
      Marlin/src/feature/pause.cpp
  4. 44
    0
      Marlin/src/feature/runout.cpp
  5. 34
    0
      Marlin/src/feature/runout.h

+ 4
- 16
Marlin/src/Marlin.cpp 查看文件

126
   #include "feature/pause.h"
126
   #include "feature/pause.h"
127
 #endif
127
 #endif
128
 
128
 
129
+#if ENABLED(FILAMENT_RUNOUT_SENSOR)
130
+  #include "feature/runout.h"
131
+#endif
132
+
129
 #if ENABLED(TEMP_STAT_LEDS)
133
 #if ENABLED(TEMP_STAT_LEDS)
130
   #include "feature/leds/tempstat.h"
134
   #include "feature/leds/tempstat.h"
131
 #endif
135
 #endif
179
 millis_t max_inactive_time = 0,
183
 millis_t max_inactive_time = 0,
180
          stepper_inactive_time = (DEFAULT_STEPPER_DEACTIVE_TIME) * 1000UL;
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
 #if ENABLED(ADVANCED_PAUSE_FEATURE)
186
 #if ENABLED(ADVANCED_PAUSE_FEATURE)
187
   AdvancedPauseMenuResponse advanced_pause_menu_response;
187
   AdvancedPauseMenuResponse advanced_pause_menu_response;
188
 #endif
188
 #endif
307
   SYNC_PLAN_POSITION_KINEMATIC();
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
 void enable_all_steppers() {
310
 void enable_all_steppers() {
323
   enable_X();
311
   enable_X();
324
   enable_Y();
312
   enable_Y();

+ 0
- 4
Marlin/src/Marlin.h 查看文件

166
 
166
 
167
 void quickstop_stepper();
167
 void quickstop_stepper();
168
 
168
 
169
-#if ENABLED(FILAMENT_RUNOUT_SENSOR)
170
-  void handle_filament_runout();
171
-#endif
172
-
173
 extern bool Running;
169
 extern bool Running;
174
 inline bool IsRunning() { return  Running; }
170
 inline bool IsRunning() { return  Running; }
175
 inline bool IsStopped() { return !Running; }
171
 inline bool IsStopped() { return !Running; }

+ 4
- 0
Marlin/src/feature/pause.cpp 查看文件

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

+ 44
- 0
Marlin/src/feature/runout.cpp 查看文件

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 查看文件

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_

Loading…
取消
儲存