void getHighESpeed() { static float oldt = 0; if (!autotemp_enabled) return; if (degTargetHotend0() + 2 < autotemp_min) return; // probably temperature set to zero. float high = 0.0; uint8_t block_index = block_buffer_tail; while (block_index != block_buffer_head) { block_t *block = &block_buffer[block_index]; if (block->steps[X_AXIS] || block->steps[Y_AXIS] || block->steps[Z_AXIS]) { float se = (float)block->steps[E_AXIS] / block->step_event_count * block->nominal_speed; // mm/sec; if (se > high) high = se; } block_index = next_block_index(block_index); } float t = autotemp_min + high * autotemp_factor; t = constrain(t, autotemp_min, autotemp_max); if (oldt > t) { t *= (1 - AUTOTEMP_OLDWEIGHT); t += AUTOTEMP_OLDWEIGHT * oldt; } oldt = t; setTargetHotend0(t); }
void getHighESpeed() { static float oldt=0; if(!autotemp_enabled){ return; } if(degTargetHotend0()+2<autotemp_min) { //probably temperature set to zero. return; //do nothing } float high=0.0; uint8_t block_index = block_buffer_tail; while(block_index != block_buffer_head) { if((block_buffer[block_index].steps_x != 0) || (block_buffer[block_index].steps_y != 0) || (block_buffer[block_index].steps_z != 0)) { float se=(float(block_buffer[block_index].steps_e)/float(block_buffer[block_index].step_event_count))*block_buffer[block_index].nominal_speed; //se; mm/sec; if(se>high) { high=se; } } block_index = (block_index+1) & (BLOCK_BUFFER_SIZE - 1); } float g=autotemp_min+high*autotemp_factor; float t=g; if(t<autotemp_min) t=autotemp_min; if(t>autotemp_max) t=autotemp_max; if(oldt>t) { t=AUTOTEMP_OLDWEIGHT*oldt+(1-AUTOTEMP_OLDWEIGHT)*t; } oldt=t; setTargetHotend0(t); }
void getHighESpeed() { static float oldt=0; if(!autotemp_enabled) return; 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].steps_e/float(block_buffer[block_index].step_event_count)*block_buffer[block_index].nominal_rate; //se; units steps/sec; if(se>high) { high=se; } block_index = (block_index+1) & (BLOCK_BUFFER_SIZE - 1); } float g=autotemp_min+high*autotemp_factor; float t=g; if(t<autotemp_min) t=autotemp_min; if(t>autotemp_max) t=autotemp_max; if(oldt>t) { t=AUTOTEMP_OLDWEIGHT*oldt+(1-AUTOTEMP_OLDWEIGHT)*t; } oldt=t; setTargetHotend0(t); // SERIAL_ECHO_START; // SERIAL_ECHOPAIR("highe",high); // SERIAL_ECHOPAIR(" t",t); // SERIAL_ECHOLN(""); }