Merge remote-tracking branch 'upstream/master' into dgus-display

This commit is contained in:
Desuuuu 2022-05-22 18:04:09 +02:00
commit 0b8d84d5d4
No known key found for this signature in database
GPG Key ID: 85943F4B2C2CE0DC
337 changed files with 88248 additions and 3263 deletions

View File

@ -8,9 +8,8 @@ jobs:
if: github.repository == 'Klipper3d/klipper' if: github.repository == 'Klipper3d/klipper'
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/github-script@v3 - uses: actions/github-script@v6
with: with:
github-token: ${{secrets.GITHUB_TOKEN}}
script: | script: |
if (context.payload.label.name != "not on github") if (context.payload.label.name != "not on github")
return; return;
@ -36,7 +35,7 @@ jobs:
+ "~ Your friendly GitIssueBot" + "~ Your friendly GitIssueBot"
+ "\n\n" + "\n\n"
+ "PS: I'm just an automated script, not a human being."; + "PS: I'm just an automated script, not a human being.";
github.issues.createComment({ github.rest.issues.createComment({
issue_number: context.issue.number, issue_number: context.issue.number,
owner: context.repo.owner, owner: context.repo.owner,
repo: context.repo.repo, repo: context.repo.repo,

View File

@ -1,5 +1,7 @@
name: klipper3d deploy name: klipper3d deploy
on: on:
schedule:
- cron: "0 0 * * *"
push: push:
branches: branches:
- master - master
@ -24,6 +26,10 @@ jobs:
${{ runner.os }}-pip- ${{ runner.os }}-pip-
- name: Install dependencies - name: Install dependencies
run: pip install -r docs/_klipper3d/mkdocs-requirements.txt run: pip install -r docs/_klipper3d/mkdocs-requirements.txt
- name: Build and deploy klipper3d - name: Build MkDocs Pages
run: | run: docs/_klipper3d/build-translations.sh
mkdocs gh-deploy --config-file docs/_klipper3d/mkdocs.yml --remote-branch gh-pages --force --verbose - name: Deploy
uses: JamesIves/github-pages-deploy-action@v4.2.5
with:
branch: gh-pages # The branch the action should deploy to.
folder: site # The folder the action should deploy.

View File

@ -0,0 +1,66 @@
# Add a comment to github PRs marked with the "reviewer needed" label
name: "Add comment to PRs marked 'reviewer needed'"
on:
pull_request_target:
types: [labeled]
jobs:
add_comment:
if: github.repository == 'Klipper3d/klipper'
runs-on: ubuntu-latest
steps:
- uses: actions/github-script@v6
with:
script: |
if (context.payload.label.name != "reviewer needed")
return;
if (context.payload.pull_request.assignees.length > 0)
return;
msg = "Thank you for your contribution to Klipper."
+ " Unfortunately, a reviewer has not assigned themselves to"
+ " this GitHub Pull Request. All Pull Requests are reviewed"
+ " before merging, and a reviewer will need to volunteer."
+ " Further information is available at:"
+ " https://www.klipper3d.org/CONTRIBUTING.html"
+ "\n\n"
+ "There are some steps that you can take now:"
+ "\n"
+ "1. Perform a self-review of your Pull Request by following"
+ " the steps at:"
+ " https://www.klipper3d.org/CONTRIBUTING.html#what-to-expect-in-a-review"
+ "\n"
+ " If you have completed a self-review, be sure to state the"
+ " results of that self-review explicitly in the Pull Request"
+ " comments. A reviewer is more likely to participate if the"
+ " bulk of a review has already been completed."
+ "\n"
+ "2. Consider opening a topic on the [Klipper Discourse]"
+ "(https://www.klipper3d.org/Contact.html#community-forum)"
+ " server to discuss this work. The Discourse server is a good"
+ " place to discuss development ideas and to engage users"
+ " interested in testing. Reviewers are more likely to"
+ " prioritize Pull Requests with an active community of users."
+ "\n"
+ "3. Consider helping out reviewers by reviewing other Klipper"
+ " Pull Requests. Taking the time to perform a careful and"
+ " detailed review of others work is appreciated. Regular"
+ " contributors are more likely to prioritize the"
+ " contributions of other regular contributors."
+ "\n\n"
+ "Unfortunately, if a reviewer does not assign themselves to"
+ " this GitHub Pull Request then it will be automatically"
+ " closed. If this happens, then it is a good idea to move"
+ " further discussion to the [Klipper Discourse]"
+ "(https://www.klipper3d.org/Contact.html#community-forum)"
+ " server. Reviewers can reach out on that forum to let you"
+ " know if they are interested and when they are available."
+ "\n\n"
+ "Best regards,\n"
+ "~ Your friendly GitIssueBot"
+ "\n\n"
+ "PS: I'm just an automated script, not a human being.";
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: msg
})

View File

@ -36,10 +36,12 @@ jobs:
if: github.repository == 'Klipper3d/klipper' if: github.repository == 'Klipper3d/klipper'
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/github-script@v3 - uses: actions/github-script@v6
with: with:
script: | script: |
const issues = await github.issues.listForRepo({ const expireMillis = 1000 * 60 * 60 * 36;
const curtime = new Date().getTime();
const issues = await github.rest.issues.listForRepo({
owner: context.repo.owner, owner: context.repo.owner,
repo: context.repo.repo, repo: context.repo.repo,
state: 'open', state: 'open',
@ -47,28 +49,167 @@ jobs:
per_page: 100, per_page: 100,
page: 1 page: 1
}); });
const expireMillis = 1000 * 60 * 60 * 36; for (const issue of issues.data.values()) {
const curtime = new Date().getTime();
for (var issue of issues.data.values()) {
const updatetime = new Date(issue.updated_at).getTime(); const updatetime = new Date(issue.updated_at).getTime();
if (curtime < updatetime + expireMillis) if (curtime < updatetime + expireMillis)
continue; continue;
await github.issues.update({ await github.rest.issues.update({
owner: context.repo.owner, owner: context.repo.owner,
repo: context.repo.repo, repo: context.repo.repo,
issue_number: issue.number, issue_number: issue.number,
state: 'closed' state: 'closed'
}); });
} }
# Close tickets marked with "reviewer needed" label for 2+ weeks
close_reviewer_needed:
if: github.repository == 'Klipper3d/klipper'
runs-on: ubuntu-latest
steps:
- uses: actions/github-script@v6
with:
script: |
const issues = await github.rest.issues.listForRepo({
owner: context.repo.owner,
repo: context.repo.repo,
state: 'open',
labels: 'reviewer needed',
assignee: 'none',
per_page: 100,
page: 1
});
msg = "Unfortunately a reviewer has not assigned themselves to"
+ " this GitHub Pull Request and it is therefore being"
+ " closed. It is a good idea to move"
+ " further discussion to the [Klipper Discourse]"
+ "(https://www.klipper3d.org/Contact.html#community-forum)"
+ " server. Reviewers can reach out on that forum to let you"
+ " know if they are interested and when they are available."
+ "\n\n"
+ "Best regards,\n"
+ "~ Your friendly GitIssueBot"
+ "\n\n"
+ "PS: I'm just an automated script, not a human being.";
const expireMillis = 1000 * 60 * 60 * 24 * 14;
const curtime = new Date().getTime();
for (const issue of issues.data.values()) {
const updatetime = new Date(issue.updated_at).getTime();
if (curtime < updatetime + expireMillis)
continue;
await github.rest.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: issue.number,
body: msg
});
await github.rest.issues.update({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: issue.number,
state: 'closed'
});
}
# Mark unassigned PRs that are idle for 2 weeks
mark_reviewer_needed:
if: github.repository == 'Klipper3d/klipper'
runs-on: ubuntu-latest
steps:
- uses: actions/github-script@v6
with:
script: |
msg = "Thank you for your contribution to Klipper."
+ " Unfortunately, a reviewer has not assigned themselves to"
+ " this GitHub Pull Request. All Pull Requests are reviewed"
+ " before merging, and a reviewer will need to volunteer."
+ " Further information is available at:"
+ " https://www.klipper3d.org/CONTRIBUTING.html"
+ "\n\n"
+ "There are some steps that you can take now:"
+ "\n"
+ "1. Perform a self-review of your Pull Request by following"
+ " the steps at:"
+ " https://www.klipper3d.org/CONTRIBUTING.html#what-to-expect-in-a-review"
+ "\n"
+ " If you have completed a self-review, be sure to state the"
+ " results of that self-review explicitly in the Pull Request"
+ " comments. A reviewer is more likely to participate if the"
+ " bulk of a review has already been completed."
+ "\n"
+ "2. Consider opening a topic on the [Klipper Discourse]"
+ "(https://www.klipper3d.org/Contact.html#community-forum)"
+ " server to discuss this work. The Discourse server is a good"
+ " place to discuss development ideas and to engage users"
+ " interested in testing. Reviewers are more likely to"
+ " prioritize Pull Requests with an active community of users."
+ "\n"
+ "3. Consider helping out reviewers by reviewing other Klipper"
+ " Pull Requests. Taking the time to perform a careful and"
+ " detailed review of others work is appreciated. Regular"
+ " contributors are more likely to prioritize the"
+ " contributions of other regular contributors."
+ "\n\n"
+ "Unfortunately, if a reviewer does not assign themselves to"
+ " this GitHub Pull Request then it will be automatically"
+ " closed. If this happens, then it is a good idea to move"
+ " further discussion to the [Klipper Discourse]"
+ "(https://www.klipper3d.org/Contact.html#community-forum)"
+ " server. Reviewers can reach out on that forum to let you"
+ " know if they are interested and when they are available."
+ "\n\n"
+ "Best regards,\n"
+ "~ Your friendly GitIssueBot"
+ "\n\n"
+ "PS: I'm just an automated script, not a human being.";
const create_check = new Date("2022-03-01T00:00:00Z").getTime();
const expireMillis = 1000 * 60 * 60 * 24 * 14;
const curtime = new Date().getTime();
const pulls_req = await github.rest.pulls.list({
owner: context.repo.owner,
repo: context.repo.repo,
per_page: 100,
page: 1
});
for (const pr of pulls_req.data.values()) {
const createtime = new Date(pr.created_at).getTime();
if (createtime < create_check)
continue;
const updatetime = new Date(pr.updated_at).getTime();
if (curtime < updatetime + expireMillis)
continue;
if (pr.labels.length > 0)
continue;
if (pr.assignees.length > 0)
continue;
await github.rest.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: pr.number,
body: msg
});
await github.rest.issues.addLabels({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: pr.number,
labels: ['reviewer needed']
});
}
# Close tickets marked with "resolved" label # Close tickets marked with "resolved" label
close_resolved: close_resolved:
if: github.repository == 'Klipper3d/klipper' if: github.repository == 'Klipper3d/klipper'
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/github-script@v3 - uses: actions/github-script@v6
with: with:
script: | script: |
const issues = await github.issues.listForRepo({ msg = "This ticket is being closed because the underlying issue"
+ " is now thought to be resolved."
+ "\n\n"
+ "Best regards,\n"
+ "~ Your friendly GitIssueBot"
+ "\n\n"
+ "PS: I'm just an automated script, not a human being.";
const expireMillis = 1000 * 60 * 60 * 24 * 7;
const curtime = new Date().getTime();
const issues = await github.rest.issues.listForRepo({
owner: context.repo.owner, owner: context.repo.owner,
repo: context.repo.repo, repo: context.repo.repo,
state: 'open', state: 'open',
@ -76,26 +217,17 @@ jobs:
per_page: 100, per_page: 100,
page: 1 page: 1
}); });
const expireMillis = 1000 * 60 * 60 * 24 * 7; for (const issue of issues.data.values()) {
const curtime = new Date().getTime();
for (var issue of issues.data.values()) {
const updatetime = new Date(issue.updated_at).getTime(); const updatetime = new Date(issue.updated_at).getTime();
if (curtime < updatetime + expireMillis) if (curtime < updatetime + expireMillis)
continue; continue;
msg = "This ticket is being closed because the underlying issue" await github.rest.issues.createComment({
+ " is now thought to be resolved."
+ "\n\n"
+ "Best regards,\n"
+ "~ Your friendly GitIssueBot"
+ "\n\n"
+ "PS: I'm just an automated script, not a human being.";
await github.issues.createComment({
owner: context.repo.owner, owner: context.repo.owner,
repo: context.repo.repo, repo: context.repo.repo,
issue_number: issue.number, issue_number: issue.number,
body: msg body: msg
}); });
await github.issues.update({ await github.rest.issues.update({
owner: context.repo.owner, owner: context.repo.owner,
repo: context.repo.repo, repo: context.repo.repo,
issue_number: issue.number, issue_number: issue.number,
@ -107,10 +239,20 @@ jobs:
if: github.repository == 'Klipper3d/klipper' if: github.repository == 'Klipper3d/klipper'
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/github-script@v3 - uses: actions/github-script@v6
with: with:
script: | script: |
const issues = await github.issues.listForRepo({ msg = "This PR is being closed because it is currently not"
+ " considered a good match for the master Klipper"
+ " repository."
+ "\n\n"
+ "Best regards,\n"
+ "~ Your friendly GitIssueBot"
+ "\n\n"
+ "PS: I'm just an automated script, not a human being.";
const expireMillis = 1000 * 60 * 60 * 24 * 7;
const curtime = new Date().getTime();
const issues = await github.rest.issues.listForRepo({
owner: context.repo.owner, owner: context.repo.owner,
repo: context.repo.repo, repo: context.repo.repo,
state: 'open', state: 'open',
@ -118,27 +260,17 @@ jobs:
per_page: 100, per_page: 100,
page: 1 page: 1
}); });
const expireMillis = 1000 * 60 * 60 * 24 * 7; for (const issue of issues.data.values()) {
const curtime = new Date().getTime();
for (var issue of issues.data.values()) {
const updatetime = new Date(issue.updated_at).getTime(); const updatetime = new Date(issue.updated_at).getTime();
if (curtime < updatetime + expireMillis) if (curtime < updatetime + expireMillis)
continue; continue;
msg = "This PR is being closed because it is currently not" await github.rest.issues.createComment({
+ " considered a good match for the master Klipper"
+ " repository."
+ "\n\n"
+ "Best regards,\n"
+ "~ Your friendly GitIssueBot"
+ "\n\n"
+ "PS: I'm just an automated script, not a human being.";
await github.issues.createComment({
owner: context.repo.owner, owner: context.repo.owner,
repo: context.repo.repo, repo: context.repo.repo,
issue_number: issue.number, issue_number: issue.number,
body: msg body: msg
}); });
await github.issues.update({ await github.rest.issues.update({
owner: context.repo.owner, owner: context.repo.owner,
repo: context.repo.repo, repo: context.repo.repo,
issue_number: issue.number, issue_number: issue.number,
@ -150,10 +282,20 @@ jobs:
if: github.repository == 'Klipper3d/klipper' if: github.repository == 'Klipper3d/klipper'
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/github-script@v3 - uses: actions/github-script@v6
with: with:
script: | script: |
const issues = await github.issues.listForRepo({ msg = "It looks like this GitHub Pull Request has become"
+ " inactive. If there are any further updates, you can"
+ " add a comment here or open a new ticket."
+ "\n\n"
+ "Best regards,\n"
+ "~ Your friendly GitIssueBot"
+ "\n\n"
+ "PS: I'm just an automated script, not a human being.";
const expireMillis = 1000 * 60 * 60 * 24 * 21;
const curtime = new Date().getTime();
const issues = await github.rest.issues.listForRepo({
owner: context.repo.owner, owner: context.repo.owner,
repo: context.repo.repo, repo: context.repo.repo,
state: 'open', state: 'open',
@ -161,33 +303,23 @@ jobs:
per_page: 100, per_page: 100,
page: 1 page: 1
}); });
const expireMillis = 1000 * 60 * 60 * 24 * 21; for (const issue of issues.data.values()) {
const curtime = new Date().getTime();
for (var issue of issues.data.values()) {
const updatetime = new Date(issue.updated_at).getTime(); const updatetime = new Date(issue.updated_at).getTime();
if (curtime < updatetime + expireMillis) if (curtime < updatetime + expireMillis)
continue; continue;
msg = "It looks like this GitHub Pull Request has become" await github.rest.issues.addLabels({
+ " inactive. If there are any further updates, you can"
+ " add a comment here or open a new ticket."
+ "\n\n"
+ "Best regards,\n"
+ "~ Your friendly GitIssueBot"
+ "\n\n"
+ "PS: I'm just an automated script, not a human being.";
await github.issues.addLabels({
owner: context.repo.owner, owner: context.repo.owner,
repo: context.repo.repo, repo: context.repo.repo,
issue_number: issue.number, issue_number: issue.number,
labels: ['inactive'] labels: ['inactive']
}); });
await github.issues.createComment({ await github.rest.issues.createComment({
owner: context.repo.owner, owner: context.repo.owner,
repo: context.repo.repo, repo: context.repo.repo,
issue_number: issue.number, issue_number: issue.number,
body: msg body: msg
}); });
await github.issues.update({ await github.rest.issues.update({
owner: context.repo.owner, owner: context.repo.owner,
repo: context.repo.repo, repo: context.repo.repo,
issue_number: issue.number, issue_number: issue.number,

View File

@ -19,7 +19,7 @@ OBJCOPY=$(CROSS_PREFIX)objcopy
OBJDUMP=$(CROSS_PREFIX)objdump OBJDUMP=$(CROSS_PREFIX)objdump
STRIP=$(CROSS_PREFIX)strip STRIP=$(CROSS_PREFIX)strip
CPP=cpp CPP=cpp
PYTHON=python2 PYTHON=python3
# Source files # Source files
src-y = src-y =
@ -85,17 +85,21 @@ $(OUT)compile_time_request.o: $(patsubst %.c, $(OUT)src/%.o.ctr,$(src-y)) ./scri
################ Auto generation of "board/" include file link ################ Auto generation of "board/" include file link
$(OUT)board-link: $(KCONFIG_CONFIG) create-board-link:
@echo " Creating symbolic link $(OUT)board" @echo " Creating symbolic link $(OUT)board"
$(Q)mkdir -p $(addprefix $(OUT), $(dirs-y)) $(Q)mkdir -p $(addprefix $(OUT), $(dirs-y))
$(Q)echo "#$(CONFIG_BOARD_DIRECTORY)" > $@.temp $(Q)rm -f $(OUT)*.d $(patsubst %,$(OUT)%/*.d,$(dirs-y))
$(Q)if ! cmp -s $@.temp $@; then rm -f $(OUT)*.d $(patsubst %,$(OUT)%/*.d,$(dirs-y)) ; mv $@.temp $@ ; fi
$(Q)rm -f $(OUT)board $(Q)rm -f $(OUT)board
$(Q)ln -sf $(CURDIR)/src/$(CONFIG_BOARD_DIRECTORY) $(OUT)board $(Q)ln -sf $(CURDIR)/src/$(CONFIG_BOARD_DIRECTORY) $(OUT)board
$(Q)mkdir -p $(OUT)board-generic $(Q)mkdir -p $(OUT)board-generic
$(Q)rm -f $(OUT)board-generic/board $(Q)rm -f $(OUT)board-generic/board
$(Q)ln -sf $(CURDIR)/src/generic $(OUT)board-generic/board $(Q)ln -sf $(CURDIR)/src/generic $(OUT)board-generic/board
# Hack to rebuild OUT directory and reload make dependencies on Kconfig change
$(OUT)board-link: $(KCONFIG_CONFIG)
$(Q)mkdir -p $(OUT)
$(Q)echo "# Makefile board-link rule" > $@
$(Q)$(MAKE) create-board-link
include $(OUT)board-link include $(OUT)board-link
################ Kconfig rules ################ Kconfig rules
@ -114,7 +118,7 @@ menuconfig:
################ Generic rules ################ Generic rules
# Make definitions # Make definitions
.PHONY : all clean distclean olddefconfig menuconfig FORCE .PHONY : all clean distclean olddefconfig menuconfig create-board-link FORCE
.DELETE_ON_ERROR: .DELETE_ON_ERROR:
all: $(target-y) all: $(target-y)

View File

@ -1,7 +1,7 @@
# This file is an example config file for polar style printers. One # This file is an example config file for polar style printers. One
# may copy and edit this file to configure a new polar printer. # may copy and edit this file to configure a new polar printer.
# POLAR KINEMATICS ARE A WORK IN PROGRESS. Moves around the 0,0 # POLAR KINEMATICS ARE A WORK IN PROGRESS. Moves around the 0, 0
# position are known to not work properly. # position are known to not work properly.
# See docs/Config_Reference.md for a description of parameters. # See docs/Config_Reference.md for a description of parameters.

View File

@ -6,7 +6,7 @@
# Homing is not implemented on cable winch kinematics. In order to # Homing is not implemented on cable winch kinematics. In order to
# home the printer, manually send movement commands until the toolhead # home the printer, manually send movement commands until the toolhead
# is at 0,0,0 and then issue a G28 command. # is at 0, 0, 0 and then issue a G28 command.
# See docs/Config_Reference.md for a description of parameters. # See docs/Config_Reference.md for a description of parameters.

View File

@ -0,0 +1,147 @@
# This file contains common pin mappings for Alligator (Rev.2) board.
# To use this config, the firmware should be compiled for the Arduino
# Due.
# Remember flash procedure:
# sudo /etc/init.d/alligator-manager --erase
# sudo bossac -e -w -v -b -R -i -p ttyAMA0 klipper.bin
# See alligator github for alligator manager:
# https://github.com/3Dartists/alligator-manager
# See docs/Config_Reference.md for a description of parameters.
[static_digital_output DRV8825_microstepping]
pins:PC10
pins:PC29
pins:PC19
pins:PC18
[dac084S085 stepper_digipot]
enable_pin: PB14
spi_bus: spi0
# Scale the config so that the channel value can be specified in amps.
# (For Alligator v2.0 boards, use 2.50)
scale: 2.50
# Channel A in this example is X, B is Y, C is Z, D is E0,1,2,3.
channel_A: 1.5
channel_B: 1.5
channel_C: 1.5
channel_D: 1.0
# channel D will be the current used by all extruders if> 1
[stepper_x]
step_pin: PB24
dir_pin: !PB25
enable_pin: !PA15
microsteps: 32 # number of microstep 16, 32
rotation_distance: 16
endstop_pin: ^!PC5
position_endstop: -30
position_max: 220
position_min: -30
homing_speed: 50
[stepper_y]
step_pin: PB22
dir_pin: !PB23
enable_pin: !PA15
microsteps: 32
rotation_distance: 16
endstop_pin: ^!PC3
position_endstop: -8
position_min: -8
position_max: 220
homing_speed: 50
[stepper_z]
step_pin: PC27
dir_pin: PC28
enable_pin: !PA15
microsteps: 32
rotation_distance: 4
endstop_pin: ^!PC2
position_endstop: 0
position_max: 240
position_min: -1
[extruder]
step_pin: PC25
dir_pin: PC26
enable_pin: !PA15
microsteps: 32
rotation_distance: 7
nozzle_diameter: 0.400
filament_diameter: 1.750
heater_pin: PA1
sensor_pin: PA16 # PA16(near mcu) or PA24(near ethernet)
sensor_type: ATC Semitec 104NT-4-R025H42G
control: pid
pid_kp: 15.572
pid_ki: 0.446
pid_kd: 136.064
min_temp: 0
max_temp: 270
#[extruder1]
#step_pin: PD3
#dir_pin: !PD2
#enable_pin: !PA15
#microsteps: 32
#heater_pin: PC22
#sensor_pin: PB25
#[extruder2]
#step_pin: PD7
#dir_pin: !PD6
#enable_pin: !PA15
#microsteps: 32
#heater_pin: PC21
#sensor_pin: PC28
#[extruder3]
#step_pin: PD9
#dir_pin: !PD8
#enable_pin: !PA15
#microsteps: 32
#heater_pin: PA29
#sensor_pin: PC5
[heater_bed]
heater_pin: PA0
sensor_type: EPCOS 100K B57560G104F
sensor_pin: PA24 # PA16(near mcu) or PA24(near ethernet)
control: pid
pid_kp: 73.517
pid_ki: 1.132
pid_kd: 1193.728
min_temp: 0
max_temp: 130
[fan]
pin: PA7
#[heater_fan fan1]
#pin: PA5
#heater: extruder
[output_pin BEEPER_pin]
pin: PB19
pwm: True
value: 0
shutdown_value: 0
cycle_time: 0.1
scale: 1000
[mcu]
serial: /dev/ttyAMA0
[printer]
kinematics: cartesian
max_velocity: 300
max_accel: 1000
max_z_velocity: 20
max_z_accel: 100
#[bltouch]
#sensor_pin: ^PC6
#control_pin: PC4

View File

@ -0,0 +1,135 @@
# This file contains common pin mappings for Alligator (Rev.3) board.
# To use this config, the firmware should be compiled for the Arduino
# Due.
# Remember flash procedure:
# sudo /etc/init.d/alligator-manager --erase
# sudo bossac -e -w -v -b -R -i -p ttyAMA0 klipper.bin
# See alligator github for alligator manager:
# https://github.com/3Dartists/alligator-manager
# See docs/Config_Reference.md for a description of parameters.
[static_digital_output DRV8825_microstepping]
pins:PC10
pins:PC29
pins:PC19
pins:PC18
[dac084S085 stepper_digipot]
enable_pin: PD2
spi_bus: spi0
# Scale the config so that the channel value can be specified in amps.
# (For Alligator v3.0 boards, use 2.50)
scale: 2.50
# Channel A in this example is X, B is Y, C is Z, D is E0,1,2,3.
channel_A: 1.5
channel_B: 1.5
channel_C: 1.5
channel_D: 1.0
# channel D will be the current used by all extruders if> 1
[stepper_x]
step_pin: PB24
dir_pin: !PB25
enable_pin: !PA15
microsteps: 32 # number of microstep 16, 32
rotation_distance: 16
endstop_pin: ^!PC5
position_endstop: -30
position_max: 220
position_min: -30
homing_speed: 50
[stepper_y]
step_pin: PB22
dir_pin: !PB23
enable_pin: !PC28
microsteps: 32
rotation_distance: 16
endstop_pin: ^!PC3
position_endstop: -8
position_min: -8
position_max: 220
homing_speed: 50
[stepper_z]
step_pin: PB20
dir_pin: PB21
enable_pin: !PA29
microsteps: 32
rotation_distance: 4
endstop_pin: ^!PC2
position_endstop: 0
position_max: 240
position_min: -1
[extruder]
step_pin: PB18
dir_pin: PB19
enable_pin: !PC27
microsteps: 32
rotation_distance: 7
nozzle_diameter: 0.400
filament_diameter: 1.750
heater_pin: PA19
sensor_pin: PC25
sensor_type: ATC Semitec 104NT-4-R025H42G
control: pid
pid_kp: 15.572
pid_ki: 0.446
pid_kd: 136.064
min_temp: 0
max_temp: 270
#[extruder1]
#step_pin: PB17
#dir_pin: !PB14
#enable_pin: !PD6
#microsteps: 32
#heater_pin: PC22
#sensor_pin: PA29
#[extruder2]
#step_pin: PB12
#dir_pin: !PB13
#enable_pin: !PD8
#microsteps: 32
#heater_pin: PC21
#sensor_pin: PC28
#[extruder3]
#step_pin: PB15
#dir_pin: !PB16
#enable_pin: !PD9
#microsteps: 32
#heater_pin: PA29
#sensor_pin: PB25
[heater_bed]
heater_pin: PA0
sensor_type: EPCOS 100K B57560G104F
sensor_pin: PA8
control: pid
pid_kp: 73.517
pid_ki: 1.132
pid_kd: 1193.728
min_temp: 0
max_temp: 130
[fan]
pin: PA7
#[heater_fan fan1]
#pin: PA5
#heater: extruder
[mcu]
serial: /dev/ttyAMA0
[printer]
kinematics: cartesian
max_velocity: 300
max_accel: 1000
max_z_velocity: 20
max_z_accel: 100

View File

@ -0,0 +1,132 @@
# This file contains common pin mappings for the BIGTREETECH SKR Pico V1.0
# To use this config, the firmware should be compiled for the RP2040 with
# USB communication.
# The "make flash" command does not work on the SKR Pico V1.0. Instead,
# after running "make", copy the generated "out/klipper.uf2" file
# to the mass storage device in RP2040 boot mode
# See docs/Config_Reference.md for a description of parameters.
[stepper_x]
step_pin: gpio11
dir_pin: !gpio10
enable_pin: !gpio12
microsteps: 16
rotation_distance: 40
endstop_pin: ^gpio4
position_endstop: 0
position_max: 235
homing_speed: 50
[tmc2209 stepper_x]
uart_pin: gpio9
tx_pin: gpio8
uart_address: 0
run_current: 0.580
stealthchop_threshold: 999999
[stepper_y]
step_pin: gpio6
dir_pin: !gpio5
enable_pin: !gpio7
microsteps: 16
rotation_distance: 40
endstop_pin: ^gpio3
position_endstop: 0
position_max: 235
homing_speed: 50
[tmc2209 stepper_y]
uart_pin: gpio9
tx_pin: gpio8
uart_address: 2
run_current: 0.580
stealthchop_threshold: 999999
[stepper_z]
step_pin: gpio19
dir_pin: gpio28
enable_pin: !gpio2
microsteps: 16
rotation_distance: 8
endstop_pin: ^gpio25
position_endstop: 0.0
position_max: 250
[tmc2209 stepper_z]
uart_pin: gpio9
tx_pin: gpio8
uart_address: 1
run_current: 0.580
stealthchop_threshold: 999999
[extruder]
step_pin: gpio14
dir_pin: !gpio13
enable_pin: !gpio15
microsteps: 16
rotation_distance: 33.500
nozzle_diameter: 0.400
filament_diameter: 1.750
heater_pin: gpio23
sensor_type: EPCOS 100K B57560G104F
sensor_pin: gpio27
control: pid
pid_Kp: 21.527
pid_Ki: 1.063
pid_Kd: 108.982
min_temp: 0
max_temp: 250
[tmc2209 extruder]
uart_pin: gpio9
tx_pin: gpio8
uart_address: 3
run_current: 0.650
stealthchop_threshold: 999999
[heater_bed]
heater_pin: gpio21
sensor_type: ATC Semitec 104GT-2
sensor_pin: gpio26
control: pid
pid_Kp: 54.027
pid_Ki: 0.770
pid_Kd: 948.182
min_temp: 0
max_temp: 130
[fan]
pin: gpio17
[heater_fan nozzle_cooling_fan]
pin: gpio18
[heater_fan controller_fan]
pin: gpio20
[mcu]
serial: /dev/serial/by-id/usb-Klipper_Klipper_firmware_12345-if00
[printer]
kinematics: cartesian
max_velocity: 300
max_accel: 3000
max_z_velocity: 5
max_z_accel: 100
[neopixel board_neopixel]
pin: gpio24
chain_count: 1
color_order: GRB
initial_RED: 0.3
initial_GREEN: 0.3
initial_BLUE: 0.3
#[bltouch]
#sensor_pin: gpio22
#control_pin: gpio29
#[filament_switch_sensor runout_sensor]
#switch_pin: ^gpio16

View File

@ -11,7 +11,7 @@ dir_pin: PE10
enable_pin: !PE9 enable_pin: !PE9
microsteps: 16 microsteps: 16
rotation_distance: 40 rotation_distance: 40
endstop_pin: PB14 # PA1 for X-max endstop_pin: ^PB14 # PA1 for X-max
position_endstop: 0 position_endstop: 0
position_max: 200 position_max: 200
@ -21,7 +21,7 @@ dir_pin: PB12
enable_pin: !PD9 enable_pin: !PD9
microsteps: 16 microsteps: 16
rotation_distance: 40 rotation_distance: 40
endstop_pin: PB13 # PA2 for Y-max endstop_pin: ^PB13 # PA2 for Y-max
position_endstop: 0 position_endstop: 0
position_max: 200 position_max: 200
@ -31,7 +31,7 @@ dir_pin: PD13
enable_pin: !PD15 enable_pin: !PD15
microsteps: 16 microsteps: 16
rotation_distance: 8 rotation_distance: 8
endstop_pin: PA0 # PA3 for Z-max endstop_pin: ^PA0 # PA3 for Z-max
position_endstop: 0 position_endstop: 0
position_max: 400 position_max: 400

View File

@ -11,7 +11,7 @@ dir_pin: PE10
enable_pin: !PE12 enable_pin: !PE12
microsteps: 16 microsteps: 16
rotation_distance: 40 rotation_distance: 40
endstop_pin: PB14 # PA1 for X-max endstop_pin: ^PB14 # PA1 for X-max
position_endstop: 0 position_endstop: 0
position_max: 200 position_max: 200
@ -21,7 +21,7 @@ dir_pin: PB12
enable_pin: !PD9 enable_pin: !PD9
microsteps: 16 microsteps: 16
rotation_distance: 40 rotation_distance: 40
endstop_pin: PB13 # PA2 for Y-max endstop_pin: ^PB13 # PA2 for Y-max
position_endstop: 0 position_endstop: 0
position_max: 200 position_max: 200
@ -31,7 +31,7 @@ dir_pin: PD13
enable_pin: !PD15 enable_pin: !PD15
microsteps: 16 microsteps: 16
rotation_distance: 8 rotation_distance: 8
endstop_pin: PA0 # PA3 for Z-max (and servo) endstop_pin: ^PA0 # PA3 for Z-max (and servo)
position_endstop: 0 position_endstop: 0
position_max: 400 position_max: 400

View File

@ -12,7 +12,7 @@ dir_pin: PE10
enable_pin: !PE9 enable_pin: !PE9
microsteps: 16 microsteps: 16
rotation_distance: 40 rotation_distance: 40
endstop_pin: PB14 # PA1 for X-max endstop_pin: ^PB14 # PA1 for X-max
position_endstop: 0 position_endstop: 0
position_max: 200 position_max: 200
@ -32,7 +32,7 @@ dir_pin: PD13
enable_pin: !PD15 enable_pin: !PD15
microsteps: 16 microsteps: 16
rotation_distance: 8 rotation_distance: 8
endstop_pin: PA0 # PA3 for Z-max endstop_pin: ^PA0 # PA3 for Z-max
position_endstop: 0 position_endstop: 0
position_max: 400 position_max: 400

View File

@ -0,0 +1,216 @@
# This file contains common pin mappings for the Mellow Fly-CDY-v3.
# To use this config, the firmware should be compiled for the
# STM32F407 with a "32KiB bootloader".
# The "make flash" command does not work on the Fly-CDY-v3. Instead,
# after running "make", copy the generated "out/klipper.bin" file to a
# file named "firmware.bin" on an SD card and then restart the Fly-CDY-v3
# with that SD card.
# See docs/Config_Reference.md for a description of parameters.
[stepper_x]
step_pin: PE5
dir_pin: PC0
enable_pin: !PC1
microsteps: 16
rotation_distance: 40
endstop_pin: ^PC7 # X-MAX PC6
position_endstop: 0
position_max: 200
homing_speed: 50
[stepper_y]
step_pin: PE4
dir_pin: !PC13
enable_pin: !PC14
microsteps: 16
rotation_distance: 40
endstop_pin: ^PD11 # Y-MAX PD10
position_endstop: 0
position_max: 200
homing_speed: 50
[stepper_z]
step_pin: PE3
dir_pin: PB7
enable_pin: !PB8
microsteps: 16
rotation_distance: 40
endstop_pin: ^PB10 # Z-MAX PB11
position_endstop: 0.5
position_max: 200
[extruder]
step_pin: PE2
dir_pin: PD6
enable_pin: !PD7
microsteps: 16
rotation_distance: 33.500
nozzle_diameter: 0.400
filament_diameter: 1.750
heater_pin: PD12
sensor_pin: PA3
sensor_type: EPCOS 100K B57560G104F
control: pid
pid_Kp: 22.2
pid_Ki: 1.08
pid_Kd: 114
min_temp: 0
max_temp: 250
#[extruder1]
#step_pin: PE1
#dir_pin: !PD3
#enable_pin: !PD4
#heater_pin: PD13
#sensor_pin: PC4
#[extruder2]
#step_pin: PE0
#dir_pin: !PA15
#enable_pin: !PD0
#heater_pin: PD14
#sensor_pin: PC5
[heater_bed]
heater_pin: PB0
sensor_type: Generic 3950
sensor_pin: PB1
control: watermark
min_temp: 0
max_temp: 130
#FAN0
[fan]
pin: PA0
#FAN1
#[heater_fan fan1]
#pin: PA1
#FAN2
#[heater_fan fan2]
#pin: PA2
[mcu]
serial: /dev/serial/by-id/usb-Klipper_Klipper_firmware_12345-if00
[printer]
kinematics: cartesian
max_velocity: 300
max_accel: 3000
max_z_velocity: 5
max_z_accel: 100
########################################
# TMC2209 configuration
########################################
#[tmc2209 stepper_x]
#uart_pin: PC15
#run_current: 0.800
#diag_pin: PC7
#stealthchop_threshold: 999999
#[tmc2209 stepper_y]
#uart_pin: PA8
#run_current: 0.800
#diag_pin: PC6
#stealthchop_threshold: 999999
#[tmc2209 stepper_z]
#uart_pin: PB6
#run_current: 0.800
#diag_pin: PD11
#stealthchop_threshold: 999999
#[tmc2209 extruder]
#uart_pin: PD5
#run_current: 0.600
#diag_pin: PD10
#stealthchop_threshold: 999999
#[tmc2209 extruder1]
#uart_pin: PD1
#run_current: 0.600
#diag_pin: PB10
#stealthchop_threshold: 999999
#[tmc2209 extruder2]
#uart_pin: PE9
#run_current: 0.600
#diag_pin: PB11
#stealthchop_threshold: 999999
########################################
# TMC5160 configuration
########################################
#[tmc5160 stepper_x]
#cs_pin: PC15
#spi_bus: spi3
#run_current: 0.800
#diag1_pin: PC7
#stealthchop_threshold: 999999
#[tmc5160 stepper_y]
#cs_pin: PA8
#spi_bus: spi3
#run_current: 0.800
#diag1_pin: PC6
#stealthchop_threshold: 999999
#[tmc5160 stepper_z]
#cs_pin: PB6
#spi_bus: spi3
#run_current: 0.800
#diag1_pin: PD11
#stealthchop_threshold: 999999
#[tmc5160 extruder]
#cs_pin: PD5
#spi_bus: spi3
#run_current: 0.800
#diag1_pin: PD10
#stealthchop_threshold: 999999
#[tmc5160 extruder1]
#cs_pin: PD1
#spi_bus: spi3
#run_current: 0.800
#diag1_pin: PB10
#stealthchop_threshold: 999999
#[tmc5160 extruder2]
#cs_pin: PE9
#spi_bus: spi3
#run_current: 0.800
#diag1_pin: PB11
#stealthchop_threshold: 999999
########################################
# Accelerometer (ADXL345) pins
########################################
## SCK=PA5, MISO=PA6, MOSI=PA7
#[adxl345]
#cs_pin: PE7
#spi_bus: spi1
########################################
# EXP1 / EXP2 (display) pins
########################################
[board_pins]
aliases:
# EXP1 header
EXP1_1=<NC>, EXP1_3=PB2, EXP1_5=PE15, EXP1_7=PA13, EXP1_9=<GND>,
EXP1_2=PA9, EXP1_4=PA10, EXP1_6=PE14, EXP1_8=PA14, EXP1_10=<5V>,
# EXP2 header
EXP2_1=PA6, EXP2_3=PD8, EXP2_5=PD9, EXP2_7=PE13, EXP2_9=<GND>,
EXP2_2=PA5, EXP2_4=PA4, EXP2_6=PA7, EXP2_8=<RST>, EXP2_10=<NC>,
# See the sample-lcd.cfg file for definitions of common LCD displays.

View File

@ -0,0 +1,157 @@
# This file contains common pin mappings for the Mellow Fly-Gemini-v1.
# To use this config, the firmware should be compiled for the
# STM32F405 with a "32KiB bootloader".
# The "make flash" command does not work on the Fly-Gemini-v1. Instead,
# after running "make", copy the generated "out/klipper.bin" file to a
# file named "firmware.bin" or "klipper.bin" on an SD card and then restart the Fly-Gemini-v1
# with that SD card.
# See docs/Config_Reference.md for a description of parameters.
[stepper_x]
step_pin: PC13
dir_pin: PC1
enable_pin: !PB2
microsteps: 16
rotation_distance: 40
endstop_pin: ^PA3
position_endstop: 0
position_max: 200
homing_speed: 50
[stepper_y]
step_pin: PC14
dir_pin: !PC4
enable_pin: !PB6
microsteps: 16
rotation_distance: 40
endstop_pin: ^PB1
position_endstop: 0
position_max: 200
homing_speed: 50
[stepper_z]
step_pin: PC15
dir_pin: PC5
enable_pin: !PB5
microsteps: 16
rotation_distance: 40
endstop_pin: ^PB10
position_endstop: 0.5
position_max: 200
[extruder]
step_pin: PC3
dir_pin: PC7
enable_pin: !PB4
microsteps: 16
rotation_distance: 33.500
nozzle_diameter: 0.400
filament_diameter: 1.750
heater_pin: PA0
sensor_type: EPCOS 100K B57560G104F
sensor_pin: PC0
control: pid
pid_Kp: 22.2
pid_Ki: 1.08
pid_Kd: 114
min_temp: 0
max_temp: 250
[heater_bed]
heater_pin: PA2
sensor_type: Generic 3950
sensor_pin: PC2
control: watermark
min_temp: 0
max_temp: 130
[fan]
pin: PC6
[mcu]
serial: /dev/serial/by-id/usb-Klipper_Klipper_firmware_12345-if00
[printer]
kinematics: cartesian
max_velocity: 300
max_accel: 3000
max_z_velocity: 5
max_z_accel: 100
########################################
# TMC2209 configuration
########################################
#[tmc2209 stepper_x]
#uart_pin: PB11
#run_current: 0.800
#diag_pin: PA3
#stealthchop_threshold: 999999
#[tmc2209 stepper_y]
#uart_pin: PB9
#run_current: 0.800
#diag_pin: PB1
#stealthchop_threshold: 999999
#[tmc2209 stepper_z]
#uart_pin: PB8
#run_current: 0.800
#diag_pin: PB10
#stealthchop_threshold: 999999
#[tmc2209 extruder]
#uart_pin: PB7
#run_current: 0.600
#diag_pin:
#stealthchop_threshold: 999999
########################################
# TMC5160 configuration
########################################
#[tmc5160 stepper_x]
#cs_pin: PB11
#spi_bus: spi1
#run_current: 0.800
#diag1_pin: PA3
#stealthchop_threshold: 999999
#[tmc5160 stepper_y]
#cs_pin: PB9
#spi_bus: spi1
#run_current: 0.800
#diag1_pin: PB1
#stealthchop_threshold: 999999
#[tmc5160 stepper_z]
#cs_pin: PB8
#spi_bus: spi1
#run_current: 0.800
#diag1_pin: PB10
#stealthchop_threshold: 999999
#[tmc5160 extruder]
#cs_pin: PB7
#spi_bus: spi1
#run_current: 0.800
#diag1_pin:
#stealthchop_threshold: 999999
########################################
# EXP1 / EXP2 (display) pins
########################################
[board_pins]
aliases:
# EXP1 header
EXP1_1=<NC>, EXP1_3=PA13, EXP1_5=PA9, EXP1_7=<NC>, EXP1_9=<GND>,
EXP1_2=PA4, EXP1_4=PA10, EXP1_6=PA8, EXP1_8=<NC>, EXP1_10=<5V>,
# EXP2 header
EXP2_1=PB14, EXP2_3=PA15, EXP2_5=PA14, EXP2_7=PB3, EXP2_9=<GND>,
EXP2_2=PB13, EXP2_4=PB12, EXP2_6=PB15, EXP2_8=<RST>, EXP2_10=<NC>,
# See the sample-lcd.cfg file for definitions of common LCD displays.

View File

@ -0,0 +1,161 @@
# This file contains common pin mappings for the Mellow Fly-Gemini-v2.
# To use this config, the firmware should be compiled for the
# STM32F405 with a "32KiB bootloader".
# The "make flash" command does not work on the Fly-Gemini-v2. Instead,
# after running "make", copy the generated "out/klipper.bin" file to a
# file named "firmware.bin" or "klipper.bin" on an SD card and then restart the Fly-Gemini-v2
# with that SD card.
# See docs/Config_Reference.md for a description of parameters.
[stepper_x]
step_pin: PC13
dir_pin: PC1
enable_pin: !PB2
microsteps: 16
rotation_distance: 40
endstop_pin: ^PA3
position_endstop: 0
position_max: 200
homing_speed: 50
[stepper_y]
step_pin: PC14
dir_pin: !PC4
enable_pin: !PD2
microsteps: 16
rotation_distance: 40
endstop_pin: ^PB1
position_endstop: 0
position_max: 200
homing_speed: 50
[stepper_z]
step_pin: PC15
dir_pin: PC5
enable_pin: !PC12
microsteps: 16
rotation_distance: 40
endstop_pin: ^PB10
position_endstop: 0.5
position_max: 200
[extruder]
step_pin: PC3
dir_pin: PC8
enable_pin: !PC11
microsteps: 16
rotation_distance: 33.500
nozzle_diameter: 0.400
filament_diameter: 1.750
heater_pin: PA0
sensor_type: EPCOS 100K B57560G104F
sensor_pin: PC0
control: pid
pid_Kp: 22.2
pid_Ki: 1.08
pid_Kd: 114
min_temp: 0
max_temp: 250
[heater_bed]
heater_pin: PA2
sensor_type: Generic 3950
sensor_pin: PC2
control: watermark
min_temp: 0
max_temp: 130
[fan]
pin: PC6
#FAN1
#[heater_fan fan1]
#pin: PC7
[mcu]
serial: /dev/serial/by-id/usb-Klipper_Klipper_firmware_12345-if00
[printer]
kinematics: cartesian
max_velocity: 300
max_accel: 3000
max_z_velocity: 5
max_z_accel: 100
########################################
# TMC2209 configuration
########################################
#[tmc2209 stepper_x]
#uart_pin: PB11
#run_current: 0.800
#diag_pin: PA3
#stealthchop_threshold: 999999
#[tmc2209 stepper_y]
#uart_pin: PB9
#run_current: 0.800
#diag_pin: PB1
#stealthchop_threshold: 999999
#[tmc2209 stepper_z]
#uart_pin: PB8
#run_current: 0.800
#diag_pin: PB10
#stealthchop_threshold: 999999
#[tmc2209 extruder]
#uart_pin: PB7
#run_current: 0.600
#diag_pin:
#stealthchop_threshold: 999999
########################################
# TMC5160 configuration
########################################
#[tmc5160 stepper_x]
#cs_pin: PB11
#spi_bus: spi1
#run_current: 0.800
#diag1_pin: PA3
#stealthchop_threshold: 999999
#[tmc5160 stepper_y]
#cs_pin: PB9
#spi_bus: spi1
#run_current: 0.800
#diag1_pin: PB1
#stealthchop_threshold: 999999
#[tmc5160 stepper_z]
#cs_pin: PB8
#spi_bus: spi1
#run_current: 0.800
#diag1_pin: PB10
#stealthchop_threshold: 999999
#[tmc5160 extruder]
#cs_pin: PB7
#spi_bus: spi1
#run_current: 0.800
#diag1_pin:
#stealthchop_threshold: 999999
########################################
# EXP1 / EXP2 (display) pins
########################################
[board_pins]
aliases:
# EXP1 header
EXP1_1=PC9, EXP1_3=PA13, EXP1_5=PA9, EXP1_7=<NC>, EXP1_9=<GND>,
EXP1_2=PB6, EXP1_4=PA10, EXP1_6=PA8, EXP1_8=<NC>, EXP1_10=<5V>,
# EXP2 header
EXP2_1=PB14, EXP2_3=PA15, EXP2_5=PA14, EXP2_7=PC10, EXP2_9=<GND>,
EXP2_2=PB13, EXP2_4=PB12, EXP2_6=PB15, EXP2_8=<RST>, EXP2_10=<NC>,
# See the sample-lcd.cfg file for definitions of common LCD displays.

View File

@ -53,7 +53,7 @@ microsteps: 16
rotation_distance: 33.500 rotation_distance: 33.500
nozzle_diameter: 0.400 nozzle_diameter: 0.400
filament_diameter: 1.750 filament_diameter: 1.750
heater_pin: PC7 # Heat0 heater_pin: PB0 # Heat0
sensor_pin: PF4 # ADC_0 sensor_pin: PF4 # ADC_0
sensor_type: EPCOS 100K B57560G104F sensor_type: EPCOS 100K B57560G104F
control: pid control: pid
@ -240,72 +240,56 @@ max_z_accel: 100
#[tmc5160 stepper_x] #[tmc5160 stepper_x]
#cs_pin: PC4 #cs_pin: PC4
#spi_software_miso_pin: PB5 #spi_bus: spi3
#spi_software_mosi_pin: PB4
#spi_software_sclk_pin: PB3
##diag1_pin: PG12 ##diag1_pin: PG12
#run_current: 0.800 #run_current: 0.800
#stealthchop_threshold: 999999 #stealthchop_threshold: 999999
#[tmc5160 stepper_y] #[tmc5160 stepper_y]
#cs_pin: PF12 #cs_pin: PF12
#spi_software_miso_pin: PB5 #spi_bus: spi3
#spi_software_mosi_pin: PB4
#spi_software_sclk_pin: PB3
##diag1_pin: PG11 ##diag1_pin: PG11
#run_current: 0.800 #run_current: 0.800
#stealthchop_threshold: 999999 #stealthchop_threshold: 999999
#[tmc5160 stepper_z] #[tmc5160 stepper_z]
#cs_pin: PF15 #cs_pin: PF15
#spi_software_miso_pin: PB5 #spi_bus: spi3
#spi_software_mosi_pin: PB4
#spi_software_sclk_pin: PB3
##diag1_pin: PG10 ##diag1_pin: PG10
#run_current: 0.650 #run_current: 0.650
#stealthchop_threshold: 999999 #stealthchop_threshold: 999999
#[tmc5160 extruder] #[tmc5160 extruder]
#cs_pin: PE7 #cs_pin: PE7
#spi_software_miso_pin: PB5 #spi_bus: spi3
#spi_software_mosi_pin: PB4
#spi_software_sclk_pin: PB3
##diag1_pin: PG9 ##diag1_pin: PG9
#run_current: 0.800 #run_current: 0.800
#stealthchop_threshold: 999999 #stealthchop_threshold: 999999
#[tmc5160 extruder1] #[tmc5160 extruder1]
#cs_pin: PE10 #cs_pin: PE10
#spi_software_miso_pin: PB5 #spi_bus: spi3
#spi_software_mosi_pin: PB4
#spi_software_sclk_pin: PB3
##diag1_pin: PD7 ##diag1_pin: PD7
#run_current: 0.800 #run_current: 0.800
#stealthchop_threshold: 999999 #stealthchop_threshold: 999999
#[tmc5160 extruder2] #[tmc5160 extruder2]
#cs_pin: PF1 #cs_pin: PF1
#spi_software_miso_pin: PB5 #spi_bus: spi3
#spi_software_mosi_pin: PB4
#spi_software_sclk_pin: PB3
##diag1_pin: PD6 ##diag1_pin: PD6
#run_current: 0.800 #run_current: 0.800
#stealthchop_threshold: 999999 #stealthchop_threshold: 999999
#[tmc5160 extruder3] #[tmc5160 extruder3]
#cs_pin: PG2 #cs_pin: PG2
#spi_software_miso_pin: PB5 #spi_bus: spi3
#spi_software_mosi_pin: PB4
#spi_software_sclk_pin: PB3
##diag1_pin: PA8 ##diag1_pin: PA8
#run_current: 0.800 #run_current: 0.800
#stealthchop_threshold: 999999 #stealthchop_threshold: 999999
#[tmc5160 extruder4] #[tmc5160 extruder4]
#cs_pin: PG5 #cs_pin: PG5
#spi_software_miso_pin: PB5 #spi_bus: spi3
#spi_software_mosi_pin: PB4
#spi_software_sclk_pin: PB3
##diag1_pin: PF3 ##diag1_pin: PF3
#run_current: 0.800 #run_current: 0.800
#stealthchop_threshold: 999999 #stealthchop_threshold: 999999

View File

@ -0,0 +1,128 @@
# This file contains common pin mappings for the TH3D EZBoard Lite v2.
# To use this config, the firmware should be compiled for the
# STM32F407 with 12mhz Crystal, 48KiB Bootloader, and USB communication.
# The "make flash" command does not work on this board. Instead,
# after running "make", copy the generated "out/klipper.bin" file to a
# file named "firmware.bin" on an SD card and then restart the board
# with that SD card.
# See docs/Config_Reference.md for a description of parameters.
[mcu]
serial: /dev/serial/by-id/usb-Klipper_stm32f407xx_0000000000000000-if00
[printer]
kinematics: cartesian
max_velocity: 300
max_accel: 3000
max_z_velocity: 5
max_z_accel: 100
[stepper_x]
step_pin: PB3
dir_pin: PD2
enable_pin: !PB5
microsteps: 16
rotation_distance: 40
endstop_pin: ^!PC1
position_endstop: 0
position_max: 235
homing_speed: 50
[tmc2209 stepper_x]
uart_pin: PC11
tx_pin: PC10
run_current: 0.600
uart_address: 0
[stepper_y]
step_pin: PB8
dir_pin: PC13
enable_pin: !PC12
microsteps: 16
rotation_distance: 40
endstop_pin: ^!PC2
position_endstop: 0
position_max: 235
homing_speed: 50
[tmc2209 stepper_y]
uart_pin: PC11
tx_pin: PC10
run_current: 0.600
uart_address: 1
[stepper_z]
step_pin: PA3
dir_pin: PB1
enable_pin: !PC14
microsteps: 16
rotation_distance: 8
endstop_pin: ^!PC3
position_endstop: 0.5
position_max: 250
[tmc2209 stepper_z]
uart_pin: PC11
tx_pin: PC10
run_current: 0.700
uart_address: 2
[extruder]
step_pin: PA15
dir_pin: PB11
enable_pin: !PB2
microsteps: 16
rotation_distance: 34.406
nozzle_diameter: 0.400
filament_diameter: 1.750
heater_pin: PC8
sensor_type: EPCOS 100K B57560G104F
sensor_pin: PA1
control: pid
pid_Kp: 22.2
pid_Ki: 1.08
pid_Kd: 114
min_temp: 0
max_temp: 250
[tmc2209 extruder]
uart_pin: PC11
tx_pin: PC10
run_current: 0.800
stealthchop_threshold: 999999
uart_address: 3
[heater_bed]
heater_pin: PC9
sensor_type: EPCOS 100K B57560G104F
sensor_pin: PA0
control: pid
pid_Kp: 54.027
pid_Ki: 0.770
pid_Kd: 948.182
min_temp: 0
max_temp: 130
[fan]
pin: PC6
#[bltouch]
#sensor_pin: ^PC3
#control_pin: PA2
#[filament_switch_sensor my_sensor]
#switch_pin: PC0
########################################
# EXP1 / EXP2 (display) pins
########################################
[board_pins]
aliases:
# EXP1 header
EXP1_1=PA14, EXP1_3=PC4, EXP1_5=PC5, EXP1_7=PB12, EXP1_9=<GND>,
EXP1_2=PB0, EXP1_4=<RST>, EXP1_6=PB13, EXP1_8=PB15, EXP1_10=<5V>
# See the sample-lcd.cfg file for definitions of common LCD displays.

View File

@ -227,14 +227,14 @@ gcode:
[quad_gantry_level] [quad_gantry_level]
# Use QUAD_GANTRY_LEVEL to level a gantry. # Use QUAD_GANTRY_LEVEL to level a gantry.
gantry_corners: gantry_corners:
-55,-7 -55, -7
305, 320 305, 320
# Min & Max gantry corners - measure from nozzle at MIN (0,0) and MAX (250,250) to respective belt positions # Min & Max gantry corners - measure from nozzle at MIN (0,0) and MAX (250,250) to respective belt positions
points: points:
25,0 25, 0
25,200 25, 200
225,200 225, 200
225,0 225, 0
# Probe points # Probe points
speed: 200 speed: 200
horizontal_move_z: 6 horizontal_move_z: 6

View File

@ -134,9 +134,9 @@ sample_retract_dist: 3.0
[bed_mesh] [bed_mesh]
speed: 100 speed: 100
horizontal_move_z: 5 horizontal_move_z: 5
mesh_min: 69,41 mesh_min: 69, 41
mesh_max: 189,161 mesh_max: 189, 161
probe_count: 3,3 probe_count: 3, 3
[homing_override] [homing_override]
set_position_z: 6 set_position_z: 6

View File

@ -132,10 +132,10 @@ max_z_accel: 50
square_corner_velocity: 5 square_corner_velocity: 5
[bed_screws] [bed_screws]
screw1: 5,5 screw1: 5, 5
screw2: 265,210 screw2: 265, 210
screw3: 5,210 screw3: 5, 210
screw4: 265,5 screw4: 265, 5
[filament_switch_sensor filament_sensor] [filament_switch_sensor filament_sensor]
switch_pin: ^!PC4 switch_pin: ^!PC4

View File

@ -0,0 +1,317 @@
# This file contains common pin mappings for the BigTreeTech SKR SE BX.
# To use this config, the firmware should be compiled for the
# STM32H743 with a "128KiB bootloader". Additionally, GPIO pins PB5
# and PE5 need to be set at microcontroller startup.
######################################################################
# NOTE: In order enable the TFT70-BX display when the printer first
# starts, add PB5 and PE5 to the `GPIO pins to set at micro-controller
# startup` section when running "make menuconfig"
######################################################################
# The "make flash" command does not work on the SKR SE BX. Instead,
# after running "make", copy the generated "out/klipper.bin" file to a
# file named "firmware.bin" on an SD card and then restart the SKR SE BX
# with that SD card. After klipper has been flashed once to the board,
# you can update klipper by leaving a microSD inserted and running the
# scripts/flash-sd.sh script.
# See docs/Config_Reference.md for a description of parameters.
########################################
# Steppers
########################################
[stepper_x]
step_pin: PG13
dir_pin: !PG12
enable_pin: !PG14
microsteps: 16
rotation_distance: 40
full_steps_per_rotation: 400
endstop_pin: tmc2209_stepper_x:virtual_endstop
position_endstop: -13
position_min: -13
position_max: 250
homing_speed: 30
homing_retract_dist: 0
[stepper_y]
step_pin: PB3
dir_pin: !PD3
enable_pin: !PB4
microsteps: 16
rotation_distance: 40
full_steps_per_rotation: 400
endstop_pin: tmc2209_stepper_y:virtual_endstop
position_endstop: -7
position_min: -7
position_max: 250
homing_speed: 30
homing_retract_dist: 0
[stepper_z]
step_pin: PD7
dir_pin: PD6
enable_pin: !PG9
microsteps: 16
rotation_distance: 8
full_steps_per_rotation: 400
endstop_pin: probe:z_virtual_endstop
position_min: -2
position_max: 250
[stepper_z1]
step_pin: PA8
dir_pin: PC9
enable_pin: !PD2
microsteps: 16
rotation_distance: 8
full_steps_per_rotation: 400
[extruder]
step_pin: PC14
dir_pin: !PC13
enable_pin: !PC15
microsteps: 16
rotation_distance: 24.031
gear_ratio: 7:1
full_steps_per_rotation: 200
nozzle_diameter: 0.400
filament_diameter: 1.750
heater_pin: PC4
sensor_type: EPCOS 100K B57560G104F
sensor_pin: PH4
control: pid
pid_Kp: 22.2
pid_Ki: 1.08
pid_Kd: 114
min_temp: 0
max_temp: 350
[safe_z_home]
home_xy_position: 125,125
speed: 200
z_hop: 10
z_hop_speed: 25
########################################
# TMC2209 configuration
########################################
[tmc2209 stepper_x]
uart_pin: PG10
diag_pin: ^PB11
run_current: 0.800
sense_resistor: 0.150
driver_SGTHRS: 127
stealthchop_threshold: 999999
[tmc2209 stepper_y]
uart_pin: PD4
diag_pin: ^PB12
run_current: 0.800
sense_resistor: 0.150
driver_SGTHRS: 137
stealthchop_threshold: 999999
[tmc2209 stepper_z]
uart_pin: PD5
run_current: 1.000
sense_resistor: 0.150
stealthchop_threshold: 999999
[tmc2209 stepper_z1]
uart_pin: PC8
run_current: 1.000
sense_resistor: 0.150
stealthchop_threshold: 999999
[tmc2209 extruder]
uart_pin: PI8
run_current: 0.800
sense_resistor: 0.150
stealthchop_threshold: 0
########################################
# PRINTER
########################################
[mcu]
serial: /dev/ttyAMA0
restart_method: command
[printer]
kinematics: cartesian
max_velocity: 200
max_accel: 1000
max_z_velocity: 10
max_z_accel: 1000
[fan]
pin: PA5
[heater_fan extruder_fan]
pin: PA6
heater: extruder
[controller_fan controller_fan]
pin: PA7
idle_timeout: 300 # 5 minute timeout
[output_pin motor_power]
pin: PI11
value: 1
[idle_timeout]
gcode:
TURN_OFF_HEATERS
M84
SET_PIN PIN=screen VALUE=0
SET_LED LED=led BLUE=0.0 RED=0.0 GREEN=0.0
[pause_resume]
########################################
# DISPLAY
########################################
[output_pin screen]
pin: PB5
value: 1
[display_status]
[gcode_button lcd_button]
pin: PH8
press_gcode:
SET_PIN PIN=screen VALUE=1
SET_LED LED=led BLUE=1.0 RED=1.0 GREEN=1.0
[output_pin beeper]
pin: PA14
pwm: True
cycle_time: 0.001
########################################
# LEDS
########################################
[neopixel led]
pin: PH3
chain_count: 15
[neopixel knob]
pin: PB1
chain_count: 2
[delayed_gcode welcome]
initial_duration: 0.1
gcode:
SET_LED LED=knob RED=0.0 BLUE=1.0 GREEN=0.0
SET_LED LED=led RED=0.0 BLUE=1.0 GREEN=0.0
G4 P1000
SET_LED LED=led RED=1.0 BLUE=0.0 GREEN=0.0
G4 P1000
SET_LED LED=led RED=0.0 BLUE=0.0 GREEN=1.0
G4 P1000
SET_LED LED=led RED=1.0 BLUE=1.0 GREEN=1.0
########################################
# BED
########################################
[heater_bed]
heater_pin: PA4
sensor_type: EPCOS 100K B57560G104F
sensor_pin: PH5
control: watermark
min_temp: 0
max_temp: 250
[probe]
pin: PH2
x_offset: -30.1
y_offset: 26.78
z_offset: 0
speed: 5
samples: 3
samples_result: median
sample_retract_dist: 3.0
samples_tolerance: 0.006
samples_tolerance_retries: 5
[bed_mesh]
speed: 120
mesh_min: 10,19.78
mesh_max: 219.9,230
probe_count: 4,4
[screws_tilt_adjust]
screw1: 58,-7
screw1_name: front left
screw2: 245,-7
screw2_name: front right
screw3: 245,179
screw3_name: rear right
screw4: 58,179
screw4_name: rear left
speed: 100
screw_thread: CCW-M3
########################################
## MACROS
########################################
# Slicer setup: "print_start NOZZLE=<temp> BED=<temp>
# This macro does a preheat on the probe for better accuracy and needs
# the temps passed in. examples:
# Cura: PRINT_START BED={material_bed_temperature_layer_0} NOZZLE={material_print_temperature_layer_0}
# PrusaSlicer: PRINT_START NOZZLE=[first_layer_temperature] BED=[bed_temperature]
# Use PRINT_END for the slicer ending script
[gcode_macro PRINT_START]
gcode:
# Turn on screen if it's not on
SET_PIN PIN=screen VALUE=1
G28
G0 Z1
# Warm up nozzle, not to full temps yet
M104 S150
# Set LED to Purple for bed heating
SET_LED LED=led BLUE=0.94 RED=0.63 GREEN=0.13
M117 Heating Bed
# Allow probe to warm up, then re-home Z
M190 S60
M105
G4 P90000
G28 Z
M190 S{params.BED}
M105
G90 # Ensure we are in absolute mode
G21
M83 # Set the extruder to relative mode
G92 E0
# Set LED to Red for nozzle heating
SET_LED LED=led BLUE=0.0 RED=1.0 GREEN=0.0
M117 Heating Nozzle
G0 X2 Y0 F6000
G0 Z0.4
M109 S{params.NOZZLE}
M105
# Set LED to white for printing
SET_LED LED=led BLUE=1.0 RED=1.0 GREEN=1.0
M117 Printing
# Purge Line
G1 X120 E30 F1200
G1 Y1
G1 X2 E30 F1200
G92 E0
G1 Z1.0 F600
G92 E0
G0 F9000
G90 # Set back to Absolute mode

View File

@ -0,0 +1,161 @@
# This file contains pin mappings for the Creality CR-10 Smart Pro
# with a CR-FDM-v2.5.S1 board.
#
# To use this config, during "make menuconfig" select the STM32F103
# with a "64KiB bootloader" and serial (on USART1 PA10/PA9)
# communication. Enable PA0 GPIO pin on startup.
#
# Flash this firmware on the MCU by copying "out/klipper.bin" to an SD
# card and turning the printer on with the card inserted. The firmware
# filename must end in ".bin" and must not match the last filename
# that was flashed.
#
# The machine itself includes a small router that can run a Klipper
# frontend. You don't need to buy a single-board computer.
#
# See docs/Config_Reference.md for a description of parameters.
[stepper_x]
step_pin: PB8
dir_pin: !PB7
enable_pin: !PC3
rotation_distance: 40
microsteps: 16
endstop_pin: PC4
position_min: -5
position_endstop: -5
position_max: 305
homing_speed: 50
[stepper_y]
step_pin: PB6
dir_pin: PB5
enable_pin: !PC3
rotation_distance: 40
microsteps: 16
endstop_pin: PC5
position_min: -2
position_endstop: -2
position_max: 302
homing_speed: 50
[stepper_z]
step_pin: PB4
dir_pin: !PB3
enable_pin: !PC3
rotation_distance: 8
microsteps: 16
endstop_pin: probe:z_virtual_endstop
position_min: -1.5
position_max: 400
homing_speed: 4
second_homing_speed: 1
homing_retract_dist: 2.0
[extruder]
step_pin: PC2
dir_pin: !PB9
enable_pin: !PC3
rotation_distance: 7.640
microsteps: 16
nozzle_diameter: 0.400
filament_diameter: 1.750
heater_pin: PB14
sensor_type: EPCOS 100K B57560G104F
sensor_pin: PB1
control: pid
pid_Kp: 22.865
pid_Ki: 1.292
pid_Kd: 101.178
min_temp: 0
max_temp: 250
[filament_switch_sensor runout_sensor]
pause_on_runout: false
runout_gcode: PAUSE
insert_gcode: RESUME
switch_pin: !PA15
[heater_bed]
heater_pin: PB13
sensor_type: EPCOS 100K B57560G104F
sensor_pin: PB0
control: pid
pid_Kp: 72.49
pid_Ki: 0.844
pid_Kd: 1542.189
min_temp: 0
max_temp: 120
[heater_fan hotend_fan]
pin: PC13
heater: extruder
heater_temp: 50.0
[fan]
pin: PB15
kick_start_time: 0.5
[mcu]
serial: /dev/ttyPrinter
restart_method: command
[temperature_sensor Board_MCU]
sensor_type: temperature_mcu
min_temp: 0
max_temp: 100
[bltouch]
sensor_pin: ^PC15
control_pin: PC14
x_offset: -32.5
y_offset: -40.6
z_offset: 2.60 # initial safe value, get correct value by PROBE_CALIBRATE
[safe_z_home]
home_xy_position: 150,150
speed: 50
z_hop: 3
z_hop_speed: 5
[screws_tilt_adjust]
screw1: 60, 80
screw1_name: front left screw
screw2: 300, 80
screw2_name: front right screw
# The rear screws are actually mechanically not reachable for the
# probe, but that is ok, adjustments will still converge.
screw3: 300, 300
screw3_name: rear right screw
screw4: 60, 300
screw4_name: rear left screw
horizontal_move_z: 10.
speed: 50.
screw_thread: CW-M3
# Main light bar
[output_pin lights]
pin: PA7
value: 1
# Do not use PB12. PB12 resets the Wifi board.
#[output_pin factory_reset]
#pin: PB12
#value: 0
# Turns off the printer
[output_pin power]
pin: PA0
value: 1
shutdown_value: 1
# Conservative default values that mimic the behaviour of the
# stock firmware for easy results. It can go faster.
[printer]
kinematics: cartesian
max_velocity: 500
max_accel: 2000
square_corner_velocity: 5.0
max_z_velocity: 10
max_z_accel: 100

View File

@ -64,7 +64,7 @@ speed: 3.0
samples: 1 samples: 1
[safe_z_home] [safe_z_home]
home_xy_position: 117,117 home_xy_position: 117, 117
speed: 50.0 speed: 50.0
z_hop: 10.0 z_hop: 10.0
z_hop_speed: 100 z_hop_speed: 100
@ -72,9 +72,9 @@ z_hop_speed: 100
[bed_mesh] [bed_mesh]
speed: 100 speed: 100
horizontal_move_z: 8 horizontal_move_z: 8
mesh_min: 106,39 mesh_min: 106, 39
mesh_max: 281,229 mesh_max: 281, 229
probe_count: 3,3 probe_count: 3, 3
[heater_bed] [heater_bed]
heater_pin: PH5 heater_pin: PH5

View File

@ -80,7 +80,7 @@ min_temp: 0
max_temp: 120 max_temp: 120
[fan] [fan]
pin: PA0 pin: PB15
kick_start_time: 0.5 kick_start_time: 0.5
[mcu] [mcu]

View File

@ -0,0 +1,106 @@
# This file contains pin mappings for the stock 2021 Creality
# Ender2 Pro. To use this config, during "make menuconfig" select
# the STM32F103 with a "28KiB bootloader" and serial
# (on USART1 PA10/PA9) communication.
# If you prefer a direct serial connection, in "make menuconfig"
# select "Enable extra low-level configuration options" and select
# serial (on USART3 PB11/PB10), which is broken out on the 10 pin IDC
# cable used for the LCD module as follows:
# 3: Tx, 4: Rx, 9: GND, 10: VCC
# Flash this firmware by copying "out/klipper.bin" to a SD card and
# turning on the printer with the card inserted. The firmware
# filename must end in ".bin" and must not match the last filename
# that was flashed.
# See docs/Config_Reference.md for a description of parameters.
[stepper_x]
step_pin: PC2
dir_pin: PB9
enable_pin: !PC3
microsteps: 16
rotation_distance: 40
endstop_pin: ^PA5
position_min: -20
position_endstop: -20
position_max: 165
homing_speed: 50
[stepper_y]
step_pin: PB8
dir_pin: PB7
enable_pin: !PC3
microsteps: 16
rotation_distance: 40
endstop_pin: ^PA6
position_min: -5
position_endstop: -5
position_max: 165
homing_speed: 50
[stepper_z]
step_pin: PB6
dir_pin: !PB5
enable_pin: !PC3
microsteps: 16
rotation_distance: 8
endstop_pin: ^PA7
position_endstop: 0.0
position_max: 180
[extruder]
max_extrude_only_distance: 100.0
step_pin: PB4
dir_pin: PB3
enable_pin: !PC3
microsteps: 16
rotation_distance: 27.53480577
nozzle_diameter: 0.400
filament_diameter: 1.750
heater_pin: PA1
sensor_pin: PC5
sensor_type: EPCOS 100K B57560G104F
control: pid
pid_Kp: 29.634
pid_Ki: 2.102
pid_Kd: 104.459
min_temp: 0
max_temp: 260
[heater_bed]
heater_pin: PB10
sensor_type: EPCOS 100K B57560G104F
sensor_pin: PC4
control: pid
pid_Kp: 72.921
pid_Ki: 1.594
pid_Kd: 834.031
min_temp: 0
max_temp: 80
[fan]
pin: PA0
[mcu]
serial: /dev/serial/by-id/usb-1a86_USB_Serial-if00-port0
restart_method: command
[printer]
kinematics: cartesian
max_velocity: 300
max_accel: 3000
max_z_velocity: 5
max_z_accel: 100
[display]
lcd_type: st7920
cs_pin: PB12
sclk_pin: PB13
sid_pin: PB15
encoder_pins: ^PB14, ^PA2
click_pin: ^!PB2
[output_pin beeper]
pin: PC6

View File

@ -88,6 +88,12 @@ max_accel: 3000
max_z_velocity: 5 max_z_velocity: 5
max_z_accel: 100 max_z_accel: 100
[bed_screws]
screw1: 30.5, 37
screw2: 30.5, 207
screw3: 204.5, 207
screw4: 204.5, 37
[display] [display]
lcd_type: st7920 lcd_type: st7920
cs_pin: PA3 cs_pin: PA3

View File

@ -3,6 +3,12 @@
# "make menuconfig" select the STM32F103 with a "28KiB bootloader" and # "make menuconfig" select the STM32F103 with a "28KiB bootloader" and
# serial (on USART1 PA10/PA9) communication. # serial (on USART1 PA10/PA9) communication.
# It should be noted that newer variations of this printer shipping in
# 2022 may have GD32F103 chips installed and not STM32F103. You may
# have to inspect the mainboard to ascertain which one you have. If it
# is the GD32F103 then please select Disable SWD at startup in the
# "make menuconfig" along with the same settings for STM32F103.
# If you prefer a direct serial connection, in "make menuconfig" # If you prefer a direct serial connection, in "make menuconfig"
# select "Enable extra low-level configuration options" and select # select "Enable extra low-level configuration options" and select
# serial (on USART3 PB11/PB10), which is broken out on the 10 pin IDC # serial (on USART3 PB11/PB10), which is broken out on the 10 pin IDC

View File

@ -75,8 +75,8 @@ pin_up_touch_mode_reports_triggered: False
speed: 100 speed: 100
horizontal_move_z: 8 horizontal_move_z: 8
mesh_min: 50, 50 mesh_min: 50, 50
mesh_max: 300,300 mesh_max: 300, 300
probe_count: 3,3 probe_count: 3, 3
[heater_bed] [heater_bed]
heater_pin: PH5 heater_pin: PH5

View File

@ -0,0 +1,101 @@
# This file contains pin mappings for the stock 2020 Creality Ender 5
# Pro with the 32-bit Creality 4.2.2 board. To use this config, during
# "make menuconfig" select the STM32F103 with a "28KiB bootloader" and
# with "Use USB for communication" disabled.
# If you prefer a direct serial connection, in "make menuconfig"
# select "Enable extra low-level configuration options" and select the
# USART3 serial port, which is broken out on the 10 pin IDC cable used
# for the LCD module as follows:
# 3: Tx, 4: Rx, 9: GND, 10: VCC
# Flash this firmware by copying "out/klipper.bin" to a SD card and
# turning on the printer with the card inserted. The firmware
# filename must end in ".bin" and must not match the last filename
# that was flashed.
# See docs/Config_Reference.md for a description of parameters.
[stepper_x]
step_pin: PC2
dir_pin: PB9
enable_pin: !PC3
microsteps: 16
rotation_distance: 40
endstop_pin: ^PA5
position_endstop: 220
position_max: 220
homing_speed: 50
[stepper_y]
step_pin: PB8
dir_pin: PB7
enable_pin: !PC3
microsteps: 16
rotation_distance: 40
endstop_pin: ^PA6
position_endstop: 220
position_max: 220
homing_speed: 50
[stepper_z]
step_pin: PB6
dir_pin: PB5
enable_pin: !PC3
microsteps: 16
rotation_distance: 4
endstop_pin: ^PA7
position_max: 300
position_endstop: 0.0
[extruder]
max_extrude_only_distance: 100.0
step_pin: PB4
dir_pin: PB3
enable_pin: !PC3
microsteps: 16
rotation_distance: 32.342
nozzle_diameter: 0.400
filament_diameter: 1.750
heater_pin: PA1
sensor_type: EPCOS 100K B57560G104F
sensor_pin: PC5
control: pid
pid_kp: 24.831
pid_ki: 1.346
pid_kd: 114.532
min_temp: 0
max_temp: 260
[heater_bed]
heater_pin: PA2
sensor_type: EPCOS 100K B57560G104F
sensor_pin: PC4
control: pid
pid_kp: 66.429
pid_ki: 1.197
pid_kd: 921.707
min_temp: 0
max_temp: 135
[fan]
pin: PA0
[mcu]
serial: /dev/serial/by-id/usb-1a86_USB_Serial-if00-port0
restart_method: command
[printer]
kinematics: cartesian
max_velocity: 300
max_accel: 3000
max_z_velocity: 5
max_z_accel: 100
[display]
lcd_type: st7920
cs_pin: PB12
sclk_pin: PB13
sid_pin: PB15
encoder_pins: ^PB14, ^PB10
click_pin: ^!PB2

View File

@ -75,7 +75,7 @@ position_max: 400
# mesh_min: 10, 10 # mesh_min: 10, 10
# mesh_max: 239, 239 # mesh_max: 239, 239
# algorithm: bicubic # algorithm: bicubic
# probe_count: 5,5 # probe_count: 5, 5
[extruder] [extruder]
max_extrude_only_distance: 1000.0 max_extrude_only_distance: 1000.0

View File

@ -113,7 +113,7 @@ restart_method: command
# mesh_min: 20, 15 # mesh_min: 20, 15
# mesh_max: 250, 240 # mesh_max: 250, 240
# algorithm: bicubic # algorithm: bicubic
# probe_count: 5,5 # probe_count: 5, 5
[filament_switch_sensor filament_sensor] [filament_switch_sensor filament_sensor]
pause_on_runout: true pause_on_runout: true

View File

@ -1,16 +1,25 @@
# This file contains common pin mappings for the stock Elegoo # This file contains standard pin mappings for the stock Elegoo Neptune 2 with a
# Neptune 2 with a MKS Robin Nano (v1.2.004) board. To use this # ZNP Robin Nano (v 1.2 and v1.3) board.
# config, the firmware should be compiled for the STM32F103. When # For the 1.2 board:
# running "make menuconfig", enable "extra low-level configuration # - Compile with the processor model STM32F103.
# setup", select the 28KiB bootloader, and serial (on # USART3 # - Enable "extra low-level configuration options"
# PB11/PB10) communication. # - Select the 28KiB bootloader,
# - Select (Serial (on # USART3 PB11/PB10) for the communication interface.
# Note that the "make flash" command does not work with MKS Robin # Note that the "make flash" command does not work with ZNP Robin boards. After
# boards. After running "make", run the following command: # running "make", run the following command:
# ./scripts/update_mks_robin.py out/klipper.bin out/elegoo.bin # ./scripts/update_mks_robin.py out/klipper.bin out/elegoo.bin
# Copy the file out/elegoo.bin to an SD card and then restart the #
# printer with that SD card. # For the 1.3 board:
# - Compile with the processor model STM32F407.
# - Enable "extra low-level configuration options"
# - Select the 32KiB bootloader,
# - Select (Serial (on # USART3 PB11/PB10) for the communication interface.
# Note that the "make flash" command does not work with ZNP Robin boards. After
# running "make", run the following command:
# cp out/klipper.bin out/elegoo.bin
#
# Copy the file out/elegoo.bin to an SD card and then restart the printer with
# that SD card.
# See docs/Config_Reference.md for a description of parameters. # See docs/Config_Reference.md for a description of parameters.
[stepper_x] [stepper_x]
@ -51,7 +60,7 @@ step_pin: PD6
dir_pin: PD3 dir_pin: PD3
enable_pin: !PB3 enable_pin: !PB3
microsteps: 16 microsteps: 16
rotation_distance: 34.406 rotation_distance: 34.406 # use 23.809 as a base before calibration for a 2s
nozzle_diameter: 0.400 nozzle_diameter: 0.400
filament_diameter: 1.750 filament_diameter: 1.750
heater_pin: PC3 heater_pin: PC3
@ -79,7 +88,7 @@ pid_Kp: 70.857
pid_Ki: 1.221 pid_Ki: 1.221
pid_Kd: 1028.316 pid_Kd: 1028.316
min_temp: 0 min_temp: 0
max_temp: 130 max_temp: 110
[heater_fan hotend_fan] [heater_fan hotend_fan]
pin: PB0 pin: PB0
@ -93,6 +102,12 @@ pin: PB1
serial: /dev/ttyUSB0 serial: /dev/ttyUSB0
restart_method: command restart_method: command
[bed_screws]
screw1: 32.5, 32.5
screw2: 32.5, 202.5
screw3: 202.5, 32.5
screw4: 202.5, 202.5
[printer] [printer]
kinematics: cartesian kinematics: cartesian
max_velocity: 300 max_velocity: 300

View File

@ -141,15 +141,15 @@ z_offset: 2.6
pin_up_touch_mode_reports_triggered: False pin_up_touch_mode_reports_triggered: False
[safe_z_home] [safe_z_home]
home_xy_position: 5,5 home_xy_position: 5, 5
z_hop: 5.0 z_hop: 5.0
z_hop_speed: 5.0 z_hop_speed: 5.0
[bed_mesh] [bed_mesh]
speed: 80 speed: 80
mesh_min: 40,20 mesh_min: 40, 20
mesh_max: 210,205 mesh_max: 210, 205
probe_count: 5,5 probe_count: 5, 5
###################################################################### ######################################################################
# "RepRapDiscount 128x64 Full Graphic Smart Controller" type display # "RepRapDiscount 128x64 Full Graphic Smart Controller" type display

View File

@ -42,10 +42,10 @@ max_z_velocity: 25
max_z_accel: 100 max_z_accel: 100
[bed_screws] [bed_screws]
screw1: 33,33 screw1: 33, 33
screw2: 203,33 screw2: 203, 33
screw3: 203,201 screw3: 203, 201
screw4: 33,201 screw4: 33, 201
[stepper_x] [stepper_x]
step_pin: PE3 step_pin: PE3
@ -158,7 +158,7 @@ switch_pin: !PA4
# Optional bed mesh configuration you can use if you have a BLtouch installed. # Optional bed mesh configuration you can use if you have a BLtouch installed.
#[bed_mesh] #[bed_mesh]
#mesh_min: 70,15 #mesh_min: 70, 15
#mesh_max: 220,210 #mesh_max: 220, 210
#horizontal_move_z: 5 #horizontal_move_z: 5
#speed: 150 #speed: 150

View File

@ -93,9 +93,9 @@ speed: 5
######################################## ########################################
[bed_mesh] [bed_mesh]
mesh_min: 40,40 mesh_min: 40, 40
mesh_max: 185,230 mesh_max: 185, 230
probe_count: 4,4 probe_count: 4, 4
speed: 100 speed: 100
fade_end: 0.0 fade_end: 0.0
algorithm: bicubic algorithm: bicubic

View File

@ -65,9 +65,9 @@ position_max: 250
# z_offset: 1.56 # z_offset: 1.56
# [bed_mesh] # [bed_mesh]
# mesh_min: 16,16 # mesh_min: 16, 16
# mesh_max: 201,200 # mesh_max: 201, 200
# probe_count: 4,3 # probe_count: 4, 3
[extruder] [extruder]
step_pin: PA4 step_pin: PA4

View File

@ -197,10 +197,10 @@ samples_tolerance_retries: 2
[bed_tilt] [bed_tilt]
# Enable bed tilt measurments using the probe we defined above # Enable bed tilt measurments using the probe we defined above
# Probe points using X0 Y0 offsets @ 0.01mm/step # Probe points using X0 Y0 offsets @ 0.01mm/step
points: -2,-6 points: -2, -6
156,-6 156, -6
156,158 156, 158
-2,158 -2, 158
speed: 75 speed: 75
horizontal_move_z: 2 horizontal_move_z: 2

View File

@ -151,15 +151,15 @@ sample_retract_dist: 1.0
samples_tolerance: 0.075 samples_tolerance: 0.075
[bed_tilt] [bed_tilt]
points: -9,-9 points: -9, -9
289.4,-9 289.4, -9
289.4,290 289.4, 290
-9,289 -9, 289
speed: 75 speed: 75
horizontal_move_z: 5 horizontal_move_z: 5
[safe_z_home] [safe_z_home]
home_xy_position: -19.1,259.3 home_xy_position: -19.1, 259.3
speed: 50.0 speed: 50.0
z_hop: 10.0 z_hop: 10.0

View File

@ -185,10 +185,10 @@ samples_tolerance: 0.100
[bed_tilt] [bed_tilt]
#Enable bed tilt measurments using the probe we defined above #Enable bed tilt measurments using the probe we defined above
#Probe points using X0 Y0 offsets @ 0.01mm/step #Probe points using X0 Y0 offsets @ 0.01mm/step
points: -3,-6 points: -3, -6
282,-6 282, -6
282,300 282, 300
-3,300 -3, 300
speed: 75 speed: 75
horizontal_move_z: 5 horizontal_move_z: 5
@ -196,7 +196,7 @@ horizontal_move_z: 5
#Needed to lift the Z to clear homing switch on bed #Needed to lift the Z to clear homing switch on bed
# ---> WARNING! - Z_MAX limit switch not monitored in Klipper! <--- # ---> WARNING! - Z_MAX limit switch not monitored in Klipper! <---
# ---> This could potentially crash the toolhead if already at the top of Z travel! <--- # ---> This could potentially crash the toolhead if already at the top of Z travel! <---
home_xy_position: -19,265 home_xy_position: -19, 265
speed: 50.0 speed: 50.0
z_hop: 15.0 z_hop: 15.0
move_to_previous: False move_to_previous: False

View File

@ -0,0 +1,141 @@
# This file contains common pin mappings for the Monoprice
# Select Mini v1. To use this config, the firmware should be compiled for the
# STM32F103 microcontroller with an 8MHz crystal and USB for communication.
#
# Use the following settings in make menuconfig:
#
# * Enable extra low-level configuration options: Enable
# * Microcontroller architecture: STM32
# * Processor: STM32F103
# * Bootloader offset: 8KiB bootloader
# * Clockspeed: 8 Mhz crystal
# * Communication interface: USB (on PA11/PA12)
# * GPIO pins to set: PA8, PB1, PB11, PB9
#
# IMPORTANT: A bootloader offset of 8KiB will preserver the stock bootloader
# and allows easy flashing via SDCard without additional hardware.
#
# IMPORTANT: Setting PB9 in the the GPIO pins to set at micro-controller
# startup is required for the USB port to function.
#
# PA8, PB1, PB11 in the GPIO pins deactivates the steppers until klippy
# takes over.
#
# Note 1: Prior to flashing klipper, if possible, make a copy of the default
# or current configuration values for the printer. Running an M503 command
# will output these values.
#
# Note 2: Klipper can be flashed by copying out/klipper.bin to the MPSMv1's
# SDCard, renaming it to update.bin, and creating an empty file on the SD card
# named fcupdate.flg. Insert the SDCard while the printer is off it on. After
# klipper is flashed, remove the SDCard and delete update.bin and fcupdate.flg
# to prevent the firmware from flashing on every subsequent power-on.
# Returning to stock firmware without a programmer is possible as long as the
# bootloader is not overwritten.
#
# Note 3: Stepper directions are not consistent in MSPMv1 printers. Check the
# directions of the printer with M503 in the stock firmware and adjust the
# dir_pins below accordingly.
#
# Note 4: Klipper currently does not support the LCD-UI of this
# printer, which is connected via serial interface and controlled by an
# esp8266 using a custom protocol.
#
# See ../docs/Config_Reference.md file for a description of all parameters.
[stepper_x]
homing_speed: 15
step_pin: PB14
dir_pin: !PB15 # modify stepper direction if necessary
enable_pin: !PA8
# rotation_distance varies in the printer model. Check the correct
# step-rate of the Select Mini in the original firmware (with M503)
# and calculate the appropriate value for rotation_distance. This has
# to be done for all axes.
microsteps: 16
rotation_distance: 34.510 # 17 teeth on pulley; MXL belt (2.03 pitch)
endstop_pin: ^!PB4
position_endstop: 0
position_max: 120 # default bed width
position_min: 0
[stepper_y]
homing_speed: 15
step_pin: PB12
dir_pin: PB13 # modify stepper direction if necessary
enable_pin: !PA8
microsteps: 16
rotation_distance: 34.510 # check comment in [stepper_x] section
endstop_pin: ^!PA15
position_endstop: 0
position_max: 120 # default bed length
position_min: 0
[stepper_z]
homing_speed: 10
step_pin: PB10
dir_pin: PB2 # modify stepper direction if necessary
enable_pin: !PB11
microsteps: 16
full_steps_per_rotation: 48
rotation_distance: 0.7 # M4 rod. check comment in [stepper_x] section
endstop_pin: ^!PB5
position_endstop: 0.5
position_max: 120 # default height
[extruder]
# extruder stepper
step_pin: PB0
dir_pin: !PC13 # modify stepper direction if necessary
enable_pin: !PB1
microsteps: 16
rotation_distance: 32.990 # 97 steps/mm. check comment in [stepper_x] section
nozzle_diameter: 0.400
filament_diameter: 1.750
# heater
heater_pin: PB6
sensor_type: EPCOS 100K B57560G104F
sensor_pin: PA0
control: pid
pid_kp: 20.00
pid_ki: 0.02
pid_kd: 250.00
# temperatures
min_temp: 0
max_temp: 250
max_extrude_only_distance: 425 #for (un-)loading
[heater_bed]
heater_pin: PB7
sensor_type: EPCOS 100K B57560G104F
sensor_pin: PA1
control: pid
pid_kp: 70.00
pid_ki: 1.50
pid_kd: 812.00
min_temp: 0
max_temp: 85
# Print cooling fan
[heater_fan hotend_fan]
pin: PB8
heater: extruder
heater_temp: 45.0
[mcu]
serial: /dev/ttyACM0
restart_method: command
[printer]
kinematics: cartesian
max_velocity: 150
max_accel: 800
max_z_velocity: 1.5
max_z_accel: 20
# Positions for BED_SCREWS_ADJUST levelling with bed screws still accessible
[bed_screws]
screw1: 22, 10
screw2: 22, 90
screw3: 98, 90
screw4: 98, 10

View File

@ -15,7 +15,7 @@
# Also make sure to use the following string in the low-level configuration # Also make sure to use the following string in the low-level configuration
# options to set a couple of GPIOs to high when the MCU boots: # options to set a couple of GPIOs to high when the MCU boots:
# #
# PA8, PB5, PB1 # PA8, PB11, PB1
# #
# This will deactivate the steppers until klippy takes over. # This will deactivate the steppers until klippy takes over.
# #
@ -143,10 +143,10 @@ max_z_accel: 20
# Positions for BED_SCREWS_ADJUST levelling with bed screws still accessible # Positions for BED_SCREWS_ADJUST levelling with bed screws still accessible
[bed_screws] [bed_screws]
screw1: 22,10 screw1: 22, 10
screw2: 22,90 screw2: 22, 90
screw3: 98,90 screw3: 98, 90
screw4: 98,10 screw4: 98, 10
###################################################################### ######################################################################
# Optional: i2c ssd1306 OLED-display controlled by raspi host_mcu # Optional: i2c ssd1306 OLED-display controlled by raspi host_mcu

View File

@ -93,13 +93,13 @@ y_offset: 37
z_offset: 2.0 z_offset: 2.0
[safe_z_home] [safe_z_home]
home_xy_position: 125,150 home_xy_position: 125, 150
z_hop: 10 z_hop: 10
z_hop_speed: 5 z_hop_speed: 5
[bed_mesh] [bed_mesh]
mesh_min: 5,5 mesh_min: 5, 5
mesh_max: 225,225 mesh_max: 225, 225
[fan] [fan]
pin: PH5 pin: PH5

View File

@ -158,15 +158,15 @@ z_offset: 0 # set this to your Live Z Offset, but negated (invert the sign)
speed: 6.0 speed: 6.0
[safe_z_home] [safe_z_home]
home_xy_position: 147.4,21.1 home_xy_position: 147.4, 21.1
z_hop: 4 z_hop: 4
[bed_mesh] [bed_mesh]
speed: 100 speed: 100
horizontal_move_z: 5 horizontal_move_z: 5
mesh_min: 10,10 mesh_min: 10, 10
mesh_max: 141,167 mesh_max: 141, 167
probe_count: 4,4 probe_count: 4, 4
[filament_switch_sensor filament_sensor] [filament_switch_sensor filament_sensor]
switch_pin: ^PB4 switch_pin: ^PB4

View File

@ -124,7 +124,7 @@ gcode:
# Mesh Bed Leveling. # Mesh Bed Leveling.
[bed_mesh] [bed_mesh]
mesh_min: 5,18 mesh_min: 5, 18
mesh_max: 230,228 mesh_max: 230, 228
probe_count: 9,9 probe_count: 9, 9
algorithm: bicubic algorithm: bicubic

View File

@ -118,26 +118,26 @@ switch_pin: !PA15
pin: PB0 pin: PB0
[safe_z_home] [safe_z_home]
home_xy_position: 165,165 home_xy_position: 165, 165
speed: 50 speed: 50
z_hop: 10 z_hop: 10
z_hop_speed: 5 z_hop_speed: 5
[bed_screws] [bed_screws]
screw1: 5,5 screw1: 5, 5
screw2: 165,5 screw2: 165, 5
screw3: 325,5 screw3: 325, 5
screw4: 5,325 screw4: 5, 325
screw5: 165,325 screw5: 165, 325
screw6: 325,325 screw6: 325, 325
[bed_mesh] [bed_mesh]
speed: 120 speed: 120
probe_count: 5,5 probe_count: 5, 5
horizontal_move_z: 5 horizontal_move_z: 5
algorithm: lagrange algorithm: lagrange
mesh_min : 20,20 mesh_min : 20, 20
mesh_max : 310,310 mesh_max : 310, 310
mesh_pps: 0 mesh_pps: 0
[probe] [probe]

View File

@ -91,11 +91,9 @@ pid_Kd: 898.279
[heater_fan hotend_fan] [heater_fan hotend_fan]
pin: PG14 pin: PG14
fan_speed: 0.5
[fan] [fan]
pin: PG13 pin: PG13
max_power: 0.5
[controller_fan drivers_fan] [controller_fan drivers_fan]
pin: PD6 pin: PD6
@ -110,26 +108,26 @@ switch_pin: PA15
pin: PB0 pin: PB0
[safe_z_home] [safe_z_home]
home_xy_position: 165,165 home_xy_position: 165, 165
speed: 50 speed: 50
z_hop: 10 z_hop: 10
z_hop_speed: 5 z_hop_speed: 5
[bed_screws] [bed_screws]
screw1: 5,5 screw1: 5, 5
screw2: 165,5 screw2: 165, 5
screw3: 325,5 screw3: 325, 5
screw4: 5,325 screw4: 5, 325
screw5: 165,325 screw5: 165, 325
screw6: 325,325 screw6: 325, 325
[bed_mesh] [bed_mesh]
speed: 120 speed: 120
probe_count: 5,5 probe_count: 5, 5
horizontal_move_z: 5 horizontal_move_z: 5
algorithm: lagrange algorithm: lagrange
mesh_min : 20,20 mesh_min : 20, 20
mesh_max : 310,310 mesh_max : 310, 310
mesh_pps: 0 mesh_pps: 0
[probe] [probe]

View File

@ -1,18 +1,20 @@
# This file contains common pin mappings for the Two Trees Sapphire # This file contains common pin mappings for the Two Trees Sapphire
# Plus printer from 2020 (revision 2 with dual Z axis). # Plus V1 (SP-5) printer (Robin Nano 1.2, 2208 drivers for X,Y and A4988 for Zs,E).
# INSTRUCTIONS FOR COMPILING
# To use this config, the firmware should be compiled for the STM32F103. # To use this config, the firmware should be compiled for the STM32F103.
# When running "make menuconfig" you have to: # When running "make menuconfig", enable "extra low-level configuration setup",
# - enable "extra low-level configuration setup", # select the 28KiB bootloader, serial (on USART3 PB11/PB10) to use USB communication
# - select the 28KiB bootloader, # or serial (on USART1 PA10/PA9) to use direct UART connection with Raspberry trough wifi pins.
# - select serial (on USART3 PB11/PB10) communication # Set "GPIO pins to set at micro-controller startup" to "!PC6,!PD13" to turn off display at startup.
# - set "GPIO pins to set at micro-controller startup" to "!PC6,!PD13"
# Note that the "make flash" command does not work with the Sapphire # INSTRUCTIONS FOR FLASHING, THE SCRIPT IS COMPULSORY OR IT WON'T WORK!!!
# Pro. After running "make", run the following command: # Note that the "make flash" command does not work with the Robin Nano!
# After running "make", run the following command in one row FROM THE KLIPPER FOLDER:
# ./scripts/update_mks_robin.py out/klipper.bin out/Robin_nano35.bin # ./scripts/update_mks_robin.py out/klipper.bin out/Robin_nano35.bin
# Copy the file out/Robin_nano35.bin to an SD card and then restart the # Copy the file out/Robin_nano35.bin (if you can't find the file the script was not executed)
# printer with that SD card. # to an SD card and then restart the printer with that SD card.
# If you removed the LCD screen rename the file to "Robin_nano43.bin" for correct flashing.
# See docs/Config_Reference.md for a description of parameters. # See docs/Config_Reference.md for a description of parameters.
@ -54,12 +56,11 @@ dir_pin: PA1
enable_pin: !PA3 enable_pin: !PA3
microsteps: 16 microsteps: 16
rotation_distance: 8 rotation_distance: 8
endstop_pin: !PC4
[extruder] [extruder]
step_pin: PD6 step_pin: PD6
dir_pin: !PD3 dir_pin: !PD3
enable_pin: !PB3 enable_pin: PB3
microsteps: 16 microsteps: 16
gear_ratio: 50:17 gear_ratio: 50:17
rotation_distance: 23.52 rotation_distance: 23.52
@ -86,6 +87,9 @@ pid_Kp: 325.10
pid_Ki: 63.35 pid_Ki: 63.35
pid_Kd: 417.10 pid_Kd: 417.10
[heater_fan extruder]
pin: PB0
[fan] [fan]
pin: PB1 pin: PB1
@ -97,8 +101,14 @@ restart_method: command
kinematics: corexy kinematics: corexy
max_velocity: 250 max_velocity: 250
max_accel: 4500 max_accel: 4500
max_z_velocity: 25 max_z_velocity: 15
max_z_accel: 100 max_z_accel: 100
[bed_screws]
screw1: 35,35
screw2: 275,35
screw3: 275,275
screw4: 35,275
[static_digital_output reset_display] [static_digital_output reset_display]
pins: !PC6, !PD13 pins: !PC6, !PD13

View File

@ -0,0 +1,114 @@
# This file contains common pin mappings for the Two Trees Sapphire
# Plus V1.1 (SP-5) printer (Robin Nano 1.2, all 2225 drivers at 32 microsteps).
# INSTRUCTIONS FOR COMPILING
# To use this config, the firmware should be compiled for the STM32F103.
# When running "make menuconfig", enable "extra low-level configuration setup",
# select the 28KiB bootloader, serial (on USART3 PB11/PB10) to use USB communication
# or serial (on USART1 PA10/PA9) to use direct UART connection with Raspberry trough wifi pins.
# Set "GPIO pins to set at micro-controller startup" to "!PC6,!PD13" to turn off display at startup.
# INSTRUCTIONS FOR FLASHING, THE SCRIPT IS COMPULSORY OR IT WON'T WORK!!!
# Note that the "make flash" command does not work with the Robin Nano!
# After running "make", run the following command in one row FROM THE KLIPPER FOLDER:
# ./scripts/update_mks_robin.py out/klipper.bin out/Robin_nano35.bin
# Copy the file out/Robin_nano35.bin (if you can't find the file the script was not executed)
# to an SD card and then restart the printer with that SD card.
# If you removed the LCD screen rename the file to "Robin_nano43.bin" for correct flashing.
# See docs/Config_Reference.md for a description of parameters.
[stepper_x]
step_pin: PE3
dir_pin: !PE2
enable_pin: !PE4
microsteps: 32
rotation_distance: 40
endstop_pin: !PA15
position_endstop: 0
position_max: 300
homing_speed: 50
[stepper_y]
step_pin: PE0
dir_pin: !PB9
enable_pin: !PE1
microsteps: 32
rotation_distance: 40
endstop_pin: !PA12
position_endstop: 300
position_max: 300
homing_speed: 50
[stepper_z]
step_pin: PB5
dir_pin: !PB4
enable_pin: !PB8
microsteps: 32
rotation_distance: 8
endstop_pin: !PA11
position_endstop: 0
position_max: 340
[stepper_z1]
step_pin: PA6
dir_pin: !PA1
enable_pin: !PA3
microsteps: 32
rotation_distance: 8
[extruder]
step_pin: PD6
dir_pin: !PD3
enable_pin: !PB3
microsteps: 32
gear_ratio: 50:17
rotation_distance: 23.52
nozzle_diameter: 0.400
filament_diameter: 1.750
heater_pin: PC3
sensor_type: EPCOS 100K B57560G104F # Stock
sensor_pin: PC1
min_temp: 0
max_temp: 250
control: pid
pid_Kp: 17.48
pid_Ki: 1.32
pid_Kd: 57.81
[heater_bed]
heater_pin: PA0
sensor_type: EPCOS 100K B57560G104F # Stock
sensor_pin: PC0
min_temp: 0
max_temp: 130
control: pid
pid_Kp: 325.10
pid_Ki: 63.35
pid_Kd: 417.10
[heater_fan extruder]
pin: PB0
[fan]
pin: PB1
[mcu]
serial: /dev/ttyUSB0
restart_method: command
[printer]
kinematics: corexy
max_velocity: 250
max_accel: 4500
max_z_velocity: 15
max_z_accel: 100
[bed_screws]
screw1: 35,35
screw2: 275,35
screw3: 275,275
screw4: 35,275
[static_digital_output reset_display]
pins: !PC6, !PD13

View File

@ -1,92 +0,0 @@
# This file contains common pin mappings for the Two Trees Sapphire
# Pro printer from 2020. To use this config, the firmware should be
# compiled for the STM32F103. When running "make menuconfig", enable
# "extra low-level configuration setup", select the 28KiB bootloader,
# serial (on USART3 PB11/PB10) communication, and set "GPIO pins to
# set at micro-controller startup" to "!PC6,!PD13".
# Note that the "make flash" command does not work with the Sapphire
# Pro. After running "make", run the following command:
# ./scripts/update_mks_robin.py out/klipper.bin out/Robin_nano35.bin
# Copy the file out/Robin_nano35.bin to an SD card and then restart the
# printer with that SD card.
# See docs/Config_Reference.md for a description of parameters.
[stepper_x]
step_pin: PE3
dir_pin: !PE2
enable_pin: !PE4
microsteps: 16
rotation_distance: 32
endstop_pin: !PA15
position_endstop: 0
position_max: 230
homing_speed: 50
[stepper_y]
step_pin: PE0
dir_pin: !PB9
enable_pin: !PE1
microsteps: 16
rotation_distance: 32
endstop_pin: !PA12
position_endstop: 230
position_max: 230
homing_speed: 50
[stepper_z]
step_pin: PB5
dir_pin: PB4
enable_pin: !PB8
microsteps: 16
rotation_distance: 8
endstop_pin: !PA11
position_endstop: 0.5
position_max: 230
[extruder]
step_pin: PD6
dir_pin: !PD3
enable_pin: !PB3
microsteps: 16
rotation_distance: 6.720
nozzle_diameter: 0.400
filament_diameter: 1.750
heater_pin: PC3
sensor_type: ATC Semitec 104GT-2
sensor_pin: PC1
control: pid
pid_Kp: 14.669
pid_Ki: 0.572
pid_Kd: 94.068
min_temp: 0
max_temp: 250
[heater_bed]
heater_pin: PA0
sensor_type: EPCOS 100K B57560G104F
sensor_pin: PC0
control: pid
pid_Kp: 325.10
pid_Ki: 63.35
pid_Kd: 417.10
min_temp: 0
max_temp: 130
[fan]
pin: PB1
[mcu]
serial: /dev/ttyUSB0
restart_method: command
[printer]
kinematics: corexy
max_velocity: 250
max_accel: 4500
max_z_velocity: 25
max_z_accel: 100
[static_digital_output reset_display]
pins: !PC6, !PD13

View File

@ -0,0 +1,107 @@
# This file contains common pin mappings for the Two Trees Sapphire
# Pro (SP-3) printer (Robin Nano 1.2, 2208 drivers for X,Y and A4988 for Z,E).
# INSTRUCTIONS FOR COMPILING
# To use this config, the firmware should be compiled for the STM32F103.
# When running "make menuconfig", enable "extra low-level configuration setup",
# select the 28KiB bootloader, serial (on USART3 PB11/PB10) to use USB communication
# or serial (on USART1 PA10/PA9) to use direct UART connection with Raspberry trough wifi pins.
# Set "GPIO pins to set at micro-controller startup" to "!PC6,!PD13" to turn off display at startup.
# INSTRUCTIONS FOR FLASHING, THE SCRIPT IS COMPULSORY OR IT WON'T WORK!!!
# Note that the "make flash" command does not work with the Robin Nano!
# After running "make", run the following command in one row FROM THE KLIPPER FOLDER:
# ./scripts/update_mks_robin.py out/klipper.bin out/Robin_nano35.bin
# Copy the file out/Robin_nano35.bin (if you can't find the file the script was not executed)
# to an SD card and then restart the printer with that SD card.
# If you removed the LCD screen rename the file to "Robin_nano43.bin" for correct flashing.
# See docs/Config_Reference.md for a description of parameters.
[stepper_x]
step_pin: PE3
dir_pin: !PE2
enable_pin: !PE4
microsteps: 16
rotation_distance: 40
endstop_pin: !PA15
position_endstop: 0
position_max: 230
homing_speed: 50
[stepper_y]
step_pin: PE0
dir_pin: !PB9
enable_pin: !PE1
microsteps: 16
rotation_distance: 40
endstop_pin: !PA12
position_endstop: 230
position_max: 230
homing_speed: 50
[stepper_z]
step_pin: PB5
dir_pin: PB4
enable_pin: !PB8
microsteps: 16
rotation_distance: 2
endstop_pin: !PA11
position_endstop: 0.5
position_max: 230
[extruder]
step_pin: PD6
dir_pin: !PD3
enable_pin: !PB3
microsteps: 16
gear_ratio: 50:17
rotation_distance: 23.52
nozzle_diameter: 0.400
filament_diameter: 1.750
heater_pin: PC3
sensor_type: ATC Semitec 104GT-2
sensor_pin: PC1
control: pid
pid_Kp: 14.669
pid_Ki: 0.572
pid_Kd: 94.068
min_temp: 0
max_temp: 250
[heater_bed]
heater_pin: PA0
sensor_type: EPCOS 100K B57560G104F
sensor_pin: PC0
control: pid
pid_Kp: 325.10
pid_Ki: 63.35
pid_Kd: 417.10
min_temp: 0
max_temp: 130
[heater_fan extruder]
pin: PB0
[fan]
pin: PB1
[mcu]
serial: /dev/ttyUSB0
restart_method: command
[printer]
kinematics: corexy
max_velocity: 250
max_accel: 4500
max_z_velocity: 10
max_z_accel: 80
[bed_screws]
screw1: 15,15
screw2: 210,15
screw3: 210,210
screw4: 15,210
[static_digital_output reset_display]
pins: !PC6, !PD13

View File

@ -92,7 +92,7 @@ z_offset: -15
speed: 120 speed: 120
horizontal_move_z: 5 horizontal_move_z: 5
mesh_radius:65 mesh_radius:65
mesh_origin: 0,0 mesh_origin: 0, 0
round_probe_count: 7 round_probe_count: 7
algorithm: bicubic algorithm: bicubic

View File

@ -91,18 +91,18 @@ square_corner_velocity: 15.0
[bed_mesh] [bed_mesh]
speed: 120 speed: 120
mesh_min: 27,3 mesh_min: 27, 3
mesh_max: 270,290 mesh_max: 270, 290
probe_count: 5,3 probe_count: 5, 3
horizontal_move_z: 10 horizontal_move_z: 10
[bed_screws] [bed_screws]
screw1: 5,5 screw1: 5, 5
screw1_name: front left screw screw1_name: front left screw
screw2: 295,0 screw2: 295, 0
screw2_name: front right screw screw2_name: front right screw
screw3: 295,290 screw3: 295, 290
screw3_name: back right screw screw3_name: back right screw
screw4: 0,290 screw4: 0, 290
screw4_name: back left screw screw4_name: back left screw
probe_height: 0 probe_height: 0

View File

@ -80,6 +80,6 @@ max_z_velocity: 5
max_z_accel: 100 max_z_accel: 100
[bed_mesh] [bed_mesh]
mesh_min: 20,20 mesh_min: 20, 20
mesh_max: 190,130 mesh_max: 190, 130
probe_count: 4,4 probe_count: 4, 4

View File

@ -168,3 +168,4 @@ sclk_pin: PD3
sid_pin: PC0 sid_pin: PC0
encoder_pins: ^PA2, ^PA1 encoder_pins: ^PA2, ^PA1
click_pin: ^!PA3 click_pin: ^!PA3
kill_pin: ^!PD2

View File

@ -21,7 +21,7 @@ position_min: -2 # The Z carriage may need to travel below the Z=0
# The safe_z_home section modifies the default G28 behavior # The safe_z_home section modifies the default G28 behavior
[safe_z_home] [safe_z_home]
home_xy_position: 100,100 home_xy_position: 100, 100
speed: 50 speed: 50
z_hop: 15 z_hop: 15
z_hop_speed: 5 z_hop_speed: 5
@ -29,18 +29,18 @@ z_hop_speed: 5
# Example bed_tilt config section # Example bed_tilt config section
[bed_tilt] [bed_tilt]
points: points:
100,100 100, 100
10,10 10, 10
10,100 10, 100
10,190 10, 190
100,10 100, 10
100,190 100, 190
190,10 190, 10
190,100 190, 100
190,190 190, 190
# Example bed_mesh config section # Example bed_mesh config section
[bed_mesh] [bed_mesh]
mesh_min: 20,20 mesh_min: 20, 20
mesh_max: 200,200 mesh_max: 200, 200
probe_count: 4,4 probe_count: 4, 4

View File

@ -16,6 +16,10 @@ This causes the host software to create a Unix Domain Socket. A client
can then open a connection on that socket and send commands to can then open a connection on that socket and send commands to
Klipper. Klipper.
See the [Moonraker](https://github.com/Arksine/moonraker) project for
a popular tool that can forward HTTP requests to Klipper's API Server
Unix Domain Socket.
## Request format ## Request format
Messages sent and received on the socket are JSON encoded strings Messages sent and received on the socket are JSON encoded strings
@ -341,6 +345,25 @@ and might later produce asynchronous messages such as:
The "header" field in the initial query response is used to describe The "header" field in the initial query response is used to describe
the fields found in later "data" responses. the fields found in later "data" responses.
### angle/dump_angle
This endpoint is used to subscribe to
[angle sensor data](Config_Reference.md#angle). Obtaining these
low-level motion updates may be useful for diagnostic and debugging
purposes. Using this endpoint may increase Klipper's system load.
A request may look like:
`{"id": 123, "method":"angle/dump_angle",
"params": {"sensor": "my_angle_sensor", "response_template": {}}}`
and might return:
`{"id": 123,"result":{"header":["time","angle"]}}`
and might later produce asynchronous messages such as:
`{"params":{"position_offset":3.151562,"errors":0,
"data":[[1290.951905,-5063],[1290.952321,-5065]]}}`
The "header" field in the initial query response is used to describe
the fields found in later "data" responses.
### pause_resume/cancel ### pause_resume/cancel
This endpoint is similar to running the "PRINT_CANCEL" G-Code command. This endpoint is similar to running the "PRINT_CANCEL" G-Code command.

View File

@ -28,7 +28,7 @@ move to the center of the bed, and home the z axis. For example:
``` ```
[safe_z_home] [safe_z_home]
home_xy_position: 100,100 # Change coordinates to the center of your print bed home_xy_position: 100, 100 # Change coordinates to the center of your print bed
speed: 50 speed: 50
z_hop: 10 # Move up 10mm z_hop: 10 # Move up 10mm
z_hop_speed: 5 z_hop_speed: 5
@ -64,9 +64,10 @@ run `BLTOUCH_DEBUG COMMAND=touch_mode`, run `QUERY_PROBE`, and verify
that command reports "probe: open". Then while gently pushing the pin that command reports "probe: open". Then while gently pushing the pin
up slightly with the nail of your finger run `QUERY_PROBE` again. up slightly with the nail of your finger run `QUERY_PROBE` again.
Verify the command reports "probe: TRIGGERED". If either query does Verify the command reports "probe: TRIGGERED". If either query does
not report the correct message then check your wiring and not report the correct message then it usually indicates an incorrect
configuration again. At the completion of this test run `BLTOUCH_DEBUG wiring or configuration (though some [clones](#bl-touch-clones) may
COMMAND=pin_up` and verify that the pin moves up. require special handling). At the completion of this test run
`BLTOUCH_DEBUG COMMAND=pin_up` and verify that the pin moves up.
After completing the BL-Touch control pin and sensor pin tests, it is After completing the BL-Touch control pin and sensor pin tests, it is
now time to test probing, but with a twist. Instead of letting the now time to test probing, but with a twist. Instead of letting the
@ -106,7 +107,8 @@ commands to achieve this.
## BL-Touch "clones" ## BL-Touch "clones"
Many BL-Touch "clone" devices work correctly with Klipper using the Many BL-Touch "clone" devices work correctly with Klipper using the
default configuration. However, some "clone" devices may require default configuration. However, some "clone" devices may not support
the `QUERY_PROBE` command and some "clone" devices may require
configuration of `pin_up_reports_not_triggered` or configuration of `pin_up_reports_not_triggered` or
`pin_up_touch_mode_reports_triggered`. `pin_up_touch_mode_reports_triggered`.
@ -116,6 +118,16 @@ these directions. Do not configure either of these to False on a
genuine BL-Touch. Incorrectly setting these to False can increase genuine BL-Touch. Incorrectly setting these to False can increase
probing time and can increase the risk of damaging the printer. probing time and can increase the risk of damaging the printer.
Some "clone" devices do not support `touch_mode` and as a result the
`QUERY_PROBE` command does not work. Despite this, it may still be
possible to perform probing and homing with these devices. On these
devices the `QUERY_PROBE` command during the
[initial tests](#initial-tests) will not succeed, however the
subsequent `G28` (or `PROBE`) test does succeed. It may be possible to
use these "clone" devices with Klipper if one does not utilize the
`QUERY_PROBE` command and one does not enable the
`probe_with_touch_mode` feature.
Some "clone" devices are unable to perform Klipper's internal sensor Some "clone" devices are unable to perform Klipper's internal sensor
verification test. On these devices, attempts to home or probe can verification test. On these devices, attempts to home or probe can
result in Klipper reporting a "BLTouch failed to verify sensor state" result in Klipper reporting a "BLTouch failed to verify sensor state"

View File

@ -63,7 +63,7 @@ test".
In order to perform the paper test, cut a small rectangular piece of In order to perform the paper test, cut a small rectangular piece of
paper using a pair of scissors (eg, 5x3 cm). The paper generally has a paper using a pair of scissors (eg, 5x3 cm). The paper generally has a
width of around 100 microns (0.100mm). (The exact width of the paper thickness of around 100 microns (0.100mm). (The exact thickness of the paper
isn't crucial.) isn't crucial.)
The first step of the paper test is to inspect the printer's nozzle The first step of the paper test is to inspect the printer's nozzle
@ -74,7 +74,7 @@ or bed.
If one always prints on a particular tape or printing surface then one If one always prints on a particular tape or printing surface then one
may perform the paper test with that tape/surface in place. However, may perform the paper test with that tape/surface in place. However,
note that tape itself has a width and different tapes (or any other note that tape itself has a thickness and different tapes (or any other
printing surface) will impact Z measurements. Be sure to rerun the printing surface) will impact Z measurements. Be sure to rerun the
paper test to measure each type of surface that is in use. paper test to measure each type of surface that is in use.
@ -89,11 +89,11 @@ temperature!**
When the nozzle is heated, its position (relative to the bed) changes When the nozzle is heated, its position (relative to the bed) changes
due to thermal expansion. This thermal expansion is typically around a due to thermal expansion. This thermal expansion is typically around a
100 microns, which is about the same width as a typical piece of 100 microns, which is about the same thickness as a typical piece of
printer paper. The exact amount of thermal expansion isn't crucial, printer paper. The exact amount of thermal expansion isn't crucial,
just as the exact width of the paper isn't crucial. Start with the just as the exact thickness of the paper isn't crucial. Start with the
assumption that the two are equal (see below for a method of assumption that the two are equal (see below for a method of
determining the difference between the two widths). determining the difference between the two distances).
It may seem odd to calibrate the distance at room temperature when the It may seem odd to calibrate the distance at room temperature when the
goal is to have a consistent distance when heated. However, if one goal is to have a consistent distance when heated. However, if one
@ -180,7 +180,7 @@ command to exit the calibration tool.
After successfully performing bed leveling, one may go on to calculate After successfully performing bed leveling, one may go on to calculate
a more precise value for the combined impact of "thermal expansion", a more precise value for the combined impact of "thermal expansion",
"width of the paper", and "amount of friction felt during the paper "thickness of the paper", and "amount of friction felt during the paper
test". test".
This type of calculation is generally not needed as most users find This type of calculation is generally not needed as most users find

View File

@ -24,9 +24,9 @@ bed and a probe with an x-offset of 24 mm and y-offset of 5 mm.
[bed_mesh] [bed_mesh]
speed: 120 speed: 120
horizontal_move_z: 5 horizontal_move_z: 5
mesh_min: 35,6 mesh_min: 35, 6
mesh_max: 240, 198 mesh_max: 240, 198
probe_count: 5,3 probe_count: 5, 3
``` ```
- `speed: 120`\ - `speed: 120`\
@ -37,21 +37,21 @@ probe_count: 5,3
_Default Value: 5_\ _Default Value: 5_\
The Z coordinate the probe rises to prior to traveling between points. The Z coordinate the probe rises to prior to traveling between points.
- `mesh_min: 35,6`\ - `mesh_min: 35, 6`\
_Required_\ _Required_\
The first probed coordinate, nearest to the origin. This coordinate The first probed coordinate, nearest to the origin. This coordinate
is relative to the probe's location. is relative to the probe's location.
- `mesh_max: 240,198`\ - `mesh_max: 240, 198`\
_Required_\ _Required_\
The probed coordinate farthest farthest from the origin. This is not The probed coordinate farthest farthest from the origin. This is not
necessarily the last point probed, as the probing process occurs in a necessarily the last point probed, as the probing process occurs in a
zig-zag fashion. As with `mesh_min`, this coordiante is relative to zig-zag fashion. As with `mesh_min`, this coordiante is relative to
the probe's location. the probe's location.
- `probe_count: 5,3`\ - `probe_count: 5, 3`\
_Default Value: 3,3_\ _Default Value: 3, 3_\
The number of points to probe on each axis, specified as x,y integer The number of points to probe on each axis, specified as X, Y integer
values. In this example 5 points will be probed along the X axis, with values. In this example 5 points will be probed along the X axis, with
3 points along the Y axis, for a total of 15 probed points. Note that 3 points along the Y axis, for a total of 15 probed points. Note that
if you wanted a square grid, for example 3x3, this could be specified if you wanted a square grid, for example 3x3, this could be specified
@ -76,7 +76,7 @@ and 5 mm on Y.
speed: 120 speed: 120
horizontal_move_z: 5 horizontal_move_z: 5
mesh_radius: 75 mesh_radius: 75
mesh_origin: 0,0 mesh_origin: 0, 0
round_probe_count: 5 round_probe_count: 5
``` ```
@ -86,10 +86,10 @@ round_probe_count: 5
that the probe's offsets limit the size of the mesh radius. In this example, that the probe's offsets limit the size of the mesh radius. In this example,
a radius larger than 76 would move the tool beyond the range of the printer. a radius larger than 76 would move the tool beyond the range of the printer.
- `mesh_origin: 0,0`\ - `mesh_origin: 0, 0`\
_Default Value: 0,0_\ _Default Value: 0, 0_\
The center point of the mesh. This coordinate is relative to the probe's The center point of the mesh. This coordinate is relative to the probe's
location. While the default is 0,0, it may be useful to adjust the origin location. While the default is 0, 0, it may be useful to adjust the origin
in an effort to probe a larger portion of the bed. See the illustration in an effort to probe a larger portion of the bed. See the illustration
below. below.
@ -125,20 +125,20 @@ lagrange and bicubic interpolation to accomplish this.
[bed_mesh] [bed_mesh]
speed: 120 speed: 120
horizontal_move_z: 5 horizontal_move_z: 5
mesh_min: 35,6 mesh_min: 35, 6
mesh_max: 240, 198 mesh_max: 240, 198
probe_count: 5,3 probe_count: 5, 3
mesh_pps: 2,3 mesh_pps: 2, 3
algorithm: bicubic algorithm: bicubic
bicubic_tension: 0.2 bicubic_tension: 0.2
``` ```
- `mesh_pps: 2,3`\ - `mesh_pps: 2, 3`\
_Default Value: 2,2_\ _Default Value: 2, 2_\
The `mesh_pps` option is shorthand for Mesh Points Per Segment. This The `mesh_pps` option is shorthand for Mesh Points Per Segment. This
option specifies how many points to interpolate for each segment along option specifies how many points to interpolate for each segment along
the x and y axes. Consider a 'segment' to be the space between each the X and Y axes. Consider a 'segment' to be the space between each
probed point. Like `probe_count`, `mesh_pps` is specified as an x,y probed point. Like `probe_count`, `mesh_pps` is specified as an X, Y
integer pair, and also may be specified a single integer that is applied integer pair, and also may be specified a single integer that is applied
to both axes. In this example there are 4 segments along the X axis to both axes. In this example there are 4 segments along the X axis
and 2 segments along the Y axis. This evaluates to 8 interpolated and 2 segments along the Y axis. This evaluates to 8 interpolated
@ -179,9 +179,9 @@ control the splitting behavior.
[bed_mesh] [bed_mesh]
speed: 120 speed: 120
horizontal_move_z: 5 horizontal_move_z: 5
mesh_min: 35,6 mesh_min: 35, 6
mesh_max: 240, 198 mesh_max: 240, 198
probe_count: 5,3 probe_count: 5, 3
move_check_distance: 5 move_check_distance: 5
split_delta_z: .025 split_delta_z: .025
``` ```
@ -225,9 +225,9 @@ As such, fade is disabled by default.
[bed_mesh] [bed_mesh]
speed: 120 speed: 120
horizontal_move_z: 5 horizontal_move_z: 5
mesh_min: 35,6 mesh_min: 35, 6
mesh_max: 240, 198 mesh_max: 240, 198
probe_count: 5,3 probe_count: 5, 3
fade_start: 1 fade_start: 1
fade_end: 10 fade_end: 10
fade_target: 0 fade_target: 0
@ -273,9 +273,9 @@ These printers can benefit from configuring the relative reference index.
[bed_mesh] [bed_mesh]
speed: 120 speed: 120
horizontal_move_z: 5 horizontal_move_z: 5
mesh_min: 35,6 mesh_min: 35, 6
mesh_max: 240, 198 mesh_max: 240, 198
probe_count: 5,3 probe_count: 5, 3
relative_reference_index: 7 relative_reference_index: 7
``` ```
@ -314,9 +314,9 @@ will be averaged and inserted in the mesh as the Z value at the generated
[bed_mesh] [bed_mesh]
speed: 120 speed: 120
horizontal_move_z: 5 horizontal_move_z: 5
mesh_min: 35,6 mesh_min: 35, 6
mesh_max: 240, 198 mesh_max: 240, 198
probe_count: 5,3 probe_count: 5, 3
faulty_region_1_min: 130.0, 0.0 faulty_region_1_min: 130.0, 0.0
faulty_region_1_max: 145.0, 40.0 faulty_region_1_max: 145.0, 40.0
faulty_region_2_min: 225.0, 0.0 faulty_region_2_min: 225.0, 0.0

View File

@ -248,6 +248,25 @@ results were obtained by running an STM32F407 binary on an STM32F446
| 1 stepper | 46 | | 1 stepper | 46 |
| 3 stepper | 205 | | 3 stepper | 205 |
### STM32G0B1 step rate benchmark
The following configuration sequence is used on the STM32G0B1:
```
allocate_oids count=3
config_stepper oid=0 step_pin=PB13 dir_pin=PB12 invert_step=-1 step_pulse_ticks=0
config_stepper oid=1 step_pin=PB10 dir_pin=PB2 invert_step=-1 step_pulse_ticks=0
config_stepper oid=2 step_pin=PB0 dir_pin=PC5 invert_step=-1 step_pulse_ticks=0
finalize_config crc=0
```
The test was last run on commit `247cd753` with gcc version
`arm-none-eabi-gcc (Fedora 10.2.0-4.fc34) 10.2.0`.
| stm32g0b1 | ticks |
| ---------------- | ----- |
| 1 stepper | 58 |
| 3 stepper | 243 |
### LPC176x step rate benchmark ### LPC176x step rate benchmark
The following configuration sequence is used on the LPC176x: The following configuration sequence is used on the LPC176x:

View File

@ -254,10 +254,11 @@ bossac -U -p /dev/ttyACM0 --offset=0x4000 -w out/klipper.bin -v -b -R
## STM32F103 micro-controllers (Blue Pill devices) ## STM32F103 micro-controllers (Blue Pill devices)
The STM32F103 devices have a ROM that can flash a bootloader or The STM32F103 devices have a ROM that can flash a bootloader or
application via 3.3V serial. To access this ROM, one should connect application via 3.3V serial. Typically one would wire the PA10 (MCU
the "boot 0" pin to high and "boot 1" pin to low, and then reset the Rx) and PA9 (MCU Tx) pins to a 3.3V UART adapter. To access the ROM,
device. The "stm32flash" package can then be used to flash the device one should connect the "boot 0" pin to high and "boot 1" pin to low,
using something like: and then reset the device. The "stm32flash" package can then be used
to flash the device using something like:
``` ```
stm32flash -w out/klipper.bin -v -g 0 /dev/ttyAMA0 stm32flash -w out/klipper.bin -v -g 0 /dev/ttyAMA0
``` ```
@ -385,6 +386,66 @@ not available, so it may be done by setting pin PA2 low if you flashed
the SKR Mini E3's "PIN" document. There is a ground pin next to PA2 the SKR Mini E3's "PIN" document. There is a ground pin next to PA2
which you can use to pull PA2 low. which you can use to pull PA2 low.
### STM32F103/STM32F072 with MSC bootloader
The [MSC bootloader](https://github.com/Telekatz/MSC-stm32f103-bootloader) is a driverless bootloader capable of flashing over USB.
It is possible to flash the bootloader via 3.3v serial using stm32flash as noted
in the stm32duino section above, substituting the file name for the desired
MSC bootloader binary (ie: MSCboot-Bluepill.bin for the blue pill).
For STM32F072 boards it is also possible to flash the bootloader over USB (via DFU)
with something like:
```
dfu-util -d 0483:df11 -a 0 -R -D MSCboot-STM32F072.bin -s0x08000000:leave
```
This bootloader uses 8KiB or 16KiB of flash space, see description of the bootloader
(the application must be compiled with with the corresponding starting address).
The bootloader can be activated by pressing the reset button of the board twice.
As soon as the bootloader is activated, the board appears as a USB flash drive
onto which the klipper.bin file can be copied.
### STM32F103/STM32F0x2 with CanBoot bootloader
The [CanBoot](https://github.com/Arksine/CanBoot) bootloader provides an option
for uploading Klipper firmware over the CANBUS. The bootloader itself is
derived from Klipper's source code. Currently CanBoot supports the STM32F103,
STM32F042, and STM32F072 models.
It is recommended to use a ST-Link Programmer to flash CanBoot, however it
should be possible to flash using `stm32flash` on STM32F103 devices, and
`dfu-util` on STM32F042/STM32F072 devices. See the previous sections in this
document for instructions on these flashing methods, substituting `canboot.bin`
for the file name where appropriate. The CanBoot repo linked above provides
instructions for building the bootloader.
The first time CanBoot has been flashed it should detect that no application
is present and enter the bootloader. If this doesn't occur it is possible to
enter the bootloader by pressing the reset button twice in succession.
The `flash_can.py` utility supplied in the `lib/canboot` folder may be used to
upload Klipper firmware. The device UUID is necessary to flash. If you do not
have a UUID it is possible to query nodes currently running the bootloader:
```
python3 flash_can.py -q
```
This will return UUIDs for all connected nodes not currently assigned a UUID.
This should include all nodes currently in the bootloader.
Once you have a UUID, you may upload firmware with following command:
```
python3 flash_can.py -i can0 -f ~/klipper/out/klipper.bin -u aabbccddeeff
```
Where `aabbccddeeff` is replaced by your UUID. Note that the `-i` and `-f`
options may be omitted, they default to `can0` and `~/klipper/out/klipper.bin`
respectively.
When building Klipper for use with CanBoot, select the 8 KiB Bootloader option.
## STM32F4 micro-controllers (SKR Pro 1.1) ## STM32F4 micro-controllers (SKR Pro 1.1)
STM32F4 microcontrollers come equipped with a built-in system bootloader STM32F4 microcontrollers come equipped with a built-in system bootloader

View File

@ -8,7 +8,7 @@ Klipper currently only supports CAN on stm32 chips. In addition, the
micro-controller chip must support CAN and it must be on a board that micro-controller chip must support CAN and it must be on a board that
has a CAN transceiver. has a CAN transceiver.
To compile for CAN, run "make menuconfig" and select "CAN bus" as the To compile for CAN, run `make menuconfig` and select "CAN bus" as the
communication interface. Finally, compile the micro-controller code communication interface. Finally, compile the micro-controller code
and flash it to the target board. and flash it to the target board.

View File

@ -73,7 +73,60 @@ Common things a reviewer will look for:
Updates to documentation should not declare that they are a "work Updates to documentation should not declare that they are a "work
in progress". in progress".
2. Is the copyright of the submission clear, non-gratuitous, and 2. Does the submission provide a "high impact" benefit to real-world
users performing real-world tasks?
Reviewers need to identify, at least in their own minds, roughly
"who the target audience is", a rough scale of "the size of that
audience", the "benefit" they will obtain, how the "benefit is
measured", and the "results of those measurement tests". In most
cases this will be obvious to both the submitter and the reviewer,
and it is not explicitly stated during a review.
Submissions to the master Klipper branch are expected to have a
noteworthy target audience. As a general "rule of thumb",
submissions should target a user base of at least a 100 real-world
users.
If a reviewer asks for details on the "benefit" of a submission,
please don't consider it criticism. Being able to understand the
real-world benefits of a change is a natural part of a review.
When discussing benefits it is preferable to discuss "facts and
measurements". In general, reviewers are not looking for responses
of the form "someone may find option X useful", nor are they
looking for responses of the form "this submission adds a feature
that firmware X implements". Instead, it is generally preferable to
discuss details on how the quality improvement was measured and
what were the results of those measurements - for example, "tests
on Acme X1000 printers show improved corners as seen in picture
...", or for example "print time of real-world object X on a
Foomatic X900 printer went from 4 hours to 3.5 hours". It is
understood that testing of this type can take significant time and
effort. Some of Klipper's most notable features took months of
discussion, rework, testing, and documentation prior to being
merged into the master branch.
All new modules, config options, commands, command parameters, and
documents should have "high impact". We do not want to burden users
with options that they can not reasonably configure nor do we want
to burden them with options that don't provide a notable benefit.
A reviewer may ask for clarification on how a user is to configure
an option - an ideal response will contain details on the process -
for example, "users of the MegaX500 are expected to set option X to
99.3 while users of the Elite100Y are expected to calibrate option
X using procedure ...".
If the goal of an option is to make the code more modular then
prefer using code constants instead of user facing config options.
New modules, new options, and new parameters should not provide
similar functionality to existing modules - if the differences are
arbitrary than it's preferable to utilize the existing system or
refactor the existing code.
3. Is the copyright of the submission clear, non-gratuitous, and
compatible? compatible?
New C files and Python files should have an unambiguous copyright New C files and Python files should have an unambiguous copyright
@ -91,14 +144,14 @@ Common things a reviewer will look for:
real name. It indicates the submitter agrees with the real name. It indicates the submitter agrees with the
[developer certificate of origin](developer-certificate-of-origin). [developer certificate of origin](developer-certificate-of-origin).
3. Does the submission follow guidelines specified in the Klipper 4. Does the submission follow guidelines specified in the Klipper
documentation? documentation?
In particular, code should follow the guidelines in In particular, code should follow the guidelines in
[Code_Overview.md](Code_Overview.md) and config files should follow [Code_Overview.md](Code_Overview.md) and config files should follow
the guidelines in [Example_Configs.md](Example_Configs.md). the guidelines in [Example_Configs.md](Example_Configs.md).
4. Is the Klipper documentation updated to reflect new changes? 5. Is the Klipper documentation updated to reflect new changes?
At a minimum, the reference documentation must be updated with At a minimum, the reference documentation must be updated with
corresponding changes to the code: corresponding changes to the code:
@ -118,7 +171,7 @@ Common things a reviewer will look for:
added to the website index added to the website index
[docs/_klipper3d/mkdocs.yml](../docs/_klipper3d/mkdocs.yml). [docs/_klipper3d/mkdocs.yml](../docs/_klipper3d/mkdocs.yml).
5. Are commits well formed, address a single topic per commit, and 6. Are commits well formed, address a single topic per commit, and
independent? independent?
Commit messages should follow the Commit messages should follow the
@ -140,61 +193,6 @@ Common things a reviewer will look for:
general, gratuitous whitespace changes are not accepted unless they general, gratuitous whitespace changes are not accepted unless they
are from the established "owner" of the code being modified. are from the established "owner" of the code being modified.
6. Does the submission provide a "high impact" benefit to real-world
users performing real-world tasks?
Reviewers need to identify, at least in their own minds, roughly
"who the target audience is", a rough scale of "the size of that
audience", the "benefit" they will obtain, how the "benefit is
measured", and the "results of those measurement tests". In most
cases this will be obvious to both the submitter and the reviewer,
and it is not explicitly stated during a review.
Submissions to the master Klipper branch are expected to have a
noteworthy target audience. As a general "rule of thumb",
submissions should target a user base of at least a 100 real-world
users.
If a reviewer asks for details on the "benefit" of a submission,
please don't consider it criticism. Being able to understand the
real-world benefits of a change is a natural part of a review.
When discussing benefits it is preferable to discuss "facts and
measurements" instead of "opinions and theories". In general,
reviewers are not looking for responses of the form "this
submission may improve quality because of ...", nor are they
looking for responses of the form "someone may find option X
useful", nor are they looking for responses of the form "this
submission adds a feature that firmware X implements". Instead, it
is generally preferable to discuss details on how the quality
improvement was measured and what were the results of those
measurements - for example, "tests on Acme X1000 printers show
improved corners as seen in picture ...", or for example "print
time of real-world object X on a Foomatic X900 printer went from 4
hours to 3.5 hours". It is understood that testing of this type can
take significant time and effort. Some of Klipper's most notable
features took years of discussion, rework, testing, and
documentation prior to being merged into the master branch.
All new modules, config options, commands, command parameters, and
documents should have "high impact". We do not want to burden users
with options that they can not reasonably configure nor do we want
to burden them with options that don't provide a notable benefit.
A reviewer may ask for clarification on how a user is to configure
an option - an ideal response will contain details on the process -
for example, "users of the MegaX500 are expected to set option X to
99.3 while users of the Elite100Y are expected to calibrate option
X using procedure ...".
If the goal of an option is to make the code more modular then
prefer using code constants instead of user facing config options.
New modules, new options, and new parameters should not provide
similar functionality to existing modules - if the differences are
arbitrary than it's preferable to utilize the existing system or
refactor the existing code.
Klipper does not implement a strict "coding style guide", but Klipper does not implement a strict "coding style guide", but
modifications to existing code should follow the high-level code flow, modifications to existing code should follow the high-level code flow,
code indentation style, and format of that existing code. Submissions code indentation style, and format of that existing code. Submissions
@ -301,15 +299,13 @@ contributions) and contain a current email address.
[Klipper-translations Project](https://github.com/Klipper3d/klipper-translations) [Klipper-translations Project](https://github.com/Klipper3d/klipper-translations)
is a project dedicated to translating Klipper to different languages. is a project dedicated to translating Klipper to different languages.
[Weblate](https://hosted.weblate.org/projects/klipper/) hosts all the [Weblate](https://hosted.weblate.org/projects/klipper/) hosts all the
Gettext strings for translating and reviewing. Locales can merge into Gettext strings for translating and reviewing. Locales can be displayed on
the Klipper project once they satisfy the following requirements: [klipper3d.org](https://www.klipper3d.org) once they satisfy the following requirements:
- [ ] 75% Total coverage - [ ] 75% Total coverage
- [ ] All titles (H1) are covered - [ ] All titles (H1) are translated
- [ ] An updated navigation hierarchy PR in klipper-translations. - [ ] An updated navigation hierarchy PR in klipper-translations.
The navigation hierarchy is in `docs\_klipper3d\mkdocs.yml`.
To reduce the frustration of translating domain-specific terms and To reduce the frustration of translating domain-specific terms and
gain awareness of the ongoing translations, you can submit a PR gain awareness of the ongoing translations, you can submit a PR
modifying the modifying the
@ -321,15 +317,15 @@ If a translation already exists in the Klipper repository and no
longer meets the checklist above, it will be marked out-of-date after longer meets the checklist above, it will be marked out-of-date after
a month without updates. a month without updates.
Please follow the following format for `mkdocs.yml` navigation Once the requirements are met, you need to:
hierarchy:
```yml 1. update klipper-tranlations repository
nav: [active_translations](https://github.com/Klipper3d/klipper-translations/blob/translations/active_translations)
- existing hierachy 2. Optional: add a manual-index.md file in klipper-translations repository's
- <language>: `docs\locals\<lang>` folder to replace the language specific index.md (generated
- locales/<language code>/md file index.md does not render correctly).
```
Note: Currently, there isn't a method for correctly translating Known Issues:
pictures in the documentation. 1. Currently, there isn't a method for correctly translating pictures in
the documentation
2. It is impossible to translate titles in mkdocs.yml.

View File

@ -58,9 +58,12 @@ functions are declared using the DECL_COMMAND() macro (see the
Task, init, and command functions always run with interrupts enabled Task, init, and command functions always run with interrupts enabled
(however, they can temporarily disable interrupts if needed). These (however, they can temporarily disable interrupts if needed). These
functions should never pause, delay, or do any work that lasts more functions should avoid long pauses, delays, or do work that lasts a
than a few micro-seconds. These functions schedule work at specific significant time. (Long delays in these "task" functions result in
times by scheduling timers. scheduling jitter for other "tasks" - delays over 100us may become
noticeable, delays over 500us may result in command retransmissions,
delays over 100ms may result in watchdog reboots.) These functions
schedule work at specific times by scheduling timers.
Timer functions are scheduled by calling sched_add_timer() (located in Timer functions are scheduled by calling sched_add_timer() (located in
**src/sched.c**). The scheduler code will arrange for the given **src/sched.c**). The scheduler code will arrange for the given

View File

@ -45,8 +45,7 @@ gcode:
SET_PIN PIN=my_led VALUE=0 SET_PIN PIN=my_led VALUE=0
``` ```
This will be showing is you use the `HELP` command or use the autocomplete The terminal will display the description when you use the `HELP` command or the autocomplete function.
function.
## Save/Restore state for G-Code moves ## Save/Restore state for G-Code moves
@ -95,7 +94,7 @@ gcode:
G90 G90
G0 Z15 F300 G0 Z15 F300
{% for wipe in range(wipe_count) %} {% for wipe in range(wipe_count) %}
{% for coordinate in [(275,4),(235,4)] %} {% for coordinate in [(275, 4),(235, 4)] %}
G0 X{coordinate[0]} Y{coordinate[1] + 0.25 * wipe} Z9.7 F12000 G0 X{coordinate[0]} Y{coordinate[1] + 0.25 * wipe} Z9.7 F12000
{% endfor %} {% endfor %}
{% endfor %} {% endfor %}

View File

@ -8,6 +8,55 @@ All dates in this document are approximate.
## Changes ## Changes
20220407: The temperature_fan `pid_integral_max` config option has
been removed (it was deprecated on 20210612).
20220407: The default color order for pca9632 LEDs is now "RGBW". Add
an explicit `color_order: RBGW` setting to the pca9632 config section
to obtain the previous behavior.
20220330: The format of the `printer.neopixel.color_data` status
information for neopixel and dotstar modules has changed. The
information is now stored as a list of color lists (instead of a list
of dictionaries). See the [status reference](Status_Reference.md#led)
for details.
20220307: `M73` will no longer set print progress to 0 if `P` is missing.
20220304: There is no longer a default for the `extruder` parameter of
[extruder_stepper](Config_Reference.md#extruder_stepper) config
sections. If desired, specify `extruder: extruder` explicitly to
associate the stepper motor with the "extruder" motion queue at
startup.
20220210: The `SYNC_STEPPER_TO_EXTRUDER` command is deprecated; the
`SET_EXTRUDER_STEP_DISTANCE` command is deprecated; the
[extruder](Config_Reference.md#extruder) `shared_heater` config option
is deprecated. These features will be removed in the near future.
Replace `SET_EXTRUDER_STEP_DISTANCE` with
`SET_EXTRUDER_ROTATION_DISTANCE`. Replace `SYNC_STEPPER_TO_EXTRUDER`
with `SYNC_EXTRUDER_MOTION`. Replace extruder config sections using
`shared_heater` with
[extruder_stepper](Config_Reference.md#extruder_stepper) config
sections and update any activation macros to use
[SYNC_EXTRUDER_MOTION](G-Codes.md#sync_extruder_motion).
20220116: The tmc2130, tmc2208, tmc2209, and tmc2660 `run_current`
calculation code has changed. For some `run_current` settings the
drivers may now be configured differently. This new configuration
should be more accurate, but it may invalidate previous tmc driver
tuning.
20211230: Scripts to tune input shaper (`scripts/calibrate_shaper.py`
and `scripts/graph_accelerometer.py`) were migrated to use Python3
by default. As a result, users must install Python3 versions of certain
packages (e.g. `sudo apt install python3-numpy python3-matplotlib`) to
continue using these scripts. For more details, refer to
[Software installation](Measuring_Resonances.md#software-installation).
Alternatively, users can temporarily force the execution of these scripts
under Python 2 by explicitly calling Python2 interpretor in the console:
`python2 ~/klipper/scripts/calibrate_shaper.py ...`
20211110: The "NTC 100K beta 3950" temperature sensor is deprecated. 20211110: The "NTC 100K beta 3950" temperature sensor is deprecated.
This sensor will be removed in the near future. Most users will find This sensor will be removed in the near future. Most users will find
the "Generic 3950" temperature sensor more accurate. To continue to the "Generic 3950" temperature sensor more accurate. To continue to

File diff suppressed because it is too large Load Diff

View File

@ -132,10 +132,10 @@ troubleshooting tips in the previous section to confirm the
Klipper supports Klipper supports
[PID control](https://en.wikipedia.org/wiki/PID_controller) for the [PID control](https://en.wikipedia.org/wiki/PID_controller) for the
extruder and bed heaters. In order to use this control mechanism it is extruder and bed heaters. In order to use this control mechanism, it is
necessary to calibrate the PID settings on each printer. (PID settings necessary to calibrate the PID settings on each printer (PID settings
found in other firmwares or in the example configuration files often found in other firmwares or in the example configuration files often
work poorly.) work poorly).
To calibrate the extruder, navigate to the OctoPrint terminal tab and To calibrate the extruder, navigate to the OctoPrint terminal tab and
run the PID_CALIBRATE command. For example: `PID_CALIBRATE run the PID_CALIBRATE command. For example: `PID_CALIBRATE

View File

@ -202,20 +202,33 @@ run this on a desktop class machine (not a Raspberry Pi) as it does
require significant cpu to run efficiently. require significant cpu to run efficiently.
To use simulavr, download the simulavr package and compile with python To use simulavr, download the simulavr package and compile with python
support: support. Note that the build system may need to have some packages (such as
swig) installed in order to build the python module.
``` ```
git clone git://git.savannah.nongnu.org/simulavr.git git clone git://git.savannah.nongnu.org/simulavr.git
cd simulavr cd simulavr
./bootstrap make python
./configure --enable-python make build
make
``` ```
Make sure a file like **./build/pysimulavr/_pysimulavr.*.so** is present
after the above compilation:
```
ls ./build/pysimulavr/_pysimulavr.*.so
```
This commmand should report a specific file (e.g.
**./build/pysimulavr/_pysimulavr.cpython-39-x86_64-linux-gnu.so**) and
not an error.
Note that the build system may need to have some packages (such as If you are on a Debian-based system (Debian, Ubuntu, etc.) you can
swig) installed in order to build the python module. Make sure the install the following packages and generate *.deb files for system-wide
file **src/python/_pysimulavr.so** is present after the above installation of simulavr:
compilation. ```
sudo apt update
sudo apt install g++ make cmake swig rst2pdf help2man texinfo
make cfgclean python debian
sudo dpkg -i build/debian/python3-simulavr*.deb
```
To compile Klipper for use in simulavr, run: To compile Klipper for use in simulavr, run:
@ -229,7 +242,12 @@ select SIMULAVR software emulation support. Then one can compile
Klipper (run `make`) and then start the simulation with: Klipper (run `make`) and then start the simulation with:
``` ```
PYTHONPATH=/path/to/simulavr/src/python/ ./scripts/avrsim.py out/klipper.elf PYTHONPATH=/path/to/simulavr/build/pysimulavr/ ./scripts/avrsim.py out/klipper.elf
```
Note that if you have installed python3-simulavr system-wide, you do
not need to set `PYTHONPATH`, and can simply run the simulator as
```
./scripts/avrsim.py out/klipper.elf
``` ```
Then, with simulavr running in another window, one can run the Then, with simulavr running in another window, one can run the

View File

@ -97,7 +97,11 @@ measuring parts of that test object with digital calipers.
Prior to running an enhanced delta calibration one must run the basic Prior to running an enhanced delta calibration one must run the basic
delta calibration (via the DELTA_CALIBRATE command) and save the delta calibration (via the DELTA_CALIBRATE command) and save the
results (via the SAVE_CONFIG command). results (via the SAVE_CONFIG command). Make sure there hasn't been any
notable change to the printer configuration nor hardware since last
performing a basic delta calibration (if unsure, rerun the
[basic delta calibration](#basic-delta-calibration), including
SAVE_CONFIG, just prior to printing the test object described below.)
Use a slicer to generate G-Code from the Use a slicer to generate G-Code from the
[docs/prints/calibrate_size.stl](prints/calibrate_size.stl) file. [docs/prints/calibrate_size.stl](prints/calibrate_size.stl) file.

View File

@ -10,7 +10,7 @@ is also a useful resource for finding and sharing config files.
## Guidelines ## Guidelines
1. Select the appropriate config filename prefix. 1. Select the appropriate config filename prefix:
1. The `printer` prefix is used for stock printers sold by a 1. The `printer` prefix is used for stock printers sold by a
mainstream manufacturer. mainstream manufacturer.
2. The `generic` prefix is used for a 3d printer board that may be 2. The `generic` prefix is used for a 3d printer board that may be
@ -24,17 +24,20 @@ is also a useful resource for finding and sharing config files.
5. The `example` prefix is used to describe printer kinematics. 5. The `example` prefix is used to describe printer kinematics.
This type of config is typically only added along with code for This type of config is typically only added along with code for
a new type of printer kinematics. a new type of printer kinematics.
2. Use the appropriate filename suffix. The `printer` config files 2. All configuration files must end in a `.cfg` suffix. The `printer`
must end in a year followed by `.cfg` (eg, `-2019.cfg`). In this config files must end in a year followed by `.cfg` (eg,
case, the year is an approximate year the given printer was `-2019.cfg`). In this case, the year is an approximate year the
sold. All example configuration files must end in `.cfg`. given printer was sold.
3. Klipper must be able to start `printer`, `generic`, and `kit` 3. Do not use spaces or special characters in the config filename. The
filename should contain only characters `A-Z`, `a-z`, `0-9`, `-`,
and `.`.
4. Klipper must be able to start `printer`, `generic`, and `kit`
example config file without error. These config files should be example config file without error. These config files should be
added to the added to the
[test/klippy/printers.test](../test/klippy/printers.test) [test/klippy/printers.test](../test/klippy/printers.test)
regression test case. Add new config files to that test case in the regression test case. Add new config files to that test case in the
appropriate section and in alphabetical order within that section. appropriate section and in alphabetical order within that section.
4. The example configuration should be for the "stock" configuration 5. The example configuration should be for the "stock" configuration
of the printer. (There are too many "customized" configurations to of the printer. (There are too many "customized" configurations to
track in the main Klipper repository.) Similarly, we only add track in the main Klipper repository.) Similarly, we only add
example config files for printers, kits, and boards that have example config files for printers, kits, and boards that have
@ -42,7 +45,7 @@ is also a useful resource for finding and sharing config files.
in active use). Consider using the in active use). Consider using the
[Klipper Community Discourse server](https://community.klipper3d.org) [Klipper Community Discourse server](https://community.klipper3d.org)
for other configs. for other configs.
5. Only specify those devices present on the given printer or board. 6. Only specify those devices present on the given printer or board.
Do not specify settings specific to your particular setup. Do not specify settings specific to your particular setup.
1. For `generic` config files, only those devices on the mainboard 1. For `generic` config files, only those devices on the mainboard
should be described. For example, it would not make sense to add should be described. For example, it would not make sense to add
@ -61,7 +64,7 @@ is also a useful resource for finding and sharing config files.
4. Only define macros that utilize functionality specific to the 4. Only define macros that utilize functionality specific to the
given printer or to define g-codes that are commonly emitted by given printer or to define g-codes that are commonly emitted by
slicers configured for the given printer. slicers configured for the given printer.
6. Where possible, it is best to use the same wording, phrasing, 7. Where possible, it is best to use the same wording, phrasing,
indentation, and section ordering as the existing config files. indentation, and section ordering as the existing config files.
1. The top of each config file should list the type of 1. The top of each config file should list the type of
micro-controller the user should select during "make micro-controller the user should select during "make
@ -82,7 +85,9 @@ is also a useful resource for finding and sharing config files.
extruder - it is normally in the range of 20 to 35mm. When extruder - it is normally in the range of 20 to 35mm. When
specifying a `gear_ratio` it is preferable to specify the actual specifying a `gear_ratio` it is preferable to specify the actual
gears on the mechanism (eg, prefer `gear_ratio: 80:20` over gears on the mechanism (eg, prefer `gear_ratio: 80:20` over
`gear_ratio: 4:1`). `gear_ratio: 4:1`). See the
[rotation distance document](Rotation_Distance.md#using-a-gear_ratio)
for more information.
6. Avoid defining field values that are set to their default 6. Avoid defining field values that are set to their default
value. For example, one should not specify `min_extrude_temp: value. For example, one should not specify `min_extrude_temp:
170` as that is already the default value. 170` as that is already the default value.
@ -91,13 +96,14 @@ is also a useful resource for finding and sharing config files.
files. (For example, avoid adding lines like "this file was files. (For example, avoid adding lines like "this file was
created by ...".) Place attribution and change history in the created by ...".) Place attribution and change history in the
git commit message. git commit message.
7. Do not use any deprecated features in the example config file. The 8. Do not use any deprecated features in the example config file.
`step_distance` and `pin_map` parameters are deprecated and should 9. Do not disable a default safety system in an example config file.
not be in any example config file.
8. Do not disable a default safety system in an example config file.
For example, a config should not specify a custom For example, a config should not specify a custom
`max_extrude_cross_section`. Do not enable debugging features. For `max_extrude_cross_section`. Do not enable debugging features. For
example there should not be a `force_move` config section. example there should not be a `force_move` config section.
10. All known boards that Klipper supports can use the default serial
baud rate of 250000. Do not recommend a different baud rate in an
example config file.
Example config files are submitted by creating a github "pull Example config files are submitted by creating a github "pull
request". Please also follow the directions in the request". Please also follow the directions in the

View File

@ -15,7 +15,7 @@
13. [My TMC motor driver turns off in the middle of a print](#my-tmc-motor-driver-turns-off-in-the-middle-of-a-print) 13. [My TMC motor driver turns off in the middle of a print](#my-tmc-motor-driver-turns-off-in-the-middle-of-a-print)
14. [I keep getting random "Lost communication with MCU" errors](#i-keep-getting-random-lost-communication-with-mcu-errors) 14. [I keep getting random "Lost communication with MCU" errors](#i-keep-getting-random-lost-communication-with-mcu-errors)
15. [My Raspberry Pi keeps rebooting during prints](#my-raspberry-pi-keeps-rebooting-during-prints) 15. [My Raspberry Pi keeps rebooting during prints](#my-raspberry-pi-keeps-rebooting-during-prints)
16. [When I set "restart_method=command" my AVR device just hangs on a restart](#when-i-set-restart_methodcommand-my-avr-device-just-hangs-on-a-restart) 16. [When I set `restart_method=command` my AVR device just hangs on a restart](#when-i-set-restart_methodcommand-my-avr-device-just-hangs-on-a-restart)
17. [Will the heaters be left on if the Raspberry Pi crashes?](#will-the-heaters-be-left-on-if-the-raspberry-pi-crashes) 17. [Will the heaters be left on if the Raspberry Pi crashes?](#will-the-heaters-be-left-on-if-the-raspberry-pi-crashes)
18. [How do I convert a Marlin pin number to a Klipper pin name?](#how-do-i-convert-a-marlin-pin-number-to-a-klipper-pin-name) 18. [How do I convert a Marlin pin number to a Klipper pin name?](#how-do-i-convert-a-marlin-pin-number-to-a-klipper-pin-name)
19. [Do I have to wire my device to a specific type of micro-controller pin?](#do-i-have-to-wire-my-device-to-a-specific-type-of-micro-controller-pin) 19. [Do I have to wire my device to a specific type of micro-controller pin?](#do-i-have-to-wire-my-device-to-a-specific-type-of-micro-controller-pin)
@ -293,7 +293,7 @@ troubleshooting steps for a
["Lost communication with MCU"](#i-keep-getting-random-lost-communication-with-mcu-errors) ["Lost communication with MCU"](#i-keep-getting-random-lost-communication-with-mcu-errors)
error. error.
## When I set "restart_method=command" my AVR device just hangs on a restart ## When I set `restart_method=command` my AVR device just hangs on a restart
Some old versions of the AVR bootloader have a known bug in watchdog Some old versions of the AVR bootloader have a known bug in watchdog
event handling. This typically manifests when the printer.cfg file has event handling. This typically manifests when the printer.cfg file has

View File

@ -161,19 +161,24 @@ represent total number of steps per second on the micro-controller.
| ------------------------------- | ----------------- | ----------------- | | ------------------------------- | ----------------- | ----------------- |
| 16Mhz AVR | 157K | 99K | | 16Mhz AVR | 157K | 99K |
| 20Mhz AVR | 196K | 123K | | 20Mhz AVR | 196K | 123K |
| Arduino Zero (SAMD21) | 686K | 471K | | SAMD21 | 686K | 471K |
| STM32F042 | 814K | 578K | | STM32F042 | 814K | 578K |
| Beaglebone PRU | 866K | 708K | | Beaglebone PRU | 866K | 708K |
| "Blue Pill" (STM32F103) | 1180K | 818K | | STM32G0B1 | 1103K | 790K |
| Arduino Due (SAM3X8E) | 1273K | 981K | | STM32F103 | 1180K | 818K |
| Duet2 Maestro (SAM4S8C) | 1690K | 1385K | | SAM3X8E | 1273K | 981K |
| Smoothieboard (LPC1768) | 1923K | 1351K | | SAM4S8C | 1690K | 1385K |
| Smoothieboard (LPC1769) | 2353K | 1622K | | LPC1768 | 1923K | 1351K |
| Raspberry Pi Pico (RP2040) | 2400K | 1636K | | LPC1769 | 2353K | 1622K |
| Duet2 Wifi/Eth (SAM4E8E) | 2500K | 1674K | | RP2040 | 2400K | 1636K |
| Adafruit Metro M4 (SAMD51) | 3077K | 1885K | | SAM4E8E | 2500K | 1674K |
| BigTreeTech SKR Pro (STM32F407) | 3652K | 2459K | | SAMD51 | 3077K | 1885K |
| Fysetc Spider (STM32F446) | 3913K | 2634K | | STM32F407 | 3652K | 2459K |
| STM32F446 | 3913K | 2634K |
If unsure of the micro-controller on a particular board, find the
appropriate [config file](../config/), and look for the
micro-controller name in the comments at the top of that file.
Further details on the benchmarks are available in the Further details on the benchmarks are available in the
[Benchmarks document](Benchmarks.md). [Benchmarks document](Benchmarks.md).

File diff suppressed because it is too large Load Diff

View File

@ -1,100 +1,26 @@
# Hall filament width sensor # Hall filament width sensor
This document describes Filament Width Sensor host module. Hardware used for developing this host module is based on Two Hall liniar sensors (ss49e for example). Sensors in the body are located opposite sides. Principle of operation : two hall sensors work in differential mode, temperature drift same for sensor. Special temperature compensation not needed. You can find designs at [Thingiverse](https://www.thingiverse.com/thing:4138933) This document describes Filament Width Sensor host module. Hardware used for
developing this host module is based on two Hall linear sensors (ss49e for
example). Sensors in the body are located opposite sides. Principle of operation:
two hall sensors work in differential mode, temperature drift same for sensor.
Special temperature compensation not needed.
You can find designs at [Thingiverse](https://www.thingiverse.com/thing:4138933),
an assembly video is also available on [Youtube](https://www.youtube.com/watch?v=TDO9tME8vp4)
To use Hall filament width sensor, read
[Config Reference](Config_Reference.md#hall_filament_width_sensor) and
[G-Code documentation](G-Codes.md#hall_filament_width_sensor).
[Hall based filament width sensor assembly video](https://www.youtube.com/watch?v=TDO9tME8vp4)
## How does it work? ## How does it work?
Sensor generates two analog output based on calculated filament width. Sum of output voltage always equals to detected filament width . Host module monitors voltage changes and adjusts extrusion multiplier. I use aux2 connector on ramps-like board analog11 and analog12 pins. You can use different pins and differenr boards Sensor generates two analog output based on calculated filament width. Sum of
output voltage always equals to detected filament width. Host module monitors
## Configuration voltage changes and adjusts extrusion multiplier. I use aux2 connector on
ramps-like board analog11 and analog12 pins. You can use different pins and
``` differenr boards.
[hall_filament_width_sensor]
adc1: analog11
adc2: analog12
# adc1 and adc2 channels select own pins Analog input pins on 3d printer board
# Sensor power supply can be 3.3v or 5v
Cal_dia1: 1.50 # Reference diameter point 1 (mm)
Cal_dia2: 2.00 # Reference diameter point 2 (mm)
# The measurement principle provides for two-point calibration
# In calibration process you must use rods of known diameter
# I use drill rods as the base diameter.
# nominal filament diameter must be between Cal_dia1 and Cal_dia2
# Your size may differ from the indicated ones, for example 2.05
Raw_dia1:10630 # Raw sensor value for reference point 1
Raw_dia2:8300 # Raw sensor value for reference point 2
# Raw value of sensor in units
# can be readed by command QUERY_RAW_FILAMENT_WIDTH
default_nominal_filament_diameter: 1.75 # This parameter is in millimeters (mm)
max_difference: 0.15
# Maximum allowed filament diameter difference in millimeters (mm)
# If difference between nominal filament diameter and sensor output is more
# than +- max_difference, extrusion multiplier set back to %100
measurement_delay: 70
# The distance from sensor to the melting chamber/hot-end in millimeters (mm).
# The filament between the sensor and the hot-end will be treated as the default_nominal_filament_diameter.
# Host module works with FIFO logic. It keeps each sensor value and position in
# an array and POP them back in correct position.
#enable:False
# Sensor enabled or disabled after power on. Disabled by default
# measurement_interval:10
# Sensor readings done with 10 mm intervals by default. If necessary you are free to change this setting
#logging: False
# Out diameter to terminal and klipper.log
# can be turn on|of by command
#Virtual filament_switch_sensor suppurt. Create sensor named hall_filament_width_sensor.
#
#min_diameter:1.0
#Minimal diameter for trigger virtual filament_switch_sensor.
#use_current_dia_while_delay: False
# Use the current diameter instead of the nominal diamenter while the measurement delay has not run through.
#
#Values from filament_switch_sensor. See the "filament_switch_sensor" section for information on these parameters.
#
#pause_on_runout: True
#runout_gcode:
#insert_gcode:
#event_delay: 3.0
#pause_delay: 0.5
```
## G-Code Commands
**QUERY_FILAMENT_WIDTH** - Return the current measured filament width as result
**RESET_FILAMENT_WIDTH_SENSOR** - Clear all sensor readings. Can be used after filament change.
**DISABLE_FILAMENT_WIDTH_SENSOR** - Turn off the filament width sensor and stop using it to do flow control
**ENABLE_FILAMENT_WIDTH_SENSOR** - Turn on the filament width sensor and start using it to do flow control
**QUERY_RAW_FILAMENT_WIDTH** Return the current ADC channel values and RAW sensor value for calibration points
**ENABLE_FILAMENT_WIDTH_LOG** - Turn on diameter logging
**DISABLE_FILAMENT_WIDTH_LOG** - Turn off diameter logging
## Menu variables
**hall_filament_width_sensor.Diameter** current measured filament width in mm
**hall_filament_width_sensor.Raw** current raw measured filament width in units
**hall_filament_width_sensor.is_active** Sensor on or off
## Template for menu variables ## Template for menu variables
@ -114,7 +40,8 @@ index: 1
## Calibration procedure ## Calibration procedure
To get raw sensor value you can use menu item or **QUERY_RAW_FILAMENT_WIDTH** command in terminal To get raw sensor value you can use menu item or **QUERY_RAW_FILAMENT_WIDTH**
command in terminal.
1. Insert first calibration rod (1.5 mm size) get first raw sensor value 1. Insert first calibration rod (1.5 mm size) get first raw sensor value
@ -126,12 +53,15 @@ To get raw sensor value you can use menu item or **QUERY_RAW_FILAMENT_WIDTH** co
By default, the sensor is disabled at power-on. By default, the sensor is disabled at power-on.
To enable the sensor, issue **ENABLE_FILAMENT_WIDTH_SENSOR** command or set the `enable` parameter to `true.` To enable the sensor, issue **ENABLE_FILAMENT_WIDTH_SENSOR** command or
set the `enable` parameter to `true`.
## Logging ## Logging
By default, diameter logging is disabled at power-on. By default, diameter logging is disabled at power-on.
Issue **ENABLE_FILAMENT_WIDTH_LOG** command to start logging and issue **DISABLE_FILAMENT_WIDTH_LOG** command to stop logging. To enable logging at power-on, set the `logging` parameter to `true`. Issue **ENABLE_FILAMENT_WIDTH_LOG** command to start logging and issue
**DISABLE_FILAMENT_WIDTH_LOG** command to stop logging. To enable logging
at power-on, set the `logging` parameter to `true`.
Filament diameter is logged on every measurement interval (10 mm by default). Filament diameter is logged on every measurement interval (10 mm by default).

View File

@ -6,10 +6,34 @@ Raspberry Pi 2, 3, or 4 computer be used as the host machine (see the
[FAQ](FAQ.md#can-i-run-klipper-on-something-other-than-a-raspberry-pi-3) [FAQ](FAQ.md#can-i-run-klipper-on-something-other-than-a-raspberry-pi-3)
for other machines). for other machines).
Klipper currently supports a number of Atmel ATmega based ## Obtain a Klipper Configuration File
micro-controllers,
[ARM based micro-controllers](Features.md#step-benchmarks), and Most Klipper settings are determined by a "printer configuration file"
[Beaglebone PRU](Beaglebone.md) based printers. that will be stored on the Raspberry Pi. An appropriate configuration
file can often be found by looking in the Klipper
[config directory](../config/) for a file starting with a "printer-"
prefix that corresponds to the target printer. The Klipper
configuration file contains technical information about the printer
that will be needed during the installation.
If there isn't an appropriate printer configuration file in the
Klipper config directory then try searching the printer manufacturer's
website to see if they have an appropriate Klipper configuration file.
If no configuration file for the printer can be found, but the type of
printer control board is known, then look for an appropriate
[config file](../config/) starting with a "generic-" prefix. These
example printer board files should allow one to successfully complete
the initial installation, but will require some customization to
obtain full printer functionality.
It is also possible to define a new printer configuration from
scratch. However, this requires significant technical knowledge about
the printer and its electronics. It is recommended that most users
start with an appropriate configuration file. If creating a new custom
printer configuration file, then start with the closest example
[config file](../config/) and use the Klipper
[config reference](Config_Reference.md) for further information.
## Prepping an OS image ## Prepping an OS image
@ -49,16 +73,27 @@ cd ~/klipper/
make menuconfig make menuconfig
``` ```
Select the appropriate micro-controller and review any other options The comments at the top of the
provided. Once configured, run: [printer configuration file](#obtain-a-klipper-configuration-file)
should describe the settings that need to be set during "make
menuconfig". Open the file in a web browser or text editor and look
for these instructions near the top of the file. Once the appropriate
"menuconfig" settings have been configured, press "Q" to exit, and
then "Y" to save. Then run:
``` ```
make make
``` ```
It is necessary to determine the serial port connected to the If the comments at the top of the
micro-controller. For micro-controllers that connect via USB, run the [printer configuration file](#obtain-a-klipper-configuration-file)
following: describe custom steps for "flashing" the final image to the printer
control board then follow those steps and then proceed to
[configuring OctoPrint](#configuring-octoprint-to-use-klipper).
Otherwise, the following steps are often used to "flash" the printer
control board. First, it is necessary to determine the serial port
connected to the micro-controller. Run the following:
``` ```
ls /dev/serial/by-id/* ls /dev/serial/by-id/*
@ -122,36 +157,43 @@ Klipper. Proceed to the next section.
## Configuring Klipper ## Configuring Klipper
The Klipper configuration is stored in a text file on the Raspberry The next step is to copy the
Pi. Take a look at the example config files in the [printer configuration file](#obtain-a-klipper-configuration-file) to
[config directory](../config/). The the Raspberry Pi.
[Config Reference](Config_Reference.md) contains documentation on
config parameters.
Arguably the easiest way to update the Klipper configuration file is Arguably the easiest way to set the Klipper configuration file is to
to use a desktop editor that supports editing files over the "scp" use a desktop editor that supports editing files over the "scp" and/or
and/or "sftp" protocols. There are freely available tools that support "sftp" protocols. There are freely available tools that support this
this (eg, Notepad++, WinSCP, and Cyberduck). Use one of the example (eg, Notepad++, WinSCP, and Cyberduck). Load the printer config file
config files as a starting point and save it as a file named in the editor and then save it as a file named "printer.cfg" in the
"printer.cfg" in the home directory of the pi user (ie, home directory of the pi user (ie, /home/pi/printer.cfg).
/home/pi/printer.cfg).
Alternatively, one can also copy and edit the file directly on the Alternatively, one can also copy and edit the file directly on the
Raspberry Pi via ssh - for example: Raspberry Pi via ssh. That may look something like the following (be
sure to update the command to use the appropriate printer config
filename):
``` ```
cp ~/klipper/config/example-cartesian.cfg ~/printer.cfg cp ~/klipper/config/example-cartesian.cfg ~/printer.cfg
nano ~/printer.cfg nano ~/printer.cfg
``` ```
Make sure to review and update each setting that is appropriate for
the hardware.
It's common for each printer to have its own unique name for the It's common for each printer to have its own unique name for the
micro-controller. The name may change after flashing Klipper, so rerun micro-controller. The name may change after flashing Klipper, so rerun
the `ls /dev/serial/by-id/*` command and then update the config file these steps again even if they were already done when flashing. Run:
with the unique name. For example, update the `[mcu]` section to look
something similar to: ```
ls /dev/serial/by-id/*
```
It should report something similar to the following:
```
/dev/serial/by-id/usb-1a86_USB2.0-Serial-if00-port0
```
Then update the config file with the unique name. For example, update
the `[mcu]` section to look something similar to:
``` ```
[mcu] [mcu]
@ -162,26 +204,19 @@ After creating and editing the file it will be necessary to issue a
"restart" command in the OctoPrint web terminal to load the config. A "restart" command in the OctoPrint web terminal to load the config. A
"status" command will report the printer is ready if the Klipper "status" command will report the printer is ready if the Klipper
config file is successfully read and the micro-controller is config file is successfully read and the micro-controller is
successfully found and configured. It is not unusual to have successfully found and configured.
configuration errors during the initial setup - update the printer
config file and issue "restart" until "status" reports the printer is When customizing the printer config file, it is not uncommon for
ready. Klipper to report a configuration error. If an error occurs, make any
necessary corrections to the printer config file and issue "restart"
until "status" reports the printer is ready.
Klipper reports error messages via the OctoPrint terminal tab. The Klipper reports error messages via the OctoPrint terminal tab. The
"status" command can be used to re-report error messages. The default "status" command can be used to re-report error messages. The default
Klipper startup script also places a log in **/tmp/klippy.log** which Klipper startup script also places a log in **/tmp/klippy.log** which
provides more detailed information. provides more detailed information.
In addition to common g-code commands, Klipper supports a few extended After Klipper reports that the printer is ready, proceed to the
commands - "status" and "restart" are examples of these commands. Use
the "help" command to get a list of other extended commands.
After Klipper reports that the printer is ready go on to the
[config check document](Config_checks.md) to perform some basic checks [config check document](Config_checks.md) to perform some basic checks
on the pin definitions in the config file. on the definitions in the config file. See the main
[documentation reference](Overview.md) for other information.
## Contacting the developers
Be sure to see the [FAQ](FAQ.md) for answers to some common questions.
See the [contact page](Contact.md) to report a bug or to contact the
developers.

View File

@ -63,9 +63,9 @@ This is done by creating a `[bed_screws]` config section. For example,
it might look something similar to: it might look something similar to:
``` ```
[bed_screws] [bed_screws]
screw1: 100,50 screw1: 100, 50
screw2: 100,150 screw2: 100, 150
screw3: 150,100 screw3: 150, 100
``` ```
If a bed screw is under the bed, then specify the XY position directly If a bed screw is under the bed, then specify the XY position directly
@ -79,8 +79,8 @@ then one can start the tool by running:
BED_SCREWS_ADJUST BED_SCREWS_ADJUST
``` ```
This tool will move the printer's nozzle to each screw XY location and This tool will move the printer's nozzle to each screw XY location
then move the nozzle to a Z=0 height. At this point one can use the and then move the nozzle to a Z=0 height. At this point one can use the
"paper test" to adjust the bed screw directly under the nozzle. See "paper test" to adjust the bed screw directly under the nozzle. See
the information described in the information described in
["the paper test"](Bed_Level.md#the-paper-test), but adjust the bed ["the paper test"](Bed_Level.md#the-paper-test), but adjust the bed
@ -126,12 +126,12 @@ coordinates and add them to the config file. For example, it might
look like: look like:
``` ```
[bed_screws] [bed_screws]
screw1: 100,50 screw1: 100, 50
screw1_fine_adjust: 0,0 screw1_fine_adjust: 0, 0
screw2: 100,150 screw2: 100, 150
screw2_fine_adjust: 300,300 screw2_fine_adjust: 300, 300
screw3: 150,100 screw3: 150, 100
screw3_fine_adjust: 0,100 screw3_fine_adjust: 0, 100
``` ```
When this feature is enabled, the `BED_SCREWS_ADJUST` tool will first When this feature is enabled, the `BED_SCREWS_ADJUST` tool will first
@ -151,13 +151,13 @@ config file. For example, it might look like:
``` ```
[screws_tilt_adjust] [screws_tilt_adjust]
screw1: -5,30 screw1: -5, 30
screw1_name: front left screw screw1_name: front left screw
screw2: 155,30 screw2: 155, 30
screw2_name: front right screw screw2_name: front right screw
screw3: 155,190 screw3: 155, 190
screw3_name: rear right screw screw3_name: rear right screw
screw4: -5,190 screw4: -5, 190
screw4_name: rear left screw screw4_name: rear left screw
horizontal_move_z: 10. horizontal_move_z: 10.
speed: 50. speed: 50.
@ -179,12 +179,15 @@ Recv: // rear right screw : y=155.0, y=190.0, z=2.71500 : adjust CCW 00:50
Recv: // read left screw : x=-5.0, y=190.0, z=2.47250 : adjust CW 00:02 Recv: // read left screw : x=-5.0, y=190.0, z=2.47250 : adjust CW 00:02
Recv: ok Recv: ok
``` ```
This means that:
This means that:
- front left screw is the reference point you must not change it. - front left screw is the reference point you must not change it.
- front right screw must be turned clockwise 1 full turn and a quarter turn - front right screw must be turned clockwise 1 full turn and a quarter turn
- rear right screw must be turned counter-clockwise 50 minutes - rear right screw must be turned counter-clockwise 50 minutes
- read left screw must be turned clockwise 2 minutes (not need it's ok) - rear left screw must be turned clockwise 2 minutes (not need it's ok)
Note that "minutes" refers to "minutes of a clock face". So, for
example, 15 minutes is a quarter of a full turn.
Repeat the process several times until you get a good level bed - Repeat the process several times until you get a good level bed -
normally when all adjustments are below 6 minutes. normally when all adjustments are below 6 minutes.

View File

@ -77,7 +77,7 @@ too little RAM, the installation may fail and you will need to enable swap.
Next, run the following commands to install the additional dependencies: Next, run the following commands to install the additional dependencies:
``` ```
sudo apt update sudo apt update
sudo apt install python-numpy python-matplotlib sudo apt install python3-numpy python3-matplotlib
``` ```
Afterwards, check and follow the instructions in the Afterwards, check and follow the instructions in the
@ -98,7 +98,7 @@ cs_pin: rpi:None
[resonance_tester] [resonance_tester]
accel_chip: adxl345 accel_chip: adxl345
probe_points: probe_points:
100,100,20 # an example 100, 100, 20 # an example
``` ```
It is advised to start with 1 probe point, in the middle of the print bed, It is advised to start with 1 probe point, in the middle of the print bed,
slightly above it. slightly above it.
@ -163,7 +163,7 @@ TEST_RESONANCES AXIS=Y
``` ```
This will generate 2 CSV files (`/tmp/resonances_x_*.csv` and This will generate 2 CSV files (`/tmp/resonances_x_*.csv` and
`/tmp/resonances_y_*.csv`). These files can be processed with the stand-alone `/tmp/resonances_y_*.csv`). These files can be processed with the stand-alone
script on a Raspberry Pi. To do that, run running the following commands: script on a Raspberry Pi. To do that, run the following commands:
``` ```
~/klipper/scripts/calibrate_shaper.py /tmp/resonances_x_*.csv -o /tmp/shaper_calibrate_x.png ~/klipper/scripts/calibrate_shaper.py /tmp/resonances_x_*.csv -o /tmp/shaper_calibrate_x.png
~/klipper/scripts/calibrate_shaper.py /tmp/resonances_y_*.csv -o /tmp/shaper_calibrate_y.png ~/klipper/scripts/calibrate_shaper.py /tmp/resonances_y_*.csv -o /tmp/shaper_calibrate_y.png
@ -473,10 +473,11 @@ ignoring any errors for `SET_INPUT_SHAPER` command. For `TEST_RESONANCES`
command, specify the desired test axis. The raw data will be written into command, specify the desired test axis. The raw data will be written into
`/tmp` directory on the RPi. `/tmp` directory on the RPi.
The raw data can also be obtained by running the command `ACCELEROMETER_MEASURE` The raw data can also be obtained by running the command
command twice during some normal printer activity - first to start the `ACCELEROMETER_MEASURE` command twice during some normal printer
measurements, and then to stop them and write the output file. Refer to activity - first to start the measurements, and then to stop them and
[G-Codes](G-Codes.md#adxl345-accelerometer-commands) for more details. write the output file. Refer to [G-Codes](G-Codes.md#adxl345) for more
details.
The data can be processed later by the following scripts: The data can be processed later by the following scripts:
`scripts/graph_accelerometer.py` and `scripts/calibrate_shaper.py`. Both `scripts/graph_accelerometer.py` and `scripts/calibrate_shaper.py`. Both

View File

@ -1,6 +1,6 @@
# Probe calibration # Probe calibration
This document describes the method for calibrating the x, y, and z This document describes the method for calibrating the X, Y, and Z
offsets of an "automatic z probe" in Klipper. This is useful for users offsets of an "automatic z probe" in Klipper. This is useful for users
that have a `[probe]` or `[bltouch]` section in their config file. that have a `[probe]` or `[bltouch]` section in their config file.
@ -129,12 +129,12 @@ typical bed leveling procedures. It may be possible to tune the probe
speed and/or probe start height to improve the repeatability of the speed and/or probe start height to improve the repeatability of the
probe. The `PROBE_ACCURACY` command allows one to run tests with probe. The `PROBE_ACCURACY` command allows one to run tests with
different parameters to see their impact - see the different parameters to see their impact - see the
[G-Codes document](G-Codes.md) for further details. If the probe [G-Codes document](G-Codes.md#probe_accuracy) for further details. If
generally obtains repeatable results but has an occasional outlier, the probe generally obtains repeatable results but has an occasional
then it may be possible to account for that by using multiple samples outlier, then it may be possible to account for that by using multiple
on each probe - read the description of the probe `samples` config samples on each probe - read the description of the probe `samples`
parameters in the [config reference](Config_Reference.md#probe) for config parameters in the [config reference](Config_Reference.md#probe)
more details. for more details.
If new probe speed, samples count, or other settings are needed, then If new probe speed, samples count, or other settings are needed, then
update the printer.cfg file and issue a `RESTART` command. If so, it update the printer.cfg file and issue a `RESTART` command. If so, it

View File

@ -1,23 +1,26 @@
# RPi microcontroller # RPi microcontroller
This document describes the process of running Klipper on a RPi This document describes the process of running Klipper on a RPi and
and use the same RPi as secondary mcu. use the same RPi as secondary mcu.
## Why use RPi as a secondary MCU? ## Why use RPi as a secondary MCU?
Often the MCUs dedicated to controlling 3D printers have a limited and Often the MCUs dedicated to controlling 3D printers have a limited and
pre-configured number of exposed pins to manage the main printing pre-configured number of exposed pins to manage the main printing
functions (thermal resistors, extruders, steppers ...). functions (thermal resistors, extruders, steppers ...). Using the RPi
Using the RPi where Klipper is installed as a secondary MCU gives the where Klipper is installed as a secondary MCU gives the possibility to
possibility to directly use the GPIOs and the buses (i2c, spi) of the RPi directly use the GPIOs and the buses (i2c, spi) of the RPi inside
inside klipper without using Octoprint plugins (if used) or external klipper without using Octoprint plugins (if used) or external programs
programs giving the ability to control everything within the print GCODE. giving the ability to control everything within the print GCODE.
**Warning**: If your platform is a _Beaglebone_ and you have correctly followed the installation steps, the linux mcu is already installed and configured for your system. **Warning**: If your platform is a _Beaglebone_ and you have correctly
followed the installation steps, the linux mcu is already installed
and configured for your system.
## Install the rc script ## Install the rc script
If you want to use the host as a secondary MCU the klipper_mcu process must run before the klippy process. If you want to use the host as a secondary MCU the klipper_mcu process
must run before the klippy process.
After installing Klipper, install the script. run: After installing Klipper, install the script. run:
``` ```
@ -26,10 +29,6 @@ sudo cp "./scripts/klipper-mcu-start.sh" /etc/init.d/klipper_mcu
sudo update-rc.d klipper_mcu defaults sudo update-rc.d klipper_mcu defaults
``` ```
## Enabling SPI
Make sure the Linux SPI driver is enabled by running sudo raspi-config and enabling SPI under the "Interfacing options" menu.
## Building the micro-controller code ## Building the micro-controller code
To compile the Klipper micro-controller code, start by configuring it To compile the Klipper micro-controller code, start by configuring it
@ -38,7 +37,9 @@ for the "Linux process":
cd ~/klipper/ cd ~/klipper/
make menuconfig make menuconfig
``` ```
In the menu, set "Microcontroller Architecture" to "Linux process," then save and exit.
In the menu, set "Microcontroller Architecture" to "Linux process,"
then save and exit.
To build and install the new micro-controller code, run: To build and install the new micro-controller code, run:
``` ```
@ -47,9 +48,10 @@ make flash
sudo service klipper start sudo service klipper start
``` ```
If klippy.log reports a "Permission denied" error when attempting to connect If klippy.log reports a "Permission denied" error when attempting to
to `/tmp/klipper_host_mcu` then you need to add your user to the tty group. connect to `/tmp/klipper_host_mcu` then you need to add your user to
The following command will add the "pi" user to the tty group: the tty group. The following command will add the "pi" user to the
tty group:
``` ```
sudo usermod -a -G tty pi sudo usermod -a -G tty pi
``` ```
@ -61,12 +63,24 @@ following the instructions in
[RaspberryPi sample config](../config/sample-raspberry-pi.cfg) and [RaspberryPi sample config](../config/sample-raspberry-pi.cfg) and
[Multi MCU sample config](../config/sample-multi-mcu.cfg). [Multi MCU sample config](../config/sample-multi-mcu.cfg).
## Optional: Enabling SPI
Make sure the Linux SPI driver is enabled by running
`sudo raspi-config` and enabling SPI under the "Interfacing options"
menu.
## Optional: Identify the correct gpiochip ## Optional: Identify the correct gpiochip
On Rasperry and on many clones the pins exposed on the GPIO belong to the first gpiochip. They can therefore be used on klipper simply by referring them with the name `gpio0..n`. On Raspberry Pi and on many clones the pins exposed on the GPIO belong
However, there are cases in which the exposed pins belong to gpiochips other than the first. For example in the case of some OrangePi models or if a Port Expander is used. In these cases it is useful to use the commands to access the _Linux GPIO character device_ to verify the configuration. to the first gpiochip. They can therefore be used on klipper simply by
referring them with the name `gpio0..n`. However, there are cases in
which the exposed pins belong to gpiochips other than the first. For
example in the case of some OrangePi models or if a Port Expander is
used. In these cases it is useful to use the commands to access the
_Linux GPIO character device_ to verify the configuration.
To install the _Linux GPIO character device - binary_ on a debian based distro like octopi run: To install the _Linux GPIO character device - binary_ on a debian
based distro like octopi run:
``` ```
sudo apt-get install gpiod sudo apt-get install gpiod
``` ```
@ -81,9 +95,13 @@ To check the pin number and the pin availability tun:
gpioinfo gpioinfo
``` ```
The chosen pin can thus be used within the configuration as `gpiochip<n>/gpio<o>` where **n** is the chip number as seen by the `gpiodetect` command and **o** is the line number seen by the` gpioinfo` command. The chosen pin can thus be used within the configuration as
`gpiochip<n>/gpio<o>` where **n** is the chip number as seen by the
`gpiodetect` command and **o** is the line number seen by the`
gpioinfo` command.
***Warning:*** only gpio marked as `unused` can be used. It is not possible for a _line_ to be used by multiple processes simultaneously. ***Warning:*** only gpio marked as `unused` can be used. It is not
possible for a _line_ to be used by multiple processes simultaneously.
For example on a RPi 3B+ where klipper use the GPIO20 for a switch: For example on a RPi 3B+ where klipper use the GPIO20 for a switch:
``` ```
@ -160,23 +178,32 @@ gpiochip1 - 8 lines:
## Optional: Hardware PWM ## Optional: Hardware PWM
Raspberry Pi's have two PWM channels (PWM0 and PWM1) which are exposed on the header or if not, can be routed to existing gpio pins. Raspberry Pi's have two PWM channels (PWM0 and PWM1) which are exposed
The Linux mcu daemon uses the pwmchip sysfs interface to control hardware pwm devices on Linux hosts. on the header or if not, can be routed to existing gpio pins. The
The pwm sysfs interface is not exposed by default on a Raspberry and can be activated by adding a line to ```/boot/config.txt```: Linux mcu daemon uses the pwmchip sysfs interface to control hardware
pwm devices on Linux hosts. The pwm sysfs interface is not exposed by
default on a Raspberry and can be activated by adding a line to
`/boot/config.txt`:
``` ```
# Enable pwmchip sysfs interface # Enable pwmchip sysfs interface
dtoverlay=pwm,pin=12,func=4 dtoverlay=pwm,pin=12,func=4
``` ```
This example enables only PWM0 and routes it to gpio12. If both PWM channels need to be enabled you can use ```pwm-2chan```. This example enables only PWM0 and routes it to gpio12. If both PWM
channels need to be enabled you can use `pwm-2chan`.
The overlay does not expose the pwm line on sysfs on boot and needs to be exported by echo'ing the number of the pwm channel to ```/sys/class/pwm/pwmchip0/export```: The overlay does not expose the pwm line on sysfs on boot and needs to
be exported by echo'ing the number of the pwm channel to
`/sys/class/pwm/pwmchip0/export`:
``` ```
echo 0 > /sys/class/pwm/pwmchip0/export echo 0 > /sys/class/pwm/pwmchip0/export
``` ```
This will create device ```/sys/class/pwm/pwmchip0/pwm0``` in the filesystem.
The easiest way to do this is by adding this to ```/etc/rc.local``` before the ```exit 0``` line.
With the sysfs in place, you can now use either the pwm channel(s) by adding the following piece of configuration to your ```printer.cfg```: This will create device `/sys/class/pwm/pwmchip0/pwm0` in the
filesystem. The easiest way to do this is by adding this to
`/etc/rc.local` before the `exit 0` line.
With the sysfs in place, you can now use either the pwm channel(s) by
adding the following piece of configuration to your `printer.cfg`:
``` ```
[output_pin caselight] [output_pin caselight]
pin: host:pwmchip0/pwm0 pin: host:pwmchip0/pwm0
@ -184,7 +211,8 @@ pwm: True
hardware_pwm: True hardware_pwm: True
cycle_time: 0.000001 cycle_time: 0.000001
``` ```
This will add hardware pwm control to gpio12 on the Pi (because the overlay was configured to route pwm0 to pin=12). This will add hardware pwm control to gpio12 on the Pi (because the
overlay was configured to route pwm0 to pin=12).
PWM0 can be routed to gpio12 and gpio18, PWM1 can be routed to gpio13 PWM0 can be routed to gpio12 and gpio18, PWM1 can be routed to gpio13
and gpio19: and gpio19:

View File

@ -23,9 +23,8 @@ of the stealthChop mode of Trinamic stepper drivers.
## Tuning ## Tuning
Basic tuning requires measuring the ringing frequencies of the printer and Basic tuning requires measuring the ringing frequencies of the printer
adding a few parameters to `printer.cfg` file. by printing a test model.
Slice the ringing test model, which can be found in Slice the ringing test model, which can be found in
[docs/prints/ringing_tower.stl](prints/ringing_tower.stl), in the slicer: [docs/prints/ringing_tower.stl](prints/ringing_tower.stl), in the slicer:
@ -45,31 +44,28 @@ Slice the ringing test model, which can be found in
First, measure the **ringing frequency**. First, measure the **ringing frequency**.
1. Increase `max_accel` and `max_accel_to_decel` parameters in your 1. If `square_corner_velocity` parameter was changed, revert it back
`printer.cfg` to 7000. Note that this is only needed for tuning, and more to 5.0. It is not advised to increase it when using input shaper
proper value will be selected in the corresponding because it can cause more smoothing in parts - it is better to use
[section](#selecting-max_accel). higher acceleration value instead.
2. If `square_corner_velocity` parameter was changed, revert it back to 5.0. 2. Increase `max_accel_to_decel` by issuing the following command:
It is not advised to increase it when using the input shaper because it can `SET_VELOCITY_LIMIT ACCEL_TO_DECEL=7000`
cause more smoothing in parts - it is better to use higher acceleration 3. Disable Pressure Advance: `SET_PRESSURE_ADVANCE ADVANCE=0`
value instead. 4. If you have already added `[input_shaper]` section to the printer.cfg,
3. Restart the firmware: `RESTART`.
4. Disable Pressure Advance: `SET_PRESSURE_ADVANCE ADVANCE=0`.
5. If you have already added `[input_shaper]` section to the printer.cfg,
execute `SET_INPUT_SHAPER SHAPER_FREQ_X=0 SHAPER_FREQ_Y=0` command. If you execute `SET_INPUT_SHAPER SHAPER_FREQ_X=0 SHAPER_FREQ_Y=0` command. If you
get "Unknown command" error, you can safely ignore it at this point and get "Unknown command" error, you can safely ignore it at this point and
continue with the measurements. continue with the measurements.
6. Execute the command 5. Execute the command:
`TUNING_TOWER COMMAND=SET_VELOCITY_LIMIT PARAMETER=ACCEL START=1250 FACTOR=100 BAND=5`. `TUNING_TOWER COMMAND=SET_VELOCITY_LIMIT PARAMETER=ACCEL START=1500 STEP_DELTA=500 STEP_HEIGHT=5`
Basically, we try to make ringing more pronounced by setting different large Basically, we try to make ringing more pronounced by setting different large
values for acceleration. This command will increase the acceleration every values for acceleration. This command will increase the acceleration every
5 mm starting from 1500 mm/sec^2: 1500 mm/sec^2, 2000 mm/sec^2, 2500 mm/sec^2 5 mm starting from 1500 mm/sec^2: 1500 mm/sec^2, 2000 mm/sec^2, 2500 mm/sec^2
and so forth up until 7000 mm/sec^2 at the last band. and so forth up until 7000 mm/sec^2 at the last band.
7. Print the test model sliced with the suggested parameters. 6. Print the test model sliced with the suggested parameters.
8. You can stop the print earlier if the ringing is clearly visible and you see 7. You can stop the print earlier if the ringing is clearly visible and you see
that acceleration gets too high for your printer (e.g. printer shakes too that acceleration gets too high for your printer (e.g. printer shakes too
much or starts skipping steps). much or starts skipping steps).
9. Use X and Y marks at the back of the model for reference. The measurements 8. Use X and Y marks at the back of the model for reference. The measurements
from the side with X mark should be used for X axis *configuration*, and from the side with X mark should be used for X axis *configuration*, and
Y mark - for Y axis configuration. Measure the distance *D* (in mm) between Y mark - for Y axis configuration. Measure the distance *D* (in mm) between
several oscillations on the part with X mark, near the notches, preferably several oscillations on the part with X mark, near the notches, preferably
@ -79,14 +75,14 @@ First, measure the **ringing frequency**.
|![Mark ringing](img/ringing-mark.jpg)|![Measure ringing](img/ringing-measure.jpg)| |![Mark ringing](img/ringing-mark.jpg)|![Measure ringing](img/ringing-measure.jpg)|
10. Count how many oscillations *N* the measured distance *D* corresponds to. 9. Count how many oscillations *N* the measured distance *D* corresponds to.
If you are unsure how to count the oscillations, refer to the picture If you are unsure how to count the oscillations, refer to the picture
above, which shows *N* = 6 oscillations. above, which shows *N* = 6 oscillations.
11. Compute the ringing frequency of X axis as *V* &middot; *N* / *D* (Hz), 10. Compute the ringing frequency of X axis as *V* &middot; *N* / *D* (Hz),
where *V* is the velocity for outer perimeters (mm/sec). For the example where *V* is the velocity for outer perimeters (mm/sec). For the example
above, we marked 6 oscillations, and the test was printed at 100 mm/sec above, we marked 6 oscillations, and the test was printed at 100 mm/sec
velocity, so the frequency is 100 * 6 / 12.14 ≈ 49.4 Hz. velocity, so the frequency is 100 * 6 / 12.14 ≈ 49.4 Hz.
12. Do (9) - (11) for Y mark as well. 11. Do (8) - (10) for Y mark as well.
Note that ringing on the test print should follow the pattern of the curved Note that ringing on the test print should follow the pattern of the curved
notches, as in the picture above. If it doesn't, then this defect is not really notches, as in the picture above. If it doesn't, then this defect is not really
@ -150,16 +146,15 @@ For most of the printers, either MZV or EI shapers can be recommended. This
section describes a testing process to choose between them, and figure out section describes a testing process to choose between them, and figure out
a few other related parameters. a few other related parameters.
Print the ringing test model as follows (assuming you already have Print the ringing test model as follows:
shaper_freq_x/y set and max_accel/max_accel_to_decel increased to 7000 in
printer.cfg file):
1. Restart the firmware: `RESTART`. 1. Restart the firmware: `RESTART`
2. Disable Pressure Advance: `SET_PRESSURE_ADVANCE ADVANCE=0`. 2. Prepare for test: `SET_VELOCITY_LIMIT ACCEL_TO_DECEL=7000`
3. Execute `SET_INPUT_SHAPER SHAPER_TYPE=MZV`. 3. Disable Pressure Advance: `SET_PRESSURE_ADVANCE ADVANCE=0`
4. Execute the command 4. Execute: `SET_INPUT_SHAPER SHAPER_TYPE=MZV`
`TUNING_TOWER COMMAND=SET_VELOCITY_LIMIT PARAMETER=ACCEL START=1250 FACTOR=100 BAND=5`. 5. Execute the command:
5. Print the test model sliced with the suggested parameters. `TUNING_TOWER COMMAND=SET_VELOCITY_LIMIT PARAMETER=ACCEL START=1500 STEP_DELTA=500 STEP_HEIGHT=5`
6. Print the test model sliced with the suggested parameters.
If you see no ringing at this point, then MZV shaper can be recommended for use. If you see no ringing at this point, then MZV shaper can be recommended for use.
@ -169,8 +164,8 @@ differ significantly from the values you obtained earlier, a more complex input
shaper configuration is needed. You can refer to Technical details of shaper configuration is needed. You can refer to Technical details of
[Input shapers](#input-shapers) section. Otherwise, proceed to the next step. [Input shapers](#input-shapers) section. Otherwise, proceed to the next step.
Now try EI input shaper. To try it, repeat steps (1)-(5) from above, but Now try EI input shaper. To try it, repeat steps (1)-(6) from above, but
executing at step 3 the following command instead: executing at step 4 the following command instead:
`SET_INPUT_SHAPER SHAPER_TYPE=EI`. `SET_INPUT_SHAPER SHAPER_TYPE=EI`.
Compare two prints with MZV and EI input shaper. If EI shows noticeably better Compare two prints with MZV and EI input shaper. If EI shows noticeably better
@ -207,7 +202,7 @@ You should have a printed test for the shaper you chose from the previous step
(if you don't, print the test model sliced with the (if you don't, print the test model sliced with the
[suggested parameters](#tuning) with the pressure advance disabled [suggested parameters](#tuning) with the pressure advance disabled
`SET_PRESSURE_ADVANCE ADVANCE=0` and with the tuning tower enabled as `SET_PRESSURE_ADVANCE ADVANCE=0` and with the tuning tower enabled as
`TUNING_TOWER COMMAND=SET_VELOCITY_LIMIT PARAMETER=ACCEL START=1250 FACTOR=100 BAND=5`). `TUNING_TOWER COMMAND=SET_VELOCITY_LIMIT PARAMETER=ACCEL START=1500 STEP_DELTA=500 STEP_HEIGHT=5`).
Note that at very high accelerations, depending on the resonance frequency and Note that at very high accelerations, depending on the resonance frequency and
the input shaper you chose (e.g. EI shaper creates more smoothing than MZV), the input shaper you chose (e.g. EI shaper creates more smoothing than MZV),
input shaping may cause too much smoothing and rounding of the parts. So, input shaping may cause too much smoothing and rounding of the parts. So,
@ -242,8 +237,7 @@ It may also be a result of a miscalibrated (too high) filament flow, so it is
a good idea to check that too. a good idea to check that too.
Choose the minimum out of the two acceleration values (from ringing and Choose the minimum out of the two acceleration values (from ringing and
smoothing), and put it as max_accel into printer.cfg (you can delete smoothing), and put it as `max_accel` into printer.cfg.
max_accel_to_decel or revert it to the old value).
As a note, it may happen - especially at low ringing frequencies - that EI As a note, it may happen - especially at low ringing frequencies - that EI
@ -273,29 +267,29 @@ your choice with the same frequencies as you have measured earlier), you can
follow the steps in this section. Note that if you see ringing at different follow the steps in this section. Note that if you see ringing at different
frequencies after enabling [input_shaper], this section will not help with that. frequencies after enabling [input_shaper], this section will not help with that.
Assuming that you have sliced the ringing model with suggested parameters and Assuming that you have sliced the ringing model with suggested
increased `max_accel` and `max_accel_to_decel` parameters in the `printer.cfg` parameters, complete the following steps for each of the axes X and Y:
to 7000 already, complete the following steps for each of the axes X and Y:
1. Make sure Pressure Advance is disabled: `SET_PRESSURE_ADVANCE ADVANCE=0`. 1. Prepare for test: `SET_VELOCITY_LIMIT ACCEL_TO_DECEL=7000`
2. Execute `SET_INPUT_SHAPER SHAPER_TYPE=ZV`. 2. Make sure Pressure Advance is disabled: `SET_PRESSURE_ADVANCE ADVANCE=0`
3. From the existing ringing test model with your chosen input shaper select 3. Execute: `SET_INPUT_SHAPER SHAPER_TYPE=ZV`
4. From the existing ringing test model with your chosen input shaper select
the acceleration that shows ringing sufficiently well, and set it with: the acceleration that shows ringing sufficiently well, and set it with:
`SET_VELOCITY_LIMIT ACCEL=...`. `SET_VELOCITY_LIMIT ACCEL=...`
4. Calculate the necessary parameters for the `TUNING_TOWER` command to tune 5. Calculate the necessary parameters for the `TUNING_TOWER` command to tune
`shaper_freq_x` parameter as follows: start = shaper_freq_x * 83 / 132 and `shaper_freq_x` parameter as follows: start = shaper_freq_x * 83 / 132 and
factor = shaper_freq_x / 66, where `shaper_freq_x` here is the current value factor = shaper_freq_x / 66, where `shaper_freq_x` here is the current value
in `printer.cfg`. in `printer.cfg`.
5. Execute the command 6. Execute the command:
`TUNING_TOWER COMMAND=SET_INPUT_SHAPER PARAMETER=SHAPER_FREQ_X START=start FACTOR=factor BAND=5` `TUNING_TOWER COMMAND=SET_INPUT_SHAPER PARAMETER=SHAPER_FREQ_X START=start FACTOR=factor BAND=5`
using `start` and `factor` values calculated at step (4). using `start` and `factor` values calculated at step (5).
6. Print the test model. 7. Print the test model.
7. Reset the original frequency value: 8. Reset the original frequency value:
`SET_INPUT_SHAPER SHAPER_FREQ_X=...`. `SET_INPUT_SHAPER SHAPER_FREQ_X=...`.
8. Find the band which shows ringing the least and count its number from the 9. Find the band which shows ringing the least and count its number from the
bottom starting at 1. bottom starting at 1.
9. Calculate the new shaper_freq_x value via old 10. Calculate the new shaper_freq_x value via old
shaper_freq_x * (39 + 5 * #band-number) / 66. shaper_freq_x * (39 + 5 * #band-number) / 66.
Repeat these steps for the Y axis in the same manner, replacing references to X Repeat these steps for the Y axis in the same manner, replacing references to X
axis with the axis Y (e.g. replace `shaper_freq_x` with `shaper_freq_y` in axis with the axis Y (e.g. replace `shaper_freq_x` with `shaper_freq_y` in
@ -312,16 +306,12 @@ After both new `shaper_freq_x` and `shaper_freq_y` parameters have been
calculated, you can update `[input_shaper]` section in `printer.cfg` with the calculated, you can update `[input_shaper]` section in `printer.cfg` with the
new `shaper_freq_x` and `shaper_freq_y` values. new `shaper_freq_x` and `shaper_freq_y` values.
Do not forget to revert the changes to `max_accel` and `max_accel_to_decel`
parameters in the `printer.cfg` after finishing this section.
### Pressure Advance ### Pressure Advance
If you use Pressure Advance, it may need to be re-tuned. Follow the If you use Pressure Advance, it may need to be re-tuned. Follow the
[instructions](Pressure_Advance.md#tuning-pressure-advance) to find the [instructions](Pressure_Advance.md#tuning-pressure-advance) to find
new value, if it differs from the previous one. Make sure to restore the the new value, if it differs from the previous one. Make sure to
original values of `max_accel` and `max_accel_to_decel` parameters in the restart Klipper before tuning Pressure Advance.
`printer.cfg` and restart Klipper before tuning Pressure Advance.
### Unreliable measurements of ringing frequencies ### Unreliable measurements of ringing frequencies
@ -335,26 +325,26 @@ accelerometer and measure the resonances with it (refer to the
process) - but this option requires some crimping and soldering. process) - but this option requires some crimping and soldering.
For tuning, add empty `[input_shaper]` section to your `printer.cfg`. Then, For tuning, add empty `[input_shaper]` section to your
assuming that you have sliced the ringing model with suggested parameters and `printer.cfg`. Then, assuming that you have sliced the ringing model
increased `max_accel` and `max_accel_to_decel` parameters in the `printer.cfg` with suggested parameters, print the test model 3 times as
to 7000 already, print the test model 3 times as follows. First time, prior to follows. First time, prior to printing, run
printing, run
1. `RESTART` 1. `RESTART`
2. `SET_PRESSURE_ADVANCE ADVANCE=0`. 2. `SET_VELOCITY_LIMIT ACCEL_TO_DECEL=7000`
3. `SET_INPUT_SHAPER SHAPER_TYPE=2HUMP_EI SHAPER_FREQ_X=60 SHAPER_FREQ_Y=60`. 3. `SET_PRESSURE_ADVANCE ADVANCE=0`
4. `TUNING_TOWER COMMAND=SET_VELOCITY_LIMIT PARAMETER=ACCEL START=1250 FACTOR=100 BAND=5`. 4. `SET_INPUT_SHAPER SHAPER_TYPE=2HUMP_EI SHAPER_FREQ_X=60 SHAPER_FREQ_Y=60`
5. `TUNING_TOWER COMMAND=SET_VELOCITY_LIMIT PARAMETER=ACCEL START=1500 STEP_DELTA=500 STEP_HEIGHT=5`
and print the model. Then print the model again, but before printing run instead and print the model. Then print the model again, but before printing run instead
1. `SET_INPUT_SHAPER SHAPER_TYPE=2HUMP_EI SHAPER_FREQ_X=50 SHAPER_FREQ_Y=50`. 1. `SET_INPUT_SHAPER SHAPER_TYPE=2HUMP_EI SHAPER_FREQ_X=50 SHAPER_FREQ_Y=50`
2. `TUNING_TOWER COMMAND=SET_VELOCITY_LIMIT PARAMETER=ACCEL START=1250 FACTOR=100 BAND=5`. 2. `TUNING_TOWER COMMAND=SET_VELOCITY_LIMIT PARAMETER=ACCEL START=1500 STEP_DELTA=500 STEP_HEIGHT=5`
Then print the model for the 3rd time, but now run Then print the model for the 3rd time, but now run
1. `SET_INPUT_SHAPER SHAPER_TYPE=2HUMP_EI SHAPER_FREQ_X=40 SHAPER_FREQ_Y=40`. 1. `SET_INPUT_SHAPER SHAPER_TYPE=2HUMP_EI SHAPER_FREQ_X=40 SHAPER_FREQ_Y=40`
2. `TUNING_TOWER COMMAND=SET_VELOCITY_LIMIT PARAMETER=ACCEL START=1250 FACTOR=100 BAND=5`. 2. `TUNING_TOWER COMMAND=SET_VELOCITY_LIMIT PARAMETER=ACCEL START=1500 STEP_DELTA=500 STEP_HEIGHT=5`
Essentially, we are printing the ringing test model with TUNING_TOWER using Essentially, we are printing the ringing test model with TUNING_TOWER using
2HUMP_EI shaper with shaper_freq = 60 Hz, 50 Hz, and 40 Hz. 2HUMP_EI shaper with shaper_freq = 60 Hz, 50 Hz, and 40 Hz.
@ -377,8 +367,8 @@ frequency based on the frequency of 2HUMP_EI shaper you chose:
Now print the test model one more time, running Now print the test model one more time, running
1. `SET_INPUT_SHAPER SHAPER_TYPE=EI SHAPER_FREQ_X=... SHAPER_FREQ_Y=...`. 1. `SET_INPUT_SHAPER SHAPER_TYPE=EI SHAPER_FREQ_X=... SHAPER_FREQ_Y=...`
2. `TUNING_TOWER COMMAND=SET_VELOCITY_LIMIT PARAMETER=ACCEL START=1250 FACTOR=100 BAND=5`. 2. `TUNING_TOWER COMMAND=SET_VELOCITY_LIMIT PARAMETER=ACCEL START=1500 STEP_DELTA=500 STEP_HEIGHT=5`
providing the shaper_freq_x=... and shaper_freq_y=... as determined previously. providing the shaper_freq_x=... and shaper_freq_y=... as determined previously.

View File

@ -36,7 +36,7 @@ Most drivers use 16 microsteps. If unsure, set `microsteps: 16` in the
config and use 16 in the formula above. config and use 16 in the formula above.
Almost all printers should have a whole number for `rotation_distance` Almost all printers should have a whole number for `rotation_distance`
on x, y, and z type axes. If the above formula results in a on X, Y, and Z type axes. If the above formula results in a
rotation_distance that is within .01 of a whole number then round the rotation_distance that is within .01 of a whole number then round the
final value to that whole_number. final value to that whole_number.

View File

@ -10,12 +10,23 @@ attribute be sure to review the
[Config Changes document](Config_Changes.md) when upgrading the [Config Changes document](Config_Changes.md) when upgrading the
Klipper software. Klipper software.
## angle
The following information is available in
[angle some_name](Config_Reference.md#angle) objects:
- `temperature`: The last temperature reading (in Celsius) from a
tle5012b magnetic hall sensor. This value is only available if the
angle sensor is a tle5012b chip and if measurements are in progress
(otherwise it reports `None`).
## bed_mesh ## bed_mesh
The following information is available in the The following information is available in the
[bed_mesh](Config_Reference.md#bed_mesh) object: [bed_mesh](Config_Reference.md#bed_mesh) object:
- `profile_name`, `mesh_min`, `mesh_max`, `probed_matrix`, - `profile_name`, `mesh_min`, `mesh_max`, `probed_matrix`,
`mesh_matrix`: Information on the currently active bed_mesh. `mesh_matrix`: Information on the currently active bed_mesh.
- `profiles`: The set of currently defined profiles as setup
using BED_MESH_PROFILE.
## configfile ## configfile
@ -138,7 +149,8 @@ The following information is available in the
[hall_filament_width_sensor](Config_Reference.md#hall_filament_width_sensor) [hall_filament_width_sensor](Config_Reference.md#hall_filament_width_sensor)
object: object:
- `is_active`: Returns True if the sensor is currently active. - `is_active`: Returns True if the sensor is currently active.
- `Diameter`, `Raw`: The last read values from the sensor. - `Diameter`: The last reading from the sensor in mm.
- `Raw`: The last raw ADC reading from the sensor.
## heater ## heater
@ -179,6 +191,19 @@ is always available):
been in the "Printing" state (as tracked by the idle_timeout been in the "Printing" state (as tracked by the idle_timeout
module). module).
## led
The following information is available for each `[led led_name]`,
`[neopixel led_name]`, `[dotstar led_name]`, `[pca9533 led_name]`, and
`[pca9632 led_name]` config section defined in printer.cfg:
- `color_data`: A list of color lists containing the RGBW values for a
led in the chain. Each value is represented as a float from 0.0 to
1.0. Each color list contains 4 items (red, green, blue, white) even
if the underyling LED supports fewer color channels. For example,
the blue value (3rd item in color list) of the second neopixel in a
chain could be accessed at
`printer["neopixel <config_name>"].color_data[1][2]`.
## mcu ## mcu
The following information is available in The following information is available in
@ -395,16 +420,6 @@ object is available if z_tilt is defined):
- `applied`: True if the z-tilt leveling process has been run and completed - `applied`: True if the z-tilt leveling process has been run and completed
successfully. successfully.
## neopixel / dotstar
The following information is available for each `[neopixel led_name]` and
`[dotstar led_name]` defined in printer.cfg:
- `color_data`: An array of objects, with each object containing the RGBW
values for a led in the chain. Note that not all configurations will contain
a white value. Each value is represented as a float from 0 to 1. For
example, the blue value of the second neopixel in a chain could be accessed
at `printer["neopixel <config_name>"].color_data[1].B`.
## dgus_status ## dgus_status
The following information is available in the `dgus_status` object The following information is available in the `dgus_status` object

View File

@ -45,7 +45,7 @@ leave a stepper idle sufficiently long.
If one wishes to reduce current to motors during print start routines, If one wishes to reduce current to motors during print start routines,
then consider issuing then consider issuing
[SET_TMC_CURRENT](G-Codes.md#tmc-stepper-drivers) commands in a [SET_TMC_CURRENT](G-Codes.md#set_tmc_current) commands in a
[START_PRINT macro](Slicers.md#klipper-gcode_macro) to adjust the [START_PRINT macro](Slicers.md#klipper-gcode_macro) to adjust the
current before and after normal printing moves. current before and after normal printing moves.
@ -410,10 +410,10 @@ restrictions:
## Querying and diagnosing driver settings ## Querying and diagnosing driver settings
The `[DUMP_TMC command](G-Codes.md#tmc-stepper-drivers) is a useful The `[DUMP_TMC command](G-Codes.md#dump_tmc) is a useful tool when
tool when configuring and diagnosing the drivers. It will report all configuring and diagnosing the drivers. It will report all fields
fields configured by Klipper as well as all fields that can be queried configured by Klipper as well as all fields that can be queried from
from the driver. the driver.
All of the reported fields are defined in the Trinamic datasheet for All of the reported fields are defined in the Trinamic datasheet for
each driver. These datasheets can be found on the each driver. These datasheets can be found on the
@ -429,7 +429,7 @@ Klipper supports configuring many low-level driver fields using
has the full list of fields available for each type of driver. has the full list of fields available for each type of driver.
In addition, almost all fields can be modified at run-time using the In addition, almost all fields can be modified at run-time using the
[SET_TMC_FIELD command](G-Codes.md#tmc-stepper-drivers). [SET_TMC_FIELD command](G-Codes.md#set_tmc_field).
Each of these fields is defined in the Trinamic datasheet for each Each of these fields is defined in the Trinamic datasheet for each
driver. These datasheets can be found on the driver. These datasheets can be found on the

View File

@ -1,36 +1,22 @@
# TSL1401CL filament width sensor # TSL1401CL filament width sensor
This document describes Filament Width Sensor host module. Hardware used for developing this host module is based on TSL1401CL linear sensor array but it can work with any sensor array that has analog output. You can find designs at [thingiverse.com](https://www.thingiverse.com/search?q=filament%20width%20sensor) This document describes Filament Width Sensor host module. Hardware used
for developing this host module is based on TSL1401CL linear sensor array
but it can work with any sensor array that has analog output. You can find
designs at [Thingiverse](https://www.thingiverse.com/search?q=filament%20width%20sensor).
To use a sensor array as a filament width sensor, read
[Config Reference](Config_Reference.md#tsl1401cl_filament_width_sensor) and
[G-Code documentation](G-Codes.md#hall_filament_width_sensor).
## How does it work? ## How does it work?
Sensor generates analog output based on calculated filament width. Output voltage always equals to detected filament width (Ex. 1.65v, 1.70v, 3.0v). Host module monitors voltage changes and adjusts extrusion multiplier. Sensor generates analog output based on calculated filament width. Output
voltage always equals to detected filament width (Ex. 1.65v, 1.70v, 3.0v).
Host module monitors voltage changes and adjusts extrusion multiplier.
## Configuration ## Note:
[tsl1401cl_filament_width_sensor] Sensor readings done with 10 mm intervals by default. If necessary you are
pin: analog5 free to change this setting by editing ***MEASUREMENT_INTERVAL_MM*** parameter
# Analog input pin for sensor output on Ramps board in **filament_width_sensor.py** file.
default_nominal_filament_diameter: 1.75
# This parameter is in millimeters (mm)
max_difference: 0.2
# Maximum allowed filament diameter difference in millimeters (mm)
# If difference between nominal filament diameter and sensor output is more
# than +- max_difference, extrusion multiplier set back to %100
measurement_delay 100
# The distance from sensor to the melting chamber/hot-end in millimeters (mm).
# The filament between the sensor and the hot-end will be treated as the default_nominal_filament_diameter.
# Host module works with FIFO logic. It keeps each sensor value and position in
# an array and POP them back in correct position.
Sensor readings done with 10 mm intervals by default. If necessary you are free to change this setting by editing ***MEASUREMENT_INTERVAL_MM*** parameter in **filament_width_sensor.py** file.
## Commands
**QUERY_FILAMENT_WIDTH** - Return the current measured filament width as result
**RESET_FILAMENT_WIDTH_SENSOR** Clear all sensor readings. Can be used after filament change.
**DISABLE_FILAMENT_WIDTH_SENSOR** Turn off the filament width sensor and stop using it to do flow control
**ENABLE_FILAMENT_WIDTH_SENSOR** - Turn on the filament width sensor and start using it to do flow control

View File

@ -4,3 +4,17 @@ site is hosted using "github pages". The
https://www.mkdocs.org/ ) to automatically convert the markdown files https://www.mkdocs.org/ ) to automatically convert the markdown files
in the docs/ directory to html. In addition to the files in this in the docs/ directory to html. In addition to the files in this
directory, the docs/CNAME file also controls the website generation. directory, the docs/CNAME file also controls the website generation.
To test deploy the main English site locally one can use commands
similar to the following:
virtualenv ~/mkdocs-env && ~/python-env/bin/pip install -r ~/klipper/docs/_klipper3d/mkdocs-requirements.txt
cd ~/klipper && ~/mkdocs-env/bin/mkdocs serve --config-file ~/klipper/docs/_klipper3d/mkdocs.yml -a 0.0.0.0:8000
To test deploy the multi-language site locally one can use commands
similar to the following:
virtualenv ~/mkdocs-env && ~/python-env/bin/pip install -r ~/klipper/docs/_klipper3d/mkdocs-requirements.txt
source ~/mkdocs-env/bin/activate
cd ~/klipper && ./docs/_klipper3d/build-translations.sh
cd ~/klipper/site/ && python3 -m http.server 8000

View File

@ -0,0 +1,64 @@
#!/bin/bash
# This script extracts the Klipper translations and builds multiple
# mdocs sites - one for each supported language. See the README file
# for additional details.
MKDOCS_DIR="docs/_klipper3d/"
WORK_DIR="work/"
TRANS_DIR="${WORK_DIR}klipper-translations/"
TRANS_FILE="${TRANS_DIR}active_translations"
MKDOCS_MAIN="${MKDOCS_DIR}mkdocs-main.yml"
# Fetch translations
git clone --depth 1 https://github.com/Klipper3d/klipper-translations ${TRANS_DIR}
# Create new mkdocs-main.yml with language links
cp ${MKDOCS_DIR}mkdocs.yml ${MKDOCS_MAIN}
while IFS="," read dirname langsite langdesc langsearch; do
sed -i "s%^.*# Alternate language links automatically added here$% - name: ${langdesc}\n link: /${langsite}/\n lang: ${langsite}\n\0%" ${MKDOCS_MAIN}
done < <(egrep -v '^ *(#|$)' ${TRANS_FILE})
# Build main English website
echo "building site for en"
mkdocs build -f ${MKDOCS_MAIN}
# Build each additional language website
while IFS="," read dirname langsite langdesc langsearch; do
new_docs_dir="${WORK_DIR}lang/${langsite}/docs/"
locale_dir="${TRANS_DIR}/docs/locales/${dirname}"
# Copy markdown files to new_docs_dir
echo "Copying $dirname to $langsite"
mkdir -p "${new_docs_dir}"
cp "${locale_dir}"/*.md "${new_docs_dir}"
echo "copy resources"
cp -r docs/img "${new_docs_dir}"
cp -r docs/prints "${new_docs_dir}"
cp -r docs/_klipper3d "${new_docs_dir}"
# manually replace index.md if a manual-index.md exist
manual_index="${new_docs_dir}manual-index.md"
if [[ -f "${manual_index}" ]]; then
mv -f "${manual_index}" "${new_docs_dir}index.md"
echo "replaced index.md with manual_index.md for $langsite"
else
echo "Manually translated index file for $langsite not found!"
fi
# Create language specific mkdocs-lang-xxx.yml file
echo "create language specific mkdocs configurations for ${langsite}"
new_mkdocs_file="${new_docs_dir}_klipper3d/mkdocs-lang-${langsite}.yml"
cp "${MKDOCS_MAIN}" "${new_mkdocs_file}"
echo "replace search language"
sed -i "s%^ lang: en$% lang: ${langsearch}%" "${new_mkdocs_file}"
echo "replace site language"
sed -i "s%^ language: en$% language: ${langsite}%" "${new_mkdocs_file}"
# Build site
echo "building site for ${langsite}"
mkdir -p "${PWD}/site/${langsite}/"
ln -sf "${PWD}/site/${langsite}/" "${WORK_DIR}lang/${langsite}/site"
mkdocs build -f "${new_mkdocs_file}"
done < <(egrep -v '^ *(#|$)' ${TRANS_FILE})

View File

@ -1,7 +1,7 @@
# Python virtualenv module requirements for mkdocs # Python virtualenv module requirements for mkdocs
jinja2==3.0.3
mkdocs==1.2.3 mkdocs==1.2.3
mkdocs-material==7.2.0 mkdocs-material==8.1.3
mkdocs-section-index==0.3.1
mkdocs-simple-hooks==0.1.3 mkdocs-simple-hooks==0.1.3
mkdocs-exclude==1.0.2 mkdocs-exclude==1.0.2
mdx-truly-sane-lists==1.2 mdx-truly-sane-lists==1.2

View File

@ -1,5 +1,8 @@
# Main configuration file for mkdocs generation of klipper3d.org website # Main configuration file for mkdocs generation of klipper3d.org website
# Note that the build-translations.sh script expects a certain file
# layout. See that script and the README file for more details.
# Site and directory configuration # Site and directory configuration
site_name: Klipper documentation site_name: Klipper documentation
repo_url: https://github.com/Klipper3d/klipper repo_url: https://github.com/Klipper3d/klipper
@ -9,7 +12,7 @@ use_directory_urls: False
docs_dir: '../' docs_dir: '../'
site_dir: '../../site/' site_dir: '../../site/'
# Markdown document translation settings # Custom markdown dialect settings
markdown_extensions: markdown_extensions:
- toc: - toc:
permalink: True permalink: True
@ -19,13 +22,13 @@ markdown_extensions:
- mdx_truly_sane_lists - mdx_truly_sane_lists
- mdx_breakless_lists - mdx_breakless_lists
plugins: plugins:
- search search:
- mkdocs-simple-hooks: lang: en
hooks: mkdocs-simple-hooks:
on_page_markdown: "docs._klipper3d.mkdocs_hooks:transform" hooks:
- exclude: on_page_markdown: "docs._klipper3d.mkdocs_hooks:transform"
glob: exclude:
- README.md glob: "README.md"
# Website layout configuration (using mkdocs-material theme) # Website layout configuration (using mkdocs-material theme)
theme: theme:
@ -49,6 +52,7 @@ theme:
favicon: img/favicon.ico favicon: img/favicon.ico
icon: icon:
repo: fontawesome/brands/github repo: fontawesome/brands/github
alternate: material/web
features: features:
#- navigation.tabs #- navigation.tabs
#- navigation.expand #- navigation.expand
@ -58,6 +62,7 @@ theme:
- search.suggest - search.suggest
- search.highlight - search.highlight
- search.share - search.share
language: en
extra_css: extra_css:
- _klipper3d/css/extra.css - _klipper3d/css/extra.css
@ -67,6 +72,12 @@ extra:
analytics: analytics:
provider: google provider: google
property: UA-138371409-1 property: UA-138371409-1
# Language Selection
alternate:
- name: English
link: /
lang: en
# Alternate language links automatically added here
# Navigation hierarchy (this should mimic the layout of Overview.md) # Navigation hierarchy (this should mimic the layout of Overview.md)
nav: nav:

View File

@ -38,8 +38,9 @@ defs_stepcompress = """
struct stepcompress *stepcompress_alloc(uint32_t oid); struct stepcompress *stepcompress_alloc(uint32_t oid);
void stepcompress_fill(struct stepcompress *sc, uint32_t max_error void stepcompress_fill(struct stepcompress *sc, uint32_t max_error
, uint32_t invert_sdir, int32_t queue_step_msgtag , int32_t queue_step_msgtag, int32_t set_next_step_dir_msgtag);
, int32_t set_next_step_dir_msgtag); void stepcompress_set_invert_sdir(struct stepcompress *sc
, uint32_t invert_sdir);
void stepcompress_free(struct stepcompress *sc); void stepcompress_free(struct stepcompress *sc);
int stepcompress_reset(struct stepcompress *sc, uint64_t last_step_clock); int stepcompress_reset(struct stepcompress *sc, uint64_t last_step_clock);
int stepcompress_set_last_position(struct stepcompress *sc int stepcompress_set_last_position(struct stepcompress *sc
@ -133,8 +134,8 @@ defs_kin_winch = """
defs_kin_extruder = """ defs_kin_extruder = """
struct stepper_kinematics *extruder_stepper_alloc(void); struct stepper_kinematics *extruder_stepper_alloc(void);
void extruder_set_smooth_time(struct stepper_kinematics *sk void extruder_set_pressure_advance(struct stepper_kinematics *sk
, double smooth_time); , double pressure_advance, double smooth_time);
""" """
defs_kin_shaper = """ defs_kin_shaper = """

View File

@ -52,15 +52,17 @@ extruder_integrate_time(double base, double start_v, double half_accel
// Calculate the definitive integral of extruder for a given move // Calculate the definitive integral of extruder for a given move
static double static double
pa_move_integrate(struct move *m, double base, double start, double end, pa_move_integrate(struct move *m, double pressure_advance
double time_offset) , double base, double start, double end, double time_offset)
{ {
if (start < 0.) if (start < 0.)
start = 0.; start = 0.;
if (end > m->move_t) if (end > m->move_t)
end = m->move_t; end = m->move_t;
// Calculate base position and velocity with pressure advance // Calculate base position and velocity with pressure advance
double pressure_advance = m->axes_r.y; int can_pressure_advance = m->axes_r.y != 0.;
if (!can_pressure_advance)
pressure_advance = 0.;
base += pressure_advance * m->start_v; base += pressure_advance * m->start_v;
double start_v = m->start_v + pressure_advance * 2. * m->half_accel; double start_v = m->start_v + pressure_advance * 2. * m->half_accel;
// Calculate definitive integral // Calculate definitive integral
@ -72,34 +74,36 @@ pa_move_integrate(struct move *m, double base, double start, double end,
// Calculate the definitive integral of the extruder over a range of moves // Calculate the definitive integral of the extruder over a range of moves
static double static double
pa_range_integrate(struct move *m, double move_time, double hst) pa_range_integrate(struct move *m, double move_time
, double pressure_advance, double hst)
{ {
// Calculate integral for the current move // Calculate integral for the current move
double res = 0., start = move_time - hst, end = move_time + hst; double res = 0., start = move_time - hst, end = move_time + hst;
double start_base = m->start_pos.x; double start_base = m->start_pos.x;
res += pa_move_integrate(m, 0., start, move_time, start); res += pa_move_integrate(m, pressure_advance, 0., start, move_time, start);
res -= pa_move_integrate(m, 0., move_time, end, end); res -= pa_move_integrate(m, pressure_advance, 0., move_time, end, end);
// Integrate over previous moves // Integrate over previous moves
struct move *prev = m; struct move *prev = m;
while (unlikely(start < 0.)) { while (unlikely(start < 0.)) {
prev = list_prev_entry(prev, node); prev = list_prev_entry(prev, node);
start += prev->move_t; start += prev->move_t;
double base = prev->start_pos.x - start_base; double base = prev->start_pos.x - start_base;
res += pa_move_integrate(prev, base, start, prev->move_t, start); res += pa_move_integrate(prev, pressure_advance, base, start
, prev->move_t, start);
} }
// Integrate over future moves // Integrate over future moves
while (unlikely(end > m->move_t)) { while (unlikely(end > m->move_t)) {
end -= m->move_t; end -= m->move_t;
m = list_next_entry(m, node); m = list_next_entry(m, node);
double base = m->start_pos.x - start_base; double base = m->start_pos.x - start_base;
res -= pa_move_integrate(m, base, 0., end, end); res -= pa_move_integrate(m, pressure_advance, base, 0., end, end);
} }
return res; return res;
} }
struct extruder_stepper { struct extruder_stepper {
struct stepper_kinematics sk; struct stepper_kinematics sk;
double half_smooth_time, inv_half_smooth_time2; double pressure_advance, half_smooth_time, inv_half_smooth_time2;
}; };
static double static double
@ -112,12 +116,13 @@ extruder_calc_position(struct stepper_kinematics *sk, struct move *m
// Pressure advance not enabled // Pressure advance not enabled
return m->start_pos.x + move_get_distance(m, move_time); return m->start_pos.x + move_get_distance(m, move_time);
// Apply pressure advance and average over smooth_time // Apply pressure advance and average over smooth_time
double area = pa_range_integrate(m, move_time, hst); double area = pa_range_integrate(m, move_time, es->pressure_advance, hst);
return m->start_pos.x + area * es->inv_half_smooth_time2; return m->start_pos.x + area * es->inv_half_smooth_time2;
} }
void __visible void __visible
extruder_set_smooth_time(struct stepper_kinematics *sk, double smooth_time) extruder_set_pressure_advance(struct stepper_kinematics *sk
, double pressure_advance, double smooth_time)
{ {
struct extruder_stepper *es = container_of(sk, struct extruder_stepper, sk); struct extruder_stepper *es = container_of(sk, struct extruder_stepper, sk);
double hst = smooth_time * .5; double hst = smooth_time * .5;
@ -126,6 +131,7 @@ extruder_set_smooth_time(struct stepper_kinematics *sk, double smooth_time)
if (! hst) if (! hst)
return; return;
es->inv_half_smooth_time2 = 1. / (hst * hst); es->inv_half_smooth_time2 = 1. / (hst * hst);
es->pressure_advance = pressure_advance;
} }
struct stepper_kinematics * __visible struct stepper_kinematics * __visible

View File

@ -259,15 +259,25 @@ stepcompress_alloc(uint32_t oid)
// Fill message id information // Fill message id information
void __visible void __visible
stepcompress_fill(struct stepcompress *sc, uint32_t max_error stepcompress_fill(struct stepcompress *sc, uint32_t max_error
, uint32_t invert_sdir, int32_t queue_step_msgtag , int32_t queue_step_msgtag, int32_t set_next_step_dir_msgtag)
, int32_t set_next_step_dir_msgtag)
{ {
sc->max_error = max_error; sc->max_error = max_error;
sc->invert_sdir = !!invert_sdir;
sc->queue_step_msgtag = queue_step_msgtag; sc->queue_step_msgtag = queue_step_msgtag;
sc->set_next_step_dir_msgtag = set_next_step_dir_msgtag; sc->set_next_step_dir_msgtag = set_next_step_dir_msgtag;
} }
// Set the inverted stepper direction flag
void __visible
stepcompress_set_invert_sdir(struct stepcompress *sc, uint32_t invert_sdir)
{
invert_sdir = !!invert_sdir;
if (invert_sdir != sc->invert_sdir) {
sc->invert_sdir = invert_sdir;
if (sc->sdir >= 0)
sc->sdir ^= 1;
}
}
// Helper to free items from the history_list // Helper to free items from the history_list
static void static void
free_history(struct stepcompress *sc, uint64_t end_clock) free_history(struct stepcompress *sc, uint64_t end_clock)

View File

@ -13,8 +13,10 @@ struct pull_history_steps {
struct stepcompress *stepcompress_alloc(uint32_t oid); struct stepcompress *stepcompress_alloc(uint32_t oid);
void stepcompress_fill(struct stepcompress *sc, uint32_t max_error void stepcompress_fill(struct stepcompress *sc, uint32_t max_error
, uint32_t invert_sdir, int32_t queue_step_msgtag , int32_t queue_step_msgtag
, int32_t set_next_step_dir_msgtag); , int32_t set_next_step_dir_msgtag);
void stepcompress_set_invert_sdir(struct stepcompress *sc
, uint32_t invert_sdir);
void stepcompress_free(struct stepcompress *sc); void stepcompress_free(struct stepcompress *sc);
uint32_t stepcompress_get_oid(struct stepcompress *sc); uint32_t stepcompress_get_oid(struct stepcompress *sc);
int stepcompress_get_step_dir(struct stepcompress *sc); int stepcompress_get_step_dir(struct stepcompress *sc);

578
klippy/extras/angle.py Normal file
View File

@ -0,0 +1,578 @@
# Support for reading SPI magnetic angle sensors
#
# Copyright (C) 2021,2022 Kevin O'Connor <kevin@koconnor.net>
#
# This file may be distributed under the terms of the GNU GPLv3 license.
import logging, math, threading
from . import bus, motion_report
MIN_MSG_TIME = 0.100
TCODE_ERROR = 0xff
TRINAMIC_DRIVERS = ["tmc2130", "tmc2208", "tmc2209", "tmc2660", "tmc5160"]
CALIBRATION_BITS = 6 # 64 entries
ANGLE_BITS = 16 # angles range from 0..65535
class AngleCalibration:
def __init__(self, config):
self.printer = config.get_printer()
self.name = config.get_name()
self.stepper_name = config.get('stepper', None)
if self.stepper_name is None:
# No calibration
return
try:
import numpy
except:
raise config.error("Angle calibration requires numpy module")
sconfig = config.getsection(self.stepper_name)
sconfig.getint('microsteps', note_valid=False)
self.tmc_module = self.mcu_stepper = None
# Current calibration data
self.mcu_pos_offset = None
self.angle_phase_offset = 0.
self.calibration_reversed = False
self.calibration = []
cal = config.get('calibrate', None)
if cal is not None:
data = [d.strip() for d in cal.split(',')]
angles = [float(d) for d in data if d]
self.load_calibration(angles)
# Register commands
self.printer.register_event_handler("stepper:sync_mcu_position",
self.handle_sync_mcu_pos)
self.printer.register_event_handler("klippy:connect", self.connect)
cname = self.name.split()[-1]
gcode = self.printer.lookup_object('gcode')
gcode.register_mux_command("ANGLE_CALIBRATE", "CHIP",
cname, self.cmd_ANGLE_CALIBRATE,
desc=self.cmd_ANGLE_CALIBRATE_help)
def handle_sync_mcu_pos(self, mcu_stepper):
if mcu_stepper.get_name() == self.stepper_name:
self.mcu_pos_offset = None
def calc_mcu_pos_offset(self, sample):
# Lookup phase information
mcu_phase_offset, phases = self.tmc_module.get_phase_offset()
if mcu_phase_offset is None:
return
# Find mcu position at time of sample
angle_time, angle_pos = sample
mcu_pos = self.mcu_stepper.get_past_mcu_position(angle_time)
# Convert angle_pos to mcu_pos units
microsteps, full_steps = self.get_microsteps()
angle_to_mcu_pos = full_steps * microsteps / float(1<<ANGLE_BITS)
angle_mpos = angle_pos * angle_to_mcu_pos
# Calculate adjustment for stepper phases
phase_diff = ((angle_mpos + self.angle_phase_offset * angle_to_mcu_pos)
- (mcu_pos + mcu_phase_offset)) % phases
if phase_diff > phases//2:
phase_diff -= phases
# Store final offset
self.mcu_pos_offset = mcu_pos - (angle_mpos - phase_diff)
def apply_calibration(self, samples):
calibration = self.calibration
if not calibration:
return None
calibration_reversed = self.calibration_reversed
interp_bits = ANGLE_BITS - CALIBRATION_BITS
interp_mask = (1 << interp_bits) - 1
interp_round = 1 << (interp_bits - 1)
for i, (samp_time, angle) in enumerate(samples):
bucket = (angle & 0xffff) >> interp_bits
cal1 = calibration[bucket]
cal2 = calibration[bucket + 1]
adj = (angle & interp_mask) * (cal2 - cal1)
adj = cal1 + ((adj + interp_round) >> interp_bits)
angle_diff = (angle - adj) & 0xffff
angle_diff -= (angle_diff & 0x8000) << 1
new_angle = angle - angle_diff
if calibration_reversed:
new_angle = -new_angle
samples[i] = (samp_time, new_angle)
if self.mcu_pos_offset is None:
self.calc_mcu_pos_offset(samples[0])
if self.mcu_pos_offset is None:
return None
return self.mcu_stepper.mcu_to_commanded_position(self.mcu_pos_offset)
def load_calibration(self, angles):
# Calculate linear intepolation calibration buckets by solving
# linear equations
angle_max = 1 << ANGLE_BITS
calibration_count = 1 << CALIBRATION_BITS
bucket_size = angle_max // calibration_count
full_steps = len(angles)
nominal_step = float(angle_max) / full_steps
self.angle_phase_offset = (angles.index(min(angles)) & 3) * nominal_step
self.calibration_reversed = angles[-2] > angles[-1]
if self.calibration_reversed:
angles = list(reversed(angles))
first_step = angles.index(min(angles))
angles = angles[first_step:] + angles[:first_step]
import numpy
eqs = numpy.zeros((full_steps, calibration_count))
ans = numpy.zeros((full_steps,))
for step, angle in enumerate(angles):
int_angle = int(angle + .5) % angle_max
bucket = int(int_angle / bucket_size)
bucket_start = bucket * bucket_size
ang_diff = angle - bucket_start
ang_diff_per = ang_diff / bucket_size
eq = eqs[step]
eq[bucket] = 1. - ang_diff_per
eq[(bucket + 1) % calibration_count] = ang_diff_per
ans[step] = float(step * nominal_step)
if bucket + 1 >= calibration_count:
ans[step] -= ang_diff_per * angle_max
sol = numpy.linalg.lstsq(eqs, ans, rcond=None)[0]
isol = [int(s + .5) for s in sol]
self.calibration = isol + [isol[0] + angle_max]
def lookup_tmc(self):
for driver in TRINAMIC_DRIVERS:
driver_name = "%s %s" % (driver, self.stepper_name)
module = self.printer.lookup_object(driver_name, None)
if module is not None:
return module
raise self.printer.command_error("Unable to find TMC driver for %s"
% (self.stepper_name,))
def connect(self):
self.tmc_module = self.lookup_tmc()
fmove = self.printer.lookup_object('force_move')
self.mcu_stepper = fmove.lookup_stepper(self.stepper_name)
def get_microsteps(self):
configfile = self.printer.lookup_object('configfile')
sconfig = configfile.get_status(None)['settings']
stconfig = sconfig.get(self.stepper_name, {})
microsteps = stconfig['microsteps']
full_steps = stconfig['full_steps_per_rotation']
return microsteps, full_steps
def get_stepper_phase(self):
mcu_phase_offset, phases = self.tmc_module.get_phase_offset()
if mcu_phase_offset is None:
raise self.printer.command_error("Driver phase not known for %s"
% (self.stepper_name,))
mcu_pos = self.mcu_stepper.get_mcu_position()
return (mcu_pos + mcu_phase_offset) % phases
def do_calibration_moves(self):
move = self.printer.lookup_object('force_move').manual_move
# Start data collection
angle_sensor = self.printer.lookup_object(self.name)
cconn = angle_sensor.start_internal_client()
# Move stepper several turns (to allow internal sensor calibration)
microsteps, full_steps = self.get_microsteps()
mcu_stepper = self.mcu_stepper
step_dist = mcu_stepper.get_step_dist()
full_step_dist = step_dist * microsteps
rotation_dist = full_steps * full_step_dist
align_dist = step_dist * self.get_stepper_phase()
move_time = 0.010
move_speed = full_step_dist / move_time
move(mcu_stepper, -(rotation_dist+align_dist), move_speed)
move(mcu_stepper, 2. * rotation_dist, move_speed)
move(mcu_stepper, -2. * rotation_dist, move_speed)
move(mcu_stepper, .5 * rotation_dist - full_step_dist, move_speed)
# Move to each full step position
toolhead = self.printer.lookup_object('toolhead')
times = []
samp_dist = full_step_dist
for i in range(2 * full_steps):
move(mcu_stepper, samp_dist, move_speed)
start_query_time = toolhead.get_last_move_time() + 0.050
end_query_time = start_query_time + 0.050
times.append((start_query_time, end_query_time))
toolhead.dwell(0.150)
if i == full_steps-1:
# Reverse direction and test each full step again
move(mcu_stepper, .5 * rotation_dist, move_speed)
move(mcu_stepper, -.5 * rotation_dist + samp_dist, move_speed)
samp_dist = -samp_dist
move(mcu_stepper, .5*rotation_dist + align_dist, move_speed)
toolhead.wait_moves()
# Finish data collection
cconn.finalize()
msgs = cconn.get_messages()
# Correlate query responses
cal = {}
step = 0
for msg in msgs:
for query_time, pos in msg['params']['data']:
# Add to step tracking
while step < len(times) and query_time > times[step][1]:
step += 1
if step < len(times) and query_time >= times[step][0]:
cal.setdefault(step, []).append(pos)
if len(cal) != len(times):
raise self.printer.command_error(
"Failed calibration - incomplete sensor data")
fcal = { i: cal[i] for i in range(full_steps) }
rcal = { full_steps-i-1: cal[i+full_steps] for i in range(full_steps) }
return fcal, rcal
def calc_angles(self, meas):
total_count = total_variance = 0
angles = {}
for step, data in meas.items():
count = len(data)
angle_avg = float(sum(data)) / count
angles[step] = angle_avg
total_count += count
total_variance += sum([(d - angle_avg)**2 for d in data])
return angles, math.sqrt(total_variance / total_count), total_count
cmd_ANGLE_CALIBRATE_help = "Calibrate angle sensor to stepper motor"
def cmd_ANGLE_CALIBRATE(self, gcmd):
# Perform calibration movement and capture
old_calibration = self.calibration
self.calibration = []
try:
fcal, rcal = self.do_calibration_moves()
finally:
self.calibration = old_calibration
# Calculate each step position average and variance
microsteps, full_steps = self.get_microsteps()
fangles, fstd, ftotal = self.calc_angles(fcal)
rangles, rstd, rtotal = self.calc_angles(rcal)
if (len({a: i for i, a in fangles.items()}) != len(fangles)
or len({a: i for i, a in rangles.items()}) != len(rangles)):
raise self.printer.command_error(
"Failed calibration - sensor not updating for each step")
merged = { i: fcal[i] + rcal[i] for i in range(full_steps) }
angles, std, total = self.calc_angles(merged)
gcmd.respond_info("angle: stddev=%.3f (%.3f forward / %.3f reverse)"
" in %d queries" % (std, fstd, rstd, total))
# Order data with lowest/highest magnet position first
anglist = [angles[i] % 0xffff for i in range(full_steps)]
if angles[0] > angles[1]:
first_ang = max(anglist)
else:
first_ang = min(anglist)
first_phase = anglist.index(first_ang) & ~3
anglist = anglist[first_phase:] + anglist[:first_phase]
# Save results
cal_contents = []
for i, angle in enumerate(anglist):
if not i % 8:
cal_contents.append('\n')
cal_contents.append("%.1f" % (angle,))
cal_contents.append(',')
cal_contents.pop()
configfile = self.printer.lookup_object('configfile')
configfile.remove_section(self.name)
configfile.set(self.name, 'calibrate', ''.join(cal_contents))
class HelperA1333:
SPI_MODE = 3
SPI_SPEED = 10000000
def __init__(self, config, spi, oid):
self.spi = spi
self.is_tcode_absolute = False
self.last_temperature = None
def get_static_delay(self):
return .000001
def start(self):
# Setup for angle query
self.spi.spi_transfer([0x32, 0x00])
class HelperAS5047D:
SPI_MODE = 1
SPI_SPEED = int(1. / .000000350)
def __init__(self, config, spi, oid):
self.spi = spi
self.is_tcode_absolute = False
self.last_temperature = None
def get_static_delay(self):
return .000100
def start(self):
# Clear any errors from device
self.spi.spi_transfer([0xff, 0xfc]) # Read DIAAGC
self.spi.spi_transfer([0x40, 0x01]) # Read ERRFL
self.spi.spi_transfer([0xc0, 0x00]) # Read NOP
class HelperTLE5012B:
SPI_MODE = 1
SPI_SPEED = 4000000
def __init__(self, config, spi, oid):
self.printer = config.get_printer()
self.spi = spi
self.oid = oid
self.is_tcode_absolute = True
self.last_temperature = None
self.mcu = spi.get_mcu()
self.mcu.register_config_callback(self._build_config)
self.spi_angle_transfer_cmd = None
self.last_chip_mcu_clock = self.last_chip_clock = 0
self.chip_freq = 0.
name = config.get_name().split()[-1]
gcode = self.printer.lookup_object("gcode")
gcode.register_mux_command("ANGLE_DEBUG_READ", "CHIP", name,
self.cmd_ANGLE_DEBUG_READ,
desc=self.cmd_ANGLE_DEBUG_READ_help)
gcode.register_mux_command("ANGLE_DEBUG_WRITE", "CHIP", name,
self.cmd_ANGLE_DEBUG_WRITE,
desc=self.cmd_ANGLE_DEBUG_WRITE_help)
def _build_config(self):
cmdqueue = self.spi.get_command_queue()
self.spi_angle_transfer_cmd = self.mcu.lookup_query_command(
"spi_angle_transfer oid=%c data=%*s",
"spi_angle_transfer_response oid=%c clock=%u response=%*s",
oid=self.oid, cq=cmdqueue)
def get_tcode_params(self):
return self.last_chip_mcu_clock, self.last_chip_clock, self.chip_freq
def _calc_crc(self, data):
crc = 0xff
for d in data:
crc ^= d
for i in range(8):
if crc & 0x80:
crc = (crc << 1) ^ 0x1d
else:
crc <<= 1
return (~crc) & 0xff
def _send_spi(self, msg):
for retry in range(5):
if msg[0] & 0x04:
params = self.spi_angle_transfer_cmd.send([self.oid, msg])
else:
params = self.spi.spi_transfer(msg)
resp = bytearray(params['response'])
crc = self._calc_crc(bytearray(msg[:2]) + resp[2:-2])
if crc == resp[-1]:
return params
raise self.printer.command_error("Unable to query tle5012b chip")
def _read_reg(self, reg):
cw = 0x8000 | ((reg & 0x3f) << 4) | 0x01
if reg >= 0x05 and reg <= 0x11:
cw |= 0x5000
msg = [cw >> 8, cw & 0xff, 0, 0, 0, 0]
params = self._send_spi(msg)
resp = bytearray(params['response'])
return (resp[2] << 8) | resp[3]
def _write_reg(self, reg, val):
cw = ((reg & 0x3f) << 4) | 0x01
if reg >= 0x05 and reg <= 0x11:
cw |= 0x5000
msg = [cw >> 8, cw & 0xff, (val >> 8) & 0xff, val & 0xff, 0, 0]
for retry in range(5):
self._send_spi(msg)
rval = self._read_reg(reg)
if rval == val:
return
raise self.printer.command_error("Unable to write to tle5012b chip")
def _mask_reg(self, reg, off, on):
rval = self._read_reg(reg)
self._write_reg(reg, (rval & ~off) | on)
def _query_clock(self):
# Read frame counter (and normalize to a 16bit counter)
msg = [0x84, 0x42, 0, 0, 0, 0, 0, 0] # Read with latch, AREV and FSYNC
params = self._send_spi(msg)
resp = bytearray(params['response'])
mcu_clock = self.mcu.clock32_to_clock64(params['clock'])
chip_clock = ((resp[2] & 0x7e) << 9) | ((resp[4] & 0x3e) << 4)
# Calculate temperature
temper = resp[5] - ((resp[4] & 0x01) << 8)
self.last_temperature = (temper + 152) / 2.776
return mcu_clock, chip_clock
def update_clock(self):
mcu_clock, chip_clock = self._query_clock()
mdiff = mcu_clock - self.last_chip_mcu_clock
chip_mclock = self.last_chip_clock + int(mdiff * self.chip_freq + .5)
cdiff = (chip_mclock - chip_clock) & 0xffff
cdiff -= (cdiff & 0x8000) << 1
new_chip_clock = chip_mclock - cdiff
self.chip_freq = float(new_chip_clock - self.last_chip_clock) / mdiff
self.last_chip_clock = new_chip_clock
self.last_chip_mcu_clock = mcu_clock
def start(self):
# Clear any errors from device
self._read_reg(0x00) # Read STAT
# Initialize chip (so different chip variants work the same way)
self._mask_reg(0x06, 0xc003, 0x4000) # MOD1: 42.7us, IIF disable
self._mask_reg(0x08, 0x0007, 0x0001) # MOD2: Predict off, autocal=1
self._mask_reg(0x0e, 0x0003, 0x0000) # MOD4: IIF mode
# Setup starting clock values
mcu_clock, chip_clock = self._query_clock()
self.last_chip_clock = chip_clock
self.last_chip_mcu_clock = mcu_clock
self.chip_freq = float(1<<5) / self.mcu.seconds_to_clock(1. / 750000.)
self.update_clock()
cmd_ANGLE_DEBUG_READ_help = "Query low-level angle sensor register"
def cmd_ANGLE_DEBUG_READ(self, gcmd):
reg = gcmd.get("REG", minval=0, maxval=0x30, parser=lambda x: int(x, 0))
val = self._read_reg(reg)
gcmd.respond_info("ANGLE REG[0x%02x] = 0x%04x" % (reg, val))
cmd_ANGLE_DEBUG_WRITE_help = "Set low-level angle sensor register"
def cmd_ANGLE_DEBUG_WRITE(self, gcmd):
reg = gcmd.get("REG", minval=0, maxval=0x30, parser=lambda x: int(x, 0))
val = gcmd.get("VAL", minval=0, maxval=0xffff,
parser=lambda x: int(x, 0))
self._write_reg(reg, val)
SAMPLE_PERIOD = 0.000400
class Angle:
def __init__(self, config):
self.printer = config.get_printer()
self.sample_period = config.getfloat('sample_period', SAMPLE_PERIOD,
above=0.)
self.calibration = AngleCalibration(config)
# Measurement conversion
self.start_clock = self.time_shift = self.sample_ticks = 0
self.last_sequence = self.last_angle = 0
# Measurement storage (accessed from background thread)
self.lock = threading.Lock()
self.raw_samples = []
# Sensor type
sensors = { "a1333": HelperA1333, "as5047d": HelperAS5047D,
"tle5012b": HelperTLE5012B }
sensor_type = config.getchoice('sensor_type', {s: s for s in sensors})
sensor_class = sensors[sensor_type]
self.spi = bus.MCU_SPI_from_config(config, sensor_class.SPI_MODE,
default_speed=sensor_class.SPI_SPEED)
self.mcu = mcu = self.spi.get_mcu()
self.oid = oid = mcu.create_oid()
self.sensor_helper = sensor_class(config, self.spi, oid)
# Setup mcu sensor_spi_angle bulk query code
self.query_spi_angle_cmd = self.query_spi_angle_end_cmd = None
mcu.add_config_cmd(
"config_spi_angle oid=%d spi_oid=%d spi_angle_type=%s"
% (oid, self.spi.get_oid(), sensor_type))
mcu.add_config_cmd(
"query_spi_angle oid=%d clock=0 rest_ticks=0 time_shift=0"
% (oid,), on_restart=True)
mcu.register_config_callback(self._build_config)
mcu.register_response(self._handle_spi_angle_data,
"spi_angle_data", oid)
# API server endpoints
self.api_dump = motion_report.APIDumpHelper(
self.printer, self._api_update, self._api_startstop, 0.100)
self.name = config.get_name().split()[1]
wh = self.printer.lookup_object('webhooks')
wh.register_mux_endpoint("angle/dump_angle", "sensor", self.name,
self._handle_dump_angle)
def _build_config(self):
freq = self.mcu.seconds_to_clock(1.)
while float(TCODE_ERROR << self.time_shift) / freq < 0.002:
self.time_shift += 1
cmdqueue = self.spi.get_command_queue()
self.query_spi_angle_cmd = self.mcu.lookup_command(
"query_spi_angle oid=%c clock=%u rest_ticks=%u time_shift=%c",
cq=cmdqueue)
self.query_spi_angle_end_cmd = self.mcu.lookup_query_command(
"query_spi_angle oid=%c clock=%u rest_ticks=%u time_shift=%c",
"spi_angle_end oid=%c sequence=%hu", oid=self.oid, cq=cmdqueue)
def get_status(self, eventtime=None):
return {'temperature': self.sensor_helper.last_temperature}
# Measurement collection
def is_measuring(self):
return self.start_clock != 0
def _handle_spi_angle_data(self, params):
with self.lock:
self.raw_samples.append(params)
def _extract_samples(self, raw_samples):
# Load variables to optimize inner loop below
sample_ticks = self.sample_ticks
start_clock = self.start_clock
clock_to_print_time = self.mcu.clock_to_print_time
last_sequence = self.last_sequence
last_angle = self.last_angle
time_shift = 0
static_delay = 0.
last_chip_mcu_clock = last_chip_clock = chip_freq = inv_chip_freq = 0.
is_tcode_absolute = self.sensor_helper.is_tcode_absolute
if is_tcode_absolute:
tparams = self.sensor_helper.get_tcode_params()
last_chip_mcu_clock, last_chip_clock, chip_freq = tparams
inv_chip_freq = 1. / chip_freq
else:
time_shift = self.time_shift
static_delay = self.sensor_helper.get_static_delay()
# Process every message in raw_samples
count = error_count = 0
samples = [None] * (len(raw_samples) * 16)
for params in raw_samples:
seq = (last_sequence & ~0xffff) | params['sequence']
if seq < last_sequence:
seq += 0x10000
last_sequence = seq
d = bytearray(params['data'])
msg_mclock = start_clock + seq*16*sample_ticks
for i in range(len(d) // 3):
tcode = d[i*3]
if tcode == TCODE_ERROR:
error_count += 1
continue
raw_angle = d[i*3 + 1] | (d[i*3 + 2] << 8)
angle_diff = (last_angle - raw_angle) & 0xffff
angle_diff -= (angle_diff & 0x8000) << 1
last_angle -= angle_diff
mclock = msg_mclock + i*sample_ticks
if is_tcode_absolute:
# tcode is tle5012b frame counter
mdiff = mclock - last_chip_mcu_clock
chip_mclock = last_chip_clock + int(mdiff * chip_freq + .5)
cdiff = ((tcode << 10) - chip_mclock) & 0xffff
cdiff -= (cdiff & 0x8000) << 1
sclock = mclock + (cdiff - 0x800) * inv_chip_freq
else:
# tcode is mcu clock offset shifted by time_shift
sclock = mclock + (tcode<<time_shift)
ptime = round(clock_to_print_time(sclock) - static_delay, 6)
samples[count] = (ptime, last_angle)
count += 1
self.last_sequence = last_sequence
self.last_angle = last_angle
del samples[count:]
return samples, error_count
# API interface
def _api_update(self, eventtime):
if self.sensor_helper.is_tcode_absolute:
self.sensor_helper.update_clock()
with self.lock:
raw_samples = self.raw_samples
self.raw_samples = []
if not raw_samples:
return {}
samples, error_count = self._extract_samples(raw_samples)
if not samples:
return {}
offset = self.calibration.apply_calibration(samples)
return {'data': samples, 'errors': error_count,
'position_offset': offset}
def _start_measurements(self):
if self.is_measuring():
return
logging.info("Starting angle '%s' measurements", self.name)
self.sensor_helper.start()
# Start bulk reading
with self.lock:
self.raw_samples = []
self.last_sequence = 0
systime = self.printer.get_reactor().monotonic()
print_time = self.mcu.estimated_print_time(systime) + MIN_MSG_TIME
self.start_clock = reqclock = self.mcu.print_time_to_clock(print_time)
rest_ticks = self.mcu.seconds_to_clock(self.sample_period)
self.sample_ticks = rest_ticks
self.query_spi_angle_cmd.send([self.oid, reqclock, rest_ticks,
self.time_shift], reqclock=reqclock)
def _finish_measurements(self):
if not self.is_measuring():
return
# Halt bulk reading
params = self.query_spi_angle_end_cmd.send([self.oid, 0, 0, 0])
self.start_clock = 0
with self.lock:
self.raw_samples = []
self.sensor_helper.last_temperature = None
logging.info("Stopped angle '%s' measurements", self.name)
def _api_startstop(self, is_start):
if is_start:
self._start_measurements()
else:
self._finish_measurements()
def _handle_dump_angle(self, web_request):
self.api_dump.add_client(web_request)
hdr = ('time', 'angle')
web_request.send({'header': hdr})
def start_internal_client(self):
return self.api_dump.add_internal_client()
def load_config_prefix(config):
return Angle(config)

View File

@ -221,7 +221,8 @@ class BedMesh:
"mesh_min": (0., 0.), "mesh_min": (0., 0.),
"mesh_max": (0., 0.), "mesh_max": (0., 0.),
"probed_matrix": [[]], "probed_matrix": [[]],
"mesh_matrix": [[]] "mesh_matrix": [[]],
"profiles": self.pmgr.get_profiles()
} }
if self.z_mesh is not None: if self.z_mesh is not None:
params = self.z_mesh.get_mesh_params() params = self.z_mesh.get_mesh_params()
@ -316,7 +317,7 @@ class BedMeshCalibrate:
if self.radius is not None: if self.radius is not None:
# round bed, min/max needs to be recalculated # round bed, min/max needs to be recalculated
y_dist = x_dist y_dist = x_dist
new_r = (x_cnt / 2) * x_dist new_r = (x_cnt // 2) * x_dist
min_x = min_y = -new_r min_x = min_y = -new_r
max_x = max_y = new_r max_x = max_y = new_r
else: else:
@ -1134,6 +1135,8 @@ class ProfileManager:
self._check_incompatible_profiles() self._check_incompatible_profiles()
if "default" in self.profiles: if "default" in self.profiles:
self.load_profile("default") self.load_profile("default")
def get_profiles(self):
return self.profiles
def get_current_profile(self): def get_current_profile(self):
return self.current_profile return self.current_profile
def _check_incompatible_profiles(self): def _check_incompatible_profiles(self):
@ -1170,9 +1173,12 @@ class ProfileManager:
for key, value in mesh_params.items(): for key, value in mesh_params.items():
configfile.set(cfg_name, key, value) configfile.set(cfg_name, key, value)
# save copy in local storage # save copy in local storage
self.profiles[prof_name] = profile = {} # ensure any self.profiles returned as status remains immutable
profiles = dict(self.profiles)
profiles[prof_name] = profile = {}
profile['points'] = probed_matrix profile['points'] = probed_matrix
profile['mesh_params'] = collections.OrderedDict(mesh_params) profile['mesh_params'] = collections.OrderedDict(mesh_params)
self.profiles = profiles
self.current_profile = prof_name self.current_profile = prof_name
self.gcode.respond_info( self.gcode.respond_info(
"Bed Mesh state has been saved to profile [%s]\n" "Bed Mesh state has been saved to profile [%s]\n"
@ -1197,7 +1203,9 @@ class ProfileManager:
if prof_name in self.profiles: if prof_name in self.profiles:
configfile = self.printer.lookup_object('configfile') configfile = self.printer.lookup_object('configfile')
configfile.remove_section('bed_mesh ' + prof_name) configfile.remove_section('bed_mesh ' + prof_name)
del self.profiles[prof_name] profiles = dict(self.profiles)
del profiles[prof_name]
self.profiles = profiles
self.gcode.respond_info( self.gcode.respond_info(
"Profile [%s] removed from storage for this session.\n" "Profile [%s] removed from storage for this session.\n"
"The SAVE_CONFIG command will update the printer\n" "The SAVE_CONFIG command will update the printer\n"

View File

@ -437,7 +437,7 @@ class BME280:
else: else:
factor = 0 factor = 0
while duration_ms > 0x3F: while duration_ms > 0x3F:
duration_ms /= 4 duration_ms //= 4
factor += 1 factor += 1
duration_reg = duration_ms + (factor * 64) duration_reg = duration_ms + (factor * 64)

View File

@ -48,7 +48,8 @@ def resolve_bus_name(mcu, param, bus):
# Helper code for working with devices connected to an MCU via an SPI bus # Helper code for working with devices connected to an MCU via an SPI bus
class MCU_SPI: class MCU_SPI:
def __init__(self, mcu, bus, pin, mode, speed, sw_pins=None): def __init__(self, mcu, bus, pin, mode, speed, sw_pins=None,
cs_active_high=False):
self.mcu = mcu self.mcu = mcu
self.bus = bus self.bus = bus
# Config SPI object (set all CS pins high before spi_set_bus commands) # Config SPI object (set all CS pins high before spi_set_bus commands)
@ -56,7 +57,8 @@ class MCU_SPI:
if pin is None: if pin is None:
mcu.add_config_cmd("config_spi_without_cs oid=%d" % (self.oid,)) mcu.add_config_cmd("config_spi_without_cs oid=%d" % (self.oid,))
else: else:
mcu.add_config_cmd("config_spi oid=%d pin=%s" % (self.oid, pin)) mcu.add_config_cmd("config_spi oid=%d pin=%s cs_active_high=%d"
% (self.oid, pin, cs_active_high))
# Generate SPI bus config message # Generate SPI bus config message
if sw_pins is not None: if sw_pins is not None:
self.config_fmt = ( self.config_fmt = (
@ -112,7 +114,8 @@ class MCU_SPI:
# Helper to setup an spi bus from settings in a config section # Helper to setup an spi bus from settings in a config section
def MCU_SPI_from_config(config, mode, pin_option="cs_pin", def MCU_SPI_from_config(config, mode, pin_option="cs_pin",
default_speed=100000, share_type=None): default_speed=100000, share_type=None,
cs_active_high=False):
# Determine pin from config # Determine pin from config
ppins = config.get_printer().lookup_object("pins") ppins = config.get_printer().lookup_object("pins")
cs_pin = config.get(pin_option) cs_pin = config.get(pin_option)
@ -139,7 +142,7 @@ def MCU_SPI_from_config(config, mode, pin_option="cs_pin",
bus = config.get('spi_bus', None) bus = config.get('spi_bus', None)
sw_pins = None sw_pins = None
# Create MCU_SPI object # Create MCU_SPI object
return MCU_SPI(mcu, bus, pin, mode, speed, sw_pins) return MCU_SPI(mcu, bus, pin, mode, speed, sw_pins, cs_active_high)
###################################################################### ######################################################################

View File

@ -0,0 +1,25 @@
# SPI DAC DAC084S085 implementation
#
# Copyright (C) 2021 Lorenzo Franco <lorenzo.franco@lorenzing.com>
#
# This file may be distributed under the terms of the GNU GPLv3 license.
from . import bus
class dac084S085:
def __init__(self, config):
self.spi = bus.MCU_SPI_from_config(
config, 1, pin_option="enable_pin", default_speed=10000000)
scale = config.getfloat('scale', 1., above=0.)
for chan, name in enumerate("ABCD"):
val = config.getfloat('channel_%s' % (name,), None,
minval=0., maxval=scale)
if val is not None:
self.set_register(chan, int(val * 255. / scale))
def set_register(self, chan, value):
b1 = (chan << 6) | (1 << 4) | ((value >> 4) & 0x0f)
b2 = (value << 4) & 0xf0
self.spi.spi_send([b1, b2])
def load_config_prefix(config):
return dac084S085(config)

View File

@ -76,7 +76,9 @@ class DGUSStatus:
if self.finish_at is not None: if self.finish_at is not None:
self.finish_at += pause_duration self.finish_at += pause_duration
if self.finish_at_naive is not None: if self.finish_at_naive is not None:
self.finish_at_naive = (self.finish_at_naive[0], self.finish_at_naive[1] + pause_duration) self.finish_at_naive = (self.finish_at_naive[0],
self.finish_at_naive[1]
+ pause_duration)
self.pause_at = None self.pause_at = None
return eventtime + 5. return eventtime + 5.

Some files were not shown because too many files have changed in this diff Show More