|
@ -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(); |
|
@ -559,15 +557,16 @@ void setup() |
|
|
|
|
|
|
|
|
// Check startup - does nothing if bootloader sets MCUSR to 0
|
|
|
// Check startup - does nothing if bootloader sets MCUSR to 0
|
|
|
byte mcu = MCUSR; |
|
|
byte mcu = MCUSR; |
|
|
if(mcu & 1) SERIAL_ECHOLNPGM(MSG_POWERUP); |
|
|
if (mcu & 1) SERIAL_ECHOLNPGM(MSG_POWERUP); |
|
|
if(mcu & 2) SERIAL_ECHOLNPGM(MSG_EXTERNAL_RESET); |
|
|
if (mcu & 2) SERIAL_ECHOLNPGM(MSG_EXTERNAL_RESET); |
|
|
if(mcu & 4) SERIAL_ECHOLNPGM(MSG_BROWNOUT_RESET); |
|
|
if (mcu & 4) SERIAL_ECHOLNPGM(MSG_BROWNOUT_RESET); |
|
|
if(mcu & 8) SERIAL_ECHOLNPGM(MSG_WATCHDOG_RESET); |
|
|
if (mcu & 8) SERIAL_ECHOLNPGM(MSG_WATCHDOG_RESET); |
|
|
if(mcu & 32) SERIAL_ECHOLNPGM(MSG_SOFTWARE_RESET); |
|
|
if (mcu & 32) SERIAL_ECHOLNPGM(MSG_SOFTWARE_RESET); |
|
|
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,17 +578,16 @@ 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; |
|
|
{ |
|
|
#endif // !SDSUPPORT
|
|
|
fromsd[i] = false; |
|
|
|
|
|
} |
|
|
|
|
|
#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)
|
|
|
Config_RetrieveSettings(); |
|
|
Config_RetrieveSettings(); |
|
@ -600,7 +598,6 @@ void setup() |
|
|
st_init(); // Initialize stepper, this enables interrupts!
|
|
|
st_init(); // Initialize stepper, this enables interrupts!
|
|
|
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,20 +609,23 @@ void setup() |
|
|
#ifdef DIGIPOT_I2C |
|
|
#ifdef DIGIPOT_I2C |
|
|
digipot_i2c_init(); |
|
|
digipot_i2c_init(); |
|
|
#endif |
|
|
#endif |
|
|
#ifdef Z_PROBE_SLED |
|
|
|
|
|
pinMode(SERVO0_PIN, OUTPUT); |
|
|
#ifdef Z_PROBE_SLED |
|
|
digitalWrite(SERVO0_PIN, LOW); // turn it off
|
|
|
pinMode(SERVO0_PIN, OUTPUT); |
|
|
#endif // Z_PROBE_SLED
|
|
|
digitalWrite(SERVO0_PIN, LOW); // turn it off
|
|
|
|
|
|
#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 |
|
|
|
|
|
pinMode(STAT_LED_BLUE, OUTPUT); |
|
|
#ifdef STAT_LED_BLUE |
|
|
digitalWrite(STAT_LED_BLUE, LOW); // turn it off
|
|
|
pinMode(STAT_LED_BLUE, OUTPUT); |
|
|
#endif |
|
|
digitalWrite(STAT_LED_BLUE, LOW); // turn it off
|
|
|
|
|
|
#endif |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -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
|
|
|
|
|
|
|
|
|
void prepare_move() { |
|
|
#ifdef PREVENT_DANGEROUS_EXTRUDE |
|
|
clamp_to_software_endstops(destination); |
|
|
|
|
|
refresh_cmd_timeout(); |
|
|
|
|
|
|
|
|
|
|
|
#ifdef PREVENT_DANGEROUS_EXTRUDE |
|
|
inline float prevent_dangerous_extrude(float &curr_e, float &dest_e) { |
|
|
float de = destination[E_AXIS] - current_position[E_AXIS]; |
|
|
float de = dest_e - curr_e; |
|
|
if (de) { |
|
|
if (de) { |
|
|
if (degHotend(active_extruder) < extrude_min_temp) { |
|
|
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
|
|
|
curr_e = dest_e; // Behave as if the move really took place, but ignore E part
|
|
|
SERIAL_ECHO_START; |
|
|
SERIAL_ECHO_START; |
|
|
SERIAL_ECHOLNPGM(MSG_ERR_COLD_EXTRUDE_STOP); |
|
|
SERIAL_ECHOLNPGM(MSG_ERR_COLD_EXTRUDE_STOP); |
|
|
|
|
|
return 0; |
|
|
} |
|
|
} |
|
|
#ifdef PREVENT_LENGTHY_EXTRUDE |
|
|
#ifdef PREVENT_LENGTHY_EXTRUDE |
|
|
if (labs(de) > EXTRUDE_MAXLENGTH) { |
|
|
if (labs(de) > EXTRUDE_MAXLENGTH) { |
|
|
current_position[E_AXIS] = destination[E_AXIS]; // Behave as if the move really took place, but ignore E part
|
|
|
curr_e = dest_e; // Behave as if the move really took place, but ignore E part
|
|
|
SERIAL_ECHO_START; |
|
|
SERIAL_ECHO_START; |
|
|
SERIAL_ECHOLNPGM(MSG_ERR_LONG_EXTRUDE_STOP); |
|
|
SERIAL_ECHOLNPGM(MSG_ERR_LONG_EXTRUDE_STOP); |
|
|
|
|
|
return 0; |
|
|
} |
|
|
} |
|
|
#endif |
|
|
#endif |
|
|
} |
|
|
} |
|
|
|
|
|
return de; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
#endif // PREVENT_DANGEROUS_EXTRUDE
|
|
|
|
|
|
|
|
|
|
|
|
void prepare_move() { |
|
|
|
|
|
clamp_to_software_endstops(destination); |
|
|
|
|
|
refresh_cmd_timeout(); |
|
|
|
|
|
|
|
|
|
|
|
#ifdef PREVENT_DANGEROUS_EXTRUDE |
|
|
|
|
|
(void)prevent_dangerous_extrude(current_position[E_AXIS], destination[E_AXIS]); |
|
|
#endif |
|
|
#endif |
|
|
|
|
|
|
|
|
#ifdef SCARA //for now same as delta-code
|
|
|
#ifdef SCARA //for now same as delta-code
|
|
|