summaryrefslogtreecommitdiff
path: root/Tonokip_Firmware
diff options
context:
space:
mode:
authorkliment <kliment.yanev@gmail.com>2011-05-14 23:42:57 +0200
committerkliment <kliment.yanev@gmail.com>2011-05-14 23:42:57 +0200
commitc0935ea3c7430cf77384ed6236d41e94b2adc3a0 (patch)
treee41dec2328cedf3dfbe5bd094b8db1fb74addd98 /Tonokip_Firmware
parent74d1769dca2c30a2d4021566c59175e679b6cd81 (diff)
Fix terrible lockup bug with RAMP acceleration
Reduce ram usage with smaller buffer line size
Diffstat (limited to 'Tonokip_Firmware')
-rw-r--r--Tonokip_Firmware/Tonokip_Firmware.pde26
1 files changed, 14 insertions, 12 deletions
diff --git a/Tonokip_Firmware/Tonokip_Firmware.pde b/Tonokip_Firmware/Tonokip_Firmware.pde
index 0dffde8..937de99 100644
--- a/Tonokip_Firmware/Tonokip_Firmware.pde
+++ b/Tonokip_Firmware/Tonokip_Firmware.pde
@@ -97,7 +97,7 @@ long timediff = 0;
// comm variables
-#define MAX_CMD_SIZE 256
+#define MAX_CMD_SIZE 96
#define BUFSIZE 8
char cmdbuffer[BUFSIZE][MAX_CMD_SIZE];
bool fromsd[BUFSIZE];
@@ -1069,6 +1069,13 @@ void linear_move(unsigned long x_steps_remaining, unsigned long y_steps_remainin
//move until no more steps remain
while(x_steps_remaining + y_steps_remaining + z_steps_remaining + e_steps_remaining > 0) {
+ //If more that 50ms have passed since previous heating check, adjust temp
+ if((millis() - previous_millis_heater) >= 50 ) {
+ manage_heater();
+ previous_millis_heater = millis();
+
+ manage_inactivity(2);
+ }
#ifdef RAMP_ACCELERATION
//If acceleration is enabled on this move and we are in the acceleration segment, calculate the current interval
if (acceleration_enabled && steps_done == 0) {
@@ -1179,7 +1186,10 @@ void linear_move(unsigned long x_steps_remaining, unsigned long y_steps_remainin
}
}
#ifdef RAMP_ACCELERATION
- if (steps_to_take > 0 && (steps_remaining == plateau_steps || (steps_done >= steps_to_take / 2 && accelerating && !decelerating))) continue;
+ if(x_steps_remaining==0 &&
+ y_steps_remaining==0 &&
+ steps_to_take > 0 &&
+ (steps_remaining == plateau_steps || (steps_done >= steps_to_take / 2 && accelerating && !decelerating))) continue;
#endif
//If there are z steps remaining, check if z steps must be taken
@@ -1202,7 +1212,7 @@ void linear_move(unsigned long x_steps_remaining, unsigned long y_steps_remainin
//If there are e steps remaining, check if e steps must be taken
if(e_steps_remaining){
- if (x_steps_to_take + y_steps_to_take <= 0) timediff = micros() * 100-previous_micros_e;
+ if (x_steps_to_take + y_steps_to_take <= 0) timediff = micros()*100 - 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;
@@ -1222,14 +1232,6 @@ void linear_move(unsigned long x_steps_remaining, unsigned long y_steps_remainin
#endif
}
}
-
- //If more that 50ms have passed since previous heating check, adjust temp
- if(!accelerating && (millis() - previous_millis_heater) >= 50 ) {
- manage_heater();
- previous_millis_heater = millis();
-
- manage_inactivity(2);
- }
}
if(DISABLE_X) disable_x();
@@ -1597,4 +1599,4 @@ inline void kill(byte debug)
inline void manage_inactivity(byte debug) {
if( (millis()-previous_millis_cmd) > max_inactive_time ) if(max_inactive_time) kill(debug);
if( (millis()-previous_millis_cmd) > stepper_inactive_time ) if(stepper_inactive_time) { disable_x(); disable_y(); disable_z(); disable_e(); }
-} \ No newline at end of file
+}