From 1e879af0a3aec38900a790115a08732fa30bb589 Mon Sep 17 00:00:00 2001 From: midopple Date: Sun, 12 Jan 2014 19:30:24 +0100 Subject: [PATCH] Version 1.3.25T / 12.01.2014 - M105 use the wrong convert function for Heatbed Target Temperatur - Correct bug in calculate_trapezoid_for_block(..) - smoother Steps for arc funtion G2/G3 - example for HEATER_DUTY_FOR_SETPOINT for reprap-fab Extruder V4 - more cycles for Autotune (M303) old 5 cycles, new 7 cycles - New Thermistortable for ATC Semitec 104GT-2 (Type 5) --- Sprinter/Configuration.h | 8 ++- Sprinter/Sprinter.pde | 26 ++++++--- Sprinter/heater.cpp | 11 ++-- Sprinter/thermistortables.h | 105 +++++++++++++++--------------------- 4 files changed, 70 insertions(+), 80 deletions(-) diff --git a/Sprinter/Configuration.h b/Sprinter/Configuration.h index 9b5c9f0..115a2b0 100644 --- a/Sprinter/Configuration.h +++ b/Sprinter/Configuration.h @@ -239,9 +239,9 @@ const int dropsegments=5; //everything with less than this number of steps will // Arc interpretation settings: //Step to split a cirrcle in small Lines -#define MM_PER_ARC_SEGMENT 1 +#define MM_PER_ARC_SEGMENT 0.5 //After this count of steps a new SIN / COS caluclation is startet to correct the circle interpolation -#define N_ARC_CORRECTION 25 +#define N_ARC_CORRECTION 40 //----------------------------------------------------------------------- //// FANCONTROL WITH SOFT PWM @@ -307,6 +307,10 @@ const int dropsegments=5; //everything with less than this number of steps will // magic formula 1, to get approximate "zero error" PWM duty. Take few measurements with low PWM duty and make linear fit to get the formula // for my makergear hot-end: linear fit {50,10},{60,20},{80,30},{105,50},{176,100},{128,64},{208,128} #define HEATER_DUTY_FOR_SETPOINT(setpoint) ((int)((187L*(long)setpoint)>>8)-27) + +//For reprap-feb Extruder V4 with heaterelement +//#define HEATER_DUTY_FOR_SETPOINT(setpoint) ((int)((72L*(long)setpoint)>>8)-14) + // magic formula 2, to make led brightness approximately linear #define LED_PWM_FOR_BRIGHTNESS(brightness) ((64*brightness-1384)/(300-brightness)) #endif diff --git a/Sprinter/Sprinter.pde b/Sprinter/Sprinter.pde index 852dce7..8e2a83a 100644 --- a/Sprinter/Sprinter.pde +++ b/Sprinter/Sprinter.pde @@ -151,7 +151,16 @@ Version 1.3.24T / 21.09.2013 - M105 show same format as Marlin work better with new Pronterface -- Optimize TEMP_RESIDENCY function + + Version 1.3.25T / 12.01.2014 +- M105 use the wrong convert function for Heatbed Target Temperatur +- Correct bug in calculate_trapezoid_for_block(..) +- smoother Steps for arc funtion G2/G3 +- example for HEATER_DUTY_FOR_SETPOINT for reprap-fab Extruder V4 +- more cycles for Autotune (M303) old 5 cycles, new 7 cycles +- New Thermistortable for ATC Semitec 104GT-2 (Type 5) + +. */ @@ -259,7 +268,7 @@ void __cxa_pure_virtual(){}; // M603 - Show Free Ram -#define _VERSION_TEXT "1.3.24T / 21.09.2013" +#define _VERSION_TEXT "1.3.25T / 12.01.2014" //Stepper Movement Variables char axis_codes[NUM_AXIS] = {'X', 'Y', 'Z', 'E'}; @@ -1502,7 +1511,7 @@ FORCE_INLINE void process_commands() if (code_seen('S')) target_bed_raw = temp2analogBed(code_value()); #endif break; - case 105: // M105 + case 105: // M105 ok T:21.2 /50.0 B:22.2 /50.0 @:127 B@:0 #if (TEMP_0_PIN > -1) || defined (HEATER_USES_MAX6675)|| defined HEATER_USES_AD595 hotendtC = analog2temp(current_raw); #endif @@ -1519,7 +1528,7 @@ FORCE_INLINE void process_commands() showString(PSTR(" B:")); Serial.print(bedtempC); showString(PSTR(" /")); - Serial.print(analog2temp(target_bed_raw)); + Serial.print(analog2tempBed(target_bed_raw)); #else Serial.print(PSTR(" B:0 /0")); #endif @@ -2302,9 +2311,9 @@ void calculate_trapezoid_for_block(block_t *block, float entry_factor, float exi long acceleration = block->acceleration_st; int32_t accelerate_steps = - ceil(estimate_acceleration_distance(block->initial_rate, block->nominal_rate, acceleration)); + ceil(estimate_acceleration_distance(initial_rate, block->nominal_rate, acceleration)); int32_t decelerate_steps = - floor(estimate_acceleration_distance(block->nominal_rate, block->final_rate, -acceleration)); + floor(estimate_acceleration_distance(block->nominal_rate, final_rate, -acceleration)); // Calculate the size of Plateau of Nominal Rate. int32_t plateau_steps = block->step_event_count-accelerate_steps-decelerate_steps; @@ -2312,9 +2321,10 @@ void calculate_trapezoid_for_block(block_t *block, float entry_factor, float exi // Is the Plateau of Nominal Rate smaller than nothing? That means no cruising, and we will // have to use intersection_distance() to calculate when to abort acceleration and start breaking // in order to reach the final_rate exactly at the end of this block. - if (plateau_steps < 0) { + if (plateau_steps < 0) + { accelerate_steps = ceil( - intersection_distance(block->initial_rate, block->final_rate, acceleration, block->step_event_count)); + intersection_distance(initial_rate, final_rate, acceleration, block->step_event_count)); accelerate_steps = max(accelerate_steps,0); // Check limits due to numerical round-off accelerate_steps = min(accelerate_steps,block->step_event_count); plateau_steps = 0; diff --git a/Sprinter/heater.cpp b/Sprinter/heater.cpp index e591bae..98876aa 100644 --- a/Sprinter/heater.cpp +++ b/Sprinter/heater.cpp @@ -420,7 +420,7 @@ void PID_autotune(int PIDAT_test_temp) showString(PSTR(" min: ")); Serial.print(PIDAT_min); showString(PSTR(" max: ")); Serial.println(PIDAT_max); - if(PIDAT_cycles > 2) + if(PIDAT_cycles > 3) { PIDAT_Ku = (4.0*PIDAT_d)/(3.14159*(PIDAT_max-PIDAT_min)); PIDAT_Tu = ((float)(PIDAT_t_low + PIDAT_t_high)/1000.0); @@ -432,9 +432,6 @@ void PID_autotune(int PIDAT_test_temp) PIDAT_Ki = 2*PIDAT_Kp/PIDAT_Tu; PIDAT_Kd = PIDAT_Kp*PIDAT_Tu/8; showString(PSTR(" Clasic PID \r\n")); - //showString(PSTR(" Kp: ")); Serial.println(PIDAT_Kp); - //showString(PSTR(" Ki: ")); Serial.println(PIDAT_Ki); - //showString(PSTR(" Kd: ")); Serial.println(PIDAT_Kd); showString(PSTR(" CFG Kp: ")); Serial.println((unsigned int)(PIDAT_Kp*256)); showString(PSTR(" CFG Ki: ")); Serial.println((unsigned int)(PIDAT_Ki*PIDAT_TIME_FACTOR)); showString(PSTR(" CFG Kd: ")); Serial.println((unsigned int)(PIDAT_Kd*PIDAT_TIME_FACTOR)); @@ -495,7 +492,7 @@ void PID_autotune(int PIDAT_test_temp) return; } - if(PIDAT_cycles > 5) + if(PIDAT_cycles > 7) { showString(PSTR("PID Autotune finished ! Place the Kp, Ki and Kd constants in the configuration.h\r\n")); return; @@ -805,7 +802,7 @@ int temp2analog_thermistor(int celsius, const short table[][2], int numtemps) #if defined (HEATER_USES_AD595) || defined (BED_USES_AD595) int temp2analog_ad595(int celsius) { - return celsius * 1024 / (500); + return (celsius * 1024.0) / (500.0); } #endif @@ -846,7 +843,7 @@ int analog2temp_thermistor(int raw,const short table[][2], int numtemps) { #if defined (HEATER_USES_AD595) || defined (BED_USES_AD595) int analog2temp_ad595(int raw) { - return raw * 500 / 1024; + return (raw * 500.0) / 1024.0; } #endif diff --git a/Sprinter/thermistortables.h b/Sprinter/thermistortables.h index 270cfaf..1e1aae3 100644 --- a/Sprinter/thermistortables.h +++ b/Sprinter/thermistortables.h @@ -200,71 +200,50 @@ const short temptable_4[NUMTEMPS_4][2] = { }; #endif -#if (THERMISTORHEATER == 5) || (THERMISTORBED == 5) //100k ParCan thermistor (104GT-2) +#if (THERMISTORHEATER == 5) || (THERMISTORBED == 5) //100k ParCan thermistor (ATC Semitec 104GT-2) -#define NUMTEMPS_5 61 +#define NUMTEMPS_5 33 const short temptable_5[NUMTEMPS_5][2] = { -{1, 713}, -{18, 316}, -{35, 266}, -{52, 239}, -{69, 221}, -{86, 208}, -{103, 197}, -{120, 188}, -{137, 181}, -{154, 174}, -{171, 169}, -{188, 163}, -{205, 159}, -{222, 154}, -{239, 150}, -{256, 147}, -{273, 143}, -{290, 140}, -{307, 136}, -{324, 133}, -{341, 130}, -{358, 128}, -{375, 125}, -{392, 122}, -{409, 120}, -{426, 117}, -{443, 115}, -{460, 112}, -{477, 110}, -{494, 108}, -{511, 106}, -{528, 103}, -{545, 101}, -{562, 99}, -{579, 97}, -{596, 95}, -{613, 92}, -{630, 90}, -{647, 88}, -{664, 86}, -{681, 84}, -{698, 81}, -{715, 79}, -{732, 77}, -{749, 75}, -{766, 72}, -{783, 70}, -{800, 67}, -{817, 64}, -{834, 61}, -{851, 58}, -{868, 55}, -{885, 52}, -{902, 48}, -{919, 44}, -{936, 40}, -{953, 34}, -{970, 28}, -{987, 20}, -{1004, 8}, -{1021, 0} + +// ATC Semitec 104GT-2 (Used in ParCan) --> Change to SMD Sensor RS 769-1899 +// 33 Fields +// Verified by linagee. Source: http://shop.arcol.hu/static/datasheets/thermistors.pdf +// Calculated using 4.7kohm pullup, voltage divider math, and manufacturer provided temp/resistance + {1, 713}, + {17, 300}, //top rating 300C + {20, 290}, + {23, 280}, + {27, 270}, + {31, 260}, + {37, 250}, + {43, 240}, + {51, 230}, + {61, 220}, + {73, 210}, + {87, 200}, + {106, 190}, + {128, 180}, + {155, 170}, + {189, 160}, + {230, 150}, + {278, 140}, + {336, 130}, + {357, 119}, + {402, 112}, + {476, 103}, + {554, 94}, + {635, 84}, + {713, 76}, + {784, 69}, + {846, 60}, + {897, 50}, + {937, 40}, + {966, 30}, + {986, 20}, + {1000, 10}, + {1021, 0} + + }; #endif