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

Improve post-processing scrirpt TimeLapse.py #19556

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 14 additions & 2 deletions plugins/PostProcessingPlugin/scripts/TimeLapse.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,21 @@ def getSettingDataString(self):
"type": "str",
"default_value": "M240"
},
"anti_shake_length":
{
"label": "Anti-shake length",
"description": "How long to wait (in ms) before capturing to reduce shake.",
"type": "int",
"default_value": 500,
"minimum_value": 0,
"unit": "ms"
},
"pause_length":
{
"label": "Pause length",
"description": "How long to wait (in ms) after camera was triggered.",
"type": "int",
"default_value": 700,
"default_value": 500,
"minimum_value": 0,
"unit": "ms"
},
Expand Down Expand Up @@ -92,6 +101,7 @@ def execute(self, data):
x_park = self.getSettingValueByKey("head_park_x")
y_park = self.getSettingValueByKey("head_park_y")
trigger_command = self.getSettingValueByKey("trigger_command")
anti_shake_length = self.getSettingValueByKey("anti_shake_length")
pause_length = self.getSettingValueByKey("pause_length")
retract = int(self.getSettingValueByKey("retract"))
zhop = self.getSettingValueByKey("zhop")
Expand All @@ -104,6 +114,7 @@ def execute(self, data):
gcode_to_append += self.putValue(G=1, F=feed_rate,
X=x_park, Y=y_park) + " ;Park print head\n"
gcode_to_append += self.putValue(M=400) + " ;Wait for moves to finish\n"
gcode_to_append += self.putValue(G=4, P=anti_shake_length) + " ;Wait for camera\n"
gcode_to_append += trigger_command + " ;Snap Photo\n"
gcode_to_append += self.putValue(G=4, P=pause_length) + " ;Wait for camera\n"

Expand All @@ -129,7 +140,8 @@ def execute(self, data):
layer += gcode_to_append

if zhop != 0:
layer += self.putValue(G=0, X=last_x, Y=last_y, Z=last_z) + "; Restore position \n"
layer += self.putValue(G=0, X=last_x, Y=last_y) + "; Restore position \n"
layer += self.putValue(G=0, Z=last_z) + "; Restore position \n"
else:
layer += self.putValue(G=0, X=last_x, Y=last_y) + "; Restore position \n"

Expand Down
Loading