minor changes and first not-well working version of autotemp

This commit is contained in:
Bernhard Kubicek 2011-11-09 22:09:16 +01:00
parent ba8a53a40f
commit 36958ee305
7 changed files with 56 additions and 6 deletions

View File

@ -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
//===========================================================================

View File

@ -25,7 +25,6 @@ template <class T> int EEPROM_readAnything(int &ee, T& value)
}
//======================================================================================
#define SERIAL_ECHOPAIR(name,value) {SERIAL_ECHOPGM(name);SERIAL_ECHO(value);}

View File

@ -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)

View File

@ -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();

View File

@ -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()+2<AUTOTEMP_MIN) //probably temperature set to zero.
return; //do nothing
float high=0;
char block_index = block_buffer_tail;
while(block_index != block_buffer_head) {
float se=block_buffer[block_index].speed_e;
if(se>high)
{
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();
}

View File

@ -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

View File

@ -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<LCD_WIDTH)
{
*target=ch;
target++;
cnt++;
ch=pgm_read_byte(++message);
}
}