Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

One bad temp reading causes failed print #101

Open
north90ty opened this issue Oct 6, 2011 · 1 comment
Open

One bad temp reading causes failed print #101

north90ty opened this issue Oct 6, 2011 · 1 comment

Comments

@north90ty
Copy link

I had some trouble with prints failing because the temperature was dropping. I guess it is caused by a bad temperature reading, triggering this code in Sprinter.pde:
#ifdef MINTEMP
if(current_raw <= minttemp)
target_raw=0;
#endif

If instead of setting the target_raw to 0 the heater_pin can be set low, so if the next reading of the temperature sensor is ok the printer keeps on managing the heater.

I changed Sprinter.pde by moving #ifdef MINTEMP to where the heater pin is managed:

if (TEMP_0_PIN > -1) || defined (HEATER_USES_MAX6675) || defined (HEATER_USES_AD595)

#ifdef PIDTEMP
  error = target_raw - current_raw;
  pTerm = (PID_PGAIN * error) / 100;
  temp_iState += error;
  temp_iState = constrain(temp_iState, temp_iState_min, temp_iState_max);
  iTerm = (PID_IGAIN * temp_iState) / 100;
  dTerm = (PID_DGAIN * (current_raw - temp_dState)) / 100;
  temp_dState = current_raw;
  analogWrite(HEATER_0_PIN, constrain(pTerm + iTerm - dTerm, 0, PID_MAX));
#else
  if(current_raw >= target_raw)
  {
    WRITE(HEATER_0_PIN,LOW);
    #if LED_PIN>-1
        WRITE(LED_PIN,LOW);
    #endif
  }
  else 
  {
    WRITE(HEATER_0_PIN,HIGH);
    #if LED_PIN > -1
        WRITE(LED_PIN,HIGH);
    #endif
  }

// ----------------------------------------------------
// if bad temp reading turn heater off for now
//--
#ifdef MINTEMP
if(current_raw <= minttemp) {
WRITE(HEATER_0_PIN,LOW);
#if LED_PIN>-1
WRITE(LED_PIN,LOW);
#endif
}
#endif
//---------------------------------
#endif

Thanks,
Frank

@marcopiraccini
Copy link

I have the very same problem...his fix has been pulled?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants