From 8cb931a77591b6ac41f392515790b4abecab4f9c Mon Sep 17 00:00:00 2001 From: kliment Date: Sat, 9 Jul 2011 13:28:43 +0200 Subject: Change step and temp control to fastio --- Sprinter/Sprinter.pde | 51 ++++++++++++++++++++++++++++++--------------------- 1 file changed, 30 insertions(+), 21 deletions(-) (limited to 'Sprinter') diff --git a/Sprinter/Sprinter.pde b/Sprinter/Sprinter.pde index 186f9f2..0994329 100644 --- a/Sprinter/Sprinter.pde +++ b/Sprinter/Sprinter.pde @@ -1228,17 +1228,26 @@ void linear_move(unsigned long axis_steps_remaining[]) // make linear move with } } -void do_step_update_micros(int axis) { - digitalWrite(STEP_PIN[axis], HIGH); - axis_previous_micros[axis] += interval; - digitalWrite(STEP_PIN[axis], LOW); - steps_taken[axis]+=1; -} - void do_step(int axis) { - digitalWrite(STEP_PIN[axis], HIGH); - digitalWrite(STEP_PIN[axis], LOW); + switch(axis){ + case 0: + WRITE(X_STEP_PIN, HIGH); + break; + case 1: + WRITE(Y_STEP_PIN, HIGH); + break; + case 2: + WRITE(Z_STEP_PIN, HIGH); + break; + case 3: + WRITE(E_STEP_PIN, HIGH); + break; + } steps_taken[axis]+=1; + WRITE(X_STEP_PIN, LOW); + WRITE(Y_STEP_PIN, LOW); + WRITE(Z_STEP_PIN, LOW); + WRITE(E_STEP_PIN, LOW); } #define HEAT_INTERVAL 250 @@ -1264,7 +1273,7 @@ int read_max6675() SPCR = (1< WATCHPERIOD){ if(watch_raw + 1 >= current_raw){ target_raw = 0; - digitalWrite(HEATER_0_PIN,LOW); - digitalWrite(LED_PIN,LOW); + WRITE(HEATER_0_PIN,LOW); + WRITE(LED_PIN,LOW); }else{ watchmillis = 0; } @@ -1354,13 +1363,13 @@ void manage_heater() #else if(current_raw >= target_raw) { - digitalWrite(HEATER_0_PIN,LOW); - digitalWrite(LED_PIN,LOW); + WRITE(HEATER_0_PIN,LOW); + WRITE(LED_PIN,LOW); } else { - digitalWrite(HEATER_0_PIN,HIGH); - digitalWrite(LED_PIN,HIGH); + WRITE(HEATER_0_PIN,HIGH); + WRITE(LED_PIN,HIGH); } #endif #endif @@ -1394,11 +1403,11 @@ void manage_heater() if(current_bed_raw >= target_bed_raw) { - digitalWrite(HEATER_1_PIN,LOW); + WRITE(HEATER_1_PIN,LOW); } else { - digitalWrite(HEATER_1_PIN,HIGH); + WRITE(HEATER_1_PIN,HIGH); } } @@ -1478,11 +1487,11 @@ inline void kill() { #if TEMP_0_PIN > -1 target_raw=0; - digitalWrite(HEATER_0_PIN,LOW); + WRITE(HEATER_0_PIN,LOW); #endif #if TEMP_1_PIN > -1 target_bed_raw=0; - if(HEATER_1_PIN > -1) digitalWrite(HEATER_1_PIN,LOW); + if(HEATER_1_PIN > -1) WRITE(HEATER_1_PIN,LOW); #endif disable_x(); disable_y(); -- cgit v1.2.1