Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enabling SD power recovery #11341

Closed
mogey336 opened this issue Jul 23, 2018 · 35 comments
Closed

Enabling SD power recovery #11341

mogey336 opened this issue Jul 23, 2018 · 35 comments

Comments

@mogey336
Copy link

How can i enable SD power recovery?Do i need a hardware (power detection circuit)?

@cjsoong
Copy link

cjsoong commented Jul 23, 2018

  1. Configuration_adv.h
#define POWER_LOSS_RECOVERY // ..........Enable
#if ENABLED(POWER_LOSS_RECOVERY)
  //#define POWER_LOSS_PIN   44     // Pin to detect power loss
  //#define POWER_LOSS_STATE HIGH   // State of pin indicating power loss
  1. power_loss_recovery.h
#define SAVE_EACH_CMD_MODE // .......Enable

@mogey336
Copy link
Author

mogey336 commented Jul 23, 2018

Thanks for your reply cjsoong
In configuration_adv.h
When i enable power_loss_recovery do i need to connect any hardware to pin 44 or just enabling it?

@mogey336
Copy link
Author

mogey336 commented Jul 23, 2018

I have a other question
I have version 1.1.x i didn't find the power_loss in Configuration_adv.h
I installed bugfix-1.1.x , i just copy what inside bugfix folder to my original firmware(1.1.x) or what?

@cjsoong
Copy link

cjsoong commented Jul 24, 2018

@mogey336
You need to download the new bugfix 1.1x to replace your old firmware and then set your machine parameters.
    Hardware is detecting AC power failure, if you don't have this feature, you don't need it.

@takno91
Copy link

takno91 commented Jul 26, 2018

Marlin-bugfix-1.1.x it Marlin-bugfix-1.1.x shifted axis z valu 2mm after homeing power loss
how fix this?

@mogey336
Copy link
Author

@takno91 same problem

@cjsoong
Copy link

cjsoong commented Jul 26, 2018

@mogey336 @takno91 Modify this
power_loss_recovery.cpp

  1. Line 141: // strcpy_P(job_recovery_commands[ind++], PSTR("G1 Z2"));
  2. Line 161: dtostrf(job_recovery_info.current_position[Z_AXIS] + 2, 1, 3, str_1);
    --> dtostrf(job_recovery_info.current_position[Z_AXIS] , 1, 3, str_1);

@takno91
Copy link

takno91 commented Jul 26, 2018

@cjsoong cjsoong
Thanks very very very much
You helped me and saved him a great effort. I wish you happiness in this life

@mogey336
Copy link
Author

@cjsoong
I edited the
line 141 strcpy_P(job_recovery_commands[ind++], PSTR("G1 Z0"));
line 161 dtostrf(job_recovery_info.current_position[Z_AXIS] , 1, 3, str_1)
Same problem shifted axis z value 2mm
Any ideas?

@cjsoong
Copy link

cjsoong commented Jul 28, 2018

@mogey336 Try this change, my test is OK

ultralcd.cpp Line 880:

        #elif !IS_KINEMATIC
-         "  X Y"
+         "  R0 X Y"

@fovarart
Copy link

fovarart commented Aug 5, 2018

i have tried all of it but some times it moves 1.5mm and some times 6mm any idea..?

@jhonf441
Copy link

to use the function, it is necessary to activate EEPROM?

@AnHardt
Copy link
Member

AnHardt commented Aug 17, 2018

to use the function, it is necessary to activate EEPROM?

Yes. That's where the state data can survive.

@cjsoong
Copy link

cjsoong commented Aug 17, 2018

@jhonf441 POWER_LOSS_RECOVERY is to write data to the SD card. Not written to the EEPROM.

@GeekAbdou
Copy link

I've The Same Problem .. The First Resume Survive But Any Resume After It Z axis Shifted 2 , 4, 6 mm each time @cjsoong Thank You For Contributing ^^

@gonzalo11
Copy link

same problem any solution ?

@gonzalo11
Copy link

the first print resume is fine but in the second it start from a correct z level but make only one layer and then level up to high and print

@thinkyhead
Copy link
Member

Power Loss Recovery is still very new and needs more refinement. For example, you cannot resume a file in a sub-folder right now, and it uses much more SRAM than necessary. It will be getting an overhaul very soon to address these issues, and we'll probably figure out the failed second resume issue also.

@walidsmart
Copy link

same problem any solution ?

@thinkyhead
Copy link
Member

I'll be working on the feature later this week.

@walidsmart
Copy link

i waiting you thanks so much

@apaltd
Copy link

apaltd commented Nov 15, 2018

hi no progress in the topic yet?

@apaltd
Copy link

apaltd commented Nov 15, 2018

i checked for the problem, the current position for Z axis is not written in the resume file, so after resume, firmware can't define Z axis position and it blinks question mark.

@thinkyhead
Copy link
Member

thinkyhead commented Nov 15, 2018

the current position for Z axis is not written in the resume file

power_loss_recovery.cpp lines 252-253:

// Machine state
COPY(job_recovery_info.current_position, current_position);

power_loss_recovery.cpp lines 185-192:

dtostrf(job_recovery_info.current_position[Z_AXIS] + 2, 1, 3, str_1);
dtostrf(job_recovery_info.current_position[E_AXIS]
  #if ENABLED(SAVE_EACH_CMD_MODE)
    - 5
  #endif
  , 1, 3, str_2
);
sprintf_P(job_recovery_commands[ind++], PSTR("G92.0 Z%s E%s"), str_1, str_2); // Current Z + 2 and E

If the position is blinking, this is because the axis_known_position and axis_homed bits are not being set to 0x07.

@thinkyhead
Copy link
Member

thinkyhead commented Nov 16, 2018

See #12440 for an updated and optimized version of Power-Loss Recovery. Needs testing. Enable the DEBUG_POWER_LOSS_RECOVERY option in power_loss_recovery.h to get extra output to the serial console when recovering. (You should be able to connect a host when the "Resume"/"Cancel" menu appears and it will go back to recovery mode when it reboots.)

@sparky1510
Copy link

Where does it write the saved information to is it the sd card or eeprom
I'm assuming it must be the eeprom as it works if your printing directly from pc or pi or whatever you use or do you need a blank sd card in to save the file
How's it work

@blueeagle69
Copy link

As far as I am aware recovery data is saved on the sd card

@hechen2019
Copy link

hello,Are there any updates about powerlosss recovery ?
I used marlin1.1.9,I has the same problem 。First resume no problem,but the second time ,the Z AXIS postion is wrong,I see, the second time ,IF powerloss trigger at Z height 5mm,resume print,the first layer is right,but the second layer,Z Move up about 5mm,LCD display Z 5mm(The actual distance from the platform is about 10 mm.), the actual Z position does not match the coordinates displayed by the LCD at second layer,So nozzle hanging printing。

@ShriganeshBorse
Copy link

I have marlin 2.0.x latest, I have enabled POWER_LOSS_RECOVERY and have MKS DET Power outage detection module connected to P44 , it is HIGH with we have POWER and LOW when there is no Power so I have changed POWER_LOSS_STATE to LOW.
On power outage LCD is is up for about 2 to 3 sec so I assume that is enough time to store state on SD card
But this does not seem to work
I have ensure that power outage module works by checking with M43 P44

Without power
SENDING:M43 P44
PIN: 44 Port: L5 E_MUX2_PIN Input = 0 TIMER5C PWM: 0 WGM: 1 COM5C: 0 CS: 3 TCCR5A: 1 TCCR5B: 3 TIMSK5: 0
. E1_CS_PIN Input = 0

M43 P44

With Power
SENDING:M43 P44
PIN: 44 Port: L5 E_MUX2_PIN Input = 1 TIMER5C PWM: 0 WGM: 1 COM5C: 0 CS: 3 TCCR5A: 1 TCCR5B: 3 TIMSK5: 0
. E1_CS_PIN Input = 0

I am not sure what I am missing here

@apaltd
Copy link

apaltd commented Apr 12, 2020

Hi, upgraded to Marlin bugfix2, un-commented power_loss_recovery. not using any pin for power outage and after each layer marlin writes in PLR file on Sd card but after power outage and re plug, no resume print appears? any help will be appreciated.

@thinkyhead
Copy link
Member

Download bugfix-2.0.x and see if the patch just applied fixes things. It worked for me.

@apaltd
Copy link

apaltd commented Apr 13, 2020

thanks for reply, i'll check it.

@TheMiguelBi
Copy link

Scarica bugfix-2.0.xe vedi se la patch appena applicata risolve le cose. Ha funzionato per me.

Hi thinkyhead,
When the power returns, even with the latest version, no pop-up window appears for recovery.
I noticed, however, that if you start a new print from the same SD you used to print with before, the superimposed window asking to "resume or delete" appears.
Printing resumes regularly (I have other problems with Z offset that I am trying to solve, but printing resumes).

(I don't know how it worked in previous versions. I am new to this)

@TheMiguelBi
Copy link

Download bugfix-2.0.x and see if the patch just applied fixes things. It worked for me.

My post above is not entirely correct. Today I was able to deepen with other tests.

  • Everything works regularly using an LCD12864 display or using a TFT35 display simulating an LCD display.
    The print recovery window appears, printing can be resumed, the coordinates are regular, etc. etc.

  • The problem is using the BTT_TFT35_E3 display in graphic mode (via RS232). Nothing works here!

Here I have tried to explain the problem in detail:
bigtreetech/BIGTREETECH-TouchScreenFirmware#644 (comment)

I think the problems are in the BTT display firmware and not in Marlin.

@github-actions
Copy link

github-actions bot commented Jul 1, 2020

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked and limited conversation to collaborators Jul 1, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests