From efb2447872ce35c9db86e5bbb71dc402d697c64f Mon Sep 17 00:00:00 2001 From: Cyril Date: Sun, 19 May 2024 23:18:35 +0200 Subject: [PATCH] Update --- files/macros/M600-support-3v3.cfg | 2 +- files/macros/M600-support-ke.cfg | 155 +++++++++++++++++++++++++++++ scripts/m600_support.sh | 2 + scripts/menu/KE/install_menu_KE.sh | 47 +++++---- scripts/menu/KE/remove_menu_KE.sh | 47 +++++---- scripts/paths.sh | 1 + 6 files changed, 213 insertions(+), 41 deletions(-) create mode 100644 files/macros/M600-support-ke.cfg diff --git a/files/macros/M600-support-3v3.cfg b/files/macros/M600-support-3v3.cfg index 77ed3d8..d24eee6 100644 --- a/files/macros/M600-support-3v3.cfg +++ b/files/macros/M600-support-3v3.cfg @@ -76,7 +76,7 @@ variable_m600_state: 0 variable_fan0_speed: 0 gcode: {% set E = printer["gcode_macro PAUSE"].extrude|float %} - {% set y_park = printer.toolhead.axis_minimum.y|float + 5.0 %} + {% set y_park = printer.toolhead.axis_minimum.y|float - 5.0 %} {% set x_park = printer.toolhead.axis_maximum.x|float - 10.0 %} {% set max_z = printer["gcode_macro PRINTER_PARAM"].max_z_position|float %} {% set act_z = printer.toolhead.position.z|float %} diff --git a/files/macros/M600-support-ke.cfg b/files/macros/M600-support-ke.cfg new file mode 100644 index 0000000..4ba463a --- /dev/null +++ b/files/macros/M600-support-ke.cfg @@ -0,0 +1,155 @@ +######################################## +# M600 Support +######################################## + +[respond] + +[idle_timeout] +gcode: + {% if printer["gcode_macro M600"].m600_state == 1 %} + RESPOND TYPE=command MSG="Stopping hotend heating..." + M104 S0 + {% else %} + TURN_OFF_HEATERS + M84 + {% endif %} +timeout: 1800 + + +[filament_switch_sensor filament_sensor] +pause_on_runout: false +switch_pin: !PC15 +runout_gcode: + M600 + + +[gcode_macro _UNLOAD_FILAMENT] +gcode: + M109 S{printer['gcode_macro PRINTER_PARAM'].hotend_temp|int} + RESPOND TYPE=command MSG="Unloading filament..." + G91 + G1 E20 F180 + G1 E-30 F180 + G1 E-50 F2000 + + +[gcode_macro _LOAD_FILAMENT] +gcode: + M109 S{printer['gcode_macro PRINTER_PARAM'].hotend_temp|int} + RESPOND TYPE=command MSG="Loading filament..." + G91 + G1 E150 F180 + G90 + M400 + + +[gcode_macro _PURGE_MORE] +gcode: + M109 S{printer['gcode_macro PRINTER_PARAM'].hotend_temp|int} + RESPOND TYPE=command MSG="Purging filament..." + G91 + G1 E10 F180 + G90 + M400 + + +[gcode_macro M600] +description: Filament Change +variable_m600_state: 0 +variable_fan0_speed: 0 +gcode: + {% set E = printer["gcode_macro PAUSE"].extrude|float %} + {% set y_park = printer.toolhead.axis_minimum.y|float - 5.0 %} + {% set x_park = printer.toolhead.axis_maximum.x|float - 5.0 %} + {% set max_z = printer["gcode_macro PRINTER_PARAM"].max_z_position|float %} + {% set act_z = printer.toolhead.position.z|float %} + {% set z_safe = 0.0 %} + {% if act_z < 48.0 %} + {% set z_safe = 50.0 - act_z %} + {% elif act_z < (max_z - 2.0) %} + {% set z_safe = 2.0 %} + {% elif act_z < max_z %} + {% set z_safe = max_z - act_z %} + {% endif %} + SET_GCODE_VARIABLE MACRO=M600 VARIABLE=m600_state VALUE=1 + SET_GCODE_VARIABLE MACRO=PRINTER_PARAM VARIABLE=hotend_temp VALUE={printer.extruder.target} + SET_GCODE_VARIABLE MACRO=PRINTER_PARAM VARIABLE=z_safe_pause VALUE={z_safe|float} + RESPOND TYPE=command MSG="Print paused for filament change!" + PAUSE_BASE + G91 + {% if "xyz" in printer.toolhead.homed_axes %} + {% if printer.extruder.can_extrude|lower == 'true' %} + G1 E-{E} F2100 + {% else %} + RESPOND TYPE=command MSG="Extruder not hot enough!" + {% endif %} + G1 Z{z_safe} F600 + M400 + G90 + G1 X{x_park} Y{y_park} F6000 + {% endif %} + _UNLOAD_FILAMENT + SET_GCODE_VARIABLE MACRO=M600 VARIABLE=fan0_speed VALUE={printer['output_pin fan0'].value} + M106 P0 S0 + SET_IDLE_TIMEOUT TIMEOUT=900 + RESPOND TYPE=command MSG="action:prompt_begin Filament change detected!" + RESPOND TYPE=command MSG="action:prompt_text A necessary filament change has been detected. Please replace filament, LOAD it and click RESUME button." + RESPOND TYPE=command MSG="action:prompt_button UNLOAD FILAMENT|_UNLOAD_FILAMENT|secondary" + RESPOND TYPE=command MSG="action:prompt_button LOAD FILAMENT|_LOAD_FILAMENT|secondary" + RESPOND TYPE=command MSG="action:prompt_button PURGE MORE FILAMENT|_PURGE_MORE|secondary" + RESPOND TYPE=command MSG="action:prompt_footer_button CANCEL PRINT|CANCEL_PRINT|error" + RESPOND TYPE=command MSG="action:prompt_footer_button IGNORE|RESPOND TYPE=command MSG=action:prompt_end|warning" + RESPOND TYPE=command MSG="action:prompt_footer_button RESUME|RESUME|primary" + RESPOND TYPE=command MSG="action:prompt_show" + + +[gcode_macro RESUME] +description: Resume the current print +rename_existing: RESUME_BASE +gcode: + {% if printer['gcode_macro PRINTER_PARAM'].hotend_temp|int != 0 %} + {% if printer['gcode_macro PRINTER_PARAM'].hotend_temp|int > printer.extruder.temperature %} + RESPOND TYPE=command MSG="Starting hotend heating..." + M109 S{printer['gcode_macro PRINTER_PARAM'].hotend_temp|int} + {% else %} + RESPOND TYPE=command MSG="Starting hotend heating..." + M104 S{printer['gcode_macro PRINTER_PARAM'].hotend_temp|int} + {% endif %} + SET_GCODE_VARIABLE MACRO=PRINTER_PARAM VARIABLE=hotend_temp VALUE=0 + {% endif %} + {% if printer['gcode_macro M600'].m600_state != 1 %} + {% set z_resume_move = printer['gcode_macro PRINTER_PARAM'].z_safe_pause|int %} + {% if z_resume_move > 2 %} + {% set z_resume_move = z_resume_move - 2 %} + G91 + G1 Z-{z_resume_move} F600 + M400 + {% endif %} + {% endif %} + {% set E = printer["gcode_macro PAUSE"].extrude|float %} + {% if 'VELOCITY' in params|upper %} + {% set get_params = ('VELOCITY=' + params.VELOCITY) %} + {%else %} + {% set get_params = "" %} + {% endif %} + {% if printer["gcode_macro M600"].m600_state == 1 %} + {% if printer['gcode_macro M600'].fan0_speed > 0 %} + {% set s_value = (printer['gcode_macro M600'].fan0_speed * 255 - printer['gcode_macro PRINTER_PARAM'].fan0_min) * 255 / (255 - printer['gcode_macro PRINTER_PARAM'].fan0_min)|float %} + M106 P0 S{s_value} + SET_GCODE_VARIABLE MACRO=M600 VARIABLE=fan0_speed VALUE=0 + {% endif %} + SET_GCODE_VARIABLE MACRO=M600 VARIABLE=m600_state VALUE=0 + SET_IDLE_TIMEOUT TIMEOUT=1800 + RESPOND TYPE=command MSG="action:prompt_end" + {% else %} + {% if printer.extruder.can_extrude|lower == 'true' %} + G91 + G1 E{E} F2100 + G90 + M400 + {% else %} + RESPOND TYPE=command MSG="Extruder not hot enough!" + {% endif %} + {% endif %} + RESPOND TYPE=command MSG="Resuming printing..." + RESUME_BASE {get_params} diff --git a/scripts/m600_support.sh b/scripts/m600_support.sh index 81dcf3a..82fe57f 100755 --- a/scripts/m600_support.sh +++ b/scripts/m600_support.sh @@ -30,6 +30,8 @@ function install_m600_support(){ echo -e "Info: Linking file..." if [ "$model" = "K1" ]; then ln -sf "$M600_SUPPORT_URL" "$HS_CONFIG_FOLDER"/M600-support.cfg + elif [ "$model" = "3KE" ]; then + ln -sf "$M600_SUPPORT_3KE_URL" "$HS_CONFIG_FOLDER"/M600-support.cfg else ln -sf "$M600_SUPPORT_3V3_URL" "$HS_CONFIG_FOLDER"/M600-support.cfg fi diff --git a/scripts/menu/KE/install_menu_KE.sh b/scripts/menu/KE/install_menu_KE.sh index 17bf23c..9e31353 100755 --- a/scripts/menu/KE/install_menu_KE.sh +++ b/scripts/menu/KE/install_menu_KE.sh @@ -19,20 +19,21 @@ function install_menu_ui_ke() { subtitle '•IMPROVEMENTS:' menu_option ' 6' 'Install' 'Improved Shapers Calibrations' menu_option ' 7' 'Install' 'Save Z-Offset Macros' - menu_option ' 8' 'Install' 'Git Backup' + menu_option ' 8' 'Install' 'M600 Support' + menu_option ' 9' 'Install' 'Git Backup' hr subtitle '•CAMERA:' - menu_option ' 9' 'Install' 'Moonraker Timelapse' - menu_option '10' 'Install' 'Nebula Camera Settings Control' - menu_option '11' 'Install' 'USB Camera Support' + menu_option '10' 'Install' 'Moonraker Timelapse' + menu_option '11' 'Install' 'Nebula Camera Settings Control' + menu_option '12' 'Install' 'USB Camera Support' hr subtitle '•REMOTE ACCESS:' - menu_option '12' 'Install' 'OctoEverywhere' - menu_option '13' 'Install' 'Moonraker Obico' - menu_option '14' 'Install' 'GuppyFLO' - menu_option '15' 'Install' 'Mobileraker Companion' - menu_option '16' 'Install' 'OctoApp Companion' - menu_option '17' 'Install' 'SimplyPrint' + menu_option '13' 'Install' 'OctoEverywhere' + menu_option '14' 'Install' 'Moonraker Obico' + menu_option '15' 'Install' 'GuppyFLO' + menu_option '16' 'Install' 'Mobileraker Companion' + menu_option '17' 'Install' 'OctoApp Companion' + menu_option '18' 'Install' 'SimplyPrint' hr inner_line hr @@ -101,6 +102,12 @@ function install_menu_ke() { run "install_save_zoffset_macros" "install_menu_ui_ke" fi;; 8) + if [ -f "$M600_SUPPORT_FILE" ]; then + error_msg "M600 Support is already installed!" + else + run "install_m600_support" "install_menu_ui_k1" + fi;; + 9) if [ -f "$GIT_BACKUP_FILE" ]; then error_msg "Git Backup is already installed!" elif [ ! -f "$ENTWARE_FILE" ]; then @@ -110,7 +117,7 @@ function install_menu_ke() { else run "install_git_backup" "install_menu_ui_ke" fi;; - 9) + 10) if [ -f "$TIMELAPSE_FILE" ]; then error_msg "Moonraker Timelapse is already installed!" elif [ ! -f "$ENTWARE_FILE" ]; then @@ -118,7 +125,7 @@ function install_menu_ke() { else run "install_moonraker_timelapse" "install_menu_ui_ke" fi;; - 10) + 11) if [ -f "$CAMERA_SETTINGS_FILE" ]; then error_msg "Nebula Camera Settings Control is already installed!" elif ! v4l2-ctl --list-devices | grep -q 'CCX2F3298'; then @@ -128,7 +135,7 @@ function install_menu_ke() { else run "install_camera_settings_control" "install_menu_ui_ke" fi;; - 11) + 12) if [ -f "$USB_CAMERA_FILE" ]; then error_msg "Camera USB Support is already installed!" elif v4l2-ctl --list-devices | grep -qE 'CREALITY|CCX2F3298'; then @@ -138,7 +145,7 @@ function install_menu_ke() { else run "install_usb_camera" "install_menu_ui_ke" fi;; - 12) + 13) if [ -d "$OCTOEVERYWHERE_FOLDER" ]; then error_msg "OctoEverywhere is already installed!" elif [ ! -d "$MOONRAKER_FOLDER" ]; then @@ -150,7 +157,7 @@ function install_menu_ke() { else run "install_octoeverywhere" "install_menu_ui_ke" fi;; - 13) + 14) if [ ! -d "$MOONRAKER_FOLDER" ]; then error_msg "Moonraker and Nginx are needed, please install them first!" elif [ ! -d "$FLUIDD_FOLDER" ] && [ ! -d "$MAINSAIL_FOLDER" ]; then @@ -160,13 +167,13 @@ function install_menu_ke() { else run "install_moonraker_obico" "install_menu_ui_ke" fi;; - 14) + 15) if [ ! -d "$MOONRAKER_FOLDER" ] && [ ! -d "$NGINX_FOLDER" ]; then error_msg "Moonraker and Nginx are needed, please install them first!" else run "install_guppyflo" "install_menu_ui_ke" fi;; - 15) + 16) if [ -d "$MOBILERAKER_COMPANION_FOLDER" ]; then error_msg "Mobileraker Companion is already installed!" elif [ ! -d "$MOONRAKER_FOLDER" ]; then @@ -178,7 +185,7 @@ function install_menu_ke() { else run "install_mobileraker_companion" "install_menu_ui_ke" fi;; - 16) + 17) if [ -d "$OCTOAPP_COMPANION_FOLDER" ]; then error_msg "OctoApp Companion is already installed!" elif [ ! -d "$MOONRAKER_FOLDER" ]; then @@ -190,7 +197,7 @@ function install_menu_ke() { else run "install_octoapp_companion" "install_menu_ui_ke" fi;; - 17) + 18) if grep -q "\[simplyprint\]" "$MOONRAKER_CFG"; then error_msg "SimplyPrint is already installed!" elif [ ! -d "$MOONRAKER_FOLDER" ]; then @@ -209,4 +216,4 @@ function install_menu_ke() { esac done install_menu_ke -} +} \ No newline at end of file diff --git a/scripts/menu/KE/remove_menu_KE.sh b/scripts/menu/KE/remove_menu_KE.sh index c8d1d00..0c48923 100755 --- a/scripts/menu/KE/remove_menu_KE.sh +++ b/scripts/menu/KE/remove_menu_KE.sh @@ -19,20 +19,21 @@ function remove_menu_ui_ke() { subtitle '•IMPROVEMENTS:' menu_option ' 6' 'Remove' 'Improved Shapers Calibrations' menu_option ' 7' 'Remove' 'Save Z-Offset Macros' - menu_option ' 8' 'Remove' 'Git Backup' + menu_option ' 8' 'Remove' 'M600 Support' + menu_option ' 9' 'Remove' 'Git Backup' hr subtitle '•CAMERA:' - menu_option ' 9' 'Remove' 'Moonraker Timelapse' - menu_option '10' 'Install' 'Nebula Camera Settings Control' - menu_option '11' 'Remove' 'USB Camera Support' + menu_option '10' 'Remove' 'Moonraker Timelapse' + menu_option '11' 'Install' 'Nebula Camera Settings Control' + menu_option '12' 'Remove' 'USB Camera Support' hr subtitle '•REMOTE ACCESS:' - menu_option '12' 'Remove' 'OctoEverywhere' - menu_option '13' 'Remove' 'Moonraker Obico' - menu_option '14' 'Remove' 'GuppyFLO' - menu_option '15' 'Remove' 'Mobileraker Companion' - menu_option '16' 'Remove' 'OctoApp Companion' - menu_option '17' 'Remove' 'SimplyPrint' + menu_option '13' 'Remove' 'OctoEverywhere' + menu_option '14' 'Remove' 'Moonraker Obico' + menu_option '15' 'Remove' 'GuppyFLO' + menu_option '16' 'Remove' 'Mobileraker Companion' + menu_option '17' 'Remove' 'OctoApp Companion' + menu_option '18' 'Remove' 'SimplyPrint' hr inner_line hr @@ -119,60 +120,66 @@ function remove_menu_ke() { run "remove_save_zoffset_macros" "remove_menu_ui_ke" fi;; 8) + if [ ! -f "$M600_SUPPORT_FILE" ]; then + error_msg "M600 Support is not installed!" + else + run "remove_m600_support" "remove_menu_ui_ke" + fi;; + 9) if [ ! -f "$GIT_BACKUP_FILE" ]; then error_msg "Git Backup is not installed!" else run "remove_git_backup" "remove_menu_ui_ke" fi;; - 9) + 10) if [ ! -f "$TIMELAPSE_FILE" ]; then error_msg "Moonraker Timelapse is not installed!" else run "remove_moonraker_timelapse" "remove_menu_ui_ke" fi;; - 10) + 11) if [ ! -f "$CAMERA_SETTINGS_FILE" ]; then error_msg "Nebula Camera Settings Control is not installed!" else run "remove_camera_settings_control" "remove_menu_ui_ke" fi;; - 11) + 12) if [ ! -f "$USB_CAMERA_FILE" ]; then error_msg "USB Camera Support is not installed!" else run "remove_usb_camera" "remove_menu_ui_3v3" fi;; - 12) + 13) if [ ! -d "$OCTOEVERYWHERE_FOLDER" ]; then error_msg "OctoEverywhere is not installed!" else run "remove_octoeverywhere" "remove_menu_ui_ke" fi;; - 13) + 14) if [ ! -d "$MOONRAKER_OBICO_FOLDER" ]; then error_msg "Moonraker Obico is not installed!" else run "remove_moonraker_obico" "remove_menu_ui_ke" fi;; - 14) + 15) if [ ! -d "$GUPPYFLO_FOLDER" ]; then error_msg "GuppyFLO is not installed!" else run "remove_guppyflo" "remove_menu_ui_ke" fi;; - 15) + 16) if [ ! -d "$MOBILERAKER_COMPANION_FOLDER" ]; then error_msg "Mobileraker Companion is not installed!" else run "remove_mobileraker_companion" "remove_menu_ui_ke" fi;; - 16) + 17) if [ ! -d "$OCTOAPP_COMPANION_FOLDER" ]; then error_msg "OctoApp Companion is not installed!" else run "remove_octoapp_companion" "remove_menu_ui_ke" fi;; - 17) + 18) if ! grep -q "\[simplyprint\]" "$MOONRAKER_CFG"; then error_msg "SimplyPrint is not installed!" else @@ -187,4 +194,4 @@ function remove_menu_ke() { esac done remove_menu_ke -} +} \ No newline at end of file diff --git a/scripts/paths.sh b/scripts/paths.sh index ebebb95..1f5e465 100755 --- a/scripts/paths.sh +++ b/scripts/paths.sh @@ -120,6 +120,7 @@ function set_paths() { M600_SUPPORT_FILE="${HS_CONFIG_FOLDER}/M600-support.cfg" M600_SUPPORT_URL="${HS_FILES}/macros/M600-support.cfg" M600_SUPPORT_3V3_URL="${HS_FILES}/macros/M600-support-3v3.cfg" + M600_SUPPORT_3KE_URL="${HS_FILES}/macros/M600-support-ke.cfg" # Git Backup # GIT_BACKUP_INSTALLER="${HS_FILES}/git-backup/git-backup.sh"