|
@@ -150,6 +150,7 @@
|
|
// Rxxx Wait for extruder current temp to reach target temp. Waits when heating and cooling
|
|
// Rxxx Wait for extruder current temp to reach target temp. Waits when heating and cooling
|
|
// IF AUTOTEMP is enabled, S<mintemp> B<maxtemp> F<factor>. Exit autotemp by any M109 without F
|
|
// IF AUTOTEMP is enabled, S<mintemp> B<maxtemp> F<factor>. Exit autotemp by any M109 without F
|
|
// M112 - Emergency stop
|
|
// M112 - Emergency stop
|
|
|
|
+// M113 - Get or set the timeout interval for Host Keepalive "busy" messages
|
|
// M114 - Output current position to serial port
|
|
// M114 - Output current position to serial port
|
|
// M115 - Capabilities string
|
|
// M115 - Capabilities string
|
|
// M117 - display message
|
|
// M117 - display message
|
|
@@ -372,6 +373,16 @@ int fanSpeed=0;
|
|
|
|
|
|
bool cancel_heatup = false ;
|
|
bool cancel_heatup = false ;
|
|
|
|
|
|
|
|
+#ifdef HOST_KEEPALIVE_FEATURE
|
|
|
|
+
|
|
|
|
+ MarlinBusyState busy_state = NOT_BUSY;
|
|
|
|
+ static long prev_busy_signal_ms = -1;
|
|
|
|
+ uint8_t host_keepalive_interval = HOST_KEEPALIVE_INTERVAL;
|
|
|
|
+#else
|
|
|
|
+ #define host_keepalive();
|
|
|
|
+ #define KEEPALIVE_STATE(n);
|
|
|
|
+#endif
|
|
|
|
+
|
|
#ifdef FILAMENT_SENSOR
|
|
#ifdef FILAMENT_SENSOR
|
|
//Variables for Filament Sensor input
|
|
//Variables for Filament Sensor input
|
|
float filament_width_nominal=DEFAULT_NOMINAL_FILAMENT_DIA; //Set nominal filament width, can be changed with M404
|
|
float filament_width_nominal=DEFAULT_NOMINAL_FILAMENT_DIA; //Set nominal filament width, can be changed with M404
|
|
@@ -761,10 +772,12 @@ void enquecommand(const char *cmd, bool from_progmem)
|
|
strcpy_P(cmdbuffer + bufindw + 1, cmd);
|
|
strcpy_P(cmdbuffer + bufindw + 1, cmd);
|
|
else
|
|
else
|
|
strcpy(cmdbuffer + bufindw + 1, cmd);
|
|
strcpy(cmdbuffer + bufindw + 1, cmd);
|
|
- SERIAL_ECHO_START;
|
|
|
|
- SERIAL_ECHORPGM(MSG_Enqueing);
|
|
|
|
- SERIAL_ECHO(cmdbuffer + bufindw + 1);
|
|
|
|
- SERIAL_ECHOLNPGM("\"");
|
|
|
|
|
|
+ if (!farm_mode) {
|
|
|
|
+ SERIAL_ECHO_START;
|
|
|
|
+ SERIAL_ECHORPGM(MSG_Enqueing);
|
|
|
|
+ SERIAL_ECHO(cmdbuffer + bufindw + 1);
|
|
|
|
+ SERIAL_ECHOLNPGM("\"");
|
|
|
|
+ }
|
|
bufindw += len + 2;
|
|
bufindw += len + 2;
|
|
if (bufindw == sizeof(cmdbuffer))
|
|
if (bufindw == sizeof(cmdbuffer))
|
|
bufindw = 0;
|
|
bufindw = 0;
|
|
@@ -786,6 +799,11 @@ void enquecommand(const char *cmd, bool from_progmem)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+bool cmd_buffer_empty()
|
|
|
|
+{
|
|
|
|
+ return (buflen == 0);
|
|
|
|
+}
|
|
|
|
+
|
|
void enquecommand_front(const char *cmd, bool from_progmem)
|
|
void enquecommand_front(const char *cmd, bool from_progmem)
|
|
{
|
|
{
|
|
int len = from_progmem ? strlen_P(cmd) : strlen(cmd);
|
|
int len = from_progmem ? strlen_P(cmd) : strlen(cmd);
|
|
@@ -797,10 +815,12 @@ void enquecommand_front(const char *cmd, bool from_progmem)
|
|
else
|
|
else
|
|
strcpy(cmdbuffer + bufindr + 1, cmd);
|
|
strcpy(cmdbuffer + bufindr + 1, cmd);
|
|
++ buflen;
|
|
++ buflen;
|
|
- SERIAL_ECHO_START;
|
|
|
|
- SERIAL_ECHOPGM("Enqueing to the front: \"");
|
|
|
|
- SERIAL_ECHO(cmdbuffer + bufindr + 1);
|
|
|
|
- SERIAL_ECHOLNPGM("\"");
|
|
|
|
|
|
+ if (!farm_mode) {
|
|
|
|
+ SERIAL_ECHO_START;
|
|
|
|
+ SERIAL_ECHOPGM("Enqueing to the front: \"");
|
|
|
|
+ SERIAL_ECHO(cmdbuffer + bufindr + 1);
|
|
|
|
+ SERIAL_ECHOLNPGM("\"");
|
|
|
|
+ }
|
|
#ifdef CMDBUFFER_DEBUG
|
|
#ifdef CMDBUFFER_DEBUG
|
|
cmdqueue_dump_to_serial();
|
|
cmdqueue_dump_to_serial();
|
|
#endif /* CMDBUFFER_DEBUG */
|
|
#endif /* CMDBUFFER_DEBUG */
|
|
@@ -1026,6 +1046,7 @@ void setup()
|
|
SERIAL_PROTOCOLLNPGM("start");
|
|
SERIAL_PROTOCOLLNPGM("start");
|
|
SERIAL_ECHO_START;
|
|
SERIAL_ECHO_START;
|
|
|
|
|
|
|
|
+
|
|
#if 0
|
|
#if 0
|
|
SERIAL_ECHOLN("Reading eeprom from 0 to 100: start");
|
|
SERIAL_ECHOLN("Reading eeprom from 0 to 100: start");
|
|
for (int i = 0; i < 4096; ++i) {
|
|
for (int i = 0; i < 4096; ++i) {
|
|
@@ -1086,6 +1107,7 @@ void setup()
|
|
world2machine_reset();
|
|
world2machine_reset();
|
|
|
|
|
|
lcd_init();
|
|
lcd_init();
|
|
|
|
+ KEEPALIVE_STATE(PAUSED_FOR_USER);
|
|
if (!READ(BTN_ENC))
|
|
if (!READ(BTN_ENC))
|
|
{
|
|
{
|
|
_delay_ms(1000);
|
|
_delay_ms(1000);
|
|
@@ -1107,7 +1129,7 @@ void setup()
|
|
|
|
|
|
|
|
|
|
_delay_ms(2000);
|
|
_delay_ms(2000);
|
|
-
|
|
|
|
|
|
+
|
|
char level = reset_menu();
|
|
char level = reset_menu();
|
|
factory_reset(level, false);
|
|
factory_reset(level, false);
|
|
|
|
|
|
@@ -1168,7 +1190,7 @@ void setup()
|
|
#if defined(Z_AXIS_ALWAYS_ON)
|
|
#if defined(Z_AXIS_ALWAYS_ON)
|
|
enable_z();
|
|
enable_z();
|
|
#endif
|
|
#endif
|
|
-
|
|
|
|
|
|
+
|
|
// Enable Toshiba FlashAir SD card / WiFi enahanced card.
|
|
// Enable Toshiba FlashAir SD card / WiFi enahanced card.
|
|
card.ToshibaFlashAir_enable(eeprom_read_byte((unsigned char*)EEPROM_TOSHIBA_FLASH_AIR_COMPATIBLITY) == 1);
|
|
card.ToshibaFlashAir_enable(eeprom_read_byte((unsigned char*)EEPROM_TOSHIBA_FLASH_AIR_COMPATIBLITY) == 1);
|
|
// Force SD card update. Otherwise the SD card update is done from loop() on card.checkautostart(false),
|
|
// Force SD card update. Otherwise the SD card update is done from loop() on card.checkautostart(false),
|
|
@@ -1184,6 +1206,8 @@ void setup()
|
|
// EEPROM_LANG to number lower than 0x0ff.
|
|
// EEPROM_LANG to number lower than 0x0ff.
|
|
// 1) Set a high power mode.
|
|
// 1) Set a high power mode.
|
|
eeprom_write_byte((uint8_t*)EEPROM_SILENT, 0);
|
|
eeprom_write_byte((uint8_t*)EEPROM_SILENT, 0);
|
|
|
|
+ eeprom_write_byte((uint8_t*)EEPROM_WIZARD_ACTIVE, 1); //run wizard
|
|
|
|
+
|
|
}
|
|
}
|
|
#ifdef SNMM
|
|
#ifdef SNMM
|
|
if (eeprom_read_dword((uint32_t*)EEPROM_BOWDEN_LENGTH) == 0x0ffffffff) { //bowden length used for SNMM
|
|
if (eeprom_read_dword((uint32_t*)EEPROM_BOWDEN_LENGTH) == 0x0ffffffff) { //bowden length used for SNMM
|
|
@@ -1214,30 +1238,39 @@ void setup()
|
|
|
|
|
|
#ifndef DEBUG_DISABLE_STARTMSGS
|
|
#ifndef DEBUG_DISABLE_STARTMSGS
|
|
check_babystep(); //checking if Z babystep is in allowed range
|
|
check_babystep(); //checking if Z babystep is in allowed range
|
|
-
|
|
|
|
- if (calibration_status() == CALIBRATION_STATUS_ASSEMBLED ||
|
|
|
|
- calibration_status() == CALIBRATION_STATUS_UNKNOWN) {
|
|
|
|
- // Reset the babystepping values, so the printer will not move the Z axis up when the babystepping is enabled.
|
|
|
|
- eeprom_update_word((uint16_t*)EEPROM_BABYSTEP_Z, 0);
|
|
|
|
- // Show the message.
|
|
|
|
- lcd_show_fullscreen_message_and_wait_P(MSG_FOLLOW_CALIBRATION_FLOW);
|
|
|
|
- } else if (calibration_status() == CALIBRATION_STATUS_LIVE_ADJUST) {
|
|
|
|
- // Show the message.
|
|
|
|
- lcd_show_fullscreen_message_and_wait_P(MSG_BABYSTEP_Z_NOT_SET);
|
|
|
|
- lcd_update_enable(true);
|
|
|
|
- } else if (calibration_status() == CALIBRATION_STATUS_CALIBRATED && temp_cal_active == true && calibration_status_pinda() == false) {
|
|
|
|
- lcd_show_fullscreen_message_and_wait_P(MSG_PINDA_NOT_CALIBRATED);
|
|
|
|
- lcd_update_enable(true);
|
|
|
|
- } else if (calibration_status() == CALIBRATION_STATUS_Z_CALIBRATION) {
|
|
|
|
- // Show the message.
|
|
|
|
- lcd_show_fullscreen_message_and_wait_P(MSG_FOLLOW_CALIBRATION_FLOW);
|
|
|
|
|
|
+
|
|
|
|
+ if (eeprom_read_byte((uint8_t*)EEPROM_WIZARD_ACTIVE) == 1) {
|
|
|
|
+ lcd_wizard(0);
|
|
}
|
|
}
|
|
- for (int i = 0; i<4; i++) EEPROM_read_B(EEPROM_BOWDEN_LENGTH + i * 2, &bowden_length[i]);
|
|
|
|
-
|
|
|
|
- //If eeprom version for storing parameters to eeprom using M500 changed, default settings are used. Inform user in this case
|
|
|
|
- if (!previous_settings_retrieved) {
|
|
|
|
- lcd_show_fullscreen_message_and_wait_P(MSG_DEFAULT_SETTINGS_LOADED);
|
|
|
|
|
|
+ else if (eeprom_read_byte((uint8_t*)EEPROM_WIZARD_ACTIVE) == 0) { //dont show calibration status messages if wizard is currently active
|
|
|
|
+
|
|
|
|
+ if (calibration_status() == CALIBRATION_STATUS_ASSEMBLED ||
|
|
|
|
+ calibration_status() == CALIBRATION_STATUS_UNKNOWN ||
|
|
|
|
+ calibration_status() == CALIBRATION_STATUS_XYZ_CALIBRATION){
|
|
|
|
+ // Reset the babystepping values, so the printer will not move the Z axis up when the babystepping is enabled.
|
|
|
|
+ eeprom_update_word((uint16_t*)EEPROM_BABYSTEP_Z, 0);
|
|
|
|
+ // Show the message.
|
|
|
|
+ lcd_show_fullscreen_message_and_wait_P(MSG_FOLLOW_CALIBRATION_FLOW);
|
|
|
|
+ }
|
|
|
|
+ else if (calibration_status() == CALIBRATION_STATUS_LIVE_ADJUST) {
|
|
|
|
+ // Show the message.
|
|
|
|
+ lcd_show_fullscreen_message_and_wait_P(MSG_BABYSTEP_Z_NOT_SET);
|
|
|
|
+ lcd_update_enable(true);
|
|
|
|
+ }
|
|
|
|
+ else if (calibration_status() == CALIBRATION_STATUS_CALIBRATED && temp_cal_active == true && calibration_status_pinda() == false) {
|
|
|
|
+ lcd_show_fullscreen_message_and_wait_P(MSG_PINDA_NOT_CALIBRATED);
|
|
|
|
+ lcd_update_enable(true);
|
|
|
|
+ }
|
|
|
|
+ else if (calibration_status() == CALIBRATION_STATUS_Z_CALIBRATION) {
|
|
|
|
+ // Show the message.
|
|
|
|
+ lcd_show_fullscreen_message_and_wait_P(MSG_FOLLOW_CALIBRATION_FLOW);
|
|
|
|
+ }
|
|
|
|
+ //If eeprom version for storing parameters to eeprom using M500 changed, default settings are used. Inform user in this case
|
|
|
|
+ if (!previous_settings_retrieved) {
|
|
|
|
+ lcd_show_fullscreen_message_and_wait_P(MSG_DEFAULT_SETTINGS_LOADED);
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
+ for (int i = 0; i < 4; i++) EEPROM_read_B(EEPROM_BOWDEN_LENGTH + i * 2, &bowden_length[i]);
|
|
|
|
|
|
#endif //DEBUG_DISABLE_STARTMSGS
|
|
#endif //DEBUG_DISABLE_STARTMSGS
|
|
lcd_update_enable(true);
|
|
lcd_update_enable(true);
|
|
@@ -1245,6 +1278,7 @@ void setup()
|
|
// Store the currently running firmware into an eeprom,
|
|
// Store the currently running firmware into an eeprom,
|
|
// so the next time the firmware gets updated, it will know from which version it has been updated.
|
|
// so the next time the firmware gets updated, it will know from which version it has been updated.
|
|
update_current_firmware_version_to_eeprom();
|
|
update_current_firmware_version_to_eeprom();
|
|
|
|
+ KEEPALIVE_STATE(NOT_BUSY);
|
|
}
|
|
}
|
|
|
|
|
|
void trace();
|
|
void trace();
|
|
@@ -1321,6 +1355,36 @@ int serial_read_stream() {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+#ifdef HOST_KEEPALIVE_FEATURE
|
|
|
|
+/**
|
|
|
|
+* Output a "busy" message at regular intervals
|
|
|
|
+* while the machine is not accepting commands.
|
|
|
|
+*/
|
|
|
|
+void host_keepalive() {
|
|
|
|
+ if (farm_mode) return;
|
|
|
|
+ long ms = millis();
|
|
|
|
+ if (host_keepalive_interval && busy_state != NOT_BUSY) {
|
|
|
|
+ if (ms - prev_busy_signal_ms < 1000UL * host_keepalive_interval) return;
|
|
|
|
+ switch (busy_state) {
|
|
|
|
+ case IN_HANDLER:
|
|
|
|
+ case IN_PROCESS:
|
|
|
|
+ SERIAL_ECHO_START;
|
|
|
|
+ SERIAL_ECHOLNPGM("busy: processing");
|
|
|
|
+ break;
|
|
|
|
+ case PAUSED_FOR_USER:
|
|
|
|
+ SERIAL_ECHO_START;
|
|
|
|
+ SERIAL_ECHOLNPGM("busy: paused for user");
|
|
|
|
+ break;
|
|
|
|
+ case PAUSED_FOR_INPUT:
|
|
|
|
+ SERIAL_ECHO_START;
|
|
|
|
+ SERIAL_ECHOLNPGM("busy: paused for input");
|
|
|
|
+ break;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ prev_busy_signal_ms = ms;
|
|
|
|
+}
|
|
|
|
+#endif
|
|
|
|
+
|
|
// The loop() function is called in an endless loop by the Arduino framework from the default main() routine.
|
|
// The loop() function is called in an endless loop by the Arduino framework from the default main() routine.
|
|
// Before loop(), the setup() function is called by the main() routine.
|
|
// Before loop(), the setup() function is called by the main() routine.
|
|
void loop()
|
|
void loop()
|
|
@@ -1376,6 +1440,7 @@ void loop()
|
|
if (! cmdbuffer_front_already_processed)
|
|
if (! cmdbuffer_front_already_processed)
|
|
cmdqueue_pop_front();
|
|
cmdqueue_pop_front();
|
|
cmdbuffer_front_already_processed = false;
|
|
cmdbuffer_front_already_processed = false;
|
|
|
|
+ host_keepalive();
|
|
}
|
|
}
|
|
}
|
|
}
|
|
//check heater every n milliseconds
|
|
//check heater every n milliseconds
|
|
@@ -1882,6 +1947,19 @@ static float probe_pt(float x, float y, float z_before) {
|
|
}
|
|
}
|
|
#endif // LIN_ADVANCE
|
|
#endif // LIN_ADVANCE
|
|
|
|
|
|
|
|
+bool check_commands() {
|
|
|
|
+ bool end_command_found = false;
|
|
|
|
+
|
|
|
|
+ if (buflen)
|
|
|
|
+ {
|
|
|
|
+ if ((code_seen("M84")) || (code_seen("M 84"))) end_command_found = true;
|
|
|
|
+ if (!cmdbuffer_front_already_processed)
|
|
|
|
+ cmdqueue_pop_front();
|
|
|
|
+ cmdbuffer_front_already_processed = false;
|
|
|
|
+ }
|
|
|
|
+ return end_command_found;
|
|
|
|
+}
|
|
|
|
+
|
|
void homeaxis(int axis) {
|
|
void homeaxis(int axis) {
|
|
#define HOMEAXIS_DO(LETTER) \
|
|
#define HOMEAXIS_DO(LETTER) \
|
|
((LETTER##_MIN_PIN > -1 && LETTER##_HOME_DIR==-1) || (LETTER##_MAX_PIN > -1 && LETTER##_HOME_DIR==1))
|
|
((LETTER##_MIN_PIN > -1 && LETTER##_HOME_DIR==-1) || (LETTER##_MAX_PIN > -1 && LETTER##_HOME_DIR==1))
|
|
@@ -2066,6 +2144,165 @@ void ramming() {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
*/
|
|
*/
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+void gcode_M701() {
|
|
|
|
+#ifdef SNMM
|
|
|
|
+ extr_adj(snmm_extruder);//loads current extruder
|
|
|
|
+#else
|
|
|
|
+ enable_z();
|
|
|
|
+ custom_message = true;
|
|
|
|
+ custom_message_type = 2;
|
|
|
|
+
|
|
|
|
+ lcd_setstatuspgm(MSG_LOADING_FILAMENT);
|
|
|
|
+ current_position[E_AXIS] += 70;
|
|
|
|
+ plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS], 400 / 60, active_extruder); //fast sequence
|
|
|
|
+
|
|
|
|
+ current_position[E_AXIS] += 25;
|
|
|
|
+ plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS], 100 / 60, active_extruder); //slow sequence
|
|
|
|
+ st_synchronize();
|
|
|
|
+
|
|
|
|
+ if (!farm_mode && loading_flag) {
|
|
|
|
+ bool clean = lcd_show_fullscreen_message_yes_no_and_wait_P(MSG_FILAMENT_CLEAN, false, true);
|
|
|
|
+
|
|
|
|
+ while (!clean) {
|
|
|
|
+ lcd_update_enable(true);
|
|
|
|
+ lcd_update(2);
|
|
|
|
+ current_position[E_AXIS] += 25;
|
|
|
|
+ plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS], 100 / 60, active_extruder); //slow sequence
|
|
|
|
+ st_synchronize();
|
|
|
|
+ clean = lcd_show_fullscreen_message_yes_no_and_wait_P(MSG_FILAMENT_CLEAN, false, true);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ lcd_update_enable(true);
|
|
|
|
+ lcd_update(2);
|
|
|
|
+ lcd_setstatuspgm(WELCOME_MSG);
|
|
|
|
+ disable_z();
|
|
|
|
+ loading_flag = false;
|
|
|
|
+ custom_message = false;
|
|
|
|
+ custom_message_type = 0;
|
|
|
|
+#endif
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+bool gcode_M45(bool onlyZ) {
|
|
|
|
+ bool final_result = false;
|
|
|
|
+ if (!onlyZ) {
|
|
|
|
+ setTargetBed(0);
|
|
|
|
+ setTargetHotend(0, 0);
|
|
|
|
+ setTargetHotend(0, 1);
|
|
|
|
+ setTargetHotend(0, 2);
|
|
|
|
+ adjust_bed_reset(); //reset bed level correction
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ // Disable the default update procedure of the display. We will do a modal dialog.
|
|
|
|
+ lcd_update_enable(false);
|
|
|
|
+ // Let the planner use the uncorrected coordinates.
|
|
|
|
+ mbl.reset();
|
|
|
|
+ // Reset world2machine_rotation_and_skew and world2machine_shift, therefore
|
|
|
|
+ // the planner will not perform any adjustments in the XY plane.
|
|
|
|
+ // Wait for the motors to stop and update the current position with the absolute values.
|
|
|
|
+ world2machine_revert_to_uncorrected();
|
|
|
|
+ // Reset the baby step value applied without moving the axes.
|
|
|
|
+ babystep_reset();
|
|
|
|
+ // Mark all axes as in a need for homing.
|
|
|
|
+ memset(axis_known_position, 0, sizeof(axis_known_position));
|
|
|
|
+
|
|
|
|
+ // Let the user move the Z axes up to the end stoppers.
|
|
|
|
+ KEEPALIVE_STATE(PAUSED_FOR_USER);
|
|
|
|
+ if (lcd_calibrate_z_end_stop_manual(onlyZ)) {
|
|
|
|
+ KEEPALIVE_STATE(IN_HANDLER);
|
|
|
|
+ refresh_cmd_timeout();
|
|
|
|
+ if (((degHotend(0) > MAX_HOTEND_TEMP_CALIBRATION) || (degBed() > MAX_BED_TEMP_CALIBRATION)) && (!onlyZ)) {
|
|
|
|
+ lcd_wait_for_cool_down();
|
|
|
|
+ lcd_show_fullscreen_message_and_wait_P(MSG_PAPER);
|
|
|
|
+ lcd_display_message_fullscreen_P(MSG_FIND_BED_OFFSET_AND_SKEW_LINE1);
|
|
|
|
+ lcd_implementation_print_at(0, 2, 1);
|
|
|
|
+ lcd_printPGM(MSG_FIND_BED_OFFSET_AND_SKEW_LINE2);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ // Move the print head close to the bed.
|
|
|
|
+ current_position[Z_AXIS] = MESH_HOME_Z_SEARCH;
|
|
|
|
+ plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS], homing_feedrate[Z_AXIS] / 40, active_extruder);
|
|
|
|
+ st_synchronize();
|
|
|
|
+
|
|
|
|
+ // Home in the XY plane.
|
|
|
|
+ set_destination_to_current();
|
|
|
|
+ setup_for_endstop_move();
|
|
|
|
+ home_xy();
|
|
|
|
+
|
|
|
|
+ int8_t verbosity_level = 0;
|
|
|
|
+ if (code_seen('V')) {
|
|
|
|
+ // Just 'V' without a number counts as V1.
|
|
|
|
+ char c = strchr_pointer[1];
|
|
|
|
+ verbosity_level = (c == ' ' || c == '\t' || c == 0) ? 1 : code_value_short();
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if (onlyZ) {
|
|
|
|
+ clean_up_after_endstop_move();
|
|
|
|
+ // Z only calibration.
|
|
|
|
+ // Load the machine correction matrix
|
|
|
|
+ world2machine_initialize();
|
|
|
|
+ // and correct the current_position to match the transformed coordinate system.
|
|
|
|
+ world2machine_update_current();
|
|
|
|
+ //FIXME
|
|
|
|
+ bool result = sample_mesh_and_store_reference();
|
|
|
|
+ if (result) {
|
|
|
|
+ if (calibration_status() == CALIBRATION_STATUS_Z_CALIBRATION)
|
|
|
|
+ // Shipped, the nozzle height has been set already. The user can start printing now.
|
|
|
|
+ calibration_status_store(CALIBRATION_STATUS_CALIBRATED);
|
|
|
|
+ // babystep_apply();
|
|
|
|
+ final_result = true;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ else {
|
|
|
|
+ //if wizard is active and selftest was succefully completed, we dont want to loose information about it
|
|
|
|
+ if (calibration_status() != 250 || eeprom_read_byte((uint8_t*)EEPROM_WIZARD_ACTIVE) == 0) {
|
|
|
|
+ calibration_status_store(CALIBRATION_STATUS_ASSEMBLED);
|
|
|
|
+ }
|
|
|
|
+ // Reset the baby step value and the baby step applied flag.
|
|
|
|
+ eeprom_update_word((uint16_t*)EEPROM_BABYSTEP_Z, 0);
|
|
|
|
+ // Complete XYZ calibration.
|
|
|
|
+ uint8_t point_too_far_mask = 0;
|
|
|
|
+ BedSkewOffsetDetectionResultType result = find_bed_offset_and_skew(verbosity_level, point_too_far_mask);
|
|
|
|
+ clean_up_after_endstop_move();
|
|
|
|
+ // Print head up.
|
|
|
|
+ current_position[Z_AXIS] = MESH_HOME_Z_SEARCH;
|
|
|
|
+ plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS], homing_feedrate[Z_AXIS] / 40, active_extruder);
|
|
|
|
+ st_synchronize();
|
|
|
|
+ if (result >= 0) {
|
|
|
|
+ point_too_far_mask = 0;
|
|
|
|
+ // Second half: The fine adjustment.
|
|
|
|
+ // Let the planner use the uncorrected coordinates.
|
|
|
|
+ mbl.reset();
|
|
|
|
+ world2machine_reset();
|
|
|
|
+ // Home in the XY plane.
|
|
|
|
+ setup_for_endstop_move();
|
|
|
|
+ home_xy();
|
|
|
|
+ result = improve_bed_offset_and_skew(1, verbosity_level, point_too_far_mask);
|
|
|
|
+ clean_up_after_endstop_move();
|
|
|
|
+ // Print head up.
|
|
|
|
+ current_position[Z_AXIS] = MESH_HOME_Z_SEARCH;
|
|
|
|
+ plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS], homing_feedrate[Z_AXIS] / 40, active_extruder);
|
|
|
|
+ st_synchronize();
|
|
|
|
+ // if (result >= 0) babystep_apply();
|
|
|
|
+ }
|
|
|
|
+ lcd_bed_calibration_show_result(result, point_too_far_mask);
|
|
|
|
+ if (result >= 0) {
|
|
|
|
+ // Calibration valid, the machine should be able to print. Advise the user to run the V2Calibration.gcode.
|
|
|
|
+ calibration_status_store(CALIBRATION_STATUS_LIVE_ADJUST);
|
|
|
|
+ if(eeprom_read_byte((uint8_t*)EEPROM_WIZARD_ACTIVE) != 1) lcd_show_fullscreen_message_and_wait_P(MSG_BABYSTEP_Z_NOT_SET);
|
|
|
|
+ final_result = true;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ else {
|
|
|
|
+ // Timeouted.
|
|
|
|
+ KEEPALIVE_STATE(IN_HANDLER);
|
|
|
|
+ }
|
|
|
|
+ lcd_update_enable(true);
|
|
|
|
+ return final_result;
|
|
|
|
+}
|
|
|
|
+
|
|
void process_commands()
|
|
void process_commands()
|
|
{
|
|
{
|
|
#ifdef FILAMENT_RUNOUT_SUPPORT
|
|
#ifdef FILAMENT_RUNOUT_SUPPORT
|
|
@@ -2094,11 +2331,17 @@ void process_commands()
|
|
float tmp_motor_loud[3] = DEFAULT_PWM_MOTOR_CURRENT_LOUD;
|
|
float tmp_motor_loud[3] = DEFAULT_PWM_MOTOR_CURRENT_LOUD;
|
|
int8_t SilentMode;
|
|
int8_t SilentMode;
|
|
#endif
|
|
#endif
|
|
|
|
+ KEEPALIVE_STATE(IN_HANDLER);
|
|
|
|
+
|
|
if (code_seen("M117")) { //moved to highest priority place to be able to to print strings which includes "G", "PRUSA" and "^"
|
|
if (code_seen("M117")) { //moved to highest priority place to be able to to print strings which includes "G", "PRUSA" and "^"
|
|
|
|
+ custom_message = true; //fixes using M117 during SD print, but needs to be be updated in future
|
|
|
|
+ custom_message_type = 2; //fixes using M117 during SD print, but needs to be be updated in future
|
|
starpos = (strchr(strchr_pointer + 5, '*'));
|
|
starpos = (strchr(strchr_pointer + 5, '*'));
|
|
if (starpos != NULL)
|
|
if (starpos != NULL)
|
|
*(starpos) = '\0';
|
|
*(starpos) = '\0';
|
|
lcd_setstatus(strchr_pointer + 5);
|
|
lcd_setstatus(strchr_pointer + 5);
|
|
|
|
+ custom_message = false;
|
|
|
|
+ custom_message_type = 0;
|
|
}
|
|
}
|
|
else if(code_seen("PRUSA")){
|
|
else if(code_seen("PRUSA")){
|
|
if (code_seen("Ping")) { //PRUSA Ping
|
|
if (code_seen("Ping")) { //PRUSA Ping
|
|
@@ -2427,7 +2670,7 @@ void process_commands()
|
|
prepare_arc_move(false);
|
|
prepare_arc_move(false);
|
|
}
|
|
}
|
|
break;
|
|
break;
|
|
- case 4: // G4 dwell
|
|
|
|
|
|
+ case 4: // G4 dwell
|
|
codenum = 0;
|
|
codenum = 0;
|
|
if(code_seen('P')) codenum = code_value(); // milliseconds to wait
|
|
if(code_seen('P')) codenum = code_value(); // milliseconds to wait
|
|
if(code_seen('S')) codenum = code_value() * 1000; // seconds to wait
|
|
if(code_seen('S')) codenum = code_value() * 1000; // seconds to wait
|
|
@@ -2460,8 +2703,7 @@ void process_commands()
|
|
#endif //FWRETRACT
|
|
#endif //FWRETRACT
|
|
case 28: //G28 Home all Axis one at a time
|
|
case 28: //G28 Home all Axis one at a time
|
|
homing_flag = true;
|
|
homing_flag = true;
|
|
-
|
|
|
|
-#ifdef ENABLE_AUTO_BED_LEVELING
|
|
|
|
|
|
+ #ifdef ENABLE_AUTO_BED_LEVELING
|
|
plan_bed_level_matrix.set_to_identity(); //Reset the plane ("erase" all leveling data)
|
|
plan_bed_level_matrix.set_to_identity(); //Reset the plane ("erase" all leveling data)
|
|
#endif //ENABLE_AUTO_BED_LEVELING
|
|
#endif //ENABLE_AUTO_BED_LEVELING
|
|
|
|
|
|
@@ -2908,6 +3150,7 @@ void process_commands()
|
|
enquecommand_front_P((PSTR("G28 W0")));
|
|
enquecommand_front_P((PSTR("G28 W0")));
|
|
break;
|
|
break;
|
|
}
|
|
}
|
|
|
|
+ KEEPALIVE_STATE(NOT_BUSY); //no need to print busy messages as we print current temperatures periodicaly
|
|
SERIAL_ECHOLNPGM("PINDA probe calibration start");
|
|
SERIAL_ECHOLNPGM("PINDA probe calibration start");
|
|
custom_message = true;
|
|
custom_message = true;
|
|
custom_message_type = 4;
|
|
custom_message_type = 4;
|
|
@@ -3308,6 +3551,7 @@ void process_commands()
|
|
current_position[E_AXIS] += DEFAULT_RETRACTION;
|
|
current_position[E_AXIS] += DEFAULT_RETRACTION;
|
|
plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS], 400, active_extruder);
|
|
plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS], 400, active_extruder);
|
|
}
|
|
}
|
|
|
|
+ KEEPALIVE_STATE(NOT_BUSY);
|
|
// Restore custom message state
|
|
// Restore custom message state
|
|
custom_message = custom_message_old;
|
|
custom_message = custom_message_old;
|
|
custom_message_type = custom_message_type_old;
|
|
custom_message_type = custom_message_type_old;
|
|
@@ -3416,13 +3660,16 @@ void process_commands()
|
|
calibration_status_store(CALIBRATION_STATUS_CALIBRATED);
|
|
calibration_status_store(CALIBRATION_STATUS_CALIBRATED);
|
|
break;
|
|
break;
|
|
|
|
|
|
- /**
|
|
|
|
- * G88: Prusa3D specific: Don't know what it is for, it is in V2Calibration.gcode
|
|
|
|
- */
|
|
|
|
- case 88:
|
|
|
|
- break;
|
|
|
|
-
|
|
|
|
-
|
|
|
|
|
|
+ /*case 88: //just for test
|
|
|
|
+ SERIAL_ECHOPGM("Calibration status:");
|
|
|
|
+ MYSERIAL.println(int(calibration_status()));
|
|
|
|
+ if (code_seen('S')) codenum = code_value();
|
|
|
|
+ calibration_status_store(codenum);
|
|
|
|
+ SERIAL_ECHOPGM("Calibration status:");
|
|
|
|
+ MYSERIAL.println(int(calibration_status()));
|
|
|
|
+ eeprom_write_byte((uint8_t*)EEPROM_WIZARD_ACTIVE, 1); //run wizard
|
|
|
|
+ break;
|
|
|
|
+ */
|
|
#endif // ENABLE_MESH_BED_LEVELING
|
|
#endif // ENABLE_MESH_BED_LEVELING
|
|
|
|
|
|
|
|
|
|
@@ -3452,7 +3699,9 @@ void process_commands()
|
|
case 98: //activate farm mode
|
|
case 98: //activate farm mode
|
|
farm_mode = 1;
|
|
farm_mode = 1;
|
|
PingTime = millis();
|
|
PingTime = millis();
|
|
|
|
+ EEPROM_save_B(EEPROM_FARM_NUMBER, &farm_no);
|
|
eeprom_update_byte((unsigned char *)EEPROM_FARM_MODE, farm_mode);
|
|
eeprom_update_byte((unsigned char *)EEPROM_FARM_MODE, farm_mode);
|
|
|
|
+
|
|
break;
|
|
break;
|
|
|
|
|
|
case 99: //deactivate farm mode
|
|
case 99: //deactivate farm mode
|
|
@@ -3487,9 +3736,11 @@ void process_commands()
|
|
case 0: // M0 - Unconditional stop - Wait for user button press on LCD
|
|
case 0: // M0 - Unconditional stop - Wait for user button press on LCD
|
|
case 1: // M1 - Conditional stop - Wait for user button press on LCD
|
|
case 1: // M1 - Conditional stop - Wait for user button press on LCD
|
|
{
|
|
{
|
|
- char *src = strchr_pointer + 2;
|
|
|
|
|
|
+ custom_message = true; //fixes using M1 during SD print, but needs to be be updated in future
|
|
|
|
+ custom_message_type = 2; //fixes using M1 during SD print, but needs to be be updated in future
|
|
|
|
|
|
- codenum = 0;
|
|
|
|
|
|
+ char *src = strchr_pointer + 2;
|
|
|
|
+ codenum = 0;
|
|
|
|
|
|
bool hasP = false, hasS = false;
|
|
bool hasP = false, hasS = false;
|
|
if (code_seen('P')) {
|
|
if (code_seen('P')) {
|
|
@@ -3505,35 +3756,41 @@ void process_commands()
|
|
while (*src == ' ') ++src;
|
|
while (*src == ' ') ++src;
|
|
if (!hasP && !hasS && *src != '\0') {
|
|
if (!hasP && !hasS && *src != '\0') {
|
|
lcd_setstatus(src);
|
|
lcd_setstatus(src);
|
|
- } else {
|
|
|
|
- LCD_MESSAGERPGM(MSG_USERWAIT);
|
|
|
|
- }
|
|
|
|
|
|
+ } else {
|
|
|
|
+ LCD_MESSAGERPGM(MSG_USERWAIT);
|
|
|
|
+ }
|
|
|
|
|
|
lcd_ignore_click(); //call lcd_ignore_click aslo for else ???
|
|
lcd_ignore_click(); //call lcd_ignore_click aslo for else ???
|
|
st_synchronize();
|
|
st_synchronize();
|
|
previous_millis_cmd = millis();
|
|
previous_millis_cmd = millis();
|
|
if (codenum > 0){
|
|
if (codenum > 0){
|
|
codenum += millis(); // keep track of when we started waiting
|
|
codenum += millis(); // keep track of when we started waiting
|
|
- while(millis() < codenum && !lcd_clicked()){
|
|
|
|
|
|
+ KEEPALIVE_STATE(PAUSED_FOR_USER);
|
|
|
|
+ while(millis() < codenum && !lcd_clicked()){
|
|
manage_heater();
|
|
manage_heater();
|
|
manage_inactivity(true);
|
|
manage_inactivity(true);
|
|
lcd_update();
|
|
lcd_update();
|
|
}
|
|
}
|
|
|
|
+ KEEPALIVE_STATE(IN_HANDLER);
|
|
lcd_ignore_click(false);
|
|
lcd_ignore_click(false);
|
|
}else{
|
|
}else{
|
|
if (!lcd_detected())
|
|
if (!lcd_detected())
|
|
break;
|
|
break;
|
|
|
|
+ KEEPALIVE_STATE(PAUSED_FOR_USER);
|
|
while(!lcd_clicked()){
|
|
while(!lcd_clicked()){
|
|
manage_heater();
|
|
manage_heater();
|
|
manage_inactivity(true);
|
|
manage_inactivity(true);
|
|
lcd_update();
|
|
lcd_update();
|
|
}
|
|
}
|
|
|
|
+ KEEPALIVE_STATE(IN_HANDLER);
|
|
}
|
|
}
|
|
if (IS_SD_PRINTING)
|
|
if (IS_SD_PRINTING)
|
|
LCD_MESSAGERPGM(MSG_RESUMING);
|
|
LCD_MESSAGERPGM(MSG_RESUMING);
|
|
else
|
|
else
|
|
LCD_MESSAGERPGM(WELCOME_MSG);
|
|
LCD_MESSAGERPGM(WELCOME_MSG);
|
|
- }
|
|
|
|
|
|
+ custom_message = false;
|
|
|
|
+ custom_message_type = 0;
|
|
|
|
+ }
|
|
break;
|
|
break;
|
|
#endif
|
|
#endif
|
|
case 17:
|
|
case 17:
|
|
@@ -3714,112 +3971,8 @@ void process_commands()
|
|
case 45: // M45: Prusa3D: bed skew and offset with manual Z up
|
|
case 45: // M45: Prusa3D: bed skew and offset with manual Z up
|
|
{
|
|
{
|
|
// Only Z calibration?
|
|
// Only Z calibration?
|
|
- bool onlyZ = code_seen('Z');
|
|
|
|
-
|
|
|
|
- if (!onlyZ) {
|
|
|
|
- setTargetBed(0);
|
|
|
|
- setTargetHotend(0, 0);
|
|
|
|
- setTargetHotend(0, 1);
|
|
|
|
- setTargetHotend(0, 2);
|
|
|
|
- adjust_bed_reset(); //reset bed level correction
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- // Disable the default update procedure of the display. We will do a modal dialog.
|
|
|
|
- lcd_update_enable(false);
|
|
|
|
- // Let the planner use the uncorrected coordinates.
|
|
|
|
- mbl.reset();
|
|
|
|
- // Reset world2machine_rotation_and_skew and world2machine_shift, therefore
|
|
|
|
- // the planner will not perform any adjustments in the XY plane.
|
|
|
|
- // Wait for the motors to stop and update the current position with the absolute values.
|
|
|
|
- world2machine_revert_to_uncorrected();
|
|
|
|
- // Reset the baby step value applied without moving the axes.
|
|
|
|
- babystep_reset();
|
|
|
|
- // Mark all axes as in a need for homing.
|
|
|
|
- memset(axis_known_position, 0, sizeof(axis_known_position));
|
|
|
|
-
|
|
|
|
- // Let the user move the Z axes up to the end stoppers.
|
|
|
|
- if (lcd_calibrate_z_end_stop_manual( onlyZ )) {
|
|
|
|
- refresh_cmd_timeout();
|
|
|
|
- if (((degHotend(0) > MAX_HOTEND_TEMP_CALIBRATION) || (degBed() > MAX_BED_TEMP_CALIBRATION)) && (!onlyZ)) {
|
|
|
|
- lcd_wait_for_cool_down();
|
|
|
|
- lcd_show_fullscreen_message_and_wait_P(MSG_PAPER);
|
|
|
|
- lcd_display_message_fullscreen_P(MSG_FIND_BED_OFFSET_AND_SKEW_LINE1);
|
|
|
|
- lcd_implementation_print_at(0, 2, 1);
|
|
|
|
- lcd_printPGM(MSG_FIND_BED_OFFSET_AND_SKEW_LINE2);
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- // Move the print head close to the bed.
|
|
|
|
- current_position[Z_AXIS] = MESH_HOME_Z_SEARCH;
|
|
|
|
- plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS],current_position[Z_AXIS] , current_position[E_AXIS], homing_feedrate[Z_AXIS]/40, active_extruder);
|
|
|
|
- st_synchronize();
|
|
|
|
-
|
|
|
|
- // Home in the XY plane.
|
|
|
|
- set_destination_to_current();
|
|
|
|
- setup_for_endstop_move();
|
|
|
|
- home_xy();
|
|
|
|
-
|
|
|
|
- int8_t verbosity_level = 0;
|
|
|
|
- if (code_seen('V')) {
|
|
|
|
- // Just 'V' without a number counts as V1.
|
|
|
|
- char c = strchr_pointer[1];
|
|
|
|
- verbosity_level = (c == ' ' || c == '\t' || c == 0) ? 1 : code_value_short();
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- if (onlyZ) {
|
|
|
|
- clean_up_after_endstop_move();
|
|
|
|
- // Z only calibration.
|
|
|
|
- // Load the machine correction matrix
|
|
|
|
- world2machine_initialize();
|
|
|
|
- // and correct the current_position to match the transformed coordinate system.
|
|
|
|
- world2machine_update_current();
|
|
|
|
- //FIXME
|
|
|
|
- bool result = sample_mesh_and_store_reference();
|
|
|
|
- if (result) {
|
|
|
|
- if (calibration_status() == CALIBRATION_STATUS_Z_CALIBRATION)
|
|
|
|
- // Shipped, the nozzle height has been set already. The user can start printing now.
|
|
|
|
- calibration_status_store(CALIBRATION_STATUS_CALIBRATED);
|
|
|
|
- // babystep_apply();
|
|
|
|
- }
|
|
|
|
- } else {
|
|
|
|
- // Reset the baby step value and the baby step applied flag.
|
|
|
|
- calibration_status_store(CALIBRATION_STATUS_ASSEMBLED);
|
|
|
|
- eeprom_update_word((uint16_t*)EEPROM_BABYSTEP_Z, 0);
|
|
|
|
- // Complete XYZ calibration.
|
|
|
|
- uint8_t point_too_far_mask = 0;
|
|
|
|
- BedSkewOffsetDetectionResultType result = find_bed_offset_and_skew(verbosity_level, point_too_far_mask);
|
|
|
|
- clean_up_after_endstop_move();
|
|
|
|
- // Print head up.
|
|
|
|
- current_position[Z_AXIS] = MESH_HOME_Z_SEARCH;
|
|
|
|
- plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS],current_position[Z_AXIS] , current_position[E_AXIS], homing_feedrate[Z_AXIS]/40, active_extruder);
|
|
|
|
- st_synchronize();
|
|
|
|
- if (result >= 0) {
|
|
|
|
- point_too_far_mask = 0;
|
|
|
|
- // Second half: The fine adjustment.
|
|
|
|
- // Let the planner use the uncorrected coordinates.
|
|
|
|
- mbl.reset();
|
|
|
|
- world2machine_reset();
|
|
|
|
- // Home in the XY plane.
|
|
|
|
- setup_for_endstop_move();
|
|
|
|
- home_xy();
|
|
|
|
- result = improve_bed_offset_and_skew(1, verbosity_level, point_too_far_mask);
|
|
|
|
- clean_up_after_endstop_move();
|
|
|
|
- // Print head up.
|
|
|
|
- current_position[Z_AXIS] = MESH_HOME_Z_SEARCH;
|
|
|
|
- plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS],current_position[Z_AXIS] , current_position[E_AXIS], homing_feedrate[Z_AXIS]/40, active_extruder);
|
|
|
|
- st_synchronize();
|
|
|
|
- // if (result >= 0) babystep_apply();
|
|
|
|
- }
|
|
|
|
- lcd_bed_calibration_show_result(result, point_too_far_mask);
|
|
|
|
- if (result >= 0) {
|
|
|
|
- // Calibration valid, the machine should be able to print. Advise the user to run the V2Calibration.gcode.
|
|
|
|
- calibration_status_store(CALIBRATION_STATUS_LIVE_ADJUST);
|
|
|
|
- lcd_show_fullscreen_message_and_wait_P(MSG_BABYSTEP_Z_NOT_SET);
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- } else {
|
|
|
|
- // Timeouted.
|
|
|
|
- }
|
|
|
|
- lcd_update_enable(true);
|
|
|
|
|
|
+ bool only_Z = code_seen('Z');
|
|
|
|
+ gcode_M45(only_Z);
|
|
break;
|
|
break;
|
|
}
|
|
}
|
|
|
|
|
|
@@ -3848,8 +4001,10 @@ void process_commands()
|
|
|
|
|
|
case 47:
|
|
case 47:
|
|
// M47: Prusa3D: Show end stops dialog on the display.
|
|
// M47: Prusa3D: Show end stops dialog on the display.
|
|
|
|
+ KEEPALIVE_STATE(PAUSED_FOR_USER);
|
|
lcd_diag_show_end_stops();
|
|
lcd_diag_show_end_stops();
|
|
- break;
|
|
|
|
|
|
+ KEEPALIVE_STATE(IN_HANDLER);
|
|
|
|
+ break;
|
|
|
|
|
|
#if 0
|
|
#if 0
|
|
case 48: // M48: scan the bed induction sensor points, print the sensor trigger coordinates to the serial line for visualization on the PC.
|
|
case 48: // M48: scan the bed induction sensor points, print the sensor trigger coordinates to the serial line for visualization on the PC.
|
|
@@ -4232,6 +4387,7 @@ Sigma_Exit:
|
|
}}
|
|
}}
|
|
#endif
|
|
#endif
|
|
SERIAL_PROTOCOLLN("");
|
|
SERIAL_PROTOCOLLN("");
|
|
|
|
+ KEEPALIVE_STATE(NOT_BUSY);
|
|
return;
|
|
return;
|
|
break;
|
|
break;
|
|
case 109:
|
|
case 109:
|
|
@@ -4269,11 +4425,14 @@ Sigma_Exit:
|
|
/* See if we are heating up or cooling down */
|
|
/* See if we are heating up or cooling down */
|
|
target_direction = isHeatingHotend(tmp_extruder); // true if heating, false if cooling
|
|
target_direction = isHeatingHotend(tmp_extruder); // true if heating, false if cooling
|
|
|
|
|
|
|
|
+ KEEPALIVE_STATE(NOT_BUSY);
|
|
|
|
+
|
|
cancel_heatup = false;
|
|
cancel_heatup = false;
|
|
|
|
|
|
wait_for_heater(codenum); //loops until target temperature is reached
|
|
wait_for_heater(codenum); //loops until target temperature is reached
|
|
|
|
|
|
LCD_MESSAGERPGM(MSG_HEATING_COMPLETE);
|
|
LCD_MESSAGERPGM(MSG_HEATING_COMPLETE);
|
|
|
|
+ KEEPALIVE_STATE(IN_HANDLER);
|
|
heating_status = 2;
|
|
heating_status = 2;
|
|
if (farm_mode) { prusa_statistics(2); };
|
|
if (farm_mode) { prusa_statistics(2); };
|
|
|
|
|
|
@@ -4301,6 +4460,7 @@ Sigma_Exit:
|
|
cancel_heatup = false;
|
|
cancel_heatup = false;
|
|
target_direction = isHeatingBed(); // true if heating, false if cooling
|
|
target_direction = isHeatingBed(); // true if heating, false if cooling
|
|
|
|
|
|
|
|
+ KEEPALIVE_STATE(NOT_BUSY);
|
|
while ( (target_direction)&&(!cancel_heatup) ? (isHeatingBed()) : (isCoolingBed()&&(CooldownNoWait==false)) )
|
|
while ( (target_direction)&&(!cancel_heatup) ? (isHeatingBed()) : (isCoolingBed()&&(CooldownNoWait==false)) )
|
|
{
|
|
{
|
|
if(( millis() - codenum) > 1000 ) //Print Temp Reading every 1 second while heating up.
|
|
if(( millis() - codenum) > 1000 ) //Print Temp Reading every 1 second while heating up.
|
|
@@ -4323,6 +4483,7 @@ Sigma_Exit:
|
|
lcd_update();
|
|
lcd_update();
|
|
}
|
|
}
|
|
LCD_MESSAGERPGM(MSG_BED_DONE);
|
|
LCD_MESSAGERPGM(MSG_BED_DONE);
|
|
|
|
+ KEEPALIVE_STATE(IN_HANDLER);
|
|
heating_status = 4;
|
|
heating_status = 4;
|
|
|
|
|
|
previous_millis_cmd = millis();
|
|
previous_millis_cmd = millis();
|
|
@@ -4466,6 +4627,18 @@ Sigma_Exit:
|
|
else
|
|
else
|
|
gcode_LastN = 0;
|
|
gcode_LastN = 0;
|
|
break;
|
|
break;
|
|
|
|
+#ifdef HOST_KEEPALIVE_FEATURE
|
|
|
|
+ case 113: // M113 - Get or set Host Keepalive interval
|
|
|
|
+ if (code_seen('S')) {
|
|
|
|
+ host_keepalive_interval = (uint8_t)code_value_short();
|
|
|
|
+ NOMORE(host_keepalive_interval, 60);
|
|
|
|
+ } else {
|
|
|
|
+ SERIAL_ECHO_START;
|
|
|
|
+ SERIAL_ECHOPAIR("M113 S", (unsigned long)host_keepalive_interval);
|
|
|
|
+ SERIAL_PROTOCOLLN("");
|
|
|
|
+ }
|
|
|
|
+ break;
|
|
|
|
+#endif
|
|
case 115: // M115
|
|
case 115: // M115
|
|
if (code_seen('V')) {
|
|
if (code_seen('V')) {
|
|
// Report the Prusa version number.
|
|
// Report the Prusa version number.
|
|
@@ -5017,7 +5190,8 @@ Sigma_Exit:
|
|
temp=70;
|
|
temp=70;
|
|
if (code_seen('S')) temp=code_value();
|
|
if (code_seen('S')) temp=code_value();
|
|
if (code_seen('C')) c=code_value();
|
|
if (code_seen('C')) c=code_value();
|
|
- PID_autotune(temp, e, c);
|
|
|
|
|
|
+
|
|
|
|
+ PID_autotune(temp, e, c);
|
|
}
|
|
}
|
|
break;
|
|
break;
|
|
case 400: // M400 finish all moves
|
|
case 400: // M400 finish all moves
|
|
@@ -5294,6 +5468,7 @@ case 404: //M404 Enter the nominal filament width (3mm, 1.75mm ) N<3.0> or disp
|
|
int counterBeep = 0;
|
|
int counterBeep = 0;
|
|
lcd_wait_interact();
|
|
lcd_wait_interact();
|
|
load_filament_time = millis();
|
|
load_filament_time = millis();
|
|
|
|
+ KEEPALIVE_STATE(PAUSED_FOR_USER);
|
|
while(!lcd_clicked()){
|
|
while(!lcd_clicked()){
|
|
|
|
|
|
cnt++;
|
|
cnt++;
|
|
@@ -5330,14 +5505,17 @@ case 404: //M404 Enter the nominal filament width (3mm, 1.75mm ) N<3.0> or disp
|
|
}
|
|
}
|
|
|
|
|
|
}
|
|
}
|
|
|
|
+ KEEPALIVE_STATE(IN_HANDLER);
|
|
WRITE(BEEPER, LOW);
|
|
WRITE(BEEPER, LOW);
|
|
#ifdef SNMM
|
|
#ifdef SNMM
|
|
display_loading();
|
|
display_loading();
|
|
|
|
+ KEEPALIVE_STATE(PAUSED_FOR_USER);
|
|
do {
|
|
do {
|
|
target[E_AXIS] += 0.002;
|
|
target[E_AXIS] += 0.002;
|
|
plan_buffer_line(target[X_AXIS], target[Y_AXIS], target[Z_AXIS], target[E_AXIS], 500, active_extruder);
|
|
plan_buffer_line(target[X_AXIS], target[Y_AXIS], target[Z_AXIS], target[E_AXIS], 500, active_extruder);
|
|
delay_keep_alive(2);
|
|
delay_keep_alive(2);
|
|
- } while (!lcd_clicked());
|
|
|
|
|
|
+ } while (!lcd_clicked());
|
|
|
|
+ KEEPALIVE_STATE(IN_HANDLER);
|
|
/*if (millis() - load_filament_time > 2) {
|
|
/*if (millis() - load_filament_time > 2) {
|
|
load_filament_time = millis();
|
|
load_filament_time = millis();
|
|
target[E_AXIS] += 0.001;
|
|
target[E_AXIS] += 0.001;
|
|
@@ -5377,7 +5555,9 @@ case 404: //M404 Enter the nominal filament width (3mm, 1.75mm ) N<3.0> or disp
|
|
lcd_loading_filament();
|
|
lcd_loading_filament();
|
|
while ((lcd_change_fil_state == 0)||(lcd_change_fil_state != 1)){
|
|
while ((lcd_change_fil_state == 0)||(lcd_change_fil_state != 1)){
|
|
lcd_change_fil_state = 0;
|
|
lcd_change_fil_state = 0;
|
|
|
|
+ KEEPALIVE_STATE(PAUSED_FOR_USER);
|
|
lcd_alright();
|
|
lcd_alright();
|
|
|
|
+ KEEPALIVE_STATE(IN_HANDLER);
|
|
switch(lcd_change_fil_state){
|
|
switch(lcd_change_fil_state){
|
|
|
|
|
|
// Filament failed to load so load it again
|
|
// Filament failed to load so load it again
|
|
@@ -5550,37 +5730,7 @@ case 404: //M404 Enter the nominal filament width (3mm, 1.75mm ) N<3.0> or disp
|
|
break;
|
|
break;
|
|
case 701: //M701: load filament
|
|
case 701: //M701: load filament
|
|
{
|
|
{
|
|
- enable_z();
|
|
|
|
- custom_message = true;
|
|
|
|
- custom_message_type = 2;
|
|
|
|
-
|
|
|
|
- lcd_setstatuspgm(MSG_LOADING_FILAMENT);
|
|
|
|
- current_position[E_AXIS] += 70;
|
|
|
|
- plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS], 400 / 60, active_extruder); //fast sequence
|
|
|
|
-
|
|
|
|
- current_position[E_AXIS] += 25;
|
|
|
|
- plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS], 100 / 60, active_extruder); //slow sequence
|
|
|
|
- st_synchronize();
|
|
|
|
-
|
|
|
|
- if (!farm_mode && loading_flag) {
|
|
|
|
- bool clean = lcd_show_fullscreen_message_yes_no_and_wait_P(MSG_FILAMENT_CLEAN, false, true);
|
|
|
|
-
|
|
|
|
- while (!clean) {
|
|
|
|
- lcd_update_enable(true);
|
|
|
|
- lcd_update(2);
|
|
|
|
- current_position[E_AXIS] += 25;
|
|
|
|
- plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS], 100 / 60, active_extruder); //slow sequence
|
|
|
|
- st_synchronize();
|
|
|
|
- clean = lcd_show_fullscreen_message_yes_no_and_wait_P(MSG_FILAMENT_CLEAN, false, true);
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- lcd_update_enable(true);
|
|
|
|
- lcd_update(2);
|
|
|
|
- lcd_setstatuspgm(WELCOME_MSG);
|
|
|
|
- disable_z();
|
|
|
|
- loading_flag = false;
|
|
|
|
- custom_message = false;
|
|
|
|
- custom_message_type = 0;
|
|
|
|
|
|
+ gcode_M701();
|
|
}
|
|
}
|
|
break;
|
|
break;
|
|
case 702:
|
|
case 702:
|
|
@@ -5790,6 +5940,8 @@ case 404: //M404 Enter the nominal filament width (3mm, 1.75mm ) N<3.0> or disp
|
|
SERIAL_ECHOLNPGM("\"");
|
|
SERIAL_ECHOLNPGM("\"");
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ KEEPALIVE_STATE(NOT_BUSY);
|
|
|
|
+
|
|
ClearToSend();
|
|
ClearToSend();
|
|
}
|
|
}
|
|
|
|
|
|
@@ -6033,7 +6185,7 @@ void manage_inactivity(bool ignore_stepper_queue/*=false*/) //default argument s
|
|
static int killCount = 0; // make the inactivity button a bit less responsive
|
|
static int killCount = 0; // make the inactivity button a bit less responsive
|
|
const int KILL_DELAY = 10000;
|
|
const int KILL_DELAY = 10000;
|
|
#endif
|
|
#endif
|
|
-
|
|
|
|
|
|
+
|
|
if(buflen < (BUFSIZE-1)){
|
|
if(buflen < (BUFSIZE-1)){
|
|
get_command();
|
|
get_command();
|
|
}
|
|
}
|
|
@@ -6309,7 +6461,7 @@ void calculate_volumetric_multipliers() {
|
|
|
|
|
|
void delay_keep_alive(unsigned int ms)
|
|
void delay_keep_alive(unsigned int ms)
|
|
{
|
|
{
|
|
- for (;;) {
|
|
|
|
|
|
+ for (;;) {
|
|
manage_heater();
|
|
manage_heater();
|
|
// Manage inactivity, but don't disable steppers on timeout.
|
|
// Manage inactivity, but don't disable steppers on timeout.
|
|
manage_inactivity(true);
|
|
manage_inactivity(true);
|