summaryrefslogtreecommitdiff
path: root/Sprinter
diff options
context:
space:
mode:
authorkliment <kliment.yanev@gmail.com>2011-08-29 07:12:21 -0700
committerkliment <kliment.yanev@gmail.com>2011-08-29 07:12:21 -0700
commit03af4f0a658a28f955cb32a8bb6539a2b184e1d5 (patch)
tree469a34e44f433ed280cb726605489ceb72b6bcdf /Sprinter
parentbc9e0b7a5ee63dddefd2f29700809eaaf091d135 (diff)
parent736a8f3b4a79d40b6c69eda659ba53e41c7ab342 (diff)
Merge pull request #82 from alexrj/setup-acceleration
Refactoring acceleration math to a new setup_acceleration() function to make M92 work
Diffstat (limited to 'Sprinter')
-rw-r--r--Sprinter/Sprinter.h1
-rw-r--r--Sprinter/Sprinter.pde25
2 files changed, 14 insertions, 12 deletions
diff --git a/Sprinter/Sprinter.h b/Sprinter/Sprinter.h
index d612b5d..a7c7a8f 100644
--- a/Sprinter/Sprinter.h
+++ b/Sprinter/Sprinter.h
@@ -8,6 +8,7 @@ void get_command();
void process_commands();
void manage_inactivity(byte debug);
+void setup_acceleration();
void manage_heater();
int temp2analogu(int celsius, const short table[][2], int numtemps, int source);
diff --git a/Sprinter/Sprinter.pde b/Sprinter/Sprinter.pde
index c0c4107..99c1dce 100644
--- a/Sprinter/Sprinter.pde
+++ b/Sprinter/Sprinter.pde
@@ -311,11 +311,7 @@ void setup()
SET_OUTPUT(E_STEP_PIN);
#endif
#ifdef RAMP_ACCELERATION
- for(int i=0; i < NUM_AXIS; i++){
- axis_max_interval[i] = 100000000.0 / (max_start_speed_units_per_second[i] * axis_steps_per_unit[i]);
- axis_steps_per_sqr_second[i] = max_acceleration_units_per_sq_second[i] * axis_steps_per_unit[i];
- axis_travel_steps_per_sqr_second[i] = max_travel_acceleration_units_per_sq_second[i] * axis_steps_per_unit[i];
- }
+ setup_acceleration();
#endif
#ifdef HEATER_USES_MAX6675
@@ -891,15 +887,10 @@ inline void process_commands()
if(code_seen(axis_codes[i])) axis_steps_per_unit[i] = code_value();
}
- //Update start speed intervals and axis order. TODO: refactor axis_max_interval[] calculation into a function, as it
- // should also be used in setup() as well
#ifdef RAMP_ACCELERATION
- long temp_max_intervals[NUM_AXIS];
- for(int i=0; i < NUM_AXIS; i++) {
- axis_max_interval[i] = 100000000.0 / (max_start_speed_units_per_second[i] * axis_steps_per_unit[i]);//TODO: do this for
- // all steps_per_unit related variables
- }
+ setup_acceleration();
#endif
+
break;
case 115: // M115
Serial.print("FIRMWARE_NAME:Sprinter FIRMWARE_URL:http%%3A/github.com/kliment/Sprinter/ PROTOCOL_VERSION:1.0 MACHINE_TYPE:Mendel EXTRUDER_COUNT:1 UUID:");
@@ -1638,6 +1629,16 @@ if( (millis()-previous_millis_cmd) > max_inactive_time ) if(max_inactive_time)
if( (millis()-previous_millis_cmd) > stepper_inactive_time ) if(stepper_inactive_time) { disable_x(); disable_y(); disable_z(); disable_e(); }
}
+#ifdef RAMP_ACCELERATION
+void setup_acceleration() {
+ for (int i=0; i < NUM_AXIS; i++) {
+ axis_max_interval[i] = 100000000.0 / (max_start_speed_units_per_second[i] * axis_steps_per_unit[i]);
+ axis_steps_per_sqr_second[i] = max_acceleration_units_per_sq_second[i] * axis_steps_per_unit[i];
+ axis_travel_steps_per_sqr_second[i] = max_travel_acceleration_units_per_sq_second[i] * axis_steps_per_unit[i];
+ }
+}
+#endif
+
#ifdef DEBUG
void log_message(char* message) {
Serial.print("DEBUG"); Serial.println(message);