summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Sprinter/Configuration.h5
-rw-r--r--Sprinter/Sd2Card.cpp4
-rw-r--r--Sprinter/SdFatUtil.h4
-rw-r--r--Sprinter/SdFile.cpp4
-rw-r--r--Sprinter/Sprinter.pde98
-rw-r--r--Sprinter/heater.cpp26
-rw-r--r--Sprinter/pins.h2
-rw-r--r--Sprinter/store_eeprom.cpp12
-rw-r--r--Sprinter/store_eeprom.h3
-rw-r--r--Sprinter/thermistortables.h4
10 files changed, 119 insertions, 43 deletions
diff --git a/Sprinter/Configuration.h b/Sprinter/Configuration.h
index 5d5d78e..37d94ce 100644
--- a/Sprinter/Configuration.h
+++ b/Sprinter/Configuration.h
@@ -175,7 +175,7 @@ const int NUM_AXIS = 4; // The axis order in all axis related arrays is X, Y, Z,
//#define RAPID_OSCILLATION_REDUCTION
#ifdef RAPID_OSCILLATION_REDUCTION
-long min_time_before_dir_change = 30; //milliseconds
+const long min_time_before_dir_change = 30; //milliseconds
#endif
//-----------------------------------------------------------------------
@@ -186,6 +186,7 @@ long min_time_before_dir_change = 30; //milliseconds
#define _RETRACT_ACCELERATION 2000 // Extruder Normal acceleration mm/s^2
#define _MAX_XY_JERK 20.0
#define _MAX_Z_JERK 0.4
+#define _MAX_E_JERK 5.0 // (mm/sec)
//#define _MAX_START_SPEED_UNITS_PER_SECOND {25.0,25.0,0.2,10.0}
#define _MAX_ACCELERATION_UNITS_PER_SQ_SECOND {5000,5000,50,5000} // X, Y, Z and E max acceleration in mm/s^2 for printing moves or retracts
@@ -193,7 +194,7 @@ long min_time_before_dir_change = 30; //milliseconds
// Minimum planner junction speed. Sets the default minimum speed the planner plans for at the end
// of the buffer and all stops. This should not be much greater than zero and should only be changed
// if unwanted behavior is observed on a user's machine when running at very slow speeds.
-#define MINIMUM_PLANNER_SPEED 2.0 // (mm/sec)
+#define MINIMUM_PLANNER_SPEED 0.05 // (mm/sec)
#define DEFAULT_MINIMUMFEEDRATE 0.0 // minimum feedrate
#define DEFAULT_MINTRAVELFEEDRATE 0.0
diff --git a/Sprinter/Sd2Card.cpp b/Sprinter/Sd2Card.cpp
index 8222cfd..05832e7 100644
--- a/Sprinter/Sd2Card.cpp
+++ b/Sprinter/Sd2Card.cpp
@@ -17,7 +17,11 @@
* along with the Arduino Sd2Card Library. If not, see
* <http://www.gnu.org/licenses/>.
*/
+#if defined(ARDUINO) && ARDUINO >= 100
+#include <Arduino.h>
+#else
#include <WProgram.h>
+#endif
#include "Sd2Card.h"
//------------------------------------------------------------------------------
#ifndef SOFTWARE_SPI
diff --git a/Sprinter/SdFatUtil.h b/Sprinter/SdFatUtil.h
index de3fee3..361a5a2 100644
--- a/Sprinter/SdFatUtil.h
+++ b/Sprinter/SdFatUtil.h
@@ -23,7 +23,11 @@
* \file
* Useful utility functions.
*/
+#if defined(ARDUINO) && ARDUINO >= 100
+#include <Arduino.h>
+#else
#include <WProgram.h>
+#endif
#include <avr/pgmspace.h>
/** Store and print a string in flash memory.*/
#define PgmPrint(x) SerialPrint_P(PSTR(x))
diff --git a/Sprinter/SdFile.cpp b/Sprinter/SdFile.cpp
index 13f4c6a..c847e01 100644
--- a/Sprinter/SdFile.cpp
+++ b/Sprinter/SdFile.cpp
@@ -19,7 +19,11 @@
*/
#include "SdFat.h"
#include <avr/pgmspace.h>
+#if defined(ARDUINO) && ARDUINO >= 100
+#include <Arduino.h>
+#else
#include <WProgram.h>
+#endif
//------------------------------------------------------------------------------
// callback function for date/time
void (*SdFile::dateTime_)(uint16_t* date, uint16_t* time) = NULL;
diff --git a/Sprinter/Sprinter.pde b/Sprinter/Sprinter.pde
index a027377..27a0bc3 100644
--- a/Sprinter/Sprinter.pde
+++ b/Sprinter/Sprinter.pde
@@ -46,7 +46,7 @@
- New Command
* M202 - Set maximum feedrate that your machine can sustain (M203 X200 Y200 Z300 E10000) in mm/sec
* M204 - Set default acceleration: S normal moves T filament only moves (M204 S3000 T7000) im mm/sec^2
- * M205 - advanced settings: minimum travel speed S=while printing T=travel only, X= maximum xy jerk, Z=maximum Z jerk
+ * M205 - advanced settings: minimum travel speed S=while printing T=travel only, X= maximum xy jerk, Z=maximum Z jerk, E = max E jerk
- Remove unused Variables
- Check Uart Puffer while circle processing (CMD: G2 / G3)
- Fast Xfer Function --> move Text to Flash
@@ -120,6 +120,15 @@
- M303 - PID relay autotune possible
- G4 Wait until last move is done
+ Version 1.3.18T
+- Problem with Thermistor 3 table when sensor is brocken and temp is -20 °C
+
+ Version 1.3.19T
+- Set maximum acceleration. If "steps per unit" is Change the acc were not recalculatet
+- Extra Parameter for Max Extruder Jerk
+- New Parameter (max_e_jerk) in EEPROM --> Default settings after update !
+
+
*/
@@ -226,7 +235,7 @@ void __cxa_pure_virtual(){};
// M603 - Show Free Ram
-#define _VERSION_TEXT "1.3.17T / 04.05.2012"
+#define _VERSION_TEXT "1.3.19T / 11.06.2012"
//Stepper Movement Variables
char axis_codes[NUM_AXIS] = {'X', 'Y', 'Z', 'E'};
@@ -240,6 +249,7 @@ float move_acceleration = _ACCELERATION; // Normal acceleration mm/s^2
float retract_acceleration = _RETRACT_ACCELERATION; // Normal acceleration mm/s^2
float max_xy_jerk = _MAX_XY_JERK;
float max_z_jerk = _MAX_Z_JERK;
+float max_e_jerk = _MAX_E_JERK;
long max_acceleration_units_per_sq_second[4] = _MAX_ACCELERATION_UNITS_PER_SQ_SECOND; // X, Y, Z and E max acceleration in mm/s^2 for printing moves or retracts
@@ -789,10 +799,7 @@ void setup()
SET_OUTPUT(E_STEP_PIN);
#endif
- for(int8_t i=0; i < NUM_AXIS; i++)
- {
- axis_steps_per_sqr_second[i] = max_acceleration_units_per_sq_second[i] * axis_steps_per_unit[i];
- }
+
// 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]);
@@ -853,6 +860,12 @@ void setup()
Serial.print((int)sizeof(block_t)*BLOCK_BUFFER_SIZE);
showString(PSTR(" / "));
Serial.println(BLOCK_BUFFER_SIZE);
+
+ for(int8_t i=0; i < NUM_AXIS; i++)
+ {
+ axis_steps_per_sqr_second[i] = max_acceleration_units_per_sq_second[i] * axis_steps_per_unit[i];
+ }
+
}
@@ -1674,7 +1687,11 @@ FORCE_INLINE void process_commands()
case 92: // M92
for(int i=0; i < NUM_AXIS; i++)
{
- if(code_seen(axis_codes[i])) axis_steps_per_unit[i] = code_value();
+ if(code_seen(axis_codes[i]))
+ {
+ axis_steps_per_unit[i] = code_value();
+ axis_steps_per_sqr_second[i] = max_acceleration_units_per_sq_second[i] * axis_steps_per_unit[i];
+ }
}
// Update start speed intervals and axis order. TODO: refactor axis_max_interval[] calculation into a function, as it
@@ -1752,7 +1769,7 @@ FORCE_INLINE void process_commands()
axis_steps_per_sqr_second[i] = code_value() * axis_steps_per_unit[i];
}
}
-
+ break;
#if 0 // Not used for Sprinter/grbl gen6
case 202: // M202
for(int i=0; i < NUM_AXIS; i++)
@@ -1776,12 +1793,13 @@ FORCE_INLINE void process_commands()
if(code_seen('S')) move_acceleration = code_value() ;
if(code_seen('T')) retract_acceleration = code_value() ;
break;
- case 205: //M205 advanced settings: minimum travel speed S=while printing T=travel only, B=minimum segment time X= maximum xy jerk, Z=maximum Z jerk
+ case 205: //M205 advanced settings: minimum travel speed S=while printing T=travel only, B=minimum segment time X= maximum xy jerk, Z=maximum Z jerk, E= max E jerk
if(code_seen('S')) minimumfeedrate = code_value();
if(code_seen('T')) mintravelfeedrate = code_value();
//if(code_seen('B')) minsegmenttime = code_value() ;
if(code_seen('X')) max_xy_jerk = code_value() ;
if(code_seen('Z')) max_z_jerk = code_value() ;
+ if(code_seen('E')) max_e_jerk = code_value() ;
break;
case 206: // M206 additional homeing offset
for(int8_t cnt_i=0; cnt_i < 3; cnt_i++)
@@ -1831,11 +1849,19 @@ FORCE_INLINE void process_commands()
case 501: // Read settings from EEPROM
{
EEPROM_RetrieveSettings(false,true);
+ for(int8_t i=0; i < NUM_AXIS; i++)
+ {
+ axis_steps_per_sqr_second[i] = max_acceleration_units_per_sq_second[i] * axis_steps_per_unit[i];
+ }
}
break;
case 502: // Revert to default settings
{
EEPROM_RetrieveSettings(true,true);
+ for(int8_t i=0; i < NUM_AXIS; i++)
+ {
+ axis_steps_per_sqr_second[i] = max_acceleration_units_per_sq_second[i] * axis_steps_per_unit[i];
+ }
}
break;
case 503: // print settings currently in memory
@@ -2259,10 +2285,17 @@ void planner_reverse_pass_kernel(block_t *previous, block_t *current, block_t *n
// implements the reverse pass.
void planner_reverse_pass() {
uint8_t block_index = block_buffer_head;
- if(((block_buffer_head-block_buffer_tail + BLOCK_BUFFER_SIZE) & (BLOCK_BUFFER_SIZE - 1)) > 3) {
+
+ //Make a local copy of block_buffer_tail, because the interrupt can alter it
+ CRITICAL_SECTION_START;
+ unsigned char tail = block_buffer_tail;
+ CRITICAL_SECTION_END;
+
+ if(((block_buffer_head-tail + BLOCK_BUFFER_SIZE) & (BLOCK_BUFFER_SIZE - 1)) > 3)
+ {
block_index = (block_buffer_head - 3) & (BLOCK_BUFFER_SIZE - 1);
block_t *block[3] = { NULL, NULL, NULL };
- while(block_index != block_buffer_tail) {
+ while(block_index != tail) {
block_index = prev_block_index(block_index);
block[2]= block[1];
block[1]= block[0];
@@ -2670,25 +2703,33 @@ void plan_buffer_line(float x, float y, float z, float e, float feed_rate)
}
#endif
// Start with a safe speed
- float vmax_junction = max_xy_jerk/2;
+ float vmax_junction = max_xy_jerk/2;
+ float vmax_junction_factor = 1.0;
if(fabs(current_speed[Z_AXIS]) > max_z_jerk/2)
- vmax_junction = max_z_jerk/2;
+ vmax_junction = min(vmax_junction, max_z_jerk/2);
+ if(fabs(current_speed[E_AXIS]) > max_e_jerk/2)
+ vmax_junction = min(vmax_junction, max_e_jerk/2);
vmax_junction = min(vmax_junction, block->nominal_speed);
+ float safe_speed = vmax_junction;
- if ((moves_queued > 1) && (previous_nominal_speed > 0.0)) {
+ if ((moves_queued > 1) && (previous_nominal_speed > 0.0001)) {
float jerk = sqrt(pow((current_speed[X_AXIS]-previous_speed[X_AXIS]), 2)+pow((current_speed[Y_AXIS]-previous_speed[Y_AXIS]), 2));
- if((previous_speed[X_AXIS] != 0.0) || (previous_speed[Y_AXIS] != 0.0)) {
- vmax_junction = block->nominal_speed;
- }
+ // if((fabs(previous_speed[X_AXIS]) > 0.0001) || (fabs(previous_speed[Y_AXIS]) > 0.0001)) {
+ vmax_junction = block->nominal_speed;
+ // }
if (jerk > max_xy_jerk) {
- vmax_junction *= (max_xy_jerk/jerk);
+ vmax_junction_factor = (max_xy_jerk/jerk);
}
if(fabs(current_speed[Z_AXIS] - previous_speed[Z_AXIS]) > max_z_jerk) {
- vmax_junction *= (max_z_jerk/fabs(current_speed[Z_AXIS] - previous_speed[Z_AXIS]));
+ vmax_junction_factor= min(vmax_junction_factor, (max_z_jerk/fabs(current_speed[Z_AXIS] - previous_speed[Z_AXIS])));
+ }
+ if(fabs(current_speed[E_AXIS] - previous_speed[E_AXIS]) > max_e_jerk) {
+ vmax_junction_factor = min(vmax_junction_factor, (max_e_jerk/fabs(current_speed[E_AXIS] - previous_speed[E_AXIS])));
}
+ vmax_junction = min(previous_nominal_speed, vmax_junction * vmax_junction_factor); // Limit speed to max previous speed
}
block->max_entry_speed = vmax_junction;
-
+
// Initialize block entry speed. Compute based on deceleration to user-defined MINIMUM_PLANNER_SPEED.
double v_allowable = max_allowable_speed(-block->acceleration,MINIMUM_PLANNER_SPEED,block->millimeters);
block->entry_speed = min(vmax_junction, v_allowable);
@@ -2701,10 +2742,14 @@ void plan_buffer_line(float x, float y, float z, float e, float feed_rate)
// block nominal speed limits both the current and next maximum junction speeds. Hence, in both
// the reverse and forward planners, the corresponding block junction speed will always be at the
// the maximum junction speed and may always be ignored for any speed reduction checks.
- if (block->nominal_speed <= v_allowable) { block->nominal_length_flag = true; }
- else { block->nominal_length_flag = false; }
+ if (block->nominal_speed <= v_allowable) {
+ block->nominal_length_flag = true;
+ }
+ else {
+ block->nominal_length_flag = false;
+ }
block->recalculate_flag = true; // Always calculate trapezoid for new block
-
+
// Update previous path unit_vector and nominal speed
memcpy(previous_speed, current_speed, sizeof(previous_speed)); // previous_speed[] = current_speed[]
previous_nominal_speed = block->nominal_speed;
@@ -2731,10 +2776,8 @@ void plan_buffer_line(float x, float y, float z, float e, float feed_rate)
#endif // ADVANCE
-
-
calculate_trapezoid_for_block(block, block->entry_speed/block->nominal_speed,
- MINIMUM_PLANNER_SPEED/block->nominal_speed);
+ safe_speed/block->nominal_speed);
// Move buffer head
block_buffer_head = next_buffer_head;
@@ -2819,7 +2862,6 @@ void getHighESpeed()
-
// Stepper
// intRes = intIn1 * intIn2 >> 16
@@ -3267,8 +3309,10 @@ ISR(TIMER1_COMPA_vect)
WRITE(E_STEP_PIN, LOW);
}
#endif //!ADVANCE
+
step_events_completed += 1;
if(step_events_completed >= current_block->step_event_count) break;
+
}
// Calculare new timer value
unsigned short timer;
diff --git a/Sprinter/heater.cpp b/Sprinter/heater.cpp
index 69e9e86..7682516 100644
--- a/Sprinter/heater.cpp
+++ b/Sprinter/heater.cpp
@@ -661,12 +661,21 @@ void PID_autotune(int PIDAT_test_temp)
heater_duty = constrain(heater_duty, 0, HEATER_CURRENT);
#ifdef PID_SOFT_PWM
- g_heater_pwm_val = (unsigned char)heater_duty;
+ if(target_raw != 0)
+ g_heater_pwm_val = (unsigned char)heater_duty;
+ else
+ g_heater_pwm_val = 0;
#else
- analogWrite(HEATER_0_PIN, heater_duty);
+ if(target_raw != 0)
+ analogWrite(HEATER_0_PIN, heater_duty);
+ else
+ analogWrite(HEATER_0_PIN, 0);
#if LED_PIN>-1
- analogWrite(LED_PIN, constrain(LED_PWM_FOR_BRIGHTNESS(heater_duty),0,255));
+ if(target_raw != 0)
+ analogWrite(LED_PIN, constrain(LED_PWM_FOR_BRIGHTNESS(heater_duty),0,255));
+ else
+ analogWrite(LED_PIN, 0);
#endif
#endif
@@ -681,10 +690,13 @@ void PID_autotune(int PIDAT_test_temp)
}
else
{
- WRITE(HEATER_0_PIN,HIGH);
- #if LED_PIN > -1
- WRITE(LED_PIN,HIGH);
- #endif
+ if(target_raw != 0)
+ {
+ WRITE(HEATER_0_PIN,HIGH);
+ #if LED_PIN > -1
+ WRITE(LED_PIN,HIGH);
+ #endif
+ }
}
#endif
#endif
diff --git a/Sprinter/pins.h b/Sprinter/pins.h
index 946118f..42b1fa1 100644
--- a/Sprinter/pins.h
+++ b/Sprinter/pins.h
@@ -151,7 +151,7 @@
#if MOTHERBOARD == 2
#define KNOWN_BOARD 1
-#if !defined(__AVR_ATmega644P__) && !defined(__AVR_ATmega1284P__)
+#if !defined(__AVR_ATmega644P__) && !defined(__AVR_ATmega1284P__) && !defined(__ATmega644P__) && !defined(__ATmega1284P__)
#error Oops! Make sure you have 'Sanguino' selected from the 'Tools -> Boards' menu.
#endif
diff --git a/Sprinter/store_eeprom.cpp b/Sprinter/store_eeprom.cpp
index a474e22..8629a24 100644
--- a/Sprinter/store_eeprom.cpp
+++ b/Sprinter/store_eeprom.cpp
@@ -67,6 +67,7 @@ void EEPROM_StoreSettings()
EEPROM_writeAnything(i,ul_help); //Min Segment Time, not used yet
EEPROM_writeAnything(i,max_xy_jerk);
EEPROM_writeAnything(i,max_z_jerk);
+ EEPROM_writeAnything(i,max_e_jerk);
//PID Settings, not used yet --> placeholder
ui_help = 2560;
@@ -124,7 +125,7 @@ void EEPROM_printSettings()
showString(PSTR(" T"));
Serial.println(retract_acceleration);
- showString(PSTR("Advanced variables: S=Min feedrate (mm/s), T=Min travel feedrate (mm/s), X=maximum xY jerk (mm/s), Z=maximum Z jerk (mm/s)\r\n"));
+ showString(PSTR("Advanced variables (mm/s): S=Min feedrate, T=Min travel feedrate, X=max xY jerk, Z=max Z jerk, E=max E jerk\r\n"));
showString(PSTR(" M205 S"));
Serial.print(minimumfeedrate );
@@ -135,7 +136,10 @@ void EEPROM_printSettings()
showString(PSTR(" X"));
Serial.print(max_xy_jerk );
showString(PSTR(" Z"));
- Serial.println(max_z_jerk);
+ Serial.print(max_z_jerk);
+ showString(PSTR(" E"));
+ Serial.println(max_e_jerk);
+
#ifdef PIDTEMP
/*
@@ -174,6 +178,7 @@ void EEPROM_RetrieveSettings(bool def, bool printout)
EEPROM_readAnything(i,ul_help); //min Segmenttime --> not used yet
EEPROM_readAnything(i,max_xy_jerk);
EEPROM_readAnything(i,max_z_jerk);
+ EEPROM_readAnything(i,max_e_jerk);
unsigned int Kp,Ki,Kd;
EEPROM_readAnything(i,Kp);
@@ -200,10 +205,11 @@ void EEPROM_RetrieveSettings(bool def, bool printout)
mintravelfeedrate=DEFAULT_MINTRAVELFEEDRATE;
max_xy_jerk=_MAX_XY_JERK;
max_z_jerk=_MAX_Z_JERK;
+ max_e_jerk=_MAX_E_JERK;
showString(PSTR("Using Default settings\r\n"));
}
-
+
if(printout)
{
EEPROM_printSettings();
diff --git a/Sprinter/store_eeprom.h b/Sprinter/store_eeprom.h
index cff25d3..3b1ac6d 100644
--- a/Sprinter/store_eeprom.h
+++ b/Sprinter/store_eeprom.h
@@ -27,7 +27,7 @@
// the default values are used whenever there is a change to the data, to prevent
// wrong data being written to the variables.
// ALSO: always make sure the variables in the Store and retrieve sections are in the same order.
-#define EEPROM_VERSION "S01"
+#define EEPROM_VERSION "S02"
extern float axis_steps_per_unit[4];
@@ -39,6 +39,7 @@ extern float mintravelfeedrate;
extern float minimumfeedrate;
extern float max_xy_jerk;
extern float max_z_jerk;
+extern float max_e_jerk;
extern void EEPROM_RetrieveSettings(bool def, bool printout );
diff --git a/Sprinter/thermistortables.h b/Sprinter/thermistortables.h
index eccfe88..8496b6d 100644
--- a/Sprinter/thermistortables.h
+++ b/Sprinter/thermistortables.h
@@ -280,8 +280,8 @@ const short temptable_6[NUMTEMPS_6][2] = {
{49, 220},
{53, 215},
{62, 210},
- {73, 205},
- {72, 200},
+ {71, 205}, //fitted graphically
+ {78, 200}, //fitted graphically
{94, 190},
{102, 185},
{116, 170},