From 53169d96e8f2df88b8bd0bd45234235c65dc78aa Mon Sep 17 00:00:00 2001
From: Scott Lahteine <sourcetree@thinkyhead.com>
Date: Thu, 26 Mar 2015 16:02:15 -0700
Subject: [PATCH] Set temp_meas_ready in set_current_temp_raw

---
 Marlin/temperature.cpp | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/Marlin/temperature.cpp b/Marlin/temperature.cpp
index cb70013246..0450d1ccd2 100644
--- a/Marlin/temperature.cpp
+++ b/Marlin/temperature.cpp
@@ -226,7 +226,7 @@ void PID_autotune(float temp, int extruder, int ncycles)
 
     unsigned long ms = millis();
 
-    if (temp_meas_ready == true) { // temp sample ready
+    if (temp_meas_ready) { // temp sample ready
       updateTemperaturesFromRawValues();
 
       input = (extruder<0)?current_temperature_bed:current_temperature[extruder];
@@ -1198,6 +1198,7 @@ static void set_current_temp_raw() {
     redundant_temperature_raw = raw_temp_value[1];
   #endif
   current_temperature_bed_raw = raw_temp_bed_value;
+  temp_meas_ready = true;
 }
 
 //
@@ -1507,16 +1508,14 @@ ISR(TIMER0_COMPB_vect) {
   } // switch(temp_state)
 
   if (temp_count >= OVERSAMPLENR) { // 10 * 16 * 1/(16000000/64/256)  = 164ms.
-    if (!temp_meas_ready) { //Only update the raw values if they have been read. Else we could be updating them during reading.
-      set_current_temp_raw();
-    } //!temp_meas_ready
+    // Update the raw values if they've been read. Else we could be updating them during reading.
+    if (!temp_meas_ready) set_current_temp_raw();
 
     // Filament Sensor - can be read any time since IIR filtering is used
     #if HAS_FILAMENT_SENSOR
       current_raw_filwidth = raw_filwidth_value >> 10;  // Divide to get to 0-16384 range since we used 1/128 IIR filter approach
     #endif
 
-    temp_meas_ready = true;
     temp_count = 0;
     for (int i = 0; i < TEMP_SENSOR_COUNT; i++) raw_temp_value[i] = 0;
     raw_temp_bed_value = 0;