chiark / gitweb /
heater power repair.
authorBernhard Kubicek <kubicek@gmx.at>
Sat, 12 Nov 2011 23:48:55 +0000 (00:48 +0100)
committerBernhard Kubicek <kubicek@gmx.at>
Sat, 12 Nov 2011 23:48:55 +0000 (00:48 +0100)
Marlin/temperature.cpp

index 0772cb324f586efdc012544a5dd9be0246f991dc..8ea8ee008ff9dba460f027409c3bf01e84138c32 100644 (file)
@@ -156,12 +156,13 @@ void manage_heater()
             pTerm+=Kc*current_block->speed_e; //additional heating if extrusion speed is high\r
           #endif\r
           pid_output = constrain(pTerm + iTerm - dTerm, 0, PID_MAX);\r
-          HeaterPower=pid_output;\r
+          \r
         }\r
     #endif //PID_OPENLOOP\r
     #ifdef PID_DEBUG\r
      //SERIAL_ECHOLN(" PIDDEBUG Input "<<pid_input<<" Output "<<pid_output" pTerm "<<pTerm<<" iTerm "<<iTerm<<" dTerm "<<dTerm);  \r
     #endif //PID_DEBUG\r
+    HeaterPower=pid_output;\r
     analogWrite(HEATER_0_PIN, pid_output);\r
   #endif //PIDTEMP\r
 \r
@@ -250,7 +251,7 @@ int temp2analogBed(int celsius) {
 \r
     return (1023 * OVERSAMPLENR) - raw;\r
   #elif defined BED_USES_AD595\r
-    return celsius * (1024.0 / (5.0 * 100.0) ) * OVERSAMPLENR;\r
+    return lround(celsius * (1024.0 * OVERSAMPLENR/ (5.0 * 100.0) ) );\r
   #endif\r
 }\r
 \r