|
@@ -247,6 +247,8 @@ int extruder_multiply[EXTRUDERS] = {100
|
|
|
#endif
|
|
|
};
|
|
|
|
|
|
+int bowden_length[4];
|
|
|
+
|
|
|
bool is_usb_printing = false;
|
|
|
bool homing_flag = false;
|
|
|
|
|
@@ -265,6 +267,8 @@ float pause_lastpos[4];
|
|
|
unsigned long pause_time = 0;
|
|
|
unsigned long start_pause_print = millis();
|
|
|
|
|
|
+unsigned long load_filament_time;
|
|
|
+
|
|
|
bool mesh_bed_leveling_flag = false;
|
|
|
|
|
|
unsigned char lang_selected = 0;
|
|
@@ -897,7 +901,7 @@ int er_progress = 0;
|
|
|
void factory_reset(char level, bool quiet)
|
|
|
{
|
|
|
lcd_implementation_clear();
|
|
|
-
|
|
|
+ int cursor_pos = 0;
|
|
|
switch (level) {
|
|
|
|
|
|
// Level 0: Language reset
|
|
@@ -968,6 +972,9 @@ void factory_reset(char level, bool quiet)
|
|
|
}
|
|
|
|
|
|
|
|
|
+ break;
|
|
|
+ case 4:
|
|
|
+ bowden_menu();
|
|
|
break;
|
|
|
|
|
|
default:
|
|
@@ -983,178 +990,183 @@ void factory_reset(char level, bool quiet)
|
|
|
// are initialized by the main() routine provided by the Arduino framework.
|
|
|
void setup()
|
|
|
{
|
|
|
- setup_killpin();
|
|
|
- setup_powerhold();
|
|
|
- MYSERIAL.begin(BAUDRATE);
|
|
|
- SERIAL_PROTOCOLLNPGM("start");
|
|
|
- SERIAL_ECHO_START;
|
|
|
+ setup_killpin();
|
|
|
+ setup_powerhold();
|
|
|
+ MYSERIAL.begin(BAUDRATE);
|
|
|
+ SERIAL_PROTOCOLLNPGM("start");
|
|
|
+ SERIAL_ECHO_START;
|
|
|
|
|
|
#if 0
|
|
|
- SERIAL_ECHOLN("Reading eeprom from 0 to 100: start");
|
|
|
- for (int i = 0; i < 4096; ++ i) {
|
|
|
- int b = eeprom_read_byte((unsigned char*)i);
|
|
|
- if (b != 255) {
|
|
|
- SERIAL_ECHO(i);
|
|
|
- SERIAL_ECHO(":");
|
|
|
- SERIAL_ECHO(b);
|
|
|
- SERIAL_ECHOLN("");
|
|
|
- }
|
|
|
- }
|
|
|
- SERIAL_ECHOLN("Reading eeprom from 0 to 100: done");
|
|
|
- #endif
|
|
|
+ SERIAL_ECHOLN("Reading eeprom from 0 to 100: start");
|
|
|
+ for (int i = 0; i < 4096; ++i) {
|
|
|
+ int b = eeprom_read_byte((unsigned char*)i);
|
|
|
+ if (b != 255) {
|
|
|
+ SERIAL_ECHO(i);
|
|
|
+ SERIAL_ECHO(":");
|
|
|
+ SERIAL_ECHO(b);
|
|
|
+ SERIAL_ECHOLN("");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ SERIAL_ECHOLN("Reading eeprom from 0 to 100: done");
|
|
|
+#endif
|
|
|
|
|
|
- // Check startup - does nothing if bootloader sets MCUSR to 0
|
|
|
- byte mcu = MCUSR;
|
|
|
- if(mcu & 1) SERIAL_ECHOLNRPGM(MSG_POWERUP);
|
|
|
- if(mcu & 2) SERIAL_ECHOLNRPGM(MSG_EXTERNAL_RESET);
|
|
|
- if(mcu & 4) SERIAL_ECHOLNRPGM(MSG_BROWNOUT_RESET);
|
|
|
- if(mcu & 8) SERIAL_ECHOLNRPGM(MSG_WATCHDOG_RESET);
|
|
|
- if(mcu & 32) SERIAL_ECHOLNRPGM(MSG_SOFTWARE_RESET);
|
|
|
- MCUSR=0;
|
|
|
-
|
|
|
- //SERIAL_ECHORPGM(MSG_MARLIN);
|
|
|
- //SERIAL_ECHOLNRPGM(VERSION_STRING);
|
|
|
-
|
|
|
- #ifdef STRING_VERSION_CONFIG_H
|
|
|
- #ifdef STRING_CONFIG_H_AUTHOR
|
|
|
- SERIAL_ECHO_START;
|
|
|
- SERIAL_ECHORPGM(MSG_CONFIGURATION_VER);
|
|
|
- SERIAL_ECHOPGM(STRING_VERSION_CONFIG_H);
|
|
|
- SERIAL_ECHORPGM(MSG_AUTHOR);
|
|
|
- SERIAL_ECHOLNPGM(STRING_CONFIG_H_AUTHOR);
|
|
|
- SERIAL_ECHOPGM("Compiled: ");
|
|
|
- SERIAL_ECHOLNPGM(__DATE__);
|
|
|
- #endif
|
|
|
- #endif
|
|
|
-
|
|
|
- SERIAL_ECHO_START;
|
|
|
- SERIAL_ECHORPGM(MSG_FREE_MEMORY);
|
|
|
- SERIAL_ECHO(freeMemory());
|
|
|
- SERIAL_ECHORPGM(MSG_PLANNER_BUFFER_BYTES);
|
|
|
- SERIAL_ECHOLN((int)sizeof(block_t)*BLOCK_BUFFER_SIZE);
|
|
|
- lcd_update_enable(false);
|
|
|
- // loads data from EEPROM if available else uses defaults (and resets step acceleration rate)
|
|
|
- Config_RetrieveSettings();
|
|
|
- SdFatUtil::set_stack_guard(); //writes magic number at the end of static variables to protect against overwriting static memory by stack
|
|
|
- tp_init(); // Initialize temperature loop
|
|
|
- plan_init(); // Initialize planner;
|
|
|
- watchdog_init();
|
|
|
- st_init(); // Initialize stepper, this enables interrupts!
|
|
|
- setup_photpin();
|
|
|
- servo_init();
|
|
|
- // Reset the machine correction matrix.
|
|
|
- // It does not make sense to load the correction matrix until the machine is homed.
|
|
|
- world2machine_reset();
|
|
|
-
|
|
|
- lcd_init();
|
|
|
- if (!READ(BTN_ENC))
|
|
|
- {
|
|
|
- _delay_ms(1000);
|
|
|
- if (!READ(BTN_ENC))
|
|
|
- {
|
|
|
- lcd_implementation_clear();
|
|
|
-
|
|
|
-
|
|
|
- lcd_printPGM(PSTR("Factory RESET"));
|
|
|
-
|
|
|
-
|
|
|
- SET_OUTPUT(BEEPER);
|
|
|
- WRITE(BEEPER, HIGH);
|
|
|
-
|
|
|
- while (!READ(BTN_ENC));
|
|
|
-
|
|
|
- WRITE(BEEPER, LOW);
|
|
|
-
|
|
|
-
|
|
|
+ // Check startup - does nothing if bootloader sets MCUSR to 0
|
|
|
+ byte mcu = MCUSR;
|
|
|
+ if (mcu & 1) SERIAL_ECHOLNRPGM(MSG_POWERUP);
|
|
|
+ if (mcu & 2) SERIAL_ECHOLNRPGM(MSG_EXTERNAL_RESET);
|
|
|
+ if (mcu & 4) SERIAL_ECHOLNRPGM(MSG_BROWNOUT_RESET);
|
|
|
+ if (mcu & 8) SERIAL_ECHOLNRPGM(MSG_WATCHDOG_RESET);
|
|
|
+ if (mcu & 32) SERIAL_ECHOLNRPGM(MSG_SOFTWARE_RESET);
|
|
|
+ MCUSR = 0;
|
|
|
+
|
|
|
+ //SERIAL_ECHORPGM(MSG_MARLIN);
|
|
|
+ //SERIAL_ECHOLNRPGM(VERSION_STRING);
|
|
|
+
|
|
|
+#ifdef STRING_VERSION_CONFIG_H
|
|
|
+#ifdef STRING_CONFIG_H_AUTHOR
|
|
|
+ SERIAL_ECHO_START;
|
|
|
+ SERIAL_ECHORPGM(MSG_CONFIGURATION_VER);
|
|
|
+ SERIAL_ECHOPGM(STRING_VERSION_CONFIG_H);
|
|
|
+ SERIAL_ECHORPGM(MSG_AUTHOR);
|
|
|
+ SERIAL_ECHOLNPGM(STRING_CONFIG_H_AUTHOR);
|
|
|
+ SERIAL_ECHOPGM("Compiled: ");
|
|
|
+ SERIAL_ECHOLNPGM(__DATE__);
|
|
|
+#endif
|
|
|
+#endif
|
|
|
|
|
|
- _delay_ms(2000);
|
|
|
-
|
|
|
- char level = reset_menu();
|
|
|
- factory_reset(level, false);
|
|
|
-
|
|
|
- switch (level) {
|
|
|
- case 0: _delay_ms(0); break;
|
|
|
- case 1: _delay_ms(0); break;
|
|
|
- case 2: _delay_ms(0); break;
|
|
|
- case 3: _delay_ms(0); break;
|
|
|
- }
|
|
|
- // _delay_ms(100);
|
|
|
-/*
|
|
|
-#ifdef MESH_BED_LEVELING
|
|
|
- _delay_ms(2000);
|
|
|
-
|
|
|
- if (!READ(BTN_ENC))
|
|
|
- {
|
|
|
- WRITE(BEEPER, HIGH);
|
|
|
- _delay_ms(100);
|
|
|
- WRITE(BEEPER, LOW);
|
|
|
- _delay_ms(200);
|
|
|
- WRITE(BEEPER, HIGH);
|
|
|
- _delay_ms(100);
|
|
|
- WRITE(BEEPER, LOW);
|
|
|
-
|
|
|
- int _z = 0;
|
|
|
- calibration_status_store(CALIBRATION_STATUS_CALIBRATED);
|
|
|
- EEPROM_save_B(EEPROM_BABYSTEP_X, &_z);
|
|
|
- EEPROM_save_B(EEPROM_BABYSTEP_Y, &_z);
|
|
|
- EEPROM_save_B(EEPROM_BABYSTEP_Z, &_z);
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
+ SERIAL_ECHO_START;
|
|
|
+ SERIAL_ECHORPGM(MSG_FREE_MEMORY);
|
|
|
+ SERIAL_ECHO(freeMemory());
|
|
|
+ SERIAL_ECHORPGM(MSG_PLANNER_BUFFER_BYTES);
|
|
|
+ SERIAL_ECHOLN((int)sizeof(block_t)*BLOCK_BUFFER_SIZE);
|
|
|
+ lcd_update_enable(false);
|
|
|
+ // loads data from EEPROM if available else uses defaults (and resets step acceleration rate)
|
|
|
+ Config_RetrieveSettings();
|
|
|
+ SdFatUtil::set_stack_guard(); //writes magic number at the end of static variables to protect against overwriting static memory by stack
|
|
|
+ tp_init(); // Initialize temperature loop
|
|
|
+ plan_init(); // Initialize planner;
|
|
|
+ watchdog_init();
|
|
|
+ st_init(); // Initialize stepper, this enables interrupts!
|
|
|
+ setup_photpin();
|
|
|
+ servo_init();
|
|
|
+ // Reset the machine correction matrix.
|
|
|
+ // It does not make sense to load the correction matrix until the machine is homed.
|
|
|
+ world2machine_reset();
|
|
|
+
|
|
|
+ lcd_init();
|
|
|
+ if (!READ(BTN_ENC))
|
|
|
+ {
|
|
|
+ _delay_ms(1000);
|
|
|
+ if (!READ(BTN_ENC))
|
|
|
+ {
|
|
|
+ lcd_implementation_clear();
|
|
|
|
|
|
- WRITE(BEEPER, HIGH);
|
|
|
- _delay_ms(100);
|
|
|
- WRITE(BEEPER, LOW);
|
|
|
- }
|
|
|
-#endif // mesh */
|
|
|
-
|
|
|
- }
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- _delay_ms(1000); // wait 1sec to display the splash screen
|
|
|
- }
|
|
|
|
|
|
-
|
|
|
+ lcd_printPGM(PSTR("Factory RESET"));
|
|
|
|
|
|
- #if defined(CONTROLLERFAN_PIN) && CONTROLLERFAN_PIN > -1
|
|
|
- SET_OUTPUT(CONTROLLERFAN_PIN); //Set pin used for driver cooling fan
|
|
|
- #endif
|
|
|
|
|
|
- #ifdef DIGIPOT_I2C
|
|
|
- digipot_i2c_init();
|
|
|
- #endif
|
|
|
- setup_homepin();
|
|
|
+ SET_OUTPUT(BEEPER);
|
|
|
+ WRITE(BEEPER, HIGH);
|
|
|
|
|
|
-#if defined(Z_AXIS_ALWAYS_ON)
|
|
|
- enable_z();
|
|
|
+ while (!READ(BTN_ENC));
|
|
|
+
|
|
|
+ WRITE(BEEPER, LOW);
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ _delay_ms(2000);
|
|
|
+
|
|
|
+ char level = reset_menu();
|
|
|
+ factory_reset(level, false);
|
|
|
+
|
|
|
+ switch (level) {
|
|
|
+ case 0: _delay_ms(0); break;
|
|
|
+ case 1: _delay_ms(0); break;
|
|
|
+ case 2: _delay_ms(0); break;
|
|
|
+ case 3: _delay_ms(0); break;
|
|
|
+ }
|
|
|
+ // _delay_ms(100);
|
|
|
+ /*
|
|
|
+ #ifdef MESH_BED_LEVELING
|
|
|
+ _delay_ms(2000);
|
|
|
+
|
|
|
+ if (!READ(BTN_ENC))
|
|
|
+ {
|
|
|
+ WRITE(BEEPER, HIGH);
|
|
|
+ _delay_ms(100);
|
|
|
+ WRITE(BEEPER, LOW);
|
|
|
+ _delay_ms(200);
|
|
|
+ WRITE(BEEPER, HIGH);
|
|
|
+ _delay_ms(100);
|
|
|
+ WRITE(BEEPER, LOW);
|
|
|
+
|
|
|
+ int _z = 0;
|
|
|
+ calibration_status_store(CALIBRATION_STATUS_CALIBRATED);
|
|
|
+ EEPROM_save_B(EEPROM_BABYSTEP_X, &_z);
|
|
|
+ EEPROM_save_B(EEPROM_BABYSTEP_Y, &_z);
|
|
|
+ EEPROM_save_B(EEPROM_BABYSTEP_Z, &_z);
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+
|
|
|
+ WRITE(BEEPER, HIGH);
|
|
|
+ _delay_ms(100);
|
|
|
+ WRITE(BEEPER, LOW);
|
|
|
+ }
|
|
|
+ #endif // mesh */
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ _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
|
|
|
- farm_mode = eeprom_read_byte((uint8_t*)EEPROM_FARM_MODE);
|
|
|
- EEPROM_read_B(EEPROM_FARM_NUMBER, &farm_no);
|
|
|
- if ((farm_mode == 0xFF && farm_no == 0) || (farm_no == 0xFFFF)) farm_mode = false; //if farm_mode has not been stored to eeprom yet and farm number is set to zero or EEPROM is fresh, deactivate farm mode
|
|
|
- if (farm_no == 0xFFFF) farm_no = 0;
|
|
|
- if (farm_mode)
|
|
|
- {
|
|
|
- prusa_statistics(8);
|
|
|
- }
|
|
|
|
|
|
- // Enable Toshiba FlashAir SD card / WiFi enahanced card.
|
|
|
- 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),
|
|
|
- // but this times out if a blocking dialog is shown in setup().
|
|
|
- card.initsd();
|
|
|
-
|
|
|
- if (eeprom_read_dword((uint32_t*)(EEPROM_TOP-4)) == 0x0ffffffff &&
|
|
|
- eeprom_read_dword((uint32_t*)(EEPROM_TOP-8)) == 0x0ffffffff &&
|
|
|
- eeprom_read_dword((uint32_t*)(EEPROM_TOP-12)) == 0x0ffffffff) {
|
|
|
- // Maiden startup. The firmware has been loaded and first started on a virgin RAMBo board,
|
|
|
- // where all the EEPROM entries are set to 0x0ff.
|
|
|
- // Once a firmware boots up, it forces at least a language selection, which changes
|
|
|
- // EEPROM_LANG to number lower than 0x0ff.
|
|
|
- // 1) Set a high power mode.
|
|
|
- eeprom_write_byte((uint8_t*)EEPROM_SILENT, 0);
|
|
|
- }
|
|
|
+#ifdef DIGIPOT_I2C
|
|
|
+ digipot_i2c_init();
|
|
|
+#endif
|
|
|
+ setup_homepin();
|
|
|
|
|
|
+#if defined(Z_AXIS_ALWAYS_ON)
|
|
|
+ enable_z();
|
|
|
+#endif
|
|
|
+ farm_mode = eeprom_read_byte((uint8_t*)EEPROM_FARM_MODE);
|
|
|
+ EEPROM_read_B(EEPROM_FARM_NUMBER, &farm_no);
|
|
|
+ if ((farm_mode == 0xFF && farm_no == 0) || (farm_no == 0xFFFF)) farm_mode = false; //if farm_mode has not been stored to eeprom yet and farm number is set to zero or EEPROM is fresh, deactivate farm mode
|
|
|
+ if (farm_no == 0xFFFF) farm_no = 0;
|
|
|
+ if (farm_mode)
|
|
|
+ {
|
|
|
+ prusa_statistics(8);
|
|
|
+ }
|
|
|
+
|
|
|
+ // Enable Toshiba FlashAir SD card / WiFi enahanced card.
|
|
|
+ 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),
|
|
|
+ // but this times out if a blocking dialog is shown in setup().
|
|
|
+ card.initsd();
|
|
|
+
|
|
|
+ if (eeprom_read_dword((uint32_t*)(EEPROM_TOP - 4)) == 0x0ffffffff &&
|
|
|
+ eeprom_read_dword((uint32_t*)(EEPROM_TOP - 8)) == 0x0ffffffff &&
|
|
|
+ eeprom_read_dword((uint32_t*)(EEPROM_TOP - 12)) == 0x0ffffffff) {
|
|
|
+ // Maiden startup. The firmware has been loaded and first started on a virgin RAMBo board,
|
|
|
+ // where all the EEPROM entries are set to 0x0ff.
|
|
|
+ // Once a firmware boots up, it forces at least a language selection, which changes
|
|
|
+ // EEPROM_LANG to number lower than 0x0ff.
|
|
|
+ // 1) Set a high power mode.
|
|
|
+ eeprom_write_byte((uint8_t*)EEPROM_SILENT, 0);
|
|
|
+ }
|
|
|
+#ifdef SNMM
|
|
|
+ if (eeprom_read_dword((uint32_t*)EEPROM_BOWDEN_LENGTH) == 0x0ffffffff) { //bowden length used for SNMM
|
|
|
+ int _z = BOWDEN_LENGTH;
|
|
|
+ for(int i = 0; i<4; i++) EEPROM_save_B(EEPROM_BOWDEN_LENGTH + i * 2, &_z);
|
|
|
+ }
|
|
|
+#endif
|
|
|
|
|
|
// In the future, somewhere here would one compare the current firmware version against the firmware version stored in the EEPROM.
|
|
|
// If they differ, an update procedure may need to be performed. At the end of this block, the current firmware version
|
|
@@ -1188,6 +1200,7 @@ void setup()
|
|
|
// Show the message.
|
|
|
lcd_show_fullscreen_message_and_wait_P(MSG_FOLLOW_CALIBRATION_FLOW);
|
|
|
}
|
|
|
+ for (int i = 0; i<4; i++) EEPROM_read_B(EEPROM_BOWDEN_LENGTH + i * 2, &bowden_length[i]);
|
|
|
lcd_update_enable(true);
|
|
|
|
|
|
// Store the currently running firmware into an eeprom,
|
|
@@ -2050,68 +2063,8 @@ void process_commands()
|
|
|
|
|
|
} else if(code_seen("FR")) {
|
|
|
// Factory full reset
|
|
|
- factory_reset(0,true);
|
|
|
-
|
|
|
- }else if(code_seen("Y")) { //filaments adjustment at the beginning of print (for SNMM)
|
|
|
- #ifdef SNMM
|
|
|
- int extr;
|
|
|
- SilentMode = eeprom_read_byte((uint8_t*)EEPROM_SILENT); //is silent mode or loud mode set
|
|
|
- lcd_implementation_clear();
|
|
|
- lcd_display_message_fullscreen_P(MSG_FIL_ADJUSTING);
|
|
|
- current_position[Z_AXIS] = 100;
|
|
|
- plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS], 500, active_extruder);
|
|
|
- digipot_current(2, E_MOTOR_HIGH_CURRENT);
|
|
|
- for (extr = 1; extr < 4; extr++) { //we dont know which filament is in nozzle, but we want to load filament0, so all other filaments must unloaded
|
|
|
- change_extr(extr);
|
|
|
- ramming();
|
|
|
- }
|
|
|
- change_extr(0);
|
|
|
- current_position[E_AXIS] += FIL_LOAD_LENGTH; //loading filament0 into the nozzle
|
|
|
- plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS], 500, active_extruder);
|
|
|
- st_synchronize();
|
|
|
-
|
|
|
- for (extr = 1; extr < 4; extr++) {
|
|
|
- digipot_current(2, E_MOTOR_LOW_CURRENT); //set lower current for extruder motors
|
|
|
- change_extr(extr);
|
|
|
- current_position[E_AXIS] += (FIL_LOAD_LENGTH + 3 * FIL_RETURN_LENGTH); //adjusting filaments
|
|
|
- plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS], 5000, active_extruder);
|
|
|
- st_synchronize();
|
|
|
- digipot_current(2, tmp_motor_loud[2]); //set back to normal operation currents
|
|
|
- current_position[E_AXIS] -= FIL_RETURN_LENGTH;
|
|
|
- plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS], 500, active_extruder);
|
|
|
- st_synchronize();
|
|
|
- }
|
|
|
-
|
|
|
- change_extr(0);
|
|
|
- current_position[E_AXIS] += 25;
|
|
|
- plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS], 10, active_extruder);
|
|
|
- digipot_current(2, E_MOTOR_HIGH_CURRENT);
|
|
|
- ramming();
|
|
|
- if (SilentMode == 1) digipot_current(2, tmp_motor[2]); //set back to normal operation currents
|
|
|
- else digipot_current(2, tmp_motor_loud[2]);
|
|
|
- st_synchronize();
|
|
|
- lcd_show_fullscreen_message_and_wait_P(MSG_CONFIRM_NOZZLE_CLEAN_FIL_ADJ);
|
|
|
- lcd_implementation_clear();
|
|
|
- lcd_printPGM(MSG_PLEASE_WAIT);
|
|
|
- current_position[Z_AXIS] = 0;
|
|
|
- plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS], 500, active_extruder);
|
|
|
- st_synchronize();
|
|
|
- lcd_update_enable(true);
|
|
|
-
|
|
|
- #endif
|
|
|
- }
|
|
|
- else if (code_seen("SetF")) {
|
|
|
-#ifdef SNMM
|
|
|
- bool not_finished = (eeprom_read_byte((unsigned char*)EEPROM_PRINT_FLAG) != PRINT_FINISHED);
|
|
|
- eeprom_update_byte((unsigned char*)EEPROM_PRINT_FLAG, PRINT_STARTED);
|
|
|
- if (not_finished) enquecommand_front_P(PSTR("PRUSA Y"));
|
|
|
-#endif
|
|
|
- }
|
|
|
- else if (code_seen("ResF")) {
|
|
|
-#ifdef SNMM
|
|
|
- eeprom_update_byte((unsigned char*)EEPROM_PRINT_FLAG, PRINT_FINISHED);
|
|
|
-#endif
|
|
|
- }
|
|
|
+ factory_reset(0,true);
|
|
|
+ }
|
|
|
//else if (code_seen('Cal')) {
|
|
|
// lcd_calibration();
|
|
|
// }
|
|
@@ -5109,11 +5062,35 @@ case 404: //M404 Enter the nominal filament width (3mm, 1.75mm ) N<3.0> or disp
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- #ifdef FILAMENTCHANGE_FINALRETRACT
|
|
|
- target[E_AXIS]+= FILAMENTCHANGE_FINALRETRACT ;
|
|
|
- #endif
|
|
|
+ #ifdef SNMM
|
|
|
+
|
|
|
+ #else
|
|
|
+ #ifdef FILAMENTCHANGE_FINALRETRACT
|
|
|
+ target[E_AXIS] += FILAMENTCHANGE_FINALRETRACT;
|
|
|
+ #endif
|
|
|
+ #endif // SNMM
|
|
|
}
|
|
|
- plan_buffer_line(target[X_AXIS], target[Y_AXIS], target[Z_AXIS], target[E_AXIS], FILAMENTCHANGE_RFEED, active_extruder);
|
|
|
+
|
|
|
+#ifdef SNMM
|
|
|
+ target[E_AXIS] += 12;
|
|
|
+ plan_buffer_line(target[X_AXIS], target[Y_AXIS], target[Z_AXIS], target[E_AXIS], 3500, active_extruder);
|
|
|
+ target[E_AXIS] += 6;
|
|
|
+ plan_buffer_line(target[X_AXIS], target[Y_AXIS], target[Z_AXIS], target[E_AXIS], 5000, active_extruder);
|
|
|
+ target[E_AXIS] += (FIL_LOAD_LENGTH * -1);
|
|
|
+ plan_buffer_line(target[X_AXIS], target[Y_AXIS], target[Z_AXIS], target[E_AXIS], 5000, active_extruder);
|
|
|
+ st_synchronize();
|
|
|
+ target[E_AXIS] += (FIL_COOLING);
|
|
|
+ plan_buffer_line(target[X_AXIS], target[Y_AXIS], target[Z_AXIS], target[E_AXIS], 50, active_extruder);
|
|
|
+ target[E_AXIS] += (FIL_COOLING*-1);
|
|
|
+ plan_buffer_line(target[X_AXIS], target[Y_AXIS], target[Z_AXIS], target[E_AXIS], 50, active_extruder);
|
|
|
+ target[E_AXIS] += (bowden_length[snmm_extruder] *-1);
|
|
|
+ plan_buffer_line(target[X_AXIS], target[Y_AXIS], target[Z_AXIS], target[E_AXIS], 3000, active_extruder);
|
|
|
+ st_synchronize();
|
|
|
+
|
|
|
+#else
|
|
|
+ plan_buffer_line(target[X_AXIS], target[Y_AXIS], target[Z_AXIS], target[E_AXIS], FILAMENTCHANGE_RFEED, active_extruder);
|
|
|
+#endif // SNMM
|
|
|
+
|
|
|
|
|
|
//finish moves
|
|
|
st_synchronize();
|
|
@@ -5127,10 +5104,19 @@ case 404: //M404 Enter the nominal filament width (3mm, 1.75mm ) N<3.0> or disp
|
|
|
uint8_t cnt=0;
|
|
|
int counterBeep = 0;
|
|
|
lcd_wait_interact();
|
|
|
+ load_filament_time = millis();
|
|
|
while(!lcd_clicked()){
|
|
|
- cnt++;
|
|
|
+
|
|
|
+ cnt++;
|
|
|
manage_heater();
|
|
|
manage_inactivity(true);
|
|
|
+
|
|
|
+/*#ifdef SNMM
|
|
|
+ target[E_AXIS] += 0.002;
|
|
|
+ plan_buffer_line(target[X_AXIS], target[Y_AXIS], target[Z_AXIS], target[E_AXIS], 500, active_extruder);
|
|
|
+
|
|
|
+#endif // SNMM*/
|
|
|
+
|
|
|
if(cnt==0)
|
|
|
{
|
|
|
#if BEEPER > 0
|
|
@@ -5140,7 +5126,7 @@ case 404: //M404 Enter the nominal filament width (3mm, 1.75mm ) N<3.0> or disp
|
|
|
SET_OUTPUT(BEEPER);
|
|
|
if (counterBeep== 0){
|
|
|
WRITE(BEEPER,HIGH);
|
|
|
- }
|
|
|
+ }
|
|
|
if (counterBeep== 20){
|
|
|
WRITE(BEEPER,LOW);
|
|
|
}
|
|
@@ -5153,14 +5139,41 @@ case 404: //M404 Enter the nominal filament width (3mm, 1.75mm ) N<3.0> or disp
|
|
|
#endif
|
|
|
#endif
|
|
|
}
|
|
|
+
|
|
|
}
|
|
|
+#ifdef SNMM
|
|
|
+ display_loading();
|
|
|
+ do {
|
|
|
+ target[E_AXIS] += 0.002;
|
|
|
+ plan_buffer_line(target[X_AXIS], target[Y_AXIS], target[Z_AXIS], target[E_AXIS], 500, active_extruder);
|
|
|
+ delay_keep_alive(2);
|
|
|
+ } while (!lcd_clicked());
|
|
|
+ /*if (millis() - load_filament_time > 2) {
|
|
|
+ load_filament_time = millis();
|
|
|
+ target[E_AXIS] += 0.001;
|
|
|
+ plan_buffer_line(target[X_AXIS], target[Y_AXIS], target[Z_AXIS], target[E_AXIS], 1000, active_extruder);
|
|
|
+ }*/
|
|
|
+#endif
|
|
|
//Filament inserted
|
|
|
|
|
|
WRITE(BEEPER,LOW);
|
|
|
-
|
|
|
- //Feed the filament to the end of nozzle quickly
|
|
|
- target[E_AXIS]+= FILAMENTCHANGE_FIRSTFEED ;
|
|
|
- plan_buffer_line(target[X_AXIS], target[Y_AXIS], target[Z_AXIS], target[E_AXIS], FILAMENTCHANGE_EFEED, active_extruder);
|
|
|
+
|
|
|
+ //Feed the filament to the end of nozzle quickly
|
|
|
+#ifdef SNMM
|
|
|
+
|
|
|
+ st_synchronize();
|
|
|
+ target[E_AXIS] += bowden_length[snmm_extruder];
|
|
|
+ plan_buffer_line(target[X_AXIS], target[Y_AXIS], target[Z_AXIS], target[E_AXIS], 3000, active_extruder);
|
|
|
+ target[E_AXIS] += FIL_LOAD_LENGTH - 60;
|
|
|
+ plan_buffer_line(target[X_AXIS], target[Y_AXIS], target[Z_AXIS], target[E_AXIS], 1400, active_extruder);
|
|
|
+ target[E_AXIS] += 40;
|
|
|
+ plan_buffer_line(target[X_AXIS], target[Y_AXIS], target[Z_AXIS], target[E_AXIS], 400, active_extruder);
|
|
|
+ target[E_AXIS] += 10;
|
|
|
+ plan_buffer_line(target[X_AXIS], target[Y_AXIS], target[Z_AXIS], target[E_AXIS], 50, active_extruder);
|
|
|
+#else
|
|
|
+ target[E_AXIS] += FILAMENTCHANGE_FIRSTFEED;
|
|
|
+ plan_buffer_line(target[X_AXIS], target[Y_AXIS], target[Z_AXIS], target[E_AXIS], FILAMENTCHANGE_EFEED, active_extruder);
|
|
|
+#endif // SNMM
|
|
|
|
|
|
//Extrude some filament
|
|
|
target[E_AXIS]+= FILAMENTCHANGE_FINALFEED ;
|
|
@@ -5198,6 +5211,7 @@ case 404: //M404 Enter the nominal filament width (3mm, 1.75mm ) N<3.0> or disp
|
|
|
// Everything good
|
|
|
default:
|
|
|
lcd_change_success();
|
|
|
+ lcd_update_enable(true);
|
|
|
break;
|
|
|
}
|
|
|
|
|
@@ -5352,6 +5366,9 @@ case 404: //M404 Enter the nominal filament width (3mm, 1.75mm ) N<3.0> or disp
|
|
|
break;
|
|
|
case 702:
|
|
|
{
|
|
|
+#ifdef SNMM
|
|
|
+ extr_unload_all();
|
|
|
+#else
|
|
|
custom_message = true;
|
|
|
custom_message_type = 2;
|
|
|
lcd_setstatuspgm(MSG_UNLOADING_FILAMENT);
|
|
@@ -5363,7 +5380,7 @@ case 404: //M404 Enter the nominal filament width (3mm, 1.75mm ) N<3.0> or disp
|
|
|
lcd_setstatuspgm(WELCOME_MSG);
|
|
|
custom_message = false;
|
|
|
custom_message_type = 0;
|
|
|
-
|
|
|
+#endif
|
|
|
}
|
|
|
break;
|
|
|
|
|
@@ -5389,6 +5406,7 @@ case 404: //M404 Enter the nominal filament width (3mm, 1.75mm ) N<3.0> or disp
|
|
|
else {
|
|
|
tmp_extruder = code_value();
|
|
|
#ifdef SNMM
|
|
|
+ snmm_extruder = tmp_extruder;
|
|
|
|
|
|
st_synchronize();
|
|
|
delay(100);
|