From 36958ee30576dd282a373c8b1da6ad8d9d22eb7b Mon Sep 17 00:00:00 2001 From: Bernhard Kubicek Date: Wed, 9 Nov 2011 22:09:16 +0100 Subject: [PATCH] minor changes and first not-well working version of autotemp --- Marlin/Configuration.h | 12 +++++++++++- Marlin/EEPROMwrite.h | 1 - Marlin/Marlin.h | 3 +++ Marlin/Marlin.pde | 3 +-- Marlin/planner.cpp | 35 +++++++++++++++++++++++++++++++++++ Marlin/planner.h | 4 +++- Marlin/ultralcd.pde | 4 +++- 7 files changed, 56 insertions(+), 6 deletions(-) diff --git a/Marlin/Configuration.h b/Marlin/Configuration.h index f44c858b9..8661ae438 100644 --- a/Marlin/Configuration.h +++ b/Marlin/Configuration.h @@ -119,7 +119,7 @@ // if Kc is choosen well, the additional required power due to increased melting should be compensated. #define PID_ADD_EXTRUSION_RATE #ifdef PID_ADD_EXTRUSION_RATE - #define DEFAULT_Kc (5) //heatingpower=Kc*(e_speed) + #define DEFAULT_Kc (3) //heatingpower=Kc*(e_speed) #endif #endif // PIDTEMP @@ -275,6 +275,16 @@ const bool ENDSTOPS_INVERTING = true; // set to true to invert the logic of the #define N_ARC_CORRECTION 25 +//automatic temperature: just for testing, this is very dangerous, keep disabled! +// not working yet. +//Erik: the settings currently depend dramatically on skeinforge39 or 41. +//#define AUTOTEMP +#define AUTOTEMP_MIN 190 +#define AUTOTEMP_MAX 260 +#define AUTOTEMP_FACTOR 1000. //current target temperature= min+largest buffered espeeds)*FACTOR + + + const int dropsegments=0; //everything with less than this number of steps will be ignored as move and joined with the next movement //=========================================================================== diff --git a/Marlin/EEPROMwrite.h b/Marlin/EEPROMwrite.h index fcb3d8d39..3d8a0b2b9 100644 --- a/Marlin/EEPROMwrite.h +++ b/Marlin/EEPROMwrite.h @@ -25,7 +25,6 @@ template int EEPROM_readAnything(int &ee, T& value) } //====================================================================================== -#define SERIAL_ECHOPAIR(name,value) {SERIAL_ECHOPGM(name);SERIAL_ECHO(value);} diff --git a/Marlin/Marlin.h b/Marlin/Marlin.h index 1e36b61e8..e14471264 100644 --- a/Marlin/Marlin.h +++ b/Marlin/Marlin.h @@ -35,6 +35,9 @@ const char echomagic[] PROGMEM ="echo:"; #define SERIAL_ECHOLN(x) SERIAL_PROTOCOLLN(x) #define SERIAL_ECHOLNPGM(x) SERIAL_PROTOCOLLNPGM(x) +#define SERIAL_ECHOPAIR(name,value) {SERIAL_ECHOPGM(name);SERIAL_ECHO(value);} + + //things to write to serial from Programmemory. saves 400 to 2k of RAM. #define SerialprintPGM(x) serialprintPGM(PSTR(x)) inline void serialprintPGM(const char *str) diff --git a/Marlin/Marlin.pde b/Marlin/Marlin.pde index dee095d84..672591a72 100644 --- a/Marlin/Marlin.pde +++ b/Marlin/Marlin.pde @@ -211,7 +211,6 @@ void setup() { Serial.begin(BAUDRATE); SERIAL_ECHO_START; - SERIAL_ECHOPGM("Marlin "); SERIAL_ECHOLN(version_string); SERIAL_PROTOCOLLNPGM("start"); SERIAL_ECHO_START; @@ -785,8 +784,8 @@ inline void process_commands() } else { - LCD_MESSAGEPGM("Free move."); st_synchronize(); + LCD_MESSAGEPGM("Free move."); disable_x(); disable_y(); disable_z(); diff --git a/Marlin/planner.cpp b/Marlin/planner.cpp index 34e29ff53..863b116a5 100644 --- a/Marlin/planner.cpp +++ b/Marlin/planner.cpp @@ -84,6 +84,10 @@ unsigned long axis_steps_per_sqr_second[NUM_AXIS]; // The current position of the tool in absolute steps long position[4]; //rescaled from extern when axis_steps_per_unit are changed by gcode +#ifdef AUTOTEMP +float high_e_speed=0; +#endif + //=========================================================================== //=============================private variables ============================ @@ -363,6 +367,34 @@ block_t *plan_get_current_block() { return(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); + setTargetHotend0(t); + SERIAL_ECHO_START; + SERIAL_ECHOPAIR("highe",high_e_speed); + SERIAL_ECHOPAIR(" t",t); + SERIAL_ECHOLN(""); +} +#endif + void check_axes_activity() { unsigned char x_active = 0; unsigned char y_active = 0; @@ -581,6 +613,9 @@ void plan_buffer_line(const float &x, const float &y, const float &z, const floa memcpy(position, target, sizeof(target)); // position[] = target[] planner_recalculate(); + #ifdef AUTOTEMP + getHighESpeed(); + #endif st_wake_up(); } diff --git a/Marlin/planner.h b/Marlin/planner.h index 79f54d879..c5bc5b8aa 100644 --- a/Marlin/planner.h +++ b/Marlin/planner.h @@ -89,5 +89,7 @@ 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; +#endif #endif diff --git a/Marlin/ultralcd.pde b/Marlin/ultralcd.pde index 59edb3470..d95167166 100644 --- a/Marlin/ultralcd.pde +++ b/Marlin/ultralcd.pde @@ -71,10 +71,12 @@ void lcd_statuspgm(const char* message) { char ch=pgm_read_byte(message); char *target=messagetext; - while(ch) + uint8_t cnt=0; + while(ch &&cnt