From 7b3d9b4c251bbdd31bfcf6ee125c0dbeed22e992 Mon Sep 17 00:00:00 2001
From: Scott Mikutsky <smikutsky@gmail.com>
Date: Thu, 27 Apr 2023 18:40:06 -0400
Subject: [PATCH 1/3] Fixed USB disconnect behavior

Reset USB host when USB drive is unplugged from STM32 based boards
---
 Marlin/src/HAL/STM32/usb_host.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Marlin/src/HAL/STM32/usb_host.cpp b/Marlin/src/HAL/STM32/usb_host.cpp
index d77f0b28e964..f3784670049c 100644
--- a/Marlin/src/HAL/STM32/usb_host.cpp
+++ b/Marlin/src/HAL/STM32/usb_host.cpp
@@ -44,7 +44,7 @@ static void USBH_UserProcess(USBH_HandleTypeDef *phost, uint8_t id) {
       break;
     case HOST_USER_DISCONNECTION:
       //SERIAL_ECHOLNPGM("APPLICATION_DISCONNECT");
-      //usb.setUsbTaskState(USB_STATE_RUNNING);
+      usb.setUsbTaskState(USB_STATE_INIT);
       break;
     case HOST_USER_CLASS_ACTIVE:
       //SERIAL_ECHOLNPGM("APPLICATION_READY");

From 209c7b0d6b8c914c491f6c21d8f982c0dc93c03b Mon Sep 17 00:00:00 2001
From: Scott Mikutsky <smikutsky@gmail.com>
Date: Wed, 21 Jun 2023 18:48:22 -0400
Subject: [PATCH 2/3] Always confirm bltouch deployment

In some scenarios when probing in high speed mode, the probe is not deployed and the nozzle crashes into the bed. This should fix that
---
 Marlin/src/module/probe.cpp | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/Marlin/src/module/probe.cpp b/Marlin/src/module/probe.cpp
index 204617ba8394..415554f34349 100644
--- a/Marlin/src/module/probe.cpp
+++ b/Marlin/src/module/probe.cpp
@@ -597,8 +597,8 @@ bool Probe::probe_down_to_z(const_float_t z, const_feedRate_t fr_mm_s) {
   #endif
 
   #if ENABLED(BLTOUCH)
-    if (!bltouch.high_speed_mode && bltouch.deploy())
-      return true; // Deploy in LOW SPEED MODE on every probe action
+    if (bltouch.deploy())
+      return true; // Deploy on every probe action or confirm deployment
   #endif
 
   #if HAS_Z_SERVO_PROBE && (ENABLED(Z_SERVO_INTERMEDIATE_STOW) || defined(Z_SERVO_MEASURE_ANGLE))

From f323df2d9a931cc6b917769b9f6af25e89742436 Mon Sep 17 00:00:00 2001
From: Scott Lahteine <thinkyhead@users.noreply.github.com>
Date: Wed, 5 Jul 2023 01:26:58 -0500
Subject: [PATCH 3/3] tweak

---
 Marlin/src/module/probe.cpp | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/Marlin/src/module/probe.cpp b/Marlin/src/module/probe.cpp
index 747ed8c43434..8c13da36f99f 100644
--- a/Marlin/src/module/probe.cpp
+++ b/Marlin/src/module/probe.cpp
@@ -596,10 +596,8 @@ bool Probe::probe_down_to_z(const_float_t z, const_feedRate_t fr_mm_s) {
     thermalManager.wait_for_hotend_heating(active_extruder);
   #endif
 
-  #if ENABLED(BLTOUCH)
-    if (bltouch.deploy())
-      return true; // Deploy on every probe action or confirm deployment
-  #endif
+  // Ensure the BLTouch is deployed. Does nothing if already deployed.
+  if (TERN0(BLTOUCH, bltouch.deploy())) return true;
 
   #if HAS_Z_SERVO_PROBE && (ENABLED(Z_SERVO_INTERMEDIATE_STOW) || defined(Z_SERVO_MEASURE_ANGLE))
     probe_specific_action(true);  //  Always re-deploy in this case