Przeglądaj źródła

Merge pull request #4467 from jbrazio/safe_delay-millis_t

Makes safe_delay() to be fully compatible with delay()
Scott Lahteine 9 lat temu
rodzic
commit
46c33f1cfa
4 zmienionych plików z 38 dodań i 6 usunięć
  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 Wyświetl plik

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

+ 28
- 0
Marlin/types.h Wyświetl plik

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 Wyświetl plik

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

+ 6
- 1
Marlin/utility.h Wyświetl plik

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

Ładowanie…
Anuluj
Zapisz