Browse Source

Set temp_meas_ready in set_current_temp_raw

Scott Lahteine 10 years ago
parent
commit
53169d96e8
1 changed files with 4 additions and 5 deletions
  1. 4
    5
      Marlin/temperature.cpp

+ 4
- 5
Marlin/temperature.cpp View File

@@ -226,7 +226,7 @@ void PID_autotune(float temp, int extruder, int ncycles)
226 226
 
227 227
     unsigned long ms = millis();
228 228
 
229
-    if (temp_meas_ready == true) { // temp sample ready
229
+    if (temp_meas_ready) { // temp sample ready
230 230
       updateTemperaturesFromRawValues();
231 231
 
232 232
       input = (extruder<0)?current_temperature_bed:current_temperature[extruder];
@@ -1198,6 +1198,7 @@ static void set_current_temp_raw() {
1198 1198
     redundant_temperature_raw = raw_temp_value[1];
1199 1199
   #endif
1200 1200
   current_temperature_bed_raw = raw_temp_bed_value;
1201
+  temp_meas_ready = true;
1201 1202
 }
1202 1203
 
1203 1204
 //
@@ -1507,16 +1508,14 @@ ISR(TIMER0_COMPB_vect) {
1507 1508
   } // switch(temp_state)
1508 1509
 
1509 1510
   if (temp_count >= OVERSAMPLENR) { // 10 * 16 * 1/(16000000/64/256)  = 164ms.
1510
-    if (!temp_meas_ready) { //Only update the raw values if they have been read. Else we could be updating them during reading.
1511
-      set_current_temp_raw();
1512
-    } //!temp_meas_ready
1511
+    // Update the raw values if they've been read. Else we could be updating them during reading.
1512
+    if (!temp_meas_ready) set_current_temp_raw();
1513 1513
 
1514 1514
     // Filament Sensor - can be read any time since IIR filtering is used
1515 1515
     #if HAS_FILAMENT_SENSOR
1516 1516
       current_raw_filwidth = raw_filwidth_value >> 10;  // Divide to get to 0-16384 range since we used 1/128 IIR filter approach
1517 1517
     #endif
1518 1518
 
1519
-    temp_meas_ready = true;
1520 1519
     temp_count = 0;
1521 1520
     for (int i = 0; i < TEMP_SENSOR_COUNT; i++) raw_temp_value[i] = 0;
1522 1521
     raw_temp_bed_value = 0;

Loading…
Cancel
Save