Compare commits
288 commits
2.0.x
...
bugfix-2.0
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
fbc2d2d726 | ||
|
|
1b0a5abd73 | ||
|
|
99c377b4e4 | ||
|
|
288eb06708 | ||
|
|
eb3d6a5333 | ||
|
|
37b56e09a3 | ||
|
|
0cccc60409 | ||
|
|
2282801172 | ||
|
|
f4e9f3654e | ||
|
|
40d442fde2 | ||
|
|
6ccb4b93b1 | ||
|
|
ddc23c6224 | ||
|
|
7216b8f804 | ||
|
|
bd6e60f56d | ||
|
|
5b9aeb2e5f | ||
|
|
0465e0ae3a | ||
|
|
3b68e44d9a | ||
|
|
d4ba94479b | ||
|
|
87ce545e15 | ||
|
|
f8ee6f8b31 | ||
|
|
f15fef90a9 | ||
|
|
53e79224fc | ||
|
|
2abb674c87 | ||
|
|
60aadd2a02 | ||
|
|
6ce1eeb4ae | ||
|
|
a70fdfaeba | ||
|
|
f17394d677 | ||
|
|
12ba2ad77e | ||
|
|
59eca253e1 | ||
|
|
4ace02f4c2 | ||
|
|
c753d2b7f4 | ||
|
|
d5fdc75c82 | ||
|
|
3c318d0dc7 | ||
|
|
5013fdaf79 | ||
|
|
06bf3ccfb7 | ||
|
|
dcb0f5dc3b | ||
|
|
18fb4b1ce1 | ||
|
|
45116128e8 | ||
|
|
7beebcd315 | ||
|
|
883347bc11 | ||
|
|
b5ef699523 | ||
|
|
2da25d67e1 | ||
|
|
6954772ece | ||
|
|
2fdeceda58 | ||
|
|
53cc8a0d6e | ||
|
|
10fd9ed896 | ||
|
|
bb7dbceb5c | ||
|
|
a439892d7a | ||
|
|
bd872d5dcf | ||
|
|
bdfedf249a | ||
|
|
4785b04aa1 | ||
|
|
8c052e43f1 | ||
|
|
85d094bbb4 | ||
|
|
97d7af7a23 | ||
|
|
0a64f197d9 | ||
|
|
af75e24c2e | ||
|
|
78e10d346a | ||
|
|
c574bcce88 | ||
|
|
ce90447531 | ||
|
|
f924344cc5 | ||
|
|
323b3a63d6 | ||
|
|
077b9201ef | ||
|
|
1f6612dfc4 | ||
|
|
c43ca39ec2 | ||
|
|
0407828027 | ||
|
|
a1cce36c1e | ||
|
|
4fe1adc383 | ||
|
|
2a78fe0f81 | ||
|
|
ea5886c77d | ||
|
|
e9053654a7 | ||
|
|
0be276482e | ||
|
|
7e55cbf798 | ||
|
|
f131f58124 | ||
|
|
5a4a6285bb | ||
|
|
e7ebb66200 | ||
|
|
5deca5a18f | ||
|
|
05033bb9d6 | ||
|
|
83097657d5 | ||
|
|
12e8861a1c | ||
|
|
22bf2b49c6 | ||
|
|
4a39c8cd53 | ||
|
|
c05beb74a9 | ||
|
|
cd89fa141b | ||
|
|
76f4dd34e0 | ||
|
|
da60dcbf2e | ||
|
|
368a581de9 | ||
|
|
24c5259005 | ||
|
|
2110739138 | ||
|
|
a4a487b0cc | ||
|
|
6071a0835a | ||
|
|
a272c019f9 | ||
|
|
dde86a4179 | ||
|
|
f8d57370d0 | ||
|
|
de315c97b1 | ||
|
|
1247f73754 | ||
|
|
50ba20fe1f | ||
|
|
b6856dcb99 | ||
|
|
54ec6a0ce2 | ||
|
|
dca7c5d1ad | ||
|
|
7473241438 | ||
|
|
be0c9ff705 | ||
|
|
3f644b6275 | ||
|
|
838220e4b3 | ||
|
|
18a5000718 | ||
|
|
21674b2879 | ||
|
|
12dec2563a | ||
|
|
603e4d66ac | ||
|
|
90fcb82a3e | ||
|
|
94a6844521 | ||
|
|
bdb3f1ae2f | ||
|
|
e3f1f7cd85 | ||
|
|
c0b4f4eb47 | ||
|
|
68ef3ac675 | ||
|
|
2cae26ee35 | ||
|
|
83aa3dbfa6 | ||
|
|
82ac8a1e76 | ||
|
|
c60696dbae | ||
|
|
75b0e3246a | ||
|
|
a74e82fbae | ||
|
|
8cf672104e | ||
|
|
8bdde8d7a0 | ||
|
|
c4f3f67537 | ||
|
|
ec23e37a4a | ||
|
|
00fbe50bbe | ||
|
|
2e48d6cf70 | ||
|
|
ec04517710 | ||
|
|
8cc0369d97 | ||
|
|
f7cdc05937 | ||
|
|
ea0afd0b4d | ||
|
|
62ba799d72 | ||
|
|
b6508c4bd1 | ||
|
|
853d01de68 | ||
|
|
311b65b225 | ||
|
|
b632b52b11 | ||
|
|
9630c2683c | ||
|
|
f53d5a0872 | ||
|
|
5917b5cf5c | ||
|
|
2a6d48bf9e | ||
|
|
0967c87a8f | ||
|
|
0ffee29a11 | ||
|
|
c75e98dc84 | ||
|
|
c7f7f2403d | ||
|
|
4533a197d5 | ||
|
|
1ed853f5d6 | ||
|
|
f83bbce3a3 | ||
|
|
4fccb92e07 | ||
|
|
ec596315bd | ||
|
|
9aee6674bb | ||
|
|
7d64de646a | ||
|
|
1e4691f02a | ||
|
|
4fe4fb0585 | ||
|
|
cf74248949 | ||
|
|
072f996af7 | ||
|
|
1f7c085527 | ||
|
|
a596969049 | ||
|
|
11badea962 | ||
|
|
d04ec15849 | ||
|
|
69d55cabd4 | ||
|
|
9baa944460 | ||
|
|
92767f5513 | ||
|
|
b320b1a3c2 | ||
|
|
35b9e9b4a5 | ||
|
|
21ce39aa9b | ||
|
|
ea80b2c8fc | ||
|
|
f501930728 | ||
|
|
8285953c1b | ||
|
|
6375829448 | ||
|
|
b0f0dc683d | ||
|
|
c2802d35bb | ||
|
|
2693d0eb27 | ||
|
|
6fed11896b | ||
|
|
178721a329 | ||
|
|
263f29a96a | ||
|
|
e99f967372 | ||
|
|
313efa33ae | ||
|
|
eaf6777a66 | ||
|
|
0f6fc48f85 | ||
|
|
1e13a7161a | ||
|
|
3ed0b24831 | ||
|
|
050ba0e0a0 | ||
|
|
418b3e5ee2 | ||
|
|
aa901ac4a2 | ||
|
|
0b80841c38 | ||
|
|
e370834c35 | ||
|
|
9b9cd698a5 | ||
|
|
a4b89e67c6 | ||
|
|
814db9d7c9 | ||
|
|
7f83231385 | ||
|
|
5247bb11f7 | ||
|
|
763544585a | ||
|
|
8a885dc61b | ||
|
|
f74b5a6b9b | ||
|
|
72e3238c3f | ||
|
|
f86c6851fc | ||
|
|
f6ffbe548c | ||
|
|
04c27573d6 | ||
|
|
9a23fb5863 | ||
|
|
90d364fc37 | ||
|
|
79d51581ba | ||
|
|
9507c49b18 | ||
|
|
87b07d6f2f | ||
|
|
64711e0d56 | ||
|
|
bf33b2f862 | ||
|
|
54315252c7 | ||
|
|
733eb127e9 | ||
|
|
2132efa981 | ||
|
|
da79674f84 | ||
|
|
ae36ed3903 | ||
|
|
cc4db8e4a9 | ||
|
|
f9f8fd37de | ||
|
|
193c0a52d9 | ||
|
|
f5139f8bf4 | ||
|
|
c0920bbf6a | ||
|
|
bcf65aa503 | ||
|
|
a866a758cc | ||
|
|
e7838c5f79 | ||
|
|
f21b91f1a7 | ||
|
|
edda32e6b4 | ||
|
|
639b0b8f50 | ||
|
|
18dd0d00a6 | ||
|
|
24fd19259d | ||
|
|
bdd555990b | ||
|
|
c762b7c91b | ||
|
|
45731bd022 | ||
|
|
492ba2a111 | ||
|
|
349465b168 | ||
|
|
98427ea92a | ||
|
|
a90edd5eb4 | ||
|
|
6fdaaf3d20 | ||
|
|
406f8363bc | ||
|
|
8e03a4cb93 | ||
|
|
1403260487 | ||
|
|
6831341ab4 | ||
|
|
0988af453c | ||
|
|
631457ffea | ||
|
|
bec1844954 | ||
|
|
e6d0a8ef66 | ||
|
|
70ab146cbb | ||
|
|
33b2e12886 | ||
|
|
1de29026d5 | ||
|
|
854af7a4bf | ||
|
|
f72c559824 | ||
|
|
321afd5fef | ||
|
|
91df2bea80 | ||
|
|
5de2946999 | ||
|
|
c650b752f1 | ||
|
|
c12f41ec6f | ||
|
|
2c6ec0c999 | ||
|
|
f1e563d8cf | ||
|
|
6de179eb7d | ||
|
|
584ffc6f52 | ||
|
|
2c99c1e06f | ||
|
|
f95a2f6d91 | ||
|
|
b31e358270 | ||
|
|
673835e5d9 | ||
|
|
f5bae208cc | ||
|
|
c25c31b1de | ||
|
|
343441d746 | ||
|
|
78fc4c8947 | ||
|
|
86165ceca5 | ||
|
|
8989353fab | ||
|
|
7e0524109e | ||
|
|
d88e694d06 | ||
|
|
44d50c2bd3 | ||
|
|
58548f5051 | ||
|
|
782eabc226 | ||
|
|
0ff3ae3cc6 | ||
|
|
8088c7dcd5 | ||
|
|
604d10d307 | ||
|
|
8dcc72ce9c | ||
|
|
d06bcd6dd3 | ||
|
|
b3c2ee56f9 | ||
|
|
435e98ceed | ||
|
|
7d21dfc938 | ||
|
|
2e1ba73926 | ||
|
|
e8a62ee3cf | ||
|
|
4e8eea8e78 | ||
|
|
d83baf8925 | ||
|
|
348570fd68 | ||
|
|
cf61562196 | ||
|
|
d02d7a95d1 | ||
|
|
ba07c26761 | ||
|
|
e56295851f | ||
|
|
f7d93dadeb | ||
|
|
5c87762f9e | ||
|
|
ea78514ff3 | ||
|
|
2616feb3df | ||
|
|
f4255b14e8 |
743 changed files with 16595 additions and 16856 deletions
2
.gitattributes
vendored
2
.gitattributes
vendored
|
|
@ -17,3 +17,5 @@
|
|||
*.png binary
|
||||
*.jpg binary
|
||||
*.fon binary
|
||||
*.bin binary
|
||||
*.woff binary
|
||||
|
|
|
|||
59
.github/ISSUE_TEMPLATE/bug_report.md
vendored
59
.github/ISSUE_TEMPLATE/bug_report.md
vendored
|
|
@ -1,59 +0,0 @@
|
|||
---
|
||||
name: Bug report
|
||||
about: Report a bug in Marlin
|
||||
title: "[BUG] (short description)"
|
||||
labels: ''
|
||||
assignees: ''
|
||||
|
||||
---
|
||||
|
||||
<!--
|
||||
|
||||
Please follow the instructions below. Failure to do so may result in your issue being closed.
|
||||
|
||||
### Before Reporting a Bug
|
||||
|
||||
1. Test with the `bugfix-2.0.x` branch to see whether the issue still exists.
|
||||
|
||||
2. Get troubleshooting help from the Marlin community to confirm it's a bug and not just a configuration error. Links at https://github.com/MarlinFirmware/Marlin/issues/new/choose
|
||||
|
||||
### Instructions
|
||||
|
||||
1. Fill out every section of the template below.
|
||||
|
||||
2. Always attach configuration files, regardless of whether you think they are involved.
|
||||
|
||||
3. Read and understand 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/master/.github/code_of_conduct.md
|
||||
|
||||
-->
|
||||
|
||||
### Bug Description
|
||||
|
||||
<!-- Describe the bug in this section. (You can remove this invisible comment.) -->
|
||||
|
||||
### Configuration Files
|
||||
|
||||
**Required:** Include a ZIP file containing `Configuration.h` and `Configuration_adv.h`.
|
||||
|
||||
If you've made any other modifications describe them in detail here.
|
||||
|
||||
### Steps to Reproduce
|
||||
|
||||
<!-- Describe the steps needed to reproduce the issue. (You can remove this invisible comment.) -->
|
||||
|
||||
1. [First Step]
|
||||
2. [Second Step]
|
||||
3. [and so on...]
|
||||
|
||||
**Expected behavior:**
|
||||
|
||||
<!-- Describe what you expected to happen here. (You can remove this invisible comment.) -->
|
||||
|
||||
**Actual behavior:**
|
||||
|
||||
<!-- Describe what actually happens here. (You can remove this invisible comment.) -->
|
||||
|
||||
#### Additional Information
|
||||
|
||||
* Provide pictures or links to videos that clearly demonstrate the issue.
|
||||
* See [Contributing to Marlin](https://github.com/MarlinFirmware/Marlin/blob/2.0.x/.github/contributing.md) for additional guidelines.
|
||||
17
.github/ISSUE_TEMPLATE/config.yml
vendored
17
.github/ISSUE_TEMPLATE/config.yml
vendored
|
|
@ -1,17 +0,0 @@
|
|||
blank_issues_enabled: false
|
||||
contact_links:
|
||||
- name: Marlin Documentation
|
||||
url: http://marlinfw.org/
|
||||
about: Lots of documentation on installing and using Marlin.
|
||||
- name: MarlinFirmware Facebook group
|
||||
url: https://www.facebook.com/groups/1049718498464482
|
||||
about: Please ask and answer questions here.
|
||||
- name: Marlin on Discord
|
||||
url: https://discord.gg/n5NJ59y
|
||||
about: Join the Discord server for support and discussion.
|
||||
- name: Marlin Discussion Forum
|
||||
url: http://forums.reprap.org/list.php?415
|
||||
about: A searchable web forum hosted by RepRap dot org.
|
||||
- name: Marlin Videos on YouTube
|
||||
url: https://www.youtube.com/results?search_query=marlin+firmware
|
||||
about: Tutorials and more from Marlin users all around the world. Great for new users!
|
||||
35
.github/ISSUE_TEMPLATE/feature_request.md
vendored
35
.github/ISSUE_TEMPLATE/feature_request.md
vendored
|
|
@ -1,35 +0,0 @@
|
|||
---
|
||||
name: Feature request
|
||||
about: Request a Feature
|
||||
title: "[FR] (feature request title)"
|
||||
labels: 'T: Feature Request'
|
||||
assignees: ''
|
||||
|
||||
---
|
||||
|
||||
<!--
|
||||
|
||||
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/master/.github/code_of_conduct.md
|
||||
|
||||
Do you want to ask a question? Are you looking for support? Please don't post here. Instead please use one of the support links at https://github.com/MarlinFirmware/Marlin/issues/new/choose
|
||||
|
||||
Before filing an issue be sure to test the "bugfix" branches to see whether the issue has been resolved.
|
||||
|
||||
-->
|
||||
|
||||
### Description
|
||||
|
||||
<!-- Description of the requested feature -->
|
||||
|
||||
### Feature Workflow
|
||||
|
||||
<!-- Please describe the feature's behavior, user interaction, etc. -->
|
||||
|
||||
1. [First Action]
|
||||
2. [Second Action]
|
||||
3. [and so on...]
|
||||
|
||||
#### Additional Information
|
||||
|
||||
* Provide pictures or links that demonstrate a similar feature or concept.
|
||||
* See [How Can I Contribute](#how-can-i-contribute) for additional guidelines.
|
||||
30
.github/issue_template.md
vendored
30
.github/issue_template.md
vendored
|
|
@ -1,11 +1,35 @@
|
|||
# NO SUPPORT REQUESTS PLEASE
|
||||
<!--
|
||||
|
||||
Do you want to ask a question? Are you looking for support? Please don't post here. 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
|
||||
|
||||
Instead use one of the following options:
|
||||
Do you want to ask a question? Are you looking for support? Please don't post here. Instead use one of the following options:
|
||||
|
||||
- The Marlin Firmware forum at https://reprap.org/forum/list.php?415
|
||||
- The MarlinFirmware Facebook Group at https://www.facebook.com/groups/1049718498464482/
|
||||
- The MarlinFirmware Discord Server at https://discord.gg/n5NJ59y.
|
||||
|
||||
Before filing an issue be sure to test the latest "bugfix" branch to see whether the issue is already addressed.
|
||||
|
||||
-->
|
||||
|
||||
### 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.
|
||||
|
|
|
|||
35
.github/workflows/bump-date.yml
vendored
35
.github/workflows/bump-date.yml
vendored
|
|
@ -1,35 +0,0 @@
|
|||
#
|
||||
# bump-date.yml
|
||||
# Bump the distribution date once per day
|
||||
#
|
||||
|
||||
name: Bump Distribution Date
|
||||
|
||||
on:
|
||||
schedule:
|
||||
- cron: '0 0 * * *'
|
||||
|
||||
jobs:
|
||||
bump_date:
|
||||
name: Bump Distribution Date
|
||||
if: github.repository == 'MarlinFirmware/Marlin'
|
||||
|
||||
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
|
||||
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
|
||||
33
.github/workflows/check-pr.yml
vendored
33
.github/workflows/check-pr.yml
vendored
|
|
@ -1,33 +0,0 @@
|
|||
#
|
||||
# check-pr.yml
|
||||
# Close PRs directed at release branches
|
||||
#
|
||||
|
||||
name: PR Bad Target
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
branches:
|
||||
- 1.0.x
|
||||
- 1.1.x
|
||||
- 2.0.x
|
||||
|
||||
jobs:
|
||||
bad_target:
|
||||
name: PR Bad Target
|
||||
if: github.repository == 'MarlinFirmware/Marlin'
|
||||
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: peter-evans/close-pull@v1
|
||||
with:
|
||||
delete-branch: false
|
||||
comment: >
|
||||
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.
|
||||
|
||||
It may help to set your fork's default branch to `bugfix-2.0.x`.
|
||||
|
||||
See [this page](http://marlinfw.org/docs/development/getting_started_pull_requests.html) for full instructions.
|
||||
27
.github/workflows/close-stale.yml
vendored
27
.github/workflows/close-stale.yml
vendored
|
|
@ -1,27 +0,0 @@
|
|||
#
|
||||
# close-stale.yml
|
||||
# Close open issues after a period of inactivity
|
||||
#
|
||||
|
||||
name: Close Stale Issues
|
||||
|
||||
on:
|
||||
schedule:
|
||||
- cron: "22 1 * * *"
|
||||
|
||||
jobs:
|
||||
stale:
|
||||
name: Close Stale Issues
|
||||
if: github.repository == 'MarlinFirmware/Marlin'
|
||||
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/stale@v3
|
||||
with:
|
||||
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
||||
stale-issue-message: 'This issue has had no activity in the last 30 days. Please add a reply if you want to keep this issue active, otherwise it will be automatically closed within 7 days.'
|
||||
days-before-stale: 30
|
||||
days-before-close: 7
|
||||
stale-issue-label: 'stale-closing-soon'
|
||||
exempt-issue-labels: 'T: Feature Request'
|
||||
32
.github/workflows/lock-closed.yml
vendored
32
.github/workflows/lock-closed.yml
vendored
|
|
@ -1,32 +0,0 @@
|
|||
#
|
||||
# lock-closed.yml
|
||||
# Lock closed issues after a period of inactivity
|
||||
#
|
||||
|
||||
name: Lock Closed Issues
|
||||
|
||||
on:
|
||||
schedule:
|
||||
- cron: '0 1/13 * * *'
|
||||
|
||||
jobs:
|
||||
lock:
|
||||
name: Lock Closed Issues
|
||||
if: github.repository == 'MarlinFirmware/Marlin'
|
||||
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: dessant/lock-threads@v2
|
||||
with:
|
||||
github-token: ${{ github.token }}
|
||||
process-only: 'issues'
|
||||
issue-lock-inactive-days: '60'
|
||||
issue-exclude-created-before: ''
|
||||
issue-exclude-labels: 'no-locking'
|
||||
issue-lock-labels: ''
|
||||
issue-lock-comment: >
|
||||
This issue has been automatically locked since there
|
||||
has not been any recent activity after it was closed.
|
||||
Please open a new issue for related bugs.
|
||||
issue-lock-reason: ''
|
||||
5
.github/workflows/test-builds.yml
vendored
5
.github/workflows/test-builds.yml
vendored
|
|
@ -36,9 +36,11 @@ jobs:
|
|||
# Base Environments
|
||||
|
||||
- DUE
|
||||
- DUE_archim
|
||||
- esp32
|
||||
- linux_native
|
||||
- mega2560
|
||||
- at90usb1286_dfu
|
||||
- teensy31
|
||||
- teensy35
|
||||
- teensy41
|
||||
|
|
@ -81,6 +83,8 @@ jobs:
|
|||
- STM32F103RET6_creality
|
||||
- LERDGEX
|
||||
- mks_robin_nano35
|
||||
- mks_robin_nano35_stm32
|
||||
- NUCLEO_F767ZI
|
||||
|
||||
# Put lengthy tests last
|
||||
|
||||
|
|
@ -94,7 +98,6 @@ jobs:
|
|||
|
||||
# Non-working environment tests
|
||||
#- at90usb1286_cdc
|
||||
#- at90usb1286_dfu
|
||||
#- STM32F103CB_malyan
|
||||
#- mks_robin_mini
|
||||
|
||||
|
|
|
|||
22
.github/workflows/unlock-reopened.yml
vendored
22
.github/workflows/unlock-reopened.yml
vendored
|
|
@ -1,22 +0,0 @@
|
|||
#
|
||||
# unlock-reopened.yml
|
||||
# Unlock an issue whenever it is re-opened
|
||||
#
|
||||
|
||||
name: "Unlock reopened issue"
|
||||
|
||||
on:
|
||||
issues:
|
||||
types: [reopened]
|
||||
|
||||
jobs:
|
||||
unlock:
|
||||
name: Unlock Reopened
|
||||
if: github.repository == 'MarlinFirmware/Marlin'
|
||||
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: OSDKDev/unlock-issues@v1.1
|
||||
with:
|
||||
repo-token: "${{ secrets.GITHUB_TOKEN }}"
|
||||
4
.gitignore
vendored
4
.gitignore
vendored
|
|
@ -77,7 +77,6 @@ tags
|
|||
*.out
|
||||
*.app
|
||||
|
||||
|
||||
#
|
||||
# C
|
||||
#
|
||||
|
|
@ -184,3 +183,6 @@ cmake-build-*
|
|||
|
||||
#Python
|
||||
__pycache__
|
||||
|
||||
#IOLogger logs
|
||||
*_log.csv
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@
|
|||
*
|
||||
* Advanced settings can be found in Configuration_adv.h
|
||||
*/
|
||||
#define CONFIGURATION_H_VERSION 020007
|
||||
#define CONFIGURATION_H_VERSION 020008
|
||||
|
||||
//===========================================================================
|
||||
//============================= Getting Started =============================
|
||||
|
|
@ -107,7 +107,8 @@
|
|||
|
||||
/**
|
||||
* Select a secondary serial port on the board to use for communication with the host.
|
||||
* :[-1, 0, 1, 2, 3, 4, 5, 6, 7]
|
||||
* Currently Ethernet (-2) is only supported on Teensy 4.1 boards.
|
||||
* :[-2, -1, 0, 1, 2, 3, 4, 5, 6, 7]
|
||||
*/
|
||||
//#define SERIAL_PORT_2 -1
|
||||
|
||||
|
|
@ -334,15 +335,19 @@
|
|||
//#define PSU_DEFAULT_OFF // Keep power off until enabled directly with M80
|
||||
//#define PSU_POWERUP_DELAY 250 // (ms) Delay for the PSU to warm up to full power
|
||||
|
||||
//#define PSU_POWERUP_GCODE "M355 S1" // G-code to run after power-on (e.g., case light on)
|
||||
//#define PSU_POWEROFF_GCODE "M355 S0" // G-code to run before power-off (e.g., case light off)
|
||||
|
||||
//#define AUTO_POWER_CONTROL // Enable automatic control of the PS_ON pin
|
||||
#if ENABLED(AUTO_POWER_CONTROL)
|
||||
#define AUTO_POWER_FANS // Turn on PSU if fans need power
|
||||
#define AUTO_POWER_E_FANS
|
||||
#define AUTO_POWER_CONTROLLERFAN
|
||||
#define AUTO_POWER_CHAMBER_FAN
|
||||
//#define AUTO_POWER_E_TEMP 50 // (°C) Turn on PSU over this temperature
|
||||
//#define AUTO_POWER_CHAMBER_TEMP 30 // (°C) Turn on PSU over this temperature
|
||||
#define POWER_TIMEOUT 30
|
||||
//#define AUTO_POWER_E_TEMP 50 // (°C) Turn on PSU if any extruder is over this temperature
|
||||
//#define AUTO_POWER_CHAMBER_TEMP 30 // (°C) Turn on PSU if the chamber is over this temperature
|
||||
#define POWER_TIMEOUT 30 // (s) Turn off power if the machine is idle for this duration
|
||||
//#define POWER_OFF_DELAY 60 // (s) Delay of poweroff after M81 command. Useful to let fans run for extra time.
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
|
@ -431,11 +436,11 @@
|
|||
#define DUMMY_THERMISTOR_998_VALUE 25
|
||||
#define DUMMY_THERMISTOR_999_VALUE 100
|
||||
|
||||
// Resistor values when using a MAX31865 (sensor -5)
|
||||
// Sensor value is typically 100 (PT100) or 1000 (PT1000)
|
||||
// Calibration value is typically 430 ohm for AdaFruit PT100 modules and 4300 ohm for AdaFruit PT1000 modules.
|
||||
//#define MAX31865_SENSOR_OHMS 100
|
||||
//#define MAX31865_CALIBRATION_OHMS 430
|
||||
// Resistor values when using MAX31865 sensors (-5) on TEMP_SENSOR_0 / 1
|
||||
//#define MAX31865_SENSOR_OHMS_0 100 // (Ω) Typically 100 or 1000 (PT100 or PT1000)
|
||||
//#define MAX31865_CALIBRATION_OHMS_0 430 // (Ω) Typically 430 for AdaFruit PT100; 4300 for AdaFruit PT1000
|
||||
//#define MAX31865_SENSOR_OHMS_1 100
|
||||
//#define MAX31865_CALIBRATION_OHMS_1 430
|
||||
|
||||
// Use temp sensor 1 as a redundant sensor with sensor 0. If the readings
|
||||
// from the two sensors differ too much the print will be aborted.
|
||||
|
|
@ -670,6 +675,8 @@
|
|||
*
|
||||
* A4988 is assumed for unspecified drivers.
|
||||
*
|
||||
* Use TMC2208/TMC2208_STANDALONE for TMC2225 drivers and TMC2209/TMC2209_STANDALONE for TMC2226 drivers.
|
||||
*
|
||||
* Options: A4988, A5984, DRV8825, LV8729, L6470, L6474, POWERSTEP01,
|
||||
* TB6560, TB6600, TMC2100,
|
||||
* TMC2130, TMC2130_STANDALONE, TMC2160, TMC2160_STANDALONE,
|
||||
|
|
@ -678,15 +685,15 @@
|
|||
* 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
|
||||
//#define Z_DRIVER_TYPE A4988
|
||||
#define X_DRIVER_TYPE A4988
|
||||
#define Y_DRIVER_TYPE A4988
|
||||
#define Z_DRIVER_TYPE A4988
|
||||
//#define X2_DRIVER_TYPE A4988
|
||||
//#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 E0_DRIVER_TYPE A4988
|
||||
//#define E1_DRIVER_TYPE A4988
|
||||
//#define E2_DRIVER_TYPE A4988
|
||||
//#define E3_DRIVER_TYPE A4988
|
||||
|
|
@ -741,7 +748,7 @@
|
|||
* Override with M92
|
||||
* X, Y, Z, E0 [, E1[, E2...]]
|
||||
*/
|
||||
#define DEFAULT_AXIS_STEPS_PER_UNIT { 80, 80, 4000, 500 }
|
||||
#define DEFAULT_AXIS_STEPS_PER_UNIT { 80, 80, 400, 500 }
|
||||
|
||||
/**
|
||||
* Default Max Feed Rate (mm/s)
|
||||
|
|
@ -1166,6 +1173,12 @@
|
|||
* Filament Runout Sensors
|
||||
* Mechanical or opto endstops are used to check for the presence of filament.
|
||||
*
|
||||
* IMPORTANT: Runout will only trigger if Marlin is aware that a print job is running.
|
||||
* Marlin knows a print job is running when:
|
||||
* 1. Running a print job from media started with M24.
|
||||
* 2. The Print Job Timer has been started with M75.
|
||||
* 3. The heaters were turned on and PRINTJOB_TIMER_AUTOSTART is enabled.
|
||||
*
|
||||
* RAMPS-based boards use SERVO3_PIN for the first runout sensor.
|
||||
* For other boards you may need to define FIL_RUNOUT_PIN, FIL_RUNOUT2_PIN, etc.
|
||||
*/
|
||||
|
|
@ -1173,9 +1186,27 @@
|
|||
#if ENABLED(FILAMENT_RUNOUT_SENSOR)
|
||||
#define FIL_RUNOUT_ENABLED_DEFAULT true // Enable the sensor on startup. Override with M412 followed by M500.
|
||||
#define NUM_RUNOUT_SENSORS 1 // Number of sensors, up to one per extruder. Define a FIL_RUNOUT#_PIN for each.
|
||||
|
||||
#define FIL_RUNOUT_STATE LOW // Pin state indicating that filament is NOT present.
|
||||
#define FIL_RUNOUT_PULLUP // Use internal pullup for filament runout pins.
|
||||
//#define FIL_RUNOUT_PULLDOWN // Use internal pulldown for filament runout pins.
|
||||
#define FIL_RUNOUT_PULL // Use internal pullup / pulldown for filament runout pins.
|
||||
|
||||
// Override individually if the runout sensors vary
|
||||
//#define FIL_RUNOUT1_STATE LOW
|
||||
//#define FIL_RUNOUT1_PULL
|
||||
//#define FIL_RUNOUT2_STATE LOW
|
||||
//#define FIL_RUNOUT2_PULL
|
||||
//#define FIL_RUNOUT3_STATE LOW
|
||||
//#define FIL_RUNOUT3_PULL
|
||||
//#define FIL_RUNOUT4_STATE LOW
|
||||
//#define FIL_RUNOUT4_PULL
|
||||
//#define FIL_RUNOUT5_STATE LOW
|
||||
//#define FIL_RUNOUT5_PULL
|
||||
//#define FIL_RUNOUT6_STATE LOW
|
||||
//#define FIL_RUNOUT6_PULL
|
||||
//#define FIL_RUNOUT7_STATE LOW
|
||||
//#define FIL_RUNOUT7_PULL
|
||||
//#define FIL_RUNOUT8_STATE LOW
|
||||
//#define FIL_RUNOUT8_PULL
|
||||
|
||||
// Set one or more commands to execute on filament runout.
|
||||
// (After 'M412 H' Marlin will ask the host to handle the process.)
|
||||
|
|
@ -2083,9 +2114,10 @@
|
|||
//
|
||||
// Anet 128x64 full graphics lcd with rotary encoder as used on Anet A6
|
||||
// A clone of the RepRapDiscount full graphics display but with
|
||||
// different pins/wiring (see pins_ANET_10.h).
|
||||
// different pins/wiring (see pins_ANET_10.h). Enable one of these.
|
||||
//
|
||||
//#define ANET_FULL_GRAPHICS_LCD
|
||||
//#define ANET_FULL_GRAPHICS_LCD_ALT_WIRING
|
||||
|
||||
//
|
||||
// AZSMZ 12864 LCD with SD
|
||||
|
|
@ -2192,7 +2224,7 @@
|
|||
|
||||
//
|
||||
// Third-party or vendor-customized controller interfaces.
|
||||
// Sources should be installed in 'src/lcd/extensible_ui'.
|
||||
// Sources should be installed in 'src/lcd/extui'.
|
||||
//
|
||||
//#define EXTENSIBLE_UI
|
||||
|
||||
|
|
@ -2205,22 +2237,83 @@
|
|||
//=============================================================================
|
||||
|
||||
/**
|
||||
* TFT Type - Select your Display type
|
||||
*
|
||||
* Available options are:
|
||||
* MKS_TS35_V2_0,
|
||||
* MKS_ROBIN_TFT24, MKS_ROBIN_TFT28, MKS_ROBIN_TFT32, MKS_ROBIN_TFT35,
|
||||
* MKS_ROBIN_TFT43, MKS_ROBIN_TFT_V1_1R
|
||||
* TFT_TRONXY_X5SA, ANYCUBIC_TFT35, LONGER_LK_TFT28
|
||||
* TFT_GENERIC
|
||||
*
|
||||
* For TFT_GENERIC, you need to configure these 3 options:
|
||||
* Driver: TFT_DRIVER
|
||||
* Current Drivers are: AUTO, ST7735, ST7789, ST7796, R61505, ILI9328, ILI9341, ILI9488
|
||||
* Resolution: TFT_WIDTH and TFT_HEIGHT
|
||||
* Interface: TFT_INTERFACE_FSMC or TFT_INTERFACE_SPI
|
||||
* Specific TFT Model Presets. Enable one of the following options
|
||||
* or enable TFT_GENERIC and set sub-options.
|
||||
*/
|
||||
|
||||
//
|
||||
// 480x320, 3.5", SPI Display From MKS
|
||||
// Normally used in MKS Robin Nano V2
|
||||
//
|
||||
//#define MKS_TS35_V2_0
|
||||
|
||||
//
|
||||
// 320x240, 2.4", FSMC Display From MKS
|
||||
// Normally used in MKS Robin Nano V1.2
|
||||
//
|
||||
//#define MKS_ROBIN_TFT24
|
||||
|
||||
//
|
||||
// 320x240, 2.8", FSMC Display From MKS
|
||||
// Normally used in MKS Robin Nano V1.2
|
||||
//
|
||||
//#define MKS_ROBIN_TFT28
|
||||
|
||||
//
|
||||
// 320x240, 3.2", FSMC Display From MKS
|
||||
// Normally used in MKS Robin Nano V1.2
|
||||
//
|
||||
//#define MKS_ROBIN_TFT32
|
||||
|
||||
//
|
||||
// 480x320, 3.5", FSMC Display From MKS
|
||||
// Normally used in MKS Robin Nano V1.2
|
||||
//
|
||||
//#define MKS_ROBIN_TFT35
|
||||
|
||||
//
|
||||
// 480x272, 4.3", FSMC Display From MKS
|
||||
//
|
||||
//#define MKS_ROBIN_TFT43
|
||||
|
||||
//
|
||||
// 320x240, 3.2", FSMC Display From MKS
|
||||
// Normally used in MKS Robin
|
||||
//
|
||||
//#define MKS_ROBIN_TFT_V1_1R
|
||||
|
||||
//
|
||||
// 480x320, 3.5", FSMC Stock Display from TronxXY
|
||||
//
|
||||
//#define TFT_TRONXY_X5SA
|
||||
|
||||
//
|
||||
// 480x320, 3.5", FSMC Stock Display from AnyCubic
|
||||
//
|
||||
//#define ANYCUBIC_TFT35
|
||||
|
||||
//
|
||||
// 320x240, 2.8", FSMC Stock Display from Longer/Alfawise
|
||||
//
|
||||
//#define LONGER_LK_TFT28
|
||||
|
||||
//
|
||||
// Generic TFT with detailed options
|
||||
//
|
||||
//#define TFT_GENERIC
|
||||
#if ENABLED(TFT_GENERIC)
|
||||
// :[ 'AUTO', 'ST7735', 'ST7789', 'ST7796', 'R61505', 'ILI9328', 'ILI9341', 'ILI9488' ]
|
||||
#define TFT_DRIVER AUTO
|
||||
|
||||
// Interface. Enable one of the following options:
|
||||
//#define TFT_INTERFACE_FSMC
|
||||
//#define TFT_INTERFACE_SPI
|
||||
|
||||
// TFT Resolution. Enable one of the following options:
|
||||
//#define TFT_RES_320x240
|
||||
//#define TFT_RES_480x272
|
||||
//#define TFT_RES_480x320
|
||||
#endif
|
||||
|
||||
/**
|
||||
* TFT UI - User Interface Selection. Enable one of the following options:
|
||||
|
|
@ -2269,6 +2362,10 @@
|
|||
//#define XPT2046_Y_CALIBRATION -8981
|
||||
//#define XPT2046_X_OFFSET -43
|
||||
//#define XPT2046_Y_OFFSET 257
|
||||
|
||||
#if ENABLED(TFT_COLOR_UI)
|
||||
//#define SINGLE_TOUCH_NAVIGATION
|
||||
#endif
|
||||
#endif
|
||||
|
||||
//
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@
|
|||
*
|
||||
* Basic settings can be found in Configuration.h
|
||||
*/
|
||||
#define CONFIGURATION_ADV_H_VERSION 020007
|
||||
#define CONFIGURATION_ADV_H_VERSION 020008
|
||||
|
||||
//===========================================================================
|
||||
//============================= Thermal Settings ============================
|
||||
|
|
@ -660,6 +660,7 @@
|
|||
|
||||
//#define QUICK_HOME // If G28 contains XY do a diagonal move first
|
||||
//#define HOME_Y_BEFORE_X // If G28 contains XY home Y before X
|
||||
//#define HOME_Z_FIRST // Home Z first. Requires a Z-MIN endstop (not a probe).
|
||||
//#define CODEPENDENT_XY_HOMING // If X/Y can't home without homing Y/X first
|
||||
|
||||
// @section bltouch
|
||||
|
|
@ -808,7 +809,10 @@
|
|||
|
||||
#define RESTORE_LEVELING_AFTER_G35 // Enable to restore leveling setup after operation
|
||||
//#define REPORT_TRAMMING_MM // Report Z deviation (mm) for each point relative to the first
|
||||
//#define ASSISTED_TRAMMING_MENU_ITEM // Add a menu item for Assisted Tramming
|
||||
|
||||
//#define ASSISTED_TRAMMING_MENU_ITEM // Add a menu item to run G35 Assisted Tramming (MarlinUI)
|
||||
//#define ASSISTED_TRAMMING_WIZARD // Make the menu item open a Tramming Wizard sub-menu
|
||||
//#define ASSISTED_TRAMMING_WAIT_POSITION { X_CENTER, Y_CENTER, 30 } // Move the nozzle out of the way for adjustment
|
||||
|
||||
/**
|
||||
* Screw thread:
|
||||
|
|
@ -1048,10 +1052,10 @@
|
|||
|
||||
// @section lcd
|
||||
|
||||
#if EITHER(ULTIPANEL, EXTENSIBLE_UI)
|
||||
#if EITHER(IS_ULTIPANEL, EXTENSIBLE_UI)
|
||||
#define MANUAL_FEEDRATE { 50*60, 50*60, 4*60, 2*60 } // (mm/min) Feedrates for manual moves along X, Y, Z, E from panel
|
||||
#define SHORT_MANUAL_Z_MOVE 0.025 // (mm) Smallest manual Z move (< 0.1mm)
|
||||
#if ENABLED(ULTIPANEL)
|
||||
#if IS_ULTIPANEL
|
||||
#define MANUAL_E_MOVES_RELATIVE // Display extruder move distance rather than "position"
|
||||
#define ULTIPANEL_FEEDMULTIPLY // Encoder sets the feedrate multiplier on the Status Screen
|
||||
#endif
|
||||
|
|
@ -1090,6 +1094,9 @@
|
|||
// BACK menu items keep the highlight at the top
|
||||
//#define TURBO_BACK_MENU_ITEM
|
||||
|
||||
// Add a mute option to the LCD menu
|
||||
//#define SOUND_MENU_ITEM
|
||||
|
||||
/**
|
||||
* LED Control Menu
|
||||
* Add LED Control to the LCD menu
|
||||
|
|
@ -1166,6 +1173,7 @@
|
|||
// Enable this option and set to HIGH if your SD cards are incorrectly detected.
|
||||
//#define SD_DETECT_STATE HIGH
|
||||
|
||||
//#define SD_IGNORE_AT_STARTUP // Don't mount the SD card when starting up
|
||||
//#define SDCARD_READONLY // Read-only SD card (to save over 2K of flash)
|
||||
|
||||
#define SD_PROCEDURE_DEPTH 1 // Increase if you need more nested M32 calls
|
||||
|
|
@ -1250,6 +1258,10 @@
|
|||
// Note: Only affects SCROLL_LONG_FILENAMES with SDSORT_CACHE_NAMES but not SDSORT_DYNAMIC_RAM.
|
||||
#endif
|
||||
|
||||
// Allow international symbols in long filenames. To display correctly, the
|
||||
// LCD's font must contain the characters. Check your selected LCD language.
|
||||
#define UTF_FILENAME_SUPPORT
|
||||
|
||||
// This allows hosts to request long names for files and folders with M33
|
||||
//#define LONG_FILENAME_HOST_SUPPORT
|
||||
|
||||
|
|
@ -2261,14 +2273,20 @@
|
|||
#if HAS_TRINAMIC_CONFIG
|
||||
|
||||
#define HOLD_MULTIPLIER 0.5 // Scales down the holding current from run current
|
||||
#define INTERPOLATE true // Interpolate X/Y/Z_MICROSTEPS to 256
|
||||
|
||||
/**
|
||||
* Interpolate microsteps to 256
|
||||
* Override for each driver with <driver>_INTERPOLATE settings below
|
||||
*/
|
||||
#define INTERPOLATE true
|
||||
|
||||
#if AXIS_IS_TMC(X)
|
||||
#define X_CURRENT 800 // (mA) RMS current. Multiply by 1.414 for peak current.
|
||||
#define X_CURRENT_HOME X_CURRENT // (mA) RMS current for sensorless homing
|
||||
#define X_MICROSTEPS 16 // 0..256
|
||||
#define X_MICROSTEPS 16 // 0..256
|
||||
#define X_RSENSE 0.11
|
||||
#define X_CHAIN_POS -1 // <=0 : Not chained. 1 : MCU MOSI connected. 2 : Next in chain, ...
|
||||
#define X_CHAIN_POS -1 // -1..0: Not chained. 1: MCU MOSI connected. 2: Next in chain, ...
|
||||
//#define X_INTERPOLATE true // Enable to override 'INTERPOLATE' for the X axis
|
||||
#endif
|
||||
|
||||
#if AXIS_IS_TMC(X2)
|
||||
|
|
@ -2277,6 +2295,7 @@
|
|||
#define X2_MICROSTEPS 16
|
||||
#define X2_RSENSE 0.11
|
||||
#define X2_CHAIN_POS -1
|
||||
//#define X2_INTERPOLATE true
|
||||
#endif
|
||||
|
||||
#if AXIS_IS_TMC(Y)
|
||||
|
|
@ -2285,6 +2304,7 @@
|
|||
#define Y_MICROSTEPS 16
|
||||
#define Y_RSENSE 0.11
|
||||
#define Y_CHAIN_POS -1
|
||||
//#define Y_INTERPOLATE true
|
||||
#endif
|
||||
|
||||
#if AXIS_IS_TMC(Y2)
|
||||
|
|
@ -2293,6 +2313,7 @@
|
|||
#define Y2_MICROSTEPS 16
|
||||
#define Y2_RSENSE 0.11
|
||||
#define Y2_CHAIN_POS -1
|
||||
//#define Y2_INTERPOLATE true
|
||||
#endif
|
||||
|
||||
#if AXIS_IS_TMC(Z)
|
||||
|
|
@ -2301,6 +2322,7 @@
|
|||
#define Z_MICROSTEPS 16
|
||||
#define Z_RSENSE 0.11
|
||||
#define Z_CHAIN_POS -1
|
||||
//#define Z_INTERPOLATE true
|
||||
#endif
|
||||
|
||||
#if AXIS_IS_TMC(Z2)
|
||||
|
|
@ -2309,6 +2331,7 @@
|
|||
#define Z2_MICROSTEPS 16
|
||||
#define Z2_RSENSE 0.11
|
||||
#define Z2_CHAIN_POS -1
|
||||
//#define Z2_INTERPOLATE true
|
||||
#endif
|
||||
|
||||
#if AXIS_IS_TMC(Z3)
|
||||
|
|
@ -2317,6 +2340,7 @@
|
|||
#define Z3_MICROSTEPS 16
|
||||
#define Z3_RSENSE 0.11
|
||||
#define Z3_CHAIN_POS -1
|
||||
//#define Z3_INTERPOLATE true
|
||||
#endif
|
||||
|
||||
#if AXIS_IS_TMC(Z4)
|
||||
|
|
@ -2325,6 +2349,7 @@
|
|||
#define Z4_MICROSTEPS 16
|
||||
#define Z4_RSENSE 0.11
|
||||
#define Z4_CHAIN_POS -1
|
||||
//#define Z4_INTERPOLATE true
|
||||
#endif
|
||||
|
||||
#if AXIS_IS_TMC(E0)
|
||||
|
|
@ -2332,6 +2357,7 @@
|
|||
#define E0_MICROSTEPS 16
|
||||
#define E0_RSENSE 0.11
|
||||
#define E0_CHAIN_POS -1
|
||||
//#define E0_INTERPOLATE true
|
||||
#endif
|
||||
|
||||
#if AXIS_IS_TMC(E1)
|
||||
|
|
@ -2339,6 +2365,7 @@
|
|||
#define E1_MICROSTEPS 16
|
||||
#define E1_RSENSE 0.11
|
||||
#define E1_CHAIN_POS -1
|
||||
//#define E1_INTERPOLATE true
|
||||
#endif
|
||||
|
||||
#if AXIS_IS_TMC(E2)
|
||||
|
|
@ -2346,6 +2373,7 @@
|
|||
#define E2_MICROSTEPS 16
|
||||
#define E2_RSENSE 0.11
|
||||
#define E2_CHAIN_POS -1
|
||||
//#define E2_INTERPOLATE true
|
||||
#endif
|
||||
|
||||
#if AXIS_IS_TMC(E3)
|
||||
|
|
@ -2353,6 +2381,7 @@
|
|||
#define E3_MICROSTEPS 16
|
||||
#define E3_RSENSE 0.11
|
||||
#define E3_CHAIN_POS -1
|
||||
//#define E3_INTERPOLATE true
|
||||
#endif
|
||||
|
||||
#if AXIS_IS_TMC(E4)
|
||||
|
|
@ -2360,6 +2389,7 @@
|
|||
#define E4_MICROSTEPS 16
|
||||
#define E4_RSENSE 0.11
|
||||
#define E4_CHAIN_POS -1
|
||||
//#define E4_INTERPOLATE true
|
||||
#endif
|
||||
|
||||
#if AXIS_IS_TMC(E5)
|
||||
|
|
@ -2367,6 +2397,7 @@
|
|||
#define E5_MICROSTEPS 16
|
||||
#define E5_RSENSE 0.11
|
||||
#define E5_CHAIN_POS -1
|
||||
//#define E5_INTERPOLATE true
|
||||
#endif
|
||||
|
||||
#if AXIS_IS_TMC(E6)
|
||||
|
|
@ -2374,6 +2405,7 @@
|
|||
#define E6_MICROSTEPS 16
|
||||
#define E6_RSENSE 0.11
|
||||
#define E6_CHAIN_POS -1
|
||||
//#define E6_INTERPOLATE true
|
||||
#endif
|
||||
|
||||
#if AXIS_IS_TMC(E7)
|
||||
|
|
@ -2381,6 +2413,7 @@
|
|||
#define E7_MICROSTEPS 16
|
||||
#define E7_RSENSE 0.11
|
||||
#define E7_CHAIN_POS -1
|
||||
//#define E7_INTERPOLATE true
|
||||
#endif
|
||||
|
||||
/**
|
||||
|
|
@ -2471,10 +2504,26 @@
|
|||
* CHOPPER_PRUSAMK3_24V // Imported parameters from the official Průša firmware for MK3 (24V)
|
||||
* CHOPPER_MARLIN_119 // Old defaults from Marlin v1.1.9
|
||||
*
|
||||
* Define you own with
|
||||
* Define your own with:
|
||||
* { <off_time[1..15]>, <hysteresis_end[-3..12]>, hysteresis_start[1..8] }
|
||||
*/
|
||||
#define CHOPPER_TIMING CHOPPER_DEFAULT_12V
|
||||
#define CHOPPER_TIMING CHOPPER_DEFAULT_12V // All axes (override below)
|
||||
//#define CHOPPER_TIMING_X CHOPPER_DEFAULT_12V // For X Axes (override below)
|
||||
//#define CHOPPER_TIMING_X2 CHOPPER_DEFAULT_12V
|
||||
//#define CHOPPER_TIMING_Y CHOPPER_DEFAULT_12V // For Y Axes (override below)
|
||||
//#define CHOPPER_TIMING_Y2 CHOPPER_DEFAULT_12V
|
||||
//#define CHOPPER_TIMING_Z CHOPPER_DEFAULT_12V // For Z Axes (override below)
|
||||
//#define CHOPPER_TIMING_Z2 CHOPPER_DEFAULT_12V
|
||||
//#define CHOPPER_TIMING_Z3 CHOPPER_DEFAULT_12V
|
||||
//#define CHOPPER_TIMING_Z4 CHOPPER_DEFAULT_12V
|
||||
//#define CHOPPER_TIMING_E CHOPPER_DEFAULT_12V // For Extruders (override below)
|
||||
//#define CHOPPER_TIMING_E1 CHOPPER_DEFAULT_12V
|
||||
//#define CHOPPER_TIMING_E2 CHOPPER_DEFAULT_12V
|
||||
//#define CHOPPER_TIMING_E3 CHOPPER_DEFAULT_12V
|
||||
//#define CHOPPER_TIMING_E4 CHOPPER_DEFAULT_12V
|
||||
//#define CHOPPER_TIMING_E5 CHOPPER_DEFAULT_12V
|
||||
//#define CHOPPER_TIMING_E6 CHOPPER_DEFAULT_12V
|
||||
//#define CHOPPER_TIMING_E7 CHOPPER_DEFAULT_12V
|
||||
|
||||
/**
|
||||
* Monitor Trinamic drivers
|
||||
|
|
@ -2903,11 +2952,18 @@
|
|||
|
||||
#define SPINDLE_LASER_FREQUENCY 2500 // (Hz) Spindle/laser frequency (only on supported HALs: AVR and LPC)
|
||||
|
||||
//#define SPINDLE_SERVO // A servo converting an angle to spindle power
|
||||
#ifdef SPINDLE_SERVO
|
||||
#define SPINDLE_SERVO_NR 0 // Index of servo used for spindle control
|
||||
#define SPINDLE_SERVO_MIN 10 // Minimum angle for servo spindle
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Speed / Power can be set ('M3 S') and displayed in terms of:
|
||||
* - PWM255 (S0 - S255)
|
||||
* - PERCENT (S0 - S100)
|
||||
* - RPM (S0 - S50000) Best for use with a spindle
|
||||
* - SERVO (S0 - S180)
|
||||
*/
|
||||
#define CUTTER_POWER_UNIT PWM255
|
||||
|
||||
|
|
@ -2958,7 +3014,7 @@
|
|||
* This allows the laser to keep in perfect sync with the planner and removes
|
||||
* the powerup/down delay since lasers require negligible time.
|
||||
*/
|
||||
#define LASER_POWER_INLINE
|
||||
//#define LASER_POWER_INLINE
|
||||
|
||||
#if ENABLED(LASER_POWER_INLINE)
|
||||
/**
|
||||
|
|
@ -3440,6 +3496,13 @@
|
|||
// Default behavior is limited to Z axis only.
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Ethernet. Use M552 to enable and set the IP address.
|
||||
*/
|
||||
#if HAS_ETHERNET
|
||||
#define MAC_ADDRESS { 0xDE, 0xAD, 0xBE, 0xEF, 0xF0, 0x0D } // A MAC address unique to your network
|
||||
#endif
|
||||
|
||||
/**
|
||||
* WiFi Support (Espressif ESP32 WiFi)
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@
|
|||
/**
|
||||
* Marlin release version identifier
|
||||
*/
|
||||
//#define SHORT_BUILD_VERSION "2.0.7.2"
|
||||
//#define SHORT_BUILD_VERSION "bugfix-2.0.x"
|
||||
|
||||
/**
|
||||
* 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 "2020-07-09"
|
||||
//#define STRING_DISTRIBUTION_DATE "2019-07-10"
|
||||
|
||||
/**
|
||||
* Defines a generic printer name to be output to the LCD after booting Marlin.
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@
|
|||
#include "watchdog.h"
|
||||
#include "math.h"
|
||||
|
||||
#ifdef IS_AT90USB
|
||||
#ifdef USBCON
|
||||
#include <HardwareSerial.h>
|
||||
#else
|
||||
#define HardwareSerial_h // Hack to prevent HardwareSerial.h header inclusion
|
||||
|
|
@ -81,7 +81,7 @@ typedef int8_t pin_t;
|
|||
//extern uint8_t MCUSR;
|
||||
|
||||
// Serial ports
|
||||
#ifdef IS_AT90USB
|
||||
#ifdef USBCON
|
||||
#define MYSERIAL0 TERN(BLUETOOTH, bluetoothSerial, Serial)
|
||||
#else
|
||||
#if !WITHIN(SERIAL_PORT, -1, 3)
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@
|
|||
|
||||
#include "../../inc/MarlinConfig.h"
|
||||
|
||||
#if !IS_AT90USB && (defined(UBRRH) || defined(UBRR0H) || defined(UBRR1H) || defined(UBRR2H) || defined(UBRR3H))
|
||||
#if !defined(USBCON) && (defined(UBRRH) || defined(UBRR0H) || defined(UBRR1H) || defined(UBRR2H) || defined(UBRR3H))
|
||||
|
||||
#include "MarlinSerial.h"
|
||||
#include "../../MarlinCore.h"
|
||||
|
|
@ -792,10 +792,10 @@ MarlinSerial<MarlinSerialCfg<SERIAL_PORT>> customizedSerial1;
|
|||
|
||||
#endif
|
||||
|
||||
#endif // !IS_AT90USB && (UBRRH || UBRR0H || UBRR1H || UBRR2H || UBRR3H)
|
||||
#endif // !USBCON && (UBRRH || UBRR0H || UBRR1H || UBRR2H || UBRR3H)
|
||||
|
||||
// For AT90USB targets use the UART for BT interfacing
|
||||
#if BOTH(IS_AT90USB, BLUETOOTH)
|
||||
#if defined(USBCON) && ENABLED(BLUETOOTH)
|
||||
HardwareSerial bluetoothSerial;
|
||||
#endif
|
||||
|
||||
|
|
|
|||
|
|
@ -327,6 +327,6 @@
|
|||
#endif
|
||||
|
||||
// Use the UART for Bluetooth in AT90USB configurations
|
||||
#if BOTH(IS_AT90USB, BLUETOOTH)
|
||||
#if defined(USBCON) && ENABLED(BLUETOOTH)
|
||||
extern HardwareSerial bluetoothSerial;
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -59,7 +59,7 @@ bool PersistentStore::write_data(int &pos, const uint8_t *value, size_t size, ui
|
|||
return false;
|
||||
}
|
||||
|
||||
bool PersistentStore::read_data(int &pos, uint8_t* value, size_t size, uint16_t *crc, const bool writing/*=true*/) {
|
||||
bool PersistentStore::read_data(int &pos, uint8_t *value, size_t size, uint16_t *crc, const bool writing/*=true*/) {
|
||||
do {
|
||||
uint8_t c = eeprom_read_byte((uint8_t*)pos);
|
||||
if (writing) *value = c;
|
||||
|
|
|
|||
|
|
@ -145,7 +145,7 @@ uint8_t u8g_com_HAL_DUE_ST7920_sw_spi_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_va
|
|||
}
|
||||
|
||||
#if ENABLED(LIGHTWEIGHT_UI)
|
||||
#include "../../../lcd/ultralcd.h"
|
||||
#include "../../../lcd/marlinui.h"
|
||||
#include "../../shared/HAL_ST7920.h"
|
||||
|
||||
#define ST7920_CS_PIN LCD_PINS_RS
|
||||
|
|
|
|||
|
|
@ -996,7 +996,7 @@ bool PersistentStore::write_data(int &pos, const uint8_t *value, size_t size, ui
|
|||
return false;
|
||||
}
|
||||
|
||||
bool PersistentStore::read_data(int &pos, uint8_t* value, size_t size, uint16_t *crc, const bool writing/*=true*/) {
|
||||
bool PersistentStore::read_data(int &pos, uint8_t *value, size_t size, uint16_t *crc, const bool writing/*=true*/) {
|
||||
do {
|
||||
uint8_t c = ee_Read(uint32_t(pos));
|
||||
if (writing) *value = c;
|
||||
|
|
|
|||
|
|
@ -62,7 +62,7 @@ bool PersistentStore::write_data(int &pos, const uint8_t *value, size_t size, ui
|
|||
return false;
|
||||
}
|
||||
|
||||
bool PersistentStore::read_data(int &pos, uint8_t* value, size_t size, uint16_t *crc, const bool writing/*=true*/) {
|
||||
bool PersistentStore::read_data(int &pos, uint8_t *value, size_t size, uint16_t *crc, const bool writing/*=true*/) {
|
||||
do {
|
||||
uint8_t c = eeprom_read_byte((uint8_t*)pos);
|
||||
if (writing) *value = c;
|
||||
|
|
|
|||
|
|
@ -163,6 +163,9 @@
|
|||
#define SET_INPUT(IO) _SET_INPUT(IO)
|
||||
// Set pin as input with pullup (wrapper)
|
||||
#define SET_INPUT_PULLUP(IO) do{ _SET_INPUT(IO); _PULLUP(IO, HIGH); }while(0)
|
||||
// Set pin as input with pulldown (substitution)
|
||||
#define SET_INPUT_PULLDOWN SET_INPUT
|
||||
|
||||
// Set pin as output (wrapper) - reads the pin and sets the output to that value
|
||||
#define SET_OUTPUT(IO) _SET_OUTPUT(IO)
|
||||
// Set pin as PWM
|
||||
|
|
@ -477,7 +480,7 @@
|
|||
#define DIO91_PIN 15
|
||||
#define DIO91_WPORT PIOB
|
||||
|
||||
#if ARDUINO_SAM_ARCHIM
|
||||
#ifdef ARDUINO_SAM_ARCHIM
|
||||
|
||||
#define DIO92_PIN 11
|
||||
#define DIO92_WPORT PIOC
|
||||
|
|
|
|||
|
|
@ -84,7 +84,7 @@ Ctrl_status sd_mmc_spi_usb_read_10(uint32_t addr, uint16_t nb_sector) {
|
|||
card.getSd2Card().readData(sector_buf);
|
||||
|
||||
// RAM -> USB
|
||||
if (!udi_msc_trans_block(true, sector_buf, SD_MMC_BLOCK_SIZE, NULL)) {
|
||||
if (!udi_msc_trans_block(true, sector_buf, SD_MMC_BLOCK_SIZE, nullptr)) {
|
||||
card.getSd2Card().readStop();
|
||||
return CTRL_FAIL;
|
||||
}
|
||||
|
|
@ -120,7 +120,7 @@ Ctrl_status sd_mmc_spi_usb_write_10(uint32_t addr, uint16_t nb_sector) {
|
|||
while (nb_sector--) {
|
||||
|
||||
// USB -> RAM
|
||||
if (!udi_msc_trans_block(false, sector_buf, SD_MMC_BLOCK_SIZE, NULL)) {
|
||||
if (!udi_msc_trans_block(false, sector_buf, SD_MMC_BLOCK_SIZE, nullptr)) {
|
||||
card.getSd2Card().writeStop();
|
||||
return CTRL_FAIL;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@ void watchdogSetup() {
|
|||
#if ENABLED(USE_WATCHDOG)
|
||||
|
||||
// 4 seconds timeout
|
||||
uint32_t timeout = 4000;
|
||||
uint32_t timeout = TERN(WATCHDOG_DURATION_8S, 8000, 4000);
|
||||
|
||||
// Calculate timeout value in WDT counter ticks: This assumes
|
||||
// the slow clock is running at 32.768 kHz watchdog
|
||||
|
|
|
|||
|
|
@ -86,7 +86,7 @@ volatile int numPWMUsed = 0,
|
|||
|
||||
#endif
|
||||
|
||||
void HAL_init() { i2s_init(); }
|
||||
void HAL_init() { TERN_(I2S_STEPPER_STREAM, i2s_init()); }
|
||||
|
||||
void HAL_init_board() {
|
||||
|
||||
|
|
|
|||
|
|
@ -44,7 +44,7 @@ bool PersistentStore::write_data(int &pos, const uint8_t *value, size_t size, ui
|
|||
return false;
|
||||
}
|
||||
|
||||
bool PersistentStore::read_data(int &pos, uint8_t* value, size_t size, uint16_t *crc, const bool writing/*=true*/) {
|
||||
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;
|
||||
|
|
|
|||
|
|
@ -52,6 +52,9 @@
|
|||
// Set pin as input with pullup wrapper
|
||||
#define SET_INPUT_PULLUP(IO) do{ _SET_INPUT(IO); _PULLUP(IO, HIGH); }while(0)
|
||||
|
||||
// Set pin as input with pulldown (substitution)
|
||||
#define SET_INPUT_PULLDOWN SET_INPUT
|
||||
|
||||
// Set pin as output wrapper
|
||||
#define SET_OUTPUT(IO) do{ _SET_OUTPUT(IO); }while(0)
|
||||
|
||||
|
|
|
|||
|
|
@ -184,7 +184,7 @@ int i2s_init() {
|
|||
|
||||
// Allocate the array of pointers to the buffers
|
||||
dma.buffers = (uint32_t **)malloc(sizeof(uint32_t*) * DMA_BUF_COUNT);
|
||||
if (dma.buffers == nullptr) return -1;
|
||||
if (!dma.buffers) return -1;
|
||||
|
||||
// Allocate each buffer that can be used by the DMA controller
|
||||
for (int buf_idx = 0; buf_idx < DMA_BUF_COUNT; buf_idx++) {
|
||||
|
|
@ -194,7 +194,7 @@ int i2s_init() {
|
|||
|
||||
// Allocate the array of DMA descriptors
|
||||
dma.desc = (lldesc_t**) malloc(sizeof(lldesc_t*) * DMA_BUF_COUNT);
|
||||
if (dma.desc == nullptr) return -1;
|
||||
if (!dma.desc) return -1;
|
||||
|
||||
// Allocate each DMA descriptor that will be used by the DMA controller
|
||||
for (int buf_idx = 0; buf_idx < DMA_BUF_COUNT; buf_idx++) {
|
||||
|
|
|
|||
|
|
@ -24,15 +24,9 @@
|
|||
#include <stdint.h>
|
||||
#include <driver/timer.h>
|
||||
|
||||
// Includes needed to get I2S_STEPPER_STREAM. Note that pins.h
|
||||
// is included in case this header is being included early.
|
||||
#include "../../inc/MarlinConfig.h"
|
||||
#include "../../pins/pins.h"
|
||||
|
||||
// ------------------------
|
||||
// Defines
|
||||
// ------------------------
|
||||
//
|
||||
#define FORCE_INLINE __attribute__((always_inline)) inline
|
||||
|
||||
typedef uint64_t hal_timer_t;
|
||||
|
|
|
|||
|
|
@ -25,6 +25,8 @@
|
|||
|
||||
#if ENABLED(USE_WATCHDOG)
|
||||
|
||||
#define WDT_TIMEOUT_US TERN(WATCHDOG_DURATION_8S, 8000000, 4000000) // 4 or 8 second timeout
|
||||
|
||||
#include "watchdog.h"
|
||||
|
||||
void watchdogSetup() {
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@
|
|||
|
||||
#define CPU_32_BIT
|
||||
|
||||
#define F_CPU 100000000
|
||||
#define F_CPU 100000000UL
|
||||
#define SystemCoreClock F_CPU
|
||||
#include <iostream>
|
||||
#include <stdint.h>
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@ size_t PersistentStore::capacity() { return MARLIN_EEPROM_SIZE; }
|
|||
bool PersistentStore::access_start() {
|
||||
const char eeprom_erase_value = 0xFF;
|
||||
FILE * eeprom_file = fopen(filename, "rb");
|
||||
if (eeprom_file == nullptr) return false;
|
||||
if (!eeprom_file) return false;
|
||||
|
||||
fseek(eeprom_file, 0L, SEEK_END);
|
||||
std::size_t file_size = ftell(eeprom_file);
|
||||
|
|
@ -59,7 +59,7 @@ bool PersistentStore::access_start() {
|
|||
|
||||
bool PersistentStore::access_finish() {
|
||||
FILE * eeprom_file = fopen(filename, "wb");
|
||||
if (eeprom_file == nullptr) return false;
|
||||
if (!eeprom_file) return false;
|
||||
fwrite(buffer, sizeof(uint8_t), sizeof(buffer), eeprom_file);
|
||||
fclose(eeprom_file);
|
||||
return true;
|
||||
|
|
@ -78,7 +78,7 @@ bool PersistentStore::write_data(int &pos, const uint8_t *value, size_t size, ui
|
|||
return (bytes_written != size); // 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*/) {
|
||||
bool PersistentStore::read_data(int &pos, uint8_t *value, const size_t size, uint16_t *crc, const bool writing/*=true*/) {
|
||||
std::size_t bytes_read = 0;
|
||||
if (writing) {
|
||||
for (std::size_t i = 0; i < size; i++) {
|
||||
|
|
|
|||
|
|
@ -86,10 +86,10 @@ public:
|
|||
GpioEvent::Type evt_type = value > 1 ? GpioEvent::SET_VALUE : value > pin_map[pin].value ? GpioEvent::RISE : value < pin_map[pin].value ? GpioEvent::FALL : GpioEvent::NOP;
|
||||
pin_map[pin].value = value;
|
||||
GpioEvent evt(Clock::nanos(), pin, evt_type);
|
||||
if (pin_map[pin].cb != nullptr) {
|
||||
if (pin_map[pin].cb) {
|
||||
pin_map[pin].cb->interrupt(evt);
|
||||
}
|
||||
if (Gpio::logger != nullptr) Gpio::logger->log(evt);
|
||||
if (Gpio::logger) Gpio::logger->log(evt);
|
||||
}
|
||||
|
||||
static uint16_t get(pin_type pin) {
|
||||
|
|
@ -105,8 +105,8 @@ public:
|
|||
if (!valid_pin(pin)) return;
|
||||
pin_map[pin].mode = value;
|
||||
GpioEvent evt(Clock::nanos(), pin, GpioEvent::Type::SETM);
|
||||
if (pin_map[pin].cb != nullptr) pin_map[pin].cb->interrupt(evt);
|
||||
if (Gpio::logger != nullptr) Gpio::logger->log(evt);
|
||||
if (pin_map[pin].cb) pin_map[pin].cb->interrupt(evt);
|
||||
if (Gpio::logger) Gpio::logger->log(evt);
|
||||
}
|
||||
|
||||
static uint8_t getMode(pin_type pin) {
|
||||
|
|
@ -118,8 +118,8 @@ public:
|
|||
if (!valid_pin(pin)) return;
|
||||
pin_map[pin].dir = value;
|
||||
GpioEvent evt(Clock::nanos(), pin, GpioEvent::Type::SETD);
|
||||
if (pin_map[pin].cb != nullptr) pin_map[pin].cb->interrupt(evt);
|
||||
if (Gpio::logger != nullptr) Gpio::logger->log(evt);
|
||||
if (pin_map[pin].cb) pin_map[pin].cb->interrupt(evt);
|
||||
if (Gpio::logger) Gpio::logger->log(evt);
|
||||
}
|
||||
|
||||
static uint8_t getDir(pin_type pin) {
|
||||
|
|
|
|||
|
|
@ -19,22 +19,23 @@
|
|||
*/
|
||||
#ifdef __PLAT_LINUX__
|
||||
|
||||
extern void setup();
|
||||
extern void loop();
|
||||
|
||||
#include <thread>
|
||||
|
||||
#include <iostream>
|
||||
#include <fstream>
|
||||
//#define GPIO_LOGGING // Full GPIO and Positional Logging
|
||||
|
||||
#include "../../inc/MarlinConfig.h"
|
||||
#include <stdio.h>
|
||||
#include <stdarg.h>
|
||||
#include "../shared/Delay.h"
|
||||
#include "hardware/IOLoggerCSV.h"
|
||||
#include "hardware/Heater.h"
|
||||
#include "hardware/LinearAxis.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdarg.h>
|
||||
#include <thread>
|
||||
#include <iostream>
|
||||
#include <fstream>
|
||||
|
||||
extern void setup();
|
||||
extern void loop();
|
||||
|
||||
// simple stdout / stdin implementation for fake serial port
|
||||
void write_serial_thread() {
|
||||
for (;;) {
|
||||
|
|
@ -64,8 +65,6 @@ void simulation_loop() {
|
|||
LinearAxis z_axis(Z_ENABLE_PIN, Z_DIR_PIN, Z_STEP_PIN, Z_MIN_PIN, Z_MAX_PIN);
|
||||
LinearAxis extruder0(E0_ENABLE_PIN, E0_DIR_PIN, E0_STEP_PIN, P_NC, P_NC);
|
||||
|
||||
//#define GPIO_LOGGING // Full GPIO and Positional Logging
|
||||
|
||||
#ifdef GPIO_LOGGING
|
||||
IOLoggerCSV logger("all_gpio_log.csv");
|
||||
Gpio::attachLogger(&logger);
|
||||
|
|
@ -88,7 +87,7 @@ void simulation_loop() {
|
|||
|
||||
#ifdef GPIO_LOGGING
|
||||
if (x_axis.position != x || y_axis.position != y || z_axis.position != z) {
|
||||
uint64_t update = MAX3(x_axis.last_update, y_axis.last_update, z_axis.last_update);
|
||||
uint64_t update = _MAX(x_axis.last_update, y_axis.last_update, z_axis.last_update);
|
||||
position_log << update << ", " << x_axis.position << ", " << y_axis.position << ", " << z_axis.position << std::endl;
|
||||
position_log.flush();
|
||||
x = x_axis.position;
|
||||
|
|
|
|||
|
|
@ -26,15 +26,15 @@
|
|||
*/
|
||||
|
||||
#define NUMBER_PINS_TOTAL NUM_DIGITAL_PINS
|
||||
#define pwm_details(pin) pin = pin // do nothing // print PWM details
|
||||
#define pwm_status(pin) false //Print a pin's PWM status. Return true if it's currently a PWM pin.
|
||||
#define IS_ANALOG(P) (DIGITAL_PIN_TO_ANALOG_PIN(P) >= 0 ? 1 : 0)
|
||||
#define pwm_details(pin) NOOP // (do nothing)
|
||||
#define pwm_status(pin) false // Print a pin's PWM status. Return true if it's currently a PWM pin.
|
||||
#define IS_ANALOG(P) (DIGITAL_PIN_TO_ANALOG_PIN(P) >= 0 ? 1 : 0)
|
||||
#define digitalRead_mod(p) digitalRead(p)
|
||||
#define PRINT_PORT(p)
|
||||
#define GET_ARRAY_PIN(p) pin_array[p].pin
|
||||
#define GET_ARRAY_PIN(p) pin_array[p].pin
|
||||
#define PRINT_ARRAY_NAME(x) do{ sprintf_P(buffer, PSTR("%-" STRINGIFY(MAX_NAME_LENGTH) "s"), pin_array[x].name); SERIAL_ECHO(buffer); }while(0)
|
||||
#define PRINT_PIN(p) do{ sprintf_P(buffer, PSTR("%3d "), p); SERIAL_ECHO(buffer); }while(0)
|
||||
#define MULTI_NAME_PAD 16 // space needed to be pretty if not first name assigned to a pin
|
||||
#define PRINT_PIN(p) do{ sprintf_P(buffer, PSTR("%3d "), p); SERIAL_ECHO(buffer); }while(0)
|
||||
#define MULTI_NAME_PAD 16 // space needed to be pretty if not first name assigned to a pin
|
||||
|
||||
// active ADC function/mode/code values for PINSEL registers
|
||||
constexpr int8_t ADC_pin_mode(pin_t pin) {
|
||||
|
|
|
|||
|
|
@ -27,6 +27,8 @@
|
|||
|
||||
#include "watchdog.h"
|
||||
|
||||
#define WDT_TIMEOUT_US TERN(WATCHDOG_DURATION_8S, 8000000, 4000000) // 4 or 8 second timeout
|
||||
|
||||
void watchdog_init() {}
|
||||
void HAL_watchdog_refresh() {}
|
||||
|
||||
|
|
|
|||
|
|
@ -21,7 +21,5 @@
|
|||
*/
|
||||
#pragma once
|
||||
|
||||
#define WDT_TIMEOUT 4000000 // 4 second timeout
|
||||
|
||||
void watchdog_init();
|
||||
void HAL_watchdog_refresh();
|
||||
|
|
|
|||
|
|
@ -127,11 +127,9 @@
|
|||
for (uint16_t i = 0; i < nbyte; i++) doio(buf[i]);
|
||||
}
|
||||
|
||||
void spiSend(uint32_t chan, byte b) {
|
||||
}
|
||||
void spiSend(uint32_t chan, byte b) {}
|
||||
|
||||
void spiSend(uint32_t chan, const uint8_t* buf, size_t nbyte) {
|
||||
}
|
||||
void spiSend(uint32_t chan, const uint8_t* buf, size_t nbyte) {}
|
||||
|
||||
// Read single byte from SPI
|
||||
uint8_t spiRec() { return doio(0xFF); }
|
||||
|
|
@ -143,9 +141,7 @@
|
|||
for (uint16_t i = 0; i < nbyte; i++) buf[i] = doio(0xFF);
|
||||
}
|
||||
|
||||
uint8_t spiTransfer(uint8_t b) {
|
||||
return doio(b);
|
||||
}
|
||||
uint8_t spiTransfer(uint8_t b) { return doio(b); }
|
||||
|
||||
// Write from buffer to SPI
|
||||
void spiSendBlock(uint8_t token, const uint8_t* buf) {
|
||||
|
|
@ -201,6 +197,15 @@ SPIClass::SPIClass(uint8_t device) {
|
|||
GPDMA_Init();
|
||||
}
|
||||
|
||||
SPIClass::SPIClass(pin_t mosi, pin_t miso, pin_t sclk, pin_t ssel) {
|
||||
#if BOARD_NR_SPI >= 1
|
||||
if (mosi == BOARD_SPI1_MOSI_PIN) SPIClass(1);
|
||||
#endif
|
||||
#if BOARD_NR_SPI >= 2
|
||||
if (mosi == BOARD_SPI2_MOSI_PIN) SPIClass(2);
|
||||
#endif
|
||||
}
|
||||
|
||||
void SPIClass::begin() {
|
||||
// Init the SPI pins in the first begin call
|
||||
if ((_currentSetting->spi_d == LPC_SSP0 && spiInitialised[0] == false) ||
|
||||
|
|
@ -263,8 +268,9 @@ uint16_t SPIClass::transfer16(const uint16_t data) {
|
|||
}
|
||||
|
||||
void SPIClass::end() {
|
||||
// SSP_Cmd(_currentSetting->spi_d, DISABLE); // stop device or SSP_DeInit?
|
||||
SSP_DeInit(_currentSetting->spi_d);
|
||||
// Neither is needed for Marlin
|
||||
//SSP_Cmd(_currentSetting->spi_d, DISABLE);
|
||||
//SSP_DeInit(_currentSetting->spi_d);
|
||||
}
|
||||
|
||||
void SPIClass::send(uint8_t data) {
|
||||
|
|
@ -330,25 +336,15 @@ void SPIClass::read(uint8_t *buf, uint32_t len) {
|
|||
for (uint16_t i = 0; i < len; i++) buf[i] = transfer(0xFF);
|
||||
}
|
||||
|
||||
void SPIClass::setClock(uint32_t clock) {
|
||||
_currentSetting->clock = clock;
|
||||
}
|
||||
void SPIClass::setClock(uint32_t clock) { _currentSetting->clock = clock; }
|
||||
|
||||
void SPIClass::setModule(uint8_t device) {
|
||||
_currentSetting = &_settings[device - 1];// SPI channels are called 1 2 and 3 but the array is zero indexed
|
||||
}
|
||||
void SPIClass::setModule(uint8_t device) { _currentSetting = &_settings[device - 1]; } // SPI channels are called 1, 2, and 3 but the array is zero-indexed
|
||||
|
||||
void SPIClass::setBitOrder(uint8_t bitOrder) {
|
||||
_currentSetting->bitOrder = bitOrder;
|
||||
}
|
||||
void SPIClass::setBitOrder(uint8_t bitOrder) { _currentSetting->bitOrder = bitOrder; }
|
||||
|
||||
void SPIClass::setDataMode(uint8_t dataMode) {
|
||||
_currentSetting->dataMode = dataMode;
|
||||
}
|
||||
void SPIClass::setDataMode(uint8_t dataMode) { _currentSetting->dataMode = dataMode; }
|
||||
|
||||
void SPIClass::setDataSize(uint32_t ds) {
|
||||
_currentSetting->dataSize = ds;
|
||||
}
|
||||
void SPIClass::setDataSize(uint32_t dataSize) { _currentSetting->dataSize = dataSize; }
|
||||
|
||||
/**
|
||||
* Set up/tear down
|
||||
|
|
@ -356,8 +352,8 @@ void SPIClass::setDataSize(uint32_t ds) {
|
|||
void SPIClass::updateSettings() {
|
||||
//SSP_DeInit(_currentSetting->spi_d); //todo: need force de init?!
|
||||
|
||||
// divide PCLK by 2 for SSP0
|
||||
CLKPWR_SetPCLKDiv(_currentSetting->spi_d == LPC_SSP0 ? CLKPWR_PCLKSEL_SSP0 : CLKPWR_PCLKSEL_SSP1, CLKPWR_PCLKSEL_CCLK_DIV_2);
|
||||
// Divide PCLK by 2 for SSP0
|
||||
//CLKPWR_SetPCLKDiv(_currentSetting->spi_d == LPC_SSP0 ? CLKPWR_PCLKSEL_SSP0 : CLKPWR_PCLKSEL_SSP1, CLKPWR_PCLKSEL_CCLK_DIV_2);
|
||||
|
||||
SSP_CFG_Type HW_SPI_init; // data structure to hold init values
|
||||
SSP_ConfigStructInit(&HW_SPI_init); // set values for SPI mode
|
||||
|
|
|
|||
|
|
@ -2,6 +2,9 @@
|
|||
* Marlin 3D Printer Firmware
|
||||
* Copyright (c) 2020 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
|
||||
|
|
@ -16,45 +19,27 @@
|
|||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
#if defined(__STM32F1__) && !defined(HAVE_SW_SERIAL)
|
||||
#pragma once
|
||||
|
||||
#include <SPI.h>
|
||||
|
||||
/**
|
||||
* Empty class for Software Serial implementation (Custom RX/TX pins)
|
||||
* Marlin currently requires 3 SPI classes:
|
||||
*
|
||||
* SPIClass:
|
||||
* This class is normally provided by frameworks and has a semi-default interface.
|
||||
* This is needed because some libraries reference it globally.
|
||||
*
|
||||
* SPISettings:
|
||||
* Container for SPI configs for SPIClass. As above, libraries may reference it globally.
|
||||
*
|
||||
* These two classes are often provided by frameworks so we cannot extend them to add
|
||||
* useful methods for Marlin.
|
||||
*
|
||||
* MarlinSPI:
|
||||
* Provides the default SPIClass interface plus some Marlin goodies such as a simplified
|
||||
* interface for SPI DMA transfer.
|
||||
*
|
||||
* TODO: Optionally use https://github.com/FYSETC/SoftwareSerialM if TMC UART is wanted
|
||||
*/
|
||||
|
||||
#include "SoftwareSerial.h"
|
||||
|
||||
// Constructor
|
||||
|
||||
SoftwareSerial::SoftwareSerial(int8_t RX_pin, int8_t TX_pin) {}
|
||||
|
||||
// Public
|
||||
|
||||
void SoftwareSerial::begin(const uint32_t baudrate) {
|
||||
}
|
||||
|
||||
bool SoftwareSerial::available() {
|
||||
return false;
|
||||
}
|
||||
|
||||
uint8_t SoftwareSerial::read() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
uint16_t SoftwareSerial::write(uint8_t byte) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
void SoftwareSerial::flush() {}
|
||||
|
||||
void SoftwareSerial::listen() {
|
||||
listening = true;
|
||||
}
|
||||
|
||||
void SoftwareSerial::stopListening() {
|
||||
listening = false;
|
||||
}
|
||||
|
||||
#endif // __STM32F1__
|
||||
using MarlinSPI = SPIClass;
|
||||
|
|
@ -119,7 +119,7 @@ bool PersistentStore::write_data(int &pos, const uint8_t *value, size_t size, ui
|
|||
return false; // return true for any error
|
||||
}
|
||||
|
||||
bool PersistentStore::read_data(int &pos, uint8_t* value, size_t size, uint16_t *crc, const bool writing/*=true*/) {
|
||||
bool PersistentStore::read_data(int &pos, uint8_t *value, size_t size, uint16_t *crc, const bool writing/*=true*/) {
|
||||
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);
|
||||
|
|
|
|||
|
|
@ -143,7 +143,7 @@ bool PersistentStore::write_data(int &pos, const uint8_t *value, size_t size, ui
|
|||
return bytes_written != size; // 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*/) {
|
||||
bool PersistentStore::read_data(int &pos, uint8_t *value, const size_t size, uint16_t *crc, const bool writing/*=true*/) {
|
||||
if (!eeprom_file_open) return true;
|
||||
UINT bytes_read = 0;
|
||||
FRESULT s;
|
||||
|
|
|
|||
|
|
@ -64,7 +64,7 @@ bool PersistentStore::write_data(int &pos, const uint8_t *value, size_t size, ui
|
|||
return false;
|
||||
}
|
||||
|
||||
bool PersistentStore::read_data(int &pos, uint8_t* value, size_t size, uint16_t *crc, const bool writing/*=true*/) {
|
||||
bool PersistentStore::read_data(int &pos, uint8_t *value, size_t size, uint16_t *crc, const bool writing/*=true*/) {
|
||||
do {
|
||||
// Read from external EEPROM
|
||||
const uint8_t c = eeprom_read_byte((uint8_t*)pos);
|
||||
|
|
|
|||
|
|
@ -72,7 +72,7 @@ static_assert(!(NUM_SERVOS && ENABLED(FAST_PWM_FAN)), "BLTOUCH and Servos are in
|
|||
//#endif
|
||||
|
||||
#if MB(RAMPS_14_RE_ARM_EFB, RAMPS_14_RE_ARM_EEB, RAMPS_14_RE_ARM_EFF, RAMPS_14_RE_ARM_EEF, RAMPS_14_RE_ARM_SF)
|
||||
#if ENABLED(REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER) && HAS_DRIVER(TMC2130) && DISABLED(TMC_USE_SW_SPI)
|
||||
#if IS_RRD_FG_SC && HAS_DRIVER(TMC2130) && DISABLED(TMC_USE_SW_SPI)
|
||||
#error "Re-ARM with REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER and TMC2130 requires TMC_USE_SW_SPI."
|
||||
#endif
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -37,13 +37,14 @@
|
|||
#define DATA_SIZE_8BIT SSP_DATABIT_8
|
||||
#define DATA_SIZE_16BIT SSP_DATABIT_16
|
||||
|
||||
#define SPI_CLOCK_DIV2 8333333 //(SCR: 2) desired: 8,000,000 actual: 8,333,333 +4.2% SPI_FULL_SPEED
|
||||
#define SPI_CLOCK_DIV4 4166667 //(SCR: 5) desired: 4,000,000 actual: 4,166,667 +4.2% SPI_HALF_SPEED
|
||||
#define SPI_CLOCK_DIV8 2083333 //(SCR: 11) desired: 2,000,000 actual: 2,083,333 +4.2% SPI_QUARTER_SPEED
|
||||
#define SPI_CLOCK_DIV16 1000000 //(SCR: 24) desired: 1,000,000 actual: 1,000,000 SPI_EIGHTH_SPEED
|
||||
#define SPI_CLOCK_DIV32 500000 //(SCR: 49) desired: 500,000 actual: 500,000 SPI_SPEED_5
|
||||
#define SPI_CLOCK_DIV64 250000 //(SCR: 99) desired: 250,000 actual: 250,000 SPI_SPEED_6
|
||||
#define SPI_CLOCK_DIV128 125000 //(SCR:199) desired: 125,000 actual: 125,000 Default from HAL.h
|
||||
#define SPI_CLOCK_MAX_TFT 30000000UL
|
||||
#define SPI_CLOCK_DIV2 8333333 //(SCR: 2) desired: 8,000,000 actual: 8,333,333 +4.2% SPI_FULL_SPEED
|
||||
#define SPI_CLOCK_DIV4 4166667 //(SCR: 5) desired: 4,000,000 actual: 4,166,667 +4.2% SPI_HALF_SPEED
|
||||
#define SPI_CLOCK_DIV8 2083333 //(SCR: 11) desired: 2,000,000 actual: 2,083,333 +4.2% SPI_QUARTER_SPEED
|
||||
#define SPI_CLOCK_DIV16 1000000 //(SCR: 24) desired: 1,000,000 actual: 1,000,000 SPI_EIGHTH_SPEED
|
||||
#define SPI_CLOCK_DIV32 500000 //(SCR: 49) desired: 500,000 actual: 500,000 SPI_SPEED_5
|
||||
#define SPI_CLOCK_DIV64 250000 //(SCR: 99) desired: 250,000 actual: 250,000 SPI_SPEED_6
|
||||
#define SPI_CLOCK_DIV128 125000 //(SCR:199) desired: 125,000 actual: 125,000 Default from HAL.h
|
||||
|
||||
#define SPI_CLOCK_MAX SPI_CLOCK_DIV2
|
||||
|
||||
|
|
@ -125,6 +126,11 @@ public:
|
|||
*/
|
||||
SPIClass(uint8_t spiPortNumber);
|
||||
|
||||
/**
|
||||
* Init using pins
|
||||
*/
|
||||
SPIClass(pin_t mosi, pin_t miso, pin_t sclk, pin_t ssel = (pin_t)-1);
|
||||
|
||||
/**
|
||||
* Select and configure the current selected SPI device to use
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -89,7 +89,7 @@ void TFT_SPI::Init() {
|
|||
#elif TFT_MISO_PIN == BOARD_SPI2_MISO_PIN
|
||||
SPIx.setModule(2);
|
||||
#endif
|
||||
SPIx.setClock(SPI_CLOCK_MAX);
|
||||
SPIx.setClock(SPI_CLOCK_MAX_TFT);
|
||||
SPIx.setBitOrder(MSBFIRST);
|
||||
SPIx.setDataMode(SPI_MODE0);
|
||||
}
|
||||
|
|
@ -125,7 +125,7 @@ uint32_t TFT_SPI::ReadID(uint16_t Reg) {
|
|||
}
|
||||
|
||||
DataTransferEnd();
|
||||
SPIx.setClock(SPI_CLOCK_MAX);
|
||||
SPIx.setClock(SPI_CLOCK_MAX_TFT);
|
||||
#endif
|
||||
|
||||
return data >> 7;
|
||||
|
|
|
|||
|
|
@ -1,6 +1,9 @@
|
|||
/**
|
||||
* Marlin 3D Printer Firmware
|
||||
* Copyright (c) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
|
||||
* Copyright (c) 2020 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
|
||||
|
|
|
|||
|
|
@ -1,6 +1,9 @@
|
|||
/**
|
||||
* Marlin 3D Printer Firmware
|
||||
* Copyright (c) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
|
||||
* Copyright (c) 2020 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
|
||||
|
|
|
|||
|
|
@ -28,6 +28,8 @@
|
|||
#include <lpc17xx_wdt.h>
|
||||
#include "watchdog.h"
|
||||
|
||||
#define WDT_TIMEOUT_US TERN(WATCHDOG_DURATION_8S, 8000000, 4000000) // 4 or 8 second timeout
|
||||
|
||||
void watchdog_init() {
|
||||
#if ENABLED(WATCHDOG_RESET_MANUAL)
|
||||
// We enable the watchdog timer, but only for the interrupt.
|
||||
|
|
@ -52,7 +54,7 @@ void watchdog_init() {
|
|||
#else
|
||||
WDT_Init(WDT_CLKSRC_IRC, WDT_MODE_RESET);
|
||||
#endif
|
||||
WDT_Start(WDT_TIMEOUT);
|
||||
WDT_Start(WDT_TIMEOUT_US);
|
||||
}
|
||||
|
||||
void HAL_watchdog_refresh() {
|
||||
|
|
|
|||
|
|
@ -21,8 +21,6 @@
|
|||
*/
|
||||
#pragma once
|
||||
|
||||
#define WDT_TIMEOUT 4000000 // 4 second timeout
|
||||
|
||||
void watchdog_init();
|
||||
void HAL_watchdog_refresh();
|
||||
|
||||
|
|
|
|||
|
|
@ -300,7 +300,7 @@ uint16_t HAL_adc_result;
|
|||
DMA_ADDRESS_INCREMENT_STEP_SIZE_1, // STEPSIZE
|
||||
DMA_STEPSEL_SRC // STEPSEL
|
||||
);
|
||||
if (descriptor != nullptr)
|
||||
if (descriptor)
|
||||
descriptor->BTCTRL.bit.EVOSEL = DMA_EVENT_OUTPUT_BEAT;
|
||||
adc0DMAProgram.startJob();
|
||||
}
|
||||
|
|
@ -337,7 +337,7 @@ uint16_t HAL_adc_result;
|
|||
DMA_ADDRESS_INCREMENT_STEP_SIZE_1, // STEPSIZE
|
||||
DMA_STEPSEL_SRC // STEPSEL
|
||||
);
|
||||
if (descriptor != nullptr)
|
||||
if (descriptor)
|
||||
descriptor->BTCTRL.bit.EVOSEL = DMA_EVENT_OUTPUT_BEAT;
|
||||
adc1DMAProgram.startJob();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -35,10 +35,10 @@ uint8_t QSPIFlash::_buf[SFLASH_SECTOR_SIZE];
|
|||
uint32_t QSPIFlash::_addr = INVALID_ADDR;
|
||||
|
||||
void QSPIFlash::begin() {
|
||||
if (_flashBase != nullptr) return;
|
||||
if (_flashBase) return;
|
||||
|
||||
_flashBase = new Adafruit_SPIFlashBase(new Adafruit_FlashTransport_QSPI());
|
||||
_flashBase->begin(NULL);
|
||||
_flashBase->begin(nullptr);
|
||||
}
|
||||
|
||||
size_t QSPIFlash::size() {
|
||||
|
|
|
|||
|
|
@ -79,7 +79,7 @@ bool PersistentStore::write_data(int &pos, const uint8_t *value, size_t size, ui
|
|||
return false;
|
||||
}
|
||||
|
||||
bool PersistentStore::read_data(int &pos, uint8_t* value, size_t size, uint16_t *crc, const bool writing/*=true*/) {
|
||||
bool PersistentStore::read_data(int &pos, uint8_t *value, size_t size, uint16_t *crc, const bool writing/*=true*/) {
|
||||
while (size--) {
|
||||
SYNC(NVMCTRL->SEESTAT.bit.BUSY);
|
||||
uint8_t c = ((volatile uint8_t *)SEEPROM_ADDR)[pos];
|
||||
|
|
|
|||
|
|
@ -56,7 +56,7 @@ bool PersistentStore::write_data(int &pos, const uint8_t *value, size_t size, ui
|
|||
return false;
|
||||
}
|
||||
|
||||
bool PersistentStore::read_data(int &pos, uint8_t* value, size_t size, uint16_t *crc, const bool writing/*=true*/) {
|
||||
bool PersistentStore::read_data(int &pos, uint8_t *value, size_t size, uint16_t *crc, const bool writing/*=true*/) {
|
||||
while (size--) {
|
||||
uint8_t c = qspi.readByte(pos);
|
||||
if (writing) *value = c;
|
||||
|
|
|
|||
|
|
@ -59,7 +59,7 @@ bool PersistentStore::write_data(int &pos, const uint8_t *value, size_t size, ui
|
|||
return false;
|
||||
}
|
||||
|
||||
bool PersistentStore::read_data(int &pos, uint8_t* value, size_t size, uint16_t *crc, const bool writing/*=true*/) {
|
||||
bool PersistentStore::read_data(int &pos, uint8_t *value, size_t size, uint16_t *crc, const bool writing/*=true*/) {
|
||||
while (size--) {
|
||||
uint8_t c = eeprom_read_byte((uint8_t*)pos);
|
||||
if (writing) *value = c;
|
||||
|
|
|
|||
|
|
@ -24,28 +24,30 @@
|
|||
|
||||
#if ENABLED(USE_WATCHDOG)
|
||||
|
||||
#include "watchdog.h"
|
||||
#include "watchdog.h"
|
||||
|
||||
void watchdog_init() {
|
||||
// The low-power oscillator used by the WDT runs at 32,768 Hz with
|
||||
// a 1:32 prescale, thus 1024 Hz, though probably not super precise.
|
||||
#define WDT_TIMEOUT_REG TERN(WATCHDOG_DURATION_8S, WDT_CONFIG_PER_CYC8192, WDT_CONFIG_PER_CYC4096) // 4 or 8 second timeout
|
||||
|
||||
// Setup WDT clocks
|
||||
MCLK->APBAMASK.bit.OSC32KCTRL_ = true;
|
||||
MCLK->APBAMASK.bit.WDT_ = true;
|
||||
OSC32KCTRL->OSCULP32K.bit.EN1K = true; // Enable out 1K (this is what WDT uses)
|
||||
void watchdog_init() {
|
||||
// The low-power oscillator used by the WDT runs at 32,768 Hz with
|
||||
// a 1:32 prescale, thus 1024 Hz, though probably not super precise.
|
||||
|
||||
WDT->CTRLA.bit.ENABLE = false; // Disable watchdog for config
|
||||
SYNC(WDT->SYNCBUSY.bit.ENABLE);
|
||||
// Setup WDT clocks
|
||||
MCLK->APBAMASK.bit.OSC32KCTRL_ = true;
|
||||
MCLK->APBAMASK.bit.WDT_ = true;
|
||||
OSC32KCTRL->OSCULP32K.bit.EN1K = true; // Enable out 1K (this is what WDT uses)
|
||||
|
||||
WDT->INTENCLR.reg = WDT_INTENCLR_EW; // Disable early warning interrupt
|
||||
WDT->CONFIG.reg = WDT_CONFIG_PER_CYC4096; // Set at least 4s period for chip reset
|
||||
WDT->CTRLA.bit.ENABLE = false; // Disable watchdog for config
|
||||
SYNC(WDT->SYNCBUSY.bit.ENABLE);
|
||||
|
||||
HAL_watchdog_refresh();
|
||||
WDT->INTENCLR.reg = WDT_INTENCLR_EW; // Disable early warning interrupt
|
||||
WDT->CONFIG.reg = WDT_TIMEOUT_REG; // Set a 4s or 8s period for chip reset
|
||||
|
||||
WDT->CTRLA.reg = WDT_CTRLA_ENABLE; // Start watchdog now in normal mode
|
||||
SYNC(WDT->SYNCBUSY.bit.ENABLE);
|
||||
}
|
||||
HAL_watchdog_refresh();
|
||||
|
||||
WDT->CTRLA.reg = WDT_CTRLA_ENABLE; // Start watchdog now in normal mode
|
||||
SYNC(WDT->SYNCBUSY.bit.ENABLE);
|
||||
}
|
||||
|
||||
#endif // USE_WATCHDOG
|
||||
|
||||
|
|
|
|||
|
|
@ -81,7 +81,9 @@ void HAL_init() {
|
|||
|
||||
SetTimerInterruptPriorities();
|
||||
|
||||
TERN_(EMERGENCY_PARSER, USB_Hook_init());
|
||||
#if ENABLED(EMERGENCY_PARSER) && USBD_USE_CDC
|
||||
USB_Hook_init();
|
||||
#endif
|
||||
}
|
||||
|
||||
void HAL_clear_reset_source() { __HAL_RCC_CLEAR_RESET_FLAGS(); }
|
||||
|
|
@ -128,8 +130,12 @@ uint16_t HAL_adc_get_result() { return HAL_adc_result; }
|
|||
void flashFirmware(const int16_t) { NVIC_SystemReset(); }
|
||||
|
||||
// Maple Compatibility
|
||||
volatile uint32_t systick_uptime_millis = 0;
|
||||
systickCallback_t systick_user_callback;
|
||||
void systick_attach_callback(systickCallback_t cb) { systick_user_callback = cb; }
|
||||
void HAL_SYSTICK_Callback() { if (systick_user_callback) systick_user_callback(); }
|
||||
void HAL_SYSTICK_Callback() {
|
||||
systick_uptime_millis++;
|
||||
if (systick_user_callback) systick_user_callback();
|
||||
}
|
||||
|
||||
#endif // ARDUINO_ARCH_STM32 && !STM32GENERIC
|
||||
|
|
|
|||
|
|
@ -184,3 +184,21 @@ void flashFirmware(const int16_t);
|
|||
typedef void (*systickCallback_t)(void);
|
||||
void systick_attach_callback(systickCallback_t cb);
|
||||
void HAL_SYSTICK_Callback();
|
||||
extern volatile uint32_t systick_uptime_millis;
|
||||
|
||||
#define HAL_CAN_SET_PWM_FREQ // This HAL supports PWM Frequency adjustment
|
||||
|
||||
/**
|
||||
* set_pwm_frequency
|
||||
* Set the frequency of the timer corresponding to the provided pin
|
||||
* All Timer PWM pins run at the same frequency
|
||||
*/
|
||||
void set_pwm_frequency(const pin_t pin, int f_desired);
|
||||
|
||||
/**
|
||||
* set_pwm_duty
|
||||
* Set the PWM duty cycle of the provided pin to the provided value
|
||||
* Optionally allows inverting the duty cycle [default = false]
|
||||
* Optionally allows changing the maximum size of the provided value to enable finer PWM duty control [default = 255]
|
||||
*/
|
||||
void set_pwm_duty(const pin_t pin, const uint16_t v, const uint16_t v_size=255, const bool invert=false);
|
||||
|
|
|
|||
165
Marlin/src/HAL/STM32/MarlinSPI.cpp
Normal file
165
Marlin/src/HAL/STM32/MarlinSPI.cpp
Normal file
|
|
@ -0,0 +1,165 @@
|
|||
/**
|
||||
* Marlin 3D Printer Firmware
|
||||
* Copyright (c) 2020 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 <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#if defined(ARDUINO_ARCH_STM32) && !defined(STM32GENERIC)
|
||||
|
||||
#include "MarlinSPI.h"
|
||||
|
||||
static void spi_init(spi_t *obj, uint32_t speed, spi_mode_e mode, uint8_t msb, uint32_t dataSize) {
|
||||
spi_init(obj, speed, mode, msb);
|
||||
// spi_init set 8bit always
|
||||
// TODO: copy the code from spi_init and handle data size, to avoid double init always!!
|
||||
if (dataSize != SPI_DATASIZE_8BIT) {
|
||||
obj->handle.Init.DataSize = dataSize;
|
||||
HAL_SPI_Init(&obj->handle);
|
||||
__HAL_SPI_ENABLE(&obj->handle);
|
||||
}
|
||||
}
|
||||
|
||||
void MarlinSPI::setClockDivider(uint8_t _div) {
|
||||
_speed = spi_getClkFreq(&_spi);// / _div;
|
||||
_clockDivider = _div;
|
||||
}
|
||||
|
||||
void MarlinSPI::begin(void) {
|
||||
//TODO: only call spi_init if any parameter changed!!
|
||||
spi_init(&_spi, _speed, _dataMode, _bitOrder, _dataSize);
|
||||
}
|
||||
|
||||
void MarlinSPI::setupDma(SPI_HandleTypeDef &_spiHandle, DMA_HandleTypeDef &_dmaHandle, uint32_t direction, bool minc) {
|
||||
_dmaHandle.Init.Direction = direction;
|
||||
_dmaHandle.Init.PeriphInc = DMA_PINC_DISABLE;
|
||||
_dmaHandle.Init.Mode = DMA_NORMAL;
|
||||
_dmaHandle.Init.Priority = DMA_PRIORITY_LOW;
|
||||
_dmaHandle.Init.MemInc = minc ? DMA_MINC_ENABLE : DMA_MINC_DISABLE;
|
||||
|
||||
if (_dataSize == DATA_SIZE_8BIT) {
|
||||
_dmaHandle.Init.PeriphDataAlignment = DMA_PDATAALIGN_BYTE;
|
||||
_dmaHandle.Init.MemDataAlignment = DMA_MDATAALIGN_BYTE;
|
||||
}
|
||||
else {
|
||||
_dmaHandle.Init.PeriphDataAlignment = DMA_PDATAALIGN_HALFWORD;
|
||||
_dmaHandle.Init.MemDataAlignment = DMA_MDATAALIGN_HALFWORD;
|
||||
}
|
||||
#ifdef STM32F4xx
|
||||
_dmaHandle.Init.Channel = DMA_CHANNEL_3;
|
||||
_dmaHandle.Init.FIFOMode = DMA_FIFOMODE_DISABLE;
|
||||
#endif
|
||||
|
||||
// start DMA hardware
|
||||
// TODO: check if hardware is already enabled
|
||||
#ifdef SPI1_BASE
|
||||
if (_spiHandle.Instance == SPI1) {
|
||||
#ifdef STM32F1xx
|
||||
__HAL_RCC_DMA1_CLK_ENABLE();
|
||||
_dmaHandle.Instance = (direction == DMA_MEMORY_TO_PERIPH) ? DMA1_Channel3 : DMA1_Channel2;
|
||||
#elif defined(STM32F4xx)
|
||||
__HAL_RCC_DMA2_CLK_ENABLE();
|
||||
_dmaHandle.Instance = DMA2_Stream3;
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
#ifdef SPI2_BASE
|
||||
if (_spiHandle.Instance == SPI2) {
|
||||
#ifdef STM32F1xx
|
||||
__HAL_RCC_DMA1_CLK_ENABLE();
|
||||
_dmaHandle.Instance = (direction == DMA_MEMORY_TO_PERIPH) ? DMA1_Channel5 : DMA1_Channel4;
|
||||
#elif defined(STM32F4xx)
|
||||
//TODO: f4 dma config
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
#ifdef SPI3_BASE
|
||||
if (_spiHandle.Instance == SPI3) {
|
||||
#ifdef STM32F1xx
|
||||
__HAL_RCC_DMA2_CLK_ENABLE();
|
||||
_dmaHandle.Instance = (direction == DMA_MEMORY_TO_PERIPH) ? DMA2_Channel2 : DMA2_Channel1;
|
||||
#elif defined(STM32F4xx)
|
||||
//TODO: f4 dma config
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
HAL_DMA_Init(&_dmaHandle);
|
||||
}
|
||||
|
||||
byte MarlinSPI::transfer(uint8_t _data) {
|
||||
uint8_t rxData = 0xFF;
|
||||
HAL_SPI_TransmitReceive(&_spi.handle, &_data, &rxData, 1, HAL_MAX_DELAY);
|
||||
return rxData;
|
||||
}
|
||||
|
||||
uint8_t MarlinSPI::dmaTransfer(const void *transmitBuf, void *receiveBuf, uint16_t length) {
|
||||
const uint8_t ff = 0xFF;
|
||||
|
||||
//if ((hspi->Instance->CR1 & SPI_CR1_SPE) != SPI_CR1_SPE) //only enable if disabled
|
||||
__HAL_SPI_ENABLE(&_spi.handle);
|
||||
|
||||
if (receiveBuf) {
|
||||
setupDma(_spi.handle, _dmaRx, DMA_PERIPH_TO_MEMORY, true);
|
||||
HAL_DMA_Start(&_dmaRx, (uint32_t)&(_spi.handle.Instance->DR), (uint32_t)receiveBuf, length);
|
||||
SET_BIT(_spi.handle.Instance->CR2, SPI_CR2_RXDMAEN); /* Enable Rx DMA Request */
|
||||
}
|
||||
|
||||
// check for 2 lines transfer
|
||||
bool mincTransmit = true;
|
||||
if (transmitBuf == nullptr && _spi.handle.Init.Direction == SPI_DIRECTION_2LINES && _spi.handle.Init.Mode == SPI_MODE_MASTER) {
|
||||
transmitBuf = &ff;
|
||||
mincTransmit = false;
|
||||
}
|
||||
|
||||
if (transmitBuf) {
|
||||
setupDma(_spi.handle, _dmaTx, DMA_MEMORY_TO_PERIPH, mincTransmit);
|
||||
HAL_DMA_Start(&_dmaTx, (uint32_t)transmitBuf, (uint32_t)&(_spi.handle.Instance->DR), length);
|
||||
SET_BIT(_spi.handle.Instance->CR2, SPI_CR2_TXDMAEN); /* Enable Tx DMA Request */
|
||||
}
|
||||
|
||||
if (transmitBuf) {
|
||||
HAL_DMA_PollForTransfer(&_dmaTx, HAL_DMA_FULL_TRANSFER, HAL_MAX_DELAY);
|
||||
HAL_DMA_Abort(&_dmaTx);
|
||||
HAL_DMA_DeInit(&_dmaTx);
|
||||
}
|
||||
|
||||
// while ((_spi.handle.Instance->SR & SPI_FLAG_RXNE) != SPI_FLAG_RXNE) {}
|
||||
|
||||
if (receiveBuf) {
|
||||
HAL_DMA_PollForTransfer(&_dmaRx, HAL_DMA_FULL_TRANSFER, HAL_MAX_DELAY);
|
||||
HAL_DMA_Abort(&_dmaRx);
|
||||
HAL_DMA_DeInit(&_dmaRx);
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
uint8_t MarlinSPI::dmaSend(const void * transmitBuf, uint16_t length, bool minc) {
|
||||
setupDma(_spi.handle, _dmaTx, DMA_MEMORY_TO_PERIPH, minc);
|
||||
HAL_DMA_Start(&_dmaTx, (uint32_t)transmitBuf, (uint32_t)&(_spi.handle.Instance->DR), length);
|
||||
__HAL_SPI_ENABLE(&_spi.handle);
|
||||
SET_BIT(_spi.handle.Instance->CR2, SPI_CR2_TXDMAEN); /* Enable Tx DMA Request */
|
||||
HAL_DMA_PollForTransfer(&_dmaTx, HAL_DMA_FULL_TRANSFER, HAL_MAX_DELAY);
|
||||
HAL_DMA_Abort(&_dmaTx);
|
||||
// DeInit objects
|
||||
HAL_DMA_DeInit(&_dmaTx);
|
||||
return 1;
|
||||
}
|
||||
|
||||
#endif // ARDUINO_ARCH_STM32 && !STM32GENERIC
|
||||
107
Marlin/src/HAL/STM32/MarlinSPI.h
Normal file
107
Marlin/src/HAL/STM32/MarlinSPI.h
Normal file
|
|
@ -0,0 +1,107 @@
|
|||
/**
|
||||
* Marlin 3D Printer Firmware
|
||||
* Copyright (c) 2020 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 <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include "HAL.h"
|
||||
#include <SPI.h>
|
||||
|
||||
extern "C" {
|
||||
#include <utility/spi_com.h>
|
||||
}
|
||||
|
||||
/**
|
||||
* Marlin currently requires 3 SPI classes:
|
||||
*
|
||||
* SPIClass:
|
||||
* This class is normally provided by frameworks and has a semi-default interface.
|
||||
* This is needed because some libraries reference it globally.
|
||||
*
|
||||
* SPISettings:
|
||||
* Container for SPI configs for SPIClass. As above, libraries may reference it globally.
|
||||
*
|
||||
* These two classes are often provided by frameworks so we cannot extend them to add
|
||||
* useful methods for Marlin.
|
||||
*
|
||||
* MarlinSPI:
|
||||
* Provides the default SPIClass interface plus some Marlin goodies such as a simplified
|
||||
* interface for SPI DMA transfer.
|
||||
*
|
||||
*/
|
||||
|
||||
#define DATA_SIZE_8BIT SPI_DATASIZE_8BIT
|
||||
#define DATA_SIZE_16BIT SPI_DATASIZE_16BIT
|
||||
|
||||
class MarlinSPI {
|
||||
public:
|
||||
MarlinSPI() : MarlinSPI(NC, NC, NC, NC) {}
|
||||
|
||||
MarlinSPI(pin_t mosi, pin_t miso, pin_t sclk, pin_t ssel = (pin_t)NC) : _mosiPin(mosi), _misoPin(miso), _sckPin(sclk), _ssPin(ssel) {
|
||||
_spi.pin_miso = digitalPinToPinName(_misoPin);
|
||||
_spi.pin_mosi = digitalPinToPinName(_mosiPin);
|
||||
_spi.pin_sclk = digitalPinToPinName(_sckPin);
|
||||
_spi.pin_ssel = digitalPinToPinName(_ssPin);
|
||||
_dataSize = DATA_SIZE_8BIT;
|
||||
_bitOrder = MSBFIRST;
|
||||
_dataMode = SPI_MODE_0;
|
||||
_spi.handle.State = HAL_SPI_STATE_RESET;
|
||||
setClockDivider(SPI_SPEED_CLOCK_DIV2_MHZ);
|
||||
}
|
||||
|
||||
void begin(void);
|
||||
void end(void) {}
|
||||
|
||||
byte transfer(uint8_t _data);
|
||||
uint8_t dmaTransfer(const void *transmitBuf, void *receiveBuf, uint16_t length);
|
||||
uint8_t dmaSend(const void * transmitBuf, uint16_t length, bool minc = true);
|
||||
|
||||
/* These methods are deprecated and kept for compatibility.
|
||||
* Use SPISettings with SPI.beginTransaction() to configure SPI parameters.
|
||||
*/
|
||||
void setBitOrder(BitOrder _order) { _bitOrder = _order; }
|
||||
|
||||
void setDataMode(uint8_t _mode) {
|
||||
switch (_mode) {
|
||||
case SPI_MODE0: _dataMode = SPI_MODE_0; break;
|
||||
case SPI_MODE1: _dataMode = SPI_MODE_1; break;
|
||||
case SPI_MODE2: _dataMode = SPI_MODE_2; break;
|
||||
case SPI_MODE3: _dataMode = SPI_MODE_3; break;
|
||||
}
|
||||
}
|
||||
|
||||
void setClockDivider(uint8_t _div);
|
||||
|
||||
private:
|
||||
void setupDma(SPI_HandleTypeDef &_spiHandle, DMA_HandleTypeDef &_dmaHandle, uint32_t direction, bool minc = false);
|
||||
|
||||
spi_t _spi;
|
||||
DMA_HandleTypeDef _dmaTx;
|
||||
DMA_HandleTypeDef _dmaRx;
|
||||
BitOrder _bitOrder;
|
||||
spi_mode_e _dataMode;
|
||||
uint8_t _clockDivider;
|
||||
uint32_t _speed;
|
||||
uint32_t _dataSize;
|
||||
pin_t _mosiPin;
|
||||
pin_t _misoPin;
|
||||
pin_t _sckPin;
|
||||
pin_t _ssPin;
|
||||
};
|
||||
|
|
@ -113,7 +113,7 @@ bool PersistentStore::access_start() {
|
|||
// 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");
|
||||
if (eeprom_data_written) DEBUG_ECHOLNPGM("Dangling EEPROM write_data");
|
||||
uint32_t address = FLASH_ADDRESS_START;
|
||||
while (address <= FLASH_ADDRESS_END) {
|
||||
uint32_t address_value = (*(__IO uint32_t*)address);
|
||||
|
|
@ -261,7 +261,7 @@ bool PersistentStore::write_data(int &pos, const uint8_t *value, size_t size, ui
|
|||
return false;
|
||||
}
|
||||
|
||||
bool PersistentStore::read_data(int &pos, uint8_t* value, size_t size, uint16_t *crc, const bool writing/*=true*/) {
|
||||
bool PersistentStore::read_data(int &pos, uint8_t *value, size_t size, uint16_t *crc, const bool writing/*=true*/) {
|
||||
do {
|
||||
const uint8_t c = TERN(FLASH_EEPROM_LEVELING, ram_eeprom[pos], eeprom_buffered_read_byte(pos));
|
||||
if (writing) *value = c;
|
||||
|
|
|
|||
|
|
@ -78,7 +78,7 @@ bool PersistentStore::write_data(int &pos, const uint8_t *value, size_t size, ui
|
|||
return false;
|
||||
}
|
||||
|
||||
bool PersistentStore::read_data(int &pos, uint8_t* value, const size_t size, uint16_t *crc, const bool writing/*=true*/) {
|
||||
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 c = HAL_eeprom_data[pos + i];
|
||||
if (writing) value[i] = c;
|
||||
|
|
|
|||
|
|
@ -52,7 +52,7 @@ bool PersistentStore::write_data(int &pos, const uint8_t *value, size_t size, ui
|
|||
return false;
|
||||
}
|
||||
|
||||
bool PersistentStore::read_data(int &pos, uint8_t* value, size_t size, uint16_t *crc, const bool writing/*=true*/) {
|
||||
bool PersistentStore::read_data(int &pos, uint8_t *value, size_t size, uint16_t *crc, const bool writing/*=true*/) {
|
||||
do {
|
||||
// Read from either external EEPROM, program flash or Backup SRAM
|
||||
const uint8_t c = ( *(__IO uint8_t *)(BKPSRAM_BASE + ((uint8_t*)pos)) );
|
||||
|
|
|
|||
|
|
@ -65,7 +65,7 @@ bool PersistentStore::write_data(int &pos, const uint8_t *value, size_t size, ui
|
|||
return false;
|
||||
}
|
||||
|
||||
bool PersistentStore::read_data(int &pos, uint8_t* value, size_t size, uint16_t *crc, const bool writing/*=true*/) {
|
||||
bool PersistentStore::read_data(int &pos, uint8_t *value, size_t size, uint16_t *crc, const bool writing/*=true*/) {
|
||||
do {
|
||||
// Read from either external EEPROM, program flash or Backup SRAM
|
||||
const uint8_t c = eeprom_read_byte((uint8_t*)pos);
|
||||
|
|
|
|||
57
Marlin/src/HAL/STM32/fast_pwm.cpp
Normal file
57
Marlin/src/HAL/STM32/fast_pwm.cpp
Normal file
|
|
@ -0,0 +1,57 @@
|
|||
/**
|
||||
* Marlin 3D Printer Firmware
|
||||
* Copyright (c) 2020 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 <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "../../inc/MarlinConfigPre.h"
|
||||
|
||||
#if NEEDS_HARDWARE_PWM
|
||||
|
||||
#include "HAL.h"
|
||||
#include "timers.h"
|
||||
|
||||
void set_pwm_frequency(const pin_t pin, int f_desired) {
|
||||
if (!PWM_PIN(pin)) return; // Don't proceed if no hardware timer
|
||||
|
||||
PinName pin_name = digitalPinToPinName(pin);
|
||||
TIM_TypeDef *Instance = (TIM_TypeDef *)pinmap_peripheral(pin_name, PinMap_PWM); // Get HAL timer instance
|
||||
|
||||
LOOP_S_L_N(i, 0, NUM_HARDWARE_TIMERS) // Protect used timers
|
||||
if (timer_instance[i] && timer_instance[i]->getHandle()->Instance == Instance)
|
||||
return;
|
||||
|
||||
pwm_start(pin_name, f_desired, 0, RESOLUTION_8B_COMPARE_FORMAT);
|
||||
}
|
||||
|
||||
void set_pwm_duty(const pin_t pin, const uint16_t v, const uint16_t v_size/*=255*/, const bool invert/*=false*/) {
|
||||
PinName pin_name = digitalPinToPinName(pin);
|
||||
TIM_TypeDef *Instance = (TIM_TypeDef *)pinmap_peripheral(pin_name, PinMap_PWM);
|
||||
uint16_t adj_val = Instance->ARR * v / v_size;
|
||||
if (invert) adj_val = Instance->ARR - adj_val;
|
||||
|
||||
switch (get_pwm_channel(pin_name)) {
|
||||
case TIM_CHANNEL_1: LL_TIM_OC_SetCompareCH1(Instance, adj_val); break;
|
||||
case TIM_CHANNEL_2: LL_TIM_OC_SetCompareCH2(Instance, adj_val); break;
|
||||
case TIM_CHANNEL_3: LL_TIM_OC_SetCompareCH3(Instance, adj_val); break;
|
||||
case TIM_CHANNEL_4: LL_TIM_OC_SetCompareCH4(Instance, adj_val); break;
|
||||
}
|
||||
}
|
||||
|
||||
#endif // NEEDS_HARDWARE_PWM
|
||||
|
|
@ -28,9 +28,6 @@
|
|||
// #error "SPINDLE_LASER_PWM_PIN must use SERVO0, SERVO1 or SERVO3 connector"
|
||||
//#endif
|
||||
|
||||
#if ENABLED(FAST_PWM_FAN) || SPINDLE_LASER_FREQUENCY
|
||||
#error "Features requiring Hardware PWM (FAST_PWM_FAN, SPINDLE_LASER_FREQUENCY) are not yet supported on STM32."
|
||||
#endif
|
||||
|
||||
#if ENABLED(SDCARD_EEPROM_EMULATION) && DISABLED(SDSUPPORT)
|
||||
#undef SDCARD_EEPROM_EMULATION // Avoid additional error noise
|
||||
|
|
|
|||
|
|
@ -21,30 +21,28 @@
|
|||
*/
|
||||
#pragma once
|
||||
|
||||
#include "../../../inc/MarlinConfig.h"
|
||||
|
||||
#ifdef STM32F1xx
|
||||
#include "stm32f1xx_hal.h"
|
||||
#define __IS_DMA_ENABLED(__HANDLE__) ((__HANDLE__)->Instance->CCR & DMA_CCR_EN)
|
||||
#elif defined(STM32F4xx)
|
||||
#include "stm32f4xx_hal.h"
|
||||
#define __IS_DMA_ENABLED(__HANDLE__) ((__HANDLE__)->Instance->CR & DMA_SxCR_EN)
|
||||
#else
|
||||
#error FSMC TFT is currently only supported on STM32F1 and STM32F4 hardware.
|
||||
#error "FSMC TFT is currently only supported on STM32F1 and STM32F4 hardware."
|
||||
#endif
|
||||
|
||||
#ifndef LCD_READ_ID
|
||||
#define LCD_READ_ID 0x04 // Read display identification information (0xD3 on ILI9341)
|
||||
#define LCD_READ_ID 0x04 // Read display identification information (0xD3 on ILI9341)
|
||||
#endif
|
||||
#ifndef LCD_READ_ID4
|
||||
#define LCD_READ_ID4 0xD3 // Read display identification information (0xD3 on ILI9341)
|
||||
#endif
|
||||
|
||||
#define DATASIZE_8BIT SPI_DATASIZE_8BIT
|
||||
#define DATASIZE_16BIT SPI_DATASIZE_16BIT
|
||||
#define TFT_IO_DRIVER TFT_FSMC
|
||||
|
||||
#ifdef STM32F1xx
|
||||
#define __IS_DMA_ENABLED(__HANDLE__) ((__HANDLE__)->Instance->CCR & DMA_CCR_EN)
|
||||
#elif defined(STM32F4xx)
|
||||
#define __IS_DMA_ENABLED(__HANDLE__) ((__HANDLE__)->Instance->CR & DMA_SxCR_EN)
|
||||
#endif
|
||||
#define DATASIZE_8BIT SPI_DATASIZE_8BIT
|
||||
#define DATASIZE_16BIT SPI_DATASIZE_16BIT
|
||||
#define TFT_IO_DRIVER TFT_FSMC
|
||||
|
||||
typedef struct {
|
||||
__IO uint16_t REG;
|
||||
|
|
|
|||
|
|
@ -1,6 +1,9 @@
|
|||
/**
|
||||
* Marlin 3D Printer Firmware
|
||||
* Copyright (c) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
|
||||
* Copyright (c) 2020 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
|
||||
|
|
@ -99,7 +102,7 @@ void XPT2046::Init() {
|
|||
#endif
|
||||
}
|
||||
else {
|
||||
SPIx.Instance = NULL;
|
||||
SPIx.Instance = nullptr;
|
||||
SET_INPUT(TOUCH_MISO_PIN);
|
||||
SET_OUTPUT(TOUCH_MOSI_PIN);
|
||||
SET_OUTPUT(TOUCH_SCK_PIN);
|
||||
|
|
|
|||
|
|
@ -1,6 +1,9 @@
|
|||
/**
|
||||
* Marlin 3D Printer Firmware
|
||||
* Copyright (c) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
|
||||
* Copyright (c) 2020 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
|
||||
|
|
|
|||
|
|
@ -27,7 +27,6 @@
|
|||
// Local defines
|
||||
// ------------------------
|
||||
|
||||
#define NUM_HARDWARE_TIMERS 2
|
||||
|
||||
// Default timer priorities. Override by specifying alternate priorities in the board pins file.
|
||||
// The TONE timer is not present here, as it currently cannot be set programmatically. It is set
|
||||
|
|
@ -68,26 +67,23 @@
|
|||
#endif
|
||||
|
||||
#ifdef STM32F0xx
|
||||
#define MCU_TIMER_RATE (F_CPU) // Frequency of timer peripherals
|
||||
#define MCU_STEP_TIMER 16
|
||||
#define MCU_TEMP_TIMER 17
|
||||
#elif defined(STM32F1xx)
|
||||
#define MCU_TIMER_RATE (F_CPU)
|
||||
#define MCU_STEP_TIMER 4
|
||||
#define MCU_TEMP_TIMER 2
|
||||
#elif defined(STM32F401xC) || defined(STM32F401xE)
|
||||
#define MCU_TIMER_RATE (F_CPU / 2)
|
||||
#define MCU_STEP_TIMER 9
|
||||
#define MCU_TEMP_TIMER 10
|
||||
#elif defined(STM32F4xx) || defined(STM32F7xx)
|
||||
#define MCU_TIMER_RATE (F_CPU / 2)
|
||||
#define MCU_STEP_TIMER 6 // STM32F401 has no TIM6, TIM7, or TIM8
|
||||
#define MCU_TEMP_TIMER 14 // TIM7 is consumed by Software Serial if used.
|
||||
#endif
|
||||
|
||||
#ifndef HAL_TIMER_RATE
|
||||
#define HAL_TIMER_RATE MCU_TIMER_RATE
|
||||
#define HAL_TIMER_RATE GetStepperTimerClkFreq()
|
||||
#endif
|
||||
|
||||
#ifndef STEP_TIMER
|
||||
#define STEP_TIMER MCU_STEP_TIMER
|
||||
#endif
|
||||
|
|
@ -109,12 +105,19 @@
|
|||
// Private Variables
|
||||
// ------------------------
|
||||
|
||||
HardwareTimer *timer_instance[NUM_HARDWARE_TIMERS] = { NULL };
|
||||
HardwareTimer *timer_instance[NUM_HARDWARE_TIMERS] = { nullptr };
|
||||
|
||||
// ------------------------
|
||||
// Public functions
|
||||
// ------------------------
|
||||
|
||||
uint32_t GetStepperTimerClkFreq() {
|
||||
// Timer input clocks vary between devices, and in some cases between timers on the same device.
|
||||
// Retrieve at runtime to ensure device compatibility. Cache result to avoid repeated overhead.
|
||||
static uint32_t clkfreq = timer_instance[STEP_TIMER_NUM]->getTimerClkFreq();
|
||||
return clkfreq;
|
||||
}
|
||||
|
||||
// frequency is in Hertz
|
||||
void HAL_timer_start(const uint8_t timer_num, const uint32_t frequency) {
|
||||
if (!HAL_timer_initialized(timer_num)) {
|
||||
|
|
|
|||
|
|
@ -43,6 +43,8 @@
|
|||
#define hal_timer_t uint32_t
|
||||
#define HAL_TIMER_TYPE_MAX UINT16_MAX
|
||||
|
||||
#define NUM_HARDWARE_TIMERS 2
|
||||
|
||||
#ifndef STEP_TIMER_NUM
|
||||
#define STEP_TIMER_NUM 0 // Timer Index for Stepper
|
||||
#endif
|
||||
|
|
@ -57,7 +59,8 @@
|
|||
|
||||
// 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))
|
||||
extern uint32_t GetStepperTimerClkFreq();
|
||||
#define STEPPER_TIMER_PRESCALE (GetStepperTimerClkFreq() / (STEPPER_TIMER_RATE))
|
||||
#define STEPPER_TIMER_TICKS_PER_US ((STEPPER_TIMER_RATE) / 1000000) // stepper timer ticks per µs
|
||||
|
||||
#define PULSE_TIMER_RATE STEPPER_TIMER_RATE
|
||||
|
|
@ -102,7 +105,7 @@ void SetTimerInterruptPriorities();
|
|||
|
||||
// FORCE_INLINE because these are used in performance-critical situations
|
||||
FORCE_INLINE bool HAL_timer_initialized(const uint8_t timer_num) {
|
||||
return timer_instance[timer_num] != NULL;
|
||||
return timer_instance[timer_num] != nullptr;
|
||||
}
|
||||
FORCE_INLINE static hal_timer_t HAL_timer_get_count(const uint8_t timer_num) {
|
||||
return HAL_timer_initialized(timer_num) ? timer_instance[timer_num]->getCount() : 0;
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@
|
|||
|
||||
#include "../../inc/MarlinConfigPre.h"
|
||||
|
||||
#if ENABLED(EMERGENCY_PARSER)
|
||||
#if ENABLED(EMERGENCY_PARSER) && USBD_USE_CDC
|
||||
|
||||
#include "usb_serial.h"
|
||||
#include "../../feature/e_parser.h"
|
||||
|
|
|
|||
|
|
@ -25,23 +25,26 @@
|
|||
|
||||
#if ENABLED(USE_WATCHDOG)
|
||||
|
||||
#include "../../inc/MarlinConfig.h"
|
||||
#define WDT_TIMEOUT_US TERN(WATCHDOG_DURATION_8S, 8000000, 4000000) // 4 or 8 second timeout
|
||||
|
||||
#include "watchdog.h"
|
||||
#include <IWatchdog.h>
|
||||
#include "../../inc/MarlinConfig.h"
|
||||
|
||||
void watchdog_init() {
|
||||
#if DISABLED(DISABLE_WATCHDOG_INIT)
|
||||
IWatchdog.begin(4000000); // 4 sec timeout
|
||||
#endif
|
||||
}
|
||||
#include "watchdog.h"
|
||||
#include <IWatchdog.h>
|
||||
|
||||
void HAL_watchdog_refresh() {
|
||||
IWatchdog.reload();
|
||||
#if DISABLED(PINS_DEBUGGING) && PIN_EXISTS(LED)
|
||||
TOGGLE(LED_PIN); // heartbeat indicator
|
||||
#endif
|
||||
}
|
||||
void watchdog_init() {
|
||||
#if DISABLED(DISABLE_WATCHDOG_INIT)
|
||||
IWatchdog.begin(WDT_TIMEOUT_US);
|
||||
#endif
|
||||
}
|
||||
|
||||
void HAL_watchdog_refresh() {
|
||||
IWatchdog.reload();
|
||||
#if DISABLED(PINS_DEBUGGING) && PIN_EXISTS(LED)
|
||||
TOGGLE(LED_PIN); // heartbeat indicator
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif // USE_WATCHDOG
|
||||
|
||||
#endif // ARDUINO_ARCH_STM32 && !STM32GENERIC
|
||||
|
|
|
|||
|
|
@ -130,7 +130,7 @@ const uint8_t adc_pins[] = {
|
|||
#if ENABLED(FILAMENT_WIDTH_SENSOR)
|
||||
FILWIDTH_PIN,
|
||||
#endif
|
||||
#if ENABLED(ADC_KEYPAD)
|
||||
#if HAS_ADC_BUTTONS
|
||||
ADC_KEYPAD_PIN,
|
||||
#endif
|
||||
#if HAS_JOY_ADC_X
|
||||
|
|
@ -187,7 +187,7 @@ enum TempPinIndex : char {
|
|||
#if ENABLED(FILAMENT_WIDTH_SENSOR)
|
||||
FILWIDTH,
|
||||
#endif
|
||||
#if ENABLED(ADC_KEYPAD)
|
||||
#if HAS_ADC_BUTTONS
|
||||
ADC_KEY,
|
||||
#endif
|
||||
#if HAS_JOY_ADC_X
|
||||
|
|
@ -389,7 +389,7 @@ void HAL_adc_start_conversion(const uint8_t adc_pin) {
|
|||
#if ENABLED(FILAMENT_WIDTH_SENSOR)
|
||||
case FILWIDTH_PIN: pin_index = FILWIDTH; break;
|
||||
#endif
|
||||
#if ENABLED(ADC_KEYPAD)
|
||||
#if HAS_ADC_BUTTONS
|
||||
case ADC_KEYPAD_PIN: pin_index = ADC_KEY; break;
|
||||
#endif
|
||||
#if ENABLED(POWER_MONITOR_CURRENT)
|
||||
|
|
|
|||
|
|
@ -124,7 +124,7 @@ void HAL_idletask();
|
|||
#endif
|
||||
|
||||
#ifndef digitalPinHasPWM
|
||||
#define digitalPinHasPWM(P) (PIN_MAP[P].timer_device != nullptr)
|
||||
#define digitalPinHasPWM(P) !!PIN_MAP[P].timer_device
|
||||
#define NO_COMPILE_TIME_PWM
|
||||
#endif
|
||||
|
||||
|
|
@ -244,3 +244,20 @@ void analogWrite(pin_t pin, int pwm_val8); // PWM only! mul by 257 in maple!?
|
|||
|
||||
#define PLATFORM_M997_SUPPORT
|
||||
void flashFirmware(const int16_t);
|
||||
|
||||
#define HAL_CAN_SET_PWM_FREQ // This HAL supports PWM Frequency adjustment
|
||||
|
||||
/**
|
||||
* set_pwm_frequency
|
||||
* Set the frequency of the timer corresponding to the provided pin
|
||||
* All Timer PWM pins run at the same frequency
|
||||
*/
|
||||
void set_pwm_frequency(const pin_t pin, int f_desired);
|
||||
|
||||
/**
|
||||
* set_pwm_duty
|
||||
* Set the PWM duty cycle of the provided pin to the provided value
|
||||
* Optionally allows inverting the duty cycle [default = false]
|
||||
* Optionally allows changing the maximum size of the provided value to enable finer PWM duty control [default = 255]
|
||||
*/
|
||||
void set_pwm_duty(const pin_t pin, const uint16_t v, const uint16_t v_size=255, const bool invert=false);
|
||||
|
|
|
|||
45
Marlin/src/HAL/STM32F1/MarlinSPI.h
Normal file
45
Marlin/src/HAL/STM32F1/MarlinSPI.h
Normal file
|
|
@ -0,0 +1,45 @@
|
|||
/**
|
||||
* Marlin 3D Printer Firmware
|
||||
* Copyright (c) 2020 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 <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include <SPI.h>
|
||||
|
||||
/**
|
||||
* Marlin currently requires 3 SPI classes:
|
||||
*
|
||||
* SPIClass:
|
||||
* This class is normally provided by frameworks and has a semi-default interface.
|
||||
* This is needed because some libraries reference it globally.
|
||||
*
|
||||
* SPISettings:
|
||||
* Container for SPI configs for SPIClass. As above, libraries may reference it globally.
|
||||
*
|
||||
* These two classes are often provided by frameworks so we cannot extend them to add
|
||||
* useful methods for Marlin.
|
||||
*
|
||||
* MarlinSPI:
|
||||
* Provides the default SPIClass interface plus some Marlin goodies such as a simplified
|
||||
* interface for SPI DMA transfer.
|
||||
*
|
||||
*/
|
||||
|
||||
using MarlinSPI = SPIClass;
|
||||
|
|
@ -147,6 +147,18 @@ SPIClass::SPIClass(uint32_t spi_num) {
|
|||
_currentSetting->state = SPI_STATE_IDLE;
|
||||
}
|
||||
|
||||
SPIClass::SPIClass(int8_t mosi, int8_t miso, int8_t sclk, int8_t ssel) {
|
||||
#if BOARD_NR_SPI >= 1
|
||||
if (mosi == BOARD_SPI1_MOSI_PIN) SPIClass(1);
|
||||
#endif
|
||||
#if BOARD_NR_SPI >= 2
|
||||
if (mosi == BOARD_SPI2_MOSI_PIN) SPIClass(2);
|
||||
#endif
|
||||
#if BOARD_NR_SPI >= 3
|
||||
if (mosi == BOARD_SPI3_MOSI_PIN) SPIClass(3);
|
||||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
* Set up/tear down
|
||||
*/
|
||||
|
|
@ -656,7 +668,7 @@ static const spi_pins* dev_to_spi_pins(spi_dev *dev) {
|
|||
#if BOARD_NR_SPI >= 3
|
||||
case RCC_SPI3: return board_spi_pins + 2;
|
||||
#endif
|
||||
default: return NULL;
|
||||
default: return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -163,6 +163,11 @@ public:
|
|||
*/
|
||||
SPIClass(uint32_t spiPortNumber);
|
||||
|
||||
/**
|
||||
* Init using pins
|
||||
*/
|
||||
SPIClass(int8_t mosi, int8_t miso, int8_t sclk, int8_t ssel=-1);
|
||||
|
||||
/**
|
||||
* @brief Equivalent to begin(SPI_1_125MHZ, MSBFIRST, 0).
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ import sys
|
|||
|
||||
#dynamic build flags for generic compile options
|
||||
if __name__ == "__main__":
|
||||
args = " ".join([ "-std=gnu11",
|
||||
args = " ".join([ "-std=gnu++14",
|
||||
"-Os",
|
||||
"-mcpu=cortex-m3",
|
||||
"-mthumb",
|
||||
|
|
|
|||
|
|
@ -68,7 +68,7 @@ bool PersistentStore::write_data(int &pos, const uint8_t *value, size_t size, ui
|
|||
return false;
|
||||
}
|
||||
|
||||
bool PersistentStore::read_data(int &pos, uint8_t* value, size_t size, uint16_t *crc, const bool writing/*=true*/) {
|
||||
bool PersistentStore::read_data(int &pos, uint8_t *value, size_t size, uint16_t *crc, const bool writing/*=true*/) {
|
||||
do {
|
||||
uint8_t * const p = (uint8_t * const)pos;
|
||||
uint8_t c = eeprom_read_byte(p);
|
||||
|
|
|
|||
|
|
@ -101,7 +101,7 @@ bool PersistentStore::write_data(int &pos, const uint8_t *value, size_t size, ui
|
|||
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*/) {
|
||||
bool PersistentStore::read_data(int &pos, uint8_t *value, const size_t size, uint16_t *crc, const bool writing/*=true*/) {
|
||||
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);
|
||||
|
|
|
|||
|
|
@ -79,7 +79,7 @@ bool PersistentStore::write_data(int &pos, const uint8_t *value, size_t size, ui
|
|||
return false;
|
||||
}
|
||||
|
||||
bool PersistentStore::read_data(int &pos, uint8_t* value, const size_t size, uint16_t *crc, const bool writing/*=true*/) {
|
||||
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 c = HAL_eeprom_data[pos + i];
|
||||
if (writing) value[i] = c;
|
||||
|
|
|
|||
|
|
@ -72,7 +72,7 @@ bool PersistentStore::write_data(int &pos, const uint8_t *value, size_t size, ui
|
|||
return false;
|
||||
}
|
||||
|
||||
bool PersistentStore::read_data(int &pos, uint8_t* value, size_t size, uint16_t *crc, const bool writing/*=true*/) {
|
||||
bool PersistentStore::read_data(int &pos, uint8_t *value, size_t size, uint16_t *crc, const bool writing/*=true*/) {
|
||||
do {
|
||||
uint8_t c = eeprom_read_byte((uint8_t*)pos);
|
||||
if (writing && value) *value = c;
|
||||
|
|
|
|||
68
Marlin/src/HAL/STM32F1/fast_pwm.cpp
Normal file
68
Marlin/src/HAL/STM32F1/fast_pwm.cpp
Normal file
|
|
@ -0,0 +1,68 @@
|
|||
/**
|
||||
* Marlin 3D Printer Firmware
|
||||
* Copyright (c) 2020 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 <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
#ifdef __STM32F1__
|
||||
|
||||
#include "../../inc/MarlinConfigPre.h"
|
||||
|
||||
#if NEEDS_HARDWARE_PWM
|
||||
|
||||
#include <pwm.h>
|
||||
#include "HAL.h"
|
||||
#include "timers.h"
|
||||
|
||||
void set_pwm_frequency(const pin_t pin, int f_desired) {
|
||||
if (!PWM_PIN(pin)) return; // Don't proceed if no hardware timer
|
||||
|
||||
timer_dev *timer = PIN_MAP[pin].timer_device;
|
||||
uint8_t channel = PIN_MAP[pin].timer_channel;
|
||||
|
||||
// Protect used timers
|
||||
if (timer == get_timer_dev(TEMP_TIMER_NUM)) return;
|
||||
if (timer == get_timer_dev(STEP_TIMER_NUM)) return;
|
||||
#if PULSE_TIMER_NUM != STEP_TIMER_NUM
|
||||
if (timer == get_timer_dev(PULSE_TIMER_NUM)) return;
|
||||
#endif
|
||||
|
||||
if (!(timer->regs.bas->SR & TIMER_CR1_CEN)) // Ensure the timer is enabled
|
||||
timer_init(timer);
|
||||
|
||||
timer_set_mode(timer, channel, TIMER_PWM);
|
||||
uint16_t preload = 255; // Lock 255 PWM resolution for high frequencies
|
||||
int32_t prescaler = (HAL_TIMER_RATE) / (preload + 1) / f_desired - 1;
|
||||
if (prescaler > 65535) { // For low frequencies increase prescaler
|
||||
prescaler = 65535;
|
||||
preload = (HAL_TIMER_RATE) / (prescaler + 1) / f_desired - 1;
|
||||
}
|
||||
if (prescaler < 0) return; // Too high frequency
|
||||
timer_set_reload(timer, preload);
|
||||
timer_set_prescaler(timer, prescaler);
|
||||
}
|
||||
|
||||
void set_pwm_duty(const pin_t pin, const uint16_t v, const uint16_t v_size/*=255*/, const bool invert/*=false*/) {
|
||||
timer_dev *timer = PIN_MAP[pin].timer_device;
|
||||
uint16_t max_val = timer->regs.bas->ARR * v / v_size;
|
||||
if (invert) max_val = v_size - max_val;
|
||||
pwmWrite(pin, max_val);
|
||||
}
|
||||
|
||||
#endif // NEEDS_HARDWARE_PWM
|
||||
#endif // __STM32F1__
|
||||
|
|
@ -51,7 +51,7 @@
|
|||
#define IS_INPUT(IO) (_GET_MODE(IO) == GPIO_INPUT_FLOATING || _GET_MODE(IO) == GPIO_INPUT_ANALOG || _GET_MODE(IO) == GPIO_INPUT_PU || _GET_MODE(IO) == GPIO_INPUT_PD)
|
||||
#define IS_OUTPUT(IO) (_GET_MODE(IO) == GPIO_OUTPUT_PP || _GET_MODE(IO) == GPIO_OUTPUT_OD)
|
||||
|
||||
#define PWM_PIN(IO) (PIN_MAP[IO].timer_device != nullptr)
|
||||
#define PWM_PIN(IO) !!PIN_MAP[IO].timer_device
|
||||
|
||||
// digitalRead/Write wrappers
|
||||
#define extDigitalRead(IO) digitalRead(IO)
|
||||
|
|
|
|||
|
|
@ -25,15 +25,6 @@
|
|||
* Test STM32F1-specific configuration values for errors at compile-time.
|
||||
*/
|
||||
|
||||
#if ENABLED(FAST_PWM_FAN) || SPINDLE_LASER_FREQUENCY
|
||||
#error "Features requiring Hardware PWM (FAST_PWM_FAN, SPINDLE_LASER_FREQUENCY) are not yet supported on STM32F1."
|
||||
#endif
|
||||
|
||||
#if !defined(HAVE_SW_SERIAL) && HAS_TMC_SW_SERIAL
|
||||
#warning "With TMC2208/9 consider using SoftwareSerialM with HAVE_SW_SERIAL and appropriate SS_TIMER."
|
||||
#error "Missing SoftwareSerial implementation."
|
||||
#endif
|
||||
|
||||
#if ENABLED(SDCARD_EEPROM_EMULATION) && DISABLED(SDSUPPORT)
|
||||
#undef SDCARD_EEPROM_EMULATION // Avoid additional error noise
|
||||
#if USE_FALLBACK_EEPROM
|
||||
|
|
@ -51,3 +42,10 @@
|
|||
#if ENABLED(NEOPIXEL_LED)
|
||||
#error "NEOPIXEL_LED (Adafruit NeoPixel) is not supported for HAL/STM32F1. Comment out this line to proceed at your own risk!"
|
||||
#endif
|
||||
|
||||
// Emergency Parser needs at least one serial with HardwareSerial or USBComposite.
|
||||
// The USBSerial maple don't allow any hook to implement EMERGENCY_PARSER.
|
||||
// And copy all USBSerial code to marlin space to support EMERGENCY_PARSER, when we have another options, don't worth it.
|
||||
#if ENABLED(EMERGENCY_PARSER) && !defined(USE_USB_COMPOSITE) && ((SERIAL_PORT == -1 && !defined(SERIAL_PORT_2)) || (SERIAL_PORT_2 == -1 && !defined(SERIAL_PORT)))
|
||||
#error "EMERGENCY_PARSER is only supported by HardwareSerial or USBComposite in HAL/STM32F1."
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -49,10 +49,6 @@
|
|||
#undef SDSS
|
||||
#define SDSS SS_PIN
|
||||
|
||||
#if ENABLED(ENABLE_SPI3)
|
||||
#define SPI_DEVICE 3
|
||||
#elif ENABLED(ENABLE_SPI2)
|
||||
#define SPI_DEVICE 2
|
||||
#else
|
||||
#ifndef SPI_DEVICE
|
||||
#define SPI_DEVICE 1
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@
|
|||
#pragma once
|
||||
|
||||
#ifndef LCD_READ_ID
|
||||
#define LCD_READ_ID 0x04 // Read display identification information (0xD3 on ILI9341)
|
||||
#define LCD_READ_ID 0x04 // Read display identification information (0xD3 on ILI9341)
|
||||
#endif
|
||||
#ifndef LCD_READ_ID4
|
||||
#define LCD_READ_ID4 0xD3 // Read display identification information (0xD3 on ILI9341)
|
||||
|
|
@ -30,9 +30,9 @@
|
|||
|
||||
#include <libmaple/dma.h>
|
||||
|
||||
#define DATASIZE_8BIT DMA_SIZE_8BITS
|
||||
#define DATASIZE_16BIT DMA_SIZE_16BITS
|
||||
#define TFT_IO_DRIVER TFT_FSMC
|
||||
#define DATASIZE_8BIT DMA_SIZE_8BITS
|
||||
#define DATASIZE_16BIT DMA_SIZE_16BITS
|
||||
#define TFT_IO_DRIVER TFT_FSMC
|
||||
|
||||
typedef struct {
|
||||
__IO uint16_t REG;
|
||||
|
|
|
|||
|
|
@ -1,6 +1,9 @@
|
|||
/**
|
||||
* Marlin 3D Printer Firmware
|
||||
* Copyright (c) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
|
||||
* Copyright (c) 2020 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
|
||||
|
|
|
|||
|
|
@ -1,6 +1,9 @@
|
|||
/**
|
||||
* Marlin 3D Printer Firmware
|
||||
* Copyright (c) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
|
||||
* Copyright (c) 2020 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
|
||||
|
|
|
|||
|
|
@ -33,6 +33,11 @@
|
|||
#include <libmaple/iwdg.h>
|
||||
#include "watchdog.h"
|
||||
|
||||
/**
|
||||
* The watchdog clock is 40Khz. So for a 4s or 8s interval use a /256 preescaler and 625 or 1250 reload value (counts down to 0).
|
||||
*/
|
||||
#define STM32F1_WD_RELOAD TERN(WATCHDOG_DURATION_8S, 1250, 625) // 4 or 8 second timeout
|
||||
|
||||
void HAL_watchdog_refresh() {
|
||||
#if DISABLED(PINS_DEBUGGING) && PIN_EXISTS(LED)
|
||||
TOGGLE(LED_PIN); // heartbeat indicator
|
||||
|
|
@ -49,7 +54,7 @@ void watchdogSetup() {
|
|||
*
|
||||
* @return No return
|
||||
*
|
||||
* @details The watchdog clock is 40Khz. We need a 4 seconds interval, so use a /256 preescaler and 625 reload value (counts down to 0)
|
||||
* @details The watchdog clock is 40Khz. So for a 4s or 8s interval use a /256 preescaler and 625 or 1250 reload value (counts down to 0).
|
||||
*/
|
||||
void watchdog_init() {
|
||||
#if DISABLED(DISABLE_WATCHDOG_INIT)
|
||||
|
|
|
|||
|
|
@ -27,18 +27,9 @@
|
|||
|
||||
#include <libmaple/iwdg.h>
|
||||
|
||||
/**
|
||||
* The watchdog clock is 40Khz. We need a 4 seconds interval, so use a /256 preescaler and
|
||||
* 625 reload value (counts down to 0)
|
||||
* use 1250 for 8 seconds
|
||||
*/
|
||||
#define STM32F1_WD_RELOAD 625
|
||||
|
||||
// Arduino STM32F1 core now has watchdog support
|
||||
|
||||
// Initialize watchdog with a 4 second countdown time
|
||||
// Initialize watchdog with a 4 or 8 second countdown time
|
||||
void watchdog_init();
|
||||
|
||||
// Reset watchdog. MUST be called at least every 4 seconds after the
|
||||
// first watchdog_init or STM32F1 will reset.
|
||||
// Reset watchdog. MUST be called every 4 or 8 seconds after the
|
||||
// first watchdog_init or the STM32F1 will reset.
|
||||
void HAL_watchdog_refresh();
|
||||
|
|
|
|||
|
|
@ -96,7 +96,7 @@ bool PersistentStore::write_data(int &pos, const uint8_t *value, size_t size, ui
|
|||
return false;
|
||||
}
|
||||
|
||||
bool PersistentStore::read_data(int &pos, uint8_t* value, size_t size, uint16_t *crc, const bool writing/*=true*/) {
|
||||
bool PersistentStore::read_data(int &pos, uint8_t *value, size_t size, uint16_t *crc, const bool writing/*=true*/) {
|
||||
do {
|
||||
uint8_t c = ee_read_byte((uint8_t*)pos);
|
||||
if (writing) *value = c;
|
||||
|
|
|
|||
|
|
@ -62,7 +62,7 @@ bool PersistentStore::write_data(int &pos, const uint8_t *value, size_t size, ui
|
|||
return false;
|
||||
}
|
||||
|
||||
bool PersistentStore::read_data(int &pos, uint8_t* value, size_t size, uint16_t *crc, const bool writing/*=true*/) {
|
||||
bool PersistentStore::read_data(int &pos, uint8_t *value, size_t size, uint16_t *crc, const bool writing/*=true*/) {
|
||||
do {
|
||||
uint8_t c = eeprom_read_byte((uint8_t*)pos);
|
||||
if (writing) *value = c;
|
||||
|
|
|
|||
|
|
@ -25,31 +25,33 @@
|
|||
|
||||
#if ENABLED(USE_WATCHDOG)
|
||||
|
||||
#include "watchdog.h"
|
||||
#include "watchdog.h"
|
||||
|
||||
IWDG_HandleTypeDef hiwdg;
|
||||
#define WDT_TIMEOUT_COUNT TERN(WATCHDOG_DURATION_8S, 8192, 4096) // 4 or 8 second timeout
|
||||
|
||||
void watchdog_init() {
|
||||
hiwdg.Instance = IWDG;
|
||||
hiwdg.Init.Prescaler = IWDG_PRESCALER_32; //32kHz LSI clock and 32x prescalar = 1024Hz IWDG clock
|
||||
hiwdg.Init.Reload = 4095; //4095 counts = 4 seconds at 1024Hz
|
||||
if (HAL_IWDG_Init(&hiwdg) != HAL_OK) {
|
||||
//Error_Handler();
|
||||
}
|
||||
else {
|
||||
#if PIN_EXISTS(LED) && DISABLED(PINS_DEBUGGING)
|
||||
TOGGLE(LED_PIN); // heartbeat indicator
|
||||
#endif
|
||||
}
|
||||
IWDG_HandleTypeDef hiwdg;
|
||||
|
||||
void watchdog_init() {
|
||||
hiwdg.Instance = IWDG;
|
||||
hiwdg.Init.Prescaler = IWDG_PRESCALER_32; // 32kHz LSI clock and 32x prescalar = 1024Hz IWDG clock
|
||||
hiwdg.Init.Reload = WDT_TIMEOUT_COUNT - 1;
|
||||
if (HAL_IWDG_Init(&hiwdg) != HAL_OK) {
|
||||
//Error_Handler();
|
||||
}
|
||||
|
||||
void HAL_watchdog_refresh() {
|
||||
/* Refresh IWDG: reload counter */
|
||||
if (HAL_IWDG_Refresh(&hiwdg) != HAL_OK) {
|
||||
/* Refresh Error */
|
||||
//Error_Handler();
|
||||
}
|
||||
else {
|
||||
#if PIN_EXISTS(LED) && DISABLED(PINS_DEBUGGING)
|
||||
TOGGLE(LED_PIN); // heartbeat indicator
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
void HAL_watchdog_refresh() {
|
||||
/* Refresh IWDG: reload counter */
|
||||
if (HAL_IWDG_Refresh(&hiwdg) != HAL_OK) {
|
||||
/* Refresh Error */
|
||||
//Error_Handler();
|
||||
}
|
||||
}
|
||||
|
||||
#endif // USE_WATCHDOG
|
||||
#endif // STM32GENERIC && (STM32F4 || STM32F7)
|
||||
|
|
|
|||
|
|
@ -57,7 +57,7 @@ bool PersistentStore::write_data(int &pos, const uint8_t *value, size_t size, ui
|
|||
return false;
|
||||
}
|
||||
|
||||
bool PersistentStore::read_data(int &pos, uint8_t* value, size_t size, uint16_t *crc, const bool writing/*=true*/) {
|
||||
bool PersistentStore::read_data(int &pos, uint8_t *value, size_t size, uint16_t *crc, const bool writing/*=true*/) {
|
||||
do {
|
||||
uint8_t c = eeprom_read_byte((uint8_t*)pos);
|
||||
if (writing) *value = c;
|
||||
|
|
|
|||
|
|
@ -27,9 +27,11 @@
|
|||
|
||||
#include "watchdog.h"
|
||||
|
||||
#define WDT_TIMEOUT_MS TERN(WATCHDOG_DURATION_8S, 8000, 4000) // 4 or 8 second timeout
|
||||
|
||||
void watchdog_init() {
|
||||
WDOG_TOVALH = 0;
|
||||
WDOG_TOVALL = 4000;
|
||||
WDOG_TOVALL = WDT_TIMEOUT_MS;
|
||||
WDOG_STCTRLH = WDOG_STCTRLH_WDOGEN;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -61,7 +61,7 @@ bool PersistentStore::write_data(int &pos, const uint8_t *value, size_t size, ui
|
|||
return false;
|
||||
}
|
||||
|
||||
bool PersistentStore::read_data(int &pos, uint8_t* value, size_t size, uint16_t *crc, const bool writing/*=true*/) {
|
||||
bool PersistentStore::read_data(int &pos, uint8_t *value, size_t size, uint16_t *crc, const bool writing/*=true*/) {
|
||||
do {
|
||||
uint8_t c = eeprom_read_byte((uint8_t*)pos);
|
||||
if (writing) *value = c;
|
||||
|
|
|
|||
|
|
@ -27,9 +27,11 @@
|
|||
|
||||
#include "watchdog.h"
|
||||
|
||||
#define WDT_TIMEOUT_MS TERN(WATCHDOG_DURATION_8S, 8000, 4000) // 4 or 8 second timeout
|
||||
|
||||
void watchdog_init() {
|
||||
WDOG_TOVALH = 0;
|
||||
WDOG_TOVALL = 4000;
|
||||
WDOG_TOVALL = WDT_TIMEOUT_MS;
|
||||
WDOG_STCTRLH = WDOG_STCTRLH_WDOGEN;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -66,10 +66,12 @@
|
|||
#ifdef SERIAL_PORT_2
|
||||
#if SERIAL_PORT_2 == -1
|
||||
#define MYSERIAL1 usbSerial
|
||||
#elif SERIAL_PORT_2 == -2
|
||||
#define MYSERIAL1 ethernet.telnetClient
|
||||
#elif WITHIN(SERIAL_PORT_2, 0, 8)
|
||||
#define MYSERIAL1 MSERIAL(SERIAL_PORT_2)
|
||||
#else
|
||||
#error "SERIAL_PORT_2 must be from -1 to 8. Please update your configuration."
|
||||
#error "SERIAL_PORT_2 must be from -2 to 8. Please update your configuration."
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue