From 5917b5cf5cdaaca3b460c2a8e470b838d01b06fe Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Fri, 23 Oct 2020 19:25:22 -0500 Subject: [PATCH] Fix warning in gcode_D --- Marlin/src/HAL/LINUX/HAL.h | 2 +- Marlin/src/HAL/shared/Delay.h | 4 ++-- Marlin/src/gcode/gcode_d.cpp | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Marlin/src/HAL/LINUX/HAL.h b/Marlin/src/HAL/LINUX/HAL.h index 2e545e03d..1c8dbfd4d 100644 --- a/Marlin/src/HAL/LINUX/HAL.h +++ b/Marlin/src/HAL/LINUX/HAL.h @@ -23,7 +23,7 @@ #define CPU_32_BIT -#define F_CPU 100000000 +#define F_CPU 100000000UL #define SystemCoreClock F_CPU #include #include diff --git a/Marlin/src/HAL/shared/Delay.h b/Marlin/src/HAL/shared/Delay.h index d98e96084..a48f3f79c 100644 --- a/Marlin/src/HAL/shared/Delay.h +++ b/Marlin/src/HAL/shared/Delay.h @@ -155,7 +155,7 @@ #endif // Delay in nanoseconds -#define DELAY_NS(x) DELAY_CYCLES( (x) * (F_CPU / 1000000UL) / 1000UL ) +#define DELAY_NS(x) DELAY_CYCLES((x) * ((F_CPU) / 1000000UL) / 1000UL) // Delay in microseconds -#define DELAY_US(x) DELAY_CYCLES( (x) * (F_CPU / 1000000UL) ) +#define DELAY_US(x) DELAY_CYCLES((x) * ((F_CPU) / 1000000UL)) diff --git a/Marlin/src/gcode/gcode_d.cpp b/Marlin/src/gcode/gcode_d.cpp index 99968b625..2fd03144c 100644 --- a/Marlin/src/gcode/gcode_d.cpp +++ b/Marlin/src/gcode/gcode_d.cpp @@ -181,7 +181,7 @@ // Use a low-level delay that does not rely on interrupts to function // Do not spin forever, to avoid thermal risks if heaters are enabled and // watchdog does not work. - DELAY_US(10000000); + for (int i = 10000; i--;) DELAY_US(1000UL); ENABLE_ISRS(); SERIAL_ECHOLNPGM("FAILURE: Watchdog did not trigger board reset."); }