Merge branch 'Marlin_v1' of https://github.com/ErikZalm/Marlin.git into Marlin_v1

Conflicts:
	Marlin/Marlin_main.cpp
This commit is contained in:
Nicolas Rossi
2013-08-03 13:05:56 +02:00
56 changed files with 204 additions and 194 deletions

View File

@ -431,10 +431,10 @@ void setup()
lcd_init();
_delay_ms(1000); // wait 1sec to display the splash screen
#if defined(CONTROLLERFAN_PIN) && CONTROLLERFAN_PIN > -1
SET_OUTPUT(CONTROLLERFAN_PIN); //Set pin used for driver cooling fan
#endif
#endif
}
@ -691,15 +691,15 @@ XYZ_CONSTS_FROM_CONFIG(signed char, home_dir, HOME_DIR);
#endif
#if X_HOME_DIR != -1 || X2_HOME_DIR != 1
#error "Please use canonical x-carriage assignment" // the x-carriages are defined by their homing directions
#endif
#endif
static float x_home_pos(int extruder) {
if (extruder == 0)
return base_home_pos(X_AXIS) + add_homeing[X_AXIS];
else
// In dual carriage mode the extruder offset provides an override of the
// second X-carriage offset when homed - otherwise X2_HOME_POS is used.
// This allow soft recalibration of the second extruder offset position without firmware reflash
// This allow soft recalibration of the second extruder offset position without firmware reflash
// (through the M218 command).
return (extruder_offset[X_AXIS][1] > 0) ? extruder_offset[X_AXIS][1] : X2_HOME_POS;
}
@ -709,7 +709,7 @@ static int x_home_dir(int extruder) {
}
static float inactive_x_carriage_pos = X2_MAX_POS;
#endif
#endif
static void axis_is_at_home(int axis) {
#ifdef DUAL_X_CARRIAGE
@ -719,7 +719,7 @@ static void axis_is_at_home(int axis) {
max_pos[X_AXIS] = max(extruder_offset[X_AXIS][1], X2_MAX_POS);
return;
}
#endif
#endif
current_position[axis] = base_home_pos(axis) + add_homeing[axis];
min_pos[axis] = base_min_pos(axis) + add_homeing[axis];
max_pos[axis] = base_max_pos(axis) + add_homeing[axis];
@ -745,7 +745,7 @@ static void homeaxis(int axis) {
servos[servo_endstops[axis]].write(servo_endstop_angles[axis * 2]);
}
#endif
current_position[axis] = 0;
plan_set_position(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS]);
destination[axis] = 1.5 * max_length(axis) * axis_home_dir;
@ -879,7 +879,7 @@ void process_commands()
current_position[X_AXIS] = 0;
current_position[Y_AXIS] = 0;
current_position[Z_AXIS] = 0;
plan_set_position(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS]);
plan_set_position(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS]);
destination[X_AXIS] = 3 * Z_MAX_LENGTH;
destination[Y_AXIS] = 3 * Z_MAX_LENGTH;
@ -892,7 +892,7 @@ void process_commands()
current_position[X_AXIS] = destination[X_AXIS];
current_position[Y_AXIS] = destination[Y_AXIS];
current_position[Z_AXIS] = destination[Z_AXIS];
// take care of back off and rehome now we are all at the top
HOMEAXIS(X);
HOMEAXIS(Y);
@ -921,7 +921,7 @@ void process_commands()
#else
int x_axis_home_dir = x_home_dir(active_extruder);
#endif
plan_set_position(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS]);
destination[X_AXIS] = 1.5 * max_length(X_AXIS) * x_axis_home_dir;destination[Y_AXIS] = 1.5 * max_length(Y_AXIS) * home_dir(Y_AXIS);
feedrate = homing_feedrate[X_AXIS];
@ -954,7 +954,7 @@ void process_commands()
HOMEAXIS(X);
inactive_x_carriage_pos = current_position[X_AXIS];
active_extruder = tmp_extruder;
#endif
#endif
HOMEAXIS(X);
}
@ -988,7 +988,7 @@ void process_commands()
}
plan_set_position(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS]);
#endif // else DELTA
#ifdef ENDSTOPS_ONLY_FOR_HOMING
enable_endstops(false);
#endif
@ -1223,9 +1223,9 @@ void process_commands()
SERIAL_PROTOCOLPGM(" T");
SERIAL_PROTOCOL(cur_extruder);
SERIAL_PROTOCOLPGM(":");
SERIAL_PROTOCOL_F(degHotend(cur_extruder),1);
SERIAL_PROTOCOL_F(degHotend(cur_extruder),1);
SERIAL_PROTOCOLPGM(" /");
SERIAL_PROTOCOL_F(degTargetHotend(cur_extruder),1);
SERIAL_PROTOCOL_F(degTargetHotend(cur_extruder),1);
}
#else
SERIAL_ERROR_START;
@ -1250,7 +1250,7 @@ void process_commands()
#ifdef AUTOTEMP
autotemp_enabled=false;
#endif
if (code_seen('S')) {
if (code_seen('S')) {
setTargetHotend(code_value(), tmp_extruder);
CooldownNoWait = true;
} else if (code_seen('R')) {
@ -1327,7 +1327,7 @@ void process_commands()
case 190: // M190 - Wait for bed heater to reach target.
#if defined(TEMP_BED_PIN) && TEMP_BED_PIN > -1
LCD_MESSAGEPGM(MSG_BED_HEATING);
if (code_seen('S')) {
if (code_seen('S')) {
setTargetBed(code_value());
CooldownNoWait = true;
} else if (code_seen('R')) {
@ -1335,9 +1335,9 @@ void process_commands()
CooldownNoWait = false;
}
codenum = millis();
target_direction = isHeatingBed(); // true if heating, false if cooling
while ( target_direction ? (isHeatingBed()) : (isCoolingBed()&&(CooldownNoWait==false)) )
{
if(( millis() - codenum) > 1000 ) //Print Temp Reading every 1 second while heating up.
@ -1417,7 +1417,7 @@ void process_commands()
#endif
break;
#endif
case 81: // M81 - Turn off Power Supply
disable_heater();
st_synchronize();
@ -1542,27 +1542,27 @@ void process_commands()
SERIAL_PROTOCOLLN(MSG_M119_REPORT);
#if defined(X_MIN_PIN) && X_MIN_PIN > -1
SERIAL_PROTOCOLPGM(MSG_X_MIN);
SERIAL_PROTOCOLLN(((READ(X_MIN_PIN)^X_ENDSTOPS_INVERTING)?MSG_ENDSTOP_HIT:MSG_ENDSTOP_OPEN));
SERIAL_PROTOCOLLN(((READ(X_MIN_PIN)^X_MIN_ENDSTOP_INVERTING)?MSG_ENDSTOP_HIT:MSG_ENDSTOP_OPEN));
#endif
#if defined(X_MAX_PIN) && X_MAX_PIN > -1
SERIAL_PROTOCOLPGM(MSG_X_MAX);
SERIAL_PROTOCOLLN(((READ(X_MAX_PIN)^X_ENDSTOPS_INVERTING)?MSG_ENDSTOP_HIT:MSG_ENDSTOP_OPEN));
SERIAL_PROTOCOLLN(((READ(X_MAX_PIN)^X_MAX_ENDSTOP_INVERTING)?MSG_ENDSTOP_HIT:MSG_ENDSTOP_OPEN));
#endif
#if defined(Y_MIN_PIN) && Y_MIN_PIN > -1
SERIAL_PROTOCOLPGM(MSG_Y_MIN);
SERIAL_PROTOCOLLN(((READ(Y_MIN_PIN)^Y_ENDSTOPS_INVERTING)?MSG_ENDSTOP_HIT:MSG_ENDSTOP_OPEN));
SERIAL_PROTOCOLLN(((READ(Y_MIN_PIN)^Y_MIN_ENDSTOP_INVERTING)?MSG_ENDSTOP_HIT:MSG_ENDSTOP_OPEN));
#endif
#if defined(Y_MAX_PIN) && Y_MAX_PIN > -1
SERIAL_PROTOCOLPGM(MSG_Y_MAX);
SERIAL_PROTOCOLLN(((READ(Y_MAX_PIN)^Y_ENDSTOPS_INVERTING)?MSG_ENDSTOP_HIT:MSG_ENDSTOP_OPEN));
SERIAL_PROTOCOLLN(((READ(Y_MAX_PIN)^Y_MAX_ENDSTOP_INVERTING)?MSG_ENDSTOP_HIT:MSG_ENDSTOP_OPEN));
#endif
#if defined(Z_MIN_PIN) && Z_MIN_PIN > -1
SERIAL_PROTOCOLPGM(MSG_Z_MIN);
SERIAL_PROTOCOLLN(((READ(Z_MIN_PIN)^Z_ENDSTOPS_INVERTING)?MSG_ENDSTOP_HIT:MSG_ENDSTOP_OPEN));
SERIAL_PROTOCOLLN(((READ(Z_MIN_PIN)^Z_MIN_ENDSTOP_INVERTING)?MSG_ENDSTOP_HIT:MSG_ENDSTOP_OPEN));
#endif
#if defined(Z_MAX_PIN) && Z_MAX_PIN > -1
SERIAL_PROTOCOLPGM(MSG_Z_MAX);
SERIAL_PROTOCOLLN(((READ(Z_MAX_PIN)^Z_ENDSTOPS_INVERTING)?MSG_ENDSTOP_HIT:MSG_ENDSTOP_OPEN));
SERIAL_PROTOCOLLN(((READ(Z_MAX_PIN)^Z_MAX_ENDSTOP_INVERTING)?MSG_ENDSTOP_HIT:MSG_ENDSTOP_OPEN));
#endif
break;
//TODO: update for all axis, use for loop
@ -1699,7 +1699,7 @@ void process_commands()
}
}
break;
#if NUM_SERVOS > 0
case 280: // M280 - set servo position absolute. P: servo index, S: angle or microseconds
{
@ -1987,7 +1987,7 @@ void process_commands()
delay(3);
WRITE(BEEPER,LOW);
delay(3);
#else
#else
lcd_buzz(1000/6,100);
#endif
}
@ -2103,8 +2103,8 @@ void process_commands()
active_extruder = tmp_extruder;
axis_is_at_home(X_AXIS); //this function updates X min/max values.
current_position[X_AXIS] = inactive_x_carriage_pos;
inactive_x_carriage_pos = tmp_x_pos;
#else
inactive_x_carriage_pos = tmp_x_pos;
#else
// Offset extruder (only by XY)
int i;
for(i = 0; i < 2; i++) {
@ -2340,10 +2340,10 @@ void prepare_arc_move(char isclockwise) {
#if defined(CONTROLLERFAN_PIN) && CONTROLLERFAN_PIN > -1
#if defined(FAN_PIN)
#if CONTROLLERFAN_PIN == FAN_PIN
#if CONTROLLERFAN_PIN == FAN_PIN
#error "You cannot set CONTROLLERFAN_PIN equal to FAN_PIN"
#endif
#endif
#endif
unsigned long lastMotor = 0; //Save the time for when a motor was turned on last
unsigned long lastMotorCheck = 0;
@ -2368,17 +2368,17 @@ void controllerFan()
{
lastMotor = millis(); //... set time to NOW so the fan will turn on
}
if ((millis() - lastMotor) >= (CONTROLLERFAN_SECS*1000UL) || lastMotor == 0) //If the last time any driver was enabled, is longer since than CONTROLLERSEC...
if ((millis() - lastMotor) >= (CONTROLLERFAN_SECS*1000UL) || lastMotor == 0) //If the last time any driver was enabled, is longer since than CONTROLLERSEC...
{
digitalWrite(CONTROLLERFAN_PIN, 0);
analogWrite(CONTROLLERFAN_PIN, 0);
digitalWrite(CONTROLLERFAN_PIN, 0);
analogWrite(CONTROLLERFAN_PIN, 0);
}
else
{
// allows digital or PWM fan output to be used (see M42 handling)
digitalWrite(CONTROLLERFAN_PIN, CONTROLLERFAN_SPEED);
analogWrite(CONTROLLERFAN_PIN, CONTROLLERFAN_SPEED);
analogWrite(CONTROLLERFAN_PIN, CONTROLLERFAN_SPEED);
}
}
}
@ -2445,7 +2445,7 @@ void kill()
#if defined(PS_ON_PIN) && PS_ON_PIN > -1
pinMode(PS_ON_PIN,INPUT);
#endif
#endif
SERIAL_ERROR_START;
SERIAL_ERRORLNPGM(MSG_ERR_KILLED);
LCD_ALERTMESSAGEPGM(MSG_KILLED);