summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormidopple <mdoppler@gmx.at>2012-04-22 18:33:19 +0200
committermidopple <mdoppler@gmx.at>2012-04-22 18:33:19 +0200
commit3a29ee97d134d5dbb101f6eac0e26746d0e59de1 (patch)
tree4de19c24f01c54c72e6e36995f2ee1b8646c9166
parent378426c766cc0a09d51b69dd1da1f2551a569833 (diff)
Version 1.3.15T
- M206 - set additional homeing offset (Thank to se5a for this idea) (First Version is without saving to EEPROM) - Option for minimum FAN start speed --> #define MINIMUM_FAN_START_SPEED 50 (set it to zero to deaktivate)
-rw-r--r--Sprinter/Configuration.h11
-rw-r--r--Sprinter/Sprinter.h4
-rw-r--r--Sprinter/Sprinter.pde87
3 files changed, 96 insertions, 6 deletions
diff --git a/Sprinter/Configuration.h b/Sprinter/Configuration.h
index cc10a09..e403de5 100644
--- a/Sprinter/Configuration.h
+++ b/Sprinter/Configuration.h
@@ -240,6 +240,17 @@ const int dropsegments=5; //everything with less than this number of steps will
//every Digital output for it, main usage for Sanguinololu
#define FAN_SOFT_PWM
+//-----------------------------------------------------------------------
+//// MINIMUM START SPEED FOR FAN
+//-----------------------------------------------------------------------
+
+//Minimum start speed for FAN when the last speed was zero
+//Set to 0 to deaktivate
+//If value is set the fan will drive with this minimum speed for MINIMUM_FAN_START_TIME
+#define MINIMUM_FAN_START_SPEED 0
+
+//This is the time how long the minimum FAN speed is set
+#define MINIMUM_FAN_START_TIME 6000 //6sec
//-----------------------------------------------------------------------
//// HEATERCONTROL AND PID PARAMETERS
diff --git a/Sprinter/Sprinter.h b/Sprinter/Sprinter.h
index 66e6c59..50f3806 100644
--- a/Sprinter/Sprinter.h
+++ b/Sprinter/Sprinter.h
@@ -123,6 +123,10 @@ void check_buffer_while_arc();
void print_disk_info(void);
#endif //SDSUPPORT
+#if (MINIMUM_FAN_START_SPEED > 0)
+void manage_fan_start_speed(void);
+#endif
+
#ifdef DEBUG
void log_message(char* message);
void log_bool(char* message, bool value);
diff --git a/Sprinter/Sprinter.pde b/Sprinter/Sprinter.pde
index 17bd098..13d0745 100644
--- a/Sprinter/Sprinter.pde
+++ b/Sprinter/Sprinter.pde
@@ -109,7 +109,9 @@
Version 1.3.14T
- When endstop is hit count the virtual steps, so the print lose no position when endstop is hit
-
+ Version 1.3.15T
+- M206 - set additional homeing offset
+- Option for minimum FAN start speed --> #define MINIMUM_FAN_START_SPEED 50 (set it to zero to deaktivate)
*/
@@ -197,6 +199,7 @@ void __cxa_pure_virtual(){};
// M203 - Set temperture monitor to Sx
// 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
+// M206 - set additional homeing offset
// M220 - set speed factor override percentage S:factor in percent
// M221 - set extruder multiply factor S100 --> original Extrude Speed
@@ -212,7 +215,7 @@ void __cxa_pure_virtual(){};
// M603 - Show Free Ram
-#define _VERSION_TEXT "1.3.14T / 20.04.2012"
+#define _VERSION_TEXT "1.3.15T / 22.04.2012"
//Stepper Movement Variables
char axis_codes[NUM_AXIS] = {'X', 'Y', 'Z', 'E'};
@@ -254,6 +257,7 @@ volatile int extrudemultiply=100; //100->1 200->2
//unsigned long interval;
float destination[NUM_AXIS] = {0.0, 0.0, 0.0, 0.0};
float current_position[NUM_AXIS] = {0.0, 0.0, 0.0, 0.0};
+float add_homeing[3]={0,0,0};
static unsigned short virtual_steps_x = 0;
static unsigned short virtual_steps_y = 0;
@@ -295,6 +299,12 @@ float offset[3] = {0.0, 0.0, 0.0};
float osc_wait_remainder = 0.0;
#endif
+#if (MINIMUM_FAN_START_SPEED > 0)
+ unsigned char fan_last_speed = 0;
+ unsigned char fan_org_start_speed = 0;
+ unsigned long previous_millis_fan_start = 0;
+#endif
+
// comm variables and Commandbuffer
// BUFSIZE is reduced from 8 to 6 to free more RAM for the PLANNER
#define MAX_CMD_SIZE 96
@@ -874,6 +884,10 @@ void loop()
//check heater every n milliseconds
manage_heater();
manage_inactivity(1);
+ #if (MINIMUM_FAN_START_SPEED > 0)
+ manage_fan_start_speed();
+ #endif
+
}
//------------------------------------------------
@@ -1150,6 +1164,7 @@ FORCE_INLINE void process_commands()
st_synchronize();
current_position[X_AXIS] = (X_HOME_DIR == -1) ? 0 : X_MAX_LENGTH;
+ current_position[X_AXIS] += add_homeing[0];
plan_set_position(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS]);
destination[X_AXIS] = current_position[X_AXIS];
feedrate = 0;
@@ -1182,6 +1197,7 @@ FORCE_INLINE void process_commands()
st_synchronize();
current_position[Y_AXIS] = (Y_HOME_DIR == -1) ? 0 : Y_MAX_LENGTH;
+ current_position[Y_AXIS] += add_homeing[1];
plan_set_position(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS]);
destination[Y_AXIS] = current_position[Y_AXIS];
feedrate = 0;
@@ -1214,6 +1230,7 @@ FORCE_INLINE void process_commands()
st_synchronize();
current_position[Z_AXIS] = (Z_HOME_DIR == -1) ? 0 : Z_MAX_LENGTH;
+ current_position[Z_AXIS] += add_homeing[2];
plan_set_position(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS]);
destination[Z_AXIS] = current_position[Z_AXIS];
feedrate = 0;
@@ -1516,6 +1533,9 @@ FORCE_INLINE void process_commands()
codenum = millis();
}
manage_heater();
+ #if (MINIMUM_FAN_START_SPEED > 0)
+ manage_fan_start_speed();
+ #endif
#ifdef TEMP_RESIDENCY_TIME
/* start/restart the TEMP_RESIDENCY_TIME timer whenever we reach target temp for the first time
or when current temp falls outside the hysteresis after target temp was reached */
@@ -1544,6 +1564,9 @@ FORCE_INLINE void process_commands()
codenum = millis();
}
manage_heater();
+ #if (MINIMUM_FAN_START_SPEED > 0)
+ manage_fan_start_speed();
+ #endif
}
#endif
break;
@@ -1551,12 +1574,33 @@ FORCE_INLINE void process_commands()
case 106: //M106 Fan On
if (code_seen('S'))
{
+ unsigned char l_fan_code_val = constrain(code_value(),0,255);
+
+ #if (MINIMUM_FAN_START_SPEED > 0)
+ if(l_fan_code_val > 0 && fan_last_speed == 0)
+ {
+ if(l_fan_code_val < MINIMUM_FAN_START_SPEED)
+ {
+ fan_org_start_speed = l_fan_code_val;
+ l_fan_code_val = MINIMUM_FAN_START_SPEED;
+ previous_millis_fan_start = millis();
+ }
+ fan_last_speed = l_fan_code_val;
+ }
+ else
+ {
+ fan_last_speed = l_fan_code_val;
+ fan_org_start_speed = 0;
+ }
+ #endif
+
#if defined(FAN_SOFT_PWM) && (FAN_PIN > -1)
- g_fan_pwm_val = constrain(code_value(),0,255);
+ g_fan_pwm_val = l_fan_code_val;
#else
WRITE(FAN_PIN, HIGH);
- analogWrite_check(FAN_PIN, constrain(code_value(),0,255) );
+ analogWrite_check(FAN_PIN, l_fan_code_val;
#endif
+
}
else
{
@@ -1720,6 +1764,12 @@ FORCE_INLINE void process_commands()
//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() ;
+ break;
+ case 206: // M206 additional homeing offset
+ for(int8_t cnt_i=0; cnt_i < 3; cnt_i++)
+ {
+ if(code_seen(axis_codes[cnt_i])) add_homeing[cnt_i] = code_value();
+ }
break;
case 220: // M220 S<factor in percent>- set speed factor override percentage
{
@@ -1968,8 +2018,27 @@ FORCE_INLINE void manage_inactivity(byte debug)
check_axes_activity();
}
-
-
+#if (MINIMUM_FAN_START_SPEED > 0)
+void manage_fan_start_speed(void)
+{
+ if(fan_org_start_speed > 0)
+ {
+ if((millis() - previous_millis_fan_start) > MINIMUM_FAN_START_TIME )
+ {
+ #if FAN_PIN > -1
+ #if defined(FAN_SOFT_PWM)
+ g_fan_pwm_val = fan_org_start_speed;
+ #else
+ WRITE(FAN_PIN, HIGH);
+ analogWrite_check(FAN_PIN, fan_org_start_speed;
+ #endif
+ #endif
+
+ fan_org_start_speed = 0;
+ }
+ }
+}
+#endif
// Planner with Interrupt for Stepper
@@ -2341,6 +2410,9 @@ void plan_buffer_line(float x, float y, float z, float e, float feed_rate)
while(block_buffer_tail == next_buffer_head) {
manage_heater();
manage_inactivity(1);
+ #if (MINIMUM_FAN_START_SPEED > 0)
+ manage_fan_start_speed();
+ #endif
}
// The target position of the tool in absolute steps
@@ -3298,6 +3370,9 @@ void st_synchronize()
while(blocks_queued()) {
manage_heater();
manage_inactivity(1);
+ #if (MINIMUM_FAN_START_SPEED > 0)
+ manage_fan_start_speed();
+ #endif
}
}