浏览代码

Merge pull request #4467 from jbrazio/safe_delay-millis_t

Makes safe_delay() to be fully compatible with delay()
Scott Lahteine 9 年前
父节点
当前提交
46c33f1cfa
共有 4 个文件被更改,包括 38 次插入6 次删除
  1. 2
    4
      Marlin/Marlin.h
  2. 28
    0
      Marlin/types.h
  3. 2
    1
      Marlin/utility.cpp
  4. 6
    1
      Marlin/utility.h

+ 2
- 4
Marlin/Marlin.h 查看文件

@@ -35,13 +35,11 @@
35 35
 
36 36
 #include "MarlinConfig.h"
37 37
 
38
-#include "fastio.h"
39
-
40 38
 #include "enum.h"
39
+#include "types.h"
40
+#include "fastio.h"
41 41
 #include "utility.h"
42 42
 
43
-typedef unsigned long millis_t;
44
-
45 43
 #ifdef USBCON
46 44
   #include "HardwareSerial.h"
47 45
   #if ENABLED(BLUETOOTH)

+ 28
- 0
Marlin/types.h 查看文件

@@ -0,0 +1,28 @@
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
+#ifndef __TYPES_H__
24
+#define __TYPES_H__
25
+
26
+typedef unsigned long millis_t;
27
+
28
+#endif

+ 2
- 1
Marlin/utility.cpp 查看文件

@@ -21,9 +21,10 @@
21 21
  */
22 22
 
23 23
 #include "Marlin.h"
24
+#include "utility.h"
24 25
 #include "temperature.h"
25 26
 
26
-void safe_delay(uint16_t ms) {
27
+void safe_delay(millis_t ms) {
27 28
   while (ms > 50) {
28 29
     ms -= 50;
29 30
     delay(50);

+ 6
- 1
Marlin/utility.h 查看文件

@@ -20,4 +20,9 @@
20 20
  *
21 21
  */
22 22
 
23
-void safe_delay(uint16_t ms);
23
+#ifndef __UTILITY_H__
24
+#define __UTILITY_H__
25
+
26
+void safe_delay(millis_t ms);
27
+
28
+#endif

正在加载...
取消
保存