|
|
@ -547,9 +547,7 @@ void servo_init()
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void setup() {
|
|
|
|
void setup()
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
setup_killpin();
|
|
|
|
setup_killpin();
|
|
|
|
setup_filrunoutpin();
|
|
|
|
setup_filrunoutpin();
|
|
|
|
setup_powerhold();
|
|
|
|
setup_powerhold();
|
|
|
@ -567,7 +565,8 @@ void setup()
|
|
|
|
MCUSR = 0;
|
|
|
|
MCUSR = 0;
|
|
|
|
|
|
|
|
|
|
|
|
SERIAL_ECHOPGM(MSG_MARLIN);
|
|
|
|
SERIAL_ECHOPGM(MSG_MARLIN);
|
|
|
|
SERIAL_ECHOLNPGM(STRING_VERSION);
|
|
|
|
SERIAL_ECHOLNPGM(" " STRING_VERSION);
|
|
|
|
|
|
|
|
|
|
|
|
#ifdef STRING_VERSION_CONFIG_H
|
|
|
|
#ifdef STRING_VERSION_CONFIG_H
|
|
|
|
#ifdef STRING_CONFIG_H_AUTHOR
|
|
|
|
#ifdef STRING_CONFIG_H_AUTHOR
|
|
|
|
SERIAL_ECHO_START;
|
|
|
|
SERIAL_ECHO_START;
|
|
|
@ -579,16 +578,15 @@ void setup()
|
|
|
|
SERIAL_ECHOLNPGM(__DATE__);
|
|
|
|
SERIAL_ECHOLNPGM(__DATE__);
|
|
|
|
#endif // STRING_CONFIG_H_AUTHOR
|
|
|
|
#endif // STRING_CONFIG_H_AUTHOR
|
|
|
|
#endif // STRING_VERSION_CONFIG_H
|
|
|
|
#endif // STRING_VERSION_CONFIG_H
|
|
|
|
|
|
|
|
|
|
|
|
SERIAL_ECHO_START;
|
|
|
|
SERIAL_ECHO_START;
|
|
|
|
SERIAL_ECHOPGM(MSG_FREE_MEMORY);
|
|
|
|
SERIAL_ECHOPGM(MSG_FREE_MEMORY);
|
|
|
|
SERIAL_ECHO(freeMemory());
|
|
|
|
SERIAL_ECHO(freeMemory());
|
|
|
|
SERIAL_ECHOPGM(MSG_PLANNER_BUFFER_BYTES);
|
|
|
|
SERIAL_ECHOPGM(MSG_PLANNER_BUFFER_BYTES);
|
|
|
|
SERIAL_ECHOLN((int)sizeof(block_t)*BLOCK_BUFFER_SIZE);
|
|
|
|
SERIAL_ECHOLN((int)sizeof(block_t)*BLOCK_BUFFER_SIZE);
|
|
|
|
|
|
|
|
|
|
|
|
#ifdef SDSUPPORT
|
|
|
|
#ifdef SDSUPPORT
|
|
|
|
for(int8_t i = 0; i < BUFSIZE; i++)
|
|
|
|
for (int8_t i = 0; i < BUFSIZE; i++) fromsd[i] = false;
|
|
|
|
{
|
|
|
|
|
|
|
|
fromsd[i] = false;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif // !SDSUPPORT
|
|
|
|
#endif // !SDSUPPORT
|
|
|
|
|
|
|
|
|
|
|
|
// loads data from EEPROM if available else uses defaults (and resets step acceleration rate)
|
|
|
|
// loads data from EEPROM if available else uses defaults (and resets step acceleration rate)
|
|
|
@ -601,7 +599,6 @@ void setup()
|
|
|
|
setup_photpin();
|
|
|
|
setup_photpin();
|
|
|
|
servo_init();
|
|
|
|
servo_init();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
lcd_init();
|
|
|
|
lcd_init();
|
|
|
|
_delay_ms(1000); // wait 1sec to display the splash screen
|
|
|
|
_delay_ms(1000); // wait 1sec to display the splash screen
|
|
|
|
|
|
|
|
|
|
|
@ -612,16 +609,19 @@ void setup()
|
|
|
|
#ifdef DIGIPOT_I2C
|
|
|
|
#ifdef DIGIPOT_I2C
|
|
|
|
digipot_i2c_init();
|
|
|
|
digipot_i2c_init();
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
#ifdef Z_PROBE_SLED
|
|
|
|
#ifdef Z_PROBE_SLED
|
|
|
|
pinMode(SERVO0_PIN, OUTPUT);
|
|
|
|
pinMode(SERVO0_PIN, OUTPUT);
|
|
|
|
digitalWrite(SERVO0_PIN, LOW); // turn it off
|
|
|
|
digitalWrite(SERVO0_PIN, LOW); // turn it off
|
|
|
|
#endif // Z_PROBE_SLED
|
|
|
|
#endif // Z_PROBE_SLED
|
|
|
|
|
|
|
|
|
|
|
|
setup_homepin();
|
|
|
|
setup_homepin();
|
|
|
|
|
|
|
|
|
|
|
|
#ifdef STAT_LED_RED
|
|
|
|
#ifdef STAT_LED_RED
|
|
|
|
pinMode(STAT_LED_RED, OUTPUT);
|
|
|
|
pinMode(STAT_LED_RED, OUTPUT);
|
|
|
|
digitalWrite(STAT_LED_RED, LOW); // turn it off
|
|
|
|
digitalWrite(STAT_LED_RED, LOW); // turn it off
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
#ifdef STAT_LED_BLUE
|
|
|
|
#ifdef STAT_LED_BLUE
|
|
|
|
pinMode(STAT_LED_BLUE, OUTPUT);
|
|
|
|
pinMode(STAT_LED_BLUE, OUTPUT);
|
|
|
|
digitalWrite(STAT_LED_BLUE, LOW); // turn it off
|
|
|
|
digitalWrite(STAT_LED_BLUE, LOW); // turn it off
|
|
|
@ -5447,26 +5447,37 @@ void mesh_plan_buffer_line(float x, float y, float z, const float e, float feed_
|
|
|
|
}
|
|
|
|
}
|
|
|
|
#endif // MESH_BED_LEVELING
|
|
|
|
#endif // MESH_BED_LEVELING
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#ifdef PREVENT_DANGEROUS_EXTRUDE
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
inline float prevent_dangerous_extrude(float &curr_e, float &dest_e) {
|
|
|
|
|
|
|
|
float de = dest_e - curr_e;
|
|
|
|
|
|
|
|
if (de) {
|
|
|
|
|
|
|
|
if (degHotend(active_extruder) < extrude_min_temp) {
|
|
|
|
|
|
|
|
curr_e = dest_e; // Behave as if the move really took place, but ignore E part
|
|
|
|
|
|
|
|
SERIAL_ECHO_START;
|
|
|
|
|
|
|
|
SERIAL_ECHOLNPGM(MSG_ERR_COLD_EXTRUDE_STOP);
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
#ifdef PREVENT_LENGTHY_EXTRUDE
|
|
|
|
|
|
|
|
if (labs(de) > EXTRUDE_MAXLENGTH) {
|
|
|
|
|
|
|
|
curr_e = dest_e; // Behave as if the move really took place, but ignore E part
|
|
|
|
|
|
|
|
SERIAL_ECHO_START;
|
|
|
|
|
|
|
|
SERIAL_ECHOLNPGM(MSG_ERR_LONG_EXTRUDE_STOP);
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return de;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#endif // PREVENT_DANGEROUS_EXTRUDE
|
|
|
|
|
|
|
|
|
|
|
|
void prepare_move() {
|
|
|
|
void prepare_move() {
|
|
|
|
clamp_to_software_endstops(destination);
|
|
|
|
clamp_to_software_endstops(destination);
|
|
|
|
refresh_cmd_timeout();
|
|
|
|
refresh_cmd_timeout();
|
|
|
|
|
|
|
|
|
|
|
|
#ifdef PREVENT_DANGEROUS_EXTRUDE
|
|
|
|
#ifdef PREVENT_DANGEROUS_EXTRUDE
|
|
|
|
float de = destination[E_AXIS] - current_position[E_AXIS];
|
|
|
|
(void)prevent_dangerous_extrude(current_position[E_AXIS], destination[E_AXIS]);
|
|
|
|
if (de) {
|
|
|
|
|
|
|
|
if (degHotend(active_extruder) < extrude_min_temp) {
|
|
|
|
|
|
|
|
current_position[E_AXIS] = destination[E_AXIS]; // Behave as if the move really took place, but ignore E part
|
|
|
|
|
|
|
|
SERIAL_ECHO_START;
|
|
|
|
|
|
|
|
SERIAL_ECHOLNPGM(MSG_ERR_COLD_EXTRUDE_STOP);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
#ifdef PREVENT_LENGTHY_EXTRUDE
|
|
|
|
|
|
|
|
if (labs(de) > EXTRUDE_MAXLENGTH) {
|
|
|
|
|
|
|
|
current_position[E_AXIS] = destination[E_AXIS]; // Behave as if the move really took place, but ignore E part
|
|
|
|
|
|
|
|
SERIAL_ECHO_START;
|
|
|
|
|
|
|
|
SERIAL_ECHOLNPGM(MSG_ERR_LONG_EXTRUDE_STOP);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
#ifdef SCARA //for now same as delta-code
|
|
|
|
#ifdef SCARA //for now same as delta-code
|
|
|
|