Browse Source

Move M106_M107 to cpp

Scott Lahteine 8 years ago
parent
commit
df031ab100

+ 0
- 5
Marlin/src/Marlin.cpp View File

@@ -391,11 +391,6 @@ bool pin_is_protected(const int8_t pin) {
391 391
 
392 392
 #endif // AUTO_REPORT_TEMPERATURES && (HAS_TEMP_HOTEND || HAS_TEMP_BED)
393 393
 
394
-#if FAN_COUNT > 0
395
-  #include "gcode/temperature/M106.h"
396
-  #include "gcode/temperature/M107.h"
397
-#endif
398
-
399 394
 #if DISABLED(EMERGENCY_PARSER)
400 395
   #include "gcode/control/M108.h"
401 396
   #include "gcode/control/M112.h"

+ 3
- 9
Marlin/src/gcode/gcode.cpp View File

@@ -124,8 +124,6 @@ extern void gcode_M83();
124 124
 extern void gcode_M85();
125 125
 extern void gcode_M92();
126 126
 extern void gcode_M100();
127
-extern void gcode_M106();
128
-extern void gcode_M107();
129 127
 extern void gcode_M108();
130 128
 extern void gcode_M110();
131 129
 extern void gcode_M111();
@@ -509,13 +507,9 @@ void GcodeSuite::process_next_command() {
509 507
       #endif // HAS_TEMP_BED
510 508
 
511 509
       #if FAN_COUNT > 0
512
-        case 106: // M106: Fan On
513
-          gcode_M106();
514
-          break;
515
-        case 107: // M107: Fan Off
516
-          gcode_M107();
517
-          break;
518
-      #endif // FAN_COUNT > 0
510
+        case 106: M106(); break;  // M106: Fan On
511
+        case 107: M107(); break;  // M107: Fan Off
512
+      #endif
519 513
 
520 514
       #if ENABLED(PARK_HEAD_ON_PAUSE)
521 515
         case 125: // M125: Store current position and move to filament change position

Marlin/src/gcode/temperature/M106.h → Marlin/src/gcode/temperature/M106_M107.cpp View File

@@ -20,15 +20,32 @@
20 20
  *
21 21
  */
22 22
 
23
+#include "../../inc/MarlinConfig.h"
24
+
25
+#if FAN_COUNT > 0
26
+
27
+#include "../gcode.h"
28
+#include "../../Marlin.h" // for fanSpeeds — should move those to Planner
29
+
23 30
 /**
24 31
  * M106: Set Fan Speed
25 32
  *
26 33
  *  S<int>   Speed between 0-255
27 34
  *  P<index> Fan index, if more than one fan
28 35
  */
29
-void gcode_M106() {
36
+void GcodeSuite::M106() {
30 37
   uint16_t s = parser.ushortval('S', 255);
31 38
   NOMORE(s, 255);
32 39
   const uint8_t p = parser.byteval('P', 0);
33 40
   if (p < FAN_COUNT) fanSpeeds[p] = s;
34 41
 }
42
+
43
+/**
44
+ * M107: Fan Off
45
+ */
46
+void GcodeSuite::M107() {
47
+  const uint16_t p = parser.ushortval('P');
48
+  if (p < FAN_COUNT) fanSpeeds[p] = 0;
49
+}
50
+
51
+#endif // FAN_COUNT > 0

+ 0
- 29
Marlin/src/gcode/temperature/M107.h View File

@@ -1,29 +0,0 @@
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
- * M107: Fan Off
25
- */
26
-void gcode_M107() {
27
-  const uint16_t p = parser.ushortval('P');
28
-  if (p < FAN_COUNT) fanSpeeds[p] = 0;
29
-}

Loading…
Cancel
Save