From 790d023f7e43151bad124fe3f9cd6713276c1a67 Mon Sep 17 00:00:00 2001 From: pappicio <52137123+pappicio@users.noreply.github.com> Date: Sat, 30 Oct 2021 18:52:44 +0200 Subject: [PATCH] Add files via upload --- component/timelapse.py | 15 ++++++++++++--- klipper_macro/timelapse.cfg | 32 +++++++++++++++++++++++++++----- 2 files changed, 39 insertions(+), 8 deletions(-) diff --git a/component/timelapse.py b/component/timelapse.py index 5d5faec..f819c25 100644 --- a/component/timelapse.py +++ b/component/timelapse.py @@ -65,7 +65,7 @@ def __init__(self, confighelper: ConfigHelper) -> None: 'mode': "layermacro", 'camera': 0, 'snapshoturl': "http://localhost:8080/?action=snapshot", - 'gcode_verbose': True, + 'gcode_verbose': False, 'parkhead': False, 'parkpos': "back_left", 'park_custom_pos_x': 0.0, @@ -429,6 +429,7 @@ async def handle_status_update(self, status: str) -> None: ioloop = IOLoop.current() ioloop.spawn_callback(self.render) + def cleanup(self) -> None: logging.debug("cleanup frame directory") filelist = glob.glob(self.temp_dir + "frame*.jpg") @@ -488,12 +489,11 @@ def call_render(self, byrendermacro=False) -> None: self.byrendermacro = byrendermacro ioloop = IOLoop.current() ioloop.spawn_callback(self.render) - + async def render(self, webrequest=None): filelist = sorted(glob.glob(self.temp_dir + "frame*.jpg")) self.framecount = len(filelist) result = {'action': 'render'} - if not filelist: msg = "no frames to render, skip" status = "skipped" @@ -609,6 +609,15 @@ async def render(self, webrequest=None): self.out_dir + outfile + ".mp4") except OSError as err: logging.info(f"moving output file failed: {err}") + + gcommand = "_done_shutdown" + logging.debug(f"run gcommand: {gcommand}") + try: + await self.klippy_apis.run_gcode(gcommand) + except self.server.error: + msg = f"Error executing GCode {gcommand}" + logging.exception(msg) + # copy image preview if self.config['previewImage']: diff --git a/klipper_macro/timelapse.cfg b/klipper_macro/timelapse.cfg index c4f7a59..3373607 100644 --- a/klipper_macro/timelapse.cfg +++ b/klipper_macro/timelapse.cfg @@ -5,7 +5,7 @@ # # This file may be distributed under the terms of the GNU GPLv3 license # -# Macro version 1.1 +# Macro version 1.2 # ##### DO NOT CHANGE ANY MACRO!!! ##### @@ -15,6 +15,9 @@ # GET_TIMELAPSE_SETUP: Print the Timelapse setup to console # # # ########################################################################## +[gcode_macro get_timelapse_status] +gcode: + GET_TIMELAPSE_SETUP [gcode_macro GET_TIMELAPSE_SETUP] description: Print the Timelapse setup @@ -41,9 +44,10 @@ gcode: ############################################################################################### [gcode_macro _SET_TIMELAPSE_SETUP] -description: Set user parameters for timelaps +description: Set user parameters for timelapse gcode: ##### get dictonaries ##### + UPDATE_DELAYED_GCODE ID=_done_shutdown_timed DURATION=0 {% set enable = printer['gcode_macro TIMELAPSE_TAKE_FRAME'].enable %} {% set verbose = printer['gcode_macro TIMELAPSE_TAKE_FRAME'].verbose %} {% set park = printer['gcode_macro TIMELAPSE_TAKE_FRAME'].park %} @@ -239,12 +243,12 @@ gcode: {% endif %} {% else %} {% if verbose|lower == 'true' %} - {action_respond_info("Timelapse: take frame ignored")} + {action_respond_info("Timelapse: disabled, take frame ignored")} {% endif %} {% endif %} [gcode_macro _TIMELAPSE_NEW_FRAME] -description: action call for timelaps shoot. must be a seperate macro +description: action call for timelapse shoot. must be a seperate macro gcode: {% set hyperlapse = false %} {% if params.HYPERLAPSE is defined %} @@ -297,7 +301,7 @@ gcode: {action_respond_info("Hyperlapse: frames stopped")} UPDATE_DELAYED_GCODE ID=_HYPERLAPSE_LOOP DURATION=0 {% else %} - {action_respond_info("Hyperlapse: No falid input parameter + {action_respond_info("Hyperlapse: No valid input parameter Use: - HYPERLAPSE ACTION=START [CYCLE=time] - HYPERLAPSE ACTION=STOP")} @@ -342,3 +346,21 @@ gcode: RESUME_BASE {% endif %} +[gcode_macro _done_shutdown] +gcode: + UPDATE_DELAYED_GCODE ID=_done_shutdown_timer DURATION=0 + UPDATE_DELAYED_GCODE ID=_done_shutdown_timed DURATION=1 + +[delayed_gcode _done_shutdown_timed] +initial_duration: 0 +gcode: + {% if printer.extruder.temperature > 50 %} + UPDATE_DELAYED_GCODE ID=_done_shutdown_timed DURATION=1 + #m117 ciclo... + #m118 ciclo... + {% else %} + m117 spengo..... + m118 spengo..... + spegni_tutto + {% endif %} +