From f3bf343c89a1452af92fa7f57f3a4eb2761c77a8 Mon Sep 17 00:00:00 2001
From: Gurmeet Athwal <gurmeet.athwal@gmail.com>
Date: Tue, 26 May 2020 04:16:35 +0530
Subject: [PATCH] Report fan speed on change (#18013)

---
 Marlin/src/module/temperature.cpp | 10 ++++++++++
 Marlin/src/module/temperature.h   |  1 +
 2 files changed, 11 insertions(+)

diff --git a/Marlin/src/module/temperature.cpp b/Marlin/src/module/temperature.cpp
index 6121a5a0ac..264d0a9039 100644
--- a/Marlin/src/module/temperature.cpp
+++ b/Marlin/src/module/temperature.cpp
@@ -204,6 +204,16 @@ const char str_t_thermal_runaway[] PROGMEM = STR_T_THERMAL_RUNAWAY,
     if (target >= FAN_COUNT) return;
 
     fan_speed[target] = speed;
+    report_fan_speed(target);
+  }
+
+  /**
+   * Report print fan speed for a target extruder
+   */
+  void Temperature::report_fan_speed(const uint8_t target) {
+    if (target >= FAN_COUNT) return;
+    PORT_REDIRECT(SERIAL_BOTH);
+    SERIAL_ECHOLNPAIR("M106 P", target, " S", fan_speed[target]);
   }
 
   #if EITHER(PROBING_FANS_OFF, ADVANCED_PAUSE_FANS_PAUSE)
diff --git a/Marlin/src/module/temperature.h b/Marlin/src/module/temperature.h
index b2c5497b00..8f875f84f3 100644
--- a/Marlin/src/module/temperature.h
+++ b/Marlin/src/module/temperature.h
@@ -483,6 +483,7 @@ class Temperature {
       #define FANS_LOOP(I) LOOP_L_N(I, FAN_COUNT)
 
       static void set_fan_speed(const uint8_t target, const uint16_t speed);
+      static void report_fan_speed(const uint8_t target);
 
       #if EITHER(PROBING_FANS_OFF, ADVANCED_PAUSE_FANS_PAUSE)
         static bool fans_paused;