summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Sprinter/Configuration.h6
-rw-r--r--Sprinter/Sprinter.pde44
-rw-r--r--Sprinter/fastio.h48
-rw-r--r--Sprinter/pins.h50
4 files changed, 146 insertions, 2 deletions
diff --git a/Sprinter/Configuration.h b/Sprinter/Configuration.h
index df52a08..950387a 100644
--- a/Sprinter/Configuration.h
+++ b/Sprinter/Configuration.h
@@ -99,6 +99,12 @@ bool axis_relative_modes[] = {false, false, false, false};
// If you enable this, make sure STEP_DELAY_MICROS is disabled. (except for Gen6: both need to be enabled.)
//#define STEP_DELAY_RATIO 0.25
+///Oscillation reduction. Forces x,y,or z axis to be stationary for ## ms before allowing axis to switch direcitons. Alternative method to prevent skipping steps. Uncomment the line below to activate.
+//#define RAPID_OSCILLATION_REDUCTION
+#ifdef RAPID_OSCILLATION_REDUCTION
+long min_time_before_dir_change = 30; //milliseconds
+#endif
+
// Comment this to disable ramp acceleration
#define RAMP_ACCELERATION
diff --git a/Sprinter/Sprinter.pde b/Sprinter/Sprinter.pde
index 657efed..bc8a2ac 100644
--- a/Sprinter/Sprinter.pde
+++ b/Sprinter/Sprinter.pde
@@ -91,7 +91,12 @@ float axis_diff[NUM_AXIS] = {0, 0, 0, 0};
#ifdef STEP_DELAY_RATIO
long long_step_delay_ratio = STEP_DELAY_RATIO * 100;
#endif
-
+///oscillation reduction
+ifdef RAPID_OSCILLATION_REDUCTION
+ float cumm_wait_time_in_dir[NUM_AXIS]={0.0,0.0,0.0,0.0};
+ bool prev_move_direction[NUM_AXIS]={1,1,1,1};
+ float osc_wait_remainder = 0.0;
+#endif
// comm variables
#define MAX_CMD_SIZE 96
@@ -1081,11 +1086,46 @@ void prepare_move()
time_for_move = time_for_move / max_feedrate[i] * (abs(axis_diff[i]) / (time_for_move / 60000000.0));
}
}
+
+#ifdef RAPID_OSCILLATION_REDUCTION //VERBOSE commenting for peer review. tested on multiple prints--works!
+ for(int i=0; i < NUM_AXIS-1; i++) { //do for each axis, except for extruder (refer to the -1 value)
+ if(prev_move_direction[i] != move_direction[i]){ //check if we've changed direcitons
+ osc_wait_remainder=min_time_before_dir_change; //if we changed directions, then shit the bed! We better make sure to wait & chill out time before jerkin' over in the opposite direction!
+ if(cumm_wait_time_in_dir[i]<min_time_before_dir_change){ //if so, check if we've sat @ the current position long enough for this axis
+ if((min_time_before_dir_change-cumm_wait_time_in_dir[i])>osc_wait_remainder){ //if not, dont overwrite the remaining wait time if we already have to wait LONGER for a different axis
+ osc_wait_remainder=min_time_before_dir_change-cumm_wait_time_in_dir[i];
+ }
+ }
+ cumm_wait_time_in_dir[i] = 0.0; //we've changed directions! now that we've either set a wait period, or we had already waited long enough after a direction change, let's reset our wait variable for this axis
+ }
+ else{ //we haven't changed directions! so, lets make sure to increase our wait time for the time we have not been moving back on the same axis
+ if(cumm_wait_time_in_dir[i]==0.0){
+ cumm_wait_time_in_dir[i] = 0.001; //if the cumm wait variable = 0.0, that means we've just completed our first move after a dir change. we really haven't waited at all. so, let's increment the wait value insignifcant value so that we may proceed, but not hit this line again.
+ }
+ else{
+ //Serial.print("It is will take [ESTIMATED] this many seconds to perform this move:"); Serial.println(time_for_move/1000000);
+ cumm_wait_time_in_dir[i] = cumm_wait_time_in_dir[i] + time_for_move/1000; //increment the time we've waited in this axis
+ }
+ }
+ }
+
+ //update prev_moves for next move. again, excluded extruder
+ for(int i=0; i < NUM_AXIS-1; i++) {
+ prev_move_direction[i]=move_direction[i];
+ }
+
+ //now WAIT if you are oscillating back & forth too fast in any given axis
+ if(osc_wait_remainder>0.0){
+ delay(osc_wait_remainder);
+ osc_wait_remainder=0.0;
+ }
+#endif
+
//Calculate the full speed stepper interval for each axis
for(int i=0; i < NUM_AXIS; i++) {
if(move_steps_to_take[i]) axis_interval[i] = time_for_move / move_steps_to_take[i] * 100;
}
-
+
#ifdef DEBUG_PREPARE_MOVE
log_float("_PREPARE_MOVE - Move distance on the XY plane", xy_d);
log_float("_PREPARE_MOVE - Move distance on the XYZ space", d);
diff --git a/Sprinter/fastio.h b/Sprinter/fastio.h
index 6b5572a..5f1f5d1 100644
--- a/Sprinter/fastio.h
+++ b/Sprinter/fastio.h
@@ -625,6 +625,54 @@ pins
#define DIO31_DDR DDRA
#define DIO31_PWM NULL
+#define DIO33_PIN PINA7
+#define DIO33_RPORT PINA
+#define DIO33_WPORT PORTA
+#define DIO33_DDR DDRA
+#define DIO33_PWM NULL
+
+#define DIO34_PIN PINA6
+#define DIO34_RPORT PINA
+#define DIO34_WPORT PORTA
+#define DIO34_DDR DDRA
+#define DIO34_PWM NULL
+
+#define DIO35_PIN PINA5
+#define DIO35_RPORT PINA
+#define DIO35_WPORT PORTA
+#define DIO35_DDR DDRA
+#define DIO35_PWM NULL
+
+#define DIO36_PIN PINA4
+#define DIO36_RPORT PINA
+#define DIO36_WPORT PORTA
+#define DIO36_DDR DDRA
+#define DIO36_PWM NULL
+
+#define DIO37_PIN PINA3
+#define DIO37_RPORT PINA
+#define DIO37_WPORT PORTA
+#define DIO37_DDR DDRA
+#define DIO37_PWM NULL
+
+#define DIO38_PIN PINA2
+#define DIO38_RPORT PINA
+#define DIO38_WPORT PORTA
+#define DIO38_DDR DDRA
+#define DIO38_PWM NULL
+
+#define DIO39_PIN PINA1
+#define DIO39_RPORT PINA
+#define DIO39_WPORT PORTA
+#define DIO39_DDR DDRA
+#define DIO39_PWM NULL
+
+#define DIO40_PIN PINA0
+#define DIO40_RPORT PINA
+#define DIO40_WPORT PORTA
+#define DIO40_DDR DDRA
+#define DIO40_PWM NULL
+
#define AIO0_PIN PINA0
#define AIO0_RPORT PINA
#define AIO0_WPORT PORTA
diff --git a/Sprinter/pins.h b/Sprinter/pins.h
index fbe6a6e..ed0420f 100644
--- a/Sprinter/pins.h
+++ b/Sprinter/pins.h
@@ -688,6 +688,56 @@
#endif
/****************************************************************************************
+* Gen7 pin assignment
+*
+****************************************************************************************/
+#if MOTHERBOARD == 7
+#define KNOWN_BOARD 1
+
+#if !defined(__AVR_ATmega644P__) && !defined(__AVR_ATmega1284P__)
+ #error Oops! Make sure you have 'Sanguino' selected from the 'Tools -> Boards' menu.
+#endif
+
+//x axis pins
+ #define X_STEP_PIN 15
+ #define X_DIR_PIN 18
+ #define X_ENABLE_PIN 33
+ #define X_MIN_PIN 8
+ #define X_MAX_PIN 7
+
+ //y axis pins
+ #define Y_STEP_PIN 29
+ #define Y_DIR_PIN 28
+ #define Y_ENABLE_PIN 33
+ #define Y_MIN_PIN 3
+ #define Y_MAX_PIN 6
+
+ //z axis pins
+ #define Z_STEP_PIN 35
+ #define Z_DIR_PIN 34
+ #define Z_ENABLE_PIN 33
+ #define Z_MIN_PIN 2
+ #define Z_MAX_PIN 1
+
+ //extruder pins
+ #define E_STEP_PIN 37
+ #define E_DIR_PIN 36
+ #define E_ENABLE_PIN 33
+ #define TEMP_0_PIN 39 // Extruder
+ #define HEATER_0_PIN 5 // Extruder
+ #define HEATER_1_PIN 4 // Bed
+
+
+ #define SDPOWER -1
+ #define SDSS -1
+ #define LED_PIN -1
+ #define TEMP_1_PIN 38 //Bed
+ #define FAN_PIN -1
+ #define PS_ON_PIN 21
+
+#endif
+
+/****************************************************************************************
* Teensylu 0.7 pin assingments (ATMEGA90USB)
* Requires the Teensyduino software with Teensy2.0++ selected in arduino IDE!
****************************************************************************************/