Skip to content

Commit

Permalink
Merge pull request #39 from dimalo/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
dimalo authored Dec 15, 2022
2 parents cc3894e + 59b1be7 commit 28f5746
Show file tree
Hide file tree
Showing 20 changed files with 449 additions and 59 deletions.
10 changes: 9 additions & 1 deletion .github/workflows/klipper_moonraker_multiarch.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,19 @@ on:
- main
- develop
schedule:
- cron: "42 13 * * 0,2,5"
- cron: "42 13 * * 0"

jobs:
consecutiveness:
runs-on: ubuntu-latest
steps:
- uses: mktcode/consecutive-workflow-action@e2e008186aa210faacd68ec30f6ac236f7e2f435
with:
token: ${{ secrets.GITHUB_TOKEN }}

docker:
runs-on: ubuntu-latest
needs: [ consecutiveness ]
steps:
- name: Checkout
uses: actions/checkout@v2
Expand Down
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
printer.cfg
!config/printer.cfg
.config
.config
build
25 changes: 25 additions & 0 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
"version": "2.0.0",
"tasks": [
{
"label": "Build Klipper Image",
"type": "shell",
"command": "docker build --pull --rm -f '${workspaceFolder}/klipper/Dockerfile' -t dimalo/klipper-moonraker:next ${workspaceFolder}",
"group": {
"kind": "build",
"isDefault": true
}
},
{
"label": "Run Klipper Image",
"type": "shell",
"command": "docker run -it --rm --cap-add SYS_NICE dimalo/klipper-moonraker:next",
"group": {
"kind": "none",
"isDefault": true
}
}
]
}
25 changes: 24 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
![Mainsail Multiarch Image CI](https://github.com/dimalo/klipper-web-control-docker/workflows/Mainsail%20Multiarch%20Image%20CI/badge.svg)
![Klipper Moonraker Multiarch Image CI](https://github.com/dimalo/klipper-web-control-docker/workflows/Klipper%20Moonraker%20Multiarch%20Image%20CI/badge.svg)

- [klipper-web-control-docker](#klipper-web-control-docker)
- [Features](#features)
- [Getting started](#getting-started)
- [Install the services](#install-the-services)
- [If things are running fine now...](#if-things-are-running-fine-now)
- [If things are not running...](#if-things-are-not-running)
- [Features not implemented or not tested (yet)](#features-not-implemented-or-not-tested-yet)
- [Credits](#credits)
# klipper-web-control-docker
__Klipper with Moonraker shipped with Fluidd and/or Mainsail__

Expand All @@ -14,6 +22,7 @@ __Klipper with Moonraker shipped with Fluidd and/or Mainsail__
- Docker multistage builds for optimized image sizes
- fully integrated klipper image with moonraker enabled
- startup management with supervisord & dependent startup (klipper starts first, then only if klipper is running moonraker is started)
- Optionally use the klipper_z_calibration-extension
- collection of useful klipper macros [see client_macros.cfg](./config/client_macros.cfg)
- Nozzle prime line with random Y starting point

Expand Down Expand Up @@ -47,7 +56,7 @@ __Klipper with Moonraker shipped with Fluidd and/or Mainsail__
- supports [Fluidd](https://github.com/cadriel/fluidd)
- supports [Mainsail](https://github.com/meteyou/mainsail)
- you can even run both in parallel!
- only your printer.cfg is required!
- only your printer.cfg is required
- the services start without it, so you can supply your config through the web UI
- you can mount your config file to /home/klippy/.config/printer.cfg, and klipper will pick it up after a restart

Expand Down Expand Up @@ -99,6 +108,19 @@ Run ```docker-compose build```

After build run ```docker-compose up -d``` and see if it works.

__Klipper is crashing:__

(from [#25](https://github.com/dimalo/klipper-web-control-docker/issues/25))

_Klipper crashes with log similar to:_
```log
klipper Fatal Python error: pyinit_main: can't initialize time
klipper | Python runtime state: core initialized
klipper | PermissionError: [Errno 1] Operation not permitted
```


check your libseccomp version and update if needed (see [https://docs.linuxserver.io/faq#libseccomp](https://docs.linuxserver.io/faq#libseccomp))
## Features not implemented or not tested (yet)
- compiling klipper.bin for your printer (will need compile tools which bloat the image so this will likely not be implemented)
- automatic updates for klipper/moonraker (partly working as repos are getting updated but no dependency installs happen - update the container with ```docker-compose pull``` instead)
Expand All @@ -112,4 +134,5 @@ After build run ```docker-compose up -d``` and see if it works.
- [Moonraker](https://github.com/Arksine/moonraker)
- [Fluidd](https://github.com/cadriel/fluidd)
- [Mainsail](https://github.com/meteyou/mainsail)
- [klipper_z_calibration](https://github.com/protoloft/klipper_z_calibration)
- awesome global RepRap open source community!
17 changes: 17 additions & 0 deletions build_firmware.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!zsh

BASE=$(pwd)
echo $BASE
TARGET=cheetah
BUILD_DIR=${BASE}/build
CONFIG_NAME=".config_${TARGET}"
CONFIG_PATH=${BUILD_DIR}/${CONFIG_NAME}
touch ${CONFIG_PATH}
OUT_DIR=${BUILD_DIR}/klipper_build_${TARGET}
mkdir -p ${BUILD_DIR}
CONTAINER=$(docker run -d -v ${CONFIG_PATH}:/home/klippy/klipper/.config -v ${BUILD_DIR}:/home/klippy/klipper/out klipper-builder sleep infinity)
docker exec -it ${CONTAINER} make menuconfig
docker exec ${CONTAINER} make
#docker exec ${CONTAINER} make flash
docker stop ${CONTAINER}
docker rm ${CONTAINER}
10 changes: 7 additions & 3 deletions config/client_macros.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -159,13 +159,15 @@ gcode:
# load filament
[gcode_macro LOAD_FILAMENT]
gcode:
{% set E = params.E|default(400) %}

SAVE_GCODE_STATE NAME=loading_filament
M117 Loading Filament
G91 # set relative
G92 E0.0
LOW_TEMP_CHECK
G1 E15 F120 # some extra to prime the nozzle --> slower
G1 E395 F1500 # length of bowden tube till cold-end (~420mm)
G1 E15 F120 # pull filament slowly into extruder
G1 E{E} F1500 # length of bowden tube till cold-end (~420mm)
G1 E25 F120 # some extra to prime the nozzle --> slower
G92 E0.0
RESTORE_GCODE_STATE NAME=loading_filament
Expand All @@ -179,14 +181,16 @@ gcode:
# unload filament
[gcode_macro UNLOAD_FILAMENT]
gcode:
{% set E = params.E|default(420) %}

SAVE_GCODE_STATE NAME=unloading_filament
M117 Unloading Filament
LOW_TEMP_CHECK
G91 # set relative
G1 E8 F100
G1 E2 F300
G1 E-10 F1800
G1 E-420 F1500 # the E is the length of the bowden tube (420mm)
G1 E-{E} F1500 # the E is the length of the bowden tube (420mm)
G92 E0.0
RESTORE_GCODE_STATE NAME=unloading_filament

Expand Down
12 changes: 12 additions & 0 deletions config/host_mcu.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# https://github.com/Klipper3d/klipper/blob/master/config/sample-raspberry-pi.cfg
# This file contains an example configuration with RPi as secondary mcu

# See docs/Config_Reference.md for a description of parameters.

# The rpi microcontroller is used as secondary.
# Typically, both the X and Y axes
# are connected to the main micro-controller. The rpi microcontroller is used
# on non time-critical functions such as enclosure sensors, additional fan or
# light sources
[mcu host]
serial: /tmp/klipper_host_mcu
4 changes: 0 additions & 4 deletions config/klipper.cfg

This file was deleted.

21 changes: 20 additions & 1 deletion config/moonraker.conf
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,22 @@
host: 0.0.0.0
port: 7125
enable_debug_logging: False

[file_manager]
config_path: /home/klippy/.config
database_path: /home/klippy/.moonraker_database
queue_gcode_uploads: True
enable_object_processing: True

[job_queue]
load_on_startup: True

[data_store]
temperature_store_size: 1800
gcode_store_size: 1000

[database]
database_path: /home/klippy/.moonraker_database

[authorization]
cors_domains:
http://*.local
Expand All @@ -26,3 +37,11 @@ trusted_clients:
[update_manager]
enable_repo_debug: True
enable_system_updates: False

[machine]
provider: none

[update_manager client z_calibration]
type: git_repo
path: ~/klipper_z_calibration
origin: https://github.com/protoloft/klipper_z_calibration.git
11 changes: 10 additions & 1 deletion config/printer.cfg
Original file line number Diff line number Diff line change
@@ -1,2 +1,11 @@
# This is a dummy config.
# Either mount your config from host like <config_path>:/home/klippy/.config/printer.cfg or change the contents of this file in UI to match your printer!
# Either mount your config from host like <config_path>:/home/klippy/.config/printer.cfg or change the contents of this file in UI to match your printer!

[include host_mcu.cfg]
[include client.cfg]
[include client_macros.cfg]
[include calibration_macros.cfg]

# To use the klipper_z_calibration-extension uncomment the following line
# Please see https://github.com/protoloft/klipper_z_calibration
#[include z_calibration.cfg]
74 changes: 74 additions & 0 deletions config/z_calibration.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
# https://github.com/protoloft/klipper_z_calibration#configurations

[z_calibration]
nozzle_xy_position:
# A X, Y coordinate (e.g. 100,100) of the nozzle, clicking on the Z endstop.
switch_xy_position:
# A X, Y coordinate (e.g. 100,100) of the probe's switch body, clicking on
# the Z endstop.
bed_xy_position: default from relative_reference_index of bed_mesh
# a X, Y coordinate (e.g. 100,100) where the print surface (e.g. the center
# point) is probed. These coordinates will be adapted by the
# probe's X and Y offsets. The default is the relative_reference_index
# of the configured bed_mesh, if configured. It's possible to change the relative
# reference index at runtime or use the GCode argument BED_POSITION of CALIBRATE_Z.
switch_offset:
# The trigger point offset of the used mag-probe switch.
# Larger values will position the nozzle closer to the bed.
# This needs to be find out manually. More on this later
# in this section..
max_deviation: 1.0
# The maximum allowed deviation of the calculated offset.
# If the offset exceeds this value, it will stop!
# The default is 1.0 mm.
samples: default from "probe:samples" section
# The number of times to probe each point. The probed z-values
# will be averaged. The default is from the probe's configuration.
samples_tolerance: default from "probe:samples_tolerance" section
# The maximum Z distance (in mm) that a sample may differ from other
# samples. The default is from the probe's configuration.
samples_tolerance_retries: default from "probe:samples_tolerance_retries" section
# The number of times to retry if a sample is found that exceeds
# samples_tolerance. The default is from the probe's configuration.
samples_result: default from "probe:samples_result" section
# The calculation method when sampling more than once - either
# "median" or "average". The default is from the probe's configuration.
clearance: 2 * z_offset from the "probe:z_offset" section
# The distance in mm to move up before moving to the next
# position. The default is two times the z_offset from the probe's
# configuration.
position_min: default from "stepper_z:position_min" section.
# Minimum valid distance (in mm) used for probing move. The
# default is from the Z rail configuration.
speed: 50
# The moving speed in X and Y. The default is 50 mm/s.
lift_speed: default from "probe:lift_speed" section
# Speed (in mm/s) of the Z axis when lifting the probe between
# samples and clearance moves. The default is from the probe's
# configuration.
probing_speed: default from "stepper_z:homing_speed" section.
# The fast probing speed (in mm/s) used, when probing_first_fast
# is activated. The default is from the Z rail configuration.
probing_second_speed: default from "stepper_z:second_homing_speed" section.
# The slower speed (in mm/s) for probing the recorded samples.
# The default is second_homing_speed of the Z rail configuration.
probing_retract_dist: default from "stepper_z:homing_retract_dist" section.
# Distance to retract (in mm) before probing the next sample.
# The default is homing_retract_dist from the Z rail configuration.
probing_first_fast: false
# If true, the first probing is done faster by the probing speed.
# This is to get faster down and the result is not recorded as a
# probing sample. The default is false.
start_gcode:
# A list of G-Code commands to execute prior to each calibration command.
# See docs/Command_Templates.md for G-Code format. This can be used to
# attach the probe.
before_switch_gcode:
# A list of G-Code commands to execute prior to each probing on the
# mag-probe. See docs/Command_Templates.md for G-Code format. This can be
# used to attach the probe after probing on the nozzle and before probing
# on the mag-probe.
end_gcode:
# A list of G-Code commands to execute after each calibration command.
# See docs/Command_Templates.md for G-Code format. This can be used to
# detach the probe afterwards.
Loading

0 comments on commit 28f5746

Please sign in to comment.