From 25d00d4147c5533eee9afde9b28e35e6b013c677 Mon Sep 17 00:00:00 2001 From: Emanuele Caruso Date: Tue, 5 Apr 2011 16:58:58 +0200 Subject: Performance tweak: removed timediff calculations for extruder steps if the move has X or Y steps, since it is not used in that case --- Tonokip_Firmware/Tonokip_Firmware.pde | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Tonokip_Firmware/Tonokip_Firmware.pde b/Tonokip_Firmware/Tonokip_Firmware.pde index f5941c7..e441121 100644 --- a/Tonokip_Firmware/Tonokip_Firmware.pde +++ b/Tonokip_Firmware/Tonokip_Firmware.pde @@ -378,7 +378,7 @@ inline void process_commands() if(x_steps_to_take) x_interval = time_for_move/x_steps_to_take; if(y_steps_to_take) y_interval = time_for_move/y_steps_to_take; if(z_steps_to_take) z_interval = time_for_move/z_steps_to_take; - if(e_steps_to_take) e_interval = time_for_move/e_steps_to_take; + if(e_steps_to_take && (x_steps_to_take + y_steps_to_take <= 0)) e_interval = time_for_move/e_steps_to_take; //#define DEBUGGING false #if 0 @@ -754,12 +754,12 @@ void linear_move(unsigned long x_steps_remaining, unsigned long y_steps_remainin } if(e_steps_remaining){ - timediff=micros()-previous_micros_e; + if (x_steps_to_take + y_steps_to_take <= 0) timediff=micros()-previous_micros_e; unsigned int final_e_steps_remaining = 0; if (steep_x && x_steps_to_take > 0) final_e_steps_remaining = e_steps_to_take * x_steps_remaining / x_steps_to_take; else if (steep_y && y_steps_to_take > 0) final_e_steps_remaining = e_steps_to_take * y_steps_remaining / y_steps_to_take; - if (final_e_steps_remaining > 0) while(e_steps_remaining > final_e_steps_remaining) { do_e_step(); e_steps_remaining--; timediff-=e_interval;} - else if (x_steps_to_take > 0 || y_steps_to_take > 0) while(e_steps_remaining) { do_e_step(); e_steps_remaining--; timediff-=e_interval;} + if (final_e_steps_remaining > 0) while(e_steps_remaining > final_e_steps_remaining) { do_e_step(); e_steps_remaining--;} + else if (x_steps_to_take + y_steps_to_take > 0) while(e_steps_remaining) { do_e_step(); e_steps_remaining--;} else while (timediff >= e_interval && e_steps_remaining) { do_e_step(); e_steps_remaining--; timediff-=e_interval;} } if( (millis() - previous_millis_heater) >= 500 ) { -- cgit v1.2.1