From 8a08b8e07e0bd84c1778eca7f3f32fafff5c3af5 Mon Sep 17 00:00:00 2001 From: Bernhard Kubicek Date: Sat, 19 Nov 2011 15:37:10 +0100 Subject: [PATCH] trying to get autotemp to work. --- Marlin/Marlin.pde | 10 ++++++++++ Marlin/planner.cpp | 20 +++++++++++++------- Marlin/planner.h | 8 +++++++- 3 files changed, 30 insertions(+), 8 deletions(-) diff --git a/Marlin/Marlin.pde b/Marlin/Marlin.pde index 34d50e3c4..c0fc8675c 100644 --- a/Marlin/Marlin.pde +++ b/Marlin/Marlin.pde @@ -695,7 +695,17 @@ inline void process_commands() case 109: {// M109 - Wait for extruder heater to reach target. LCD_MESSAGEPGM("Heating..."); + autotemp_enabled=false; if (code_seen('S')) setTargetHotend0(code_value()); + #ifdef AUTOTEMP + if (code_seen('S')) autotemp_min=code_value(); + if (code_seen('T')) autotemp_max=code_value(); + if (code_seen('F')) + { + autotemp_factor=code_value(); + autotemp_enabled=true; + } + #endif setWatch(); codenum = millis(); diff --git a/Marlin/planner.cpp b/Marlin/planner.cpp index c27d58601..0a226c66f 100644 --- a/Marlin/planner.cpp +++ b/Marlin/planner.cpp @@ -87,7 +87,10 @@ static float previous_speed[4]; // Speed of previous path line segment static float previous_nominal_speed; // Nominal speed of previous path line segment #ifdef AUTOTEMP -float high_e_speed=0; + float autotemp_max=250; + float autotemp_min=210; + float autotemp_factor=1; + bool autotemp_enabled=false; #endif @@ -379,26 +382,29 @@ block_t *plan_get_current_block() { #ifdef AUTOTEMP void getHighESpeed() { - if(degTargetHotend0()+2high) { high=se; } block_index = (block_index+1) & (BLOCK_BUFFER_SIZE - 1); } - high_e_speed=high*axis_steps_per_unit[E_AXIS]/(1000000.0); //so it is independent of the esteps/mm. before - float g=AUTOTEMP_MIN+high_e_speed*AUTOTEMP_FACTOR; - float t=constrain(AUTOTEMP_MIN,g,AUTOTEMP_MAX); + float g=autotemp_min+high*autotemp_factor; + float t=constrain(autotemp_min,g,autotemp_max); setTargetHotend0(t); SERIAL_ECHO_START; - SERIAL_ECHOPAIR("highe",high_e_speed); + SERIAL_ECHOPAIR("highe",high); SERIAL_ECHOPAIR(" t",t); SERIAL_ECHOLN(""); } diff --git a/Marlin/planner.h b/Marlin/planner.h index be1587d6b..ec497d506 100644 --- a/Marlin/planner.h +++ b/Marlin/planner.h @@ -92,7 +92,13 @@ extern float max_xy_jerk; //speed than can be stopped at once, if i understand c extern float max_z_jerk; extern float mintravelfeedrate; extern unsigned long axis_steps_per_sqr_second[NUM_AXIS]; + + #ifdef AUTOTEMP -extern float high_e_speed; + extern bool autotemp_enabled; + extern float autotemp_max; + extern float autotemp_min; + extern float autotemp_factor; #endif + #endif