Compare commits
293 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
6c55db296a | ||
|
a2ea1a9985 | ||
|
4d8dc093c9 | ||
|
11d8c72ac5 | ||
|
ec79034004 | ||
|
ae2a0036eb | ||
|
e2eef1256a | ||
|
a0a93e35ae | ||
|
2325bede8a | ||
|
56cd747c8b | ||
|
48098b1675 | ||
|
f6a6704b66 | ||
|
5e3e8fcdb9 | ||
|
0949c0f326 | ||
|
81f31efaee | ||
|
c49e987b1e | ||
|
3572fa22a0 | ||
|
1d1dc8e339 | ||
|
bbfbcb8a5d | ||
|
44d400db83 | ||
|
4a71285c34 | ||
|
6357619ab2 | ||
|
e3611ad209 | ||
|
95d5a0c480 | ||
|
838a420e27 | ||
|
248b7dfa59 | ||
|
0d166f9c7d | ||
|
86c18ea6e0 | ||
|
b7a67f6f74 | ||
|
1c042bbaea | ||
|
899db41a5c | ||
|
2ef6b86ccd | ||
|
342f65eb8e | ||
|
0eae26a7be | ||
|
fd346c6cd1 | ||
|
d3a8a81756 | ||
|
b7f86bffd5 | ||
|
79810b7fcb | ||
|
84c874c53b | ||
|
04d64351a2 | ||
|
c8ac908db2 | ||
|
b57ef4b261 | ||
|
1a5cbc9052 | ||
|
f36225c3e0 | ||
|
97b5a5f469 | ||
|
a1f5245e27 | ||
|
ef8f829513 | ||
|
d9cdb4ae19 | ||
|
451062553e | ||
|
0fcf2b1110 | ||
|
f36f084465 | ||
|
f6468f0af3 | ||
|
439e73d79c | ||
|
0547d9d651 | ||
|
3b34fbd4c4 | ||
|
a05a65e7d2 | ||
|
aec211fc80 | ||
|
1084068a3e | ||
|
e9ae585647 | ||
|
dda76e50a9 | ||
|
37849969ad | ||
|
707349d492 | ||
|
f6a6839a82 | ||
|
79c2f05e7d | ||
|
4dca6d50c0 | ||
|
23fc81f1af | ||
|
d035bfb1a9 | ||
|
80400ab3f8 | ||
|
a338dce83f | ||
|
4108c5d01f | ||
|
9520e5121c | ||
|
e94f782f51 | ||
|
6d1f6a9516 | ||
|
a578749622 | ||
|
0d0dfba203 | ||
|
91a399ae7f | ||
|
2b9eb4437b | ||
|
5bd66241df | ||
|
1bb1ce7475 | ||
|
c305c2cc6b | ||
|
b310047ded | ||
|
bda4957f9b | ||
|
f10d3564e1 | ||
|
bc483b2354 | ||
|
2d7f94cae1 | ||
|
7481563bd9 | ||
|
bd550bb45a | ||
|
b419ca254b | ||
|
7eed008e8e | ||
|
53dfeed6c0 | ||
|
ef513ef7fb | ||
|
7b304cee16 | ||
|
ea7363a8f4 | ||
|
8e1a21cf53 | ||
|
fc773c2784 | ||
|
bfe4ceedd1 | ||
|
ffd8b595d1 | ||
|
1457e40208 | ||
|
1ad53cee1f | ||
|
53f1e5ff5b | ||
|
0e6ef65aec | ||
|
ccdeb3f2cd | ||
|
ee17051933 | ||
|
c4ffe74d71 | ||
|
55b2af9464 | ||
|
b4ee420a37 | ||
|
f926351fa8 | ||
|
51f2733b7f | ||
|
fc4a42bbdc | ||
|
89ccd463d7 | ||
|
473d640e88 | ||
|
57499291d3 | ||
|
56e51efeea | ||
|
d22eb261cf | ||
|
fbf2f36cae | ||
|
536778812f | ||
|
e8941d2bd8 | ||
|
d854c8fa5f | ||
|
e9a97127f7 | ||
|
0391e5bcc7 | ||
|
d02a867424 | ||
|
2d820e6204 | ||
|
f9f7697b96 | ||
|
409d7378d9 | ||
|
669fe74096 | ||
|
36d08f8ad3 | ||
|
8a7661df89 | ||
|
6e658a7c04 | ||
|
95046c9047 | ||
|
5beca89412 | ||
|
5ac9d9754e | ||
|
5e7943f19f | ||
|
5a5e1d0401 | ||
|
a88b91b3ed | ||
|
5c4c052fd7 | ||
|
d26c32375e | ||
|
994c695862 | ||
|
f154e94981 | ||
|
b7f8163291 | ||
|
675295692b | ||
|
d1e55a2d1d | ||
|
5e1f0e5e90 | ||
|
bdcccee203 | ||
|
d70dad6807 | ||
|
93e35880ce | ||
|
9b970cf12f | ||
|
022b6b9067 | ||
|
fc07b0ea30 | ||
|
a484adcb30 | ||
|
31679640c0 | ||
|
3469a0a1a0 | ||
|
38c0f800d6 | ||
|
57e37b6c24 | ||
|
07509febcd | ||
|
e593da1c23 | ||
|
7f87a044cd | ||
|
b841b9bd01 | ||
|
ceeba58dc9 | ||
|
a49c6608c9 | ||
|
9903bc8d36 | ||
|
aa4db785f2 | ||
|
00e27503ce | ||
|
f7e3a5ad85 | ||
|
3cade6245e | ||
|
d7aee3b7b6 | ||
|
64fdc4f24b | ||
|
295aa3d60d | ||
|
1d0452c41e | ||
|
96a5e64bb8 | ||
|
595e684658 | ||
|
21dc07c40a | ||
|
cda363a15e | ||
|
9f44452834 | ||
|
7a50dbc00d | ||
|
3162d378ff | ||
|
d129ac1b37 | ||
|
1ea529b9c1 | ||
|
5ffabd56eb | ||
|
d0e1166cce | ||
|
5b75a018b7 | ||
|
c75b560604 | ||
|
a2cda631d9 | ||
|
a7b0b390cd | ||
|
9ff2d34bf8 | ||
|
92ad973729 | ||
|
0be8b22d3c | ||
|
4e1f2f89f6 | ||
|
ac32ed74b4 | ||
|
89f9902053 | ||
|
c6f7ea9f22 | ||
|
747b2b9bf4 | ||
|
23bdc1556d | ||
|
ec03e46ffa | ||
|
47edbd9220 | ||
|
00c83e9ca6 | ||
|
832321f55d | ||
|
941a09b6ac | ||
|
16787c94af | ||
|
28d83b42e1 | ||
|
23c5266076 | ||
|
0673f335e1 | ||
|
1c9ccce520 | ||
|
9c021158e5 | ||
|
254d352fca | ||
|
baa101253a | ||
|
a333bba725 | ||
|
2230ef6e09 | ||
|
24eaf2d7e0 | ||
|
f4196d394b | ||
|
ebdf8b6b1a | ||
|
59f9bb2120 | ||
|
f339a39654 | ||
|
a3d88aebed | ||
|
d5bc5547ee | ||
|
f8065da48f | ||
|
127fb9860c | ||
|
c5179cffb4 | ||
|
0d8c81b2a6 | ||
|
856013cc0f | ||
|
0b6c2d893e | ||
|
b6d857f1d6 | ||
|
2e235aff03 | ||
|
87992f3669 | ||
|
64ebec50dc | ||
|
e3b02757d3 | ||
|
70325a6a0f | ||
|
d81de7f521 | ||
|
deff538909 | ||
|
a9a78f2831 | ||
|
10f7bbee32 | ||
|
b49a0e39d5 | ||
|
53f77dfadf | ||
|
937dca4432 | ||
|
bbe0ffb2fa | ||
|
1bad8f1b17 | ||
|
5f06f42ccd | ||
|
e5edbf9d35 | ||
|
865071a946 | ||
|
329f5b4df9 | ||
|
dcdaa2025f | ||
|
0400783444 | ||
|
768a1d2713 | ||
|
711fb26ae5 | ||
|
7f15968ce7 | ||
|
262ff9584c | ||
|
af4c62b422 | ||
|
4a6f625f86 | ||
|
e0c71344ed | ||
|
42a336f8bc | ||
|
a0badf572e | ||
|
a358b72ec8 | ||
|
6e8dcba698 | ||
|
9d6b2ebf50 | ||
|
dc8d8cb39c | ||
|
509e1ab053 | ||
|
e9dadacf7b | ||
|
6a514a1e8e | ||
|
1ea78cdd69 | ||
|
303ddb862a | ||
|
f3d64b7115 | ||
|
98382fcea5 | ||
|
629c039eed | ||
|
2a7f1091ce | ||
|
3d4aa015a8 | ||
|
6b53431116 | ||
|
e45c4d6aa3 | ||
|
7b512742f4 | ||
|
b065a60dd0 | ||
|
ae3504594c | ||
|
edc671edea | ||
|
50688f03fb | ||
|
98814e1c47 | ||
|
23d1801022 | ||
|
c2342c3528 | ||
|
96cf556139 | ||
|
31fdaea269 | ||
|
1c48817a47 | ||
|
0d52eaa875 | ||
|
5ebef425ce | ||
|
5dfa152ba2 | ||
|
1c4f672eae | ||
|
1bcd47e65f | ||
|
1465fc0632 | ||
|
07a61057ba | ||
|
39fcb5b5f8 | ||
|
bb5717c5b3 | ||
|
f3155af444 | ||
|
ab61c09bff | ||
|
a087a653cd | ||
|
b65ab21733 | ||
|
37df0c1f22 | ||
|
7f8ca85e69 | ||
|
f64649933f |
4
.github/FUNDING.yml
vendored
4
.github/FUNDING.yml
vendored
@@ -1 +1,3 @@
|
||||
custom: http://www.thinkyhead.com/donate-to-marlin
|
||||
github: [thinkyhead]
|
||||
patreon: thinkyhead
|
||||
custom: ["http://www.thinkyhead.com/donate-to-marlin"]
|
||||
|
37
.github/issue_template.md
vendored
37
.github/issue_template.md
vendored
@@ -1,16 +1,31 @@
|
||||
# NO SUPPORT REQUESTS PLEASE
|
||||
<!--
|
||||
|
||||
Support Requests posted here will be automatically closed!
|
||||
Have you read Marlin's Code of Conduct? By filing an Issue, you are expected to comply with it, including treating everyone with respect: https://github.com/MarlinFirmware/Marlin/blob/bugfix-2.0.x/.github/code_of_conduct.md
|
||||
|
||||
This Issue Queue is for Marlin bug reports and development-related issues, and we prefer not to handle user-support questions here. See https://github.com/MarlinFirmware/Marlin/blob/1.1.x/.github/contributing.md#i-dont-want-to-read-this-whole-thing-i-just-have-a-question.
|
||||
Do you want to ask a question? Are you looking for support? Please don't post here. Instead please use the Marlin Firmware forum at http://forums.reprap.org/list.php?415 or the Marlin Facebook Group https://www.facebook.com/groups/1049718498464482/ or the Marlin Discord Server https://discord.gg/n5NJ59y.
|
||||
|
||||
For best results getting help with configuration and troubleshooting, please use the following resources:
|
||||
Before filing an issue be sure to test the 1.1 and/or 2.0 "bugfix" branches to see whether the issue is already addressed.
|
||||
|
||||
- RepRap.org Marlin Forum http://forums.reprap.org/list.php?415
|
||||
- Tom's 3D Forums https://discuss.toms3d.org/
|
||||
- Facebook Group "Marlin Firmware" https://www.facebook.com/groups/1049718498464482/
|
||||
- Facebook Group "Marlin Firmware for 3D Printers" https://www.facebook.com/groups/3Dtechtalk/
|
||||
- Marlin Configuration https://www.youtube.com/results?search_query=marlin+configuration on YouTube
|
||||
- Marlin Discord server. Join link: https://discord.gg/n5NJ59y
|
||||
-->
|
||||
|
||||
After seeking help from the community, if the consensus points to to a bug in Marlin, then you should post a Bug Report at https://github.com/MarlinFirmware/Marlin/issues/new/choose).
|
||||
### Description
|
||||
|
||||
<!-- Description of the bug or requested feature -->
|
||||
|
||||
### Steps to Reproduce
|
||||
|
||||
<!-- If this is a Bug Report, please describe the steps needed to reproduce the issue -->
|
||||
|
||||
1. [First Step]
|
||||
2. [Second Step]
|
||||
3. [and so on...]
|
||||
|
||||
**Expected behavior:** [What you expect to happen]
|
||||
|
||||
**Actual behavior:** [What actually happens]
|
||||
|
||||
#### Additional Information
|
||||
|
||||
* Include a ZIP file containing your `Configuration.h` and `Configuration_adv.h` files.
|
||||
* Provide pictures or links to videos that clearly demonstrate the issue.
|
||||
* See [How Can I Contribute](#how-can-i-contribute) for additional guidelines.
|
||||
|
18
.github/labeler.yml
vendored
Normal file
18
.github/labeler.yml
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
# Add '@domain/core' label to any change within the 'core' package
|
||||
enhancement:
|
||||
- .github
|
||||
|
||||
# Add 'test' label to any change to *.spec.js files within the source dir
|
||||
"C: Motion":
|
||||
- src/module/motion.*
|
||||
- src/module/planner.*
|
||||
- src/module/stepper.*
|
||||
|
||||
"C: G-code Parser":
|
||||
- src/gcode/**
|
||||
|
||||
"PR: Configurations":
|
||||
- config/examples/**
|
||||
|
||||
"T: 32-Bit & HAL":
|
||||
- src/HAL/**
|
34
.github/workflows/bump-date.yml
vendored
Normal file
34
.github/workflows/bump-date.yml
vendored
Normal file
@@ -0,0 +1,34 @@
|
||||
#
|
||||
# bump-date.yml
|
||||
# Bump the distribution date once per day
|
||||
#
|
||||
|
||||
name: Bump Distribution Date
|
||||
|
||||
on:
|
||||
schedule:
|
||||
- cron: '0 0 * * *'
|
||||
|
||||
jobs:
|
||||
bump_date:
|
||||
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
|
||||
- name: Check out bugfix-2.0.x
|
||||
uses: actions/checkout@v2
|
||||
with:
|
||||
ref: bugfix-2.0.x
|
||||
|
||||
- name: Bump Distribution Date
|
||||
run: |
|
||||
# Inline Bump Script
|
||||
[[ "$GITHUB_REPOSITORY" == "MarlinFirmware/Marlin" ]] || exit 0
|
||||
DIST=$( date +"%Y-%m-%d" )
|
||||
eval "sed -E -i 's/(#define +STRING_DISTRIBUTION_DATE) .*$/\1 \"$DIST\"/g' Marlin/src/inc/Version.h" && \
|
||||
git config user.name "${GITHUB_ACTOR}" && \
|
||||
git config user.email "${GITHUB_ACTOR}@users.noreply.github.com" && \
|
||||
git add . && \
|
||||
git commit -m "[cron] Bump distribution date ($DIST)" && \
|
||||
git push
|
31
.github/workflows/check-pr.yml
vendored
Normal file
31
.github/workflows/check-pr.yml
vendored
Normal file
@@ -0,0 +1,31 @@
|
||||
#
|
||||
# check-pr.yml
|
||||
# Add a comment to the PR if it's directed to a release branch
|
||||
#
|
||||
|
||||
name: Check PR
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
branches:
|
||||
- 1.0.x
|
||||
- 1.1.x
|
||||
- 2.0.x
|
||||
|
||||
jobs:
|
||||
check_pr:
|
||||
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Comment on PR
|
||||
uses: unsplash/comment-on-pr@master
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
with:
|
||||
msg: "<p>Thanks for your contribution! \
|
||||
Unfortunately we can't accept PRs directed at release branches. \
|
||||
We make patches to the bugfix branches and only later do we push them out as releases. \
|
||||
Please redo this PR starting with the `bugfix-2.0.x` branch and be careful to target `bugfix-2.0.x` when resubmitting the PR.</p> \
|
||||
<p>It may help to set your fork's default branch to `bugfix-2.0.x`.</p> \
|
||||
<p>See <a href='http://marlinfw.org/docs/development/getting_started_pull_requests.html' target='_blank'>this page</a> for full instructions.</p>"
|
23
.github/workflows/label-pr.yml
vendored
Normal file
23
.github/workflows/label-pr.yml
vendored
Normal file
@@ -0,0 +1,23 @@
|
||||
#
|
||||
# label-pr.yml
|
||||
# Automatically close the PR if it's directed to a release branch
|
||||
#
|
||||
|
||||
name: Apply Labels
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
branches:
|
||||
- bugfix-1.1.x
|
||||
- bugfix-2.0.x
|
||||
- dev-2.1.x
|
||||
|
||||
jobs:
|
||||
apply_labels:
|
||||
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/labeler@v2
|
||||
with:
|
||||
repo-token: "${{ secrets.GITHUB_TOKEN }}"
|
103
.github/workflows/test-builds.yml
vendored
Normal file
103
.github/workflows/test-builds.yml
vendored
Normal file
@@ -0,0 +1,103 @@
|
||||
#
|
||||
# test-builds.yml
|
||||
# Do test builds to catch compile errors
|
||||
#
|
||||
|
||||
name: CI
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
branches:
|
||||
- bugfix-2.0.x
|
||||
- dev-2.1.x
|
||||
paths-ignore:
|
||||
- config/**
|
||||
- data/**
|
||||
- docs/**
|
||||
- '**/*.md'
|
||||
|
||||
jobs:
|
||||
test_builds:
|
||||
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
strategy:
|
||||
matrix:
|
||||
test-platform:
|
||||
# Base Environments
|
||||
|
||||
- DUE
|
||||
- esp32
|
||||
- linux_native
|
||||
- megaatmega2560
|
||||
- teensy31
|
||||
- teensy35
|
||||
|
||||
# Extended AVR Environments
|
||||
|
||||
- FYSETC_F6_13
|
||||
- megaatmega1280
|
||||
- rambo
|
||||
- sanguino_atmega1284p
|
||||
- sanguino_atmega644p
|
||||
|
||||
# Extended STM32 Environments
|
||||
|
||||
- STM32F103RC_bigtree
|
||||
- STM32F103RC_bigtree_USB
|
||||
- STM32F103RE_bigtree
|
||||
- STM32F103RE_bigtree_USB
|
||||
- STM32F103RC_fysetc
|
||||
- jgaurora_a5s_a1
|
||||
- STM32F103VE_longer
|
||||
- STM32F407VE_black
|
||||
- BIGTREE_SKR_PRO
|
||||
- mks_robin
|
||||
- ARMED
|
||||
- FYSETC_S6
|
||||
|
||||
# Put lengthy tests last
|
||||
|
||||
- LPC1768
|
||||
- LPC1769
|
||||
|
||||
# STM32 with non-STM framework. both broken for now. they should use HAL_STM32 which is working.
|
||||
|
||||
#- STM32F4
|
||||
#- STM32F7
|
||||
|
||||
# Non-working environment tests
|
||||
|
||||
#- BIGTREE_BTT002
|
||||
#- at90usb1286_cdc
|
||||
#- at90usb1286_dfu
|
||||
#- STM32F103CB_malyan
|
||||
#- mks_robin_lite
|
||||
#- mks_robin_mini
|
||||
#- mks_robin_nano
|
||||
#- SAMD51_grandcentral_m4
|
||||
|
||||
steps:
|
||||
|
||||
- name: Select Python 3.7
|
||||
uses: actions/setup-python@v1
|
||||
with:
|
||||
python-version: '3.7' # Version range or exact version of a Python version to use, using semvers version range syntax.
|
||||
architecture: 'x64' # optional x64 or x86. Defaults to x64 if not specified
|
||||
|
||||
- name: Install PlatformIO
|
||||
run: |
|
||||
pip install -U https://github.com/platformio/platformio-core/archive/master.zip
|
||||
platformio update
|
||||
|
||||
- name: Check out the PR
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: Run ${{ matrix.test-platform }} Tests
|
||||
run: |
|
||||
# Inline tests script
|
||||
[[ "$GITHUB_REPOSITORY" == "MarlinFirmware/Marlin" ]] || exit 0
|
||||
chmod +x buildroot/bin/*
|
||||
chmod +x buildroot/share/tests/*
|
||||
export PATH=./buildroot/bin/:./buildroot/share/tests/:${PATH}
|
||||
run_tests . ${{ matrix.test-platform }}
|
84
.travis.yml
84
.travis.yml
@@ -1,84 +0,0 @@
|
||||
dist: bionic
|
||||
sudo: false
|
||||
|
||||
language: python
|
||||
python:
|
||||
- "3.7"
|
||||
|
||||
notifications:
|
||||
email: false
|
||||
|
||||
env:
|
||||
# Base Environments
|
||||
- TEST_PLATFORM="DUE"
|
||||
- TEST_PLATFORM="esp32"
|
||||
- TEST_PLATFORM="linux_native"
|
||||
- TEST_PLATFORM="megaatmega2560"
|
||||
- TEST_PLATFORM="teensy31"
|
||||
- TEST_PLATFORM="teensy35"
|
||||
|
||||
# Extended AVR Environments
|
||||
- TEST_PLATFORM="FYSETC_F6_13"
|
||||
- TEST_PLATFORM="megaatmega1280"
|
||||
- TEST_PLATFORM="rambo"
|
||||
- TEST_PLATFORM="sanguino_atmega1284p"
|
||||
- TEST_PLATFORM="sanguino_atmega644p"
|
||||
|
||||
# Extended STM32 Environments
|
||||
- TEST_PLATFORM="STM32F103RC_bigtree"
|
||||
- TEST_PLATFORM="STM32F103RC_bigtree_USB"
|
||||
- TEST_PLATFORM="STM32F103RE_bigtree"
|
||||
- TEST_PLATFORM="STM32F103RE_bigtree_USB"
|
||||
- TEST_PLATFORM="STM32F103RC_fysetc"
|
||||
- TEST_PLATFORM="jgaurora_a5s_a1"
|
||||
- TEST_PLATFORM="STM32F103VE_longer"
|
||||
- TEST_PLATFORM="STM32F407VE_black"
|
||||
- TEST_PLATFORM="BIGTREE_SKR_PRO"
|
||||
- TEST_PLATFORM="mks_robin"
|
||||
- TEST_PLATFORM="ARMED"
|
||||
|
||||
# STM32 with non-STM framework. both broken for now. they should use HAL_STM32 which is working.
|
||||
#- TEST_PLATFORM="STM32F4"
|
||||
#- TEST_PLATFORM="STM32F7"
|
||||
|
||||
# Put lengthy tests last
|
||||
- TEST_PLATFORM="LPC1768"
|
||||
- TEST_PLATFORM="LPC1769"
|
||||
|
||||
# Non-working environment tests
|
||||
#- TEST_PLATFORM="BIGTREE_BTT002" this board isn't released yet. we need pinout to be sure about what we do
|
||||
#- TEST_PLATFORM="at90usb1286_cdc"
|
||||
#- TEST_PLATFORM="at90usb1286_dfu"
|
||||
#- TEST_PLATFORM="STM32F103CB_malyan"
|
||||
#- TEST_PLATFORM="mks_robin_lite"
|
||||
#- TEST_PLATFORM="mks_robin_mini"
|
||||
#- TEST_PLATFORM="mks_robin_nano"
|
||||
#- TEST_PLATFORM="SAMD51_grandcentral_m4"
|
||||
|
||||
before_install:
|
||||
#
|
||||
# Fetch the tag information for the current branch
|
||||
- git fetch origin --tags
|
||||
#
|
||||
# Publish the buildroot script folder
|
||||
- chmod +x ${TRAVIS_BUILD_DIR}/buildroot/bin/*
|
||||
- chmod +x ${TRAVIS_BUILD_DIR}/buildroot/share/tests/*
|
||||
- export PATH=${TRAVIS_BUILD_DIR}/buildroot/bin/:${TRAVIS_BUILD_DIR}/buildroot/share/tests/:${PATH}
|
||||
|
||||
install:
|
||||
#- pip install -U platformio
|
||||
- pip install -U https://github.com/platformio/platformio-core/archive/master.zip
|
||||
|
||||
before_script:
|
||||
# Update PlatformIO packages
|
||||
- platformio update
|
||||
#
|
||||
# Change current working directory to the build dir
|
||||
- cd ${TRAVIS_BUILD_DIR}
|
||||
#
|
||||
# Generate custom version include
|
||||
- generate_version ${TRAVIS_BUILD_DIR}/Marlin/
|
||||
- cat ${TRAVIS_BUILD_DIR}/Marlin/Version.h
|
||||
#
|
||||
script:
|
||||
- run_tests ${TRAVIS_BUILD_DIR} ${TEST_PLATFORM}
|
@@ -143,7 +143,7 @@
|
||||
// @section extruder
|
||||
|
||||
// This defines the number of extruders
|
||||
// :[1, 2, 3, 4, 5, 6]
|
||||
// :[1, 2, 3, 4, 5, 6, 7, 8]
|
||||
#define EXTRUDERS 1
|
||||
|
||||
// Generally expected filament diameter (1.75, 2.85, 3.0, ...). Used for Volumetric, Filament Width Sensor, etc.
|
||||
@@ -360,7 +360,8 @@
|
||||
* -1 : thermocouple with AD595
|
||||
* 0 : not used
|
||||
* 1 : 100k thermistor - best choice for EPCOS 100k (4.7k pullup)
|
||||
* 331 : (3.3V scaled thermistor 1 table)
|
||||
* 331 : (3.3V scaled thermistor 1 table for MEGA)
|
||||
* 332 : (3.3V scaled thermistor 1 table for DUE)
|
||||
* 2 : 200k thermistor - ATC Semitec 204GT-2 (4.7k pullup)
|
||||
* 3 : Mendel-parts thermistor (4.7k pullup)
|
||||
* 4 : 10k thermistor !! do not use it for a hotend. It gives bad resolution at high temp. !!
|
||||
@@ -411,7 +412,10 @@
|
||||
#define TEMP_SENSOR_3 0
|
||||
#define TEMP_SENSOR_4 0
|
||||
#define TEMP_SENSOR_5 0
|
||||
#define TEMP_SENSOR_6 0
|
||||
#define TEMP_SENSOR_7 0
|
||||
#define TEMP_SENSOR_BED 0
|
||||
#define TEMP_SENSOR_PROBE 0
|
||||
#define TEMP_SENSOR_CHAMBER 0
|
||||
|
||||
// Dummy thermistor constant temperature readings, for use with 998 and 999
|
||||
@@ -439,6 +443,8 @@
|
||||
#define HEATER_3_MINTEMP 5
|
||||
#define HEATER_4_MINTEMP 5
|
||||
#define HEATER_5_MINTEMP 5
|
||||
#define HEATER_6_MINTEMP 5
|
||||
#define HEATER_7_MINTEMP 5
|
||||
#define BED_MINTEMP 5
|
||||
|
||||
// Above this temperature the heater will be switched off.
|
||||
@@ -450,6 +456,8 @@
|
||||
#define HEATER_3_MAXTEMP 275
|
||||
#define HEATER_4_MAXTEMP 275
|
||||
#define HEATER_5_MAXTEMP 275
|
||||
#define HEATER_6_MAXTEMP 275
|
||||
#define HEATER_7_MAXTEMP 275
|
||||
#define BED_MAXTEMP 150
|
||||
|
||||
//===========================================================================
|
||||
@@ -654,12 +662,13 @@
|
||||
*
|
||||
* A4988 is assumed for unspecified drivers.
|
||||
*
|
||||
* Options: A4988, A5984, DRV8825, LV8729, L6470, TB6560, TB6600, TMC2100,
|
||||
* Options: A4988, A5984, DRV8825, LV8729, L6470, L6474, POWERSTEP01,
|
||||
* TB6560, TB6600, TMC2100,
|
||||
* TMC2130, TMC2130_STANDALONE, TMC2160, TMC2160_STANDALONE,
|
||||
* TMC2208, TMC2208_STANDALONE, TMC2209, TMC2209_STANDALONE,
|
||||
* TMC26X, TMC26X_STANDALONE, TMC2660, TMC2660_STANDALONE,
|
||||
* TMC5130, TMC5130_STANDALONE, TMC5160, TMC5160_STANDALONE
|
||||
* :['A4988', 'A5984', 'DRV8825', 'LV8729', 'L6470', 'TB6560', 'TB6600', 'TMC2100', 'TMC2130', 'TMC2130_STANDALONE', 'TMC2160', 'TMC2160_STANDALONE', 'TMC2208', 'TMC2208_STANDALONE', 'TMC2209', 'TMC2209_STANDALONE', 'TMC26X', 'TMC26X_STANDALONE', 'TMC2660', 'TMC2660_STANDALONE', 'TMC5130', 'TMC5130_STANDALONE', 'TMC5160', 'TMC5160_STANDALONE']
|
||||
* :['A4988', 'A5984', 'DRV8825', 'LV8729', 'L6470', 'L6474', 'POWERSTEP01', 'TB6560', 'TB6600', 'TMC2100', 'TMC2130', 'TMC2130_STANDALONE', 'TMC2160', 'TMC2160_STANDALONE', 'TMC2208', 'TMC2208_STANDALONE', 'TMC2209', 'TMC2209_STANDALONE', 'TMC26X', 'TMC26X_STANDALONE', 'TMC2660', 'TMC2660_STANDALONE', 'TMC5130', 'TMC5130_STANDALONE', 'TMC5160', 'TMC5160_STANDALONE']
|
||||
*/
|
||||
//#define X_DRIVER_TYPE A4988
|
||||
//#define Y_DRIVER_TYPE A4988
|
||||
@@ -668,12 +677,15 @@
|
||||
//#define Y2_DRIVER_TYPE A4988
|
||||
//#define Z2_DRIVER_TYPE A4988
|
||||
//#define Z3_DRIVER_TYPE A4988
|
||||
//#define Z4_DRIVER_TYPE A4988
|
||||
//#define E0_DRIVER_TYPE A4988
|
||||
//#define E1_DRIVER_TYPE A4988
|
||||
//#define E2_DRIVER_TYPE A4988
|
||||
//#define E3_DRIVER_TYPE A4988
|
||||
//#define E4_DRIVER_TYPE A4988
|
||||
//#define E5_DRIVER_TYPE A4988
|
||||
//#define E6_DRIVER_TYPE A4988
|
||||
//#define E7_DRIVER_TYPE A4988
|
||||
|
||||
// Enable this feature if all enabled endstop pins are interrupt-capable.
|
||||
// This will remove the need to poll the interrupt pins, saving many CPU cycles.
|
||||
@@ -855,6 +867,12 @@
|
||||
*/
|
||||
//#define FIX_MOUNTED_PROBE
|
||||
|
||||
/**
|
||||
* Use the nozzle as the probe, as with a conductive
|
||||
* nozzle system or a piezo-electric smart effector.
|
||||
*/
|
||||
//#define NOZZLE_AS_PROBE
|
||||
|
||||
/**
|
||||
* Z Servo Probe, such as an endstop switch on a rotating arm.
|
||||
*/
|
||||
@@ -897,6 +915,13 @@
|
||||
#define Z_PROBE_RETRACT_X X_MAX_POS
|
||||
#endif
|
||||
|
||||
// Duet Smart Effector (for delta printers) - https://bit.ly/2ul5U7J
|
||||
// When the pin is defined you can use M672 to set/reset the probe sensivity.
|
||||
//#define DUET_SMART_EFFECTOR
|
||||
#if ENABLED(DUET_SMART_EFFECTOR)
|
||||
#define SMART_EFFECTOR_MOD_PIN -1 // Connect a GPIO pin to the Smart Effector MOD pin
|
||||
#endif
|
||||
|
||||
//
|
||||
// For Z_PROBE_ALLEN_KEY see the Delta example configurations.
|
||||
//
|
||||
@@ -923,7 +948,8 @@
|
||||
*/
|
||||
#define NOZZLE_TO_PROBE_OFFSET { 10, 10, 0 }
|
||||
|
||||
// Certain types of probes need to stay away from edges
|
||||
// Most probes should stay away from the edges of the bed, but
|
||||
// with NOZZLE_AS_PROBE this can be negative for a wider probing area.
|
||||
#define MIN_PROBE_EDGE 10
|
||||
|
||||
// X and Y axis travel speed (mm/m) between probes
|
||||
@@ -1033,6 +1059,8 @@
|
||||
#define INVERT_E3_DIR false
|
||||
#define INVERT_E4_DIR false
|
||||
#define INVERT_E5_DIR false
|
||||
#define INVERT_E6_DIR false
|
||||
#define INVERT_E7_DIR false
|
||||
|
||||
// @section homing
|
||||
|
||||
@@ -1418,11 +1446,6 @@
|
||||
#define DEFAULT_KEEPALIVE_INTERVAL 2 // Number of seconds between "busy" messages. Set with M113.
|
||||
#define BUSY_WHILE_HEATING // Some hosts require "busy" messages even during heating
|
||||
|
||||
//
|
||||
// M100 Free Memory Watcher
|
||||
//
|
||||
//#define M100_FREE_MEMORY_WATCHER // Add M100 (Free Memory Watcher) to debug memory usage
|
||||
|
||||
//
|
||||
// G20/G21 Inch mode support
|
||||
//
|
||||
@@ -1513,9 +1536,10 @@
|
||||
// Default number of triangles
|
||||
#define NOZZLE_CLEAN_TRIANGLES 3
|
||||
|
||||
// Specify positions as { X, Y, Z }
|
||||
#define NOZZLE_CLEAN_START_POINT { 30, 30, (Z_MIN_POS + 1) }
|
||||
#define NOZZLE_CLEAN_END_POINT { 100, 60, (Z_MIN_POS + 1) }
|
||||
// Specify positions for each tool as { { X, Y, Z }, { X, Y, Z } }
|
||||
// Dual hotend system may use { { -20, (Y_BED_SIZE / 2), (Z_MIN_POS + 1) }, { 420, (Y_BED_SIZE / 2), (Z_MIN_POS + 1) }}
|
||||
#define NOZZLE_CLEAN_START_POINT { { 30, 30, (Z_MIN_POS + 1) } }
|
||||
#define NOZZLE_CLEAN_END_POINT { { 100, 60, (Z_MIN_POS + 1) } }
|
||||
|
||||
// Circular pattern radius
|
||||
#define NOZZLE_CLEAN_CIRCLE_RADIUS 6.5
|
||||
@@ -1769,7 +1793,7 @@
|
||||
|
||||
//
|
||||
// Makeboard 3D Printer Parts 3D Printer Mini Display 1602 Mini Controller
|
||||
// https://www.aliexpress.com/item/Micromake-Makeboard-3D-Printer-Parts-3D-Printer-Mini-Display-1602-Mini-Controller-Compatible-with-Ramps-1/32765887917.html
|
||||
// https://www.aliexpress.com/item/32765887917.html
|
||||
//
|
||||
//#define MAKEBOARD_MINI_2_LINE_DISPLAY_1602
|
||||
|
||||
@@ -1936,20 +1960,26 @@
|
||||
// FYSETC variant of the MINI12864 graphic controller with SD support
|
||||
// https://wiki.fysetc.com/Mini12864_Panel/
|
||||
//
|
||||
//#define FYSETC_MINI_12864_X_X // Type C/D/E/F. No tunable RGB Backlight by default
|
||||
//#define FYSETC_MINI_12864_1_2 // Type C/D/E/F. Simple RGB Backlight (always on)
|
||||
//#define FYSETC_MINI_12864_2_0 // Type A/B. Discreet RGB Backlight
|
||||
//#define FYSETC_MINI_12864_2_1 // Type A/B. Neopixel RGB Backlight
|
||||
//#define FYSETC_MINI_12864_X_X // Type C/D/E/F. No tunable RGB Backlight by default
|
||||
//#define FYSETC_MINI_12864_1_2 // Type C/D/E/F. Simple RGB Backlight (always on)
|
||||
//#define FYSETC_MINI_12864_2_0 // Type A/B. Discreet RGB Backlight
|
||||
//#define FYSETC_MINI_12864_2_1 // Type A/B. Neopixel RGB Backlight
|
||||
//#define FYSETC_GENERIC_12864_1_1 // Larger display with basic ON/OFF backlight.
|
||||
|
||||
//
|
||||
// Factory display for Creality CR-10
|
||||
// https://www.aliexpress.com/item/Universal-LCD-12864-3D-Printer-Display-Screen-With-Encoder-For-CR-10-CR-7-Model/32833148327.html
|
||||
// https://www.aliexpress.com/item/32833148327.html
|
||||
//
|
||||
// This is RAMPS-compatible using a single 10-pin connector.
|
||||
// (For CR-10 owners who want to replace the Melzi Creality board but retain the display)
|
||||
//
|
||||
//#define CR10_STOCKDISPLAY
|
||||
|
||||
//
|
||||
// Ender-2 OEM display, a variant of the MKS_MINI_12864
|
||||
//
|
||||
//#define ENDER2_STOCKDISPLAY
|
||||
|
||||
//
|
||||
// ANET and Tronxy Graphical Controller
|
||||
//
|
||||
@@ -1961,7 +1991,7 @@
|
||||
|
||||
//
|
||||
// AZSMZ 12864 LCD with SD
|
||||
// https://www.aliexpress.com/store/product/3D-printer-smart-controller-SMART-RAMPS-OR-RAMPS-1-4-LCD-12864-LCD-control-panel-green/2179173_32213636460.html
|
||||
// https://www.aliexpress.com/item/32837222770.html
|
||||
//
|
||||
//#define AZSMZ_12864
|
||||
|
||||
@@ -2018,9 +2048,11 @@
|
||||
//=============================================================================
|
||||
|
||||
//
|
||||
// DGUS Touch Display with DWIN OS
|
||||
// DGUS Touch Display with DWIN OS. (Choose one.)
|
||||
//
|
||||
//#define DGUS_LCD
|
||||
//#define DGUS_LCD_UI_ORIGIN
|
||||
//#define DGUS_LCD_UI_FYSETC
|
||||
//#define DGUS_LCD_UI_HIPRECY
|
||||
|
||||
//
|
||||
// Touch-screen LCD for Malyan M200 printers
|
||||
|
@@ -78,6 +78,18 @@
|
||||
#define HOTEND5_BETA 3950 // Beta value
|
||||
#endif
|
||||
|
||||
#if TEMP_SENSOR_6 == 1000
|
||||
#define HOTEND6_PULLUP_RESISTOR_OHMS 4700 // Pullup resistor
|
||||
#define HOTEND6_RESISTANCE_25C_OHMS 100000 // Resistance at 25C
|
||||
#define HOTEND6_BETA 3950 // Beta value
|
||||
#endif
|
||||
|
||||
#if TEMP_SENSOR_7 == 1000
|
||||
#define HOTEND7_PULLUP_RESISTOR_OHMS 4700 // Pullup resistor
|
||||
#define HOTEND7_RESISTANCE_25C_OHMS 100000 // Resistance at 25C
|
||||
#define HOTEND7_BETA 3950 // Beta value
|
||||
#endif
|
||||
|
||||
#if TEMP_SENSOR_BED == 1000
|
||||
#define BED_PULLUP_RESISTOR_OHMS 4700 // Pullup resistor
|
||||
#define BED_RESISTANCE_25C_OHMS 100000 // Resistance at 25C
|
||||
@@ -165,28 +177,28 @@
|
||||
* Thermal Protection parameters for the bed are just as above for hotends.
|
||||
*/
|
||||
#if ENABLED(THERMAL_PROTECTION_BED)
|
||||
#define THERMAL_PROTECTION_BED_PERIOD 20 // Seconds
|
||||
#define THERMAL_PROTECTION_BED_HYSTERESIS 2 // Degrees Celsius
|
||||
#define THERMAL_PROTECTION_BED_PERIOD 20 // Seconds
|
||||
#define THERMAL_PROTECTION_BED_HYSTERESIS 2 // Degrees Celsius
|
||||
|
||||
/**
|
||||
* As described above, except for the bed (M140/M190/M303).
|
||||
*/
|
||||
#define WATCH_BED_TEMP_PERIOD 60 // Seconds
|
||||
#define WATCH_BED_TEMP_INCREASE 2 // Degrees Celsius
|
||||
#define WATCH_BED_TEMP_PERIOD 60 // Seconds
|
||||
#define WATCH_BED_TEMP_INCREASE 2 // Degrees Celsius
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Thermal Protection parameters for the heated chamber.
|
||||
*/
|
||||
#if ENABLED(THERMAL_PROTECTION_CHAMBER)
|
||||
#define THERMAL_PROTECTION_CHAMBER_PERIOD 20 // Seconds
|
||||
#define THERMAL_PROTECTION_CHAMBER_PERIOD 20 // Seconds
|
||||
#define THERMAL_PROTECTION_CHAMBER_HYSTERESIS 2 // Degrees Celsius
|
||||
|
||||
/**
|
||||
* Heated chamber watch settings (M141/M191).
|
||||
*/
|
||||
#define WATCH_CHAMBER_TEMP_PERIOD 60 // Seconds
|
||||
#define WATCH_CHAMBER_TEMP_INCREASE 2 // Degrees Celsius
|
||||
#define WATCH_CHAMBER_TEMP_PERIOD 60 // Seconds
|
||||
#define WATCH_CHAMBER_TEMP_INCREASE 2 // Degrees Celsius
|
||||
#endif
|
||||
|
||||
#if ENABLED(PIDTEMP)
|
||||
@@ -368,7 +380,7 @@
|
||||
* FAST_PWM_FAN_FREQUENCY [undefined by default]
|
||||
* Set this to your desired frequency.
|
||||
* If left undefined this defaults to F = F_CPU/(2*255*1)
|
||||
* ie F = 31.4 Khz on 16 MHz microcontrollers or F = 39.2 KHz on 20 MHz microcontrollers
|
||||
* i.e., F = 31.4kHz on 16MHz microcontrollers or F = 39.2kHz on 20MHz microcontrollers.
|
||||
* These defaults are the same as with the old FAST_PWM_FAN implementation - no migration is required
|
||||
* NOTE: Setting very low frequencies (< 10 Hz) may result in unexpected timer behavior.
|
||||
*
|
||||
@@ -479,7 +491,7 @@
|
||||
//#define X_DUAL_ENDSTOPS
|
||||
#if ENABLED(X_DUAL_ENDSTOPS)
|
||||
#define X2_USE_ENDSTOP _XMAX_
|
||||
#define X_DUAL_ENDSTOPS_ADJUSTMENT 0
|
||||
#define X2_ENDSTOP_ADJUSTMENT 0
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@@ -489,27 +501,28 @@
|
||||
//#define Y_DUAL_ENDSTOPS
|
||||
#if ENABLED(Y_DUAL_ENDSTOPS)
|
||||
#define Y2_USE_ENDSTOP _YMAX_
|
||||
#define Y_DUAL_ENDSTOPS_ADJUSTMENT 0
|
||||
#define Y2_ENDSTOP_ADJUSTMENT 0
|
||||
#endif
|
||||
#endif
|
||||
|
||||
//#define Z_DUAL_STEPPER_DRIVERS
|
||||
#if ENABLED(Z_DUAL_STEPPER_DRIVERS)
|
||||
//#define Z_DUAL_ENDSTOPS
|
||||
#if ENABLED(Z_DUAL_ENDSTOPS)
|
||||
#define Z2_USE_ENDSTOP _XMAX_
|
||||
#define Z_DUAL_ENDSTOPS_ADJUSTMENT 0
|
||||
#endif
|
||||
#endif
|
||||
//
|
||||
// For Z set the number of stepper drivers
|
||||
//
|
||||
#define NUM_Z_STEPPER_DRIVERS 1 // (1-4) Z options change based on how many
|
||||
|
||||
//#define Z_TRIPLE_STEPPER_DRIVERS
|
||||
#if ENABLED(Z_TRIPLE_STEPPER_DRIVERS)
|
||||
//#define Z_TRIPLE_ENDSTOPS
|
||||
#if ENABLED(Z_TRIPLE_ENDSTOPS)
|
||||
#define Z2_USE_ENDSTOP _XMAX_
|
||||
#define Z3_USE_ENDSTOP _YMAX_
|
||||
#define Z_TRIPLE_ENDSTOPS_ADJUSTMENT2 0
|
||||
#define Z_TRIPLE_ENDSTOPS_ADJUSTMENT3 0
|
||||
#if NUM_Z_STEPPER_DRIVERS > 1
|
||||
//#define Z_MULTI_ENDSTOPS
|
||||
#if ENABLED(Z_MULTI_ENDSTOPS)
|
||||
#define Z2_USE_ENDSTOP _XMAX_
|
||||
#define Z2_ENDSTOP_ADJUSTMENT 0
|
||||
#if NUM_Z_STEPPER_DRIVERS >= 3
|
||||
#define Z3_USE_ENDSTOP _YMAX_
|
||||
#define Z3_ENDSTOP_ADJUSTMENT 0
|
||||
#endif
|
||||
#if NUM_Z_STEPPER_DRIVERS >= 4
|
||||
#define Z4_USE_ENDSTOP _ZMAX_
|
||||
#define Z4_ENDSTOP_ADJUSTMENT 0
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@@ -656,7 +669,7 @@
|
||||
//#define Z_STEPPER_AUTO_ALIGN
|
||||
#if ENABLED(Z_STEPPER_AUTO_ALIGN)
|
||||
// Define probe X and Y positions for Z1, Z2 [, Z3]
|
||||
#define Z_STEPPER_ALIGN_XY { { 10, 290 }, { 150, 10 }, { 290, 290 } }
|
||||
#define Z_STEPPER_ALIGN_XY { { 10, 190 }, { 100, 10 }, { 190, 190 } }
|
||||
|
||||
// Provide Z stepper positions for more rapid convergence in bed alignment.
|
||||
// Currently requires triple stepper drivers.
|
||||
@@ -1243,6 +1256,44 @@
|
||||
|
||||
#endif // HAS_GRAPHICAL_LCD
|
||||
|
||||
//
|
||||
// Additional options for DGUS / DWIN displays
|
||||
//
|
||||
#if HAS_DGUS_LCD
|
||||
#define DGUS_SERIAL_PORT 2
|
||||
#define DGUS_BAUDRATE 115200
|
||||
|
||||
#define DGUS_RX_BUFFER_SIZE 128
|
||||
#define DGUS_TX_BUFFER_SIZE 48
|
||||
//#define DGUS_SERIAL_STATS_RX_BUFFER_OVERRUNS // Fix Rx overrun situation (Currently only for AVR)
|
||||
|
||||
#define DGUS_UPDATE_INTERVAL_MS 500 // (ms) Interval between automatic screen updates
|
||||
#define BOOTSCREEN_TIMEOUT 3000 // (ms) Duration to display the boot screen
|
||||
|
||||
#if EITHER(DGUS_LCD_UI_FYSETC, DGUS_LCD_UI_HIPRECY)
|
||||
#define DGUS_PRINT_FILENAME // Display the filename during printing
|
||||
#define DGUS_PREHEAT_UI // Display a preheat screen during heatup
|
||||
|
||||
#if ENABLED(DGUS_LCD_UI_FYSETC)
|
||||
//#define DUGS_UI_MOVE_DIS_OPTION // Disabled by default for UI_FYSETC
|
||||
#else
|
||||
#define DUGS_UI_MOVE_DIS_OPTION // Enabled by default for UI_HIPRECY
|
||||
#endif
|
||||
|
||||
#define DGUS_FILAMENT_LOADUNLOAD
|
||||
#if ENABLED(DGUS_FILAMENT_LOADUNLOAD)
|
||||
#define DGUS_FILAMENT_PURGE_LENGTH 10
|
||||
#define DGUS_FILAMENT_LOAD_LENGTH_PER_TIME 0.5 // (mm) Adjust in proportion to DGUS_UPDATE_INTERVAL_MS
|
||||
#endif
|
||||
|
||||
#define DGUS_UI_WAITING // Show a "waiting" screen between some screens
|
||||
#if ENABLED(DGUS_UI_WAITING)
|
||||
#define DGUS_UI_WAITING_STATUS 10
|
||||
#define DGUS_UI_WAITING_STATUS_PERIOD 8 // Increase to slower waiting status looping
|
||||
#endif
|
||||
#endif
|
||||
#endif // HAS_DGUS_LCD
|
||||
|
||||
//
|
||||
// Touch UI for the FTDI Embedded Video Engine (EVE)
|
||||
//
|
||||
@@ -1341,6 +1392,13 @@
|
||||
//#define TFT_BTOKMENU_COLOR 0x145F // 00010 100010 11111 Cyan
|
||||
#endif
|
||||
|
||||
//
|
||||
// ADC Button Debounce
|
||||
//
|
||||
#if HAS_ADC_BUTTONS
|
||||
#define ADC_BUTTON_DEBOUNCE_DELAY 16 // (ms) Increase if buttons bounce or repeat too fast
|
||||
#endif
|
||||
|
||||
// @section safety
|
||||
|
||||
/**
|
||||
@@ -1438,7 +1496,8 @@
|
||||
* Override MIN_PROBE_EDGE for each side of the build plate
|
||||
* Useful to get probe points to exact positions on targets or
|
||||
* to allow leveling to avoid plate clamps on only specific
|
||||
* sides of the bed.
|
||||
* sides of the bed. With NOZZLE_AS_PROBE negative values are
|
||||
* allowed, to permit probing outside the bed.
|
||||
*
|
||||
* If you are replacing the prior *_PROBE_BED_POSITION options,
|
||||
* LEFT and FRONT values in most cases will map directly over
|
||||
@@ -1483,18 +1542,57 @@
|
||||
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Thermal Probe Compensation
|
||||
* Probe measurements are adjusted to compensate for temperature distortion.
|
||||
* Use G76 to calibrate this feature. Use M871 to set values manually.
|
||||
* For a more detailed explanation of the process see G76_M871.cpp.
|
||||
*/
|
||||
#if HAS_BED_PROBE && TEMP_SENSOR_PROBE && TEMP_SENSOR_BED
|
||||
// Enable thermal first layer compensation using bed and probe temperatures
|
||||
#define PROBE_TEMP_COMPENSATION
|
||||
|
||||
// Add additional compensation depending on hotend temperature
|
||||
// Note: this values cannot be calibrated and have to be set manually
|
||||
#ifdef PROBE_TEMP_COMPENSATION
|
||||
// Max temperature that can be reached by heated bed.
|
||||
// This is required only for the calibration process.
|
||||
#define PTC_MAX_BED_TEMP 110
|
||||
|
||||
// Park position to wait for probe cooldown
|
||||
#define PTC_PARK_POS_X 0.0F
|
||||
#define PTC_PARK_POS_Y 0.0F
|
||||
#define PTC_PARK_POS_Z 100.0F
|
||||
|
||||
// Probe position to probe and wait for probe to reach target temperature
|
||||
#define PTC_PROBE_POS_X 90.0F
|
||||
#define PTC_PROBE_POS_Y 100.0F
|
||||
|
||||
// Enable additional compensation using hotend temperature
|
||||
// Note: this values cannot be calibrated automatically but have to be set manually
|
||||
//#define USE_TEMP_EXT_COMPENSATION
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// @section extras
|
||||
|
||||
//
|
||||
// G60/G61 Position Save and Return
|
||||
//
|
||||
//#define SAVED_POSITIONS 1 // Each saved position slot costs 12 bytes
|
||||
|
||||
//
|
||||
// G2/G3 Arc Support
|
||||
//
|
||||
#define ARC_SUPPORT // Disable this feature to save ~3226 bytes
|
||||
#define ARC_SUPPORT // Disable this feature to save ~3226 bytes
|
||||
#if ENABLED(ARC_SUPPORT)
|
||||
#define MM_PER_ARC_SEGMENT 1 // Length of each arc segment
|
||||
#define MIN_ARC_SEGMENTS 24 // Minimum number of segments in a complete circle
|
||||
#define N_ARC_CORRECTION 25 // Number of interpolated segments between corrections
|
||||
//#define ARC_P_CIRCLES // Enable the 'P' parameter to specify complete circles
|
||||
//#define CNC_WORKSPACE_PLANES // Allow G2/G3 to operate in XY, ZX, or YZ planes
|
||||
#define MM_PER_ARC_SEGMENT 1 // (mm) Length (or minimum length) of each arc segment
|
||||
//#define ARC_SEGMENTS_PER_R 1 // Max segment length, MM_PER = Min
|
||||
#define MIN_ARC_SEGMENTS 24 // Minimum number of segments in a complete circle
|
||||
//#define ARC_SEGMENTS_PER_SEC 50 // Use feedrate to choose segment length (with MM_PER_ARC_SEGMENT as the minimum)
|
||||
#define N_ARC_CORRECTION 25 // Number of interpolated segments between corrections
|
||||
//#define ARC_P_CIRCLES // Enable the 'P' parameter to specify complete circles
|
||||
//#define CNC_WORKSPACE_PLANES // Allow G2/G3 to operate in XY, ZX, or YZ planes
|
||||
#endif
|
||||
|
||||
// Support for G5 with XYZE destination and IJPQ offsets. Requires ~2666 bytes.
|
||||
@@ -1548,12 +1646,12 @@
|
||||
/**
|
||||
* Maximum stepping rate (in Hz) the stepper driver allows
|
||||
* If undefined, defaults to 1MHz / (2 * MINIMUM_STEPPER_PULSE)
|
||||
* 500000 : Maximum for A4988 stepper driver
|
||||
* 400000 : Maximum for TMC2xxx stepper drivers
|
||||
* 250000 : Maximum for DRV8825 stepper driver
|
||||
* 200000 : Maximum for LV8729 stepper driver
|
||||
* 150000 : Maximum for TB6600 stepper driver
|
||||
* 15000 : Maximum for TB6560 stepper driver
|
||||
* 5000000 : Maximum for TMC2xxx stepper drivers
|
||||
* 1000000 : Maximum for LV8729 stepper driver
|
||||
* 500000 : Maximum for A4988 stepper driver
|
||||
* 250000 : Maximum for DRV8825 stepper driver
|
||||
* 150000 : Maximum for TB6600 stepper driver
|
||||
* 15000 : Maximum for TB6560 stepper driver
|
||||
*
|
||||
* Override the default value based on the driver type set in Configuration.h.
|
||||
*/
|
||||
@@ -1691,6 +1789,9 @@
|
||||
// Z raise distance for tool-change, as needed for some extruders
|
||||
#define TOOLCHANGE_ZRAISE 2 // (mm)
|
||||
//#define TOOLCHANGE_NO_RETURN // Never return to the previous position on tool-change
|
||||
#if ENABLED(TOOLCHANGE_NO_RETURN)
|
||||
//#define EVENT_GCODE_AFTER_TOOLCHANGE "G12X" // G-code to run after tool-change is complete
|
||||
#endif
|
||||
|
||||
// Retract and prime filament on tool-change
|
||||
//#define TOOLCHANGE_FILAMENT_SWAP
|
||||
@@ -1751,9 +1852,10 @@
|
||||
//#define ADVANCED_PAUSE_FANS_PAUSE // Turn off print-cooling fans while the machine is paused.
|
||||
|
||||
// Filament Unload does a Retract, Delay, and Purge first:
|
||||
#define FILAMENT_UNLOAD_RETRACT_LENGTH 13 // (mm) Unload initial retract length.
|
||||
#define FILAMENT_UNLOAD_DELAY 5000 // (ms) Delay for the filament to cool after retract.
|
||||
#define FILAMENT_UNLOAD_PURGE_RETRACT 13 // (mm) Unload initial retract length.
|
||||
#define FILAMENT_UNLOAD_PURGE_DELAY 5000 // (ms) Delay for the filament to cool after retract.
|
||||
#define FILAMENT_UNLOAD_PURGE_LENGTH 8 // (mm) An unretract is done, then this length is purged.
|
||||
#define FILAMENT_UNLOAD_PURGE_FEEDRATE 25 // (mm/s) feedrate to purge before unload
|
||||
|
||||
#define PAUSE_PARK_NOZZLE_TIMEOUT 45 // (seconds) Time limit before the nozzle is turned off for safety.
|
||||
#define FILAMENT_CHANGE_ALERT_BEEPS 10 // Number of alert beeps to play when a response is needed.
|
||||
@@ -1818,6 +1920,12 @@
|
||||
#define Z3_MICROSTEPS 16
|
||||
#endif
|
||||
|
||||
#if AXIS_DRIVER_TYPE_Z4(TMC26X)
|
||||
#define Z4_MAX_CURRENT 1000
|
||||
#define Z4_SENSE_RESISTOR 91
|
||||
#define Z4_MICROSTEPS 16
|
||||
#endif
|
||||
|
||||
#if AXIS_DRIVER_TYPE_E0(TMC26X)
|
||||
#define E0_MAX_CURRENT 1000
|
||||
#define E0_SENSE_RESISTOR 91
|
||||
@@ -1854,6 +1962,18 @@
|
||||
#define E5_MICROSTEPS 16
|
||||
#endif
|
||||
|
||||
#if AXIS_DRIVER_TYPE_E6(TMC26X)
|
||||
#define E6_MAX_CURRENT 1000
|
||||
#define E6_SENSE_RESISTOR 91
|
||||
#define E6_MICROSTEPS 16
|
||||
#endif
|
||||
|
||||
#if AXIS_DRIVER_TYPE_E7(TMC26X)
|
||||
#define E7_MAX_CURRENT 1000
|
||||
#define E7_SENSE_RESISTOR 91
|
||||
#define E7_MICROSTEPS 16
|
||||
#endif
|
||||
|
||||
#endif // TMC26X
|
||||
|
||||
// @section tmc_smart
|
||||
@@ -1935,6 +2055,14 @@
|
||||
#define Z3_CHAIN_POS -1
|
||||
#endif
|
||||
|
||||
#if AXIS_IS_TMC(Z4)
|
||||
#define Z4_CURRENT 800
|
||||
#define Z4_CURRENT_HOME Z4_CURRENT
|
||||
#define Z4_MICROSTEPS 16
|
||||
#define Z4_RSENSE 0.11
|
||||
#define Z4_CHAIN_POS -1
|
||||
#endif
|
||||
|
||||
#if AXIS_IS_TMC(E0)
|
||||
#define E0_CURRENT 800
|
||||
#define E0_MICROSTEPS 16
|
||||
@@ -1977,6 +2105,20 @@
|
||||
#define E5_CHAIN_POS -1
|
||||
#endif
|
||||
|
||||
#if AXIS_IS_TMC(E6)
|
||||
#define E6_CURRENT 800
|
||||
#define E6_MICROSTEPS 16
|
||||
#define E6_RSENSE 0.11
|
||||
#define E6_CHAIN_POS -1
|
||||
#endif
|
||||
|
||||
#if AXIS_IS_TMC(E7)
|
||||
#define E7_CURRENT 800
|
||||
#define E7_MICROSTEPS 16
|
||||
#define E7_RSENSE 0.11
|
||||
#define E7_CHAIN_POS -1
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Override default SPI pins for TMC2130, TMC2160, TMC2660, TMC5130 and TMC5160 drivers here.
|
||||
* The default pins can be found in your board's pins file.
|
||||
@@ -1994,6 +2136,8 @@
|
||||
//#define E3_CS_PIN -1
|
||||
//#define E4_CS_PIN -1
|
||||
//#define E5_CS_PIN -1
|
||||
//#define E6_CS_PIN -1
|
||||
//#define E7_CS_PIN -1
|
||||
|
||||
/**
|
||||
* Software option for SPI driven drivers (TMC2130, TMC2160, TMC2660, TMC5130 and TMC5160).
|
||||
@@ -2024,12 +2168,15 @@
|
||||
#define Y2_SLAVE_ADDRESS 0
|
||||
#define Z2_SLAVE_ADDRESS 0
|
||||
#define Z3_SLAVE_ADDRESS 0
|
||||
#define Z4_SLAVE_ADDRESS 0
|
||||
#define E0_SLAVE_ADDRESS 0
|
||||
#define E1_SLAVE_ADDRESS 0
|
||||
#define E2_SLAVE_ADDRESS 0
|
||||
#define E3_SLAVE_ADDRESS 0
|
||||
#define E4_SLAVE_ADDRESS 0
|
||||
#define E5_SLAVE_ADDRESS 0
|
||||
#define E6_SLAVE_ADDRESS 0
|
||||
#define E7_SLAVE_ADDRESS 0
|
||||
|
||||
/**
|
||||
* Software enable
|
||||
@@ -2099,12 +2246,15 @@
|
||||
#define Z_HYBRID_THRESHOLD 3
|
||||
#define Z2_HYBRID_THRESHOLD 3
|
||||
#define Z3_HYBRID_THRESHOLD 3
|
||||
#define Z4_HYBRID_THRESHOLD 3
|
||||
#define E0_HYBRID_THRESHOLD 30
|
||||
#define E1_HYBRID_THRESHOLD 30
|
||||
#define E2_HYBRID_THRESHOLD 30
|
||||
#define E3_HYBRID_THRESHOLD 30
|
||||
#define E4_HYBRID_THRESHOLD 30
|
||||
#define E5_HYBRID_THRESHOLD 30
|
||||
#define E6_HYBRID_THRESHOLD 30
|
||||
#define E7_HYBRID_THRESHOLD 30
|
||||
|
||||
/**
|
||||
* Use StallGuard2 to home / probe X, Y, Z.
|
||||
@@ -2128,8 +2278,6 @@
|
||||
*
|
||||
* IMPROVE_HOMING_RELIABILITY tunes acceleration and jerk when
|
||||
* homing and adds a guard period for endstop triggering.
|
||||
*
|
||||
* TMC2209 requires STEALTHCHOP enabled for SENSORLESS_HOMING
|
||||
*/
|
||||
//#define SENSORLESS_HOMING // StallGuard capable drivers only
|
||||
|
||||
@@ -2148,7 +2296,6 @@
|
||||
#define Y_STALL_SENSITIVITY 8
|
||||
//#define Z_STALL_SENSITIVITY 8
|
||||
//#define SPI_ENDSTOPS // TMC2130 only
|
||||
//#define HOME_USING_SPREADCYCLE
|
||||
//#define IMPROVE_HOMING_RELIABILITY
|
||||
#endif
|
||||
|
||||
@@ -2179,12 +2326,12 @@
|
||||
|
||||
#endif // HAS_TRINAMIC
|
||||
|
||||
// @section L6470
|
||||
// @section L64XX
|
||||
|
||||
/**
|
||||
* L6470 Stepper Driver options
|
||||
* L64XX Stepper Driver options
|
||||
*
|
||||
* Arduino-L6470 library (0.7.0 or higher) is required for this stepper driver.
|
||||
* Arduino-L6470 library (0.8.0 or higher) is required.
|
||||
* https://github.com/ameyer/Arduino-L6470
|
||||
*
|
||||
* Requires the following to be defined in your pins_YOUR_BOARD file
|
||||
@@ -2192,114 +2339,160 @@
|
||||
* L6470_CHAIN_MISO_PIN
|
||||
* L6470_CHAIN_MOSI_PIN
|
||||
* L6470_CHAIN_SS_PIN
|
||||
* L6470_RESET_CHAIN_PIN (optional)
|
||||
* ENABLE_RESET_L64XX_CHIPS(Q) where Q is 1 to enable and 0 to reset
|
||||
*/
|
||||
#if HAS_DRIVER(L6470)
|
||||
|
||||
#if HAS_L64XX
|
||||
|
||||
//#define L6470_CHITCHAT // Display additional status info
|
||||
|
||||
#if AXIS_DRIVER_TYPE_X(L6470)
|
||||
#define X_MICROSTEPS 128 // Number of microsteps (VALID: 1, 2, 4, 8, 16, 32, 128)
|
||||
#define X_OVERCURRENT 2000 // (mA) Current where the driver detects an over current (VALID: 375 x (1 - 16) - 6A max - rounds down)
|
||||
#define X_STALLCURRENT 1500 // (mA) Current where the driver detects a stall (VALID: 31.25 * (1-128) - 4A max - rounds down)
|
||||
#define X_MAX_VOLTAGE 127 // 0-255, Maximum effective voltage seen by stepper
|
||||
#define X_CHAIN_POS -1 // Position in SPI chain. (<=0 : Not in chain. 1 : Nearest MOSI)
|
||||
#if AXIS_IS_L64XX(X)
|
||||
#define X_MICROSTEPS 128 // Number of microsteps (VALID: 1, 2, 4, 8, 16, 32, 128) - L6474 max is 16
|
||||
#define X_OVERCURRENT 2000 // (mA) Current where the driver detects an over current
|
||||
// L6470 & L6474 - VALID: 375 x (1 - 16) - 6A max - rounds down
|
||||
// POWERSTEP01: VALID: 1000 x (1 - 32) - 32A max - rounds down
|
||||
#define X_STALLCURRENT 1500 // (mA) Current where the driver detects a stall (VALID: 31.25 * (1-128) - 4A max - rounds down)
|
||||
// L6470 & L6474 - VALID: 31.25 * (1-128) - 4A max - rounds down
|
||||
// POWERSTEP01: VALID: 200 x (1 - 32) - 6.4A max - rounds down
|
||||
// L6474 - STALLCURRENT setting is used to set the nominal (TVAL) current
|
||||
#define X_MAX_VOLTAGE 127 // 0-255, Maximum effective voltage seen by stepper - not used by L6474
|
||||
#define X_CHAIN_POS -1 // Position in SPI chain, 0=Not in chain, 1=Nearest MOSI
|
||||
#define X_SLEW_RATE 1 // 0-3, Slew 0 is slowest, 3 is fastest
|
||||
#endif
|
||||
|
||||
#if AXIS_DRIVER_TYPE_X2(L6470)
|
||||
#if AXIS_IS_L64XX(X2)
|
||||
#define X2_MICROSTEPS 128
|
||||
#define X2_OVERCURRENT 2000
|
||||
#define X2_STALLCURRENT 1500
|
||||
#define X2_MAX_VOLTAGE 127
|
||||
#define X2_CHAIN_POS -1
|
||||
#define X2_SLEW_RATE 1
|
||||
#endif
|
||||
|
||||
#if AXIS_DRIVER_TYPE_Y(L6470)
|
||||
#if AXIS_IS_L64XX(Y)
|
||||
#define Y_MICROSTEPS 128
|
||||
#define Y_OVERCURRENT 2000
|
||||
#define Y_STALLCURRENT 1500
|
||||
#define Y_MAX_VOLTAGE 127
|
||||
#define Y_CHAIN_POS -1
|
||||
#define Y_SLEW_RATE 1
|
||||
#endif
|
||||
|
||||
#if AXIS_DRIVER_TYPE_Y2(L6470)
|
||||
#if AXIS_IS_L64XX(Y2)
|
||||
#define Y2_MICROSTEPS 128
|
||||
#define Y2_OVERCURRENT 2000
|
||||
#define Y2_STALLCURRENT 1500
|
||||
#define Y2_MAX_VOLTAGE 127
|
||||
#define Y2_CHAIN_POS -1
|
||||
#define Y2_SLEW_RATE 1
|
||||
#endif
|
||||
|
||||
#if AXIS_DRIVER_TYPE_Z(L6470)
|
||||
#if AXIS_IS_L64XX(Z)
|
||||
#define Z_MICROSTEPS 128
|
||||
#define Z_OVERCURRENT 2000
|
||||
#define Z_STALLCURRENT 1500
|
||||
#define Z_MAX_VOLTAGE 127
|
||||
#define Z_CHAIN_POS -1
|
||||
#define Z_SLEW_RATE 1
|
||||
#endif
|
||||
|
||||
#if AXIS_DRIVER_TYPE_Z2(L6470)
|
||||
#if AXIS_IS_L64XX(Z2)
|
||||
#define Z2_MICROSTEPS 128
|
||||
#define Z2_OVERCURRENT 2000
|
||||
#define Z2_STALLCURRENT 1500
|
||||
#define Z2_MAX_VOLTAGE 127
|
||||
#define Z2_CHAIN_POS -1
|
||||
#define Z2_SLEW_RATE 1
|
||||
#endif
|
||||
|
||||
#if AXIS_DRIVER_TYPE_Z3(L6470)
|
||||
#if AXIS_IS_L64XX(Z3)
|
||||
#define Z3_MICROSTEPS 128
|
||||
#define Z3_OVERCURRENT 2000
|
||||
#define Z3_STALLCURRENT 1500
|
||||
#define Z3_MAX_VOLTAGE 127
|
||||
#define Z3_CHAIN_POS -1
|
||||
#define Z3_SLEW_RATE 1
|
||||
#endif
|
||||
|
||||
#if AXIS_DRIVER_TYPE_E0(L6470)
|
||||
#if AXIS_IS_L64XX(Z4)
|
||||
#define Z4_MICROSTEPS 128
|
||||
#define Z4_OVERCURRENT 2000
|
||||
#define Z4_STALLCURRENT 1500
|
||||
#define Z4_MAX_VOLTAGE 127
|
||||
#define Z4_CHAIN_POS -1
|
||||
#define Z4_SLEW_RATE 1
|
||||
#endif
|
||||
|
||||
#if AXIS_IS_L64XX(E0)
|
||||
#define E0_MICROSTEPS 128
|
||||
#define E0_OVERCURRENT 2000
|
||||
#define E0_STALLCURRENT 1500
|
||||
#define E0_MAX_VOLTAGE 127
|
||||
#define E0_CHAIN_POS -1
|
||||
#define E0_SLEW_RATE 1
|
||||
#endif
|
||||
|
||||
#if AXIS_DRIVER_TYPE_E1(L6470)
|
||||
#if AXIS_IS_L64XX(E1)
|
||||
#define E1_MICROSTEPS 128
|
||||
#define E1_OVERCURRENT 2000
|
||||
#define E1_STALLCURRENT 1500
|
||||
#define E1_MAX_VOLTAGE 127
|
||||
#define E1_CHAIN_POS -1
|
||||
#define E1_SLEW_RATE 1
|
||||
#endif
|
||||
|
||||
#if AXIS_DRIVER_TYPE_E2(L6470)
|
||||
#if AXIS_IS_L64XX(E2)
|
||||
#define E2_MICROSTEPS 128
|
||||
#define E2_OVERCURRENT 2000
|
||||
#define E2_STALLCURRENT 1500
|
||||
#define E2_MAX_VOLTAGE 127
|
||||
#define E2_CHAIN_POS -1
|
||||
#define E2_SLEW_RATE 1
|
||||
#endif
|
||||
|
||||
#if AXIS_DRIVER_TYPE_E3(L6470)
|
||||
#if AXIS_IS_L64XX(E3)
|
||||
#define E3_MICROSTEPS 128
|
||||
#define E3_OVERCURRENT 2000
|
||||
#define E3_STALLCURRENT 1500
|
||||
#define E3_MAX_VOLTAGE 127
|
||||
#define E3_CHAIN_POS -1
|
||||
#define E3_SLEW_RATE 1
|
||||
#endif
|
||||
|
||||
#if AXIS_DRIVER_TYPE_E4(L6470)
|
||||
#if AXIS_IS_L64XX(E4)
|
||||
#define E4_MICROSTEPS 128
|
||||
#define E4_OVERCURRENT 2000
|
||||
#define E4_STALLCURRENT 1500
|
||||
#define E4_MAX_VOLTAGE 127
|
||||
#define E4_CHAIN_POS -1
|
||||
#define E4_SLEW_RATE 1
|
||||
#endif
|
||||
|
||||
#if AXIS_DRIVER_TYPE_E5(L6470)
|
||||
#if AXIS_IS_L64XX(E5)
|
||||
#define E5_MICROSTEPS 128
|
||||
#define E5_OVERCURRENT 2000
|
||||
#define E5_STALLCURRENT 1500
|
||||
#define E5_MAX_VOLTAGE 127
|
||||
#define E5_CHAIN_POS -1
|
||||
#define E5_SLEW_RATE 1
|
||||
#endif
|
||||
|
||||
#if AXIS_IS_L64XX(E6)
|
||||
#define E6_MICROSTEPS 128
|
||||
#define E6_OVERCURRENT 2000
|
||||
#define E6_STALLCURRENT 1500
|
||||
#define E6_MAX_VOLTAGE 127
|
||||
#define E6_CHAIN_POS -1
|
||||
#define E6_SLEW_RATE 1
|
||||
#endif
|
||||
|
||||
#if AXIS_IS_L64XX(E7)
|
||||
#define E7_MICROSTEPS 128
|
||||
#define E7_OVERCURRENT 2000
|
||||
#define E7_STALLCURRENT 1500
|
||||
#define E7_MAX_VOLTAGE 127
|
||||
#define E7_CHAIN_POS -1
|
||||
#define E7_SLEW_RATE 1
|
||||
#endif
|
||||
|
||||
/**
|
||||
@@ -2311,7 +2504,7 @@
|
||||
* I not present or I0 or I1 - X, Y, Z or E0
|
||||
* I2 - X2, Y2, Z2 or E1
|
||||
* I3 - Z3 or E3
|
||||
* I4 - E4
|
||||
* I4 - Z4 or E4
|
||||
* I5 - E5
|
||||
* M916 - Increase drive level until get thermal warning
|
||||
* M917 - Find minimum current thresholds
|
||||
@@ -2325,7 +2518,15 @@
|
||||
//#define L6470_STOP_ON_ERROR
|
||||
#endif
|
||||
|
||||
#endif // L6470
|
||||
#endif // HAS_L64XX
|
||||
|
||||
// @section i2cbus
|
||||
|
||||
//
|
||||
// I2C Master ID for LPC176x LCD and Digital Current control
|
||||
// Does not apply to other peripherals based on the Wire library.
|
||||
//
|
||||
//#define I2C_MASTER_ID 1 // Set a value from 0 to 2
|
||||
|
||||
/**
|
||||
* TWI/I2C BUS
|
||||
@@ -2355,10 +2556,10 @@
|
||||
* echo:i2c-reply: from:99 bytes:5 data:hello
|
||||
*/
|
||||
|
||||
// @section i2cbus
|
||||
|
||||
//#define EXPERIMENTAL_I2CBUS
|
||||
#define I2C_SLAVE_ADDRESS 0 // Set a value from 8 to 127 to act as a slave
|
||||
#if ENABLED(EXPERIMENTAL_I2CBUS)
|
||||
#define I2C_SLAVE_ADDRESS 0 // Set a value from 8 to 127 to act as a slave
|
||||
#endif
|
||||
|
||||
// @section extras
|
||||
|
||||
@@ -2387,6 +2588,20 @@
|
||||
|
||||
// Duration to hold the switch or keep CHDK_PIN high
|
||||
//#define PHOTO_SWITCH_MS 50 // (ms) (M240 D)
|
||||
|
||||
/**
|
||||
* PHOTO_PULSES_US may need adjustment depending on board and camera model.
|
||||
* Pin must be running at 48.4kHz.
|
||||
* Be sure to use a PHOTOGRAPH_PIN which can rise and fall quick enough.
|
||||
* (e.g., MKS SBase temp sensor pin was too slow, so used P1.23 on J8.)
|
||||
*
|
||||
* Example pulse data for Nikon: https://bit.ly/2FKD0Aq
|
||||
* IR Wiring: https://git.io/JvJf7
|
||||
*/
|
||||
//#define PHOTO_PULSES_US { 2000, 27850, 400, 1580, 400, 3580, 400 } // (µs) Durations for each 48.4kHz oscillation
|
||||
#ifdef PHOTO_PULSES_US
|
||||
#define PHOTO_PULSE_DELAY_US 13 // (µs) Approximate duration of each HIGH and LOW pulse in the oscillation
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/**
|
||||
@@ -2726,7 +2941,11 @@
|
||||
#define JOY_Z_PIN 12 // RAMPS: Suggested pin A12 on AUX2
|
||||
#define JOY_EN_PIN 44 // RAMPS: Suggested pin D44 on AUX2
|
||||
|
||||
// Use M119 to find reasonable values after connecting your hardware:
|
||||
//#define INVERT_JOY_X // Enable if X direction is reversed
|
||||
//#define INVERT_JOY_Y // Enable if Y direction is reversed
|
||||
//#define INVERT_JOY_Z // Enable if Z direction is reversed
|
||||
|
||||
// Use M119 with JOYSTICK_DEBUG to find reasonable values after connecting:
|
||||
#define JOY_X_LIMITS { 5600, 8190-100, 8190+100, 10800 } // min, deadzone start, deadzone end, max
|
||||
#define JOY_Y_LIMITS { 5600, 8250-100, 8250+100, 11000 }
|
||||
#define JOY_Z_LIMITS { 4800, 8080-100, 8080+100, 11550 }
|
||||
@@ -2781,12 +3000,15 @@
|
||||
/**
|
||||
* WiFi Support (Espressif ESP32 WiFi)
|
||||
*/
|
||||
//#define WIFISUPPORT
|
||||
#if ENABLED(WIFISUPPORT)
|
||||
//#define WIFISUPPORT // Marlin embedded WiFi managenent
|
||||
//#define ESP3D_WIFISUPPORT // ESP3D Library WiFi management (https://github.com/luc-github/ESP3DLib)
|
||||
|
||||
#if EITHER(WIFISUPPORT, ESP3D_WIFISUPPORT)
|
||||
#define WIFI_SSID "Wifi SSID"
|
||||
#define WIFI_PWD "Wifi Password"
|
||||
//#define WEBSUPPORT // Start a webserver with auto-discovery
|
||||
//#define OTASUPPORT // Support over-the-air firmware updates
|
||||
//#define WEBSUPPORT // Start a webserver (which may include auto-discovery)
|
||||
//#define OTASUPPORT // Support over-the-air firmware updates
|
||||
//#define WIFI_CUSTOM_COMMAND // Accept feature config commands (e.g., WiFi ESP3D) from the host
|
||||
#endif
|
||||
|
||||
/**
|
||||
@@ -2858,9 +3080,14 @@
|
||||
|
||||
// @section develop
|
||||
|
||||
/**
|
||||
* M43 - display pin status, watch pins for changes, watch endstops & toggle LED, Z servo probe test, toggle pins
|
||||
*/
|
||||
//
|
||||
// M100 Free Memory Watcher to debug memory usage
|
||||
//
|
||||
//#define M100_FREE_MEMORY_WATCHER
|
||||
|
||||
//
|
||||
// M43 - display pin status, toggle pins, watch pins, watch endstops & toggle LED, test servo probe
|
||||
//
|
||||
//#define PINS_DEBUGGING
|
||||
|
||||
// Enable Marlin dev mode which adds some special commands
|
||||
|
@@ -188,7 +188,7 @@ else ifeq ($(HARDWARE_MOTHERBOARD),1109)
|
||||
else ifeq ($(HARDWARE_MOTHERBOARD),1110)
|
||||
# zrib V2.0 control board (Chinese knock off RAMPS replica)
|
||||
else ifeq ($(HARDWARE_MOTHERBOARD),1111)
|
||||
# Bigtreetech or BIQU KFB2.0
|
||||
# BigTreeTech or BIQU KFB2.0
|
||||
else ifeq ($(HARDWARE_MOTHERBOARD),1112)
|
||||
# Felix 2.0+ Electronics Board (RAMPS like)
|
||||
else ifeq ($(HARDWARE_MOTHERBOARD),1113)
|
||||
|
@@ -28,7 +28,7 @@
|
||||
/**
|
||||
* Marlin release version identifier
|
||||
*/
|
||||
//#define SHORT_BUILD_VERSION "2.0.0.1"
|
||||
//#define SHORT_BUILD_VERSION "2.0.2.1"
|
||||
|
||||
/**
|
||||
* Verbose version identifier which should contain a reference to the location
|
||||
@@ -41,7 +41,7 @@
|
||||
* here we define this default string as the date where the latest release
|
||||
* version was tagged.
|
||||
*/
|
||||
//#define STRING_DISTRIBUTION_DATE "2023-07-19"
|
||||
//#define STRING_DISTRIBUTION_DATE "2020-01-27"
|
||||
|
||||
/**
|
||||
* Defines a generic printer name to be output to the LCD after booting Marlin.
|
||||
|
@@ -91,24 +91,37 @@ typedef int8_t pin_t;
|
||||
#define NUM_SERIAL 1
|
||||
#else
|
||||
#if !WITHIN(SERIAL_PORT, -1, 3)
|
||||
#error "SERIAL_PORT must be from -1 to 3"
|
||||
#error "SERIAL_PORT must be from -1 to 3. Please update your configuration."
|
||||
#endif
|
||||
|
||||
#define MYSERIAL0 customizedSerial1
|
||||
|
||||
#ifdef SERIAL_PORT_2
|
||||
#if !WITHIN(SERIAL_PORT_2, -1, 3)
|
||||
#error "SERIAL_PORT_2 must be from -1 to 3"
|
||||
#error "SERIAL_PORT_2 must be from -1 to 3. Please update your configuration."
|
||||
#elif SERIAL_PORT_2 == SERIAL_PORT
|
||||
#error "SERIAL_PORT_2 must be different than SERIAL_PORT"
|
||||
#error "SERIAL_PORT_2 must be different than SERIAL_PORT. Please update your configuration."
|
||||
#endif
|
||||
#define NUM_SERIAL 2
|
||||
#define MYSERIAL1 customizedSerial2
|
||||
#define NUM_SERIAL 2
|
||||
#else
|
||||
#define NUM_SERIAL 1
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef DGUS_SERIAL_PORT
|
||||
#if !WITHIN(DGUS_SERIAL_PORT, -1, 3)
|
||||
#error "DGUS_SERIAL_PORT must be from -1 to 3. Please update your configuration."
|
||||
#elif DGUS_SERIAL_PORT == SERIAL_PORT
|
||||
#error "DGUS_SERIAL_PORT must be different than SERIAL_PORT. Please update your configuration."
|
||||
#elif defined(SERIAL_PORT_2) && DGUS_SERIAL_PORT == SERIAL_PORT_2
|
||||
#error "DGUS_SERIAL_PORT must be different than SERIAL_PORT_2. Please update your configuration."
|
||||
#endif
|
||||
#define DGUS_SERIAL internalDgusSerial
|
||||
|
||||
#define DGUS_SERIAL_GET_TX_BUFFER_FREE DGUS_SERIAL.get_tx_buffer_free
|
||||
#endif
|
||||
|
||||
// ------------------------
|
||||
// Public functions
|
||||
// ------------------------
|
||||
@@ -345,9 +358,9 @@ void TIMER0_COMPB_vect_bottom()
|
||||
|
||||
// ADC
|
||||
#ifdef DIDR2
|
||||
#define HAL_ANALOG_SELECT(pin) do{ if (pin < 8) SBI(DIDR0, pin); else SBI(DIDR2, pin & 0x07); }while(0)
|
||||
#define HAL_ANALOG_SELECT(ind) do{ if (ind < 8) SBI(DIDR0, ind); else SBI(DIDR2, ind & 0x07); }while(0)
|
||||
#else
|
||||
#define HAL_ANALOG_SELECT(pin) do{ SBI(DIDR0, pin); }while(0)
|
||||
#define HAL_ANALOG_SELECT(ind) SBI(DIDR0, ind);
|
||||
#endif
|
||||
|
||||
inline void HAL_adc_init() {
|
||||
@@ -358,11 +371,11 @@ inline void HAL_adc_init() {
|
||||
#endif
|
||||
}
|
||||
|
||||
#define SET_ADMUX_ADCSRA(pin) ADMUX = _BV(REFS0) | (pin & 0x07); SBI(ADCSRA, ADSC)
|
||||
#define SET_ADMUX_ADCSRA(ch) ADMUX = _BV(REFS0) | (ch & 0x07); SBI(ADCSRA, ADSC)
|
||||
#ifdef MUX5
|
||||
#define HAL_START_ADC(pin) if (pin > 7) ADCSRB = _BV(MUX5); else ADCSRB = 0; SET_ADMUX_ADCSRA(pin)
|
||||
#define HAL_START_ADC(ch) if (ch > 7) ADCSRB = _BV(MUX5); else ADCSRB = 0; SET_ADMUX_ADCSRA(ch)
|
||||
#else
|
||||
#define HAL_START_ADC(pin) ADCSRB = 0; SET_ADMUX_ADCSRA(pin)
|
||||
#define HAL_START_ADC(ch) ADCSRB = 0; SET_ADMUX_ADCSRA(ch)
|
||||
#endif
|
||||
|
||||
#define HAL_ADC_RESOLUTION 10
|
||||
|
@@ -41,7 +41,7 @@
|
||||
#if !defined(USBCON) && (defined(UBRRH) || defined(UBRR0H) || defined(UBRR1H) || defined(UBRR2H) || defined(UBRR3H))
|
||||
|
||||
#include "MarlinSerial.h"
|
||||
#include "../../Marlin.h"
|
||||
#include "../../MarlinCore.h"
|
||||
|
||||
template<typename Cfg> typename MarlinSerial<Cfg>::ring_buffer_r MarlinSerial<Cfg>::rx_buffer = { 0, 0, { 0 } };
|
||||
template<typename Cfg> typename MarlinSerial<Cfg>::ring_buffer_t MarlinSerial<Cfg>::tx_buffer = { 0 };
|
||||
@@ -757,6 +757,33 @@
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef DGUS_SERIAL_PORT
|
||||
|
||||
template<typename Cfg>
|
||||
typename MarlinSerial<Cfg>::ring_buffer_pos_t MarlinSerial<Cfg>::get_tx_buffer_free() {
|
||||
const ring_buffer_pos_t t = tx_buffer.tail, // next byte to send.
|
||||
h = tx_buffer.head; // next pos for queue.
|
||||
int ret = t - h - 1;
|
||||
if (ret < 0) ret += Cfg::TX_SIZE + 1;
|
||||
return ret;
|
||||
}
|
||||
|
||||
ISR(SERIAL_REGNAME(USART,DGUS_SERIAL_PORT,_RX_vect)) {
|
||||
MarlinSerial<MarlinInternalSerialCfg<DGUS_SERIAL_PORT>>::store_rxd_char();
|
||||
}
|
||||
|
||||
ISR(SERIAL_REGNAME(USART,DGUS_SERIAL_PORT,_UDRE_vect)) {
|
||||
MarlinSerial<MarlinInternalSerialCfg<DGUS_SERIAL_PORT>>::_tx_udr_empty_irq();
|
||||
}
|
||||
|
||||
// Preinstantiate
|
||||
template class MarlinSerial<MarlinInternalSerialCfg<DGUS_SERIAL_PORT>>;
|
||||
|
||||
// Instantiate
|
||||
MarlinSerial<MarlinInternalSerialCfg<DGUS_SERIAL_PORT>> internalDgusSerial;
|
||||
|
||||
#endif
|
||||
|
||||
// For AT90USB targets use the UART for BT interfacing
|
||||
#if defined(USBCON) && ENABLED(BLUETOOTH)
|
||||
HardwareSerial bluetoothSerial;
|
||||
|
@@ -217,6 +217,9 @@
|
||||
static ring_buffer_pos_t available();
|
||||
static void write(const uint8_t c);
|
||||
static void flushTX();
|
||||
#ifdef DGUS_SERIAL_PORT
|
||||
static ring_buffer_pos_t get_tx_buffer_free();
|
||||
#endif
|
||||
|
||||
FORCE_INLINE static uint8_t dropped() { return Cfg::DROPPED_RX ? rx_dropped_bytes : 0; }
|
||||
FORCE_INLINE static uint8_t buffer_overruns() { return Cfg::RX_OVERRUNS ? rx_buffer_overruns : 0; }
|
||||
@@ -292,6 +295,23 @@
|
||||
extern MarlinSerial<MarlinInternalSerialCfg<INTERNAL_SERIAL_PORT>> internalSerial;
|
||||
#endif
|
||||
|
||||
#ifdef DGUS_SERIAL_PORT
|
||||
template <uint8_t serial>
|
||||
struct MarlinInternalSerialCfg {
|
||||
static constexpr int PORT = serial;
|
||||
static constexpr unsigned int RX_SIZE = 128;
|
||||
static constexpr unsigned int TX_SIZE = 48;
|
||||
static constexpr bool XONOFF = false;
|
||||
static constexpr bool EMERGENCYPARSER = false;
|
||||
static constexpr bool DROPPED_RX = false;
|
||||
static constexpr bool RX_OVERRUNS = bDGUS_SERIAL_STATS_RX_BUFFER_OVERRUNS;
|
||||
static constexpr bool RX_FRAMING_ERRORS = false;
|
||||
static constexpr bool MAX_RX_QUEUED = false;
|
||||
};
|
||||
|
||||
extern MarlinSerial<MarlinInternalSerialCfg<DGUS_SERIAL_PORT>> internalDgusSerial;
|
||||
#endif
|
||||
|
||||
// Use the UART for Bluetooth in AT90USB configurations
|
||||
#if defined(USBCON) && ENABLED(BLUETOOTH)
|
||||
extern HardwareSerial bluetoothSerial;
|
||||
|
@@ -232,6 +232,22 @@ void setup_endstop_interrupts() {
|
||||
pciSetup(Z3_MIN_PIN);
|
||||
#endif
|
||||
#endif
|
||||
#if HAS_Z4_MAX
|
||||
#if (digitalPinToInterrupt(Z4_MAX_PIN) != NOT_AN_INTERRUPT)
|
||||
_ATTACH(Z4_MAX_PIN);
|
||||
#else
|
||||
static_assert(digitalPinHasPCICR(Z4_MAX_PIN), "Z4_MAX_PIN is not interrupt-capable");
|
||||
pciSetup(Z4_MAX_PIN);
|
||||
#endif
|
||||
#endif
|
||||
#if HAS_Z4_MIN
|
||||
#if (digitalPinToInterrupt(Z4_MIN_PIN) != NOT_AN_INTERRUPT)
|
||||
_ATTACH(Z4_MIN_PIN);
|
||||
#else
|
||||
static_assert(digitalPinHasPCICR(Z4_MIN_PIN), "Z4_MIN_PIN is not interrupt-capable");
|
||||
pciSetup(Z4_MIN_PIN);
|
||||
#endif
|
||||
#endif
|
||||
#if HAS_Z_MIN_PROBE_PIN
|
||||
#if (digitalPinToInterrupt(Z_MIN_PROBE_PIN) != NOT_AN_INTERRUPT)
|
||||
_ATTACH(Z_MIN_PROBE_PIN);
|
||||
|
@@ -279,14 +279,25 @@ enum ClockSource2 : char {
|
||||
*/
|
||||
|
||||
// Determine which harware PWMs are already in use
|
||||
#define _PWM_CHK_FAN_B(P) (P == E0_AUTO_FAN_PIN || P == E1_AUTO_FAN_PIN || P == E2_AUTO_FAN_PIN || P == E3_AUTO_FAN_PIN || P == E4_AUTO_FAN_PIN || P == E5_AUTO_FAN_PIN || P == E6_AUTO_FAN_PIN || P == E7_AUTO_FAN_PIN || P == CHAMBER_AUTO_FAN_PIN)
|
||||
#if PIN_EXISTS(CONTROLLER_FAN)
|
||||
#define PWM_CHK_FAN_B(P) (P == CONTROLLER_FAN_PIN || P == E0_AUTO_FAN_PIN || P == E1_AUTO_FAN_PIN || P == E2_AUTO_FAN_PIN || P == E3_AUTO_FAN_PIN || P == E4_AUTO_FAN_PIN || P == E5_AUTO_FAN_PIN || P == CHAMBER_AUTO_FAN_PIN)
|
||||
#define PWM_CHK_FAN_B(P) (_PWM_CHK_FAN_B(P) || P == CONTROLLER_FAN_PIN)
|
||||
#else
|
||||
#define PWM_CHK_FAN_B(P) (P == E0_AUTO_FAN_PIN || P == E1_AUTO_FAN_PIN || P == E2_AUTO_FAN_PIN || P == E3_AUTO_FAN_PIN || P == E4_AUTO_FAN_PIN || P == E5_AUTO_FAN_PIN || P == CHAMBER_AUTO_FAN_PIN)
|
||||
#define PWM_CHK_FAN_B(P) _PWM_CHK_FAN_B(P)
|
||||
#endif
|
||||
|
||||
#if ANY_PIN(FAN, FAN1, FAN2)
|
||||
#if PIN_EXISTS(FAN2)
|
||||
#if ANY_PIN(FAN, FAN1, FAN2, FAN3, FAN4, FAN5, FAN6, FAN7)
|
||||
#if PIN_EXISTS(FAN7)
|
||||
#define PWM_CHK_FAN_A(P) (P == FAN0_PIN || P == FAN1_PIN || P == FAN2_PIN || P == FAN3_PIN || P == FAN4_PIN || P == FAN5_PIN || P == FAN6_PIN || P == FAN7_PIN)
|
||||
#elif PIN_EXISTS(FAN6)
|
||||
#define PWM_CHK_FAN_A(P) (P == FAN0_PIN || P == FAN1_PIN || P == FAN2_PIN || P == FAN3_PIN || P == FAN4_PIN || P == FAN5_PIN || P == FAN6_PIN)
|
||||
#elif PIN_EXISTS(FAN5)
|
||||
#define PWM_CHK_FAN_A(P) (P == FAN0_PIN || P == FAN1_PIN || P == FAN2_PIN || P == FAN3_PIN || P == FAN4_PIN || P == FAN5_PIN)
|
||||
#elif PIN_EXISTS(FAN4)
|
||||
#define PWM_CHK_FAN_A(P) (P == FAN0_PIN || P == FAN1_PIN || P == FAN2_PIN || P == FAN3_PIN || P == FAN4_PIN)
|
||||
#elif PIN_EXISTS(FAN3)
|
||||
#define PWM_CHK_FAN_A(P) (P == FAN0_PIN || P == FAN1_PIN || P == FAN2_PIN || P == FAN3_PIN)
|
||||
#elif PIN_EXISTS(FAN2)
|
||||
#define PWM_CHK_FAN_A(P) (P == FAN0_PIN || P == FAN1_PIN || P == FAN2_PIN)
|
||||
#elif PIN_EXISTS(FAN1)
|
||||
#define PWM_CHK_FAN_A(P) (P == FAN0_PIN || P == FAN1_PIN)
|
||||
|
@@ -39,7 +39,7 @@
|
||||
* Checks for FAST PWM
|
||||
*/
|
||||
#if ENABLED(FAST_PWM_FAN) && (ENABLED(USE_OCR2A_AS_TOP) && defined(TCCR2))
|
||||
#error "USE_OCR2A_AS_TOP does not apply to devices with a single output TIMER2"
|
||||
#error "USE_OCR2A_AS_TOP does not apply to devices with a single output TIMER2"
|
||||
#endif
|
||||
|
||||
/**
|
||||
@@ -59,3 +59,7 @@
|
||||
#if HAS_TRINAMIC && ENABLED(ENDSTOP_INTERRUPTS_FEATURE)
|
||||
#error "TMCStepper includes SoftwareSerial.h which is incompatible with ENDSTOP_INTERRUPTS_FEATURE. Disable ENDSTOP_INTERRUPTS_FEATURE to continue."
|
||||
#endif
|
||||
|
||||
#if TMC_HAS_SW_SERIAL && ENABLED(MONITOR_DRIVER_STATUS)
|
||||
#error "MONITOR_DRIVER_STATUS causes performance issues when used with SoftwareSerial-connected drivers. Disable MONITOR_DRIVER_STATUS or use hardware serial to continue."
|
||||
#endif
|
||||
|
@@ -26,7 +26,10 @@
|
||||
|
||||
#define NUMBER_PINS_TOTAL NUM_DIGITAL_PINS
|
||||
|
||||
#define AVR_ATmega2560_FAMILY_PLUS_70 MB(BQ_ZUM_MEGA_3D, MIGHTYBOARD_REVE, MINIRAMBO, SCOOVO_X9H)
|
||||
|
||||
#if AVR_AT90USB1286_FAMILY
|
||||
|
||||
// Working with Teensyduino extension so need to re-define some things
|
||||
#include "pinsDebug_Teensyduino.h"
|
||||
// Can't use the "digitalPinToPort" function from the Teensyduino type IDEs
|
||||
@@ -35,7 +38,9 @@
|
||||
#define digitalPinToBitMask_DEBUG(p) digitalPinToBitMask(p)
|
||||
#define digitalPinToPort_DEBUG(p) digitalPinToPort_Teensy(p)
|
||||
#define GET_PINMODE(pin) (*portModeRegister(pin) & digitalPinToBitMask_DEBUG(pin))
|
||||
|
||||
#elif AVR_ATmega2560_FAMILY_PLUS_70 // So we can access/display all the pins on boards using more than 70
|
||||
|
||||
#include "pinsDebug_plus_70.h"
|
||||
#define digitalPinToTimer_DEBUG(p) digitalPinToTimer_plus_70(p)
|
||||
#define digitalPinToBitMask_DEBUG(p) digitalPinToBitMask_plus_70(p)
|
||||
@@ -43,11 +48,13 @@
|
||||
bool GET_PINMODE(int8_t pin) {return *portModeRegister(digitalPinToPort_DEBUG(pin)) & digitalPinToBitMask_DEBUG(pin); }
|
||||
|
||||
#else
|
||||
|
||||
#define digitalPinToTimer_DEBUG(p) digitalPinToTimer(p)
|
||||
#define digitalPinToBitMask_DEBUG(p) digitalPinToBitMask(p)
|
||||
#define digitalPinToPort_DEBUG(p) digitalPinToPort(p)
|
||||
bool GET_PINMODE(int8_t pin) {return *portModeRegister(digitalPinToPort_DEBUG(pin)) & digitalPinToBitMask_DEBUG(pin); }
|
||||
#define GET_ARRAY_PIN(p) pgm_read_byte(&pin_array[p].pin)
|
||||
|
||||
#endif
|
||||
|
||||
#define VALID_PIN(pin) (pin >= 0 && pin < NUM_DIGITAL_PINS ? 1 : 0)
|
||||
@@ -224,11 +231,10 @@ static void err_is_interrupt() { SERIAL_ECHOPGM(" compare interrupt enabled"
|
||||
static void err_prob_interrupt() { SERIAL_ECHOPGM(" overflow interrupt enabled"); }
|
||||
static void print_is_also_tied() { SERIAL_ECHOPGM(" is also tied to this pin"); SERIAL_ECHO_SP(14); }
|
||||
|
||||
void com_print(uint8_t N, uint8_t Z) {
|
||||
inline void com_print(const uint8_t N, const uint8_t Z) {
|
||||
const uint8_t *TCCRA = (uint8_t*)TCCR_A(N);
|
||||
SERIAL_ECHOPGM(" COM");
|
||||
SERIAL_CHAR('0' + N);
|
||||
SERIAL_CHAR('A' + Z);
|
||||
SERIAL_CHAR('0' + N, Z);
|
||||
SERIAL_ECHOPAIR(": ", int((*TCCRA >> (6 - Z * 2)) & 0x03));
|
||||
}
|
||||
|
||||
@@ -240,8 +246,7 @@ void timer_prefix(uint8_t T, char L, uint8_t N) { // T - timer L - pwm N -
|
||||
if (N == 4) WGM |= ((*TCCRB & _BV(WGM_3)) >> 1);
|
||||
|
||||
SERIAL_ECHOPGM(" TIMER");
|
||||
SERIAL_CHAR(T + '0');
|
||||
SERIAL_CHAR(L);
|
||||
SERIAL_CHAR(T + '0', L);
|
||||
SERIAL_ECHO_SP(3);
|
||||
|
||||
if (N == 3) {
|
||||
|
@@ -28,7 +28,7 @@
|
||||
|
||||
#include "watchdog.h"
|
||||
|
||||
#include "../../Marlin.h"
|
||||
#include "../../MarlinCore.h"
|
||||
|
||||
// Initialize watchdog with 8s timeout, if possible. Otherwise, make it 4s.
|
||||
void watchdog_init() {
|
||||
|
@@ -94,8 +94,8 @@ int freeMemory() {
|
||||
// ADC
|
||||
// ------------------------
|
||||
|
||||
void HAL_adc_start_conversion(const uint8_t adc_pin) {
|
||||
HAL_adc_result = analogRead(adc_pin);
|
||||
void HAL_adc_start_conversion(const uint8_t ch) {
|
||||
HAL_adc_result = analogRead(ch);
|
||||
}
|
||||
|
||||
uint16_t HAL_adc_get_result() {
|
||||
|
@@ -56,8 +56,7 @@
|
||||
#ifdef SERIAL_PORT_2
|
||||
#if SERIAL_PORT_2 == SERIAL_PORT
|
||||
#error "SERIAL_PORT_2 must be different from SERIAL_PORT. Please update your configuration."
|
||||
#endif
|
||||
#if SERIAL_PORT_2 == -1
|
||||
#elif SERIAL_PORT_2 == -1
|
||||
#define MYSERIAL1 customizedSerial2
|
||||
#elif SERIAL_PORT_2 == 0
|
||||
#define MYSERIAL1 Serial
|
||||
@@ -75,6 +74,27 @@
|
||||
#define NUM_SERIAL 1
|
||||
#endif
|
||||
|
||||
#ifdef DGUS_SERIAL_PORT
|
||||
#if DGUS_SERIAL_PORT == SERIAL_PORT
|
||||
#error "DGUS_SERIAL_PORT must be different from SERIAL_PORT. Please update your configuration."
|
||||
#elif defined(SERIAL_PORT_2) && DGUS_SERIAL_PORT == SERIAL_PORT_2
|
||||
#error "DGUS_SERIAL_PORT must be different than SERIAL_PORT_2. Please update your configuration."
|
||||
#elif DGUS_SERIAL_PORT == -1
|
||||
#define DGUS_SERIAL internalDgusSerial
|
||||
#elif DGUS_SERIAL_PORT == 0
|
||||
#define DGUS_SERIAL Serial
|
||||
#elif DGUS_SERIAL_PORT == 1
|
||||
#define DGUS_SERIAL Serial1
|
||||
#elif DGUS_SERIAL_PORT == 2
|
||||
#define DGUS_SERIAL Serial2
|
||||
#elif DGUS_SERIAL_PORT == 3
|
||||
#define DGUS_SERIAL Serial3
|
||||
#else
|
||||
#error "DGUS_SERIAL_PORT must be from -1 to 3. Please update your configuration."
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
#include "MarlinSerial.h"
|
||||
#include "MarlinSerialUSB.h"
|
||||
|
||||
@@ -128,16 +148,16 @@ extern uint16_t HAL_adc_result; // result of last ADC conversion
|
||||
#define analogInputToDigitalPin(p) ((p < 12u) ? (p) + 54u : -1)
|
||||
#endif
|
||||
|
||||
#define HAL_ANALOG_SELECT(pin)
|
||||
#define HAL_ANALOG_SELECT(ch)
|
||||
|
||||
inline void HAL_adc_init() {}//todo
|
||||
|
||||
#define HAL_START_ADC(pin) HAL_adc_start_conversion(pin)
|
||||
#define HAL_START_ADC(ch) HAL_adc_start_conversion(ch)
|
||||
#define HAL_ADC_RESOLUTION 10
|
||||
#define HAL_READ_ADC() HAL_adc_result
|
||||
#define HAL_ADC_READY() true
|
||||
|
||||
void HAL_adc_start_conversion(const uint8_t adc_pin);
|
||||
void HAL_adc_start_conversion(const uint8_t ch);
|
||||
uint16_t HAL_adc_get_result();
|
||||
|
||||
//
|
||||
|
@@ -240,7 +240,7 @@
|
||||
}
|
||||
|
||||
// all the others
|
||||
static uint32_t spiDelayCyclesX4 = (F_CPU) / 1000000; // 4uS => 125khz
|
||||
static uint32_t spiDelayCyclesX4 = (F_CPU) / 1000000; // 4µs => 125khz
|
||||
|
||||
static uint8_t spiTransferX(uint8_t b) { // using Mode 0
|
||||
int bits = 8;
|
||||
|
@@ -31,7 +31,7 @@
|
||||
|
||||
#include "MarlinSerial.h"
|
||||
#include "InterruptVectors.h"
|
||||
#include "../../Marlin.h"
|
||||
#include "../../MarlinCore.h"
|
||||
|
||||
template<typename Cfg> typename MarlinSerial<Cfg>::ring_buffer_r MarlinSerial<Cfg>::rx_buffer = { 0, 0, { 0 } };
|
||||
template<typename Cfg> typename MarlinSerial<Cfg>::ring_buffer_t MarlinSerial<Cfg>::tx_buffer = { 0 };
|
||||
|
@@ -63,7 +63,7 @@
|
||||
|
||||
#include <U8glib.h>
|
||||
|
||||
#include "../../../Marlin.h"
|
||||
#include "../../../MarlinCore.h"
|
||||
|
||||
void spiBegin();
|
||||
void spiInit(uint8_t spiRate);
|
||||
|
@@ -77,6 +77,12 @@ void setup_endstop_interrupts() {
|
||||
#if HAS_Z3_MIN
|
||||
_ATTACH(Z3_MIN_PIN);
|
||||
#endif
|
||||
#if HAS_Z4_MAX
|
||||
_ATTACH(Z4_MAX_PIN);
|
||||
#endif
|
||||
#if HAS_Z4_MIN
|
||||
_ATTACH(Z4_MIN_PIN);
|
||||
#endif
|
||||
#if HAS_Z_MIN_PROBE_PIN
|
||||
_ATTACH(Z_MIN_PROBE_PIN);
|
||||
#endif
|
||||
|
@@ -55,3 +55,7 @@
|
||||
#if ENABLED(FAST_PWM_FAN)
|
||||
#error "FAST_PWM_FAN is not yet implemented for this platform."
|
||||
#endif
|
||||
|
||||
#if TMC_HAS_SW_SERIAL
|
||||
#error "TMC220x Software Serial is not supported on this platform."
|
||||
#endif
|
||||
|
@@ -1479,7 +1479,7 @@ static void udd_ctrl_in_sent(void)
|
||||
// The IN data don't must be written in endpoint 0 DPRAM during
|
||||
// a next setup reception in same endpoint 0 DPRAM.
|
||||
// Thereby, an OUT ZLP reception must check before IN data write
|
||||
// and if no OUT ZLP is recevied the data must be written quickly (800us)
|
||||
// and if no OUT ZLP is received the data must be written quickly (800µs)
|
||||
// before an eventually ZLP OUT and SETUP reception
|
||||
flags = cpu_irq_save();
|
||||
if (Is_udd_out_received(0)) {
|
||||
|
@@ -23,7 +23,7 @@
|
||||
#ifdef ARDUINO_ARCH_SAM
|
||||
|
||||
#include "../../inc/MarlinConfig.h"
|
||||
#include "../../Marlin.h"
|
||||
#include "../../MarlinCore.h"
|
||||
#include "watchdog.h"
|
||||
|
||||
// Override Arduino runtime to either config or disable the watchdog
|
||||
|
@@ -30,10 +30,6 @@
|
||||
|
||||
#include "../../inc/MarlinConfigPre.h"
|
||||
|
||||
#if EITHER(EEPROM_SETTINGS, WEBSUPPORT)
|
||||
#include "spiffs.h"
|
||||
#endif
|
||||
|
||||
#if ENABLED(WIFISUPPORT)
|
||||
#include <ESPAsyncWebServer.h>
|
||||
#include "wifi.h"
|
||||
@@ -41,6 +37,7 @@
|
||||
#include "ota.h"
|
||||
#endif
|
||||
#if ENABLED(WEBSUPPORT)
|
||||
#include "spiffs.h"
|
||||
#include "web.h"
|
||||
#endif
|
||||
#endif
|
||||
@@ -78,21 +75,32 @@ volatile int numPWMUsed = 0,
|
||||
// Public functions
|
||||
// ------------------------
|
||||
|
||||
void HAL_init() {
|
||||
i2s_init();
|
||||
}
|
||||
#if ENABLED(WIFI_CUSTOM_COMMAND)
|
||||
|
||||
bool wifi_custom_command(char * const command_ptr) {
|
||||
#if ENABLED(ESP3D_WIFISUPPORT)
|
||||
return esp3dlib.parse(command_ptr);
|
||||
#else
|
||||
UNUSED(command_ptr);
|
||||
return false;
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
void HAL_init() { i2s_init(); }
|
||||
|
||||
void HAL_init_board() {
|
||||
#if EITHER(EEPROM_SETTINGS, WEBSUPPORT)
|
||||
spiffs_init();
|
||||
#endif
|
||||
|
||||
#if ENABLED(WIFISUPPORT)
|
||||
#if ENABLED(ESP3D_WIFISUPPORT)
|
||||
esp3dlib.init();
|
||||
#elif ENABLED(WIFISUPPORT)
|
||||
wifi_init();
|
||||
#if ENABLED(OTASUPPORT)
|
||||
OTA_init();
|
||||
#endif
|
||||
#if ENABLED(WEBSUPPORT)
|
||||
spiffs_init();
|
||||
web_init();
|
||||
#endif
|
||||
server.begin();
|
||||
@@ -100,9 +108,12 @@ void HAL_init_board() {
|
||||
}
|
||||
|
||||
void HAL_idletask() {
|
||||
#if ENABLED(OTASUPPORT)
|
||||
#if BOTH(WIFISUPPORT, OTASUPPORT)
|
||||
OTA_handle();
|
||||
#endif
|
||||
#if ENABLED(ESP3D_WIFISUPPORT)
|
||||
esp3dlib.idletask();
|
||||
#endif
|
||||
}
|
||||
|
||||
void HAL_clear_reset_source() { }
|
||||
@@ -183,7 +194,7 @@ void HAL_adc_init() {
|
||||
}
|
||||
}
|
||||
|
||||
void HAL_adc_start_conversion(uint8_t adc_pin) {
|
||||
void HAL_adc_start_conversion(const uint8_t adc_pin) {
|
||||
const adc1_channel_t chan = get_channel(adc_pin);
|
||||
uint32_t mv;
|
||||
esp_adc_cal_get_voltage((adc_channel_t)chan, &characteristics[attenuations[chan]], &mv);
|
||||
|
@@ -36,7 +36,14 @@
|
||||
|
||||
#include "timers.h"
|
||||
|
||||
#include "WebSocketSerial.h"
|
||||
#if ENABLED(WIFISUPPORT)
|
||||
#include "WebSocketSerial.h"
|
||||
#endif
|
||||
|
||||
#if ENABLED(ESP3D_WIFISUPPORT)
|
||||
#include "esp3dlib.h"
|
||||
#endif
|
||||
|
||||
#include "FlushableHardwareSerial.h"
|
||||
|
||||
// ------------------------
|
||||
@@ -47,9 +54,13 @@ extern portMUX_TYPE spinlock;
|
||||
|
||||
#define MYSERIAL0 flushableSerial
|
||||
|
||||
#if ENABLED(WIFISUPPORT)
|
||||
#if EITHER(WIFISUPPORT, ESP3D_WIFISUPPORT)
|
||||
#if ENABLED(ESP3D_WIFISUPPORT)
|
||||
#define MYSERIAL1 Serial2Socket
|
||||
#else
|
||||
#define MYSERIAL1 webSocketSerial
|
||||
#endif
|
||||
#define NUM_SERIAL 2
|
||||
#define MYSERIAL1 webSocketSerial
|
||||
#else
|
||||
#define NUM_SERIAL 1
|
||||
#endif
|
||||
@@ -60,7 +71,6 @@ extern portMUX_TYPE spinlock;
|
||||
#define ENABLE_ISRS() if (spinlock.owner != portMUX_FREE_VAL) portEXIT_CRITICAL(&spinlock)
|
||||
#define DISABLE_ISRS() portENTER_CRITICAL(&spinlock)
|
||||
|
||||
|
||||
// Fix bug in pgm_read_ptr
|
||||
#undef pgm_read_ptr
|
||||
#define pgm_read_ptr(addr) (*(addr))
|
||||
@@ -115,7 +125,7 @@ void HAL_adc_init();
|
||||
#define HAL_READ_ADC() HAL_adc_result
|
||||
#define HAL_ADC_READY() true
|
||||
|
||||
void HAL_adc_start_conversion(uint8_t adc_pin);
|
||||
void HAL_adc_start_conversion(const uint8_t adc_pin);
|
||||
|
||||
#define GET_PIN_MAP_PIN(index) index
|
||||
#define GET_PIN_MAP_INDEX(pin) pin
|
||||
@@ -127,3 +137,44 @@ void HAL_adc_start_conversion(uint8_t adc_pin);
|
||||
void HAL_idletask();
|
||||
void HAL_init();
|
||||
void HAL_init_board();
|
||||
|
||||
//
|
||||
// Delay in cycles (used by DELAY_NS / DELAY_US)
|
||||
//
|
||||
FORCE_INLINE static void DELAY_CYCLES(uint32_t x) {
|
||||
unsigned long start, ccount, stop;
|
||||
|
||||
/**
|
||||
* It's important to care for race conditions (and overflows) here.
|
||||
* Race condition example: If `stop` calculates to being close to the upper boundary of
|
||||
* `uint32_t` and if at the same time a longer loop interruption kicks in (e.g. due to other
|
||||
* FreeRTOS tasks or interrupts), `ccount` might overflow (and therefore be below `stop` again)
|
||||
* without the loop ever being able to notice that `ccount` had already been above `stop` once
|
||||
* (and that therefore the number of cycles to delay has already passed).
|
||||
* As DELAY_CYCLES (through DELAY_NS / DELAY_US) is used by software SPI bit banging to drive
|
||||
* LCDs and therefore might be called very, very often, this seemingly improbable situation did
|
||||
* actually happen in reality. It resulted in apparently random print pauses of ~17.9 seconds
|
||||
* (0x100000000 / 240 MHz) or multiples thereof, essentially ruining the current print by causing
|
||||
* large blobs of filament.
|
||||
*/
|
||||
|
||||
__asm__ __volatile__ ( "rsr %0, ccount" : "=a" (start) );
|
||||
stop = start + x;
|
||||
ccount = start;
|
||||
|
||||
if (stop >= start) {
|
||||
// no overflow, so only loop while in between start and stop:
|
||||
// 0x00000000 -----------------start****stop-- 0xffffffff
|
||||
while (ccount >= start && ccount < stop) {
|
||||
__asm__ __volatile__ ( "rsr %0, ccount" : "=a" (ccount) );
|
||||
}
|
||||
}
|
||||
else {
|
||||
// stop did overflow, so only loop while outside of stop and start:
|
||||
// 0x00000000 **stop-------------------start** 0xffffffff
|
||||
while (ccount >= start || ccount < stop) {
|
||||
__asm__ __volatile__ ( "rsr %0, ccount" : "=a" (ccount) );
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -37,7 +37,7 @@ Servo::Servo() {
|
||||
|
||||
int8_t Servo::attach(const int inPin) {
|
||||
if (channel >= CHANNEL_MAX_NUM) return -1;
|
||||
if (pin > 0) pin = inPin;
|
||||
if (inPin > 0) pin = inPin;
|
||||
|
||||
ledcSetup(channel, 50, 16); // channel X, 50 Hz, 16-bit depth
|
||||
ledcAttachPin(pin, channel);
|
||||
|
@@ -25,14 +25,16 @@
|
||||
|
||||
#include <Stream.h>
|
||||
|
||||
#ifndef RX_BUFFER_SIZE
|
||||
#define RX_BUFFER_SIZE 128
|
||||
#endif
|
||||
#ifndef TX_BUFFER_SIZE
|
||||
#define TX_BUFFER_SIZE 32
|
||||
#endif
|
||||
#if TX_BUFFER_SIZE <= 0
|
||||
#error "TX_BUFFER_SIZE is required for the WebSocket."
|
||||
#if ENABLED(WIFISUPPORT)
|
||||
#ifndef RX_BUFFER_SIZE
|
||||
#define RX_BUFFER_SIZE 128
|
||||
#endif
|
||||
#if TX_BUFFER_SIZE <= 0
|
||||
#error "TX_BUFFER_SIZE is required for the WebSocket."
|
||||
#endif
|
||||
#endif
|
||||
|
||||
typedef uint16_t ring_buffer_pos_t;
|
||||
|
@@ -72,6 +72,12 @@ void setup_endstop_interrupts() {
|
||||
#if HAS_Z3_MIN
|
||||
_ATTACH(Z3_MIN_PIN);
|
||||
#endif
|
||||
#if HAS_Z4_MAX
|
||||
_ATTACH(Z4_MAX_PIN);
|
||||
#endif
|
||||
#if HAS_Z4_MIN
|
||||
_ATTACH(Z4_MIN_PIN);
|
||||
#endif
|
||||
#if HAS_Z_MIN_PROBE_PIN
|
||||
_ATTACH(Z_MIN_PROBE_PIN);
|
||||
#endif
|
||||
|
@@ -177,7 +177,7 @@ int i2s_init() {
|
||||
*
|
||||
* fwclk = fbclk / 32
|
||||
*
|
||||
* for fwclk = 250kHz (4uS pulse time)
|
||||
* for fwclk = 250kHz (4µS pulse time)
|
||||
* N = 10
|
||||
* M = 20
|
||||
*/
|
||||
|
@@ -28,3 +28,11 @@
|
||||
#if ENABLED(FAST_PWM_FAN)
|
||||
#error "FAST_PWM_FAN is not yet implemented for this platform."
|
||||
#endif
|
||||
|
||||
#if TMC_HAS_SW_SERIAL
|
||||
#error "TMC220x Software Serial is not supported on this platform."
|
||||
#endif
|
||||
|
||||
#if BOTH(WIFISUPPORT, ESP3D_WIFISUPPORT)
|
||||
#error "Only enable one WiFi option, either WIFISUPPORT or ESP3D_WIFISUPPORT."
|
||||
#endif
|
||||
|
@@ -21,7 +21,7 @@
|
||||
|
||||
#include "../../inc/MarlinConfigPre.h"
|
||||
|
||||
#if ENABLED(OTASUPPORT)
|
||||
#if BOTH(WIFISUPPORT, OTASUPPORT)
|
||||
|
||||
#include <WiFi.h>
|
||||
#include <ESPmDNS.h>
|
||||
@@ -67,6 +67,5 @@ void OTA_handle() {
|
||||
ArduinoOTA.handle();
|
||||
}
|
||||
|
||||
#endif // OTASUPPORT
|
||||
|
||||
#endif // WIFISUPPORT && OTASUPPORT
|
||||
#endif // ARDUINO_ARCH_ESP32
|
||||
|
63
Marlin/src/HAL/HAL_ESP32/persistent_store_impl.cpp
Normal file
63
Marlin/src/HAL/HAL_ESP32/persistent_store_impl.cpp
Normal file
@@ -0,0 +1,63 @@
|
||||
/**
|
||||
* Marlin 3D Printer Firmware
|
||||
* Copyright (c) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
|
||||
*
|
||||
* Based on Sprinter and grbl.
|
||||
* Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifdef ARDUINO_ARCH_ESP32
|
||||
|
||||
#include "../../inc/MarlinConfig.h"
|
||||
|
||||
#if ENABLED(EEPROM_SETTINGS) && DISABLED(FLASH_EEPROM_EMULATION)
|
||||
|
||||
#include "../shared/persistent_store_api.h"
|
||||
#include "EEPROM.h"
|
||||
|
||||
#define EEPROM_SIZE 4096
|
||||
|
||||
bool PersistentStore::access_start() {
|
||||
return EEPROM.begin(EEPROM_SIZE);
|
||||
}
|
||||
|
||||
bool PersistentStore::access_finish() {
|
||||
EEPROM.end();
|
||||
return true;
|
||||
}
|
||||
|
||||
bool PersistentStore::write_data(int &pos, const uint8_t *value, size_t size, uint16_t *crc) {
|
||||
for (size_t i = 0; i < size; i++) {
|
||||
EEPROM.write(pos++, value[i]);
|
||||
crc16(crc, &value[i], 1);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool PersistentStore::read_data(int &pos, uint8_t* value, size_t size, uint16_t *crc, const bool writing/*=true*/) {
|
||||
for (size_t i = 0; i < size; i++) {
|
||||
uint8_t c = EEPROM.read(pos++);
|
||||
if (writing) value[i] = c;
|
||||
crc16(crc, &c, 1);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
size_t PersistentStore::capacity() { return EEPROM_SIZE; }
|
||||
|
||||
#endif // EEPROM_SETTINGS
|
||||
#endif // ARDUINO_ARCH_ESP32
|
@@ -1,106 +0,0 @@
|
||||
/**
|
||||
* Marlin 3D Printer Firmware
|
||||
* Copyright (c) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
|
||||
*
|
||||
* Based on Sprinter and grbl.
|
||||
* Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifdef ARDUINO_ARCH_ESP32
|
||||
|
||||
#include "../../inc/MarlinConfig.h"
|
||||
|
||||
#if ENABLED(EEPROM_SETTINGS) && DISABLED(FLASH_EEPROM_EMULATION)
|
||||
|
||||
#include "../shared/persistent_store_api.h"
|
||||
|
||||
#include <SPIFFS.h>
|
||||
#include <FS.h>
|
||||
#include "spiffs.h"
|
||||
|
||||
#define HAL_ESP32_EEPROM_SIZE 4096
|
||||
#define HAL_ESP32_EEPROM_FILE_PATH "/eeprom.dat"
|
||||
|
||||
File eeprom_file;
|
||||
|
||||
bool PersistentStore::access_start() {
|
||||
if (spiffs_initialized) {
|
||||
eeprom_file = SPIFFS.open(HAL_ESP32_EEPROM_FILE_PATH, "r+");
|
||||
|
||||
size_t file_size = eeprom_file.size();
|
||||
if (file_size < HAL_ESP32_EEPROM_SIZE) {
|
||||
SERIAL_ECHO_MSG("SPIFFS EEPROM settings file " HAL_ESP32_EEPROM_FILE_PATH " is too small or did not exist, expanding.");
|
||||
SERIAL_ECHO_START(); SERIAL_ECHOLNPAIR(" file size: ", file_size, ", required size: ", HAL_ESP32_EEPROM_SIZE);
|
||||
|
||||
// mode r+ does not allow to expand the file (at least on ESP32 SPIFFS9, so we close, reopen "a", append, close, reopen "r+"
|
||||
eeprom_file.close();
|
||||
|
||||
eeprom_file = SPIFFS.open(HAL_ESP32_EEPROM_FILE_PATH, "a");
|
||||
for (size_t i = eeprom_file.size(); i < HAL_ESP32_EEPROM_SIZE; i++)
|
||||
eeprom_file.write(0xFF);
|
||||
eeprom_file.close();
|
||||
|
||||
eeprom_file = SPIFFS.open(HAL_ESP32_EEPROM_FILE_PATH, "r+");
|
||||
file_size = eeprom_file.size();
|
||||
if (file_size < HAL_ESP32_EEPROM_SIZE) {
|
||||
SERIAL_ERROR_MSG("Failed to expand " HAL_ESP32_EEPROM_FILE_PATH " to required size. SPIFFS partition full?");
|
||||
SERIAL_ERROR_START(); SERIAL_ECHOLNPAIR(" file size: ", file_size, ", required size: ", HAL_ESP32_EEPROM_SIZE);
|
||||
SERIAL_ERROR_START(); SERIAL_ECHOLNPAIR(" SPIFFS used bytes: ", SPIFFS.usedBytes(), ", total bytes: ", SPIFFS.totalBytes());
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool PersistentStore::access_finish() {
|
||||
eeprom_file.close();
|
||||
return true;
|
||||
}
|
||||
|
||||
bool PersistentStore::write_data(int &pos, const uint8_t *value, size_t size, uint16_t *crc) {
|
||||
if (!eeprom_file.seek(pos)) return true; // return true for any error
|
||||
if (eeprom_file.write(value, size) != size) return true;
|
||||
|
||||
crc16(crc, value, size);
|
||||
pos += size;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool PersistentStore::read_data(int &pos, uint8_t* value, size_t size, uint16_t *crc, const bool writing/*=true*/) {
|
||||
if (!eeprom_file.seek(pos)) return true; // return true for any error
|
||||
|
||||
if (writing) {
|
||||
if (eeprom_file.read(value, size) != size) return true;
|
||||
crc16(crc, value, size);
|
||||
}
|
||||
else {
|
||||
uint8_t tmp[size];
|
||||
if (eeprom_file.read(tmp, size) != size) return true;
|
||||
crc16(crc, tmp, size);
|
||||
}
|
||||
|
||||
pos += size;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
size_t PersistentStore::capacity() { return HAL_ESP32_EEPROM_SIZE; }
|
||||
|
||||
#endif // EEPROM_SETTINGS
|
||||
#endif // ARDUINO_ARCH_ESP32
|
@@ -24,7 +24,7 @@
|
||||
|
||||
#include "../../inc/MarlinConfigPre.h"
|
||||
|
||||
#if EITHER(WEBSUPPORT, EEPROM_SETTINGS)
|
||||
#if BOTH(WIFISUPPORT, WEBSUPPORT)
|
||||
|
||||
#include "../../core/serial.h"
|
||||
|
||||
@@ -40,5 +40,5 @@ void spiffs_init() {
|
||||
SERIAL_ERROR_MSG("SPIFFS mount failed");
|
||||
}
|
||||
|
||||
#endif // WEBSUPPORT
|
||||
#endif // WIFISUPPORT && WEBSUPPORT
|
||||
#endif // ARDUINO_ARCH_ESP32
|
||||
|
@@ -47,7 +47,7 @@ typedef uint64_t hal_timer_t;
|
||||
|
||||
#if ENABLED(I2S_STEPPER_STREAM)
|
||||
#define STEPPER_TIMER_PRESCALE 1
|
||||
#define STEPPER_TIMER_RATE 250000 // 250khz, 4us pulses of i2s word clock
|
||||
#define STEPPER_TIMER_RATE 250000 // 250khz, 4µs pulses of i2s word clock
|
||||
#define STEPPER_TIMER_TICKS_PER_US ((STEPPER_TIMER_RATE) / 1000000) // stepper timer ticks per µs // wrong would be 0.25
|
||||
#else
|
||||
#define STEPPER_TIMER_PRESCALE 40
|
||||
|
@@ -21,8 +21,18 @@
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
esp_err_t esp_task_wdt_reset();
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
// Initialize watchdog with a 4 second interrupt time
|
||||
void watchdog_init();
|
||||
|
||||
// Reset watchdog.
|
||||
inline void HAL_watchdog_refresh() {}
|
||||
inline void HAL_watchdog_refresh() { esp_task_wdt_reset(); }
|
||||
|
@@ -22,13 +22,12 @@
|
||||
|
||||
#ifdef ARDUINO_ARCH_ESP32
|
||||
|
||||
#include <SPIFFS.h>
|
||||
#undef DISABLED // esp32-hal-gpio.h
|
||||
|
||||
#include "../../inc/MarlinConfigPre.h"
|
||||
|
||||
#if ENABLED(WEBSUPPORT)
|
||||
#if BOTH(WIFISUPPORT, WEBSUPPORT)
|
||||
|
||||
#undef DISABLED // esp32-hal-gpio.h
|
||||
#include <SPIFFS.h>
|
||||
#include "wifi.h"
|
||||
|
||||
AsyncEventSource events("/events"); // event source (Server-Sent events)
|
||||
@@ -43,5 +42,5 @@ void web_init() {
|
||||
server.onNotFound(onNotFound);
|
||||
}
|
||||
|
||||
#endif // WEBSUPPORT
|
||||
#endif // WIFISUPPORT && WEBSUPPORT
|
||||
#endif // ARDUINO_ARCH_ESP32
|
||||
|
@@ -55,7 +55,7 @@ void HAL_adc_init() {
|
||||
|
||||
}
|
||||
|
||||
void HAL_adc_enable_channel(int ch) {
|
||||
void HAL_adc_enable_channel(const uint8_t ch) {
|
||||
|
||||
}
|
||||
|
||||
|
@@ -87,15 +87,15 @@ int freeMemory();
|
||||
#pragma GCC diagnostic pop
|
||||
|
||||
// ADC
|
||||
#define HAL_ANALOG_SELECT(pin) HAL_adc_enable_channel(pin)
|
||||
#define HAL_START_ADC(pin) HAL_adc_start_conversion(pin)
|
||||
#define HAL_ADC_RESOLUTION 10
|
||||
#define HAL_READ_ADC() HAL_adc_get_result()
|
||||
#define HAL_ADC_READY() true
|
||||
#define HAL_ANALOG_SELECT(ch) HAL_adc_enable_channel(ch)
|
||||
#define HAL_START_ADC(ch) HAL_adc_start_conversion(ch)
|
||||
#define HAL_ADC_RESOLUTION 10
|
||||
#define HAL_READ_ADC() HAL_adc_get_result()
|
||||
#define HAL_ADC_READY() true
|
||||
|
||||
void HAL_adc_init();
|
||||
void HAL_adc_enable_channel(int pin);
|
||||
void HAL_adc_start_conversion(const uint8_t adc_pin);
|
||||
void HAL_adc_enable_channel(const uint8_t ch);
|
||||
void HAL_adc_start_conversion(const uint8_t ch);
|
||||
uint16_t HAL_adc_get_result();
|
||||
|
||||
// Reset source
|
||||
|
@@ -33,3 +33,7 @@
|
||||
#if ENABLED(FAST_PWM_FAN)
|
||||
#error "FAST_PWM_FAN is not yet implemented for this platform."
|
||||
#endif
|
||||
|
||||
#if TMC_HAS_SW_SERIAL
|
||||
#error "TMC220x Software Serial is not supported on this platform."
|
||||
#endif
|
||||
|
@@ -61,10 +61,6 @@ extern "C" volatile uint32_t _millis;
|
||||
#define ST7920_DELAY_3 DELAY_NS(750)
|
||||
#endif
|
||||
|
||||
#if !WITHIN(SERIAL_PORT, -1, 3)
|
||||
#error "SERIAL_PORT must be from -1 to 3"
|
||||
#endif
|
||||
|
||||
#if SERIAL_PORT == -1
|
||||
#define MYSERIAL0 UsbSerial
|
||||
#elif SERIAL_PORT == 0
|
||||
@@ -75,16 +71,14 @@ extern "C" volatile uint32_t _millis;
|
||||
#define MYSERIAL0 MSerial2
|
||||
#elif SERIAL_PORT == 3
|
||||
#define MYSERIAL0 MSerial3
|
||||
#else
|
||||
#error "SERIAL_PORT must be from -1 to 3. Please update your configuration."
|
||||
#endif
|
||||
|
||||
#ifdef SERIAL_PORT_2
|
||||
#if !WITHIN(SERIAL_PORT_2, -1, 3)
|
||||
#error "SERIAL_PORT_2 must be from -1 to 3"
|
||||
#elif SERIAL_PORT_2 == SERIAL_PORT
|
||||
#error "SERIAL_PORT_2 must be different than SERIAL_PORT"
|
||||
#endif
|
||||
#define NUM_SERIAL 2
|
||||
#if SERIAL_PORT_2 == -1
|
||||
#if SERIAL_PORT_2 == SERIAL_PORT
|
||||
#error "SERIAL_PORT_2 must be different than SERIAL_PORT. Please update your configuration."
|
||||
#elif SERIAL_PORT_2 == -1
|
||||
#define MYSERIAL1 UsbSerial
|
||||
#elif SERIAL_PORT_2 == 0
|
||||
#define MYSERIAL1 MSerial
|
||||
@@ -94,11 +88,34 @@ extern "C" volatile uint32_t _millis;
|
||||
#define MYSERIAL1 MSerial2
|
||||
#elif SERIAL_PORT_2 == 3
|
||||
#define MYSERIAL1 MSerial3
|
||||
#else
|
||||
#error "SERIAL_PORT_2 must be from -1 to 3. Please update your configuration."
|
||||
#endif
|
||||
#define NUM_SERIAL 2
|
||||
#else
|
||||
#define NUM_SERIAL 1
|
||||
#endif
|
||||
|
||||
#ifdef DGUS_SERIAL_PORT
|
||||
#if DGUS_SERIAL_PORT == SERIAL_PORT
|
||||
#error "DGUS_SERIAL_PORT must be different than SERIAL_PORT. Please update your configuration."
|
||||
#elif defined(SERIAL_PORT_2) && DGUS_SERIAL_PORT == SERIAL_PORT_2
|
||||
#error "DGUS_SERIAL_PORT must be different than SERIAL_PORT_2. Please update your configuration."
|
||||
#elif DGUS_SERIAL_PORT == -1
|
||||
#define DGUS_SERIAL UsbSerial
|
||||
#elif DGUS_SERIAL_PORT == 0
|
||||
#define DGUS_SERIAL MSerial
|
||||
#elif DGUS_SERIAL_PORT == 1
|
||||
#define DGUS_SERIAL MSerial1
|
||||
#elif DGUS_SERIAL_PORT == 2
|
||||
#define DGUS_SERIAL MSerial2
|
||||
#elif DGUS_SERIAL_PORT == 3
|
||||
#define DGUS_SERIAL MSerial3
|
||||
#else
|
||||
#error "DGUS_SERIAL_PORT must be from -1 to 3. Please update your configuration."
|
||||
#endif
|
||||
#endif
|
||||
|
||||
//
|
||||
// Interrupts
|
||||
//
|
||||
|
@@ -93,7 +93,7 @@ void setup_endstop_interrupts() {
|
||||
_ATTACH(Z2_MIN_PIN);
|
||||
#endif
|
||||
#if HAS_Z3_MAX
|
||||
#if !LPC1768_PIN_INTERRUPT_M(Z3_MIN_PIN)
|
||||
#if !LPC1768_PIN_INTERRUPT_M(Z3_MAX_PIN)
|
||||
#error "Z3_MIN_PIN is not INTERRUPT-capable."
|
||||
#endif
|
||||
_ATTACH(Z3_MAX_PIN);
|
||||
@@ -104,6 +104,18 @@ void setup_endstop_interrupts() {
|
||||
#endif
|
||||
_ATTACH(Z3_MIN_PIN);
|
||||
#endif
|
||||
#if HAS_Z4_MAX
|
||||
#if !LPC1768_PIN_INTERRUPT_M(Z4_MAX_PIN)
|
||||
#error "Z4_MIN_PIN is not INTERRUPT-capable."
|
||||
#endif
|
||||
_ATTACH(Z4_MAX_PIN);
|
||||
#endif
|
||||
#if HAS_Z4_MIN
|
||||
#if !LPC1768_PIN_INTERRUPT_M(Z4_MIN_PIN)
|
||||
#error "Z4_MIN_PIN is not INTERRUPT-capable."
|
||||
#endif
|
||||
_ATTACH(Z4_MIN_PIN);
|
||||
#endif
|
||||
#if HAS_Z_MIN_PROBE_PIN
|
||||
#if !LPC1768_PIN_INTERRUPT_M(Z_MIN_PROBE_PIN)
|
||||
#error "Z_MIN_PROBE_PIN is not INTERRUPT-capable."
|
||||
|
@@ -46,6 +46,10 @@
|
||||
#error "TEMP_4_PIN must be defined using the Pn_nn or Pn_nn_An format. (See the included pins files)."
|
||||
#elif _OLD_TEMP_PIN(TEMP_5)
|
||||
#error "TEMP_5_PIN must be defined using the Pn_nn or Pn_nn_An format. (See the included pins files)."
|
||||
#elif _OLD_TEMP_PIN(TEMP_6)
|
||||
#error "TEMP_6_PIN must be defined using the Pn_nn or Pn_nn_An format. (See the included pins files)."
|
||||
#elif _OLD_TEMP_PIN(TEMP_7)
|
||||
#error "TEMP_7_PIN must be defined using the Pn_nn or Pn_nn_An format. (See the included pins files)."
|
||||
#endif
|
||||
#undef _OLD_TEMP_PIN
|
||||
|
||||
@@ -68,3 +72,7 @@
|
||||
#if IS_RE_ARM_BOARD && ENABLED(REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER) && HAS_DRIVER(TMC2130) && DISABLED(TMC_USE_SW_SPI)
|
||||
#error "Re-ARM with REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER and TMC2130 require TMC_USE_SW_SPI"
|
||||
#endif
|
||||
|
||||
#if ENABLED(BAUD_RATE_GCODE)
|
||||
#error "BAUD_RATE_GCODE is not yet supported on LPC176x."
|
||||
#endif
|
||||
|
@@ -20,8 +20,10 @@
|
||||
*
|
||||
*/
|
||||
|
||||
// adapted from I2C/master/master.c example
|
||||
// https://www-users.cs.york.ac.uk/~pcc/MCP/HAPR-Course-web/CMSIS/examples/html/master_8c_source.html
|
||||
/**
|
||||
* digipot_mcp4451_I2C_routines.c
|
||||
* Adapted from https://www-users.cs.york.ac.uk/~pcc/MCP/HAPR-Course-web/CMSIS/examples/html/master_8c_source.html
|
||||
*/
|
||||
|
||||
#ifdef TARGET_LPC1768
|
||||
|
||||
@@ -29,12 +31,12 @@
|
||||
|
||||
#if MB(MKS_SBASE)
|
||||
|
||||
#include "digipot_mcp4451_I2C_routines.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include "digipot_mcp4451_I2C_routines.h"
|
||||
|
||||
// These two routines are exact copies of the lpc17xx_i2c.c routines. Couldn't link to
|
||||
// to the lpc17xx_i2c.c routines so had to copy them into this file & rename them.
|
||||
|
||||
@@ -60,7 +62,6 @@ static void _I2C_Stop(LPC_I2C_TypeDef *I2Cx) {
|
||||
I2Cx->I2CONCLR = I2C_I2CONCLR_SIC;
|
||||
}
|
||||
|
||||
PINSEL_CFG_Type PinCfg;
|
||||
I2C_M_SETUP_Type transferMCfg;
|
||||
|
||||
#define I2C_status (LPC_I2C1->I2STAT & I2C_STAT_CODE_BITMASK)
|
||||
@@ -89,41 +90,6 @@ uint8_t digipot_mcp4451_start(uint8_t sla) { // send slave address and write bi
|
||||
return 1;
|
||||
}
|
||||
|
||||
void digipot_mcp4451_init() {
|
||||
/**
|
||||
* Init I2C pin connect
|
||||
*/
|
||||
PinCfg.OpenDrain = 0;
|
||||
PinCfg.Pinmode = 0;
|
||||
#if USEDI2CDEV_M == 0
|
||||
PinCfg.Funcnum = 1;
|
||||
PinCfg.Pinnum = 27;
|
||||
PinCfg.Portnum = 0;
|
||||
PINSEL_ConfigPin(&PinCfg); // SDA0 / D57 AUX-1
|
||||
PinCfg.Pinnum = 28;
|
||||
PINSEL_ConfigPin(&PinCfg); // SCL0 / D58 AUX-1
|
||||
#elif USEDI2CDEV_M == 1
|
||||
PinCfg.Funcnum = 3;
|
||||
PinCfg.Pinnum = 0;
|
||||
PinCfg.Portnum = 0;
|
||||
PINSEL_ConfigPin(&PinCfg); // SDA1 / D20 SCA
|
||||
PinCfg.Pinnum = 1;
|
||||
PINSEL_ConfigPin(&PinCfg); // SCL1 / D21 SCL
|
||||
#elif USEDI2CDEV_M == 2
|
||||
PinCfg.Funcnum = 2;
|
||||
PinCfg.Pinnum = 10;
|
||||
PinCfg.Portnum = 0;
|
||||
PINSEL_ConfigPin(&PinCfg); // SDA2 / D38 X_ENABLE_PIN
|
||||
PinCfg.Pinnum = 11;
|
||||
PINSEL_ConfigPin(&PinCfg); // SCL2 / D55 X_DIR_PIN
|
||||
#endif
|
||||
// Initialize I2C peripheral
|
||||
I2C_Init(I2CDEV_M, 400000); // hardwired to 400KHz bit rate, 100KHz is the other option
|
||||
|
||||
// Enable Master I2C operation
|
||||
I2C_Cmd(I2CDEV_M, I2C_MASTER_MODE, ENABLE);
|
||||
}
|
||||
|
||||
uint8_t digipot_mcp4451_send_byte(uint8_t data) {
|
||||
LPC_I2C1->I2DAT = data & I2C_I2DAT_BITMASK; // transmit data
|
||||
LPC_I2C1->I2CONSET = I2C_I2CONSET_AA;
|
||||
|
@@ -21,20 +21,10 @@
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
// adapted from I2C/master/master.c example
|
||||
// https://www-users.cs.york.ac.uk/~pcc/MCP/HAPR-Course-web/CMSIS/examples/html/master_8c_source.html
|
||||
|
||||
#define USEDI2CDEV_M 1 // use I2C1 controller
|
||||
|
||||
#if USEDI2CDEV_M == 0
|
||||
#define I2CDEV_M LPC_I2C0
|
||||
#elif USEDI2CDEV_M == 1
|
||||
#define I2CDEV_M LPC_I2C1
|
||||
#elif USEDI2CDEV_M == 2
|
||||
#define I2CDEV_M LPC_I2C2
|
||||
#else
|
||||
#error "Master I2C device not defined!"
|
||||
#endif
|
||||
/**
|
||||
* digipot_mcp4451_I2C_routines.h
|
||||
* Adapted from https://www-users.cs.york.ac.uk/~pcc/MCP/HAPR-Course-web/CMSIS/examples/html/master_8c_source.html
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
@@ -43,9 +33,9 @@
|
||||
#include <lpc17xx_i2c.h>
|
||||
#include <lpc17xx_pinsel.h>
|
||||
#include <lpc17xx_libcfg_default.h>
|
||||
#include "i2c_util.h"
|
||||
|
||||
uint8_t digipot_mcp4451_start(uint8_t sla);
|
||||
void digipot_mcp4451_init();
|
||||
uint8_t digipot_mcp4451_send_byte(uint8_t data);
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
70
Marlin/src/HAL/HAL_LPC1768/include/i2c_util.c
Normal file
70
Marlin/src/HAL/HAL_LPC1768/include/i2c_util.c
Normal file
@@ -0,0 +1,70 @@
|
||||
/**
|
||||
* Marlin 3D Printer Firmware
|
||||
* Copyright (c) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
|
||||
*
|
||||
* Based on Sprinter and grbl.
|
||||
* Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* HAL_LPC1768/include/i2c_util.c
|
||||
*/
|
||||
|
||||
#ifdef TARGET_LPC1768
|
||||
|
||||
#include "i2c_util.h"
|
||||
|
||||
#define U8G_I2C_OPT_FAST 16 // from u8g.h
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
void configure_i2c(const uint8_t clock_option) {
|
||||
/**
|
||||
* Init I2C pin connect
|
||||
*/
|
||||
PINSEL_CFG_Type PinCfg;
|
||||
PinCfg.OpenDrain = 0;
|
||||
PinCfg.Pinmode = 0;
|
||||
PinCfg.Portnum = 0;
|
||||
#if I2C_MASTER_ID == 0
|
||||
PinCfg.Funcnum = 1;
|
||||
PinCfg.Pinnum = 27; // SDA0 / D57 AUX-1 ... SCL0 / D58 AUX-1
|
||||
#elif I2C_MASTER_ID == 1
|
||||
PinCfg.Funcnum = 3;
|
||||
PinCfg.Pinnum = 0; // SDA1 / D20 SCA ... SCL1 / D21 SCL
|
||||
#elif I2C_MASTER_ID == 2
|
||||
PinCfg.Funcnum = 2;
|
||||
PinCfg.Pinnum = 10; // SDA2 / D38 X_ENABLE_PIN ... SCL2 / D55 X_DIR_PIN
|
||||
#endif
|
||||
PINSEL_ConfigPin(&PinCfg);
|
||||
PinCfg.Pinnum += 1;
|
||||
PINSEL_ConfigPin(&PinCfg);
|
||||
|
||||
// Initialize I2C peripheral
|
||||
I2C_Init(I2CDEV_M, (clock_option & U8G_I2C_OPT_FAST) ? 400000: 100000); // LCD data rates
|
||||
|
||||
// Enable Master I2C operation
|
||||
I2C_Cmd(I2CDEV_M, I2C_MASTER_MODE, ENABLE);
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // TARGET_LPC1768
|
56
Marlin/src/HAL/HAL_LPC1768/include/i2c_util.h
Normal file
56
Marlin/src/HAL/HAL_LPC1768/include/i2c_util.h
Normal file
@@ -0,0 +1,56 @@
|
||||
/**
|
||||
* Marlin 3D Printer Firmware
|
||||
* Copyright (c) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
|
||||
*
|
||||
* Based on Sprinter and grbl.
|
||||
* Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
/**
|
||||
* HAL_LPC1768/include/i2c_util.h
|
||||
*/
|
||||
|
||||
#include "../../../inc/MarlinConfigPre.h"
|
||||
|
||||
#ifndef I2C_MASTER_ID
|
||||
#define I2C_MASTER_ID 1
|
||||
#endif
|
||||
|
||||
#if I2C_MASTER_ID == 0
|
||||
#define I2CDEV_M LPC_I2C0
|
||||
#elif I2C_MASTER_ID == 1
|
||||
#define I2CDEV_M LPC_I2C1
|
||||
#elif I2C_MASTER_ID == 2
|
||||
#define I2CDEV_M LPC_I2C2
|
||||
#else
|
||||
#error "Master I2C device not defined!"
|
||||
#endif
|
||||
|
||||
#include <lpc17xx_i2c.h>
|
||||
#include <lpc17xx_pinsel.h>
|
||||
#include <lpc17xx_libcfg_default.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
void configure_i2c(const uint8_t clock_option);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
@@ -25,25 +25,21 @@
|
||||
|
||||
#ifdef TARGET_LPC1768
|
||||
|
||||
#include "../include/i2c_util.h"
|
||||
#include "../../../core/millis_t.h"
|
||||
|
||||
extern int millis();
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <lpc17xx_i2c.h>
|
||||
#include <lpc17xx_pinsel.h>
|
||||
#include <lpc17xx_libcfg_default.h>
|
||||
|
||||
#include "../../../core/millis_t.h"
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// These two routines are exact copies of the lpc17xx_i2c.c routines. Couldn't link to
|
||||
// to the lpc17xx_i2c.c routines so had to copy them into this file & rename them.
|
||||
|
||||
static uint32_t _I2C_Start (LPC_I2C_TypeDef *I2Cx) {
|
||||
static uint32_t _I2C_Start(LPC_I2C_TypeDef *I2Cx) {
|
||||
// Reset STA, STO, SI
|
||||
I2Cx->I2CONCLR = I2C_I2CONCLR_SIC|I2C_I2CONCLR_STOC|I2C_I2CONCLR_STAC;
|
||||
|
||||
@@ -67,30 +63,16 @@ static void _I2C_Stop (LPC_I2C_TypeDef *I2Cx) {
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#define U8G_I2C_OPT_FAST 16 // from u8g.h
|
||||
|
||||
#define USEDI2CDEV_M 1
|
||||
|
||||
#define I2CDEV_S_ADDR 0x78 // from SSD1306 //actual address is 0x3C - shift left 1 with LSB set to 0 to indicate write
|
||||
|
||||
#define BUFFER_SIZE 0x1 // only do single byte transfers with LCDs
|
||||
|
||||
#if (USEDI2CDEV_M == 0)
|
||||
#define I2CDEV_M LPC_I2C0
|
||||
#elif (USEDI2CDEV_M == 1)
|
||||
#define I2CDEV_M LPC_I2C1
|
||||
#elif (USEDI2CDEV_M == 2)
|
||||
#define I2CDEV_M LPC_I2C2
|
||||
#else
|
||||
#error "Master I2C device not defined!"
|
||||
#endif
|
||||
|
||||
PINSEL_CFG_Type PinCfg;
|
||||
I2C_M_SETUP_Type transferMCfg;
|
||||
|
||||
#define I2C_status (LPC_I2C1->I2STAT & I2C_STAT_CODE_BITMASK)
|
||||
|
||||
uint8_t u8g_i2c_start(uint8_t sla) { // send slave address and write bit
|
||||
// Send slave address and write bit
|
||||
uint8_t u8g_i2c_start(const uint8_t sla) {
|
||||
// Sometimes TX data ACK or NAK status is returned. That mean the start state didn't
|
||||
// happen which means only the value of the slave address was send. Keep looping until
|
||||
// the slave address and write bit are actually sent.
|
||||
@@ -114,44 +96,9 @@ uint8_t u8g_i2c_start(uint8_t sla) { // send slave address and write bit
|
||||
return 1;
|
||||
}
|
||||
|
||||
void u8g_i2c_init(uint8_t clock_option) {
|
||||
|
||||
/**
|
||||
* Init I2C pin connect
|
||||
*/
|
||||
PinCfg.OpenDrain = 0;
|
||||
PinCfg.Pinmode = 0;
|
||||
#if ((USEDI2CDEV_M == 0))
|
||||
PinCfg.Funcnum = 1;
|
||||
PinCfg.Pinnum = 27;
|
||||
PinCfg.Portnum = 0;
|
||||
PINSEL_ConfigPin(&PinCfg); // SDA0 / D57 AUX-1
|
||||
PinCfg.Pinnum = 28;
|
||||
PINSEL_ConfigPin(&PinCfg); // SCL0 / D58 AUX-1
|
||||
#endif
|
||||
#if ((USEDI2CDEV_M == 1))
|
||||
PinCfg.Funcnum = 3;
|
||||
PinCfg.Pinnum = 0;
|
||||
PinCfg.Portnum = 0;
|
||||
PINSEL_ConfigPin(&PinCfg); // SDA1 / D20 SCA
|
||||
PinCfg.Pinnum = 1;
|
||||
PINSEL_ConfigPin(&PinCfg); // SCL1 / D21 SCL
|
||||
#endif
|
||||
#if ((USEDI2CDEV_M == 2))
|
||||
PinCfg.Funcnum = 2;
|
||||
PinCfg.Pinnum = 10;
|
||||
PinCfg.Portnum = 0;
|
||||
PINSEL_ConfigPin(&PinCfg); // SDA2 / D38 X_ENABLE_PIN
|
||||
PinCfg.Pinnum = 11;
|
||||
PINSEL_ConfigPin(&PinCfg); // SCL2 / D55 X_DIR_PIN
|
||||
#endif
|
||||
// Initialize I2C peripheral
|
||||
I2C_Init(I2CDEV_M, (clock_option & U8G_I2C_OPT_FAST) ? 400000: 100000); // LCD data rates
|
||||
|
||||
// Enable Master I2C operation
|
||||
I2C_Cmd(I2CDEV_M, I2C_MASTER_MODE, ENABLE);
|
||||
|
||||
u8g_i2c_start(0); // send slave address and write bit
|
||||
void u8g_i2c_init(const uint8_t clock_option) {
|
||||
configure_i2c(clock_option);
|
||||
u8g_i2c_start(0); // Send slave address and write bit
|
||||
}
|
||||
|
||||
uint8_t u8g_i2c_send_byte(uint8_t data) {
|
||||
|
@@ -21,8 +21,8 @@
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
void u8g_i2c_init(uint8_t options);
|
||||
uint8_t u8g_i2c_wait(uint8_t mask, uint8_t pos);
|
||||
void u8g_i2c_init(const uint8_t clock_options);
|
||||
//uint8_t u8g_i2c_wait(uint8_t mask, uint8_t pos);
|
||||
uint8_t u8g_i2c_start(uint8_t sla);
|
||||
uint8_t u8g_i2c_send_byte(uint8_t data);
|
||||
void u8g_i2c_stop();
|
||||
|
@@ -26,8 +26,8 @@
|
||||
*
|
||||
* These are based on the LPC1768 routines.
|
||||
*
|
||||
* Couldn't just call exact copies because the overhead resulted in the
|
||||
* one microsecond delay being about 4uS.
|
||||
* Couldn't just call exact copies because the overhead
|
||||
* results in a one microsecond delay taking about 4µS.
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
@@ -86,8 +86,6 @@
|
||||
#define I2C_CMD_MODE 0x000
|
||||
#define I2C_DATA_MODE 0x040
|
||||
|
||||
//#define U8G_I2C_OPT_FAST 16
|
||||
|
||||
uint8_t u8g_com_ssd_I2C_start_sequence(u8g_t *u8g) {
|
||||
/* are we requested to set the a0 state? */
|
||||
if (u8g->pin_list[U8G_PI_SET_A0] == 0) return 1;
|
||||
|
@@ -9,7 +9,9 @@ target_filename = "FIRMWARE.CUR"
|
||||
target_drive = "REARM"
|
||||
|
||||
import os
|
||||
import getpass
|
||||
import platform
|
||||
|
||||
current_OS = platform.system()
|
||||
Import("env")
|
||||
|
||||
@@ -77,28 +79,26 @@ try:
|
||||
upload_disk = 'Disk not found'
|
||||
target_file_found = False
|
||||
target_drive_found = False
|
||||
medias = os.listdir('/media') #
|
||||
for media in medias:
|
||||
drives = os.listdir('/media/' + media) #
|
||||
if target_drive in drives and target_file_found == False: # set upload if not found target file yet
|
||||
target_drive_found = True
|
||||
upload_disk = '/media/' + media + '/' + target_drive + '/'
|
||||
drives = os.listdir(os.path.join(os.sep, 'media', getpass.getuser()))
|
||||
if target_drive in drives: # If target drive is found, use it.
|
||||
target_drive_found = True
|
||||
upload_disk = os.path.join(os.sep, 'media', getpass.getuser(), target_drive) + os.sep
|
||||
else:
|
||||
for drive in drives:
|
||||
try:
|
||||
files = os.listdir('/media/' + media + '/' + drive)
|
||||
files = os.listdir(os.path.join(os.sep, 'media', getpass.getuser(), drive))
|
||||
except:
|
||||
continue
|
||||
else:
|
||||
if target_filename in files:
|
||||
if target_file_found == False:
|
||||
upload_disk = '/media/' + media + '/' + drive + '/'
|
||||
target_file_found = True
|
||||
|
||||
upload_disk = os.path.join(os.sep, 'media', getpass.getuser(), drive) + os.sep
|
||||
target_file_found = True
|
||||
break
|
||||
#
|
||||
# set upload_port to drive if found
|
||||
#
|
||||
|
||||
if target_file_found == True or target_drive_found == True:
|
||||
if target_file_found or target_drive_found:
|
||||
env.Replace(
|
||||
UPLOAD_FLAGS="-P$UPLOAD_PORT",
|
||||
UPLOAD_PORT=upload_disk
|
||||
|
@@ -68,5 +68,4 @@ bool watchdog_timed_out() { return TEST(WDT_ReadTimeOutFlag(), 0); }
|
||||
void watchdog_clear_timeout_flag() { WDT_ClrTimeOutFlag(); }
|
||||
|
||||
#endif // USE_WATCHDOG
|
||||
|
||||
#endif // TARGET_LPC1768
|
||||
|
@@ -59,6 +59,21 @@
|
||||
#else
|
||||
#define GET_TEMP_5_ADC() -1
|
||||
#endif
|
||||
#if HAS_TEMP_ADC_6
|
||||
#define GET_TEMP_6_ADC() PIN_TO_ADC(TEMP_6_PIN)
|
||||
#else
|
||||
#define GET_TEMP_6_ADC() -1
|
||||
#endif
|
||||
#if HAS_TEMP_ADC_7
|
||||
#define GET_TEMP_7_ADC() PIN_TO_ADC(TEMP_7_PIN)
|
||||
#else
|
||||
#define GET_TEMP_7_ADC() -1
|
||||
#endif
|
||||
#if HAS_TEMP_PROBE
|
||||
#define GET_PROBE_ADC() PIN_TO_ADC(TEMP_PROBE_PIN)
|
||||
#else
|
||||
#define GET_PROBE_ADC() -1
|
||||
#endif
|
||||
#if HAS_TEMP_ADC_BED
|
||||
#define GET_BED_ADC() PIN_TO_ADC(TEMP_BED_PIN)
|
||||
#else
|
||||
@@ -80,12 +95,15 @@
|
||||
#define GET_BUTTONS_ADC() -1
|
||||
#endif
|
||||
|
||||
#define IS_ADC_REQUIRED(n) (GET_TEMP_0_ADC() == n || GET_TEMP_1_ADC() == n || GET_TEMP_2_ADC() == n \
|
||||
|| GET_TEMP_3_ADC() == n || GET_TEMP_4_ADC() == n || GET_TEMP_5_ADC() == n \
|
||||
|| GET_BED_ADC() == n \
|
||||
|| GET_CHAMBER_ADC() == n \
|
||||
|| GET_FILAMENT_WIDTH_ADC() == n \
|
||||
|| GET_BUTTONS_ADC() == n)
|
||||
#define IS_ADC_REQUIRED(n) ( \
|
||||
GET_TEMP_0_ADC() == n || GET_TEMP_1_ADC() == n || GET_TEMP_2_ADC() == n || GET_TEMP_3_ADC() == n \
|
||||
|| GET_TEMP_4_ADC() == n || GET_TEMP_5_ADC() == n || GET_TEMP_6_ADC() == n || GET_TEMP_7_ADC() == n \
|
||||
|| GET_PROBE_ADC() == n \
|
||||
|| GET_BED_ADC() == n \
|
||||
|| GET_CHAMBER_ADC() == n \
|
||||
|| GET_FILAMENT_WIDTH_ADC() == n \
|
||||
|| GET_BUTTONS_ADC() == n \
|
||||
)
|
||||
|
||||
#define ADC0_IS_REQUIRED IS_ADC_REQUIRED(0)
|
||||
#define ADC1_IS_REQUIRED IS_ADC_REQUIRED(1)
|
||||
@@ -145,6 +163,15 @@ uint16_t HAL_adc_result;
|
||||
#if GET_TEMP_5_ADC() == 0
|
||||
TEMP_5_PIN,
|
||||
#endif
|
||||
#if GET_TEMP_6_ADC() == 0
|
||||
TEMP_6_PIN,
|
||||
#endif
|
||||
#if GET_TEMP_7_ADC() == 0
|
||||
TEMP_7_PIN,
|
||||
#endif
|
||||
#if GET_PROBE_ADC() == 0
|
||||
TEMP_PROBE_PIN,
|
||||
#endif
|
||||
#if GET_BED_ADC() == 0
|
||||
TEMP_BED_PIN,
|
||||
#endif
|
||||
@@ -176,6 +203,15 @@ uint16_t HAL_adc_result;
|
||||
#if GET_TEMP_5_ADC() == 1
|
||||
TEMP_5_PIN,
|
||||
#endif
|
||||
#if GET_TEMP_6_ADC() == 1
|
||||
TEMP_6_PIN,
|
||||
#endif
|
||||
#if GET_TEMP_7_ADC() == 1
|
||||
TEMP_7_PIN,
|
||||
#endif
|
||||
#if GET_PROBE_ADC() == 1
|
||||
TEMP_PROBE_PIN,
|
||||
#endif
|
||||
#if GET_BED_ADC() == 1
|
||||
TEMP_BED_PIN,
|
||||
#endif
|
||||
@@ -215,6 +251,15 @@ uint16_t HAL_adc_result;
|
||||
#if GET_TEMP_5_ADC() == 0
|
||||
{ PIN_TO_INPUTCTRL(TEMP_5_PIN) },
|
||||
#endif
|
||||
#if GET_TEMP_6_ADC() == 0
|
||||
{ PIN_TO_INPUTCTRL(TEMP_6_PIN) },
|
||||
#endif
|
||||
#if GET_TEMP_7_ADC() == 0
|
||||
{ PIN_TO_INPUTCTRL(TEMP_7_PIN) },
|
||||
#endif
|
||||
#if GET_PROBE_ADC() == 0
|
||||
{ PIN_TO_INPUTCTRL(TEMP_PROBE_PIN) },
|
||||
#endif
|
||||
#if GET_BED_ADC() == 0
|
||||
{ PIN_TO_INPUTCTRL(TEMP_BED_PIN) },
|
||||
#endif
|
||||
@@ -255,6 +300,15 @@ uint16_t HAL_adc_result;
|
||||
#if GET_TEMP_5_ADC() == 1
|
||||
{ PIN_TO_INPUTCTRL(TEMP_5_PIN) },
|
||||
#endif
|
||||
#if GET_TEMP_6_ADC() == 1
|
||||
{ PIN_TO_INPUTCTRL(TEMP_6_PIN) },
|
||||
#endif
|
||||
#if GET_TEMP_7_ADC() == 1
|
||||
{ PIN_TO_INPUTCTRL(TEMP_7_PIN) },
|
||||
#endif
|
||||
#if GET_PROBE_ADC() == 1
|
||||
{ PIN_TO_INPUTCTRL(TEMP_PROBE_PIN) },
|
||||
#endif
|
||||
#if GET_BED_ADC() == 1
|
||||
{ PIN_TO_INPUTCTRL(TEMP_BED_PIN) },
|
||||
#endif
|
||||
@@ -426,7 +480,7 @@ void HAL_adc_init() {
|
||||
memset(HAL_adc_results, 0xFF, sizeof(HAL_adc_results)); // Fill result with invalid values
|
||||
|
||||
for (uint8_t pi = 0; pi < COUNT(adc_pins); ++pi)
|
||||
pinPeripheral(adc_pins[pi], PIO_ANALOG);
|
||||
pinPeripheral(adc_pins[pi], PIO_ANALOG);
|
||||
|
||||
for (uint8_t ai = FIRST_ADC; ai <= LAST_ADC; ++ai) {
|
||||
Adc* adc = ((Adc*[])ADC_INSTS)[ai];
|
||||
@@ -471,8 +525,4 @@ void HAL_adc_start_conversion(const uint8_t adc_pin) {
|
||||
HAL_adc_result = 0xFFFF;
|
||||
}
|
||||
|
||||
uint16_t HAL_adc_get_result() {
|
||||
return HAL_adc_result;
|
||||
}
|
||||
|
||||
#endif // __SAMD51__
|
||||
|
@@ -33,11 +33,9 @@
|
||||
#include "MarlinSerial_AGCM4.h"
|
||||
|
||||
// Serial ports
|
||||
#if !WITHIN(SERIAL_PORT, -1, 3)
|
||||
#error "SERIAL_PORT must be from -1 to 3"
|
||||
#endif
|
||||
|
||||
// MYSERIAL0 required before MarlinSerial includes!
|
||||
|
||||
#if SERIAL_PORT == -1
|
||||
#define MYSERIAL0 Serial
|
||||
#elif SERIAL_PORT == 0
|
||||
@@ -46,18 +44,16 @@
|
||||
#define MYSERIAL0 Serial2
|
||||
#elif SERIAL_PORT == 2
|
||||
#define MYSERIAL0 Serial3
|
||||
#else
|
||||
#elif SERIAL_PORT == 3
|
||||
#define MYSERIAL0 Serial4
|
||||
#else
|
||||
#error "SERIAL_PORT must be from -1 to 3. Please update your configuration."
|
||||
#endif
|
||||
|
||||
#ifdef SERIAL_PORT_2
|
||||
#if !WITHIN(SERIAL_PORT_2, -1, 3)
|
||||
#error "SERIAL_PORT_2 must be from -1 to 3"
|
||||
#elif SERIAL_PORT_2 == SERIAL_PORT
|
||||
#error "SERIAL_PORT_2 must be different than SERIAL_PORT"
|
||||
#endif
|
||||
#define NUM_SERIAL 2
|
||||
#if SERIAL_PORT_2 == -1
|
||||
#if SERIAL_PORT_2 == SERIAL_PORT
|
||||
#error "SERIAL_PORT_2 must be different than SERIAL_PORT. Please update your configuration."
|
||||
#elif SERIAL_PORT_2 == -1
|
||||
#define MYSERIAL1 Serial
|
||||
#elif SERIAL_PORT_2 == 0
|
||||
#define MYSERIAL1 Serial1
|
||||
@@ -65,13 +61,36 @@
|
||||
#define MYSERIAL1 Serial2
|
||||
#elif SERIAL_PORT_2 == 2
|
||||
#define MYSERIAL1 Serial3
|
||||
#else
|
||||
#elif SERIAL_PORT_2 == 3
|
||||
#define MYSERIAL1 Serial4
|
||||
#else
|
||||
#error "SERIAL_PORT_2 must be from -1 to 3. Please update your configuration."
|
||||
#endif
|
||||
#define NUM_SERIAL 2
|
||||
#else
|
||||
#define NUM_SERIAL 1
|
||||
#endif
|
||||
|
||||
#ifdef DGUS_SERIAL_PORT
|
||||
#if DGUS_SERIAL_PORT == SERIAL_PORT
|
||||
#error "DGUS_SERIAL_PORT must be different than SERIAL_PORT. Please update your configuration."
|
||||
#elif defined(SERIAL_PORT_2) && DGUS_SERIAL_PORT == SERIAL_PORT_2
|
||||
#error "DGUS_SERIAL_PORT must be different than SERIAL_PORT_2. Please update your configuration."
|
||||
#elif DGUS_SERIAL_PORT == -1
|
||||
#define DGUS_SERIAL Serial
|
||||
#elif DGUS_SERIAL_PORT == 0
|
||||
#define DGUS_SERIAL Serial1
|
||||
#elif DGUS_SERIAL_PORT == 1
|
||||
#define DGUS_SERIAL Serial2
|
||||
#elif DGUS_SERIAL_PORT == 2
|
||||
#define DGUS_SERIAL Serial3
|
||||
#elif DGUS_SERIAL_PORT == 2
|
||||
#define DGUS_SERIAL Serial4
|
||||
#else
|
||||
#error "DGUS_SERIAL_PORT must be from -1 to 3. Please update your configuration."
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#endif // ADAFRUIT_GRAND_CENTRAL_M4
|
||||
|
||||
typedef int8_t pin_t;
|
||||
@@ -116,7 +135,7 @@ void HAL_adc_init();
|
||||
#define HAL_ADC_READY() true
|
||||
|
||||
void HAL_adc_start_conversion(const uint8_t adc_pin);
|
||||
uint16_t HAL_adc_get_result();
|
||||
inline uint16_t HAL_adc_get_result() { return HAL_adc_result; }
|
||||
|
||||
//
|
||||
// Pin Map
|
||||
|
@@ -98,6 +98,16 @@
|
||||
#else
|
||||
#define MATCH_Z3_MIN_EILINE(P) false
|
||||
#endif
|
||||
#if HAS_Z4_MAX
|
||||
#define MATCH_Z4_MAX_EILINE(P) MATCH_EILINE(P, Z4_MAX_PIN)
|
||||
#else
|
||||
#define MATCH_Z4_MAX_EILINE(P) false
|
||||
#endif
|
||||
#if HAS_Z4_MIN
|
||||
#define MATCH_Z4_MIN_EILINE(P) MATCH_EILINE(P, Z4_MIN_PIN)
|
||||
#else
|
||||
#define MATCH_Z4_MIN_EILINE(P) false
|
||||
#endif
|
||||
#if HAS_Z_MIN_PROBE_PIN
|
||||
#define MATCH_Z_MIN_PROBE_EILINE(P) MATCH_EILINE(P, Z_MIN_PROBE_PIN)
|
||||
#else
|
||||
@@ -109,6 +119,7 @@
|
||||
&& !MATCH_Z_MAX_EILINE(P) && !MATCH_Z_MIN_EILINE(P) \
|
||||
&& !MATCH_Z2_MAX_EILINE(P) && !MATCH_Z2_MIN_EILINE(P) \
|
||||
&& !MATCH_Z3_MAX_EILINE(P) && !MATCH_Z3_MIN_EILINE(P) \
|
||||
&& !MATCH_Z4_MAX_EILINE(P) && !MATCH_Z4_MIN_EILINE(P) \
|
||||
&& !MATCH_Z_MIN_PROBE_EILINE(P))
|
||||
|
||||
// One ISR for all EXT-Interrupts
|
||||
@@ -117,67 +128,79 @@ void endstop_ISR() { endstops.update(); }
|
||||
void setup_endstop_interrupts() {
|
||||
#if HAS_X_MAX
|
||||
#if !AVAILABLE_EILINE(X_MAX_PIN)
|
||||
static_assert(false, "X_MAX_PIN has no EXTINT line available.");
|
||||
#error "X_MAX_PIN has no EXTINT line available."
|
||||
#endif
|
||||
attachInterrupt(X_MAX_PIN, endstop_ISR, CHANGE);
|
||||
#endif
|
||||
#if HAS_X_MIN
|
||||
#if !AVAILABLE_EILINE(X_MIN_PIN)
|
||||
static_assert(false, "X_MIN_PIN has no EXTINT line available.");
|
||||
#error "X_MIN_PIN has no EXTINT line available."
|
||||
#endif
|
||||
attachInterrupt(X_MIN_PIN, endstop_ISR, CHANGE);
|
||||
#endif
|
||||
#if HAS_Y_MAX
|
||||
#if !AVAILABLE_EILINE(Y_MAX_PIN)
|
||||
static_assert(false, "Y_MAX_PIN has no EXTINT line available.");
|
||||
#error "Y_MAX_PIN has no EXTINT line available."
|
||||
#endif
|
||||
attachInterrupt(Y_MAX_PIN, endstop_ISR, CHANGE);
|
||||
#endif
|
||||
#if HAS_Y_MIN
|
||||
#if !AVAILABLE_EILINE(Y_MIN_PIN)
|
||||
static_assert(false, "Y_MIN_PIN has no EXTINT line available.");
|
||||
#error "Y_MIN_PIN has no EXTINT line available."
|
||||
#endif
|
||||
attachInterrupt(Y_MIN_PIN, endstop_ISR, CHANGE);
|
||||
#endif
|
||||
#if HAS_Z_MAX
|
||||
#if !AVAILABLE_EILINE(Z_MAX_PIN)
|
||||
static_assert(false, "Z_MAX_PIN has no EXTINT line available.");
|
||||
#error "Z_MAX_PIN has no EXTINT line available."
|
||||
#endif
|
||||
attachInterrupt(Z_MAX_PIN, endstop_ISR, CHANGE);
|
||||
#endif
|
||||
#if HAS_Z_MIN
|
||||
#if !AVAILABLE_EILINE(Z_MIN_PIN)
|
||||
static_assert(false, "Z_MIN_PIN has no EXTINT line available.");
|
||||
#error "Z_MIN_PIN has no EXTINT line available."
|
||||
#endif
|
||||
attachInterrupt(Z_MIN_PIN, endstop_ISR, CHANGE);
|
||||
#endif
|
||||
#if HAS_Z2_MAX
|
||||
#if !AVAILABLE_EILINE(Z2_MAX_PIN)
|
||||
static_assert(false, "Z2_MAX_PIN has no EXTINT line available.");
|
||||
#error "Z2_MAX_PIN has no EXTINT line available."
|
||||
#endif
|
||||
attachInterrupt(Z2_MAX_PIN, endstop_ISR, CHANGE);
|
||||
#endif
|
||||
#if HAS_Z2_MIN
|
||||
#if !AVAILABLE_EILINE(Z2_MIN_PIN)
|
||||
static_assert(false, "Z2_MIN_PIN has no EXTINT line available.");
|
||||
#error "Z2_MIN_PIN has no EXTINT line available."
|
||||
#endif
|
||||
attachInterrupt(Z2_MIN_PIN, endstop_ISR, CHANGE);
|
||||
#endif
|
||||
#if HAS_Z3_MAX
|
||||
#if !AVAILABLE_EILINE(Z3_MAX_PIN)
|
||||
static_assert(false, "Z3_MAX_PIN has no EXTINT line available.");
|
||||
#error "Z3_MAX_PIN has no EXTINT line available."
|
||||
#endif
|
||||
attachInterrupt(Z3_MAX_PIN, endstop_ISR, CHANGE);
|
||||
#endif
|
||||
#if HAS_Z3_MIN
|
||||
#if !AVAILABLE_EILINE(Z3_MIN_PIN)
|
||||
static_assert(false, "Z3_MIN_PIN has no EXTINT line available.");
|
||||
#error "Z3_MIN_PIN has no EXTINT line available."
|
||||
#endif
|
||||
attachInterrupt(Z3_MIN_PIN, endstop_ISR, CHANGE);
|
||||
#endif
|
||||
#if HAS_Z4_MAX
|
||||
#if !AVAILABLE_EILINE(Z4_MAX_PIN)
|
||||
#error "Z4_MAX_PIN has no EXTINT line available."
|
||||
#endif
|
||||
attachInterrupt(Z4_MAX_PIN, endstop_ISR, CHANGE);
|
||||
#endif
|
||||
#if HAS_Z4_MIN
|
||||
#if !AVAILABLE_EILINE(Z4_MIN_PIN)
|
||||
#error "Z4_MIN_PIN has no EXTINT line available."
|
||||
#endif
|
||||
attachInterrupt(Z4_MIN_PIN, endstop_ISR, CHANGE);
|
||||
#endif
|
||||
#if HAS_Z_MIN_PROBE_PIN
|
||||
#if !AVAILABLE_EILINE(Z_MIN_PROBE_PIN)
|
||||
static_assert(false, "Z_MIN_PROBE_PIN has no EXTINT line available.");
|
||||
#error "Z_MIN_PROBE_PIN has no EXTINT line available."
|
||||
#endif
|
||||
attachInterrupt(Z_MIN_PROBE_PIN, endstop_ISR, CHANGE);
|
||||
#endif
|
||||
|
@@ -36,7 +36,7 @@
|
||||
#endif
|
||||
|
||||
#if ENABLED(SDIO_SUPPORT)
|
||||
#error "SDIO_SUPPORT is not supported."
|
||||
#error "SDIO_SUPPORT is not supported on SAMD51."
|
||||
#endif
|
||||
|
||||
#if ENABLED(FAST_PWM_FAN)
|
||||
@@ -46,3 +46,7 @@
|
||||
#if ENABLED(EEPROM_SETTINGS) && NONE(SPI_EEPROM, I2C_EEPROM)
|
||||
#warning "Did you activate the SmartEEPROM? See https://github.com/GMagician/SAMD51-SmartEEprom-Activator"
|
||||
#endif
|
||||
|
||||
#if TMC_HAS_SW_SERIAL
|
||||
#error "TMC220x Software Serial is not supported on this platform."
|
||||
#endif
|
||||
|
@@ -28,13 +28,7 @@
|
||||
#include "../../inc/MarlinConfig.h"
|
||||
#include "../shared/Delay.h"
|
||||
|
||||
#if (__cplusplus == 201703L) && defined(__has_include)
|
||||
#define HAS_SWSERIAL __has_include(<SoftwareSerial.h>)
|
||||
#else
|
||||
#define HAS_SWSERIAL HAS_TMC220x
|
||||
#endif
|
||||
|
||||
#if HAS_SWSERIAL
|
||||
#if TMC_HAS_SW_SERIAL
|
||||
#include "SoftwareSerial.h"
|
||||
#endif
|
||||
|
||||
@@ -93,7 +87,7 @@ void HAL_init() {
|
||||
while (!LL_PWR_IsActiveFlag_BRR());
|
||||
#endif // EEPROM_EMULATED_SRAM
|
||||
|
||||
#if HAS_SWSERIAL
|
||||
#if TMC_HAS_SW_SERIAL
|
||||
SoftwareSerial::setInterruptPriority(SWSERIAL_TIMER_IRQ_PRIO, 0);
|
||||
#endif
|
||||
}
|
||||
@@ -101,11 +95,27 @@ void HAL_init() {
|
||||
void HAL_clear_reset_source() { __HAL_RCC_CLEAR_RESET_FLAGS(); }
|
||||
|
||||
uint8_t HAL_get_reset_source() {
|
||||
if (__HAL_RCC_GET_FLAG(RCC_FLAG_IWDGRST) != RESET) return RST_WATCHDOG;
|
||||
if (__HAL_RCC_GET_FLAG(RCC_FLAG_SFTRST) != RESET) return RST_SOFTWARE;
|
||||
if (__HAL_RCC_GET_FLAG(RCC_FLAG_PINRST) != RESET) return RST_EXTERNAL;
|
||||
if (__HAL_RCC_GET_FLAG(RCC_FLAG_PORRST) != RESET) return RST_POWER_ON;
|
||||
return 0;
|
||||
return
|
||||
#ifdef RCC_FLAG_IWDGRST // Some sources may not exist...
|
||||
RESET != __HAL_RCC_GET_FLAG(RCC_FLAG_IWDGRST) ? RST_WATCHDOG :
|
||||
#endif
|
||||
#ifdef RCC_FLAG_IWDG1RST
|
||||
RESET != __HAL_RCC_GET_FLAG(RCC_FLAG_IWDG1RST) ? RST_WATCHDOG :
|
||||
#endif
|
||||
#ifdef RCC_FLAG_IWDG2RST
|
||||
RESET != __HAL_RCC_GET_FLAG(RCC_FLAG_IWDG2RST) ? RST_WATCHDOG :
|
||||
#endif
|
||||
#ifdef RCC_FLAG_SFTRST
|
||||
RESET != __HAL_RCC_GET_FLAG(RCC_FLAG_SFTRST) ? RST_SOFTWARE :
|
||||
#endif
|
||||
#ifdef RCC_FLAG_PINRST
|
||||
RESET != __HAL_RCC_GET_FLAG(RCC_FLAG_PINRST) ? RST_EXTERNAL :
|
||||
#endif
|
||||
#ifdef RCC_FLAG_PORRST
|
||||
RESET != __HAL_RCC_GET_FLAG(RCC_FLAG_PORRST) ? RST_POWER_ON :
|
||||
#endif
|
||||
0
|
||||
;
|
||||
}
|
||||
|
||||
void _delay_ms(const int delay_ms) { delay(delay_ms); }
|
||||
|
@@ -44,13 +44,8 @@
|
||||
// ------------------------
|
||||
|
||||
#if SERIAL_PORT == 0
|
||||
#error "Serial port 0 does not exist"
|
||||
#endif
|
||||
|
||||
#if !WITHIN(SERIAL_PORT, -1, 6)
|
||||
#error "SERIAL_PORT must be from -1 to 6"
|
||||
#endif
|
||||
#if SERIAL_PORT == -1
|
||||
#error "SERIAL_PORT cannot be 0. (Port 0 does not exist.) Please update your configuration."
|
||||
#elif SERIAL_PORT == -1
|
||||
#define MYSERIAL0 SerialUSB
|
||||
#elif SERIAL_PORT == 1
|
||||
#define MYSERIAL0 Serial1
|
||||
@@ -64,20 +59,17 @@
|
||||
#define MYSERIAL0 Serial5
|
||||
#elif SERIAL_PORT == 6
|
||||
#define MYSERIAL0 Serial6
|
||||
#else
|
||||
#error "SERIAL_PORT must be from -1 to 6. Please update your configuration."
|
||||
#endif
|
||||
|
||||
#ifdef SERIAL_PORT_2
|
||||
#if SERIAL_PORT_2 == 0
|
||||
#error "Serial port 0 does not exist"
|
||||
#endif
|
||||
|
||||
#if !WITHIN(SERIAL_PORT_2, -1, 6)
|
||||
#error "SERIAL_PORT_2 must be from -1 to 6"
|
||||
#elif SERIAL_PORT_2 == SERIAL_PORT
|
||||
#error "SERIAL_PORT_2 must be different than SERIAL_PORT"
|
||||
#endif
|
||||
#define NUM_SERIAL 2
|
||||
#if SERIAL_PORT_2 == -1
|
||||
#if SERIAL_PORT_2 == 0
|
||||
#error "SERIAL_PORT_2 cannot be 0. (Port 0 does not exist.) Please update your configuration."
|
||||
#elif SERIAL_PORT_2 == SERIAL_PORT
|
||||
#error "SERIAL_PORT_2 must be different than SERIAL_PORT. Please update your configuration."
|
||||
#elif SERIAL_PORT_2 == -1
|
||||
#define MYSERIAL1 SerialUSB
|
||||
#elif SERIAL_PORT_2 == 1
|
||||
#define MYSERIAL1 Serial1
|
||||
@@ -91,11 +83,41 @@
|
||||
#define MYSERIAL1 Serial5
|
||||
#elif SERIAL_PORT_2 == 6
|
||||
#define MYSERIAL1 Serial6
|
||||
#else
|
||||
#error "SERIAL_PORT_2 must be from -1 to 6. Please update your configuration."
|
||||
#endif
|
||||
#else
|
||||
#define NUM_SERIAL 1
|
||||
#endif
|
||||
|
||||
#if HAS_DGUS_LCD
|
||||
#if DGUS_SERIAL_PORT == 0
|
||||
#error "DGUS_SERIAL_PORT cannot be 0. (Port 0 does not exist.) Please update your configuration."
|
||||
#elif DGUS_SERIAL_PORT == SERIAL_PORT
|
||||
#error "DGUS_SERIAL_PORT must be different than SERIAL_PORT. Please update your configuration."
|
||||
#elif defined(SERIAL_PORT_2) && DGUS_SERIAL_PORT == SERIAL_PORT_2
|
||||
#error "DGUS_SERIAL_PORT must be different than SERIAL_PORT_2. Please update your configuration."
|
||||
#elif DGUS_SERIAL_PORT == -1
|
||||
#define DGUS_SERIAL SerialUSB
|
||||
#elif DGUS_SERIAL_PORT == 1
|
||||
#define DGUS_SERIAL Serial1
|
||||
#elif DGUS_SERIAL_PORT == 2
|
||||
#define DGUS_SERIAL Serial2
|
||||
#elif DGUS_SERIAL_PORT == 3
|
||||
#define DGUS_SERIAL Serial3
|
||||
#elif DGUS_SERIAL_PORT == 4
|
||||
#define DGUS_SERIAL Serial4
|
||||
#elif DGUS_SERIAL_PORT == 5
|
||||
#define DGUS_SERIAL Serial5
|
||||
#elif DGUS_SERIAL_PORT == 6
|
||||
#define DGUS_SERIAL Serial6
|
||||
#else
|
||||
#error "DGUS_SERIAL_PORT must be from -1 to 6. Please update your configuration."
|
||||
#endif
|
||||
|
||||
#define DGUS_SERIAL_GET_TX_BUFFER_FREE DGUS_SERIAL.availableForWrite
|
||||
#endif
|
||||
|
||||
#include "timers.h"
|
||||
|
||||
/**
|
||||
|
@@ -37,114 +37,193 @@ static SPISettings spiConfig;
|
||||
// ------------------------
|
||||
|
||||
#if ENABLED(SOFTWARE_SPI)
|
||||
|
||||
// ------------------------
|
||||
// Software SPI
|
||||
// ------------------------
|
||||
#error "Software SPI not supported for STM32. Use Hardware SPI."
|
||||
|
||||
#include "../shared/Delay.h"
|
||||
|
||||
void spiBegin(void) {
|
||||
OUT_WRITE(SS_PIN, HIGH);
|
||||
OUT_WRITE(SCK_PIN, HIGH);
|
||||
SET_INPUT(MISO_PIN);
|
||||
OUT_WRITE(MOSI_PIN, HIGH);
|
||||
}
|
||||
|
||||
static uint16_t delay_STM32_soft_spi;
|
||||
|
||||
void spiInit(uint8_t spiRate) {
|
||||
// Use datarates Marlin uses
|
||||
switch (spiRate) {
|
||||
case SPI_FULL_SPEED: delay_STM32_soft_spi = 125; break; // desired: 8,000,000 actual: ~1.1M
|
||||
case SPI_HALF_SPEED: delay_STM32_soft_spi = 125; break; // desired: 4,000,000 actual: ~1.1M
|
||||
case SPI_QUARTER_SPEED:delay_STM32_soft_spi = 250; break; // desired: 2,000,000 actual: ~890K
|
||||
case SPI_EIGHTH_SPEED: delay_STM32_soft_spi = 500; break; // desired: 1,000,000 actual: ~590K
|
||||
case SPI_SPEED_5: delay_STM32_soft_spi = 1000; break; // desired: 500,000 actual: ~360K
|
||||
case SPI_SPEED_6: delay_STM32_soft_spi = 2000; break; // desired: 250,000 actual: ~210K
|
||||
default: delay_STM32_soft_spi = 4000; break; // desired: 125,000 actual: ~123K
|
||||
}
|
||||
SPI.begin();
|
||||
}
|
||||
|
||||
// Begin SPI transaction, set clock, bit order, data mode
|
||||
void spiBeginTransaction(uint32_t spiClock, uint8_t bitOrder, uint8_t dataMode) { /* do nothing */ }
|
||||
|
||||
uint8_t HAL_SPI_STM32_SpiTransfer_Mode_3(uint8_t b) { // using Mode 3
|
||||
for (uint8_t bits = 8; bits--;) {
|
||||
WRITE(SCK_PIN, LOW);
|
||||
WRITE(MOSI_PIN, b & 0x80);
|
||||
|
||||
DELAY_NS(delay_STM32_soft_spi);
|
||||
WRITE(SCK_PIN, HIGH);
|
||||
DELAY_NS(delay_STM32_soft_spi);
|
||||
|
||||
b <<= 1; // little setup time
|
||||
b |= (READ(MISO_PIN) != 0);
|
||||
}
|
||||
DELAY_NS(125);
|
||||
return b;
|
||||
}
|
||||
|
||||
// Soft SPI receive byte
|
||||
uint8_t spiRec() {
|
||||
DISABLE_ISRS(); // No interrupts during byte receive
|
||||
const uint8_t data = HAL_SPI_STM32_SpiTransfer_Mode_3(0xFF);
|
||||
ENABLE_ISRS(); // Enable interrupts
|
||||
return data;
|
||||
}
|
||||
|
||||
// Soft SPI read data
|
||||
void spiRead(uint8_t *buf, uint16_t nbyte) {
|
||||
for (uint16_t i = 0; i < nbyte; i++)
|
||||
buf[i] = spiRec();
|
||||
}
|
||||
|
||||
// Soft SPI send byte
|
||||
void spiSend(uint8_t data) {
|
||||
DISABLE_ISRS(); // No interrupts during byte send
|
||||
HAL_SPI_STM32_SpiTransfer_Mode_3(data); // Don't care what is received
|
||||
ENABLE_ISRS(); // Enable interrupts
|
||||
}
|
||||
|
||||
// Soft SPI send block
|
||||
void spiSendBlock(uint8_t token, const uint8_t *buf) {
|
||||
spiSend(token);
|
||||
for (uint16_t i = 0; i < 512; i++)
|
||||
spiSend(buf[i]);
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
// ------------------------
|
||||
// Hardware SPI
|
||||
// ------------------------
|
||||
// ------------------------
|
||||
// Hardware SPI
|
||||
// ------------------------
|
||||
|
||||
/**
|
||||
* VGPV SPI speed start and PCLK2/2, by default 108/2 = 54Mhz
|
||||
*/
|
||||
/**
|
||||
* VGPV SPI speed start and PCLK2/2, by default 108/2 = 54Mhz
|
||||
*/
|
||||
|
||||
/**
|
||||
* @brief Begin SPI port setup
|
||||
*
|
||||
* @return Nothing
|
||||
*
|
||||
* @details Only configures SS pin since stm32duino creates and initialize the SPI object
|
||||
*/
|
||||
void spiBegin() {
|
||||
#if !PIN_EXISTS(SS)
|
||||
#error "SS_PIN not defined!"
|
||||
#endif
|
||||
/**
|
||||
* @brief Begin SPI port setup
|
||||
*
|
||||
* @return Nothing
|
||||
*
|
||||
* @details Only configures SS pin since stm32duino creates and initialize the SPI object
|
||||
*/
|
||||
void spiBegin() {
|
||||
#if !PIN_EXISTS(SS)
|
||||
#error "SS_PIN not defined!"
|
||||
#endif
|
||||
|
||||
OUT_WRITE(SS_PIN, HIGH);
|
||||
}
|
||||
|
||||
/** Configure SPI for specified SPI speed */
|
||||
void spiInit(uint8_t spiRate) {
|
||||
// Use datarates Marlin uses
|
||||
uint32_t clock;
|
||||
switch (spiRate) {
|
||||
case SPI_FULL_SPEED: clock = 20000000; break; // 13.9mhz=20000000 6.75mhz=10000000 3.38mhz=5000000 .833mhz=1000000
|
||||
case SPI_HALF_SPEED: clock = 5000000; break;
|
||||
case SPI_QUARTER_SPEED: clock = 2500000; break;
|
||||
case SPI_EIGHTH_SPEED: clock = 1250000; break;
|
||||
case SPI_SPEED_5: clock = 625000; break;
|
||||
case SPI_SPEED_6: clock = 300000; break;
|
||||
default:
|
||||
clock = 4000000; // Default from the SPI library
|
||||
OUT_WRITE(SS_PIN, HIGH);
|
||||
}
|
||||
spiConfig = SPISettings(clock, MSBFIRST, SPI_MODE0);
|
||||
|
||||
SPI.begin();
|
||||
}
|
||||
// Configure SPI for specified SPI speed
|
||||
void spiInit(uint8_t spiRate) {
|
||||
// Use datarates Marlin uses
|
||||
uint32_t clock;
|
||||
switch (spiRate) {
|
||||
case SPI_FULL_SPEED: clock = 20000000; break; // 13.9mhz=20000000 6.75mhz=10000000 3.38mhz=5000000 .833mhz=1000000
|
||||
case SPI_HALF_SPEED: clock = 5000000; break;
|
||||
case SPI_QUARTER_SPEED: clock = 2500000; break;
|
||||
case SPI_EIGHTH_SPEED: clock = 1250000; break;
|
||||
case SPI_SPEED_5: clock = 625000; break;
|
||||
case SPI_SPEED_6: clock = 300000; break;
|
||||
default:
|
||||
clock = 4000000; // Default from the SPI library
|
||||
}
|
||||
spiConfig = SPISettings(clock, MSBFIRST, SPI_MODE0);
|
||||
|
||||
/**
|
||||
* @brief Receives a single byte from the SPI port.
|
||||
*
|
||||
* @return Byte received
|
||||
*
|
||||
* @details
|
||||
*/
|
||||
uint8_t spiRec() {
|
||||
SPI.beginTransaction(spiConfig);
|
||||
uint8_t returnByte = SPI.transfer(0xFF);
|
||||
SPI.endTransaction();
|
||||
return returnByte;
|
||||
}
|
||||
#if ENABLED(CUSTOM_SPI_PINS)
|
||||
SPI.setMISO(MISO_PIN);
|
||||
SPI.setMOSI(MOSI_PIN);
|
||||
SPI.setSCLK(SCK_PIN);
|
||||
SPI.setSSEL(SS_PIN);
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Receives a number of bytes from the SPI port to a buffer
|
||||
*
|
||||
* @param buf Pointer to starting address of buffer to write to.
|
||||
* @param nbyte Number of bytes to receive.
|
||||
* @return Nothing
|
||||
*
|
||||
* @details Uses DMA
|
||||
*/
|
||||
void spiRead(uint8_t* buf, uint16_t nbyte) {
|
||||
if (nbyte == 0) return;
|
||||
memset(buf, 0xFF, nbyte);
|
||||
SPI.beginTransaction(spiConfig);
|
||||
SPI.transfer(buf, nbyte);
|
||||
SPI.endTransaction();
|
||||
}
|
||||
SPI.begin();
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Sends a single byte on SPI port
|
||||
*
|
||||
* @param b Byte to send
|
||||
*
|
||||
* @details
|
||||
*/
|
||||
void spiSend(uint8_t b) {
|
||||
SPI.beginTransaction(spiConfig);
|
||||
SPI.transfer(b);
|
||||
SPI.endTransaction();
|
||||
}
|
||||
/**
|
||||
* @brief Receives a single byte from the SPI port.
|
||||
*
|
||||
* @return Byte received
|
||||
*
|
||||
* @details
|
||||
*/
|
||||
uint8_t spiRec() {
|
||||
SPI.beginTransaction(spiConfig);
|
||||
uint8_t returnByte = SPI.transfer(0xFF);
|
||||
SPI.endTransaction();
|
||||
return returnByte;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Write token and then write from 512 byte buffer to SPI (for SD card)
|
||||
*
|
||||
* @param buf Pointer with buffer start address
|
||||
* @return Nothing
|
||||
*
|
||||
* @details Use DMA
|
||||
*/
|
||||
void spiSendBlock(uint8_t token, const uint8_t* buf) {
|
||||
uint8_t rxBuf[512];
|
||||
SPI.beginTransaction(spiConfig);
|
||||
SPI.transfer(token);
|
||||
SPI.transfer((uint8_t*)buf, &rxBuf, 512);
|
||||
SPI.endTransaction();
|
||||
}
|
||||
/**
|
||||
* @brief Receive a number of bytes from the SPI port to a buffer
|
||||
*
|
||||
* @param buf Pointer to starting address of buffer to write to.
|
||||
* @param nbyte Number of bytes to receive.
|
||||
* @return Nothing
|
||||
*
|
||||
* @details Uses DMA
|
||||
*/
|
||||
void spiRead(uint8_t* buf, uint16_t nbyte) {
|
||||
if (nbyte == 0) return;
|
||||
memset(buf, 0xFF, nbyte);
|
||||
SPI.beginTransaction(spiConfig);
|
||||
SPI.transfer(buf, nbyte);
|
||||
SPI.endTransaction();
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Send a single byte on SPI port
|
||||
*
|
||||
* @param b Byte to send
|
||||
*
|
||||
* @details
|
||||
*/
|
||||
void spiSend(uint8_t b) {
|
||||
SPI.beginTransaction(spiConfig);
|
||||
SPI.transfer(b);
|
||||
SPI.endTransaction();
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Write token and then write from 512 byte buffer to SPI (for SD card)
|
||||
*
|
||||
* @param buf Pointer with buffer start address
|
||||
* @return Nothing
|
||||
*
|
||||
* @details Use DMA
|
||||
*/
|
||||
void spiSendBlock(uint8_t token, const uint8_t* buf) {
|
||||
uint8_t rxBuf[512];
|
||||
SPI.beginTransaction(spiConfig);
|
||||
SPI.transfer(token);
|
||||
SPI.transfer((uint8_t*)buf, &rxBuf, 512);
|
||||
SPI.endTransaction();
|
||||
}
|
||||
|
||||
#endif // SOFTWARE_SPI
|
||||
|
||||
|
@@ -28,25 +28,30 @@
|
||||
|
||||
#include "Servo.h"
|
||||
|
||||
uint8_t servoPin[MAX_SERVOS] = { 0 };
|
||||
static uint_fast8_t servoCount = 0;
|
||||
constexpr millis_t servoDelay[] = SERVO_DELAY;
|
||||
static_assert(COUNT(servoDelay) == NUM_SERVOS, "SERVO_DELAY must be an array NUM_SERVOS long.");
|
||||
|
||||
libServo::libServo()
|
||||
: delay(servoDelay[servoCount++])
|
||||
{}
|
||||
|
||||
int8_t libServo::attach(const int pin) {
|
||||
if (servoIndex >= MAX_SERVOS) return -1;
|
||||
if (pin > 0) servoPin[servoIndex] = pin;
|
||||
return super::attach(servoPin[servoIndex]);
|
||||
if (servoCount >= MAX_SERVOS) return -1;
|
||||
if (pin > 0) servo_pin = pin;
|
||||
return super::attach(servo_pin);
|
||||
}
|
||||
|
||||
int8_t libServo::attach(const int pin, const int min, const int max) {
|
||||
if (pin > 0) servoPin[servoIndex] = pin;
|
||||
return super::attach(servoPin[servoIndex], min, max);
|
||||
if (servoCount >= MAX_SERVOS) return -1;
|
||||
if (pin > 0) servo_pin = pin;
|
||||
return super::attach(servo_pin, min, max);
|
||||
}
|
||||
|
||||
void libServo::move(const int value) {
|
||||
constexpr uint16_t servo_delay[] = SERVO_DELAY;
|
||||
static_assert(COUNT(servo_delay) == NUM_SERVOS, "SERVO_DELAY must be an array NUM_SERVOS long.");
|
||||
if (attach(0) >= 0) {
|
||||
write(value);
|
||||
safe_delay(servo_delay[servoIndex]);
|
||||
safe_delay(delay);
|
||||
#if ENABLED(DEACTIVATE_SERVOS_AFTER_MOVE)
|
||||
detach();
|
||||
#endif
|
||||
|
@@ -27,11 +27,13 @@
|
||||
// Inherit and expand on the official library
|
||||
class libServo : public Servo {
|
||||
public:
|
||||
libServo();
|
||||
int8_t attach(const int pin);
|
||||
int8_t attach(const int pin, const int min, const int max);
|
||||
void move(const int value);
|
||||
private:
|
||||
typedef Servo super;
|
||||
uint16_t min_ticks, max_ticks;
|
||||
uint8_t servoIndex; // index into the channel data for this servo
|
||||
|
||||
int servo_pin = 0;
|
||||
millis_t delay = 0;
|
||||
};
|
||||
|
@@ -34,7 +34,7 @@
|
||||
//
|
||||
// Includes
|
||||
//
|
||||
#if defined(ARDUINO_ARCH_STM32) && !defined(STM32GENERIC)
|
||||
#if defined(PLATFORMIO) && defined(ARDUINO_ARCH_STM32) && !defined(STM32GENERIC)
|
||||
|
||||
#include "SoftwareSerial.h"
|
||||
#include "timers.h"
|
||||
|
@@ -58,6 +58,12 @@ void setup_endstop_interrupts() {
|
||||
#if HAS_Z3_MIN
|
||||
attachInterrupt(Z3_MIN_PIN, endstop_ISR, CHANGE);
|
||||
#endif
|
||||
#if HAS_Z4_MAX
|
||||
attachInterrupt(Z4_MAX_PIN, endstop_ISR, CHANGE);
|
||||
#endif
|
||||
#if HAS_Z4_MIN
|
||||
attachInterrupt(Z4_MIN_PIN, endstop_ISR, CHANGE);
|
||||
#endif
|
||||
#if HAS_Z_MIN_PROBE_PIN
|
||||
attachInterrupt(Z_MIN_PROBE_PIN, endstop_ISR, CHANGE);
|
||||
#endif
|
||||
|
265
Marlin/src/HAL/HAL_STM32/persistent_store_flash.cpp
Normal file
265
Marlin/src/HAL/HAL_STM32/persistent_store_flash.cpp
Normal file
@@ -0,0 +1,265 @@
|
||||
/**
|
||||
* Marlin 3D Printer Firmware
|
||||
*
|
||||
* Copyright (c) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
|
||||
* Copyright (c) 2016 Bob Cousins bobcousins42@googlemail.com
|
||||
* Copyright (c) 2015-2016 Nico Tonnhofer wurstnase.reprap@gmail.com
|
||||
* Copyright (c) 2016 Victor Perez victor_pv@hotmail.com
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#if defined(ARDUINO_ARCH_STM32) && !defined(STM32GENERIC)
|
||||
|
||||
#include "../../inc/MarlinConfig.h"
|
||||
|
||||
#if BOTH(EEPROM_SETTINGS, FLASH_EEPROM_EMULATION)
|
||||
|
||||
#include "../shared/persistent_store_api.h"
|
||||
|
||||
|
||||
// Only STM32F4 can support wear leveling at this time
|
||||
#ifndef STM32F4xx
|
||||
#undef FLASH_EEPROM_LEVELING
|
||||
#endif
|
||||
|
||||
/**
|
||||
* The STM32 HAL supports chips that deal with "pages" and some with "sectors" and some that
|
||||
* even have multiple "banks" of flash.
|
||||
*
|
||||
* This code is a bit of a mashup of
|
||||
* framework-arduinoststm32/cores/arduino/stm32/stm32_eeprom.c
|
||||
* hal/hal_lpc1768/persistent_store_flash.cpp
|
||||
*
|
||||
* This has only be written against those that use a single "sector" design.
|
||||
*
|
||||
* Those that deal with "pages" could be made to work. Looking at the STM32F07 for example, there are
|
||||
* 128 "pages", each 2kB in size. If we continued with our EEPROM being 4Kb, we'd always need to operate
|
||||
* on 2 of these pages. Each write, we'd use 2 different pages from a pool of pages until we are done.
|
||||
*/
|
||||
|
||||
#if ENABLED(FLASH_EEPROM_LEVELING)
|
||||
|
||||
#include "stm32_def.h"
|
||||
|
||||
#define DEBUG_OUT ENABLED(EEPROM_CHITCHAT)
|
||||
#include "src/core/debug_out.h"
|
||||
|
||||
#ifndef EEPROM_SIZE
|
||||
#define EEPROM_SIZE 0x1000 // 4kB
|
||||
#endif
|
||||
|
||||
#ifndef FLASH_SECTOR
|
||||
#define FLASH_SECTOR (FLASH_SECTOR_TOTAL - 1)
|
||||
#endif
|
||||
#ifndef FLASH_UNIT_SIZE
|
||||
#define FLASH_UNIT_SIZE 0x20000 // 128kB
|
||||
#endif
|
||||
|
||||
#define FLASH_ADDRESS_START (FLASH_END - ((FLASH_SECTOR_TOTAL - FLASH_SECTOR) * FLASH_UNIT_SIZE) + 1)
|
||||
#define FLASH_ADDRESS_END (FLASH_ADDRESS_START + FLASH_UNIT_SIZE - 1)
|
||||
|
||||
#define EEPROM_SLOTS (FLASH_UNIT_SIZE/EEPROM_SIZE)
|
||||
#define SLOT_ADDRESS(slot) (FLASH_ADDRESS_START + (slot * EEPROM_SIZE))
|
||||
|
||||
#define UNLOCK_FLASH() if (!flash_unlocked) { \
|
||||
HAL_FLASH_Unlock(); \
|
||||
__HAL_FLASH_CLEAR_FLAG(FLASH_FLAG_EOP | FLASH_FLAG_OPERR | FLASH_FLAG_WRPERR | \
|
||||
FLASH_FLAG_PGAERR | FLASH_FLAG_PGPERR | FLASH_FLAG_PGSERR); \
|
||||
flash_unlocked = true; \
|
||||
}
|
||||
#define LOCK_FLASH() if (flash_unlocked) { HAL_FLASH_Lock(); flash_unlocked = false; }
|
||||
|
||||
#define EMPTY_UINT32 ((uint32_t)-1)
|
||||
#define EMPTY_UINT8 ((uint8_t)-1)
|
||||
|
||||
static uint8_t ram_eeprom[EEPROM_SIZE] __attribute__((aligned(4))) = {0};
|
||||
static int current_slot = -1;
|
||||
|
||||
static_assert(0 == EEPROM_SIZE % 4, "EEPROM_SIZE must be a multiple of 4"); // Ensure copying as uint32_t is safe
|
||||
static_assert(0 == FLASH_UNIT_SIZE % EEPROM_SIZE, "EEPROM_SIZE must divide evenly into your FLASH_UNIT_SIZE");
|
||||
static_assert(FLASH_UNIT_SIZE >= EEPROM_SIZE, "FLASH_UNIT_SIZE must be greater than or equal to your EEPROM_SIZE");
|
||||
static_assert(IS_FLASH_SECTOR(FLASH_SECTOR), "FLASH_SECTOR is invalid");
|
||||
static_assert(IS_POWER_OF_2(FLASH_UNIT_SIZE), "FLASH_UNIT_SIZE should be a power of 2, please check your chip's spec sheet");
|
||||
|
||||
#endif
|
||||
|
||||
static bool eeprom_data_written = false;
|
||||
|
||||
bool PersistentStore::access_start() {
|
||||
|
||||
#if ENABLED(FLASH_EEPROM_LEVELING)
|
||||
|
||||
if (current_slot == -1 || eeprom_data_written) {
|
||||
// This must be the first time since power on that we have accessed the storage, or someone
|
||||
// loaded and called write_data and never called access_finish.
|
||||
// Lets go looking for the slot that holds our configuration.
|
||||
if (eeprom_data_written) DEBUG_ECHOLN("Dangling EEPROM write_data");
|
||||
uint32_t address = FLASH_ADDRESS_START;
|
||||
while (address <= FLASH_ADDRESS_END) {
|
||||
uint32_t address_value = (*(__IO uint32_t*)address);
|
||||
if (address_value != EMPTY_UINT32) {
|
||||
current_slot = (address - FLASH_ADDRESS_START) / EEPROM_SIZE;
|
||||
break;
|
||||
}
|
||||
address += sizeof(uint32_t);
|
||||
}
|
||||
if (current_slot == -1) {
|
||||
// We didn't find anything, so we'll just intialize to empty
|
||||
for (int i = 0; i < EEPROM_SIZE; i++) ram_eeprom[i] = EMPTY_UINT8;
|
||||
current_slot = EEPROM_SLOTS;
|
||||
}
|
||||
else {
|
||||
// load current settings
|
||||
uint8_t *eeprom_data = (uint8_t *)SLOT_ADDRESS(current_slot);
|
||||
for (int i = 0; i < EEPROM_SIZE; i++) ram_eeprom[i] = eeprom_data[i];
|
||||
DEBUG_ECHOLNPAIR("EEPROM loaded from slot ", current_slot, ".");
|
||||
}
|
||||
eeprom_data_written = false;
|
||||
}
|
||||
|
||||
#else
|
||||
eeprom_buffer_fill();
|
||||
#endif
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool PersistentStore::access_finish() {
|
||||
|
||||
if (eeprom_data_written) {
|
||||
|
||||
#if ENABLED(FLASH_EEPROM_LEVELING)
|
||||
|
||||
HAL_StatusTypeDef status = HAL_ERROR;
|
||||
bool flash_unlocked = false;
|
||||
|
||||
if (--current_slot < 0) {
|
||||
// all slots have been used, erase everything and start again
|
||||
|
||||
FLASH_EraseInitTypeDef EraseInitStruct;
|
||||
uint32_t SectorError = 0;
|
||||
|
||||
EraseInitStruct.TypeErase = FLASH_TYPEERASE_SECTORS;
|
||||
EraseInitStruct.VoltageRange = FLASH_VOLTAGE_RANGE_3;
|
||||
EraseInitStruct.Sector = FLASH_SECTOR;
|
||||
EraseInitStruct.NbSectors = 1;
|
||||
|
||||
current_slot = EEPROM_SLOTS - 1;
|
||||
UNLOCK_FLASH();
|
||||
|
||||
status = HAL_FLASHEx_Erase(&EraseInitStruct, &SectorError);
|
||||
if (status != HAL_OK) {
|
||||
DEBUG_ECHOLNPAIR("HAL_FLASHEx_Erase=", status);
|
||||
DEBUG_ECHOLNPAIR("GetError=", HAL_FLASH_GetError());
|
||||
DEBUG_ECHOLNPAIR("SectorError=", SectorError);
|
||||
LOCK_FLASH();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
UNLOCK_FLASH();
|
||||
|
||||
uint32_t offset = 0;
|
||||
uint32_t address = SLOT_ADDRESS(current_slot);
|
||||
uint32_t address_end = address + EEPROM_SIZE;
|
||||
uint32_t data = 0;
|
||||
|
||||
bool success = true;
|
||||
|
||||
while (address < address_end) {
|
||||
memcpy(&data, ram_eeprom + offset, sizeof(uint32_t));
|
||||
status = HAL_FLASH_Program(FLASH_TYPEPROGRAM_WORD, address, data);
|
||||
if (status == HAL_OK) {
|
||||
address += sizeof(uint32_t);
|
||||
offset += sizeof(uint32_t);
|
||||
}
|
||||
else {
|
||||
DEBUG_ECHOLNPAIR("HAL_FLASH_Program=", status);
|
||||
DEBUG_ECHOLNPAIR("GetError=", HAL_FLASH_GetError());
|
||||
DEBUG_ECHOLNPAIR("address=", address);
|
||||
success = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
LOCK_FLASH();
|
||||
|
||||
if (success) {
|
||||
eeprom_data_written = false;
|
||||
DEBUG_ECHOLNPAIR("EEPROM saved to slot ", current_slot, ".");
|
||||
}
|
||||
|
||||
return success;
|
||||
|
||||
#else
|
||||
eeprom_buffer_flush();
|
||||
eeprom_data_written = false;
|
||||
#endif
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool PersistentStore::write_data(int &pos, const uint8_t *value, size_t size, uint16_t *crc) {
|
||||
while (size--) {
|
||||
uint8_t v = *value;
|
||||
#if ENABLED(FLASH_EEPROM_LEVELING)
|
||||
if (v != ram_eeprom[pos]) {
|
||||
ram_eeprom[pos] = v;
|
||||
eeprom_data_written = true;
|
||||
}
|
||||
#else
|
||||
if (v != eeprom_buffered_read_byte(pos)) {
|
||||
eeprom_buffered_write_byte(pos, v);
|
||||
eeprom_data_written = true;
|
||||
}
|
||||
#endif
|
||||
crc16(crc, &v, 1);
|
||||
pos++;
|
||||
value++;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool PersistentStore::read_data(int &pos, uint8_t* value, size_t size, uint16_t *crc, const bool writing/*=true*/) {
|
||||
do {
|
||||
const uint8_t c = (
|
||||
#if ENABLED(FLASH_EEPROM_LEVELING)
|
||||
ram_eeprom[pos]
|
||||
#else
|
||||
eeprom_buffered_read_byte(pos)
|
||||
#endif
|
||||
);
|
||||
if (writing) *value = c;
|
||||
crc16(crc, &c, 1);
|
||||
pos++;
|
||||
value++;
|
||||
} while (--size);
|
||||
return false;
|
||||
}
|
||||
|
||||
size_t PersistentStore::capacity() {
|
||||
return (
|
||||
#if ENABLED(FLASH_EEPROM_LEVELING)
|
||||
EEPROM_SIZE
|
||||
#else
|
||||
E2END + 1
|
||||
#endif
|
||||
);
|
||||
}
|
||||
|
||||
#endif // EEPROM_SETTINGS && FLASH_EEPROM_EMULATION
|
||||
#endif // ARDUINO_ARCH_STM32 && !STM32GENERIC
|
@@ -24,29 +24,15 @@
|
||||
|
||||
#include "../../inc/MarlinConfig.h"
|
||||
|
||||
#if ENABLED(EEPROM_SETTINGS) && ANY(FLASH_EEPROM_EMULATION, SRAM_EEPROM_EMULATION, SPI_EEPROM, I2C_EEPROM)
|
||||
#if ENABLED(EEPROM_SETTINGS) && ANY(SRAM_EEPROM_EMULATION, SPI_EEPROM, I2C_EEPROM)
|
||||
|
||||
#include "../shared/persistent_store_api.h"
|
||||
|
||||
#if ENABLED(FLASH_EEPROM_EMULATION)
|
||||
#include <EEPROM.h>
|
||||
static bool eeprom_data_written = false;
|
||||
#endif
|
||||
|
||||
bool PersistentStore::access_start() {
|
||||
#if ENABLED(FLASH_EEPROM_EMULATION)
|
||||
eeprom_buffer_fill();
|
||||
#endif
|
||||
return true;
|
||||
}
|
||||
|
||||
bool PersistentStore::access_finish() {
|
||||
#if ENABLED(FLASH_EEPROM_EMULATION)
|
||||
if (eeprom_data_written) {
|
||||
eeprom_buffer_flush();
|
||||
eeprom_data_written = false;
|
||||
}
|
||||
#endif
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -66,8 +52,6 @@ bool PersistentStore::write_data(int &pos, const uint8_t *value, size_t size, ui
|
||||
return true;
|
||||
}
|
||||
}
|
||||
#elif ENABLED(FLASH_EEPROM_EMULATION)
|
||||
eeprom_buffered_write_byte(pos, v);
|
||||
#else
|
||||
*(__IO uint8_t *)(BKPSRAM_BASE + (uint8_t * const)pos) = v;
|
||||
#endif
|
||||
@@ -76,9 +60,6 @@ bool PersistentStore::write_data(int &pos, const uint8_t *value, size_t size, ui
|
||||
pos++;
|
||||
value++;
|
||||
};
|
||||
#if ENABLED(FLASH_EEPROM_EMULATION)
|
||||
eeprom_data_written = true;
|
||||
#endif
|
||||
|
||||
return false;
|
||||
}
|
||||
@@ -89,8 +70,6 @@ bool PersistentStore::read_data(int &pos, uint8_t* value, size_t size, uint16_t
|
||||
const uint8_t c = (
|
||||
#if EITHER(SPI_EEPROM, I2C_EEPROM)
|
||||
eeprom_read_byte((uint8_t*)pos)
|
||||
#elif ENABLED(FLASH_EEPROM_EMULATION)
|
||||
eeprom_buffered_read_byte(pos)
|
||||
#else
|
||||
(*(__IO uint8_t *)(BKPSRAM_BASE + ((uint8_t*)pos)))
|
||||
#endif
|
||||
@@ -114,5 +93,5 @@ size_t PersistentStore::capacity() {
|
||||
);
|
||||
}
|
||||
|
||||
#endif // EEPROM_SETTINGS && (FLASH_EEPROM_EMULATION || SRAM_EEPROM_EMULATION || SPI_EEPROM || I2C_EEPROM)
|
||||
#endif // EEPROM_SETTINGS && (SRAM_EEPROM_EMULATION || SPI_EEPROM || I2C_EEPROM)
|
||||
#endif // ARDUINO_ARCH_STM32 && !STM32GENERIC
|
||||
|
@@ -33,7 +33,6 @@
|
||||
#define hal_timer_t uint32_t
|
||||
#define HAL_TIMER_TYPE_MAX 0xFFFFFFFF // Timers can be 16 or 32 bit
|
||||
|
||||
|
||||
#ifdef STM32F0xx
|
||||
|
||||
#define HAL_TIMER_RATE (F_CPU) // frequency of timer peripherals
|
||||
@@ -58,18 +57,42 @@
|
||||
#define TEMP_TIMER 2
|
||||
#endif
|
||||
|
||||
#elif defined(STM32F4xx) || defined(STM32F7xx)
|
||||
#elif defined(STM32F401xC) || defined(STM32F401xE)
|
||||
|
||||
#define HAL_TIMER_RATE (F_CPU/2) // frequency of timer peripherals
|
||||
#define HAL_TIMER_RATE (F_CPU / 2) // frequency of timer peripherals
|
||||
|
||||
#ifndef STEP_TIMER
|
||||
#define STEP_TIMER 5
|
||||
#define STEP_TIMER 9
|
||||
#endif
|
||||
|
||||
#ifndef TEMP_TIMER
|
||||
#define TEMP_TIMER 10
|
||||
#endif
|
||||
|
||||
#elif defined(STM32F4xx)
|
||||
|
||||
#define HAL_TIMER_RATE (F_CPU / 2) // frequency of timer peripherals
|
||||
|
||||
#ifndef STEP_TIMER
|
||||
#define STEP_TIMER 6 // STM32F401 has no TIM6, TIM7, or TIM8
|
||||
#endif
|
||||
|
||||
#ifndef TEMP_TIMER
|
||||
#define TEMP_TIMER 14 // TIM7 is consumed by Software Serial if used.
|
||||
#endif
|
||||
|
||||
#elif defined(STM32F7xx)
|
||||
|
||||
#define HAL_TIMER_RATE (F_CPU / 2) // frequency of timer peripherals
|
||||
|
||||
#ifndef STEP_TIMER
|
||||
#define STEP_TIMER 6 // the RIGHT timer!
|
||||
#endif
|
||||
|
||||
#ifndef TEMP_TIMER
|
||||
#define TEMP_TIMER 14
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
#ifndef SWSERIAL_TIMER_IRQ_PRIO
|
||||
@@ -81,16 +104,16 @@
|
||||
#endif
|
||||
|
||||
#ifndef TEMP_TIMER_IRQ_PRIO
|
||||
#define TEMP_TIMER_IRQ_PRIO 14 //14 = after hardware ISRs
|
||||
#define TEMP_TIMER_IRQ_PRIO 14 // 14 = after hardware ISRs
|
||||
#endif
|
||||
|
||||
#define STEP_TIMER_NUM 0 // index of timer to use for stepper
|
||||
#define TEMP_TIMER_NUM 1 // index of timer to use for temperature
|
||||
#define PULSE_TIMER_NUM STEP_TIMER_NUM
|
||||
|
||||
#define TEMP_TIMER_FREQUENCY 1000 //Temperature::isr() is expected to be called at around 1kHz
|
||||
#define TEMP_TIMER_FREQUENCY 1000 // Temperature::isr() is expected to be called at around 1kHz
|
||||
|
||||
//TODO: get rid of manual rate/prescale/ticks/cycles taken for procedures in stepper.cpp
|
||||
// TODO: get rid of manual rate/prescale/ticks/cycles taken for procedures in stepper.cpp
|
||||
#define STEPPER_TIMER_RATE 2000000 // 2 Mhz
|
||||
#define STEPPER_TIMER_PRESCALE ((HAL_TIMER_RATE)/(STEPPER_TIMER_RATE))
|
||||
#define STEPPER_TIMER_TICKS_PER_US ((STEPPER_TIMER_RATE) / 1000000) // stepper timer ticks per µs
|
||||
|
@@ -118,6 +118,12 @@ const uint8_t adc_pins[] = {
|
||||
#if HAS_TEMP_ADC_5
|
||||
TEMP_5_PIN,
|
||||
#endif
|
||||
#if HAS_TEMP_ADC_6
|
||||
TEMP_6_PIN,
|
||||
#endif
|
||||
#if HAS_TEMP_ADC_7
|
||||
TEMP_7_PIN,
|
||||
#endif
|
||||
#if ENABLED(FILAMENT_WIDTH_SENSOR)
|
||||
FILWIDTH_PIN,
|
||||
#endif
|
||||
@@ -160,6 +166,12 @@ enum TEMP_PINS : char {
|
||||
#if HAS_TEMP_ADC_5
|
||||
TEMP_5,
|
||||
#endif
|
||||
#if HAS_TEMP_ADC_6
|
||||
TEMP_6,
|
||||
#endif
|
||||
#if HAS_TEMP_ADC_7
|
||||
TEMP_7,
|
||||
#endif
|
||||
#if ENABLED(FILAMENT_WIDTH_SENSOR)
|
||||
FILWIDTH,
|
||||
#endif
|
||||
@@ -346,6 +358,12 @@ void HAL_adc_start_conversion(const uint8_t adc_pin) {
|
||||
#if HAS_TEMP_ADC_5
|
||||
case TEMP_5_PIN: pin_index = TEMP_5; break;
|
||||
#endif
|
||||
#if HAS_TEMP_ADC_6
|
||||
case TEMP_6_PIN: pin_index = TEMP_6; break;
|
||||
#endif
|
||||
#if HAS_TEMP_ADC_7
|
||||
case TEMP_7_PIN: pin_index = TEMP_7; break;
|
||||
#endif
|
||||
#if HAS_JOY_ADC_X
|
||||
case JOY_X_PIN: pin_index = JOY_X; break;
|
||||
#endif
|
||||
|
@@ -78,13 +78,10 @@
|
||||
#define MSerial5 Serial4
|
||||
#endif
|
||||
|
||||
#if !WITHIN(SERIAL_PORT, -1, 5)
|
||||
#error "SERIAL_PORT must be from -1 to 5"
|
||||
#endif
|
||||
#if SERIAL_PORT == -1
|
||||
#if SERIAL_PORT == 0
|
||||
#error "SERIAL_PORT cannot be 0. (Port 0 does not exist.) Please update your configuration."
|
||||
#elif SERIAL_PORT == -1
|
||||
#define MYSERIAL0 UsbSerial
|
||||
#elif SERIAL_PORT == 0
|
||||
#error "Serial port 0 does not exist"
|
||||
#elif SERIAL_PORT == 1
|
||||
#define MYSERIAL0 MSerial1
|
||||
#elif SERIAL_PORT == 2
|
||||
@@ -95,19 +92,17 @@
|
||||
#define MYSERIAL0 MSerial4
|
||||
#elif SERIAL_PORT == 5
|
||||
#define MYSERIAL0 MSerial5
|
||||
#else
|
||||
#error "SERIAL_PORT must be from -1 to 5. Please update your configuration."
|
||||
#endif
|
||||
|
||||
#ifdef SERIAL_PORT_2
|
||||
#if !WITHIN(SERIAL_PORT_2, -1, 5)
|
||||
#error "SERIAL_PORT_2 must be from -1 to 5"
|
||||
#if SERIAL_PORT_2 == 0
|
||||
#error "SERIAL_PORT_2 cannot be 0. (Port 0 does not exist.) Please update your configuration."
|
||||
#elif SERIAL_PORT_2 == SERIAL_PORT
|
||||
#error "SERIAL_PORT_2 must be different than SERIAL_PORT"
|
||||
#endif
|
||||
#define NUM_SERIAL 2
|
||||
#if SERIAL_PORT_2 == -1
|
||||
#error "SERIAL_PORT_2 must be different than SERIAL_PORT. Please update your configuration."
|
||||
#elif SERIAL_PORT_2 == -1
|
||||
#define MYSERIAL1 UsbSerial
|
||||
#elif SERIAL_PORT_2 == 0
|
||||
#error "Serial port 0 does not exist"
|
||||
#elif SERIAL_PORT_2 == 1
|
||||
#define MYSERIAL1 MSerial1
|
||||
#elif SERIAL_PORT_2 == 2
|
||||
@@ -118,11 +113,39 @@
|
||||
#define MYSERIAL1 MSerial4
|
||||
#elif SERIAL_PORT_2 == 5
|
||||
#define MYSERIAL1 MSerial5
|
||||
#else
|
||||
#error "SERIAL_PORT_2 must be from -1 to 5. Please update your configuration."
|
||||
#endif
|
||||
#define NUM_SERIAL 2
|
||||
#else
|
||||
#define NUM_SERIAL 1
|
||||
#endif
|
||||
|
||||
#ifdef DGUS_SERIAL
|
||||
#if DGUS_SERIAL_PORT == 0
|
||||
#error "DGUS_SERIAL_PORT cannot be 0. (Port 0 does not exist.) Please update your configuration."
|
||||
#elif DGUS_SERIAL_PORT == SERIAL_PORT
|
||||
#error "DGUS_SERIAL_PORT must be different than SERIAL_PORT. Please update your configuration."
|
||||
#elif defined(SERIAL_PORT_2) && DGUS_SERIAL_PORT == SERIAL_PORT_2
|
||||
#error "DGUS_SERIAL_PORT must be different than SERIAL_PORT_2. Please update your configuration."
|
||||
#elif DGUS_SERIAL_PORT == -1
|
||||
#define DGUS_SERIAL UsbSerial
|
||||
#elif DGUS_SERIAL_PORT == 1
|
||||
#define DGUS_SERIAL MSerial1
|
||||
#elif DGUS_SERIAL_PORT == 2
|
||||
#define DGUS_SERIAL MSerial2
|
||||
#elif DGUS_SERIAL_PORT == 3
|
||||
#define DGUS_SERIAL MSerial3
|
||||
#elif DGUS_SERIAL_PORT == 4
|
||||
#define DGUS_SERIAL MSerial4
|
||||
#elif DGUS_SERIAL_PORT == 5
|
||||
#define DGUS_SERIAL MSerial5
|
||||
#else
|
||||
#error "DGUS_SERIAL_PORT must be from -1 to 5. Please update your configuration."
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
// Set interrupt grouping for this MCU
|
||||
void HAL_init();
|
||||
#define HAL_IDLETASK 1
|
||||
|
@@ -49,6 +49,7 @@
|
||||
void LCD_IO_Init(uint8_t cs, uint8_t rs);
|
||||
void LCD_IO_WriteData(uint16_t RegValue);
|
||||
void LCD_IO_WriteReg(uint16_t Reg);
|
||||
uint16_t LCD_IO_ReadData(uint16_t RegValue);
|
||||
uint32_t LCD_IO_ReadData(uint16_t RegValue, uint8_t ReadSize);
|
||||
#ifdef LCD_USE_DMA_FSMC
|
||||
void LCD_IO_WriteMultiple(uint16_t data, uint32_t count);
|
||||
@@ -79,8 +80,11 @@ uint8_t u8g_com_stm32duino_fsmc_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, voi
|
||||
LCD_IO_Init(u8g->pin_list[U8G_PI_CS], u8g->pin_list[U8G_PI_A0]);
|
||||
u8g_Delay(50);
|
||||
|
||||
if (arg_ptr)
|
||||
*((uint32_t *)arg_ptr) = LCD_IO_ReadData(LCD_READ_ID, 3);
|
||||
if (arg_ptr) {
|
||||
*((uint32_t *)arg_ptr) = LCD_IO_ReadData(0x0000);
|
||||
if (*((uint32_t *)arg_ptr) == 0)
|
||||
*((uint32_t *)arg_ptr) = (LCD_READ_ID << 24) | LCD_IO_ReadData(LCD_READ_ID, 3);
|
||||
}
|
||||
isCommand = 0;
|
||||
break;
|
||||
|
||||
@@ -265,6 +269,13 @@ void LCD_IO_WriteReg(uint16_t Reg) {
|
||||
__DSB();
|
||||
}
|
||||
|
||||
uint16_t LCD_IO_ReadData(uint16_t RegValue) {
|
||||
LCD->REG = RegValue;
|
||||
__DSB();
|
||||
|
||||
return LCD->RAM;
|
||||
}
|
||||
|
||||
uint32_t LCD_IO_ReadData(uint16_t RegValue, uint8_t ReadSize) {
|
||||
volatile uint32_t data;
|
||||
LCD->REG = RegValue;
|
||||
|
@@ -82,6 +82,12 @@ void setup_endstop_interrupts() {
|
||||
#endif
|
||||
#if HAS_Z3_MIN
|
||||
attachInterrupt(Z3_MIN_PIN, endstop_ISR, CHANGE);
|
||||
#endif
|
||||
#if HAS_Z4_MAX
|
||||
attachInterrupt(Z4_MAX_PIN, endstop_ISR, CHANGE);
|
||||
#endif
|
||||
#if HAS_Z4_MIN
|
||||
attachInterrupt(Z4_MIN_PIN, endstop_ISR, CHANGE);
|
||||
#endif
|
||||
#if HAS_Z_MIN_PROBE_PIN
|
||||
attachInterrupt(Z_MIN_PROBE_PIN, endstop_ISR, CHANGE);
|
||||
|
@@ -37,7 +37,7 @@
|
||||
#error "FAST_PWM_FAN is not yet implemented for this platform."
|
||||
#endif
|
||||
|
||||
#if !defined(HAVE_SW_SERIAL) && HAS_TMC220x
|
||||
#if !defined(HAVE_SW_SERIAL) && TMC_HAS_SW_SERIAL
|
||||
#warning "With TMC2208/9 consider using SoftwareSerialM with HAVE_SW_SERIAL and appropriate SS_TIMER."
|
||||
#error "Missing SoftwareSerial implementation."
|
||||
#endif
|
||||
|
@@ -40,53 +40,73 @@
|
||||
#include <EEPROM.h>
|
||||
|
||||
// Store settings in the last two pages
|
||||
// Flash pages must be erased before writing, so keep track.
|
||||
bool firstWrite = false;
|
||||
#define EEPROM_SIZE (EEPROM_PAGE_SIZE * 2)
|
||||
#define ACCESS_FINISHED(TF) do{ FLASH_Lock(); eeprom_dirty = false; return TF; }while(0)
|
||||
|
||||
static uint8_t ram_eeprom[EEPROM_SIZE] __attribute__((aligned(4))) = {0};
|
||||
static bool eeprom_dirty = false;
|
||||
|
||||
bool PersistentStore::access_start() {
|
||||
firstWrite = true;
|
||||
const uint32_t* source = reinterpret_cast<const uint32_t*>(EEPROM_PAGE0_BASE);
|
||||
uint32_t* destination = reinterpret_cast<uint32_t*>(ram_eeprom);
|
||||
|
||||
static_assert(0 == EEPROM_SIZE % 4, "EEPROM_SIZE is corrupted. (Must be a multiple of 4.)"); // Ensure copying as uint32_t is safe
|
||||
constexpr size_t eeprom_size_u32 = EEPROM_SIZE / 4;
|
||||
|
||||
for (size_t i = 0; i < eeprom_size_u32; ++i, ++destination, ++source)
|
||||
*destination = *source;
|
||||
|
||||
eeprom_dirty = false;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool PersistentStore::access_finish() {
|
||||
FLASH_Lock();
|
||||
firstWrite = false;
|
||||
|
||||
if (eeprom_dirty) {
|
||||
FLASH_Status status;
|
||||
|
||||
// Instead of erasing all (both) pages, maybe in the loop we check what page we are in, and if the
|
||||
// data has changed in that page. We then erase the first time we "detect" a change. In theory, if
|
||||
// nothing changed in a page, we wouldn't need to erase/write it.
|
||||
// Or, instead of checking at this point, turn eeprom_dirty into an array of bool the size of number
|
||||
// of pages. Inside write_data, we set the flag to true at that time if something in that
|
||||
// page changes...either way, something to look at later.
|
||||
FLASH_Unlock();
|
||||
|
||||
status = FLASH_ErasePage(EEPROM_PAGE0_BASE);
|
||||
if (status != FLASH_COMPLETE) ACCESS_FINISHED(true);
|
||||
status = FLASH_ErasePage(EEPROM_PAGE1_BASE);
|
||||
if (status != FLASH_COMPLETE) ACCESS_FINISHED(true);
|
||||
|
||||
const uint16_t *source = reinterpret_cast<const uint16_t*>(ram_eeprom);
|
||||
for (size_t i = 0; i < EEPROM_SIZE; i += 2, ++source) {
|
||||
if (FLASH_ProgramHalfWord(EEPROM_PAGE0_BASE + i, *source) != FLASH_COMPLETE)
|
||||
ACCESS_FINISHED(false);
|
||||
}
|
||||
|
||||
ACCESS_FINISHED(true);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool PersistentStore::write_data(int &pos, const uint8_t *value, size_t size, uint16_t *crc) {
|
||||
FLASH_Status status;
|
||||
|
||||
if (firstWrite) {
|
||||
FLASH_Unlock();
|
||||
status = FLASH_ErasePage(EEPROM_PAGE0_BASE);
|
||||
if (status != FLASH_COMPLETE) return true;
|
||||
status = FLASH_ErasePage(EEPROM_PAGE1_BASE);
|
||||
if (status != FLASH_COMPLETE) return true;
|
||||
firstWrite = false;
|
||||
}
|
||||
|
||||
for (size_t i = 0; i < size; i++) {
|
||||
if (FLASH_ProgramHalfWord(EEPROM_PAGE0_BASE + (pos + i) * 2, value[i]) != FLASH_COMPLETE)
|
||||
return true;
|
||||
}
|
||||
|
||||
for (size_t i = 0; i < size; ++i) ram_eeprom[pos + i] = value[i];
|
||||
eeprom_dirty = true;
|
||||
crc16(crc, value, size);
|
||||
pos += size;
|
||||
return false;
|
||||
return false; // return true for any error
|
||||
}
|
||||
|
||||
bool PersistentStore::read_data(int &pos, uint8_t* value, const size_t size, uint16_t *crc, const bool writing/*=true*/) {
|
||||
for (size_t i = 0; i < size; i++) {
|
||||
uint8_t v = *(uint16_t *)(EEPROM_PAGE0_BASE + (pos + i) * 2);
|
||||
if (writing) value[i] = v;
|
||||
crc16(crc, &v, 1);
|
||||
}
|
||||
const uint8_t * const buff = writing ? &value[0] : &ram_eeprom[pos];
|
||||
if (writing) for (size_t i = 0; i < size; i++) value[i] = ram_eeprom[pos + i];
|
||||
crc16(crc, buff, size);
|
||||
pos += size;
|
||||
return false;
|
||||
return false; // return true for any error
|
||||
}
|
||||
|
||||
size_t PersistentStore::capacity() { return size_t(E2END + 1); }
|
||||
size_t PersistentStore::capacity() { return EEPROM_SIZE; }
|
||||
|
||||
#endif // EEPROM_SETTINGS && EEPROM FLASH
|
||||
#endif // __STM32F1__
|
||||
|
@@ -44,17 +44,12 @@
|
||||
// Defines
|
||||
// ------------------------
|
||||
|
||||
//Serial override
|
||||
// Serial override
|
||||
//extern HalSerial usb_serial;
|
||||
|
||||
#if defined(STM32F4) && SERIAL_PORT == 0
|
||||
#error "Serial port 0 does not exist"
|
||||
#endif
|
||||
|
||||
#if !WITHIN(SERIAL_PORT, -1, 6)
|
||||
#error "SERIAL_PORT must be from -1 to 6"
|
||||
#endif
|
||||
#if SERIAL_PORT == -1
|
||||
#error "SERIAL_PORT cannot be 0. (Port 0 does not exist.) Please update your configuration."
|
||||
#elif SERIAL_PORT == -1
|
||||
#define MYSERIAL0 SerialUSB
|
||||
#elif SERIAL_PORT == 1
|
||||
#define MYSERIAL0 SerialUART1
|
||||
@@ -68,19 +63,16 @@
|
||||
#define MYSERIAL0 SerialUART5
|
||||
#elif SERIAL_PORT == 6
|
||||
#define MYSERIAL0 SerialUART6
|
||||
#else
|
||||
#error "SERIAL_PORT must be from -1 to 6. Please update your configuration."
|
||||
#endif
|
||||
|
||||
#ifdef SERIAL_PORT_2
|
||||
#if defined(STM32F4) && SERIAL_PORT_2 == 0
|
||||
#error "Serial port 0 does not exist"
|
||||
#endif
|
||||
#if !WITHIN(SERIAL_PORT_2, -1, 6)
|
||||
#error "SERIAL_PORT_2 must be from -1 to 6"
|
||||
#error "SERIAL_PORT_2 cannot be 0. (Port 0 does not exist.) Please update your configuration."
|
||||
#elif SERIAL_PORT_2 == SERIAL_PORT
|
||||
#error "SERIAL_PORT_2 must be different than SERIAL_PORT"
|
||||
#endif
|
||||
#define NUM_SERIAL 2
|
||||
#if SERIAL_PORT_2 == -1
|
||||
#error "SERIAL_PORT_2 must be different than SERIAL_PORT. Please update your configuration."
|
||||
#elif SERIAL_PORT_2 == -1
|
||||
#define MYSERIAL1 SerialUSB
|
||||
#elif SERIAL_PORT_2 == 1
|
||||
#define MYSERIAL1 SerialUART1
|
||||
@@ -94,11 +86,40 @@
|
||||
#define MYSERIAL1 SerialUART5
|
||||
#elif SERIAL_PORT_2 == 6
|
||||
#define MYSERIAL1 SerialUART6
|
||||
#else
|
||||
#error "SERIAL_PORT_2 must be from -1 to 6. Please update your configuration."
|
||||
#endif
|
||||
#define NUM_SERIAL 2
|
||||
#else
|
||||
#define NUM_SERIAL 1
|
||||
#endif
|
||||
|
||||
#ifdef DGUS_SERIAL_PORT
|
||||
#if defined(STM32F4) && DGUS_SERIAL_PORT == 0
|
||||
#error "DGUS_SERIAL_PORT cannot be 0. (Port 0 does not exist.) Please update your configuration."
|
||||
#elif DGUS_SERIAL_PORT == SERIAL_PORT
|
||||
#error "DGUS_SERIAL_PORT must be different than SERIAL_PORT. Please update your configuration."
|
||||
#elif defined(SERIAL_PORT_2) && DGUS_SERIAL_PORT == SERIAL_PORT_2
|
||||
#error "DGUS_SERIAL_PORT must be different than SERIAL_PORT_2. Please update your configuration."
|
||||
#elif DGUS_SERIAL_PORT == -1
|
||||
#define DGUS_SERIAL SerialUSB
|
||||
#elif DGUS_SERIAL_PORT == 1
|
||||
#define DGUS_SERIAL SerialUART1
|
||||
#elif DGUS_SERIAL_PORT == 2
|
||||
#define DGUS_SERIAL SerialUART2
|
||||
#elif DGUS_SERIAL_PORT == 3
|
||||
#define DGUS_SERIAL SerialUART3
|
||||
#elif DGUS_SERIAL_PORT == 4
|
||||
#define DGUS_SERIAL SerialUART4
|
||||
#elif DGUS_SERIAL_PORT == 5
|
||||
#define DGUS_SERIAL SerialUART5
|
||||
#elif DGUS_SERIAL_PORT == 6
|
||||
#define DGUS_SERIAL SerialUART6
|
||||
#else
|
||||
#error "DGUS_SERIAL_PORT must be from -1 to 6. Please update your configuration."
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/**
|
||||
* TODO: review this to return 1 for pins that are not analog input
|
||||
*/
|
||||
|
@@ -36,7 +36,7 @@
|
||||
#include "TMC2660.h"
|
||||
|
||||
#include "../../../inc/MarlinConfig.h"
|
||||
#include "../../../Marlin.h"
|
||||
#include "../../../MarlinCore.h"
|
||||
#include "../../../module/stepper/indirection.h"
|
||||
#include "../../../module/printcounter.h"
|
||||
#include "../../../libs/duration_t.h"
|
||||
|
@@ -58,6 +58,12 @@ void setup_endstop_interrupts() {
|
||||
#if HAS_Z3_MIN
|
||||
attachInterrupt(Z3_MIN_PIN, endstop_ISR, CHANGE);
|
||||
#endif
|
||||
#if HAS_Z4_MAX
|
||||
attachInterrupt(Z4_MAX_PIN, endstop_ISR, CHANGE);
|
||||
#endif
|
||||
#if HAS_Z4_MIN
|
||||
attachInterrupt(Z4_MIN_PIN, endstop_ISR, CHANGE);
|
||||
#endif
|
||||
#if HAS_Z_MIN_PROBE_PIN
|
||||
attachInterrupt(Z_MIN_PROBE_PIN, endstop_ISR, CHANGE);
|
||||
#endif
|
||||
|
@@ -35,3 +35,7 @@
|
||||
#if ENABLED(FAST_PWM_FAN)
|
||||
#error "FAST_PWM_FAN is not yet implemented for this platform."
|
||||
#endif
|
||||
|
||||
#if TMC_HAS_SW_SERIAL
|
||||
#error "TMC220x Software Serial is not supported on this platform."
|
||||
#endif
|
||||
|
@@ -32,3 +32,7 @@
|
||||
#if ENABLED(FAST_PWM_FAN)
|
||||
#error "FAST_PWM_FAN is not yet implemented for this platform."
|
||||
#endif
|
||||
|
||||
#if TMC_HAS_SW_SERIAL
|
||||
#error "TMC220x Software Serial is not supported on this platform."
|
||||
#endif
|
||||
|
@@ -94,7 +94,7 @@ extern "C" {
|
||||
}
|
||||
|
||||
void HAL_adc_start_conversion(const uint8_t adc_pin) {
|
||||
uint16_t pin = pin2sc1a[adc_pin];
|
||||
const uint16_t pin = pin2sc1a[adc_pin];
|
||||
if (pin == 0xFF) {
|
||||
// Digital only
|
||||
HAL_adc_select = -1;
|
||||
|
@@ -76,6 +76,12 @@ void setup_endstop_interrupts() {
|
||||
#if HAS_Z3_MIN
|
||||
_ATTACH(Z3_MIN_PIN);
|
||||
#endif
|
||||
#if HAS_Z4_MAX
|
||||
_ATTACH(Z4_MAX_PIN);
|
||||
#endif
|
||||
#if HAS_Z4_MIN
|
||||
_ATTACH(Z4_MIN_PIN);
|
||||
#endif
|
||||
#if HAS_Z_MIN_PROBE_PIN
|
||||
_ATTACH(Z_MIN_PROBE_PIN);
|
||||
#endif
|
||||
|
@@ -32,3 +32,7 @@
|
||||
#if ENABLED(FAST_PWM_FAN)
|
||||
#error "FAST_PWM_FAN is not yet implemented for this platform."
|
||||
#endif
|
||||
|
||||
#if TMC_HAS_SW_SERIAL
|
||||
#error "TMC220x Software Serial is not supported on this platform."
|
||||
#endif
|
||||
|
@@ -145,21 +145,7 @@
|
||||
}
|
||||
#undef nop
|
||||
|
||||
#elif defined(ESP32)
|
||||
|
||||
FORCE_INLINE static void DELAY_CYCLES(uint32_t x) {
|
||||
unsigned long ccount, stop;
|
||||
|
||||
__asm__ __volatile__ ( "rsr %0, ccount" : "=a" (ccount) );
|
||||
|
||||
stop = ccount + x; // This can overflow
|
||||
|
||||
while (ccount < stop) { // This doesn't deal with overflows
|
||||
__asm__ __volatile__ ( "rsr %0, ccount" : "=a" (ccount) );
|
||||
}
|
||||
}
|
||||
|
||||
#elif defined(__PLAT_LINUX__)
|
||||
#elif defined(__PLAT_LINUX__) || defined(ESP32)
|
||||
|
||||
// specified inside platform
|
||||
|
||||
|
@@ -27,12 +27,12 @@
|
||||
|
||||
#include "../../inc/MarlinConfig.h"
|
||||
|
||||
#if HAS_DRIVER(L6470)
|
||||
#if HAS_L64XX
|
||||
|
||||
#include "Delay.h"
|
||||
|
||||
#include "../../core/serial.h"
|
||||
#include "../../libs/L6470/L6470_Marlin.h"
|
||||
#include "../../libs/L64XX/L64XX_Marlin.h"
|
||||
|
||||
// Make sure GCC optimizes this file.
|
||||
// Note that this line triggers a bug in GCC which is fixed by casting.
|
||||
@@ -40,7 +40,7 @@
|
||||
#pragma GCC optimize (3)
|
||||
|
||||
// run at ~4Mhz
|
||||
uint8_t L6470_SpiTransfer_Mode_0(uint8_t b) { // using Mode 0
|
||||
inline uint8_t L6470_SpiTransfer_Mode_0(uint8_t b) { // using Mode 0
|
||||
for (uint8_t bits = 8; bits--;) {
|
||||
WRITE(L6470_CHAIN_MOSI_PIN, b & 0x80);
|
||||
b <<= 1; // little setup time
|
||||
@@ -56,61 +56,26 @@ uint8_t L6470_SpiTransfer_Mode_0(uint8_t b) { // using Mode 0
|
||||
return b;
|
||||
}
|
||||
|
||||
uint8_t L6470_SpiTransfer_Mode_3(uint8_t b) { // using Mode 3
|
||||
inline uint8_t L6470_SpiTransfer_Mode_3(uint8_t b) { // using Mode 3
|
||||
for (uint8_t bits = 8; bits--;) {
|
||||
WRITE(L6470_CHAIN_SCK_PIN, LOW);
|
||||
WRITE(L6470_CHAIN_MOSI_PIN, b & 0x80);
|
||||
|
||||
DELAY_NS(125); // 10 cycles @ 84mhz
|
||||
|
||||
WRITE(L6470_CHAIN_SCK_PIN, HIGH);
|
||||
DELAY_NS(125); // Need more delay for fast CPUs
|
||||
|
||||
b <<= 1; // little setup time
|
||||
b |= (READ(L6470_CHAIN_MISO_PIN) != 0);
|
||||
}
|
||||
|
||||
DELAY_NS(125); // 10 cycles @ 84mhz
|
||||
DELAY_NS(125); // 10 cycles @ 84mhz
|
||||
return b;
|
||||
}
|
||||
|
||||
/**
|
||||
* The following are weak-linked and defined as do-nothing
|
||||
* functions by the L6470-Arduino library. They must be
|
||||
* defined by the client (Marlin) to provide an SPI interface.
|
||||
* L64XX methods for SPI init and transfer
|
||||
*/
|
||||
|
||||
uint8_t L6470_transfer(uint8_t data, int16_t ss_pin, const uint8_t chain_position) {
|
||||
uint8_t data_out = 0;
|
||||
|
||||
// first device in chain has data sent last
|
||||
extDigitalWrite(ss_pin, LOW);
|
||||
|
||||
for (uint8_t i = L6470::chain[0]; (i >= 1) && !spi_abort; i--) { // stop sending data if spi_abort is active
|
||||
DISABLE_ISRS(); // disable interrupts during SPI transfer (can't allow partial command to chips)
|
||||
uint8_t temp = L6470_SpiTransfer_Mode_3(uint8_t(i == chain_position ? data : dSPIN_NOP));
|
||||
ENABLE_ISRS(); // enable interrupts
|
||||
if (i == chain_position) data_out = temp;
|
||||
}
|
||||
|
||||
extDigitalWrite(ss_pin, HIGH);
|
||||
return data_out;
|
||||
}
|
||||
|
||||
void L6470_transfer(uint8_t L6470_buf[], const uint8_t length) {
|
||||
// first device in chain has data sent last
|
||||
|
||||
if (spi_active) { // interrupted SPI transfer so need to
|
||||
WRITE(L6470_CHAIN_SS_PIN, HIGH); // guarantee min high of 650nS
|
||||
DELAY_US(1);
|
||||
}
|
||||
|
||||
WRITE(L6470_CHAIN_SS_PIN, LOW);
|
||||
for (uint8_t i = length; i >= 1; i--)
|
||||
L6470_SpiTransfer_Mode_3(uint8_t(L6470_buf[i]));
|
||||
WRITE(L6470_CHAIN_SS_PIN, HIGH);
|
||||
}
|
||||
|
||||
void L6470_spi_init() {
|
||||
void L64XX_Marlin::spi_init() {
|
||||
OUT_WRITE(L6470_CHAIN_SS_PIN, HIGH);
|
||||
OUT_WRITE(L6470_CHAIN_SCK_PIN, HIGH);
|
||||
OUT_WRITE(L6470_CHAIN_MOSI_PIN, HIGH);
|
||||
@@ -123,6 +88,52 @@ void L6470_spi_init() {
|
||||
OUT_WRITE(L6470_CHAIN_MOSI_PIN, HIGH);
|
||||
}
|
||||
|
||||
uint8_t L64XX_Marlin::transfer_single(uint8_t data, int16_t ss_pin) {
|
||||
// First device in chain has data sent last
|
||||
extDigitalWrite(ss_pin, LOW);
|
||||
|
||||
DISABLE_ISRS(); // Disable interrupts during SPI transfer (can't allow partial command to chips)
|
||||
const uint8_t data_out = L6470_SpiTransfer_Mode_3(data);
|
||||
ENABLE_ISRS(); // Enable interrupts
|
||||
|
||||
extDigitalWrite(ss_pin, HIGH);
|
||||
return data_out;
|
||||
}
|
||||
|
||||
uint8_t L64XX_Marlin::transfer_chain(uint8_t data, int16_t ss_pin, uint8_t chain_position) {
|
||||
uint8_t data_out = 0;
|
||||
|
||||
// first device in chain has data sent last
|
||||
extDigitalWrite(ss_pin, LOW);
|
||||
|
||||
for (uint8_t i = L64XX::chain[0]; !L64xxManager.spi_abort && i >= 1; i--) { // Send data unless aborted
|
||||
DISABLE_ISRS(); // Disable interrupts during SPI transfer (can't allow partial command to chips)
|
||||
const uint8_t temp = L6470_SpiTransfer_Mode_3(uint8_t(i == chain_position ? data : dSPIN_NOP));
|
||||
ENABLE_ISRS(); // Enable interrupts
|
||||
if (i == chain_position) data_out = temp;
|
||||
}
|
||||
|
||||
extDigitalWrite(ss_pin, HIGH);
|
||||
return data_out;
|
||||
}
|
||||
|
||||
/**
|
||||
* Platform-supplied L6470 buffer transfer method
|
||||
*/
|
||||
void L64XX_Marlin::transfer(uint8_t L6470_buf[], const uint8_t length) {
|
||||
// First device in chain has its data sent last
|
||||
|
||||
if (spi_active) { // Interrupted SPI transfer so need to
|
||||
WRITE(L6470_CHAIN_SS_PIN, HIGH); // guarantee min high of 650ns
|
||||
DELAY_US(1);
|
||||
}
|
||||
|
||||
WRITE(L6470_CHAIN_SS_PIN, LOW);
|
||||
for (uint8_t i = length; i >= 1; i--)
|
||||
L6470_SpiTransfer_Mode_3(uint8_t(L6470_buf[i]));
|
||||
WRITE(L6470_CHAIN_SS_PIN, HIGH);
|
||||
}
|
||||
|
||||
#pragma GCC reset_options
|
||||
|
||||
#endif // HAS_DRIVER(L6470)
|
||||
#endif // HAS_L64XX
|
||||
|
@@ -28,6 +28,13 @@
|
||||
#include "../../inc/MarlinConfigPre.h"
|
||||
|
||||
constexpr bool
|
||||
#if HAS_DGUS_LCD
|
||||
bDGUS_SERIAL_STATS_RX_BUFFER_OVERRUNS = (false
|
||||
#if ENABLED(DGUS_SERIAL_STATS_RX_BUFFER_OVERRUNS)
|
||||
|| true
|
||||
#endif
|
||||
),
|
||||
#endif
|
||||
bSERIAL_XON_XOFF = (false
|
||||
#if ENABLED(SERIAL_XON_XOFF)
|
||||
|| true
|
||||
|
@@ -35,7 +35,7 @@ static bool UnwReportOut(void* ctx, const UnwReport* bte) {
|
||||
|
||||
(*p)++;
|
||||
|
||||
SERIAL_CHAR('#'); SERIAL_PRINT(*p,DEC); SERIAL_ECHOPGM(" : ");
|
||||
SERIAL_CHAR('#'); SERIAL_PRINT(*p, DEC); SERIAL_ECHOPGM(" : ");
|
||||
SERIAL_ECHOPGM(bte->name ? bte->name : "unknown"); SERIAL_ECHOPGM("@0x"); SERIAL_PRINT(bte->function, HEX);
|
||||
SERIAL_CHAR('+'); SERIAL_PRINT(bte->address - bte->function,DEC);
|
||||
SERIAL_ECHOPGM(" PC:"); SERIAL_PRINT(bte->address,HEX); SERIAL_CHAR('\n');
|
||||
|
@@ -164,7 +164,7 @@ typedef struct {
|
||||
* link register (i.e. not a normal register) and the stack pointer value
|
||||
* supplied.
|
||||
*
|
||||
* -If the program was compiled with -funwind-tables , it will use them to
|
||||
* -If the program was compiled with -funwind-tables it will use them to
|
||||
* perform the traceback. Otherwise, brute force will be employed
|
||||
* -If the program was compiled with -mpoke-function-name, then you will
|
||||
* get function names in the traceback. Otherwise, you will not.
|
||||
|
@@ -1,381 +0,0 @@
|
||||
/**
|
||||
* Marlin 3D Printer Firmware
|
||||
* Copyright (c) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
|
||||
*
|
||||
* Based on Sprinter and grbl.
|
||||
* Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include "inc/MarlinConfig.h"
|
||||
|
||||
#ifdef DEBUG_GCODE_PARSER
|
||||
#include "gcode/parser.h"
|
||||
#endif
|
||||
|
||||
#include <math.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#if HAS_DRIVER(L6470)
|
||||
#include "libs/L6470/L6470_Marlin.h"
|
||||
extern uint8_t axis_known_position;
|
||||
#endif
|
||||
|
||||
void stop();
|
||||
|
||||
void idle(
|
||||
#if ENABLED(ADVANCED_PAUSE_FEATURE)
|
||||
bool no_stepper_sleep = false // pass true to keep steppers from disabling on timeout
|
||||
#endif
|
||||
);
|
||||
|
||||
void manage_inactivity(const bool ignore_stepper_queue=false);
|
||||
|
||||
//
|
||||
// X, Y, Z Stepper enable / disable
|
||||
//
|
||||
#if AXIS_DRIVER_TYPE_X(L6470)
|
||||
extern L6470 stepperX;
|
||||
#define X_enable() NOOP
|
||||
#define X_disable() stepperX.free()
|
||||
#elif HAS_X_ENABLE
|
||||
#define X_enable() X_ENABLE_WRITE( X_ENABLE_ON)
|
||||
#define X_disable() X_ENABLE_WRITE(!X_ENABLE_ON)
|
||||
#else
|
||||
#define X_enable() NOOP
|
||||
#define X_disable() NOOP
|
||||
#endif
|
||||
|
||||
#if AXIS_DRIVER_TYPE_X2(L6470)
|
||||
extern L6470 stepperX2;
|
||||
#define X2_enable() NOOP
|
||||
#define X2_disable() stepperX2.free()
|
||||
#elif HAS_X2_ENABLE
|
||||
#define X2_enable() X2_ENABLE_WRITE( X_ENABLE_ON)
|
||||
#define X2_disable() X2_ENABLE_WRITE(!X_ENABLE_ON)
|
||||
#else
|
||||
#define X2_enable() NOOP
|
||||
#define X2_disable() NOOP
|
||||
#endif
|
||||
|
||||
#define enable_X() do{ X_enable(); X2_enable(); }while(0)
|
||||
#define disable_X() do{ X_disable(); X2_disable(); CBI(axis_known_position, X_AXIS); }while(0)
|
||||
|
||||
#if AXIS_DRIVER_TYPE_Y(L6470)
|
||||
extern L6470 stepperY;
|
||||
#define Y_enable() NOOP
|
||||
#define Y_disable() stepperY.free()
|
||||
#elif HAS_Y_ENABLE
|
||||
#define Y_enable() Y_ENABLE_WRITE( Y_ENABLE_ON)
|
||||
#define Y_disable() Y_ENABLE_WRITE(!Y_ENABLE_ON)
|
||||
#else
|
||||
#define Y_enable() NOOP
|
||||
#define Y_disable() NOOP
|
||||
#endif
|
||||
|
||||
#if AXIS_DRIVER_TYPE_Y2(L6470)
|
||||
extern L6470 stepperY2;
|
||||
#define Y2_enable() NOOP
|
||||
#define Y2_disable() stepperY2.free()
|
||||
#elif HAS_Y2_ENABLE
|
||||
#define Y2_enable() Y2_ENABLE_WRITE( Y_ENABLE_ON)
|
||||
#define Y2_disable() Y2_ENABLE_WRITE(!Y_ENABLE_ON)
|
||||
#else
|
||||
#define Y2_enable() NOOP
|
||||
#define Y2_disable() NOOP
|
||||
#endif
|
||||
|
||||
#define enable_Y() do{ Y_enable(); Y2_enable(); }while(0)
|
||||
#define disable_Y() do{ Y_disable(); Y2_disable(); CBI(axis_known_position, Y_AXIS); }while(0)
|
||||
|
||||
#if AXIS_DRIVER_TYPE_Z(L6470)
|
||||
extern L6470 stepperZ;
|
||||
#define Z_enable() NOOP
|
||||
#define Z_disable() stepperZ.free()
|
||||
#elif HAS_Z_ENABLE
|
||||
#define Z_enable() Z_ENABLE_WRITE( Z_ENABLE_ON)
|
||||
#define Z_disable() Z_ENABLE_WRITE(!Z_ENABLE_ON)
|
||||
#else
|
||||
#define Z_enable() NOOP
|
||||
#define Z_disable() NOOP
|
||||
#endif
|
||||
|
||||
#if AXIS_DRIVER_TYPE_Z2(L6470)
|
||||
extern L6470 stepperZ2;
|
||||
#define Z2_enable() NOOP
|
||||
#define Z2_disable() stepperZ2.free()
|
||||
#elif HAS_Z2_ENABLE
|
||||
#define Z2_enable() Z2_ENABLE_WRITE( Z_ENABLE_ON)
|
||||
#define Z2_disable() Z2_ENABLE_WRITE(!Z_ENABLE_ON)
|
||||
#else
|
||||
#define Z2_enable() NOOP
|
||||
#define Z2_disable() NOOP
|
||||
#endif
|
||||
|
||||
#if AXIS_DRIVER_TYPE_Z3(L6470)
|
||||
extern L6470 stepperZ3;
|
||||
#define Z3_enable() NOOP
|
||||
#define Z3_disable() stepperZ3.free()
|
||||
#elif HAS_Z3_ENABLE
|
||||
#define Z3_enable() Z3_ENABLE_WRITE( Z_ENABLE_ON)
|
||||
#define Z3_disable() Z3_ENABLE_WRITE(!Z_ENABLE_ON)
|
||||
#else
|
||||
#define Z3_enable() NOOP
|
||||
#define Z3_disable() NOOP
|
||||
#endif
|
||||
|
||||
#define enable_Z() do{ Z_enable(); Z2_enable(); Z3_enable(); }while(0)
|
||||
#define disable_Z() do{ Z_disable(); Z2_disable(); Z3_disable(); CBI(axis_known_position, Z_AXIS); }while(0)
|
||||
|
||||
//
|
||||
// Extruder Stepper enable / disable
|
||||
//
|
||||
|
||||
// define the individual enables/disables
|
||||
#if AXIS_DRIVER_TYPE_E0(L6470)
|
||||
extern L6470 stepperE0;
|
||||
#define E0_enable() NOOP
|
||||
#define E0_disable() do{ stepperE0.free(); CBI(axis_known_position, E_AXIS); }while(0)
|
||||
#elif HAS_E0_ENABLE
|
||||
#define E0_enable() E0_ENABLE_WRITE( E_ENABLE_ON)
|
||||
#define E0_disable() E0_ENABLE_WRITE(!E_ENABLE_ON)
|
||||
#else
|
||||
#define E0_enable() NOOP
|
||||
#define E0_disable() NOOP
|
||||
#endif
|
||||
|
||||
#if AXIS_DRIVER_TYPE_E1(L6470)
|
||||
extern L6470 stepperE1;
|
||||
#define E1_enable() NOOP
|
||||
#define E1_disable() do{ stepperE1.free(); CBI(axis_known_position, E_AXIS); }while(0)
|
||||
#elif E_STEPPERS > 1 && HAS_E1_ENABLE
|
||||
#define E1_enable() E1_ENABLE_WRITE( E_ENABLE_ON)
|
||||
#define E1_disable() E1_ENABLE_WRITE(!E_ENABLE_ON)
|
||||
#else
|
||||
#define E1_enable() NOOP
|
||||
#define E1_disable() NOOP
|
||||
#endif
|
||||
|
||||
#if AXIS_DRIVER_TYPE_E2(L6470)
|
||||
extern L6470 stepperE2;
|
||||
#define E2_enable() NOOP
|
||||
#define E2_disable() do{ stepperE2.free(); CBI(axis_known_position, E_AXIS); }while(0)
|
||||
#elif E_STEPPERS > 2 && HAS_E2_ENABLE
|
||||
#define E2_enable() E2_ENABLE_WRITE( E_ENABLE_ON)
|
||||
#define E2_disable() E2_ENABLE_WRITE(!E_ENABLE_ON)
|
||||
#else
|
||||
#define E2_enable() NOOP
|
||||
#define E2_disable() NOOP
|
||||
#endif
|
||||
|
||||
#if AXIS_DRIVER_TYPE_E3(L6470)
|
||||
extern L6470 stepperE3;
|
||||
#define E3_enable() NOOP
|
||||
#define E3_disable() do{ stepperE3.free(); CBI(axis_known_position, E_AXIS); }while(0)
|
||||
#elif E_STEPPERS > 3 && HAS_E3_ENABLE
|
||||
#define E3_enable() E3_ENABLE_WRITE( E_ENABLE_ON)
|
||||
#define E3_disable() E3_ENABLE_WRITE(!E_ENABLE_ON)
|
||||
#else
|
||||
#define E3_enable() NOOP
|
||||
#define E3_disable() NOOP
|
||||
#endif
|
||||
|
||||
#if AXIS_DRIVER_TYPE_E4(L6470)
|
||||
extern L6470 stepperE4;
|
||||
#define E4_enable() NOOP
|
||||
#define E4_disable() do{ stepperE4.free(); CBI(axis_known_position, E_AXIS); }while(0)
|
||||
#elif E_STEPPERS > 4 && HAS_E4_ENABLE
|
||||
#define E4_enable() E4_ENABLE_WRITE( E_ENABLE_ON)
|
||||
#define E4_disable() E4_ENABLE_WRITE(!E_ENABLE_ON)
|
||||
#else
|
||||
#define E4_enable() NOOP
|
||||
#define E4_disable() NOOP
|
||||
#endif
|
||||
|
||||
#if AXIS_DRIVER_TYPE_E5(L6470)
|
||||
extern L6470 stepperE5;
|
||||
#define E5_enable() NOOP
|
||||
#define E5_disable() do{ stepperE5.free(); CBI(axis_known_position, E_AXIS); }while(0)
|
||||
#elif E_STEPPERS > 5 && HAS_E5_ENABLE
|
||||
#define E5_enable() E5_ENABLE_WRITE( E_ENABLE_ON)
|
||||
#define E5_disable() E5_ENABLE_WRITE(!E_ENABLE_ON)
|
||||
#else
|
||||
#define E5_enable() NOOP
|
||||
#define E5_disable() NOOP
|
||||
#endif
|
||||
|
||||
#if ENABLED(MIXING_EXTRUDER)
|
||||
|
||||
/**
|
||||
* Mixing steppers synchronize their enable (and direction) together
|
||||
*/
|
||||
#if MIXING_STEPPERS > 5
|
||||
#define enable_E0() { E0_enable(); E1_enable(); E2_enable(); E3_enable(); E4_enable(); E5_enable(); }
|
||||
#define disable_E0() { E0_disable(); E1_disable(); E2_disable(); E3_disable(); E4_disable(); E5_disable(); }
|
||||
#elif MIXING_STEPPERS > 4
|
||||
#define enable_E0() { E0_enable(); E1_enable(); E2_enable(); E3_enable(); E4_enable(); }
|
||||
#define disable_E0() { E0_disable(); E1_disable(); E2_disable(); E3_disable(); E4_disable(); }
|
||||
#elif MIXING_STEPPERS > 3
|
||||
#define enable_E0() { E0_enable(); E1_enable(); E2_enable(); E3_enable(); }
|
||||
#define disable_E0() { E0_disable(); E1_disable(); E2_disable(); E3_disable(); }
|
||||
#elif MIXING_STEPPERS > 2
|
||||
#define enable_E0() { E0_enable(); E1_enable(); E2_enable(); }
|
||||
#define disable_E0() { E0_disable(); E1_disable(); E2_disable(); }
|
||||
#else
|
||||
#define enable_E0() { E0_enable(); E1_enable(); }
|
||||
#define disable_E0() { E0_disable(); E1_disable(); }
|
||||
#endif
|
||||
#define enable_E1() NOOP
|
||||
#define disable_E1() NOOP
|
||||
#define enable_E2() NOOP
|
||||
#define disable_E2() NOOP
|
||||
#define enable_E3() NOOP
|
||||
#define disable_E3() NOOP
|
||||
#define enable_E4() NOOP
|
||||
#define disable_E4() NOOP
|
||||
#define enable_E5() NOOP
|
||||
#define disable_E5() NOOP
|
||||
|
||||
#else // !MIXING_EXTRUDER
|
||||
|
||||
#if HAS_E0_ENABLE
|
||||
#define enable_E0() E0_enable()
|
||||
#define disable_E0() E0_disable()
|
||||
#else
|
||||
#define enable_E0() NOOP
|
||||
#define disable_E0() NOOP
|
||||
#endif
|
||||
|
||||
#if E_STEPPERS > 1 && HAS_E1_ENABLE
|
||||
#define enable_E1() E1_enable()
|
||||
#define disable_E1() E1_disable()
|
||||
#else
|
||||
#define enable_E1() NOOP
|
||||
#define disable_E1() NOOP
|
||||
#endif
|
||||
|
||||
#if E_STEPPERS > 2 && HAS_E2_ENABLE
|
||||
#define enable_E2() E2_enable()
|
||||
#define disable_E2() E2_disable()
|
||||
#else
|
||||
#define enable_E2() NOOP
|
||||
#define disable_E2() NOOP
|
||||
#endif
|
||||
|
||||
#if E_STEPPERS > 3 && HAS_E3_ENABLE
|
||||
#define enable_E3() E3_enable()
|
||||
#define disable_E3() E3_disable()
|
||||
#else
|
||||
#define enable_E3() NOOP
|
||||
#define disable_E3() NOOP
|
||||
#endif
|
||||
|
||||
#if E_STEPPERS > 4 && HAS_E4_ENABLE
|
||||
#define enable_E4() E4_enable()
|
||||
#define disable_E4() E4_disable()
|
||||
#else
|
||||
#define enable_E4() NOOP
|
||||
#define disable_E4() NOOP
|
||||
#endif
|
||||
|
||||
#if E_STEPPERS > 5 && HAS_E5_ENABLE
|
||||
#define enable_E5() E5_enable()
|
||||
#define disable_E5() E5_disable()
|
||||
#else
|
||||
#define enable_E5() NOOP
|
||||
#define disable_E5() NOOP
|
||||
#endif
|
||||
|
||||
#endif // !MIXING_EXTRUDER
|
||||
|
||||
#if ENABLED(EXPERIMENTAL_I2CBUS)
|
||||
#include "feature/twibus.h"
|
||||
extern TWIBus i2c;
|
||||
#endif
|
||||
|
||||
#if ENABLED(G38_PROBE_TARGET)
|
||||
extern uint8_t G38_move; // Flag to tell the ISR that G38 is in progress, and the type
|
||||
extern bool G38_did_trigger; // Flag from the ISR to indicate the endstop changed
|
||||
#endif
|
||||
|
||||
/**
|
||||
* The axis order in all axis related arrays is X, Y, Z, E
|
||||
*/
|
||||
void enable_e_steppers();
|
||||
void enable_all_steppers();
|
||||
void disable_e_stepper(const uint8_t e);
|
||||
void disable_e_steppers();
|
||||
void disable_all_steppers();
|
||||
|
||||
void kill(PGM_P const lcd_error=nullptr, PGM_P const lcd_component=nullptr, const bool steppers_off=false);
|
||||
void minkill(const bool steppers_off=false);
|
||||
|
||||
void quickstop_stepper();
|
||||
|
||||
extern bool Running;
|
||||
inline bool IsRunning() { return Running; }
|
||||
inline bool IsStopped() { return !Running; }
|
||||
|
||||
bool printingIsActive();
|
||||
bool printingIsPaused();
|
||||
void startOrResumeJob();
|
||||
|
||||
extern bool wait_for_heatup;
|
||||
|
||||
#if HAS_RESUME_CONTINUE
|
||||
extern bool wait_for_user;
|
||||
#endif
|
||||
|
||||
#if HAS_AUTO_REPORTING || ENABLED(HOST_KEEPALIVE_FEATURE)
|
||||
extern bool suspend_auto_report;
|
||||
#endif
|
||||
|
||||
// Inactivity shutdown timer
|
||||
extern millis_t max_inactive_time, stepper_inactive_time;
|
||||
|
||||
#if ENABLED(USE_CONTROLLER_FAN)
|
||||
extern uint8_t controllerfan_speed;
|
||||
#endif
|
||||
|
||||
#if ENABLED(PSU_CONTROL)
|
||||
extern bool powersupply_on;
|
||||
#define PSU_PIN_ON() do{ OUT_WRITE(PS_ON_PIN, PSU_ACTIVE_HIGH); powersupply_on = true; }while(0)
|
||||
#define PSU_PIN_OFF() do{ OUT_WRITE(PS_ON_PIN, !PSU_ACTIVE_HIGH); powersupply_on = false; }while(0)
|
||||
#if ENABLED(AUTO_POWER_CONTROL)
|
||||
#define PSU_ON() powerManager.power_on()
|
||||
#define PSU_OFF() powerManager.power_off()
|
||||
#else
|
||||
#define PSU_ON() PSU_PIN_ON()
|
||||
#define PSU_OFF() PSU_PIN_OFF()
|
||||
#endif
|
||||
#endif
|
||||
|
||||
bool pin_is_protected(const pin_t pin);
|
||||
void protected_pin_err();
|
||||
|
||||
#if HAS_SUICIDE
|
||||
inline void suicide() { OUT_WRITE(SUICIDE_PIN, SUICIDE_PIN_INVERTING); }
|
||||
#endif
|
||||
|
||||
#if ENABLED(G29_RETRY_AND_RECOVER)
|
||||
void event_probe_recover();
|
||||
void event_probe_failure();
|
||||
#endif
|
||||
|
||||
extern const char NUL_STR[], G28_STR[], M21_STR[], M23_STR[], M24_STR[],
|
||||
SP_X_STR[], SP_Y_STR[], SP_Z_STR[], SP_E_STR[];
|
@@ -28,7 +28,7 @@
|
||||
* - https://github.com/grbl/grbl
|
||||
*/
|
||||
|
||||
#include "Marlin.h"
|
||||
#include "MarlinCore.h"
|
||||
|
||||
#include "core/utility.h"
|
||||
#include "lcd/ultralcd.h"
|
||||
@@ -177,11 +177,12 @@
|
||||
#include "feature/prusa_MMU2/mmu2.h"
|
||||
#endif
|
||||
|
||||
#if HAS_DRIVER(L6470)
|
||||
#include "libs/L6470/L6470_Marlin.h"
|
||||
#if HAS_L64XX
|
||||
#include "libs/L64XX/L64XX_Marlin.h"
|
||||
#endif
|
||||
|
||||
const char NUL_STR[] PROGMEM = "",
|
||||
M112_KILL_STR[] PROGMEM = "M112 Shutdown",
|
||||
G28_STR[] PROGMEM = "G28",
|
||||
M21_STR[] PROGMEM = "M21",
|
||||
M23_STR[] PROGMEM = "M23 %s",
|
||||
@@ -406,7 +407,7 @@ void startOrResumeJob() {
|
||||
thermalManager.zero_fan_speeds();
|
||||
wait_for_heatup = false;
|
||||
#if ENABLED(POWER_LOSS_RECOVERY)
|
||||
card.removeJobRecoveryFile();
|
||||
recovery.purge();
|
||||
#endif
|
||||
#ifdef EVENT_GCODE_SD_STOP
|
||||
queue.inject_P(PSTR(EVENT_GCODE_SD_STOP));
|
||||
@@ -553,7 +554,7 @@ void manage_inactivity(const bool ignore_stepper_queue/*=false*/) {
|
||||
bool oldstatus;
|
||||
switch (active_extruder) {
|
||||
default:
|
||||
#define _CASE_EN(N) case N: oldstatus = E##N_ENABLE_READ(); enable_E##N(); break;
|
||||
#define _CASE_EN(N) case N: oldstatus = E##N##_ENABLE_READ(); enable_E##N(); break;
|
||||
REPEAT(E_STEPPERS, _CASE_EN);
|
||||
}
|
||||
#endif
|
||||
@@ -605,7 +606,7 @@ void manage_inactivity(const bool ignore_stepper_queue/*=false*/) {
|
||||
#endif
|
||||
|
||||
#if ENABLED(MONITOR_L6470_DRIVER_STATUS)
|
||||
L6470.monitor_driver();
|
||||
L64xxManager.monitor_driver();
|
||||
#endif
|
||||
|
||||
// Limit check_axes_activity frequency to 10Hz
|
||||
@@ -618,7 +619,7 @@ void manage_inactivity(const bool ignore_stepper_queue/*=false*/) {
|
||||
#if PIN_EXISTS(FET_SAFETY)
|
||||
static millis_t FET_next;
|
||||
if (ELAPSED(ms, FET_next)) {
|
||||
FET_next = ms + FET_SAFETY_DELAY; // 2uS pulse every FET_SAFETY_DELAY mS
|
||||
FET_next = ms + FET_SAFETY_DELAY; // 2µs pulse every FET_SAFETY_DELAY mS
|
||||
OUT_WRITE(FET_SAFETY_PIN, !FET_SAFETY_INVERTED);
|
||||
DELAY_US(2);
|
||||
WRITE(FET_SAFETY_PIN, FET_SAFETY_INVERTED);
|
||||
@@ -822,8 +823,12 @@ void setup() {
|
||||
|
||||
HAL_init();
|
||||
|
||||
#if HAS_DRIVER(L6470)
|
||||
L6470.init(); // setup SPI and then init chips
|
||||
#if HAS_L64XX
|
||||
L64xxManager.init(); // Set up SPI, init drivers
|
||||
#endif
|
||||
|
||||
#if ENABLED(SMART_EFFECTOR) && PIN_EXISTS(SMART_EFFECTOR_MOD)
|
||||
OUT_WRITE(SMART_EFFECTOR_MOD_PIN, LOW); // Put Smart Effector into NORMAL mode
|
||||
#endif
|
||||
|
||||
#if ENABLED(MAX7219_DEBUG)
|
||||
@@ -1128,10 +1133,9 @@ void setup() {
|
||||
* - Call inactivity manager
|
||||
*/
|
||||
void loop() {
|
||||
do {
|
||||
|
||||
for (;;) {
|
||||
|
||||
idle(); // Do an idle first so boot is slightly faster
|
||||
idle();
|
||||
|
||||
#if ENABLED(SDSUPPORT)
|
||||
card.checkautostart();
|
||||
@@ -1141,5 +1145,10 @@ void loop() {
|
||||
queue.advance();
|
||||
|
||||
endstops.event_handler();
|
||||
}
|
||||
|
||||
} while (false // Return to caller for best compatibility
|
||||
#ifdef __AVR__
|
||||
|| true // Loop forever on slower (AVR) boards
|
||||
#endif
|
||||
);
|
||||
}
|
124
Marlin/src/MarlinCore.h
Normal file
124
Marlin/src/MarlinCore.h
Normal file
@@ -0,0 +1,124 @@
|
||||
/**
|
||||
* Marlin 3D Printer Firmware
|
||||
* Copyright (c) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
|
||||
*
|
||||
* Based on Sprinter and grbl.
|
||||
* Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include "inc/MarlinConfig.h"
|
||||
|
||||
#ifdef DEBUG_GCODE_PARSER
|
||||
#include "gcode/parser.h"
|
||||
#endif
|
||||
|
||||
#include <math.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#if HAS_L64XX
|
||||
#include "libs/L64XX/L64XX_Marlin.h"
|
||||
extern uint8_t axis_known_position;
|
||||
#endif
|
||||
|
||||
void stop();
|
||||
|
||||
void idle(
|
||||
#if ENABLED(ADVANCED_PAUSE_FEATURE)
|
||||
bool no_stepper_sleep = false // pass true to keep steppers from disabling on timeout
|
||||
#endif
|
||||
);
|
||||
|
||||
void manage_inactivity(const bool ignore_stepper_queue=false);
|
||||
|
||||
#if ENABLED(EXPERIMENTAL_I2CBUS)
|
||||
#include "feature/twibus.h"
|
||||
extern TWIBus i2c;
|
||||
#endif
|
||||
|
||||
#if ENABLED(G38_PROBE_TARGET)
|
||||
extern uint8_t G38_move; // Flag to tell the ISR that G38 is in progress, and the type
|
||||
extern bool G38_did_trigger; // Flag from the ISR to indicate the endstop changed
|
||||
#endif
|
||||
|
||||
/**
|
||||
* The axis order in all axis related arrays is X, Y, Z, E
|
||||
*/
|
||||
void enable_e_steppers();
|
||||
void enable_all_steppers();
|
||||
void disable_e_stepper(const uint8_t e);
|
||||
void disable_e_steppers();
|
||||
void disable_all_steppers();
|
||||
|
||||
void kill(PGM_P const lcd_error=nullptr, PGM_P const lcd_component=nullptr, const bool steppers_off=false);
|
||||
void minkill(const bool steppers_off=false);
|
||||
|
||||
void quickstop_stepper();
|
||||
|
||||
extern bool Running;
|
||||
inline bool IsRunning() { return Running; }
|
||||
inline bool IsStopped() { return !Running; }
|
||||
|
||||
bool printingIsActive();
|
||||
bool printingIsPaused();
|
||||
void startOrResumeJob();
|
||||
|
||||
extern bool wait_for_heatup;
|
||||
|
||||
#if HAS_RESUME_CONTINUE
|
||||
extern bool wait_for_user;
|
||||
#endif
|
||||
|
||||
#if HAS_AUTO_REPORTING || ENABLED(HOST_KEEPALIVE_FEATURE)
|
||||
extern bool suspend_auto_report;
|
||||
#endif
|
||||
|
||||
// Inactivity shutdown timer
|
||||
extern millis_t max_inactive_time, stepper_inactive_time;
|
||||
|
||||
#if ENABLED(USE_CONTROLLER_FAN)
|
||||
extern uint8_t controllerfan_speed;
|
||||
#endif
|
||||
|
||||
#if ENABLED(PSU_CONTROL)
|
||||
extern bool powersupply_on;
|
||||
#define PSU_PIN_ON() do{ OUT_WRITE(PS_ON_PIN, PSU_ACTIVE_HIGH); powersupply_on = true; }while(0)
|
||||
#define PSU_PIN_OFF() do{ OUT_WRITE(PS_ON_PIN, !PSU_ACTIVE_HIGH); powersupply_on = false; }while(0)
|
||||
#if ENABLED(AUTO_POWER_CONTROL)
|
||||
#define PSU_ON() powerManager.power_on()
|
||||
#define PSU_OFF() powerManager.power_off()
|
||||
#else
|
||||
#define PSU_ON() PSU_PIN_ON()
|
||||
#define PSU_OFF() PSU_PIN_OFF()
|
||||
#endif
|
||||
#endif
|
||||
|
||||
bool pin_is_protected(const pin_t pin);
|
||||
void protected_pin_err();
|
||||
|
||||
#if HAS_SUICIDE
|
||||
inline void suicide() { OUT_WRITE(SUICIDE_PIN, SUICIDE_PIN_INVERTING); }
|
||||
#endif
|
||||
|
||||
#if ENABLED(G29_RETRY_AND_RECOVER)
|
||||
void event_probe_recover();
|
||||
void event_probe_failure();
|
||||
#endif
|
||||
|
||||
extern const char NUL_STR[], M112_KILL_STR[], G28_STR[], M21_STR[], M23_STR[], M24_STR[],
|
||||
SP_X_STR[], SP_Y_STR[], SP_Z_STR[], SP_E_STR[];
|
@@ -64,7 +64,7 @@
|
||||
#define BOARD_MKS_BASE_HEROIC 1108 // MKS BASE 1.0 with Heroic HR4982 stepper drivers
|
||||
#define BOARD_MKS_GEN_13 1109 // MKS GEN v1.3 or 1.4
|
||||
#define BOARD_MKS_GEN_L 1110 // MKS GEN L
|
||||
#define BOARD_KFB_2 1111 // Bigtreetech or BIQU KFB2.0
|
||||
#define BOARD_KFB_2 1111 // BigTreeTech or BIQU KFB2.0
|
||||
#define BOARD_ZRIB_V20 1112 // zrib V2.0 control board (Chinese knock off RAMPS replica)
|
||||
#define BOARD_FELIX2 1113 // Felix 2.0+ Electronics Board (RAMPS like)
|
||||
#define BOARD_RIGIDBOARD 1114 // Invent-A-Part RigidBoard
|
||||
@@ -90,17 +90,18 @@
|
||||
#define BOARD_RAMPS_ENDER_4 1134 // Creality: Ender-4, CR-8
|
||||
#define BOARD_RAMPS_CREALITY 1135 // Creality: CR10S, CR20, CR-X
|
||||
#define BOARD_RAMPS_DAGOMA 1136 // Dagoma F5
|
||||
#define BOARD_FYSETC_F6_13 1137 // FYSETC F6
|
||||
#define BOARD_DUPLICATOR_I3_PLUS 1138 // Wanhao Duplicator i3 Plus
|
||||
#define BOARD_VORON 1139 // VORON Design
|
||||
#define BOARD_TRONXY_V3_1_0 1140 // Tronxy TRONXY-V3-1.0
|
||||
#define BOARD_Z_BOLT_X_SERIES 1141 // Z-Bolt X Series
|
||||
#define BOARD_TT_OSCAR 1142 // TT OSCAR
|
||||
#define BOARD_OVERLORD 1143 // Overlord/Overlord Pro
|
||||
#define BOARD_HJC2560C_REV1 1144 // ADIMLab Gantry v1
|
||||
#define BOARD_HJC2560C_REV2 1145 // ADIMLab Gantry v2
|
||||
#define BOARD_TANGO 1146 // BIQU Tango V1
|
||||
#define BOARD_MKS_GEN_L_V2 1147 // MKS GEN L V2
|
||||
#define BOARD_FYSETC_F6_13 1137 // FYSETC F6 1.3
|
||||
#define BOARD_FYSETC_F6_14 1138 // FYSETC F6 1.4
|
||||
#define BOARD_DUPLICATOR_I3_PLUS 1139 // Wanhao Duplicator i3 Plus
|
||||
#define BOARD_VORON 1140 // VORON Design
|
||||
#define BOARD_TRONXY_V3_1_0 1141 // Tronxy TRONXY-V3-1.0
|
||||
#define BOARD_Z_BOLT_X_SERIES 1142 // Z-Bolt X Series
|
||||
#define BOARD_TT_OSCAR 1143 // TT OSCAR
|
||||
#define BOARD_OVERLORD 1144 // Overlord/Overlord Pro
|
||||
#define BOARD_HJC2560C_REV1 1145 // ADIMLab Gantry v1
|
||||
#define BOARD_HJC2560C_REV2 1146 // ADIMLab Gantry v2
|
||||
#define BOARD_TANGO 1147 // BIQU Tango V1
|
||||
#define BOARD_MKS_GEN_L_V2 1148 // MKS GEN L V2
|
||||
|
||||
//
|
||||
// RAMBo and derivatives
|
||||
@@ -138,6 +139,7 @@
|
||||
#define BOARD_GT2560_V3_A20 1318 // Geeetech GT2560 Rev B for A20(M/D)
|
||||
#define BOARD_EINSTART_S 1319 // Einstart retrofit
|
||||
#define BOARD_WANHAO_ONEPLUS 1320 // Wanhao 0ne+ i3 Mini
|
||||
#define BOARD_LEAPFROG_XEED2015 1321 // Leapfrog Xeed 2015
|
||||
|
||||
//
|
||||
// ATmega1281, ATmega2561
|
||||
@@ -201,21 +203,28 @@
|
||||
#define BOARD_RAMPS_14_RE_ARM_SF 2004 // Re-ARM with RAMPS 1.4 (Power outputs: Spindle, Controller Fan)
|
||||
#define BOARD_MKS_SBASE 2005 // MKS-Sbase (Power outputs: Hotend0, Hotend1, Bed, Fan)
|
||||
#define BOARD_AZSMZ_MINI 2006 // AZSMZ Mini
|
||||
#define BOARD_AZTEEG_X5_GT 2007 // Azteeg X5 GT (Power outputs: Hotend0, Hotend1, Bed, Fan)
|
||||
#define BOARD_BIQU_BQ111_A4 2008 // BIQU BQ111-A4 (Power outputs: Hotend, Fan, Bed)
|
||||
#define BOARD_SELENA_COMPACT 2009 // Selena Compact (Power outputs: Hotend0, Hotend1, Bed0, Bed1, Fan0, Fan1)
|
||||
#define BOARD_COHESION3D_REMIX 2010 // Cohesion3D ReMix
|
||||
#define BOARD_COHESION3D_MINI 2011 // Cohesion3D Mini
|
||||
#define BOARD_SMOOTHIEBOARD 2012 // Smoothieboard
|
||||
#define BOARD_AZTEEG_X5_MINI_WIFI 2013 // Azteeg X5 Mini Wifi (Power outputs: Hotend0, Bed, Fan)
|
||||
#define BOARD_BIGTREE_SKR_V1_1 2014 // BIGTREE SKR_V1.1 (Power outputs: Hotend0,Hotend1, Fan, Bed)
|
||||
#define BOARD_BIQU_B300_V1_0 2015 // BIQU B300_V1.0 (Power outputs: Hotend0, Fan, Bed, SPI Driver)
|
||||
#define BOARD_BIGTREE_SKR_V1_3 2016 // BIGTREE SKR_V1.3 (Power outputs: Hotend0, Hotend1, Fan, Bed)
|
||||
#define BOARD_AZTEEG_X5_MINI 2017 // Azteeg X5 Mini (Power outputs: Hotend0, Bed, Fan)
|
||||
#define BOARD_MKS_SGEN 2018 // MKS-SGen (Power outputs: Hotend0, Hotend1, Bed, Fan)
|
||||
#define BOARD_MKS_SGEN_L 2019 // MKS-SGen-L (Power outputs: Hotend0, Hotend1, Bed, Fan)
|
||||
#define BOARD_TH3D_EZBOARD 2020 // TH3D EZBoard v1.0
|
||||
#define BOARD_GMARSH_X6_REV1 2021 // GMARSH X6 board, revision 1 prototype
|
||||
#define BOARD_BIQU_BQ111_A4 2007 // BIQU BQ111-A4 (Power outputs: Hotend, Fan, Bed)
|
||||
#define BOARD_SELENA_COMPACT 2008 // Selena Compact (Power outputs: Hotend0, Hotend1, Bed0, Bed1, Fan0, Fan1)
|
||||
#define BOARD_BIQU_B300_V1_0 2009 // BIQU B300_V1.0 (Power outputs: Hotend0, Fan, Bed, SPI Driver)
|
||||
#define BOARD_MKS_SGEN_L 2010 // MKS-SGen-L (Power outputs: Hotend0, Hotend1, Bed, Fan)
|
||||
#define BOARD_GMARSH_X6_REV1 2011 // GMARSH X6 board, revision 1 prototype
|
||||
#define BOARD_BIGTREE_SKR_V1_1 2012 // BigTreeTech SKR v1.1 (Power outputs: Hotend0, Hotend1, Fan, Bed)
|
||||
#define BOARD_BIGTREE_SKR_V1_3 2013 // BigTreeTech SKR v1.3 (Power outputs: Hotend0, Hotend1, Fan, Bed)
|
||||
#define BOARD_BIGTREE_SKR_V1_4 2014 // BigTreeTech SKR v1.4 (Power outputs: Hotend0, Hotend1, Fan, Bed)
|
||||
|
||||
//
|
||||
// LPC1769 ARM Cortex M3
|
||||
//
|
||||
|
||||
#define BOARD_MKS_SGEN 2500 // MKS-SGen (Power outputs: Hotend0, Hotend1, Bed, Fan)
|
||||
#define BOARD_AZTEEG_X5_GT 2501 // Azteeg X5 GT (Power outputs: Hotend0, Hotend1, Bed, Fan)
|
||||
#define BOARD_AZTEEG_X5_MINI 2502 // Azteeg X5 Mini (Power outputs: Hotend0, Bed, Fan)
|
||||
#define BOARD_AZTEEG_X5_MINI_WIFI 2503 // Azteeg X5 Mini Wifi (Power outputs: Hotend0, Bed, Fan)
|
||||
#define BOARD_COHESION3D_REMIX 2504 // Cohesion3D ReMix
|
||||
#define BOARD_COHESION3D_MINI 2505 // Cohesion3D Mini
|
||||
#define BOARD_SMOOTHIEBOARD 2506 // Smoothieboard
|
||||
#define BOARD_TH3D_EZBOARD 2507 // TH3D EZBoard v1.0
|
||||
#define BOARD_BIGTREE_SKR_V1_4_TURBO 2508 // BigTreeTech SKR v1.4 TURBO (Power outputs: Hotend0, Hotend1, Fan, Bed)
|
||||
|
||||
//
|
||||
// SAM3X8E ARM Cortex M3
|
||||
@@ -247,6 +256,7 @@
|
||||
#define BOARD_ARCHIM1 3023 // UltiMachine Archim1 (with DRV8825 drivers)
|
||||
#define BOARD_ARCHIM2 3024 // UltiMachine Archim2 (with TMC2130 drivers)
|
||||
#define BOARD_ALLIGATOR 3025 // Alligator Board R2
|
||||
#define BOARD_CNCONTROLS_15D 3026 // Cartesio CN Controls V15 on DUE
|
||||
|
||||
//
|
||||
// SAM3X8C ARM Cortex M3
|
||||
@@ -269,18 +279,21 @@
|
||||
#define BOARD_MKS_ROBIN_MINI 4007 // MKS Robin Mini (STM32F103VET6)
|
||||
#define BOARD_MKS_ROBIN_NANO 4008 // MKS Robin Nano (STM32F103VET6)
|
||||
#define BOARD_MKS_ROBIN_LITE 4009 // MKS Robin Lite/Lite2 (STM32F103RCT6)
|
||||
#define BOARD_BIGTREE_SKR_MINI_V1_1 4010 // BigTreeTech SKR Mini v1.1 (STM32F103RC)
|
||||
#define BOARD_BTT_SKR_MINI_E3_V1_0 4011 // BigTreeTech SKR Mini E3 (STM32F103RC)
|
||||
#define BOARD_BTT_SKR_MINI_E3_V1_2 4012 // BigTreeTech SKR Mini E3 V1.2 (STM32F103RC)
|
||||
#define BOARD_BIGTREE_SKR_E3_DIP 4013 // BigTreeTech SKR E3 DIP V1.0 (STM32F103RC / STM32F103RE)
|
||||
#define BOARD_JGAURORA_A5S_A1 4014 // JGAurora A5S A1 (STM32F103ZET6)
|
||||
#define BOARD_FYSETC_AIO_II 4015 // FYSETC AIO_II
|
||||
#define BOARD_FYSETC_CHEETAH 4016 // FYSETC Cheetah
|
||||
#define BOARD_FYSETC_CHEETAH_V12 4017 // FYSETC Cheetah V1.2
|
||||
#define BOARD_LONGER3D_LK 4018 // Alfawise U20/U20+/U30 (Longer3D LK1/2) / STM32F103VET6
|
||||
#define BOARD_GTM32_MINI 4019 // STM32F103VET6 controller
|
||||
#define BOARD_GTM32_MINI_A30 4020 // STM32F103VET6 controller
|
||||
#define BOARD_GTM32_REV_B 4021 // STM32F103VET6 controller
|
||||
#define BOARD_MKS_ROBIN_LITE3 4010 // MKS Robin Lite3 (STM32F103RCT6)
|
||||
#define BOARD_MKS_ROBIN_PRO 4011 // MKS Robin Pro (STM32F103ZET6)
|
||||
#define BOARD_BIGTREE_SKR_MINI_V1_1 4012 // BigTreeTech SKR Mini v1.1 (STM32F103RC)
|
||||
#define BOARD_BTT_SKR_MINI_E3_V1_0 4013 // BigTreeTech SKR Mini E3 (STM32F103RC)
|
||||
#define BOARD_BTT_SKR_MINI_E3_V1_2 4014 // BigTreeTech SKR Mini E3 V1.2 (STM32F103RC)
|
||||
#define BOARD_BIGTREE_SKR_E3_DIP 4015 // BigTreeTech SKR E3 DIP V1.0 (STM32F103RC / STM32F103RE)
|
||||
#define BOARD_JGAURORA_A5S_A1 4016 // JGAurora A5S A1 (STM32F103ZET6)
|
||||
#define BOARD_FYSETC_AIO_II 4017 // FYSETC AIO_II
|
||||
#define BOARD_FYSETC_CHEETAH 4018 // FYSETC Cheetah
|
||||
#define BOARD_FYSETC_CHEETAH_V12 4019 // FYSETC Cheetah V1.2
|
||||
#define BOARD_LONGER3D_LK 4020 // Alfawise U20/U20+/U30 (Longer3D LK1/2) / STM32F103VET6
|
||||
#define BOARD_GTM32_MINI 4021 // STM32F103VET6 controller
|
||||
#define BOARD_GTM32_MINI_A30 4022 // STM32F103VET6 controller
|
||||
#define BOARD_GTM32_REV_B 4023 // STM32F103VET6 controller
|
||||
|
||||
|
||||
//
|
||||
// ARM Cortex-M4F
|
||||
@@ -299,13 +312,15 @@
|
||||
#define BOARD_RUMBA32 4203 // RUMBA32 STM32F4-based controller
|
||||
#define BOARD_BLACK_STM32F407VE 4204 // BLACK_STM32F407VE
|
||||
#define BOARD_BLACK_STM32F407ZE 4205 // BLACK_STM32F407ZE
|
||||
#define BOARD_STEVAL 4206 // STEVAL-3DP001V1 3D PRINTER BOARD
|
||||
#define BOARD_STEVAL_3DP001V1 4206 // STEVAL-3DP001V1 3D PRINTER BOARD
|
||||
#define BOARD_BIGTREE_SKR_PRO_V1_1 4207 // BigTreeTech SKR Pro v1.1 (STM32F407ZG)
|
||||
#define BOARD_BIGTREE_BTT002_V1_0 4208 // BigTreeTech BTT002 v1.0 (STM32F407VE)
|
||||
#define BOARD_LERDGE_K 4209 // Lerdge K (STM32F407ZG)
|
||||
#define BOARD_LERDGE_X 4210 // Lerdge X (STM32F407VE)
|
||||
#define BOARD_VAKE403D 4211 // VAkE 403D (STM32F446VET6)
|
||||
#define BOARD_FYSETC_S6 4212 // FYSETC S6 board
|
||||
#define BOARD_FLYF407ZG 4213 // FLYF407ZG board (STM32F407ZG)
|
||||
#define BOARD_MKS_ROBIN2 4214 // MKS_ROBIN2 (STM32F407ZE)
|
||||
|
||||
//
|
||||
// ARM Cortex M7
|
||||
@@ -318,6 +333,8 @@
|
||||
// Espressif ESP32 WiFi
|
||||
//
|
||||
#define BOARD_ESPRESSIF_ESP32 6000
|
||||
#define BOARD_MRR_ESPA 6001
|
||||
#define BOARD_MRR_ESPE 6002
|
||||
|
||||
//
|
||||
// Simulations
|
||||
|
@@ -23,30 +23,33 @@
|
||||
|
||||
#include "../inc/MarlinConfigPre.h"
|
||||
|
||||
#define _A4988 0x001
|
||||
#define _A5984 0x002
|
||||
#define _DRV8825 0x003
|
||||
#define _LV8729 0x004
|
||||
#define _L6470 0x105
|
||||
#define _TB6560 0x006
|
||||
#define _TB6600 0x007
|
||||
#define _TMC2100 0x008
|
||||
#define _TMC2130 2130
|
||||
#define _TMC2130_STANDALONE 0x009
|
||||
#define _TMC2160 2160
|
||||
#define _TMC2160_STANDALONE 2161
|
||||
#define _TMC2208 2208
|
||||
#define _TMC2208_STANDALONE 0x00A
|
||||
#define _TMC2209 2209
|
||||
#define _TMC2209_STANDALONE 0x00D
|
||||
#define _TMC26X 0x10B
|
||||
#define _TMC26X_STANDALONE 0x00B
|
||||
#define _TMC2660 2660
|
||||
#define _TMC2660_STANDALONE 0x00C
|
||||
#define _TMC5130 5130
|
||||
#define _TMC5130_STANDALONE 5131
|
||||
#define _TMC5160 5160
|
||||
#define _TMC5160_STANDALONE 5161
|
||||
#define _A4988 0x4988
|
||||
#define _A5984 0x5984
|
||||
#define _DRV8825 0x8825
|
||||
#define _LV8729 0x8729
|
||||
#define _L6470 0x6470
|
||||
#define _L6474 0x6474
|
||||
#define _L6480 0x6480
|
||||
#define _POWERSTEP01 0xF00D
|
||||
#define _TB6560 0x6560
|
||||
#define _TB6600 0x6600
|
||||
#define _TMC2100 0x2100
|
||||
#define _TMC2130 0x2130A
|
||||
#define _TMC2130_STANDALONE 0x2130B
|
||||
#define _TMC2160 0x2160A
|
||||
#define _TMC2160_STANDALONE 0x2160B
|
||||
#define _TMC2208 0x2208A
|
||||
#define _TMC2208_STANDALONE 0x2208B
|
||||
#define _TMC2209 0x2209A
|
||||
#define _TMC2209_STANDALONE 0x2209B
|
||||
#define _TMC26X 0x2600A
|
||||
#define _TMC26X_STANDALONE 0x2600B
|
||||
#define _TMC2660 0x2660A
|
||||
#define _TMC2660_STANDALONE 0x2660B
|
||||
#define _TMC5130 0x5130A
|
||||
#define _TMC5130_STANDALONE 0x5130B
|
||||
#define _TMC5160 0x5160A
|
||||
#define _TMC5160_STANDALONE 0x5160B
|
||||
|
||||
#define _DRIVER_ID(V) _CAT(_, V)
|
||||
#define _AXIS_DRIVER_TYPE(A,T) (_DRIVER_ID(A##_DRIVER_TYPE) == _CAT(_, T))
|
||||
@@ -54,26 +57,35 @@
|
||||
#define AXIS_DRIVER_TYPE_X(T) _AXIS_DRIVER_TYPE(X,T)
|
||||
#define AXIS_DRIVER_TYPE_Y(T) _AXIS_DRIVER_TYPE(Y,T)
|
||||
#define AXIS_DRIVER_TYPE_Z(T) _AXIS_DRIVER_TYPE(Z,T)
|
||||
#define AXIS_DRIVER_TYPE_X2(T) (EITHER(X_DUAL_STEPPER_DRIVERS, DUAL_X_CARRIAGE) && _AXIS_DRIVER_TYPE(X2,T))
|
||||
#if EITHER(X_DUAL_STEPPER_DRIVERS, DUAL_X_CARRIAGE)
|
||||
#define AXIS_DRIVER_TYPE_X2(T) _AXIS_DRIVER_TYPE(X2,T)
|
||||
#else
|
||||
#define AXIS_DRIVER_TYPE_X2(T) false
|
||||
#endif
|
||||
#define AXIS_DRIVER_TYPE_Y2(T) (ENABLED(Y_DUAL_STEPPER_DRIVERS) && _AXIS_DRIVER_TYPE(Y2,T))
|
||||
#define AXIS_DRIVER_TYPE_Z2(T) (Z_MULTI_STEPPER_DRIVERS && _AXIS_DRIVER_TYPE(Z2,T))
|
||||
#define AXIS_DRIVER_TYPE_Z3(T) (ENABLED(Z_TRIPLE_STEPPER_DRIVERS) && _AXIS_DRIVER_TYPE(Z3,T))
|
||||
#define AXIS_DRIVER_TYPE_Z2(T) (NUM_Z_STEPPER_DRIVERS >= 2 && _AXIS_DRIVER_TYPE(Z2,T))
|
||||
#define AXIS_DRIVER_TYPE_Z3(T) (NUM_Z_STEPPER_DRIVERS >= 3 && _AXIS_DRIVER_TYPE(Z3,T))
|
||||
#define AXIS_DRIVER_TYPE_Z4(T) (NUM_Z_STEPPER_DRIVERS >= 4 && _AXIS_DRIVER_TYPE(Z4,T))
|
||||
#define AXIS_DRIVER_TYPE_E0(T) (E_STEPPERS > 0 && _AXIS_DRIVER_TYPE(E0,T))
|
||||
#define AXIS_DRIVER_TYPE_E1(T) (E_STEPPERS > 1 && _AXIS_DRIVER_TYPE(E1,T))
|
||||
#define AXIS_DRIVER_TYPE_E2(T) (E_STEPPERS > 2 && _AXIS_DRIVER_TYPE(E2,T))
|
||||
#define AXIS_DRIVER_TYPE_E3(T) (E_STEPPERS > 3 && _AXIS_DRIVER_TYPE(E3,T))
|
||||
#define AXIS_DRIVER_TYPE_E4(T) (E_STEPPERS > 4 && _AXIS_DRIVER_TYPE(E4,T))
|
||||
#define AXIS_DRIVER_TYPE_E5(T) (E_STEPPERS > 5 && _AXIS_DRIVER_TYPE(E5,T))
|
||||
#define AXIS_DRIVER_TYPE_E6(T) (E_STEPPERS > 6 && _AXIS_DRIVER_TYPE(E6,T))
|
||||
#define AXIS_DRIVER_TYPE_E7(T) (E_STEPPERS > 7 && _AXIS_DRIVER_TYPE(E7,T))
|
||||
|
||||
#define AXIS_DRIVER_TYPE(A,T) AXIS_DRIVER_TYPE_##A(T)
|
||||
|
||||
#define HAS_E_DRIVER(T) ( AXIS_DRIVER_TYPE_E0(T) || AXIS_DRIVER_TYPE_E1(T) \
|
||||
|| AXIS_DRIVER_TYPE_E2(T) || AXIS_DRIVER_TYPE_E3(T) \
|
||||
|| AXIS_DRIVER_TYPE_E4(T) || AXIS_DRIVER_TYPE_E5(T) )
|
||||
|| AXIS_DRIVER_TYPE_E4(T) || AXIS_DRIVER_TYPE_E5(T) \
|
||||
|| AXIS_DRIVER_TYPE_E6(T) || AXIS_DRIVER_TYPE_E7(T) )
|
||||
|
||||
#define HAS_DRIVER(T) ( AXIS_DRIVER_TYPE_X(T) || AXIS_DRIVER_TYPE_X2(T) \
|
||||
|| AXIS_DRIVER_TYPE_Y(T) || AXIS_DRIVER_TYPE_Y2(T) \
|
||||
|| AXIS_DRIVER_TYPE_Z(T) || AXIS_DRIVER_TYPE_Z2(T) || AXIS_DRIVER_TYPE_Z3(T) \
|
||||
|| AXIS_DRIVER_TYPE_Z(T) || AXIS_DRIVER_TYPE_Z2(T) \
|
||||
|| AXIS_DRIVER_TYPE_Z3(T) || AXIS_DRIVER_TYPE_Z4(T) \
|
||||
|| HAS_E_DRIVER(T) )
|
||||
|
||||
// Test for supported TMC drivers that require advanced configuration
|
||||
@@ -86,6 +98,18 @@
|
||||
|| HAS_DRIVER(TMC5130) \
|
||||
|| HAS_DRIVER(TMC5160) )
|
||||
|
||||
#define HAS_TRINAMIC_STANDALONE ( HAS_DRIVER(TMC2130_STANDALONE) \
|
||||
|| HAS_DRIVER(TMC2208_STANDALONE) \
|
||||
|| HAS_DRIVER(TMC2209_STANDALONE) \
|
||||
|| HAS_DRIVER(TMC26X_STANDALONE) \
|
||||
|| HAS_DRIVER(TMC2660_STANDALONE) \
|
||||
|| HAS_DRIVER(TMC5130_STANDALONE) \
|
||||
|| HAS_DRIVER(TMC5160_STANDALONE) \
|
||||
|| HAS_DRIVER(TMC2160_STANDALONE) )
|
||||
|
||||
#define HAS_TMCX1X0 ( HAS_DRIVER(TMC2130) || HAS_DRIVER(TMC2160) \
|
||||
|| HAS_DRIVER(TMC5130) || HAS_DRIVER(TMC5160))
|
||||
|
||||
#define HAS_TMC220x (HAS_DRIVER(TMC2208) || HAS_DRIVER(TMC2209))
|
||||
|
||||
#define AXIS_IS_TMC(A) ( AXIS_DRIVER_TYPE(A,TMC2130) \
|
||||
@@ -107,6 +131,8 @@
|
||||
#define AXIS_HAS_UART(A) ( AXIS_DRIVER_TYPE(A,TMC2208) \
|
||||
|| AXIS_DRIVER_TYPE(A,TMC2209) )
|
||||
|
||||
#define AXIS_HAS_SW_SERIAL(A) ((AXIS_HAS_UART(A) && !defined(A##_HARDWARE_SERIAL)))
|
||||
|
||||
#define AXIS_HAS_STALLGUARD(A) ( AXIS_DRIVER_TYPE(A,TMC2130) \
|
||||
|| AXIS_DRIVER_TYPE(A,TMC2160) \
|
||||
|| AXIS_DRIVER_TYPE(A,TMC2209) \
|
||||
@@ -121,19 +147,20 @@
|
||||
|| AXIS_DRIVER_TYPE(A,TMC5130) \
|
||||
|| AXIS_DRIVER_TYPE(A,TMC5160) )
|
||||
|
||||
#define HAS_TMC_E_DRIVER ( HAS_E_DRIVER(TMC2130) \
|
||||
|| HAS_E_DRIVER(TMC2160) \
|
||||
|| HAS_E_DRIVER(TMC2660) \
|
||||
|| HAS_E_DRIVER(TMC2209) \
|
||||
|| HAS_E_DRIVER(TMC5130) \
|
||||
|| HAS_E_DRIVER(TMC5160) )
|
||||
#define ANY_AXIS_HAS(T) ( AXIS_HAS_##T(X) || AXIS_HAS_##T(X2) \
|
||||
|| AXIS_HAS_##T(Y) || AXIS_HAS_##T(Y2) \
|
||||
|| AXIS_HAS_##T(Z) || AXIS_HAS_##T(Z2) \
|
||||
|| AXIS_HAS_##T(Z3) \
|
||||
|| AXIS_HAS_##T(E0) || AXIS_HAS_##T(E1) \
|
||||
|| AXIS_HAS_##T(E2) || AXIS_HAS_##T(E3) \
|
||||
|| AXIS_HAS_##T(E4) || AXIS_HAS_##T(E5) \
|
||||
|| AXIS_HAS_##T(E6) || AXIS_HAS_##T(E7) )
|
||||
|
||||
#define HAS_STEALTHCHOP ANY_AXIS_HAS(STEALTHCHOP)
|
||||
#define HAS_STALLGUARD ANY_AXIS_HAS(STALLGUARD)
|
||||
#define TMC_HAS_SPI ANY_AXIS_HAS(SPI)
|
||||
#define TMC_HAS_SW_SERIAL ANY_AXIS_HAS(SW_SERIAL)
|
||||
|
||||
#define HAS_TMC_STANDALONE_E_DRIVER ( HAS_E_DRIVER(TMC2130_STANDALONE) \
|
||||
|| HAS_E_DRIVER(TMC2160_STANDALONE) \
|
||||
|| HAS_E_DRIVER(TMC2660_STANDALONE) \
|
||||
|| HAS_E_DRIVER(TMC2209_STANDALONE) \
|
||||
|| HAS_E_DRIVER(TMC5130_STANDALONE) \
|
||||
|| HAS_E_DRIVER(TMC5160_STANDALONE) )
|
||||
//
|
||||
// Stretching 'drivers.h' to include LPC/SAMD51 SD options
|
||||
//
|
||||
@@ -142,3 +169,8 @@
|
||||
#define _SDCARD_CUSTOM_CABLE 3
|
||||
#define _SDCARD_ID(V) _CAT(_SDCARD_, V)
|
||||
#define SD_CONNECTION_IS(V) (_SDCARD_ID(SDCARD_CONNECTION) == _SDCARD_ID(V))
|
||||
|
||||
#define HAS_L64XX (HAS_DRIVER(L6470) || HAS_DRIVER(L6474) || HAS_DRIVER(L6480) || HAS_DRIVER(POWERSTEP01))
|
||||
#define HAS_L64XX_NOT_L6474 (HAS_L64XX && !HAS_DRIVER(L6474))
|
||||
|
||||
#define AXIS_IS_L64XX(A) (AXIS_DRIVER_TYPE_##A(L6470) || AXIS_DRIVER_TYPE_##A(L6474) || AXIS_DRIVER_TYPE_##A(L6480) || AXIS_DRIVER_TYPE_##A(POWERSTEP01))
|
||||
|
@@ -195,6 +195,8 @@
|
||||
#define MSG_Z2_MAX "z2_max"
|
||||
#define MSG_Z3_MIN "z3_min"
|
||||
#define MSG_Z3_MAX "z3_max"
|
||||
#define MSG_Z4_MIN "z4_min"
|
||||
#define MSG_Z4_MAX "z4_max"
|
||||
#define MSG_Z_PROBE "z_probe"
|
||||
#define MSG_FILAMENT_RUNOUT_SENSOR "filament"
|
||||
#define MSG_PROBE_OFFSET "Probe Offset"
|
||||
@@ -220,6 +222,10 @@
|
||||
#define MSG_SOFT_MIN " Min: "
|
||||
#define MSG_SOFT_MAX " Max: "
|
||||
|
||||
#define MSG_SAVED_POS "Position saved"
|
||||
#define MSG_RESTORING_POS "Restoring position"
|
||||
#define MSG_INVALID_POS_SLOT "Invalid slot. Total: "
|
||||
|
||||
#define MSG_SD_CANT_OPEN_SUBDIR "Cannot open subdir "
|
||||
#define MSG_SD_INIT_FAIL "SD init fail"
|
||||
#define MSG_SD_VOL_INIT_FAIL "volume.init failed"
|
||||
@@ -252,10 +258,10 @@
|
||||
#define MSG_FILAMENT_CHANGE_INSERT_M108 "Insert filament and send M108"
|
||||
#define MSG_FILAMENT_CHANGE_WAIT_M108 "Send M108 to resume"
|
||||
|
||||
#define MSG_STOP_BLTOUCH "STOP called because of BLTouch error - restart with M999"
|
||||
#define MSG_STOP_UNHOMED "STOP called because of unhomed error - restart with M999"
|
||||
#define MSG_KILL_INACTIVE_TIME "KILL caused by too much inactive time - current command: "
|
||||
#define MSG_KILL_BUTTON "KILL caused by KILL button/pin"
|
||||
#define MSG_STOP_BLTOUCH "!! STOP called because of BLTouch error - restart with M999"
|
||||
#define MSG_STOP_UNHOMED "!! STOP called because of unhomed error - restart with M999"
|
||||
#define MSG_KILL_INACTIVE_TIME "!! KILL caused by too much inactive time - current command: "
|
||||
#define MSG_KILL_BUTTON "!! KILL caused by KILL button/pin"
|
||||
|
||||
// temperature.cpp strings
|
||||
#define MSG_PID_AUTOTUNE_PREFIX "PID Autotune"
|
||||
@@ -333,6 +339,7 @@
|
||||
#define MSG_Y2 "Y2"
|
||||
#define MSG_Z2 "Z2"
|
||||
#define MSG_Z3 "Z3"
|
||||
#define MSG_Z4 "Z4"
|
||||
|
||||
#define LCD_STR_A MSG_A
|
||||
#define LCD_STR_B MSG_B
|
||||
@@ -356,6 +363,8 @@
|
||||
#define LCD_STR_N3 "3"
|
||||
#define LCD_STR_N4 "4"
|
||||
#define LCD_STR_N5 "5"
|
||||
#define LCD_STR_N6 "6"
|
||||
#define LCD_STR_N7 "7"
|
||||
#else
|
||||
#define LCD_FIRST_TOOL '1'
|
||||
#define LCD_STR_N0 "1"
|
||||
@@ -364,6 +373,8 @@
|
||||
#define LCD_STR_N3 "4"
|
||||
#define LCD_STR_N4 "5"
|
||||
#define LCD_STR_N5 "6"
|
||||
#define LCD_STR_N6 "7"
|
||||
#define LCD_STR_N7 "8"
|
||||
#endif
|
||||
|
||||
#define LCD_STR_E0 "E" LCD_STR_N0
|
||||
@@ -372,6 +383,8 @@
|
||||
#define LCD_STR_E3 "E" LCD_STR_N3
|
||||
#define LCD_STR_E4 "E" LCD_STR_N4
|
||||
#define LCD_STR_E5 "E" LCD_STR_N5
|
||||
#define LCD_STR_E6 "E" LCD_STR_N6
|
||||
#define LCD_STR_E7 "E" LCD_STR_N7
|
||||
|
||||
#include "multi_language.h" // Allow multiple languages
|
||||
|
||||
|
@@ -29,7 +29,7 @@ static const char errormagic[] PROGMEM = "Error:";
|
||||
static const char echomagic[] PROGMEM = "echo:";
|
||||
|
||||
#if NUM_SERIAL > 1
|
||||
int8_t serial_port_index = SERIAL_PORT;
|
||||
int8_t serial_port_index = 0;
|
||||
#endif
|
||||
|
||||
void serialprintPGM(PGM_P str) {
|
||||
@@ -58,12 +58,10 @@ void serialprint_onoff(const bool onoff) { serialprintPGM(onoff ? PSTR(MSG_ON) :
|
||||
void serialprintln_onoff(const bool onoff) { serialprint_onoff(onoff); SERIAL_EOL(); }
|
||||
void serialprint_truefalse(const bool tf) { serialprintPGM(tf ? PSTR("true") : PSTR("false")); }
|
||||
|
||||
void print_bin(const uint16_t val) {
|
||||
uint16_t mask = 0x8000;
|
||||
void print_bin(uint16_t val) {
|
||||
for (uint8_t i = 16; i--;) {
|
||||
if (i && !(i % 4)) SERIAL_CHAR(' ');
|
||||
SERIAL_CHAR((val & mask) ? '1' : '0');
|
||||
mask >>= 1;
|
||||
SERIAL_CHAR('0' + TEST(val, i));
|
||||
if (!(i & 0x3) && i) SERIAL_CHAR(' ');
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -66,7 +66,6 @@ extern uint8_t marlin_debug_flags;
|
||||
#define PORT_REDIRECT(p) _PORT_REDIRECT(1,p)
|
||||
#define PORT_RESTORE() _PORT_RESTORE(1)
|
||||
|
||||
#define SERIAL_CHAR(x) SERIAL_OUT(write, x)
|
||||
#define SERIAL_ECHO(x) SERIAL_OUT(print, x)
|
||||
#define SERIAL_ECHO_F(V...) SERIAL_OUT(print, V)
|
||||
#define SERIAL_ECHOLN(x) SERIAL_OUT(println, x)
|
||||
@@ -75,7 +74,7 @@ extern uint8_t marlin_debug_flags;
|
||||
#define SERIAL_PRINTF(V...) SERIAL_OUT(printf, V)
|
||||
#define SERIAL_FLUSH() SERIAL_OUT(flush)
|
||||
|
||||
#ifdef __STM32F1__
|
||||
#ifdef ARDUINO_ARCH_STM32
|
||||
#define SERIAL_FLUSHTX() SERIAL_OUT(flush)
|
||||
#elif TX_BUFFER_SIZE > 0
|
||||
#define SERIAL_FLUSHTX() SERIAL_OUT(flushTX)
|
||||
@@ -83,6 +82,22 @@ extern uint8_t marlin_debug_flags;
|
||||
#define SERIAL_FLUSHTX()
|
||||
#endif
|
||||
|
||||
// Print up to 10 chars from a list
|
||||
#define __CHAR_N(N,V...) _CHAR_##N(V)
|
||||
#define _CHAR_N(N,V...) __CHAR_N(N,V)
|
||||
#define _CHAR_1(c) SERIAL_OUT(write, c)
|
||||
#define _CHAR_2(a,b) do{ _CHAR_1(a); _CHAR_1(b); }while(0)
|
||||
#define _CHAR_3(a,V...) do{ _CHAR_1(a); _CHAR_2(V); }while(0)
|
||||
#define _CHAR_4(a,V...) do{ _CHAR_1(a); _CHAR_3(V); }while(0)
|
||||
#define _CHAR_5(a,V...) do{ _CHAR_1(a); _CHAR_4(V); }while(0)
|
||||
#define _CHAR_6(a,V...) do{ _CHAR_1(a); _CHAR_5(V); }while(0)
|
||||
#define _CHAR_7(a,V...) do{ _CHAR_1(a); _CHAR_6(V); }while(0)
|
||||
#define _CHAR_8(a,V...) do{ _CHAR_1(a); _CHAR_7(V); }while(0)
|
||||
#define _CHAR_9(a,V...) do{ _CHAR_1(a); _CHAR_8(V); }while(0)
|
||||
#define _CHAR_10(a,V...) do{ _CHAR_1(a); _CHAR_9(V); }while(0)
|
||||
|
||||
#define SERIAL_CHAR(V...) _CHAR_N(NUM_ARGS(V),V)
|
||||
|
||||
// Print up to 12 pairs of values. Odd elements auto-wrapped in PSTR().
|
||||
#define __SEP_N(N,V...) _SEP_##N(V)
|
||||
#define _SEP_N(N,V...) __SEP_N(N,V)
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user