Skip to content

Take picture on actual layer change#992

Draft
Magdiel3 wants to merge 4 commits intoprusa3d:masterfrom
Magdiel3:M3D-4-LayerSnapshotSaving
Draft

Take picture on actual layer change#992
Magdiel3 wants to merge 4 commits intoprusa3d:masterfrom
Magdiel3:M3D-4-LayerSnapshotSaving

Conversation

@Magdiel3
Copy link

@Magdiel3 Magdiel3 commented Aug 28, 2024

Instead of right when parsing the LAYER_CHANGE comment from PrusaSlicer generated gcode, add a listener(?) for a serial message coming from the Einsy board. This message is sent with the following gcode, which needs to be inserted at the desired spot in the gcode file.

M118 A1 action:photo

NOTE: M118 is a serial print command. The A1 will prepend a // to the message which is usually expected by OctoPrint and PrusaLink while the final part is the triggering string that was implemented.

Saving is done in ~/prusa/timelapses/<gcode_file_name>/<gcode_file_name>_0000.jpg and the numberin takes an ascending order based on the last number used.

Proposed addition in PrusaSlicer for Start GCode (at the very beginning):

{global x_park_timelapse=250}
{global y_park_timelapse=180}
{global wait_park_timelapse=250}

Proposed change in PrusaSlicer for After Layer Change

;AFTER_LAYER_CHANGE
{if wait_park_timelapse > 0}
G1 E-{retract_length[0]*0.525} F2100
G1 X{x_park_timelapse} Y{y_park_timelapse} F{travel_speed*60} ;Move away from the print
G4 S0 ;Wait for move to finish
;TIMELAPSE_SHOT
M118 A1 action:photo
G4 P{wait_park_timelapse} ;Wait for {wait_park_timelapse}ms
G1 E.{retract_length[0]*0.5} F1500
{endif}
;[layer_z]

@Magdiel3 Magdiel3 marked this pull request as draft August 28, 2024 04:36
Copy link
Author

@Magdiel3 Magdiel3 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will fix this typo later

Comment on lines 625 to 626
Triggers aphoto from the camera and stores it through
another command so later a timelapse can be created
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Triggers aphoto from the camera and stores it through
another command so later a timelapse can be created
Triggers a photo from the camera and stores it through
another command so when finished, a timelapse can be created

@Magdiel3
Copy link
Author

I was aiming on doing this PR on my Fork. Although I'm still planning on opening a PR once all changes have been done.

@Magdiel3 Magdiel3 closed this Aug 28, 2024
@TojikCZ
Copy link
Contributor

TojikCZ commented Aug 28, 2024

Hi, I tried doing this from observing the Z value, the code ended up being trash and the output wasn't that great. I tried supporting vase mode there too. Anway. I don't think we'd be doing this using saved pictures, instead uploading the pictures to connect. I respect you trying to make my code do a new thing. Hope it doesn't give you too many headaches.

output.mp4

@Magdiel3
Copy link
Author

Thanks for giving it a try. I had to also make some changes in Prusa-Connect-SDK-Printer.

If not an issue, could you share your approach with me? I just started with 3D printing a month ago and I’m doing this for fun so far. I do have similar issues because of not getting a good focus for the camera, is that what you meant from “Timelapse not bing very good”? Although I’m pleased with the results obtained so far from my side and I haven’t worked yet on rendering the Timelapse at print success and making the timelapses available form PrusaLink local server (that was my original approach as it is what I saw more chance of controlling from my side, rather than using Prusa Connect).

I can happily redirect my approach if you want to do that final implementation seems more adequate to the desired functionalities.

Btw, in working with a MK3S+ that, as mentioned, is the first 3D printer I got just a month ago, if not less.

@Magdiel3
Copy link
Author

These are some examples of the timelapses I can produce currently.

Video.de.WhatsApp.2024-08-21.a.las.17.33.45_30971d94.mp4
Video.de.WhatsApp.2024-08-21.a.las.17.52.38_51408abe.mp4

@Magdiel3
Copy link
Author

Magdiel3 commented Feb 9, 2025

Could this feature be considered to be merged? I can retake the effort on this and add corresponding testing if necessary.

@Magdiel3 Magdiel3 reopened this Feb 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants