From b48fdc708c052b6c4342db499307518db13d702b Mon Sep 17 00:00:00 2001 From: ruipeng <1041589370@qq.com> Date: Thu, 19 Jun 2025 11:15:47 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9EP800=E7=9A=84=E9=85=8D?= =?UTF-8?q?=E7=BD=AE=E6=96=87=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/moonraker_P800.conf | 131 +++++++++++++++++++++++++++++++++++++ 1 file changed, 131 insertions(+) create mode 100644 config/moonraker_P800.conf diff --git a/config/moonraker_P800.conf b/config/moonraker_P800.conf new file mode 100644 index 0000000..69a1bd5 --- /dev/null +++ b/config/moonraker_P800.conf @@ -0,0 +1,131 @@ +[server] +host: 0.0.0.0 +port: %PORT% +klippy_uds_address: %UDS% + +[authorization] +trusted_clients: + %LAN% + 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 + +[octoprint_compat] + +[firmware_manager] + +[history] + +[power Printer] +type: gpio +pin: gpiochip4/gpio13 +initial_state: on +off_when_shutdown: true +off_when_shutdown_delay: 86400 +on_when_job_queued: true +locked_while_printing: true +restart_klipper_when_powered: true +# restart_delay: 1 +bound_services: + klipper + KlipperScreen + crowsnest + +[button switch_button] +type: gpio +pin: ^gpiochip4/gpio12 +debounce_period: .02 +minimum_event_time: 0 +on_press: + {% if event.elapsed_time > 5.0 %} + {% do call_method("machine.shutdown") %} + {% endif %} +on_release: + {% do call_method("machine.device_power.post_device", device="Printer", action="toggle") %} + +[button power_outage] +type: gpio +pin: ^!gpiochip4/gpio19 +debounce_period: .01 +minimum_event_time: 0 +on_press: + {% do call_method("printer.gcode.script", script="TURN_OFF_HEATERS") %} + {% do call_method("printer.gcode.script", script="GET_TASKLINE") %} + {% set query_objs = {"print_stats": ["state"], "toolhead": ["extruder"], "virtual_sdcard": ["file_path", "file_position", "file_line"]} %} + {% set status = call_method("printer.objects.query", objects=query_objs) %} + {% do call_method("printer.emergency_stop") %} + {% set data = status | tojson | fromjson %} + {% set print_state = data['status']['print_stats']['state'] %} + # Judging the printer status + {% if print_state | string == 'printing' or print_state | string == 'paused' %} + {% set hotend = data['status']['toolhead']['extruder'] %} + {% set position = data['status']['virtual_sdcard']['file_position'] %} + {% set line = data['status']['virtual_sdcard']['file_line'] %} + {% set filepath = data['status']['virtual_sdcard']['file_path'] %} + # save file position and line + {% do call_method("printer.gcode.script", script="SAVE_VARIABLE VARIABLE=power_resume_position VALUE=" + position | string) %} + {% do call_method("printer.gcode.script", script="SAVE_VARIABLE VARIABLE=power_resume_line VALUE=" + line | string) %} + {% set script = "SAVE_VARIABLE VARIABLE=power_loss_paused VALUE=" ~ ("False" if print_state | string == 'printing' else "True") %} + {% if print_state | string in ['printing', 'paused'] %} + {% do call_method("printer.gcode.script", script=script) %} + {% endif %} + # save extruder + {% do call_method("printer.gcode.script", script="SAVE_VARIABLE VARIABLE=power_resume_extruder VALUE=\"'" + hotend | string + "'\"") %} + # save file + {% do call_method("printer.gcode.script", script="SAVE_VARIABLE VARIABLE=filepath VALUE=\"'" + filepath | string + "'\"") %} + save interrupt + {% do call_method("printer.gcode.script", script="SAVE_VARIABLE VARIABLE=was_interrupted VALUE=True") %} + {% else %} + {% do call_method("printer.gcode.script", script="SAVE_VARIABLE VARIABLE=was_interrupted VALUE=False") %} + {% endif %} + # shutdown + {% do call_method("machine.shutdown") %} + +[update_manager] +channel: stable +refresh_interval: 168 + +[update_manager klipper] +channel: stable + +[update_manager KlipperScreen] +type: git_repo +path: /home/klipper/KlipperScreen +origin: https://github.com/CreatBotOfficail/CreatBotKlipperScreen.git +env: /home/klipper/.KlipperScreen-env/bin/python +requirements: scripts/KlipperScreen-requirements.txt +install_script: scripts/KlipperScreen-install.sh +channel: stable +primary_branch: P800 + +[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 + +[update_manager mainsail] +type: web +channel: stable +repo: mainsail-crew/mainsail +path: ~/mainsail + +# Crowsnest update_manager entry +[update_manager crowsnest] +type: git_repo +path: ~/crowsnest +origin: https://github.com/CreatBotOfficail/CreatBotCrowsnest.git +managed_services: crowsnest +install_script: tools/pkglist.sh