|
|
@ -44,6 +44,11 @@ |
|
|
|
#include "language.h" |
|
|
|
#include "pins_arduino.h" |
|
|
|
|
|
|
|
#ifdef BLINKM |
|
|
|
#include "BlinkM.h" |
|
|
|
#include "Wire.h" |
|
|
|
#endif |
|
|
|
|
|
|
|
#if NUM_SERVOS > 0 |
|
|
|
#include "Servo.h" |
|
|
|
#endif |
|
|
@ -118,6 +123,7 @@ |
|
|
|
// M128 - EtoP Open (BariCUDA EtoP = electricity to air pressure transducer by jmil)
|
|
|
|
// M129 - EtoP Closed (BariCUDA EtoP = electricity to air pressure transducer by jmil)
|
|
|
|
// M140 - Set bed target temp
|
|
|
|
// M150 - Set BlinkM Colour Output R: Red<0-255> U(!): Green<0-255> B: Blue<0-255> over i2c, G for green does not work.
|
|
|
|
// M190 - Sxxx Wait for bed current temp to reach target temp. Waits only when heating
|
|
|
|
// Rxxx Wait for bed current temp to reach target temp. Waits when heating and cooling
|
|
|
|
// M200 - Set filament diameter
|
|
|
@ -935,19 +941,28 @@ static void homeaxis(int axis) { |
|
|
|
axis_home_dir = x_home_dir(active_extruder); |
|
|
|
#endif |
|
|
|
|
|
|
|
current_position[axis] = 0; |
|
|
|
plan_set_position(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS]); |
|
|
|
|
|
|
|
// Engage Servo endstop if enabled
|
|
|
|
#ifdef SERVO_ENDSTOPS |
|
|
|
#if defined (ENABLE_AUTO_BED_LEVELING) && (PROBE_SERVO_DEACTIVATION_DELAY > 0) |
|
|
|
if (axis==Z_AXIS) engage_z_probe(); |
|
|
|
else |
|
|
|
#endif |
|
|
|
#if defined (ENABLE_AUTO_BED_LEVELING) && (PROBE_SERVO_DEACTIVATION_DELAY > 0) |
|
|
|
if (axis==Z_AXIS) { |
|
|
|
#if defined (Z_RAISE_BEFORE_HOMING) && (Z_RAISE_BEFORE_HOMING > 0) |
|
|
|
destination[axis] = Z_RAISE_BEFORE_HOMING * axis_home_dir * (-1); // Set destination away from bed
|
|
|
|
feedrate = max_feedrate[axis]; |
|
|
|
plan_buffer_line(destination[X_AXIS], destination[Y_AXIS], destination[Z_AXIS], destination[E_AXIS], feedrate, active_extruder); |
|
|
|
st_synchronize(); |
|
|
|
#endif |
|
|
|
engage_z_probe(); |
|
|
|
} |
|
|
|
else |
|
|
|
#endif |
|
|
|
if (servo_endstops[axis] > -1) { |
|
|
|
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; |
|
|
|
feedrate = homing_feedrate[axis]; |
|
|
|
plan_buffer_line(destination[X_AXIS], destination[Y_AXIS], destination[Z_AXIS], destination[E_AXIS], feedrate/60, active_extruder); |
|
|
@ -1213,6 +1228,9 @@ void process_commands() |
|
|
|
current_position[Z_AXIS]=code_value()+add_homeing[2]; |
|
|
|
} |
|
|
|
} |
|
|
|
#ifdef ENABLE_AUTO_BED_LEVELING |
|
|
|
current_position[Z_AXIS] -= Z_PROBE_OFFSET_FROM_EXTRUDER; //Add Z_Probe offset (the distance is negative)
|
|
|
|
#endif |
|
|
|
plan_set_position(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS]); |
|
|
|
#endif // else DELTA
|
|
|
|
|
|
|
@ -1607,6 +1625,23 @@ void process_commands() |
|
|
|
SERIAL_PROTOCOLPGM(" B@:"); |
|
|
|
SERIAL_PROTOCOL(getHeaterPower(-1)); |
|
|
|
|
|
|
|
#ifdef SHOW_TEMP_ADC_VALUES |
|
|
|
#if defined(TEMP_BED_PIN) && TEMP_BED_PIN > -1 |
|
|
|
SERIAL_PROTOCOLPGM(" ADC B:"); |
|
|
|
SERIAL_PROTOCOL_F(degBed(),1); |
|
|
|
SERIAL_PROTOCOLPGM("C->"); |
|
|
|
SERIAL_PROTOCOL_F(rawBedTemp()/OVERSAMPLENR,0); |
|
|
|
#endif |
|
|
|
for (int8_t cur_extruder = 0; cur_extruder < EXTRUDERS; ++cur_extruder) { |
|
|
|
SERIAL_PROTOCOLPGM(" T"); |
|
|
|
SERIAL_PROTOCOL(cur_extruder); |
|
|
|
SERIAL_PROTOCOLPGM(":"); |
|
|
|
SERIAL_PROTOCOL_F(degHotend(cur_extruder),1); |
|
|
|
SERIAL_PROTOCOLPGM("C->"); |
|
|
|
SERIAL_PROTOCOL_F(rawHotendTemp(cur_extruder)/OVERSAMPLENR,0); |
|
|
|
} |
|
|
|
#endif |
|
|
|
|
|
|
|
SERIAL_PROTOCOLLN(""); |
|
|
|
return; |
|
|
|
break; |
|
|
@ -1943,6 +1978,21 @@ void process_commands() |
|
|
|
#endif |
|
|
|
break; |
|
|
|
//TODO: update for all axis, use for loop
|
|
|
|
#ifdef BLINKM |
|
|
|
case 150: // M150
|
|
|
|
{ |
|
|
|
byte red; |
|
|
|
byte grn; |
|
|
|
byte blu; |
|
|
|
|
|
|
|
if(code_seen('R')) red = code_value(); |
|
|
|
if(code_seen('U')) grn = code_value(); |
|
|
|
if(code_seen('B')) blu = code_value(); |
|
|
|
|
|
|
|
SendColors(red,grn,blu); |
|
|
|
} |
|
|
|
break; |
|
|
|
#endif //BLINKM
|
|
|
|
case 201: // M201
|
|
|
|
for(int8_t i=0; i < NUM_AXIS; i++) |
|
|
|
{ |
|
|
@ -2925,6 +2975,39 @@ void controllerFan() |
|
|
|
} |
|
|
|
#endif |
|
|
|
|
|
|
|
#ifdef TEMP_STAT_LEDS |
|
|
|
static bool blue_led = false; |
|
|
|
static bool red_led = false; |
|
|
|
static uint32_t stat_update = 0; |
|
|
|
|
|
|
|
void handle_status_leds(void) { |
|
|
|
float max_temp = 0.0; |
|
|
|
if(millis() > stat_update) { |
|
|
|
stat_update += 500; // Update every 0.5s
|
|
|
|
for (int8_t cur_extruder = 0; cur_extruder < EXTRUDERS; ++cur_extruder) { |
|
|
|
max_temp = max(max_temp, degHotend(cur_extruder)); |
|
|
|
max_temp = max(max_temp, degTargetHotend(cur_extruder)); |
|
|
|
} |
|
|
|
#if defined(TEMP_BED_PIN) && TEMP_BED_PIN > -1 |
|
|
|
max_temp = max(max_temp, degTargetBed()); |
|
|
|
max_temp = max(max_temp, degBed()); |
|
|
|
#endif |
|
|
|
if((max_temp > 55.0) && (red_led == false)) { |
|
|
|
digitalWrite(STAT_LED_RED, 1); |
|
|
|
digitalWrite(STAT_LED_BLUE, 0); |
|
|
|
red_led = true; |
|
|
|
blue_led = false; |
|
|
|
} |
|
|
|
if((max_temp < 54.0) && (blue_led == false)) { |
|
|
|
digitalWrite(STAT_LED_RED, 0); |
|
|
|
digitalWrite(STAT_LED_BLUE, 1); |
|
|
|
red_led = false; |
|
|
|
blue_led = true; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
#endif |
|
|
|
|
|
|
|
void manage_inactivity() |
|
|
|
{ |
|
|
|
if( (millis() - previous_millis_cmd) > max_inactive_time ) |
|
|
@ -2979,6 +3062,9 @@ void manage_inactivity() |
|
|
|
prepare_move(); |
|
|
|
} |
|
|
|
#endif |
|
|
|
#ifdef TEMP_STAT_LEDS |
|
|
|
handle_status_leds(); |
|
|
|
#endif |
|
|
|
check_axes_activity(); |
|
|
|
} |
|
|
|
|
|
|
|