From 8e79e8cdb375da86064d7bb5752d3e38135bdff7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Br=C3=A1zio?= Date: Sat, 30 Jul 2016 02:55:52 +0100 Subject: [PATCH 1/2] Adds types.h --- Marlin/types.h | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 Marlin/types.h diff --git a/Marlin/types.h b/Marlin/types.h new file mode 100644 index 000000000..8ab7beebe --- /dev/null +++ b/Marlin/types.h @@ -0,0 +1,28 @@ +/** + * Marlin 3D Printer Firmware + * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * + * Based on Sprinter and grbl. + * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + */ + +#ifndef __TYPES_H__ +#define __TYPES_H__ + +typedef unsigned long millis_t; + +#endif From 226e74a438c1dac72e575dbf39371e0f50335118 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Br=C3=A1zio?= Date: Sat, 30 Jul 2016 02:56:26 +0100 Subject: [PATCH 2/2] Fixes safe_delay() to be fully compatible with delay() --- Marlin/Marlin.h | 6 ++---- Marlin/utility.cpp | 3 ++- Marlin/utility.h | 7 ++++++- 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/Marlin/Marlin.h b/Marlin/Marlin.h index ded8b1f50..1e14fbf1c 100644 --- a/Marlin/Marlin.h +++ b/Marlin/Marlin.h @@ -35,13 +35,11 @@ #include "MarlinConfig.h" -#include "fastio.h" - #include "enum.h" +#include "types.h" +#include "fastio.h" #include "utility.h" -typedef unsigned long millis_t; - #ifdef USBCON #include "HardwareSerial.h" #if ENABLED(BLUETOOTH) diff --git a/Marlin/utility.cpp b/Marlin/utility.cpp index 385fe3d39..0285219c4 100644 --- a/Marlin/utility.cpp +++ b/Marlin/utility.cpp @@ -21,9 +21,10 @@ */ #include "Marlin.h" +#include "utility.h" #include "temperature.h" -void safe_delay(uint16_t ms) { +void safe_delay(millis_t ms) { while (ms > 50) { ms -= 50; delay(50); diff --git a/Marlin/utility.h b/Marlin/utility.h index 8bb3a9b8b..8ca70dbf8 100644 --- a/Marlin/utility.h +++ b/Marlin/utility.h @@ -20,4 +20,9 @@ * */ -void safe_delay(uint16_t ms); +#ifndef __UTILITY_H__ +#define __UTILITY_H__ + +void safe_delay(millis_t ms); + +#endif