From dd02cf5cd274cffd11418495ea4c30cb78bb3686 Mon Sep 17 00:00:00 2001 From: Ton Date: Sat, 31 Aug 2024 17:35:33 +0200 Subject: [PATCH] working until I fucked up --- firmware/config/.moonraker.conf.bkp | 52 ++ firmware/config/KlipperScreen.conf | 10 + firmware/config/MKS_THR.cfg | 26 + firmware/config/crowsnest.conf | 35 ++ firmware/config/fluidd.cfg | 71 +++ firmware/config/mainsail.bak.cfg | 222 +++++++ firmware/config/mainsail.cfg | 237 ++++++++ firmware/config/moonraker-obico-update.cfg | 9 + firmware/config/moonraker-obico.cfg | 14 + firmware/config/moonraker.conf | 64 ++ firmware/config/octoeverywhere-system.cfg | 20 + firmware/config/octoeverywhere.conf | 34 ++ firmware/config/printer.cfg | 653 +++++++++++++++++++++ firmware/config/telegram.conf | 20 + 14 files changed, 1467 insertions(+) create mode 100644 firmware/config/.moonraker.conf.bkp create mode 100644 firmware/config/KlipperScreen.conf create mode 100644 firmware/config/MKS_THR.cfg create mode 100644 firmware/config/crowsnest.conf create mode 100644 firmware/config/fluidd.cfg create mode 100644 firmware/config/mainsail.bak.cfg create mode 100644 firmware/config/mainsail.cfg create mode 100644 firmware/config/moonraker-obico-update.cfg create mode 100644 firmware/config/moonraker-obico.cfg create mode 100644 firmware/config/moonraker.conf create mode 100644 firmware/config/octoeverywhere-system.cfg create mode 100644 firmware/config/octoeverywhere.conf create mode 100644 firmware/config/printer.cfg create mode 100644 firmware/config/telegram.conf diff --git a/firmware/config/.moonraker.conf.bkp b/firmware/config/.moonraker.conf.bkp new file mode 100644 index 0000000..10f9386 --- /dev/null +++ b/firmware/config/.moonraker.conf.bkp @@ -0,0 +1,52 @@ +[server] +host = 0.0.0.0 +port = 7125 +klippy_uds_address = /home/mks/printer_data/comms/klippy.sock + +[authorization] +trusted_clients = + 10.0.0.0/8 + 127.0.0.0/8 + 169.254.0.0/16 + 172.16.0.0/12 + 192.168.0.0/16 + FE80::/10 + ::1/128 +cors_domains = + *.lan + *.local + *://localhost + *://localhost:* + *://my.mainsail.xyz + *://app.fluidd.xyz + +[file_manager] +enable_object_processing = True + +[octoprint_compat] + +[history] + +[update_manager moonraker-telegram-bot] +type = git_repo +path = ~/moonraker-telegram-bot +origin = https://github.com/nlef/moonraker-telegram-bot.git +env = ~/moonraker-telegram-bot-env/bin/python +requirements = scripts/requirements.txt +install_script = scripts/install.sh + +[update_manager octoeverywhere] +type = git_repo +channel = beta +path = /home/mks/octoeverywhere +origin = https://github.com/QuinnDamerell/OctoPrint-OctoEverywhere.git +env = /home/mks/octoeverywhere-env/bin/python +requirements = requirements.txt +install_script = install.sh +managed_services = + octoeverywhere + +[announcements] +subscriptions = + octoeverywhere + diff --git a/firmware/config/KlipperScreen.conf b/firmware/config/KlipperScreen.conf new file mode 100644 index 0000000..d07f86e --- /dev/null +++ b/firmware/config/KlipperScreen.conf @@ -0,0 +1,10 @@ +[main] +language = chinese_simple + +#~# --- Do not edit below this line. This section is auto generated --- #~# +#~# +#~# [main] +#~# language = en +#~# font_size = extralarge +#~# print_sort_dir = date_desc +#~# diff --git a/firmware/config/MKS_THR.cfg b/firmware/config/MKS_THR.cfg new file mode 100644 index 0000000..d9dfe49 --- /dev/null +++ b/firmware/config/MKS_THR.cfg @@ -0,0 +1,26 @@ +##################################################################### +# KINGROON KLP1 V2.2-230 +#################################################################### +[mcu MKS_THR] +serial:/dev/ttyS0 +restart_method: command +##################################################################### +# 风扇 +##################################################################### +[fan] +pin:MKS_THR:gpio3 +cycle_time: 0.0010 + +[heater_fan Fan1] +pin: MKS_THR:gpio11 +shutdown_speed: 1 +##################################################################### +# 自动调平和偏移 +##################################################################### +[bed_mesh] +speed:150 #调平速度 +horizontal_move_z:8 #调平中Z抬高高度 +mesh_min:10,20 #探测点最小位置 +mesh_max:210,220 #探测点最大位置 +probe_count:6,6 #调平点数 + diff --git a/firmware/config/crowsnest.conf b/firmware/config/crowsnest.conf new file mode 100644 index 0000000..5959f5a --- /dev/null +++ b/firmware/config/crowsnest.conf @@ -0,0 +1,35 @@ +#### crowsnest.conf +#### This is a typical default config. +#### Also used as default in mainsail / MainsailOS +#### See: +#### https://github.com/mainsail-crew/crowsnest/blob/master/README.md +#### for details to configure to your needs. + + +##################################################################### +#### ##### +#### Information about ports and according URL's ##### +#### ##### +##################################################################### +#### ##### +#### Port 8080 equals /webcam/?action=[stream/snapshot] ##### +#### Port 8081 equals /webcam2/?action=[stream/snapshot] ##### +#### Port 8082 equals /webcam3/?action=[stream/snapshot] ##### +#### Port 8083 equals /webcam4/?action=[stream/snapshot] ##### +#### ##### +##################################################################### + + +[crowsnest] +log_path: ~/printer_data/logs/crowsnest.log +log_level: verbose # Valid Options are quiet/verbose/debug +delete_log: false # Deletes log on every restart, if set to true + +[cam 1] +mode: mjpg # mjpg/rtsp +port: 8080 # Port +device: /dev/video4 # See Log for available ... +resolution: 640x480 # widthxheight format +max_fps: 15 # If Hardware Supports this it will be forced, otherwise ignored/coerced. +#custom_flags: # You can run the Stream Services with custom flags. +#v4l2ctl: # Add v4l2-ctl parameters to setup your camera, see Log what your cam is capable of. diff --git a/firmware/config/fluidd.cfg b/firmware/config/fluidd.cfg new file mode 100644 index 0000000..483ae6a --- /dev/null +++ b/firmware/config/fluidd.cfg @@ -0,0 +1,71 @@ +[virtual_sdcard] +path: /home/mks/printer_data/gcodes + + +[pause_resume] + +[display_status] + +[gcode_macro CANCEL_PRINT] +description: Cancel the actual running print +rename_existing: CANCEL_PRINT_BASE +gcode: + TURN_OFF_HEATERS + CANCEL_PRINT_BASE + +[gcode_macro PAUSE] +description: Pause the actual running print +rename_existing: PAUSE_BASE +# change this if you need more or less extrusion +variable_extrude: 1.0 +gcode: + ##### read E from pause macro ##### + {% set E = printer["gcode_macro PAUSE"].extrude|float %} + ##### set park positon for x and y ##### + # default is your max posion from your printer.cfg + {% set x_park = printer.toolhead.axis_maximum.x|float - 5.0 %} + {% set y_park = printer.toolhead.axis_maximum.y|float - 5.0 %} + ##### calculate save lift position ##### + {% set max_z = printer.toolhead.axis_maximum.z|float %} + {% set act_z = printer.toolhead.position.z|float %} + {% if act_z < (max_z - 2.0) %} + {% set z_safe = 2.0 %} + {% else %} + {% set z_safe = max_z - act_z %} + {% endif %} + ##### end of definitions ##### + PAUSE_BASE + G91 + {% if printer.extruder.can_extrude|lower == 'true' %} + G1 E-{E} F2100 + {% else %} + {action_respond_info("Extruder not hot enough")} + {% endif %} + {% if "xyz" in printer.toolhead.homed_axes %} + G1 Z{z_safe} F900 + G90 + G1 X{x_park} Y{y_park} F6000 + {% else %} + {action_respond_info("Printer not homed")} + {% endif %} + +[gcode_macro RESUME] +description: Resume the actual running print +rename_existing: RESUME_BASE +gcode: + ##### read E from pause macro ##### + {% set E = printer["gcode_macro PAUSE"].extrude|float %} + #### get VELOCITY parameter if specified #### + {% if 'VELOCITY' in params|upper %} + {% set get_params = ('VELOCITY=' + params.VELOCITY) %} + {%else %} + {% set get_params = "" %} + {% endif %} + ##### end of definitions ##### + {% if printer.extruder.can_extrude|lower == 'true' %} + G91 + G1 E{E} F2100 + {% else %} + {action_respond_info("Extruder not hot enough")} + {% endif %} + RESUME_BASE {get_params} \ No newline at end of file diff --git a/firmware/config/mainsail.bak.cfg b/firmware/config/mainsail.bak.cfg new file mode 100644 index 0000000..01cbc70 --- /dev/null +++ b/firmware/config/mainsail.bak.cfg @@ -0,0 +1,222 @@ +## Client klipper macro definitions +## +## Copyright (C) 2022 Alex Zellner +## +## This file may be distributed under the terms of the GNU GPLv3 license + +## add [include mainsail.cfg] to your printer.cfg + +## Customization: +## copy the following macro to your printer.cfg (outside of mainsail.cfg) + +#[gcode_macro _CLIENT_VARIABLE] +#variable_use_custom_pos : False ; use custom park coordinates for x,y [True/False] +#variable_custom_park_x : 0.0 ; custom x position; value must be within your defined min and max of X +#variable_custom_park_y : 0.0 ; custom y position; value must be within your defined min and max of Y +#variable_custom_park_dz : 2.0 ; custom dz value; the value in mm to lift the nozzle when move to park position +#variable_retract : 1.0 ; the value to retract while PAUSE +#variable_cancel_retract : 5.0 ; the value to retract while CANCEL_PRINT +#variable_speed_retract : 35.0 ; retract speed in mm/s +#variable_unretract : 1.0 ; the value to unretract while RESUME +#variable_speed_unretract : 35.0 ; unretract speed in mm/s +#variable_speed_hop : 15.0 ; z move speed in mm/s +#variable_speed_move : 100.0 ; move speed in mm/s +#variable_park_at_cancel : False ; allow to move the toolhead to park while execute CANCEL_PRINT [True,False] +## !!! Caution [firmware_retraction] must be defined in the printer.cfg if you set use_fw_retract: True !!! +#variable_use_fw_retract : False ; use fw_retraction instead of the manual version [True/False] +#gcode: + +## After you uncomment it add your custom values + +## You now can use your PAUSE macro direct in your M600 here a short example: + +#[gcode_macro M600] +#description: Filament change +#gcode: PAUSE X=10 Y=10 Z_MIN=50 + +## That will park your head front left with a minimum height of 50mm above the bed. If your head +## is already above 50mm it will use only the z_hop specified with dz. + +[virtual_sdcard] +path: ~/printer_data/gcodes +on_error_gcode: CANCEL_PRINT + +[pause_resume] + +[display_status] + +[gcode_macro CANCEL_PRINT] +description: Cancel the actual running print +rename_existing: CANCEL_PRINT_BASE +gcode: + ##### get user parameters or use default ##### + {% set macro_found = True if printer['gcode_macro _CLIENT_VARIABLE'] is defined else False %} + {% set client = printer['gcode_macro _CLIENT_VARIABLE'] %} + {% set allow_park = False if not macro_found + else False if client.park_at_cancel is not defined + else True if client.park_at_cancel|lower == 'true' + else False %} + {% set retract = 5.0 if not macro_found else client.cancel_retract|default(5.0)|abs %} + ##### end of definitions ##### + {% if not printer.pause_resume.is_paused and allow_park %} _TOOLHEAD_PARK_PAUSE_CANCEL {% endif %} + _CLIENT_RETRACT LENGTH={retract} + TURN_OFF_HEATERS + M106 S0 + # clear pause_next_layer and pause_at_layer as preparation for next print + SET_GCODE_VARIABLE MACRO=SET_PRINT_STATS_INFO VARIABLE=pause_next_layer VALUE="{{'enable': False, 'call':"PAUSE"}}" + SET_GCODE_VARIABLE MACRO=SET_PRINT_STATS_INFO VARIABLE=pause_at_layer VALUE="{{'enable': False, 'layer': 0, 'call':"PAUSE"}}" + CANCEL_PRINT_BASE + +[gcode_macro PAUSE] +description: Pause the actual running print +rename_existing: PAUSE_BASE +gcode: + PAUSE_BASE + _TOOLHEAD_PARK_PAUSE_CANCEL {rawparams} + +[gcode_macro RESUME] +description: Resume the actual running print +rename_existing: RESUME_BASE +gcode: + ##### get user parameters or use default ##### + {% set macro_found = True if printer['gcode_macro _CLIENT_VARIABLE'] is defined else False %} + {% set client = printer['gcode_macro _CLIENT_VARIABLE'] %} + {% set velocity = printer.configfile.settings.pause_resume.recover_velocity %} + {% set sp_move = velocity if not macro_found else client.speed_move|default(velocity) %} + ##### end of definitions ##### + _CLIENT_EXTRUDE + RESUME_BASE VELOCITY={params.VELOCITY|default(sp_move)} + +# Usage: SET_PAUSE_NEXT_LAYER [MACRO=] +[gcode_macro SET_PAUSE_NEXT_LAYER] +description: Enable a pause if the next layer is reached +gcode: SET_GCODE_VARIABLE MACRO=SET_PRINT_STATS_INFO VARIABLE=pause_next_layer VALUE="{{'enable':True, 'call':params.MACRO|default("PAUSE")}}" + +# Usage: SET_PAUSE_AT_LAYER [LAYER=] [MACRO=] +[gcode_macro SET_PAUSE_AT_LAYER] +description: Enable/disable a pause if a given layer number is reached +gcode: + {% if params.LAYER is defined %} + SET_GCODE_VARIABLE MACRO=SET_PRINT_STATS_INFO VARIABLE=pause_at_layer VALUE="{{'enable': True, 'layer':params.LAYER|int, 'call':params.MACRO|default("PAUSE")}}" + {% else %} + SET_GCODE_VARIABLE MACRO=SET_PRINT_STATS_INFO VARIABLE=pause_at_layer VALUE="{{'enable': False, 'layer':0, 'call':"PAUSE"}}" + {% endif %} + +# Usage: SET_PRINT_STATS_INFO [TOTAL_LAYER=] [CURRENT_LAYER= ] +[gcode_macro SET_PRINT_STATS_INFO] +rename_existing: SET_PRINT_STATS_INFO_BASE +description: Overwrite, to get pause_next_layer and pause_at_layer feature +variable_pause_next_layer: {'enable':False, 'call':"PAUSE"} +variable_pause_at_layer : {'enable':False, 'layer':0, 'call':"PAUSE"} +gcode: + {% if pause_next_layer.enable %} + {action_respond_info("%s, forced by pause_next_layer" % pause_next_layer.call)} + {pause_next_layer.call} ; execute the given gcode to pause, should be either M600 or PAUSE + SET_GCODE_VARIABLE MACRO=SET_PRINT_STATS_INFO VARIABLE=pause_next_layer VALUE="{{'enable': False, 'call':"PAUSE"}}" + {% elif pause_at_layer.enable and params.CURRENT_LAYER is defined and params.CURRENT_LAYER|int == pause_at_layer.layer %} + {action_respond_info("%s, forced by pause_at_layer [%d]" % (pause_at_layer.call, pause_at_layer.layer))} + {pause_at_layer.call} ; execute the given gcode to pause, should be either M600 or PAUSE + SET_GCODE_VARIABLE MACRO=SET_PRINT_STATS_INFO VARIABLE=pause_at_layer VALUE="{{'enable': False, 'layer': 0, 'call':"PAUSE"}}" + {% endif %} + SET_PRINT_STATS_INFO_BASE {rawparams} + +##### internal use ##### +[gcode_macro _TOOLHEAD_PARK_PAUSE_CANCEL] +description: Helper: park toolhead used in PAUSE and CANCEL_PRINT +gcode: + ##### get user parameters or use default ##### + {% set macro_found = True if printer['gcode_macro _CLIENT_VARIABLE'] is defined else False %} + {% set client = printer['gcode_macro _CLIENT_VARIABLE'] %} + {% set velocity = printer.configfile.settings.pause_resume.recover_velocity %} + {% set use_custom = False if not macro_found + else False if client.use_custom_pos is not defined + else True if client.use_custom_pos|lower == 'true' + else False %} + {% set custom_park_x = 0.0 if not macro_found else client.custom_park_x|default(0.0) %} + {% set custom_park_y = 0.0 if not macro_found else client.custom_park_y|default(0.0) %} + {% set park_dz = 2.0 if not macro_found else client.custom_park_dz|default(2.0)|abs %} + {% set sp_hop = 900 if not macro_found else client.speed_hop|default(15) * 60 %} + {% set sp_move = velocity * 60 if not macro_found else client.speed_move|default(velocity) * 60 %} + ##### get config and toolhead values ##### + {% set origion = printer.gcode_move.homing_origin %} + {% set act = printer.gcode_move.gcode_position %} + {% set max = printer.toolhead.axis_maximum %} + {% set cone = printer.toolhead.cone_start_z|default(max.z) %} ; height as long the toolhead can reach max and min of an delta + {% set round_bed = True if printer.configfile.settings.printer.kinematics is in ['delta','polar','rotary_delta','winch'] + else False %} + ##### define park position ##### + {% set z_min = params.Z_MIN|default(0)|float %} + {% set z_park = [[(act.z + park_dz), z_min]|max, (max.z - origion.z)]|min %} + {% set x_park = params.X if params.X is defined + else custom_park_x if use_custom + else 0.0 if round_bed + else (max.x - 5.0) %} + {% set y_park = params.Y if params.Y is defined + else custom_park_y if use_custom + else (max.y - 5.0) if round_bed and z_park < cone + else 0.0 if round_bed + else (max.y - 5.0) %} + ##### end of definitions ##### + _CLIENT_RETRACT + {% if "xyz" in printer.toolhead.homed_axes %} + G90 + G1 Z{z_park} F{sp_hop} + G1 X{x_park} Y{y_park} F{sp_move} + {% if not printer.gcode_move.absolute_coordinates %} G91 {% endif %} + {% else %} + {action_respond_info("Printer not homed")} + {% endif %} + +[gcode_macro _CLIENT_EXTRUDE] +description: Extrudes, if the extruder is hot enough +gcode: + {% set macro_found = True if printer['gcode_macro _CLIENT_VARIABLE'] is defined else False %} + {% set client = printer['gcode_macro _CLIENT_VARIABLE'] %} + {% set use_fw_retract = False if not macro_found + else False if client.use_fw_retract is not defined + else True if client.use_fw_retract|lower == 'true' and printer.firmware_retraction is defined + else False %} + + {% set length = (params.LENGTH|float) if params.LENGTH is defined + else 1.0 if not macro_found + else client.unretract|default(1.0) %} + + {% set speed = params.SPEED if params.SPEED is defined + else 35 if not macro_found + else client.speed_unretract|default(35) %} + + {% set absolute_extrude = printer.gcode_move.absolute_extrude %} + + {% if printer.extruder.can_extrude %} + {% if use_fw_retract %} + {% if length < 0 %} + G10 + {% else %} + G11 + {% endif %} + {% else %} + M83 + G1 E{length} F{(speed|float|abs) * 60} + {% if absolute_extrude %} + M82 + {% endif %} + {% endif %} + {% else %} + {action_respond_info("Extruder not hot enough")} + {% endif %} + +[gcode_macro _CLIENT_RETRACT] +description: Retracts, if the extruder is hot enough +gcode: + {% set macro_found = True if printer['gcode_macro _CLIENT_VARIABLE'] is defined else False %} + {% set client = printer['gcode_macro _CLIENT_VARIABLE'] %} + + {% set length = (params.LENGTH|float) if params.LENGTH is defined + else 1.0 if not macro_found + else client.retract|default(1.0) %} + + {% set speed = params.SPEED if params.SPEED is defined + else 35 if not macro_found + else client.speed_retract|default(35) %} + + _CLIENT_EXTRUDE LENGTH=-{length|float|abs} SPEED={speed|float|abs} diff --git a/firmware/config/mainsail.cfg b/firmware/config/mainsail.cfg new file mode 100644 index 0000000..d1d4c14 --- /dev/null +++ b/firmware/config/mainsail.cfg @@ -0,0 +1,237 @@ +## Client klipper macro definitions +## +## Copyright (C) 2022 Alex Zellner +## +## This file may be distributed under the terms of the GNU GPLv3 license +## +## !!! This file is read-only. Maybe the used editor indicates that. !!! +## +## Customization: +## 1) copy the gcode_macro _CLIENT_VARIABLE (see below) to your printer.cfg +## 2) remove the comment mark (#) from all lines +## 3) change any value in there to your needs +## +## Use the PAUSE macro direct in your M600: +## e.g. with a different park position front left and a minimal height of 50 +## [gcode_macro M600] +## description: Filament change +## gcode: PAUSE X=10 Y=10 Z_MIN=50 +## Z_MIN will park the toolhead at a minimum of 50 mm above to bed to make it easier for you to swap filament. +## +## Client variable macro for your printer.cfg +#[gcode_macro _CLIENT_VARIABLE] +#variable_use_custom_pos : False ; use custom park coordinates for x,y [True/False] +#variable_custom_park_x : 0.0 ; custom x position; value must be within your defined min and max of X +#variable_custom_park_y : 0.0 ; custom y position; value must be within your defined min and max of Y +#variable_custom_park_dz : 2.0 ; custom dz value; the value in mm to lift the nozzle when move to park position +#variable_retract : 1.0 ; the value to retract while PAUSE +#variable_cancel_retract : 5.0 ; the value to retract while CANCEL_PRINT +#variable_speed_retract : 35.0 ; retract speed in mm/s +#variable_unretract : 1.0 ; the value to unretract while RESUME +#variable_speed_unretract : 35.0 ; unretract speed in mm/s +#variable_speed_hop : 15.0 ; z move speed in mm/s +#variable_speed_move : 100.0 ; move speed in mm/s +#variable_park_at_cancel : False ; allow to move the toolhead to park while execute CANCEL_PRINT [True/False] +#variable_park_at_cancel_x : None ; different park position during CANCEL_PRINT [None/Position as Float]; park_at_cancel must be True +#variable_park_at_cancel_y : None ; different park position during CANCEL_PRINT [None/Position as Float]; park_at_cancel must be True +## !!! Caution [firmware_retraction] must be defined in the printer.cfg if you set use_fw_retract: True !!! +#variable_use_fw_retract : False ; use fw_retraction instead of the manual version [True/False] +#gcode: + +[virtual_sdcard] +path: ~/printer_data/gcodes +on_error_gcode: CANCEL_PRINT + +[pause_resume] + +[display_status] + +[gcode_macro CANCEL_PRINT] +description: Cancel the actual running print +rename_existing: CANCEL_PRINT_BASE +gcode: + ##### get user parameters or use default ##### + {% set macro_found = True if printer['gcode_macro _CLIENT_VARIABLE'] is defined else False %} + {% set client = printer['gcode_macro _CLIENT_VARIABLE'] %} + {% set allow_park = False if not macro_found + else False if client.park_at_cancel is not defined + else True if client.park_at_cancel|lower == 'true' + else False %} + {% set retract = 5.0 if not macro_found else client.cancel_retract|default(5.0)|abs %} + ##### define park position ##### + {% set park_x = "" if not macro_found + else "" if client.park_at_cancel_x is not defined + else "X=" + client.park_at_cancel_x|string if client.park_at_cancel_x is not none %} + {% set park_y = "" if not macro_found + else "" if client.park_at_cancel_y is not defined + else "Y=" + client.park_at_cancel_y|string if client.park_at_cancel_y is not none %} + {% set custom_park = True if (park_x|length > 0 or park_y|length > 0) else False %} + ##### end of definitions ##### + {% if (custom_park or not printer.pause_resume.is_paused) and allow_park %} _TOOLHEAD_PARK_PAUSE_CANCEL {park_x} {park_y} {% endif %} + _CLIENT_RETRACT LENGTH={retract} + TURN_OFF_HEATERS + M106 S0 + # clear pause_next_layer and pause_at_layer as preparation for next print + SET_PAUSE_NEXT_LAYER ENABLE=0 + SET_PAUSE_AT_LAYER ENABLE=0 LAYER=0 + CANCEL_PRINT_BASE + +[gcode_macro PAUSE] +description: Pause the actual running print +rename_existing: PAUSE_BASE +gcode: + PAUSE_BASE + _TOOLHEAD_PARK_PAUSE_CANCEL {rawparams} + +[gcode_macro RESUME] +description: Resume the actual running print +rename_existing: RESUME_BASE +gcode: + ##### get user parameters or use default ##### + {% set macro_found = True if printer['gcode_macro _CLIENT_VARIABLE'] is defined else False %} + {% set client = printer['gcode_macro _CLIENT_VARIABLE'] %} + {% set velocity = printer.configfile.settings.pause_resume.recover_velocity %} + {% set sp_move = velocity if not macro_found else client.speed_move|default(velocity) %} + ##### end of definitions ##### + _CLIENT_EXTRUDE + RESUME_BASE VELOCITY={params.VELOCITY|default(sp_move)} + +# Usage: SET_PAUSE_NEXT_LAYER [ENABLE=[0|1]] [MACRO=] +[gcode_macro SET_PAUSE_NEXT_LAYER] +description: Enable a pause if the next layer is reached +gcode: + {% set pause_next_layer = printer['gcode_macro SET_PRINT_STATS_INFO'].pause_next_layer %} + {% set ENABLE = params.ENABLE | default(1) | int != 0 %} + {% set MACRO = params.MACRO | default(pause_next_layer.call, True) %} + SET_GCODE_VARIABLE MACRO=SET_PRINT_STATS_INFO VARIABLE=pause_next_layer VALUE="{{ 'enable': ENABLE, 'call': MACRO }}" + +# Usage: SET_PAUSE_AT_LAYER [ENABLE=[0|1]] [LAYER=] [MACRO=] +[gcode_macro SET_PAUSE_AT_LAYER] +description: Enable/disable a pause if a given layer number is reached +gcode: + {% set pause_at_layer = printer['gcode_macro SET_PRINT_STATS_INFO'].pause_at_layer %} + {% set ENABLE = params.ENABLE | int != 0 if params.ENABLE is defined + else params.LAYER is defined %} + {% set LAYER = params.LAYER | default(pause_at_layer.layer) | int %} + {% set MACRO = params.MACRO | default(pause_at_layer.call, True) %} + SET_GCODE_VARIABLE MACRO=SET_PRINT_STATS_INFO VARIABLE=pause_at_layer VALUE="{{ 'enable': ENABLE, 'layer': LAYER, 'call': MACRO }}" + +# Usage: SET_PRINT_STATS_INFO [TOTAL_LAYER=] [CURRENT_LAYER= ] +[gcode_macro SET_PRINT_STATS_INFO] +rename_existing: SET_PRINT_STATS_INFO_BASE +description: Overwrite, to get pause_next_layer and pause_at_layer feature +variable_pause_next_layer: { 'enable': False, 'call': "PAUSE" } +variable_pause_at_layer : { 'enable': False, 'layer': 0, 'call': "PAUSE" } +gcode: + {% if pause_next_layer.enable %} + {action_respond_info("%s, forced by pause_next_layer" % pause_next_layer.call)} + {pause_next_layer.call} ; execute the given gcode to pause, should be either M600 or PAUSE + SET_PAUSE_NEXT_LAYER ENABLE=0 + {% elif pause_at_layer.enable and params.CURRENT_LAYER is defined and params.CURRENT_LAYER|int == pause_at_layer.layer %} + {action_respond_info("%s, forced by pause_at_layer [%d]" % (pause_at_layer.call, pause_at_layer.layer))} + {pause_at_layer.call} ; execute the given gcode to pause, should be either M600 or PAUSE + SET_PAUSE_AT_LAYER ENABLE=0 + {% endif %} + SET_PRINT_STATS_INFO_BASE {rawparams} + +##### internal use ##### +[gcode_macro _TOOLHEAD_PARK_PAUSE_CANCEL] +description: Helper: park toolhead used in PAUSE and CANCEL_PRINT +gcode: + ##### get user parameters or use default ##### + {% set macro_found = True if printer['gcode_macro _CLIENT_VARIABLE'] is defined else False %} + {% set client = printer['gcode_macro _CLIENT_VARIABLE'] %} + {% set velocity = printer.configfile.settings.pause_resume.recover_velocity %} + {% set use_custom = False if not macro_found + else False if client.use_custom_pos is not defined + else True if client.use_custom_pos|lower == 'true' + else False %} + {% set custom_park_x = 0.0 if not macro_found else client.custom_park_x|default(0.0) %} + {% set custom_park_y = 0.0 if not macro_found else client.custom_park_y|default(0.0) %} + {% set park_dz = 2.0 if not macro_found else client.custom_park_dz|default(2.0)|abs %} + {% set sp_hop = 900 if not macro_found else client.speed_hop|default(15) * 60 %} + {% set sp_move = velocity * 60 if not macro_found else client.speed_move|default(velocity) * 60 %} + ##### get config and toolhead values ##### + {% set origin = printer.gcode_move.homing_origin %} + {% set act = printer.gcode_move.gcode_position %} + {% set max = printer.toolhead.axis_maximum %} + {% set cone = printer.toolhead.cone_start_z|default(max.z) %} ; height as long the toolhead can reach max and min of an delta + {% set round_bed = True if printer.configfile.settings.printer.kinematics is in ['delta','polar','rotary_delta','winch'] + else False %} + ##### define park position ##### + {% set z_min = params.Z_MIN|default(0)|float %} + {% set z_park = [[(act.z + park_dz), z_min]|max, (max.z - origin.z)]|min %} + {% set x_park = params.X if params.X is defined + else custom_park_x if use_custom + else 0.0 if round_bed + else (max.x - 5.0) %} + {% set y_park = params.Y if params.Y is defined + else custom_park_y if use_custom + else (max.y - 5.0) if round_bed and z_park < cone + else 0.0 if round_bed + else (max.y - 5.0) %} + ##### end of definitions ##### + _CLIENT_RETRACT + {% if "xyz" in printer.toolhead.homed_axes %} + G90 + G1 Z{z_park} F{sp_hop} + G1 X{x_park} Y{y_park} F{sp_move} + {% if not printer.gcode_move.absolute_coordinates %} G91 {% endif %} + {% else %} + {action_respond_info("Printer not homed")} + {% endif %} + +[gcode_macro _CLIENT_EXTRUDE] +description: Extrudes, if the extruder is hot enough +gcode: + {% set macro_found = True if printer['gcode_macro _CLIENT_VARIABLE'] is defined else False %} + {% set client = printer['gcode_macro _CLIENT_VARIABLE'] %} + {% set use_fw_retract = False if not macro_found + else False if client.use_fw_retract is not defined + else True if client.use_fw_retract|lower == 'true' and printer.firmware_retraction is defined + else False %} + + {% set length = (params.LENGTH|float) if params.LENGTH is defined + else 1.0 if not macro_found + else client.unretract|default(1.0) %} + + {% set speed = params.SPEED if params.SPEED is defined + else 35 if not macro_found + else client.speed_unretract|default(35) %} + + {% set absolute_extrude = printer.gcode_move.absolute_extrude %} + + {% if printer.extruder.can_extrude %} + {% if use_fw_retract %} + {% if length < 0 %} + G10 + {% else %} + G11 + {% endif %} + {% else %} + M83 + G1 E{length} F{(speed|float|abs) * 60} + {% if absolute_extrude %} + M82 + {% endif %} + {% endif %} + {% else %} + {action_respond_info("Extruder not hot enough")} + {% endif %} + +[gcode_macro _CLIENT_RETRACT] +description: Retracts, if the extruder is hot enough +gcode: + {% set macro_found = True if printer['gcode_macro _CLIENT_VARIABLE'] is defined else False %} + {% set client = printer['gcode_macro _CLIENT_VARIABLE'] %} + + {% set length = (params.LENGTH|float) if params.LENGTH is defined + else 1.0 if not macro_found + else client.retract|default(1.0) %} + + {% set speed = params.SPEED if params.SPEED is defined + else 35 if not macro_found + else client.speed_retract|default(35) %} + + _CLIENT_EXTRUDE LENGTH=-{length|float|abs} SPEED={speed|float|abs} + \ No newline at end of file diff --git a/firmware/config/moonraker-obico-update.cfg b/firmware/config/moonraker-obico-update.cfg new file mode 100644 index 0000000..531b7e6 --- /dev/null +++ b/firmware/config/moonraker-obico-update.cfg @@ -0,0 +1,9 @@ +[update_manager moonraker-obico] +type: git_repo +path: ~/moonraker-obico +origin: https://github.com/TheSpaghettiDetective/moonraker-obico.git +env: /home/mks/moonraker-obico-env/bin/python +requirements: requirements.txt +install_script: install.sh +managed_services: + moonraker-obico diff --git a/firmware/config/moonraker-obico.cfg b/firmware/config/moonraker-obico.cfg new file mode 100644 index 0000000..cf5d141 --- /dev/null +++ b/firmware/config/moonraker-obico.cfg @@ -0,0 +1,14 @@ +[server] +url = https://app.obico.io +auth_token = 87b5d40c7592f8c2f3dc + +[moonraker] +host = 127.0.0.1 +port = 7125 + +[webcam] +disable_video_streaming = False + +[logging] +path = /home/mks/printer_data/logs/moonraker-obico.log + diff --git a/firmware/config/moonraker.conf b/firmware/config/moonraker.conf new file mode 100644 index 0000000..a4874e4 --- /dev/null +++ b/firmware/config/moonraker.conf @@ -0,0 +1,64 @@ +[server] +host: 0.0.0.0 +port: 7125 +klippy_uds_address: /home/mks/printer_data/comms/klippy.sock + +[authorization] +trusted_clients: + 10.0.0.0/8 + 127.0.0.0/8 + 169.254.0.0/16 + 172.16.0.0/12 + 192.168.0.0/16 + FE80::/10 + ::1/128 +cors_domains: + *.lan + *.local + *://localhost + *://localhost:* + *://my.mainsail.xyz + *://app.fluidd.xyz + +[file_manager] +enable_object_processing: True + +[octoprint_compat] + +[history] + +# [update_manager] +# channel: dev +# refresh_interval: 168 +# enable_system_updates: False + +# [update_manager fluidd] +# type: web +# channel: stable +# repo: fluidd-core/fluidd +# path: ~/fluidd + +# [update_manager mainsail] +# type: web +# channel: stable +# repo: mainsail-crew/mainsail +# path: ~/mainsail + +# [update_manager mainsail-config] +# type: git_repo +# primary_branch: master +# path: ~/mainsail-config +# origin: https://github.com/mainsail-crew/mainsail-config.git +# managed_services: klipper + +# [include moonraker-obico-update.cfg] + +[update_manager moonraker-telegram-bot] +type: git_repo +path: ~/moonraker-telegram-bot +origin: https://github.com/nlef/moonraker-telegram-bot.git +env: ~/moonraker-telegram-bot-env/bin/python +requirements: scripts/requirements.txt +install_script: scripts/install.sh + +[include octoeverywhere-system.cfg] diff --git a/firmware/config/octoeverywhere-system.cfg b/firmware/config/octoeverywhere-system.cfg new file mode 100644 index 0000000..33057f6 --- /dev/null +++ b/firmware/config/octoeverywhere-system.cfg @@ -0,0 +1,20 @@ +[update_manager octoeverywhere] +type: git_repo +# Using `channel: beta` makes moonraker only update to the lasted tagged commit on the branch. Which lets us control releases. +channel: beta +path: /home/mks/octoeverywhere +origin: https://github.com/QuinnDamerell/OctoPrint-OctoEverywhere.git +# env is deprecated for virtualenv, but for now we can only use one and must use the older option for compat. +env: /home/mks/octoeverywhere-env/bin/python +#virtualenv: /home/mks/octoeverywhere-env +# requirements is deprecated for system_dependencies, but for now we can only use one and must use the older option for compat. +requirements: requirements.txt +# system_dependencies: moonraker-system-dependencies.json +install_script: install.sh +managed_services: + octoeverywhere + +# This allows users of OctoEverywhere to get announcements from the system. +[announcements] +subscriptions: + octoeverywhere diff --git a/firmware/config/octoeverywhere.conf b/firmware/config/octoeverywhere.conf new file mode 100644 index 0000000..e93ed9f --- /dev/null +++ b/firmware/config/octoeverywhere.conf @@ -0,0 +1,34 @@ +[relay] +# The port used for http relay. If your desired frontend runs on a different port, change this value. The OctoEverywhere plugin service needs to be restarted before changes will take effect. +frontend_port = 81 +# A string only used by the UI to hint at what web interface this port is. +frontend_type_hint = Mainsail + +[logging] +# The active logging level. Valid values include: DEBUG, INFO, WARNING, or ERROR. +log_level = INFO +max_file_size_mb = 3 +max_file_count = 1 + +[server] + +[webcam] +# This is the webcam name OctoEverywhere will use for Gadget AI, notifications, and such. This much match the camera 'Name' from your Mainsail of Fluidd webcam settings. The default value of 'Default' will pick whatever camera the system can find. +webcam_name_to_use_as_primary = Default +# Enables or disables auto webcam setting detection. If enabled, OctoEverywhere will find the webcam settings configured via the frontend (Fluidd, Mainsail, etc) and use them. Disable to manually set the values and have them not be overwritten. +auto_settings_detection = True +# Webcam streaming URL. This can be a local relative path (ex: /webcam/?action=stream) or absolute http URL (ex: http://10.0.0.1:8080/webcam/?action=stream or http://webcam.local/webcam/?action=stream) +stream_url = /webcam/?action=stream +# Flips the webcam image horizontally. Valid values are True or False +flip_horizontally = False +# Flips the webcam image vertically. Valid values are True or False +flip_vertically = False +# Rotates the webcam image. Valid values are 0, 90, 180, or 270 +rotate = 0 +# Webcam snapshot URL. This can be a local relative path (ex: /webcam/?action=snapshot) or absolute http URL (ex: http://10.0.0.1:8080/webcam/?action=snapshot or http://webcam.local/webcam/?action=snapshot) +snapshot_url = /webcam/?action=snapshot + +[general] +# The temperature in Celsius that the bed must be under to be considered cooled down. This is used to fire the Bed Cooldown Complete notification. +bed_cooldown_threshold_temp_celsius = 40.0 + diff --git a/firmware/config/printer.cfg b/firmware/config/printer.cfg new file mode 100644 index 0000000..c63880c --- /dev/null +++ b/firmware/config/printer.cfg @@ -0,0 +1,653 @@ +##################################################################### +# KINGROON KLP1 V2.2-230 +#################################################################### +[include mainsail.cfg] +[include MKS_THR.cfg] +[mcu] +serial:/dev/serial/by-id/usb-Klipper_stm32f103xe_BB6232333036341232383139-if00 +restart_method: command + +##################################################################### +# 速度 +#################################################################### +[printer] +kinematics:corexy#打印机类型 +max_velocity: 500#最大速度 +max_accel: 20000#最大加速度 +max_accel_to_decel: 6000#最大加速度到减速度 +max_z_velocity: 50#Z轴最大速度 +max_z_accel: 100#Z轴最大加速度 +square_corner_velocity: 20#方形拐角速度 + +##################################################################### +# 运动和驱动参数 +#################################################################### +[stepper_x] +step_pin:PC14 #电机脉冲引脚 +dir_pin:!PC13 #方向设置 +enable_pin:!PC15 #使能引脚 +microsteps: 16 #细分 +rotation_distance: 40 #主动轮周长mm +full_steps_per_rotation:200 #单圈脉冲数量 +endstop_pin:tmc2209_stepper_x:virtual_endstop #限位开关接口 +position_min: 0 #限位最小行程 +position_endstop: 0 #回零的位置 +position_max: 235 #最大限位行程 +homing_speed:50 #回零速度 +homing_retract_dist:0 #后撤距离 +homing_positive_dir:False #回零方向 +step_pulse_duration:0.000002 +[stepper_y] +step_pin:PE5 +dir_pin:PE4 +enable_pin:!PD14 +microsteps:16 +rotation_distance: 40 +full_steps_per_rotation:200 +endstop_pin:tmc2209_stepper_y:virtual_endstop +position_min: 0 +position_endstop:0 +position_max:235 +homing_speed:50 +homing_retract_dist:0 +homing_positive_dir:false +step_pulse_duration:0.000002 +[stepper_z] +step_pin:PE1 +dir_pin:PE0 +enable_pin:!PE2 +microsteps: 16 +rotation_distance:8 +full_steps_per_rotation: 200 +gear_ratio: 40:20 +endstop_pin:probe:z_virtual_endstop +position_max: 220 +position_min: -10 +homing_speed:5 +second_homing_speed: 2 +homing_positive_dir:false +step_pulse_duration:0.000002 + +[tmc2209 stepper_x] +uart_pin: PE6 +run_current: 1.3 +interpolate: True +stealthchop_threshold: 0 #静音模式quiet mode:99999/高速模式High speed mode:0 +diag_pin:^PA14 +driver_SGTHRS: 110 +[tmc2209 stepper_y] +uart_pin: PE3 +run_current: 1.3 +interpolate: True +stealthchop_threshold: 0#静音模式quiet mode:99999/高速模式High speed mode:0 +diag_pin:^PA15 +driver_SGTHRS:110 +[tmc2209 stepper_z] +uart_pin: PB7 +run_current: 1.0 +hold_current: 1.0 +interpolate: True +stealthchop_threshold: 0#静音模式quiet mode:99999/高速模式High speed mode:0 + +##################################################################### +# 挤出机 +##################################################################### +[extruder] +step_pin: MKS_THR:gpio5 +dir_pin: !MKS_THR:gpio4 +enable_pin: !MKS_THR:gpio10 +rotation_distance:53.2 +gear_ratio: 95:10 #减速比 +microsteps: 16 +full_steps_per_rotation: 200 #脉冲 +nozzle_diameter: 0.400 # 喷嘴的孔径(以毫米为单位) +filament_diameter: 1.75 # 进入挤出机的耗材上标的直径(以毫米为单位) +heater_pin: MKS_THR:gpio2 +sensor_pin: MKS_THR:gpio26 +sensor_type: ATC Semitec 104GT-2 +min_temp: 0 #最小温度 +max_temp: 310 #最大温度 +max_power: 1 #最大功率 +min_extrude_temp: 60 +control = pid +pid_kp = 19.837#发送命令PID_CALIBRATE HEATER=extruder TARGET=245 它将执行一个PID校准程序,完成后控制台将返回PID数值,将其复制到配置文件即可。 +pid_ki = 4.723 +pid_kd = 20.829 +pressure_advance: 0.03 #压力提前数据 was 0.03 +pressure_advance_smooth_time: 0.09 +max_extrude_cross_section:0.64#500挤出线条横截面的最大面积(以平方毫米为单位) (例如:挤出线宽乘层高)这个设置能防止在相对较小的XY移动时产生过度的挤出,默认值是:4.0 * 喷嘴直径 ^ 2 +instantaneous_corner_velocity: 20.000 #两次挤出之间最大的速度变化(以毫米每秒为单位) +max_extrude_only_distance: 100.0# 一次挤出或回抽的最大长度(以毫米耗材的长度为单位) +max_extrude_only_velocity:5000# 最大的挤出和回抽速度(以毫米每秒为单位) +max_extrude_only_accel:2000# 和加速度(以毫米每二次方秒为单位) +step_pulse_duration:0.000002 + +[tmc2209 extruder] +uart_pin: MKS_THR:gpio6 +interpolate: True +run_current: 0.9 +hold_current: 0.9 +sense_resistor: 0.110 +stealthchop_threshold:0 + +##################################################################### +# 回零动作 +#################################################################### +[homing_override] +set_position_z:0 +gcode: + G91 + G1 Z5 F100 + {% set HOME_CUR = 0.500 %} + {% set driver_config = printer.configfile.settings['tmc2209 stepper_x'] %} + {% set RUN_CUR = driver_config.run_current %} + SET_VELOCITY_LIMIT ACCEL=500 + # Set current for sensorless homing + SET_TMC_CURRENT STEPPER=stepper_x CURRENT={HOME_CUR} + SET_TMC_CURRENT STEPPER=stepper_y CURRENT={HOME_CUR} + {% if params.X is defined %} + {% if params.Y is undefined %} + {% if params.Z is undefined %} + G28 X F100 + G1 X2 F1000 + {% endif %} + {% endif %} + {% endif %} + {% if params.Y is defined %} + {% if params.X is undefined %} + {% if params.Z is undefined %} + G28 Y F100 + G1 Y2 F1000 + {% endif %} + {% endif %} + {% endif %} + {% if params.Z is defined %} + {% if params.X is undefined %} + {% if params.Y is undefined %} + G28 Z F100 + {% endif %} + {% endif %} + {% endif %} + {% if params.X is defined %} + {% if params.Y is defined %} + {% if params.Z is undefined %} + G28 X F100 + G28 Y F100 + G1 X2 F1000 + G1 Y2 F1000 + {% endif %} + {% endif %} + {% endif %} + {% if params.X is undefined %} + {% if params.Y is undefined %} + {% if params.Z is undefined %} + G28 X F100 + G28 Y F100 + G1 X30 F2000 + G1 Y15 F1000 + G28 Z F100 + G1 Z10 F100 + {% endif %} + {% endif %} + {% endif %} + SET_TMC_CURRENT STEPPER=stepper_x CURRENT={RUN_CUR} + SET_TMC_CURRENT STEPPER=stepper_y CURRENT={RUN_CUR} + SET_VELOCITY_LIMIT ACCEL=5000 + G90 + BED_MESH_PROFILE LOAD=default + +##################################################################### +# 热床 +#################################################################### +[heater_bed] +heater_pin: PA0 +sensor_type: NTC 100K MGB18-104F39050L32 +sensor_pin: PC0 +max_power: 1 +#control = pid +#pid_kp = 57.862 +#pid_ki = 2.167 +#pid_kd = 386.231 +min_temp: 0 +max_temp: 200 + +##################################################################### +# 风扇 +#################################################################### +[temperature_sensor mcu_temp] +sensor_type: temperature_mcu +min_temp: 0 +max_temp: 100 +[temperature_sensor KINGROONpi Pi] +sensor_type: temperature_host +min_temp: 0 +max_temp: 100 +[temperature_fan Pi_fan2]#主板温控风扇 +pin:PA2 +kick_start_time: 0.500 +sensor_type: temperature_host +##control: watermark +# 高于以下温度启用风扇 +##target_temp: 30.0# 允许的温度范围 +##min_temp: 0 +##max_temp: 90# 调节最大风速以降低噪音 设置值30-100 +##max_speed: 1 +##min_speed: 0.3 +##https://klp1.com/issues/silence-motherboard-fan/ +control: pid +pid_kp: 10 +pid_ki: 0 +pid_kd: 0 +# Temperature which it will try to target +target_temp: 60.0 +# Absolute limits for temperature +min_temp: 0 +max_temp: 90 +# Adjust the interval for the fan speed to the range 0%-100% +max_speed: 1.0 +min_speed: 0.0 + +#################################################################### +# 一键预热 +##################################################################### +[gcode_macro START_PRINT] +gcode: + {% set BED_TEMP = params.BED_TEMP|default(60)|float %} + {% set EXTRUDER_TEMP = params.EXTRUDER_TEMP|default(220)|float %} + M140 S{BED_TEMP}#加热热床到目标温度 + M104 S{EXTRUDER_TEMP} + M190 S{BED_TEMP} + M109 S{EXTRUDER_TEMP} + G90 + G28 + ## https://klipper.discourse.group/t/klipper-does-not-appear-to-be-using-mesh-ender-3v2n/9615 + BED_MESH_PROFILE LOAD="default" + G1 Z5 F3000 + G1 Z0.15 F100 + +[gcode_macro M205] +gcode: +[gcode_macro END_PRINT] +gcode: + + G91 + G1 X-2 Y-2 E-3 F300 + G1 Z10 F3000 + G90 + M84 + M140 S60 + M104 S200 + M106 S0 + +[gcode_macro PAUSE] +rename_existing: BASE_PAUSE +gcode: + # Parameters + {% set z = params.Z|default(10)|int %} ; z hop amount + {% set e = params.E|default(1) %} + + {% if printer['pause_resume'].is_paused|int == 0 %} + SET_GCODE_VARIABLE MACRO=RESUME VARIABLE=zhop VALUE={z} ; set z hop variable for reference in resume macro + SET_GCODE_VARIABLE MACRO=RESUME VARIABLE=etemp VALUE={printer['extruder'].target} ; set hotend temp variable for reference in resume macro + +# SET_FILAMENT_SENSOR SENSOR=fila ENABLE=0 ; disable filament sensor + SAVE_GCODE_STATE NAME=PAUSE ; save current print position for resume + BASE_PAUSE ; pause print + {% if (printer.gcode_move.position.z + z) < printer.toolhead.axis_maximum.z %} ; check that zhop doesn't exceed z max + G91 ; relative positioning + G1 Z{z} F900 ; raise Z up by z hop amount + {% else %} +# { action_respond_info("Pause zhop exceeds maximum Z height.") } ; if z max is exceeded, show message and set zhop value for resume to 0 + SET_GCODE_VARIABLE MACRO=RESUME VARIABLE=zhop VALUE=0 + {% endif %} + G1 E-{e} F2100 + SAVE_GCODE_STATE NAME=PAUSEPARK + G90 ; absolute positioning + G1 X10 Y10 F6000 ; park toolhead at front center + #M104 S0 ; turn off hotend + SET_IDLE_TIMEOUT TIMEOUT=43200 ; set timeout to 12 hours + {% endif %} + M106 S0 +[gcode_macro RESUME] +rename_existing: BASE_RESUME +variable_zhop: 0 +variable_etemp: 0 +gcode: + # Parameters + {% set e = params.E|default(2.5)|int %} ; hotend prime amount (in mm) + + {% if printer['pause_resume'].is_paused|int == 1 %} + #SET_FILAMENT_SENSOR SENSOR=fila ENABLE=1 ; enable filament sensor + #INITIAL_RGB ; reset LCD color + SET_IDLE_TIMEOUT TIMEOUT={printer.configfile.settings.idle_timeout.timeout} ; set timeout back to configured value + {% if etemp > 0 %} + M109 S{etemp|int} ; wait for hotend to heat back up + {% endif %} + RESTORE_GCODE_STATE NAME=PAUSEPARK MOVE=1 MOVE_SPEED=100 ; go back to parked position in case toolhead was moved during pause (otherwise the return zhop can error) + G91 ; relative extruder positioning + M83 ; restore position + {% if printer[printer.toolhead.extruder].temperature >= printer.configfile.settings.extruder.min_extrude_temp %} + G1 Z{zhop * -1} E{e} F900 ; prime nozzle by E, lower Z back down + {% else %} + G1 Z{zhop * -1} F900 ; lower Z back down without priming (just in case we are testing the macro with cold hotend) + {% endif %} + M400 + RESTORE_GCODE_STATE NAME=PAUSE MOVE=1 MOVE_SPEED=60 + BASE_RESUME ; resume print + {% endif %} + M106 S255 +#################################################################### +# 共振补偿 +##################################################################### +[idle_timeout] +timeout: 36000 + +[gcode_macro G40] +gcode: + ACCELEROMETER_QUERY + SET_INPUT_SHAPER SHAPER_FREQ_X=0 SHAPER_FREQ_Y=0 + G28 + M106 S255 + SHAPER_CALIBRATE + SAVE_CONFIG +[gcode_macro SHAPER_CALIBRATE] +rename_existing: RESHAPER_CALIBRATE +gcode: + RESHAPER_CALIBRATE FREQ_START=5 FREQ_END=100 +[resonance_tester] +accel_chip: adxl345 +probe_points: + 100, 100, 20 # 共振补偿开始的位置 +accel_per_hz: 300 + +[adxl345] +cs_pin: MKS_THR:gpio13 +spi_software_sclk_pin: MKS_THR:gpio14 +spi_software_mosi_pin: MKS_THR:gpio15 +spi_software_miso_pin: MKS_THR:gpio12 +[input_shaper] +#shaper_freq_x: 96.6 +#shaper_type_x: mzv +#shaper_freq_y: 136.0 +#shaper_type_y: 2hump_ei + +[virtual_sdcard] +# path: ~/gcode_files +path: /home/mks/printer_data/gcodes + +[pause_resume] + +[exclude_object] + +[gcode_macro CANCEL_PRINT] +description: Cancel the actual running print +rename_existing: CANCEL_PRINT_BASE +gcode: + TURN_OFF_HEATERS + CANCEL_PRINT_BASE + G91 + G1 Z10 F100 + G90 + G1 X10 F3000 + M84 + M106 S0 +#################################################################### +# 断料检测 +##################################################################### +[filament_switch_sensor fila] +pause_on_runout: True#当设置为 "True "时,会在检测到耗尽后立即暂停打印机。 +runout_gcode: + G91 + G1 Z10 + G90 + G1 X10 Y10 F3000 + M104 S220 + M105 + M109 S220 + G91 + G1 E30 F3000 + G1 E-27 F9000 + M106 S255 + M104 S62 + M105 + M109 S62 + G1 E-50 F300 + M106 S0 + SET_HEATER_TEMPERATURE HEATER=extruder TARGET=0 +event_delay: 3.0 +pause_delay: 0.5 +switch_pin:PA1 + +[display_status] +#################################################################### +# 温度波动阀值 +##################################################################### +[verify_heater extruder] +max_error: 120 +check_gain_time:120 +hysteresis: 10 +heating_gain: 2 + +[verify_heater heater_bed] +max_error: 120 +check_gain_time:120 +hysteresis: 10 +heating_gain: 2 + +[probe] +pin:!MKS_THR:gpio21 +x_offset: -22.2 +y_offset: 0 +speed:5 #自动调平速度 +samples:3 +samples_result:median +sample_retract_dist: 1.2 #调平两点之间的抬升高度 +samples_tolerance: 0.05 +samples_tolerance_retries: 3 + +[probe] +#z_offset: 0#2.0 #6.25 + +[gcode_macro G29] +gcode: + G28 + G0 Z10 F1000 + G1 X105 Y105 F1000 + PROBE_CALIBRATE +#执行Z轴偏移 +[gcode_macro G30] +gcode: + BED_MESH_CLEAR #清除调平数据 + G28 + BED_MESH_CALIBRATE #自动调平 + BED_MESH_PROFILE SAVE="name" #保存调平数据 + SAVE_CONFIG + BED_MESH_PROFILE LOAD="name" #加载调平数据 + +[gcode_macro G31] +gcode: + TESTZ Z=-1 +#Z轴偏移-1 +[gcode_macro G32] +gcode: + TESTZ Z=-0.5 +#Z轴偏移-0.5 +[gcode_macro G33] +gcode: + TESTZ Z=-0.1 +#Z轴偏移-0.1 +[gcode_macro G34] +gcode: + TESTZ Z=0.1 +#Z轴偏移0.1 +[gcode_macro G35] +gcode: + TESTZ Z=0.5 +#Z轴偏移0.5 +[gcode_macro G36] +gcode: + TESTZ Z=1 +#Z轴偏移1 +[gcode_macro G37] +gcode: + ACCEPT +#保存Z轴偏移数据 +##################################################################### +# 自动退料 +##################################################################### +[gcode_macro G50] +gcode: + M104 S220 + M105 + M109 S220 + G91 + G1 E30 F3000 + G1 E-27 F9000 + M106 S255 + M104 S62 + M105 + M109 S62 + G1 E-50 F300 + M106 S0 + M84 + SET_HEATER_TEMPERATURE HEATER=extruder TARGET=0 +[duplicate_pin_override] +pins: + PB5 + +[gcode_macro LOAD_FILAMENT] +#触摸屏端的自动进料 +gcode: + M104 S220 + M105 + M109 S220 + G91 + G1 E100 F200 + G90 +[gcode_macro UNLOAD_FILAMENT] +#触摸屏端的自动退料 +gcode: + M104 S220 + M105 + M109 S220 + G91 + G1 E30 F3000 + G1 E-27 F9000 + M106 S255 + M104 S62 + M105 + M109 S62 + G1 E-50 F300 + M106 S0 + M84 + SET_HEATER_TEMPERATURE HEATER=extruder TARGET=0 +[display] +lcd_type:uc1701 +cs_pin: PE11 +a0_pin: PE9 +rst_pin: PE10 +contrast: 63 +encoder_pins:^PE13,^PE14 +click_pin: ^!PE15 +## Some micro-controller boards may require an spi bus to be specified: +#spi_bus: spi +## Alternatively, some micro-controller boards may work with software spi: +spi_software_miso_pin:PB5 +spi_software_mosi_pin:PB5 +spi_software_sclk_pin:PB3 + +[output_pin beeper] +pin: PC5 + +# Enable object exclusion +[exclude_object] + +# Enable arcs support +[gcode_arcs] +resolution: 0.1 + +[neopixel mini12864] +pin: PE12 +chain_count: 3 +color_order: RGB +initial_RED: 1.0 +initial_GREEN: 1.0 +initial_BLUE: 0.0 + +#*# <---------------------- SAVE_CONFIG ----------------------> +#*# DO NOT EDIT THIS BLOCK OR BELOW. The contents are auto-generated. +#*# +#*# [bed_mesh name] +#*# version = 1 +#*# points = +#*# 0.028750, -0.373750, -0.768750, -1.116250, -1.411250, -1.656250 +#*# 0.188750, -0.218750, -0.605000, -0.937500, -1.252500, -1.532500 +#*# 0.302500, -0.093750, -0.498750, -0.837500, -1.147500, -1.421250 +#*# 0.388750, 0.021250, -0.350000, -0.720000, -1.013750, -1.288750 +#*# 0.481250, 0.122500, -0.225000, -0.568750, -0.866250, -1.166250 +#*# 0.566250, 0.232500, -0.113750, -0.435000, -0.682500, -0.968750 +#*# tension = 0.2 +#*# min_x = 10.000000000000004 +#*# algo = lagrange +#*# y_count = 6 +#*# mesh_y_pps = 2 +#*# min_y = 20.0 +#*# x_count = 6 +#*# max_y = 220.0 +#*# mesh_x_pps = 2 +#*# max_x = 210.0 +#*# +#*# [probe] +#*# z_offset = 2.325 +#*# +#*# [input_shaper] +#*# shaper_type_x = mzv +#*# shaper_freq_x = 59.4 +#*# shaper_type_y = zv +#*# shaper_freq_y = 66.6 +#*# +#*# [heater_bed] +#*# control = pid +#*# pid_kp = 72.465 +#*# pid_ki = 2.166 +#*# pid_kd = 605.989 +#*# +#*# [bed_mesh default1] +#*# version = 1 +#*# points = +#*# 0.026250, -0.316250, -0.670000, -0.970000, -1.182500, -1.410000 +#*# 0.163750, -0.171250, -0.533750, -0.810000, -1.060000, -1.290000 +#*# 0.288750, -0.061250, -0.425000, -0.686250, -0.933750, -1.176250 +#*# 0.400000, 0.057500, -0.266250, -0.568750, -0.810000, -1.058750 +#*# 0.505000, 0.181250, -0.126250, -0.412500, -0.661250, -0.861250 +#*# 0.622500, 0.308750, 0.003750, -0.256250, -0.503750, -0.715000 +#*# x_count = 6 +#*# y_count = 6 +#*# mesh_x_pps = 2 +#*# mesh_y_pps = 2 +#*# algo = lagrange +#*# tension = 0.2 +#*# min_x = 10.000000000000004 +#*# max_x = 210.0 +#*# min_y = 20.0 +#*# max_y = 220.0 +#*# +#*# [bed_mesh default] +#*# version = 1 +#*# points = +#*# 0.028750, -0.373750, -0.768750, -1.116250, -1.411250, -1.656250 +#*# 0.188750, -0.218750, -0.605000, -0.937500, -1.252500, -1.532500 +#*# 0.302500, -0.093750, -0.498750, -0.837500, -1.147500, -1.421250 +#*# 0.388750, 0.021250, -0.350000, -0.720000, -1.013750, -1.288750 +#*# 0.481250, 0.122500, -0.225000, -0.568750, -0.866250, -1.166250 +#*# 0.566250, 0.232500, -0.113750, -0.435000, -0.682500, -0.968750 +#*# x_count = 6 +#*# y_count = 6 +#*# mesh_x_pps = 2 +#*# mesh_y_pps = 2 +#*# algo = lagrange +#*# tension = 0.2 +#*# min_x = 10.000000000000004 +#*# max_x = 210.0 +#*# min_y = 20.0 +#*# max_y = 220.0 diff --git a/firmware/config/telegram.conf b/firmware/config/telegram.conf new file mode 100644 index 0000000..611ffdb --- /dev/null +++ b/firmware/config/telegram.conf @@ -0,0 +1,20 @@ +# Please refer to the wiki(https://github.com/nlef/moonraker-telegram-bot/wiki) for detailed information on how to configure the bot + +[bot] +server: localhost +bot_token: 7541624255:AAF0WSQbEYxdV0LxS2SCzMnN5UH_mugAaAg +chat_id: 615819132 + +[camera] +host: http://localhost:8080/?action=stream + +[progress_notification] +percent: 5 +height: 5 +time: 5 + +[timelapse] +cleanup: true +height: 0.2 +time: 5 +target_fps: 30