From ff592b056ad492632a810e6c77a7d063b6ce05e3 Mon Sep 17 00:00:00 2001 From: Bernhard Kubicek <kubicek@gmx.at> Date: Sun, 13 Nov 2011 00:48:55 +0100 Subject: [PATCH] heater power repair. --- Marlin/temperature.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Marlin/temperature.cpp b/Marlin/temperature.cpp index 0772cb324f..8ea8ee008f 100644 --- a/Marlin/temperature.cpp +++ b/Marlin/temperature.cpp @@ -156,12 +156,13 @@ void manage_heater() pTerm+=Kc*current_block->speed_e; //additional heating if extrusion speed is high #endif pid_output = constrain(pTerm + iTerm - dTerm, 0, PID_MAX); - HeaterPower=pid_output; + } #endif //PID_OPENLOOP #ifdef PID_DEBUG //SERIAL_ECHOLN(" PIDDEBUG Input "<<pid_input<<" Output "<<pid_output" pTerm "<<pTerm<<" iTerm "<<iTerm<<" dTerm "<<dTerm); #endif //PID_DEBUG + HeaterPower=pid_output; analogWrite(HEATER_0_PIN, pid_output); #endif //PIDTEMP @@ -250,7 +251,7 @@ int temp2analogBed(int celsius) { return (1023 * OVERSAMPLENR) - raw; #elif defined BED_USES_AD595 - return celsius * (1024.0 / (5.0 * 100.0) ) * OVERSAMPLENR; + return lround(celsius * (1024.0 * OVERSAMPLENR/ (5.0 * 100.0) ) ); #endif }