Set temp_meas_ready in set_current_temp_raw

This commit is contained in:
Scott Lahteine 2015-03-26 16:02:15 -07:00
parent 06eb7f5b3c
commit 53169d96e8

View file

@ -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;