From bde30b2b4837c816789d42896ad5654222ff4c06 Mon Sep 17 00:00:00 2001 From: Erik van der Zalm Date: Sun, 12 Feb 2012 01:36:42 +0800 Subject: [PATCH 1/3] Corrected e-length calculation in planner --- Marlin/planner.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Marlin/planner.cpp b/Marlin/planner.cpp index 2eb0733330..b895b95e52 100644 --- a/Marlin/planner.cpp +++ b/Marlin/planner.cpp @@ -518,7 +518,7 @@ void plan_buffer_line(const float &x, const float &y, const float &z, const floa delta_mm[Z_AXIS] = (target[Z_AXIS]-position[Z_AXIS])/axis_steps_per_unit[Z_AXIS]; delta_mm[E_AXIS] = (target[E_AXIS]-position[E_AXIS])/axis_steps_per_unit[E_AXIS]; if ( block->steps_x == 0 && block->steps_y == 0 && block->steps_z == 0 ) { - block->millimeters = delta_mm[E_AXIS]; + block->millimeters = abs(delta_mm[E_AXIS]); } else { block->millimeters = sqrt(square(delta_mm[X_AXIS]) + square(delta_mm[Y_AXIS]) + square(delta_mm[Z_AXIS])); } From b447815de5474b4533bcebb2e4b1d831fb731141 Mon Sep 17 00:00:00 2001 From: Erik van der Zalm Date: Sun, 12 Feb 2012 06:22:16 +0800 Subject: [PATCH 2/3] removed unused HEATING_EARLY_FINISH_DEG_OFFSET Simplified stepper inactive time --- Marlin/Configuration_adv.h | 6 +----- Marlin/Marlin.pde | 19 ++++++++----------- 2 files changed, 9 insertions(+), 16 deletions(-) diff --git a/Marlin/Configuration_adv.h b/Marlin/Configuration_adv.h index 1bdbd1ac2c..a19747d145 100644 --- a/Marlin/Configuration_adv.h +++ b/Marlin/Configuration_adv.h @@ -25,9 +25,6 @@ // if CooldownNoWait is defined M109 will not wait for the cooldown to finish #define CooldownNoWait true -// Heating is finished if a temperature close to this degree shift is reached -#define HEATING_EARLY_FINISH_DEG_OFFSET 1 //Degree - //Do not wait for M109 to finish when printing from SD card //#define STOP_HEATING_WAIT_WHEN_SD_PRINTING @@ -85,7 +82,6 @@ //default stepper release if idle #define DEFAULT_STEPPER_DEACTIVE_TIME 60 -#define DEFAULT_STEPPER_DEACTIVE_COMMAND "M84 X Y E" //z stays powered #define DEFAULT_MINIMUMFEEDRATE 0.0 // minimum feedrate #define DEFAULT_MINTRAVELFEEDRATE 0.0 @@ -112,7 +108,7 @@ #define SD_FINISHED_STEPPERRELEASE true //if sd support and the file is finished: disable steppers? -#define SD_FINISHED_RELEASECOMMAND "M84 X Y E" // no z because of layer shift. +#define SD_FINISHED_RELEASECOMMAND "M84 X Y Z E" // no z because of layer shift. // The hardware watchdog should halt the Microcontroller, in case the firmware gets stuck somewhere. However: // the Watchdog is not working well, so please only enable this for testing diff --git a/Marlin/Marlin.pde b/Marlin/Marlin.pde index b16174c2dd..a4997f31cd 100644 --- a/Marlin/Marlin.pde +++ b/Marlin/Marlin.pde @@ -165,7 +165,6 @@ const int sensitive_pins[] = SENSITIVE_PINS; // Sensitive pin list for M42 static unsigned long previous_millis_cmd = 0; static unsigned long max_inactive_time = 0; static unsigned long stepper_inactive_time = DEFAULT_STEPPER_DEACTIVE_TIME*1000l; -static unsigned long last_stepperdisabled_time=30*1000; //first release check after 30 seconds static unsigned long starttime=0; static unsigned long stoptime=0; @@ -1296,16 +1295,15 @@ void manage_inactivity(byte debug) if( (millis() - previous_millis_cmd) > max_inactive_time ) if(max_inactive_time) kill(); - if(stepper_inactive_time) - if( (millis() - last_stepperdisabled_time) > stepper_inactive_time ) - { - if(previous_millis_cmd>last_stepperdisabled_time) - last_stepperdisabled_time=previous_millis_cmd; - else + if(stepper_inactive_time) { + if( (millis() - previous_millis_cmd) > stepper_inactive_time ) { - if( (X_ENABLE_ON && (READ(X_ENABLE_PIN)!=0)) || (!X_ENABLE_ON && READ(X_ENABLE_PIN)==0) ) - enquecommand(DEFAULT_STEPPER_DEACTIVE_COMMAND); - last_stepperdisabled_time=millis(); + disable_x(); + disable_y(); + disable_z(); + disable_e0(); + disable_e1(); + disable_e2(); } } #ifdef EXTRUDER_RUNOUT_PREVENT @@ -1323,7 +1321,6 @@ void manage_inactivity(byte debug) destination[E_AXIS]=oldedes; plan_set_e_position(oldepos); previous_millis_cmd=millis(); - //enquecommand(DEFAULT_STEPPER_DEACTIVE_COMMAND); st_synchronize(); WRITE(E0_ENABLE_PIN,oldstatus); } From 73344e69c1cd361164aa67af9ab28344f17a1227 Mon Sep 17 00:00:00 2001 From: Daid Date: Thu, 16 Feb 2012 11:03:41 +0100 Subject: [PATCH 3/3] Added temperature offset/gain settings for AD595. --- Marlin/Configuration.h | 6 ++++++ Marlin/temperature.cpp | 8 ++++---- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/Marlin/Configuration.h b/Marlin/Configuration.h index f0d8913631..eed1895d4f 100644 --- a/Marlin/Configuration.h +++ b/Marlin/Configuration.h @@ -66,6 +66,12 @@ #define HEATER_2_MAXTEMP 275 #define BED_MAXTEMP 150 +//These defines help to calibrate the AD595 sensor in case you get wrong temperature measurements. +//The measured temperature is defined as "actualTemp = (measuredTemp * TEMP_SENSOR_AD595_GAIN) + TEMP_SENSOR_AD595_OFFSET" +#define TEMP_SENSOR_AD595_OFFSET 0.0 +#define TEMP_SENSOR_AD595_GAIN 1.0 + + // PID settings: // Comment the following line to disable PID and enable bang-bang. #define PIDTEMP diff --git a/Marlin/temperature.cpp b/Marlin/temperature.cpp index 2f3888c018..9103127f70 100644 --- a/Marlin/temperature.cpp +++ b/Marlin/temperature.cpp @@ -312,7 +312,7 @@ int temp2analog(int celsius, uint8_t e) { return (1023 * OVERSAMPLENR) - raw; } - return celsius * (1024.0 / (5.0 * 100.0) ) * OVERSAMPLENR; + return ((celsius-TEMP_SENSOR_AD595_OFFSET)/TEMP_SENSOR_AD595_GAIN) * (1024.0 / (5.0 * 100.0) ) * OVERSAMPLENR; } // Takes bed temperature value as input and returns corresponding raw value. @@ -342,7 +342,7 @@ int temp2analogBed(int celsius) { return (1023 * OVERSAMPLENR) - raw; #elif defined BED_USES_AD595 - return lround(celsius * (1024.0 * OVERSAMPLENR/ (5.0 * 100.0) ) ); + return lround(((celsius-TEMP_SENSOR_AD595_OFFSET)/TEMP_SENSOR_AD595_GAIN) * (1024.0 * OVERSAMPLENR/ (5.0 * 100.0) ) ); #else #warning No heater-type defined for the bed. return 0; @@ -390,7 +390,7 @@ float analog2temp(int raw, uint8_t e) { return celsius; } - return raw * ((5.0 * 100.0) / 1024.0) / OVERSAMPLENR; + return ((raw * ((5.0 * 100.0) / 1024.0) / OVERSAMPLENR) * TEMP_SENSOR_AD595_GAIN) + TEMP_SENSOR_AD595_OFFSET; } // Derived from RepRap FiveD extruder::getTemperature() @@ -421,7 +421,7 @@ float analog2tempBed(int raw) { return celsius; #elif defined BED_USES_AD595 - return raw * ((5.0 * 100.0) / 1024.0) / OVERSAMPLENR; + return ((raw * ((5.0 * 100.0) / 1024.0) / OVERSAMPLENR) * TEMP_SENSOR_AD595_GAIN) + TEMP_SENSOR_AD595_OFFSET; #else #warning No heater-type defined for the bed. #endif