From 8842d168321c9cce088a4114a3c6b1b83fba6bfe Mon Sep 17 00:00:00 2001 From: NotaRobotexe Date: Tue, 28 May 2019 13:50:21 +0200 Subject: [PATCH 1/2] add back uvlo tiny z positio --- Firmware/Marlin_main.cpp | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/Firmware/Marlin_main.cpp b/Firmware/Marlin_main.cpp index 982e2130..7352dae9 100644 --- a/Firmware/Marlin_main.cpp +++ b/Firmware/Marlin_main.cpp @@ -1008,6 +1008,10 @@ void setup() { mmu_init(); + #ifdef UVLO_SUPPORT + setup_uvlo_interrupt(); + #endif //UVLO_SUPPORT + ultralcd_init(); #if (LCD_BL_PIN != -1) && defined (LCD_BL_PIN) @@ -1296,10 +1300,6 @@ void setup() #endif //TMC2130 - #ifdef UVLO_SUPPORT - setup_uvlo_interrupt(); - #endif //UVLO_SUPPORT - st_init(); // Initialize stepper, this enables interrupts! #ifdef TMC2130 @@ -8686,7 +8686,6 @@ void serialecho_temperatures() { SERIAL_PROTOCOL_F(degBed(), 1); SERIAL_PROTOCOLLN(""); } - extern uint32_t sdpos_atomic; #ifdef UVLO_SUPPORT @@ -8850,9 +8849,11 @@ disable_z(); // Finaly store the "power outage" flag. //if(sd_print) - eeprom_update_byte((uint8_t*)EEPROM_UVLO,2); - -eeprom_update_word((uint16_t*)(EEPROM_UVLO_Z_MICROSTEPS),z_microsteps); +if(eeprom_read_byte((uint8_t*)EEPROM_UVLO)==1){ + eeprom_update_float((float*)(EEPROM_UVLO_TINY_CURRENT_POSITION_Z), current_position[Z_AXIS]); + eeprom_update_word((uint16_t*)(EEPROM_UVLO_Z_MICROSTEPS),z_microsteps); +} +eeprom_update_byte((uint8_t*)EEPROM_UVLO,2); // Increment power failure counter eeprom_update_byte((uint8_t*)EEPROM_POWER_COUNT, eeprom_read_byte((uint8_t*)EEPROM_POWER_COUNT) + 1); @@ -8923,10 +8924,11 @@ ISR(INT4_vect) { if(eeprom_read_byte((uint8_t*)EEPROM_UVLO)) uvlo_tiny(); } -void recover_print(uint8_t automatic) { +void recover_print(uint8_t automatic) { char cmd[30]; lcd_update_enable(true); lcd_update(2); + lcd_setstatuspgm(_i("Recovering print "));////MSG_RECOVERING_PRINT c=20 r=1 bool bTiny=(eeprom_read_byte((uint8_t*)EEPROM_UVLO)==2); recover_machine_state_after_power_panic(bTiny); //recover position, temperatures and extrude_multipliers // Lift the print head, so one may remove the excess priming material. @@ -8964,8 +8966,7 @@ void recover_machine_state_after_power_panic(bool bTiny) // Recover the logical coordinate of the Z axis at the time of the power panic. // The current position after power panic is moved to the next closest 0th full step. if(bTiny){ - current_position[Z_AXIS] = eeprom_read_float((float*)(EEPROM_UVLO_CURRENT_POSITION_Z)) + - UVLO_Z_AXIS_SHIFT + float((1024 - eeprom_read_word((uint16_t*)(EEPROM_UVLO_Z_MICROSTEPS)) + 7) >> 4) / cs.axis_steps_per_unit[Z_AXIS]; + current_position[Z_AXIS] = eeprom_read_float((float*)(EEPROM_UVLO_TINY_CURRENT_POSITION_Z)) + float((1024 - eeprom_read_word((uint16_t*)(EEPROM_UVLO_Z_MICROSTEPS)) + 7) >> 4) / cs.axis_steps_per_unit[Z_AXIS]; } else{ current_position[Z_AXIS] = eeprom_read_float((float*)(EEPROM_UVLO_CURRENT_POSITION_Z)) + @@ -9078,7 +9079,7 @@ void restore_print_from_eeprom() { strcat_P(cmd, PSTR(" F2000")); enquecommand(cmd); // Move the Z axis down to the print, in logical coordinates. - strcpy_P(cmd, PSTR("G1 Z")); strcat(cmd, ftostr32(current_position[Z_AXIS] - (UVLO_Z_AXIS_SHIFT + + strcpy_P(cmd, PSTR("G1 Z")); strcat(cmd, ftostr32( eeprom_read_float((float*)(EEPROM_UVLO_CURRENT_POSITION_Z)) - (UVLO_Z_AXIS_SHIFT + float((1024 - eeprom_read_word((uint16_t*)(EEPROM_UVLO_Z_MICROSTEPS)) + 7) >> 4) / cs.axis_steps_per_unit[Z_AXIS]))); enquecommand(cmd); // Unretract. @@ -9570,7 +9571,7 @@ void M600_load_filament_movements() st_synchronize(); } -void M600_load_filament() { +void M600_load_filament() { //TODO: ----- //load filament for single material and SNMM lcd_wait_interact(); From bcb6129c29e89b7f1c0752ee98f4396d35f1bd33 Mon Sep 17 00:00:00 2001 From: NotaRobotexe Date: Tue, 28 May 2019 14:11:38 +0200 Subject: [PATCH 2/2] delete comment --- Firmware/Marlin_main.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Firmware/Marlin_main.cpp b/Firmware/Marlin_main.cpp index 7352dae9..0bbe6a4e 100644 --- a/Firmware/Marlin_main.cpp +++ b/Firmware/Marlin_main.cpp @@ -9571,7 +9571,7 @@ void M600_load_filament_movements() st_synchronize(); } -void M600_load_filament() { //TODO: ----- +void M600_load_filament() { //load filament for single material and SNMM lcd_wait_interact();