From 7c60853219da0b5305c1d8856873868a1db6c5a9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ra=C3=BAl=20L=C3=A1zaro=20S=C3=A1nchez?= Date: Thu, 31 Oct 2019 23:14:11 +0100 Subject: [PATCH] Fix blocking delay in Photo G-code M240 (#15728) --- Marlin/src/gcode/feature/camera/M240.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Marlin/src/gcode/feature/camera/M240.cpp b/Marlin/src/gcode/feature/camera/M240.cpp index 6fb68d454e..53d18d64a3 100644 --- a/Marlin/src/gcode/feature/camera/M240.cpp +++ b/Marlin/src/gcode/feature/camera/M240.cpp @@ -148,7 +148,7 @@ void GcodeSuite::M240() { #if PIN_EXISTS(CHDK) OUT_WRITE(CHDK_PIN, HIGH); - chdk_timeout = millis() + PHOTO_SWITCH_MS; + chdk_timeout = millis() + parser.intval('D', PHOTO_SWITCH_MS); #elif HAS_PHOTOGRAPH @@ -160,7 +160,8 @@ void GcodeSuite::M240() { #ifdef PHOTO_POSITION #if PHOTO_DELAY_MS > 0 - safe_delay(parser.intval('P', PHOTO_DELAY_MS)); + const millis_t timeout = millis() + parser.intval('P', PHOTO_DELAY_MS); + while (PENDING(millis(), timeout)) idle(); #endif do_blocking_move_to(old_pos, fr_mm_s); #ifdef PHOTO_RETRACT_MM