Parcourir la source

Merge branch '2.0.x' of github.com:MarlinFirmware/Marlin into ctc-i3-pro-b

Thomas Buck il y a 4 ans
Parent
révision
0ab5bd2ad6
100 fichiers modifiés avec 2972 ajouts et 1972 suppressions
  1. 1
    1
      .github/FUNDING.yml
  2. 26
    10
      .github/ISSUE_TEMPLATE/bug_report.md
  3. 1
    1
      .github/ISSUE_TEMPLATE/feature_request.md
  4. 10
    11
      .github/contributing.md
  5. 6
    11
      .github/issue_template.md
  6. 40
    0
      .github/lock.yml
  7. 4
    0
      .github/pull_request_template.md
  8. 0
    7
      .github/workflows/bad-target.md
  9. 2
    1
      .github/workflows/bump-date.yml
  10. 15
    9
      .github/workflows/check-pr.yml
  11. 27
    0
      .github/workflows/close-stale.yml
  12. 32
    0
      .github/workflows/lock-closed.yml
  13. 28
    9
      .github/workflows/test-builds.yml
  14. 22
    0
      .github/workflows/unlock-reopened.yml
  15. 1
    1
      .gitignore
  16. 4
    5
      LICENSE
  17. 309
    150
      Marlin/Configuration.h
  18. 658
    199
      Marlin/Configuration_adv.h
  19. 201
    95
      Marlin/Makefile
  20. 15
    11
      Marlin/Marlin.ino
  21. 8
    8
      Marlin/Version.h
  22. 1
    1
      Marlin/lib/readme.txt
  23. 1
    2
      Marlin/src/HAL/AVR/HAL.cpp
  24. 22
    246
      Marlin/src/HAL/AVR/HAL.h
  25. 1
    1
      Marlin/src/HAL/AVR/HAL_SPI.cpp
  26. 618
    608
      Marlin/src/HAL/AVR/MarlinSerial.cpp
  27. 38
    24
      Marlin/src/HAL/AVR/MarlinSerial.h
  28. 1
    3
      Marlin/src/HAL/AVR/Servo.cpp
  29. 6
    4
      Marlin/src/HAL/AVR/ServoTimers.h
  30. 13
    6
      Marlin/src/HAL/AVR/eeprom.cpp
  31. 1
    1
      Marlin/src/HAL/AVR/endstop_interrupts.h
  32. 6
    6
      Marlin/src/HAL/AVR/fast_pwm.cpp
  33. 51
    1
      Marlin/src/HAL/AVR/fastio.cpp
  34. 15
    9
      Marlin/src/HAL/AVR/fastio.h
  35. 1
    1
      Marlin/src/HAL/AVR/fastio/fastio_1280.h
  36. 1
    1
      Marlin/src/HAL/AVR/fastio/fastio_1281.h
  37. 1
    1
      Marlin/src/HAL/AVR/fastio/fastio_168.h
  38. 1
    1
      Marlin/src/HAL/AVR/fastio/fastio_644.h
  39. 1
    1
      Marlin/src/HAL/AVR/fastio/fastio_AT90USB.h
  40. 5
    1
      Marlin/src/HAL/AVR/inc/Conditionals_LCD.h
  41. 1
    1
      Marlin/src/HAL/AVR/inc/Conditionals_adv.h
  42. 1
    1
      Marlin/src/HAL/AVR/inc/Conditionals_post.h
  43. 7
    14
      Marlin/src/HAL/AVR/inc/SanityCheck.h
  44. 1
    1
      Marlin/src/HAL/AVR/math.h
  45. 4
    2
      Marlin/src/HAL/AVR/pinsDebug.h
  46. 1
    1
      Marlin/src/HAL/AVR/pinsDebug_Teensyduino.h
  47. 4
    7
      Marlin/src/HAL/AVR/pinsDebug_plus_70.h
  48. 1
    1
      Marlin/src/HAL/AVR/spi_pins.h
  49. 260
    0
      Marlin/src/HAL/AVR/timers.h
  50. 3
    3
      Marlin/src/HAL/AVR/u8g_com_HAL_AVR_sw_spi.cpp
  51. 1
    2
      Marlin/src/HAL/AVR/watchdog.cpp
  52. 1
    1
      Marlin/src/HAL/AVR/watchdog.h
  53. 1
    2
      Marlin/src/HAL/DUE/DebugMonitor.cpp
  54. 3
    4
      Marlin/src/HAL/DUE/HAL.cpp
  55. 23
    54
      Marlin/src/HAL/DUE/HAL.h
  56. 3
    4
      Marlin/src/HAL/DUE/HAL_SPI.cpp
  57. 1
    1
      Marlin/src/HAL/DUE/InterruptVectors.cpp
  58. 1
    1
      Marlin/src/HAL/DUE/InterruptVectors.h
  59. 6
    16
      Marlin/src/HAL/DUE/MarlinSerial.cpp
  60. 5
    7
      Marlin/src/HAL/DUE/MarlinSerial.h
  61. 11
    11
      Marlin/src/HAL/DUE/MarlinSerialUSB.cpp
  62. 10
    4
      Marlin/src/HAL/DUE/MarlinSerialUSB.h
  63. 1
    2
      Marlin/src/HAL/DUE/Servo.cpp
  64. 2
    3
      Marlin/src/HAL/DUE/Tone.cpp
  65. 4
    5
      Marlin/src/HAL/DUE/dogm/u8g_com_HAL_DUE_shared_hw_spi.cpp
  66. 1
    1
      Marlin/src/HAL/DUE/dogm/u8g_com_HAL_DUE_st7920_sw_spi.cpp
  67. 3
    3
      Marlin/src/HAL/DUE/dogm/u8g_com_HAL_DUE_sw_spi.cpp
  68. 3
    3
      Marlin/src/HAL/DUE/dogm/u8g_com_HAL_DUE_sw_spi_shared.cpp
  69. 1
    1
      Marlin/src/HAL/DUE/dogm/u8g_com_HAL_DUE_sw_spi_shared.h
  70. 113
    122
      Marlin/src/HAL/DUE/eeprom_flash.cpp
  71. 16
    21
      Marlin/src/HAL/DUE/eeprom_wired.cpp
  72. 18
    40
      Marlin/src/HAL/DUE/endstop_interrupts.h
  73. 4
    4
      Marlin/src/HAL/DUE/fastio.h
  74. 110
    49
      Marlin/src/HAL/DUE/fastio/G2_PWM.cpp
  75. 1
    1
      Marlin/src/HAL/DUE/fastio/G2_PWM.h
  76. 1
    1
      Marlin/src/HAL/DUE/fastio/G2_pins.h
  77. 5
    1
      Marlin/src/HAL/DUE/inc/Conditionals_LCD.h
  78. 1
    1
      Marlin/src/HAL/DUE/inc/Conditionals_adv.h
  79. 5
    5
      Marlin/src/HAL/DUE/inc/Conditionals_post.h
  80. 3
    3
      Marlin/src/HAL/DUE/inc/SanityCheck.h
  81. 1
    2
      Marlin/src/HAL/DUE/pinsDebug.h
  82. 1
    1
      Marlin/src/HAL/DUE/spi_pins.h
  83. 2
    6
      Marlin/src/HAL/DUE/timers.cpp
  84. 18
    10
      Marlin/src/HAL/DUE/timers.h
  85. 18
    0
      Marlin/src/HAL/DUE/upload_extra_script.py
  86. 2
    2
      Marlin/src/HAL/DUE/usb/arduino_due_x.h
  87. 83
    84
      Marlin/src/HAL/DUE/usb/compiler.h
  88. 1
    1
      Marlin/src/HAL/DUE/usb/conf_access.h
  89. 1
    1
      Marlin/src/HAL/DUE/usb/conf_clock.h
  90. 1
    5
      Marlin/src/HAL/DUE/usb/conf_usb.h
  91. 1
    1
      Marlin/src/HAL/DUE/usb/ctrl_access.c
  92. 1
    1
      Marlin/src/HAL/DUE/usb/ctrl_access.h
  93. 1
    1
      Marlin/src/HAL/DUE/usb/genclk.h
  94. 1
    1
      Marlin/src/HAL/DUE/usb/mrepeat.h
  95. 1
    1
      Marlin/src/HAL/DUE/usb/osc.h
  96. 1
    1
      Marlin/src/HAL/DUE/usb/pll.h
  97. 1
    1
      Marlin/src/HAL/DUE/usb/preprocessor.h
  98. 1
    1
      Marlin/src/HAL/DUE/usb/sbc_protocol.h
  99. 1
    1
      Marlin/src/HAL/DUE/usb/sd_mmc_spi_mem.h
  100. 0
    0
      Marlin/src/HAL/DUE/usb/spc_protocol.h

+ 1
- 1
.github/FUNDING.yml Voir le fichier

@@ -1,3 +1,3 @@
1 1
 github: [thinkyhead]
2 2
 patreon: thinkyhead
3
-custom: ["http://www.thinkyhead.com/donate-to-marlin"]
3
+custom: ["https://www.thinkyhead.com/donate-to-marlin"]

+ 26
- 10
.github/ISSUE_TEMPLATE/bug_report.md Voir le fichier

@@ -9,35 +9,51 @@ assignees: ''
9 9
 
10 10
 <!--
11 11
 
12
-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
12
+Please follow the instructions below. Failure to do so may result in your issue being closed.
13 13
 
14
-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
14
+### Before Reporting a Bug
15 15
 
16
-Before filing an issue be sure to test the "bugfix" branches to see whether the issue has been resolved.
16
+1. Test with the `bugfix-2.0.x` branch to see whether the issue still exists.
17
+
18
+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
19
+
20
+### Instructions
21
+
22
+1. Fill out every section of the template below.
23
+
24
+2. Always attach configuration files, regardless of whether you think they are involved.
25
+
26
+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
17 27
 
18 28
 -->
19 29
 
20 30
 ### Bug Description
21 31
 
22
-<!-- Description of the bug -->
32
+<!-- Describe the bug in this section. (You can remove this invisible comment.) -->
33
+
34
+### Configuration Files
23 35
 
24
-### My Configurations
36
+**Required:** Include a ZIP file containing `Configuration.h` and `Configuration_adv.h`.
25 37
 
26
-**Required:** Please include a ZIP file containing your `Configuration.h` and `Configuration_adv.h` files.
38
+If you've made any other modifications describe them in detail here.
27 39
 
28 40
 ### Steps to Reproduce
29 41
 
30
-<!-- Please describe the steps needed to reproduce the issue -->
42
+<!-- Describe the steps needed to reproduce the issue. (You can remove this invisible comment.) -->
31 43
 
32 44
 1. [First Step]
33 45
 2. [Second Step]
34 46
 3. [and so on...]
35 47
 
36
-**Expected behavior:** [What you expect to happen]
48
+**Expected behavior:**
49
+
50
+<!-- Describe what you expected to happen here. (You can remove this invisible comment.) -->
51
+
52
+**Actual behavior:**
37 53
 
38
-**Actual behavior:** [What actually happens]
54
+<!-- Describe what actually happens here. (You can remove this invisible comment.) -->
39 55
 
40 56
 #### Additional Information
41 57
 
42 58
 * Provide pictures or links to videos that clearly demonstrate the issue.
43
-* See [How Can I Contribute](#how-can-i-contribute) for additional guidelines.
59
+* See [Contributing to Marlin](https://github.com/MarlinFirmware/Marlin/blob/2.0.x/.github/contributing.md) for additional guidelines.

+ 1
- 1
.github/ISSUE_TEMPLATE/feature_request.md Voir le fichier

@@ -2,7 +2,7 @@
2 2
 name: Feature request
3 3
 about: Request a Feature
4 4
 title: "[FR] (feature request title)"
5
-labels: ''
5
+labels: 'T: Feature Request'
6 6
 assignees: ''
7 7
 
8 8
 ---

+ 10
- 11
.github/contributing.md Voir le fichier

@@ -34,16 +34,15 @@ This project and everyone participating in it is governed by the [Marlin Code of
34 34
 
35 35
 We have a Message Board and a Facebook group where our knowledgable user community can provide helpful advice if you have questions.
36 36
 
37
-* [Marlin RepRap forum](http://forums.reprap.org/list.php?415)
37
+* [Marlin RepRap forum](https://reprap.org/forum/list.php?415)
38 38
 * [MarlinFirmware on Facebook](https://www.facebook.com/groups/1049718498464482/)
39 39
 
40
-If chat is more your speed, you can join the MarlinFirmware Slack team:
40
+If chat is more your speed, you can join the MarlinFirmware Discord server:
41 41
 
42
-* Join the Marlin Slack Team
43
-  * To obtain group access, please [send a request](http://www.thinkyhead.com/contact/9) to @thinkyhead.
44
-  * Even though Slack is a chat service, sometimes it takes several hours for community members to respond &mdash; please be patient!
45
-  * Use the `#general` channel for general questions or discussion about Marlin.
46
-  * Other channels exist for certain topics. Check the channel list.
42
+* Use the link https://discord.gg/n5NJ59y to join up as a General User.
43
+* Even though our Discord is pretty active, it may take a while for community members to respond &mdash; please be patient!
44
+* Use the `#general` channel for general questions or discussion about Marlin.
45
+* Other channels exist for certain topics or are limited to Patrons. Check the channel list.
47 46
 
48 47
 ## How Can I Contribute?
49 48
 
@@ -93,7 +92,7 @@ Before creating a suggestion, please check [this list](#before-submitting-a-sugg
93 92
 
94 93
 #### Before Submitting a Feature Request
95 94
 
96
-* **Check the [Marlin website](http://marlinfw.org/)** for tips — you might discover that the feature is already included. Most importantly, check if you're using [the latest version of Marlin](https://github.com/MarlinFirmware/Marlin/releases) and if you can get the desired behavior by changing [Marlin's config settings](http://marlinfw.org/docs/configuration/configuration.html).
95
+* **Check the [Marlin website](https://marlinfw.org/)** for tips — you might discover that the feature is already included. Most importantly, check if you're using [the latest version of Marlin](https://github.com/MarlinFirmware/Marlin/releases) and if you can get the desired behavior by changing [Marlin's config settings](https://marlinfw.org/docs/configuration/configuration.html).
97 96
 * **Perform a [cursory search](https://github.com/MarlinFirmware/Marlin/issues?q=is%3Aissue)** to see if the enhancement has already been suggested. If it has, add a comment to the existing issue instead of opening a new one.
98 97
 
99 98
 #### How Do I Submit A (Good) Feature Request?
@@ -117,12 +116,12 @@ Unsure where to begin contributing to Marlin? You can start by looking through t
117 116
 
118 117
 ### Pull Requests
119 118
 
120
-Pull Requests should always be targeted to working branches (e.g., `bugfix-1.1.x` and/or `bugfix-2.0.x`) and never to release branches (e.g., `1.1.x`). If this is your first Pull Request, please read our [Guide to Pull Requests](http://marlinfw.org/docs/development/getting_started_pull_requests.html) and Github's [Pull Request](https://help.github.com/articles/creating-a-pull-request/) documentation.
119
+Pull Requests should always be targeted to working branches (e.g., `bugfix-1.1.x` and/or `bugfix-2.0.x`) and never to release branches (e.g., `1.1.x`). If this is your first Pull Request, please read our [Guide to Pull Requests](https://marlinfw.org/docs/development/getting_started_pull_requests.html) and Github's [Pull Request](https://help.github.com/articles/creating-a-pull-request/) documentation.
121 120
 
122 121
 * Fill in [the required template](pull_request_template.md).
123 122
 * Don't include issue numbers in the PR title.
124 123
 * Include pictures, diagrams, and links to videos in your Pull Request to demonstrate your changes, if needed.
125
-* Follow the [Coding Standards](http://marlinfw.org/docs/development/coding_standards.html) posted on our website.
124
+* Follow the [Coding Standards](https://marlinfw.org/docs/development/coding_standards.html) posted on our website.
126 125
 * Document new code with clear and concise comments.
127 126
 * End all files with a newline.
128 127
 
@@ -137,7 +136,7 @@ Pull Requests should always be targeted to working branches (e.g., `bugfix-1.1.x
137 136
 
138 137
 ### C++ Coding Standards
139 138
 
140
-* Please read and follow the [Coding Standards](http://marlinfw.org/docs/development/coding_standards.html) posted on our website. Failure to follow these guidelines will delay evaluation and acceptance of Pull Requests.
139
+* Please read and follow the [Coding Standards](https://marlinfw.org/docs/development/coding_standards.html) posted on our website. Failure to follow these guidelines will delay evaluation and acceptance of Pull Requests.
141 140
 
142 141
 ### Documentation
143 142
 

+ 6
- 11
.github/issue_template.md Voir le fichier

@@ -1,16 +1,11 @@
1 1
 # NO SUPPORT REQUESTS PLEASE
2 2
 
3
-Support Requests posted here will be automatically closed!
3
+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!
4 4
 
5
-This Issue Queue is for Marlin bug reports and development-related issues, and we prefer not to handle user-support questions here. See https://github.com/MarlinFirmware/Marlin/blob/1.1.x/.github/contributing.md#i-dont-want-to-read-this-whole-thing-i-just-have-a-question.
5
+Instead use one of the following options:
6 6
 
7
-For best results getting help with configuration and troubleshooting, please use the following resources:
7
+- The Marlin Firmware forum at https://reprap.org/forum/list.php?415
8
+- The MarlinFirmware Facebook Group at https://www.facebook.com/groups/1049718498464482/
9
+- The MarlinFirmware Discord Server at https://discord.gg/n5NJ59y.
8 10
 
9
-- RepRap.org Marlin Forum http://forums.reprap.org/list.php?415
10
-- Tom's 3D Forums https://discuss.toms3d.org/
11
-- Facebook Group "Marlin Firmware" https://www.facebook.com/groups/1049718498464482/
12
-- Facebook Group "Marlin Firmware for 3D Printers" https://www.facebook.com/groups/3Dtechtalk/
13
-- Marlin Configuration https://www.youtube.com/results?search_query=marlin+configuration on YouTube
14
-- Marlin Discord server. Join link: https://discord.gg/n5NJ59y
15
-
16
-After seeking help from the community, if the consensus points to to a bug in Marlin, then you should post a Bug Report at https://github.com/MarlinFirmware/Marlin/issues/new/choose).
11
+Before filing an issue be sure to test the latest "bugfix" branch to see whether the issue is already addressed.

+ 40
- 0
.github/lock.yml Voir le fichier

@@ -0,0 +1,40 @@
1
+#
2
+# Configuration for Lock Threads - https://github.com/dessant/lock-threads-app
3
+#
4
+
5
+# Number of days of inactivity before a closed issue or pull request is locked
6
+daysUntilLock: 60
7
+
8
+# Skip issues and pull requests created before a given timestamp. Timestamp must
9
+# follow ISO 8601 (`YYYY-MM-DD`). Set to `false` to disable
10
+skipCreatedBefore: false
11
+
12
+# Issues and pull requests with these labels will be ignored. Set to `[]` to disable
13
+exemptLabels: [ 'no-locking' ]
14
+
15
+# Label to add before locking, such as `outdated`. Set to `false` to disable
16
+lockLabel: false
17
+
18
+# Comment to post before locking. Set to `false` to disable
19
+lockComment: >
20
+  This thread has been automatically locked since there has not been
21
+  any recent activity after it was closed. Please open a new issue for
22
+  related bugs.
23
+
24
+# Assign `resolved` as the reason for locking. Set to `false` to disable
25
+setLockReason: true
26
+
27
+# Limit to only `issues` or `pulls`
28
+# only: issues
29
+
30
+# Optionally, specify configuration settings just for `issues` or `pulls`
31
+# issues:
32
+#   exemptLabels:
33
+#     - help-wanted
34
+#   lockLabel: outdated
35
+
36
+# pulls:
37
+#   daysUntilLock: 30
38
+
39
+# Repository to extend settings from
40
+# _extends: repo

+ 4
- 0
.github/pull_request_template.md Voir le fichier

@@ -14,6 +14,10 @@ We must be able to understand your proposed change from this description. If we
14 14
 
15 15
 <!-- What does this fix or improve? -->
16 16
 
17
+### Configurations
18
+
19
+<!-- Attach any Configuration.h, Configuration_adv.h, or platformio.ini files needed to compile/test your Pull Request. -->
20
+
17 21
 ### Related Issues
18 22
 
19 23
 <!-- Whether this fixes a bug or fulfills a feature request, please list any related Issues here. -->

+ 0
- 7
.github/workflows/bad-target.md Voir le fichier

@@ -1,7 +0,0 @@
1
-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.
2
-
3
-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.
4
-
5
-It may help to set your fork's default branch to `bugfix-2.0.x`.
6
-
7
-See [this page](http://marlinfw.org/docs/development/getting_started_pull_requests.html) for full instructions.

+ 2
- 1
.github/workflows/bump-date.yml Voir le fichier

@@ -11,6 +11,8 @@ on:
11 11
 
12 12
 jobs:
13 13
   bump_date:
14
+    name: Bump Distribution Date
15
+    if: github.repository == 'MarlinFirmware/Marlin'
14 16
 
15 17
     runs-on: ubuntu-latest
16 18
 
@@ -24,7 +26,6 @@ jobs:
24 26
     - name: Bump Distribution Date
25 27
       run: |
26 28
         # Inline Bump Script
27
-        [[ "$GITHUB_REPOSITORY" == "MarlinFirmware/Marlin" ]] || exit 0
28 29
         DIST=$( date +"%Y-%m-%d" )
29 30
         eval "sed -E -i 's/(#define +STRING_DISTRIBUTION_DATE) .*$/\1 \"$DIST\"/g' Marlin/src/inc/Version.h" && \
30 31
         git config user.name "${GITHUB_ACTOR}" && \

+ 15
- 9
.github/workflows/check-pr.yml Voir le fichier

@@ -1,6 +1,6 @@
1 1
 #
2
-# comment-pr.yml
3
-# Add a comment to any PR directed to a release branch
2
+# check-pr.yml
3
+# Close PRs directed at release branches
4 4
 #
5 5
 
6 6
 name: PR Bad Target
@@ -14,14 +14,20 @@ on:
14 14
 
15 15
 jobs:
16 16
   bad_target:
17
-
18 17
     name: PR Bad Target
18
+    if: github.repository == 'MarlinFirmware/Marlin'
19
+
19 20
     runs-on: ubuntu-latest
20 21
 
21 22
     steps:
22
-      - uses: actions/checkout@v1
23
-      - uses: harupy/comment-on-pr@master
24
-        env:
25
-          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
26
-        with:
27
-          filename: bad-target.md
23
+    - uses: peter-evans/close-pull@v1
24
+      with:
25
+        delete-branch: false
26
+        comment: >
27
+          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.
28
+
29
+          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.
30
+
31
+          It may help to set your fork's default branch to `bugfix-2.0.x`.
32
+
33
+          See [this page](http://marlinfw.org/docs/development/getting_started_pull_requests.html) for full instructions.

+ 27
- 0
.github/workflows/close-stale.yml Voir le fichier

@@ -0,0 +1,27 @@
1
+#
2
+# close-stale.yml
3
+# Close open issues after a period of inactivity
4
+#
5
+
6
+name: Close Stale Issues
7
+
8
+on:
9
+  schedule:
10
+  - cron: "22 1 * * *"
11
+
12
+jobs:
13
+  stale:
14
+    name: Close Stale Issues
15
+    if: github.repository == 'MarlinFirmware/Marlin'
16
+
17
+    runs-on: ubuntu-latest
18
+
19
+    steps:
20
+    - uses: actions/stale@v3
21
+      with:
22
+        repo-token: ${{ secrets.GITHUB_TOKEN }}
23
+        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.'
24
+        days-before-stale: 30
25
+        days-before-close: 7
26
+        stale-issue-label: 'stale-closing-soon'
27
+        exempt-issue-labels: 'T: Feature Request'

+ 32
- 0
.github/workflows/lock-closed.yml Voir le fichier

@@ -0,0 +1,32 @@
1
+#
2
+# lock-closed.yml
3
+# Lock closed issues after a period of inactivity
4
+#
5
+
6
+name: Lock Closed Issues
7
+
8
+on:
9
+  schedule:
10
+    - cron: '0 1/13 * * *'
11
+
12
+jobs:
13
+  lock:
14
+    name: Lock Closed Issues
15
+    if: github.repository == 'MarlinFirmware/Marlin'
16
+
17
+    runs-on: ubuntu-latest
18
+
19
+    steps:
20
+    - uses: dessant/lock-threads@v2
21
+      with:
22
+        github-token: ${{ github.token }}
23
+        process-only: 'issues'
24
+        issue-lock-inactive-days: '60'
25
+        issue-exclude-created-before: ''
26
+        issue-exclude-labels: 'no-locking'
27
+        issue-lock-labels: ''
28
+        issue-lock-comment: >
29
+          This issue has been automatically locked since there
30
+          has not been any recent activity after it was closed.
31
+          Please open a new issue for related bugs.
32
+        issue-lock-reason: ''

+ 28
- 9
.github/workflows/test-builds.yml Voir le fichier

@@ -9,7 +9,14 @@ on:
9 9
   pull_request:
10 10
     branches:
11 11
     - bugfix-2.0.x
12
-    - dev-2.1.x
12
+    paths-ignore:
13
+    - config/**
14
+    - data/**
15
+    - docs/**
16
+    - '**/*.md'
17
+  push:
18
+    branches:
19
+    - bugfix-2.0.x
13 20
     paths-ignore:
14 21
     - config/**
15 22
     - data/**
@@ -18,6 +25,8 @@ on:
18 25
 
19 26
 jobs:
20 27
   test_builds:
28
+    name: Run All Tests
29
+    if: github.repository == 'MarlinFirmware/Marlin'
21 30
 
22 31
     runs-on: ubuntu-latest
23 32
 
@@ -32,6 +41,7 @@ jobs:
32 41
         - mega2560
33 42
         - teensy31
34 43
         - teensy35
44
+        - teensy41
35 45
         - SAMD51_grandcentral_m4
36 46
 
37 47
         # Extended AVR Environments
@@ -49,14 +59,28 @@ jobs:
49 59
         - STM32F103RE_btt
50 60
         - STM32F103RE_btt_USB
51 61
         - STM32F103RC_fysetc
62
+        - STM32F103RC_meeb
52 63
         - jgaurora_a5s_a1
53 64
         - STM32F103VE_longer
54 65
         - STM32F407VE_black
66
+        - STM32F401VE_STEVAL
67
+        - BIGTREE_BTT002
55 68
         - BIGTREE_SKR_PRO
56 69
         - BIGTREE_GTR_V1_0
57 70
         - mks_robin
71
+        - mks_robin_stm32
58 72
         - ARMED
59 73
         - FYSETC_S6
74
+        - STM32F070CB_malyan
75
+        - STM32F070RB_malyan
76
+        - malyan_M300
77
+        - mks_robin_lite
78
+        - FLYF407ZG
79
+        - rumba32
80
+        - mks_robin_pro
81
+        - STM32F103RET6_creality
82
+        - LERDGEX
83
+        - mks_robin_nano35
60 84
 
61 85
         # Put lengthy tests last
62 86
 
@@ -69,14 +93,10 @@ jobs:
69 93
         #- STM32F7
70 94
 
71 95
         # Non-working environment tests
72
-
73
-        #- BIGTREE_BTT002
74 96
         #- at90usb1286_cdc
75 97
         #- at90usb1286_dfu
76 98
         #- STM32F103CB_malyan
77
-        #- mks_robin_lite
78 99
         #- mks_robin_mini
79
-        #- mks_robin_nano
80 100
 
81 101
     steps:
82 102
 
@@ -88,7 +108,7 @@ jobs:
88 108
 
89 109
     - name: Install PlatformIO
90 110
       run: |
91
-        pip install -U https://github.com/platformio/platformio-core/archive/master.zip
111
+        pip install -U https://github.com/platformio/platformio-core/archive/develop.zip
92 112
         platformio update
93 113
 
94 114
     - name: Check out the PR
@@ -97,8 +117,7 @@ jobs:
97 117
     - name: Run ${{ matrix.test-platform }} Tests
98 118
       run: |
99 119
         # Inline tests script
100
-        [[ "$GITHUB_REPOSITORY" == "MarlinFirmware/Marlin" ]] || exit 0
101 120
         chmod +x buildroot/bin/*
102
-        chmod +x buildroot/share/tests/*
103
-        export PATH=./buildroot/bin/:./buildroot/share/tests/:${PATH}
121
+        chmod +x buildroot/tests/*
122
+        export PATH=./buildroot/bin/:./buildroot/tests/:${PATH}
104 123
         run_tests . ${{ matrix.test-platform }}

+ 22
- 0
.github/workflows/unlock-reopened.yml Voir le fichier

@@ -0,0 +1,22 @@
1
+#
2
+# unlock-reopened.yml
3
+# Unlock an issue whenever it is re-opened
4
+#
5
+
6
+name: "Unlock reopened issue"
7
+
8
+on:
9
+  issues:
10
+    types: [reopened]
11
+
12
+jobs:
13
+  unlock:
14
+    name: Unlock Reopened
15
+    if: github.repository == 'MarlinFirmware/Marlin'
16
+
17
+    runs-on: ubuntu-latest
18
+
19
+    steps:
20
+    - uses: OSDKDev/unlock-issues@v1.1
21
+      with:
22
+        repo-token: "${{ secrets.GITHUB_TOKEN }}"

+ 1
- 1
.gitignore Voir le fichier

@@ -16,7 +16,7 @@
16 16
 # GNU General Public License for more details.
17 17
 #
18 18
 # You should have received a copy of the GNU General Public License
19
-# along with this program.  If not, see <http://www.gnu.org/licenses/>.
19
+# along with this program.  If not, see <https://www.gnu.org/licenses/>.
20 20
 #
21 21
 
22 22
 # Our automatic versioning scheme generates the following file

+ 4
- 5
LICENSE Voir le fichier

@@ -3,7 +3,7 @@
3 3
                     GNU GENERAL PUBLIC LICENSE
4 4
                        Version 3, 29 June 2007
5 5
 
6
- Copyright (c) 2007 Free Software Foundation, Inc. <http://fsf.org/>
6
+ Copyright (c) 2007 Free Software Foundation, Inc. <https://www.fsf.org/>
7 7
  Everyone is permitted to copy and distribute verbatim copies
8 8
  of this license document, but changing it is not allowed.
9 9
 
@@ -647,7 +647,7 @@ the "copyright" line and a pointer to where the full notice is found.
647 647
     GNU General Public License for more details.
648 648
 
649 649
     You should have received a copy of the GNU General Public License
650
-    along with this program.  If not, see <http://www.gnu.org/licenses/>.
650
+    along with this program.  If not, see <https://www.gnu.org/licenses/>.
651 651
 
652 652
 Also add information on how to contact you by electronic and paper mail.
653 653
 
@@ -666,12 +666,11 @@ might be different; for a GUI interface, you would use an "about box".
666 666
   You should also get your employer (if you work as a programmer) or school,
667 667
 if any, to sign a "copyright disclaimer" for the program, if necessary.
668 668
 For more information on this, and how to apply and follow the GNU GPL, see
669
-<http://www.gnu.org/licenses/>.
669
+<https://www.gnu.org/licenses/>.
670 670
 
671 671
   The GNU General Public License does not permit incorporating your program
672 672
 into proprietary programs.  If your program is a subroutine library, you
673 673
 may consider it more useful to permit linking proprietary applications with
674 674
 the library.  If this is what you want to do, use the GNU Lesser General
675 675
 Public License instead of this License.  But first, please read
676
-<http://www.gnu.org/philosophy/why-not-lgpl.html>.
677
-
676
+<https://www.gnu.org/licenses/why-not-lgpl.html>.

+ 309
- 150
Marlin/Configuration.h
Fichier diff supprimé car celui-ci est trop grand
Voir le fichier


+ 658
- 199
Marlin/Configuration_adv.h
Fichier diff supprimé car celui-ci est trop grand
Voir le fichier


+ 201
- 95
Marlin/Makefile Voir le fichier

@@ -14,7 +14,7 @@
14 14
 # Detailed instructions for using the makefile:
15 15
 #
16 16
 #  1. Modify the line containing "ARDUINO_INSTALL_DIR" to point to the directory that
17
-#     contains the Arduino installation (for example, under Mac OS X, this
17
+#     contains the Arduino installation (for example, under macOS, this
18 18
 #     might be /Applications/Arduino.app/Contents/Resources/Java).
19 19
 #
20 20
 #  2. Modify the line containing "UPLOAD_PORT" to refer to the filename
@@ -22,8 +22,10 @@
22 22
 #     (e.g. UPLOAD_PORT = /dev/tty.USB0).  If the exact name of this file
23 23
 #     changes, you can use * as a wild card (e.g. UPLOAD_PORT = /dev/tty.usb*).
24 24
 #
25
-#  3. Set the line containing "MCU" to match your board's processor.
26
-#     Older one's are atmega8 based, newer ones like Arduino Mini, Bluetooth
25
+#  3. Set the line containing "MCU" to match your board's processor. Set
26
+#     "PROG_MCU" as the AVR part name corresponding to "MCU". You can use the
27
+#     following command to get a list of correspondences: `avrdude -c alf -p x`
28
+#     Older boards are atmega8 based, newer ones like Arduino Mini, Bluetooth
27 29
 #     or Diecimila have the atmega168.  If you're using a LilyPad Arduino,
28 30
 #     change F_CPU to 8000000. If you are using Gen7 electronics, you
29 31
 #     probably need to use 20000000. Either way, you must regenerate
@@ -34,18 +36,18 @@
34 36
 #  5. Type "make upload", reset your Arduino board, and press enter to
35 37
 #     upload your program to the Arduino board.
36 38
 #
37
-# Note that all settings at the top of this file can be overriden from
39
+# Note that all settings at the top of this file can be overridden from
38 40
 # the command line with, for example, "make HARDWARE_MOTHERBOARD=71"
39 41
 #
40 42
 # To compile for RAMPS (atmega2560) with Arduino 1.6.9 at root/arduino you would use...
41 43
 #
42 44
 #   make ARDUINO_VERSION=10609 AVR_TOOLS_PATH=/root/arduino/hardware/tools/avr/bin/ \
43
-#   HARDWARE_MOTHERBOARD=33 ARDUINO_INSTALL_DIR=/root/arduino
45
+#   HARDWARE_MOTHERBOARD=1200 ARDUINO_INSTALL_DIR=/root/arduino
44 46
 #
45 47
 # To compile and upload simply add "upload" to the end of the line...
46 48
 #
47 49
 #   make ARDUINO_VERSION=10609 AVR_TOOLS_PATH=/root/arduino/hardware/tools/avr/bin/ \
48
-#   HARDWARE_MOTHERBOARD=33 ARDUINO_INSTALL_DIR=/root/arduino upload
50
+#   HARDWARE_MOTHERBOARD=1200 ARDUINO_INSTALL_DIR=/root/arduino upload
49 51
 #
50 52
 # If uploading doesn't work try adding the parameter "AVRDUDE_PROGRAMMER=wiring" or
51 53
 # start upload manually (using stk500) like so:
@@ -57,7 +59,26 @@
57 59
 #
58 60
 
59 61
 # This defines the board to compile for (see boards.h for your board's ID)
60
-HARDWARE_MOTHERBOARD ?= 11
62
+HARDWARE_MOTHERBOARD ?= 1020
63
+
64
+ifeq ($(OS),Windows_NT)
65
+  # Windows
66
+  ARDUINO_INSTALL_DIR ?= ${HOME}/Arduino
67
+  ARDUINO_USER_DIR ?= ${HOME}/Arduino
68
+else
69
+  UNAME_S := $(shell uname -s)
70
+  ifeq ($(UNAME_S),Linux)
71
+    # Linux
72
+    ARDUINO_INSTALL_DIR ?= /usr/share/arduino
73
+    ARDUINO_USER_DIR ?= ${HOME}/Arduino
74
+  endif
75
+  ifeq ($(UNAME_S),Darwin)
76
+    # Darwin (macOS)
77
+    ARDUINO_INSTALL_DIR ?= /Applications/Arduino.app/Contents/Java
78
+    ARDUINO_USER_DIR ?= ${HOME}/Documents/Arduino
79
+    AVR_TOOLS_PATH ?= /Applications/Arduino.app/Contents/Java/hardware/tools/avr/bin/
80
+  endif
81
+endif
61 82
 
62 83
 # Arduino source install directory, and version number
63 84
 # On most linuxes this will be /usr/share/arduino
@@ -67,38 +88,44 @@ ARDUINO_VERSION      ?= 106
67 88
 # The installed Libraries are in the User folder
68 89
 ARDUINO_USER_DIR ?= ${HOME}/Arduino
69 90
 
70
-# You can optionally set a path to the avr-gcc tools. Requires a trailing slash. (ex: /usr/local/avr-gcc/bin)
91
+# You can optionally set a path to the avr-gcc tools.
92
+# Requires a trailing slash. For example, /usr/local/avr-gcc/bin/
71 93
 AVR_TOOLS_PATH ?=
72 94
 
73
-#Programmer configuration
95
+# Programmer configuration
74 96
 UPLOAD_RATE        ?= 57600
75 97
 AVRDUDE_PROGRAMMER ?= arduino
76
-# on most linuxes this will be /dev/ttyACM0 or /dev/ttyACM1
98
+# On most linuxes this will be /dev/ttyACM0 or /dev/ttyACM1
77 99
 UPLOAD_PORT        ?= /dev/ttyUSB0
78 100
 
79
-#Directory used to build files in, contains all the build files, from object files to the final hex file
80
-#on linux it is best to put an absolute path like /home/username/tmp .
101
+# Directory used to build files in, contains all the build files, from object
102
+# files to the final hex file on linux it is best to put an absolute path
103
+# like /home/username/tmp .
81 104
 BUILD_DIR          ?= applet
82 105
 
83 106
 # This defines whether Liquid_TWI2 support will be built
84 107
 LIQUID_TWI2        ?= 0
85 108
 
86
-# this defines if Wire is needed
109
+# This defines if Wire is needed
87 110
 WIRE               ?= 0
88 111
 
89
-# this defines if U8GLIB is needed (may require RELOC_WORKAROUND)
90
-U8GLIB             ?= 1
112
+# This defines if Tone is needed (i.e SPEAKER is defined in Configuration.h)
113
+# Disabling this (and SPEAKER) saves approximatively 350 bytes of memory.
114
+TONE               ?= 1
115
+
116
+# This defines if U8GLIB is needed (may require RELOC_WORKAROUND)
117
+U8GLIB             ?= 0
91 118
 
92
-# this defines whether to include the Trinamic TMCStepper library
93
-TMC                ?= 1
119
+# This defines whether to include the Trinamic TMCStepper library
120
+TMC                ?= 0
94 121
 
95
-# this defines whether to include the AdaFruit NeoPixel library
122
+# This defines whether to include the AdaFruit NeoPixel library
96 123
 NEOPIXEL           ?= 0
97 124
 
98 125
 ############
99 126
 # Try to automatically determine whether RELOC_WORKAROUND is needed based
100 127
 # on GCC versions:
101
-#   http://www.avrfreaks.net/comment/1789106#comment-1789106
128
+#   https://www.avrfreaks.net/comment/1789106#comment-1789106
102 129
 
103 130
 CC_MAJ:=$(shell $(CC) -dM -E - < /dev/null | grep __GNUC__ | cut -f3 -d\ )
104 131
 CC_MIN:=$(shell $(CC) -dM -E - < /dev/null | grep __GNUC_MINOR__ | cut -f3 -d\ )
@@ -170,103 +197,115 @@ else ifeq ($(HARDWARE_MOTHERBOARD),1100)
170 197
 else ifeq ($(HARDWARE_MOTHERBOARD),1101)
171 198
 # Velleman K8400 Controller (derived from 3Drag Controller)
172 199
 else ifeq ($(HARDWARE_MOTHERBOARD),1102)
173
-# 2PrintBeta BAM&DICE with STK drivers
200
+# Velleman K8600 Controller (Vertex Nano)
174 201
 else ifeq ($(HARDWARE_MOTHERBOARD),1103)
175
-# 2PrintBeta BAM&DICE Due with STK drivers
202
+# Velleman K8800 Controller (Vertex Delta)
176 203
 else ifeq ($(HARDWARE_MOTHERBOARD),1104)
177
-# MKS BASE v1.0
204
+# 2PrintBeta BAM&DICE with STK drivers
178 205
 else ifeq ($(HARDWARE_MOTHERBOARD),1105)
179
-# MKS v1.4 with A4982 stepper drivers
206
+# 2PrintBeta BAM&DICE Due with STK drivers
180 207
 else ifeq ($(HARDWARE_MOTHERBOARD),1106)
181
-# MKS v1.5 with Allegro A4982 stepper drivers
208
+# MKS BASE v1.0
182 209
 else ifeq ($(HARDWARE_MOTHERBOARD),1107)
183
-# MKS v1.6 with Allegro A4982 stepper drivers
210
+# MKS v1.4 with A4982 stepper drivers
184 211
 else ifeq ($(HARDWARE_MOTHERBOARD),1108)
185
-
186
-# MKS BASE 1.0 with Heroic HR4982 stepper drivers
212
+# MKS v1.5 with Allegro A4982 stepper drivers
187 213
 else ifeq ($(HARDWARE_MOTHERBOARD),1109)
188
-# MKS GEN v1.3 or 1.4
214
+# MKS v1.6 with Allegro A4982 stepper drivers
189 215
 else ifeq ($(HARDWARE_MOTHERBOARD),1110)
190
-# MKS GEN L
216
+# MKS BASE 1.0 with Heroic HR4982 stepper drivers
191 217
 else ifeq ($(HARDWARE_MOTHERBOARD),1111)
192
-# zrib V2.0 control board (Chinese knock off RAMPS replica)
218
+# MKS GEN v1.3 or 1.4
193 219
 else ifeq ($(HARDWARE_MOTHERBOARD),1112)
194
-# BigTreeTech or BIQU KFB2.0
220
+# MKS GEN L
195 221
 else ifeq ($(HARDWARE_MOTHERBOARD),1113)
196
-# Felix 2.0+ Electronics Board (RAMPS like)
222
+# zrib V2.0 control board (Chinese knock off RAMPS replica)
197 223
 else ifeq ($(HARDWARE_MOTHERBOARD),1114)
198
-# Invent-A-Part RigidBoard
224
+# BigTreeTech or BIQU KFB2.0
199 225
 else ifeq ($(HARDWARE_MOTHERBOARD),1115)
200
-# Invent-A-Part RigidBoard V2
226
+# Felix 2.0+ Electronics Board (RAMPS like)
201 227
 else ifeq ($(HARDWARE_MOTHERBOARD),1116)
202
-# Sainsmart 2-in-1 board
228
+# Invent-A-Part RigidBoard
203 229
 else ifeq ($(HARDWARE_MOTHERBOARD),1117)
204
-# Ultimaker
230
+# Invent-A-Part RigidBoard V2
205 231
 else ifeq ($(HARDWARE_MOTHERBOARD),1118)
206
-# Ultimaker (Older electronics. Pre 1.5.4. This is rare)
232
+# Sainsmart 2-in-1 board
207 233
 else ifeq ($(HARDWARE_MOTHERBOARD),1119)
208
-  MCU ?= atmega1280
234
+# Ultimaker
235
+else ifeq ($(HARDWARE_MOTHERBOARD),1120)
236
+# Ultimaker (Older electronics. Pre 1.5.4. This is rare)
237
+else ifeq ($(HARDWARE_MOTHERBOARD),1121)
238
+  MCU              ?= atmega1280
239
+  PROG_MCU         ?= m1280
209 240
 
210 241
 # Azteeg X3
211
-else ifeq ($(HARDWARE_MOTHERBOARD),1120)
242
+else ifeq ($(HARDWARE_MOTHERBOARD),1122)
212 243
 # Azteeg X3 Pro
213
-else ifeq ($(HARDWARE_MOTHERBOARD),1121)
244
+else ifeq ($(HARDWARE_MOTHERBOARD),1123)
214 245
 # Ultimainboard 2.x (Uses TEMP_SENSOR 20)
215
-else ifeq ($(HARDWARE_MOTHERBOARD),1122)
246
+else ifeq ($(HARDWARE_MOTHERBOARD),1124)
216 247
 # Rumba
217
-else ifeq ($(HARDWARE_MOTHERBOARD),1123)
248
+else ifeq ($(HARDWARE_MOTHERBOARD),1125)
218 249
 # Raise3D Rumba
219
-else ifeq ($(HARDWARE_MOTHERBOARD),1124)
250
+else ifeq ($(HARDWARE_MOTHERBOARD),1126)
220 251
 # Rapide Lite RL200 Rumba
221
-else ifeq ($(HARDWARE_MOTHERBOARD),1125)
252
+else ifeq ($(HARDWARE_MOTHERBOARD),1127)
222 253
 # Formbot T-Rex 2 Plus
223
-else ifeq ($(HARDWARE_MOTHERBOARD),1126)
254
+else ifeq ($(HARDWARE_MOTHERBOARD),1128)
224 255
 # Formbot T-Rex 3
225
-else ifeq ($(HARDWARE_MOTHERBOARD),1127)
256
+else ifeq ($(HARDWARE_MOTHERBOARD),1129)
226 257
 # Formbot Raptor
227
-else ifeq ($(HARDWARE_MOTHERBOARD),1128)
258
+else ifeq ($(HARDWARE_MOTHERBOARD),1130)
228 259
 # Formbot Raptor 2
229
-else ifeq ($(HARDWARE_MOTHERBOARD),1129)
260
+else ifeq ($(HARDWARE_MOTHERBOARD),1131)
230 261
 # bq ZUM Mega 3D
231
-else ifeq ($(HARDWARE_MOTHERBOARD),1130)
262
+else ifeq ($(HARDWARE_MOTHERBOARD),1132)
232 263
 # MakeBoard Mini v2.1.2 is a control board sold by MicroMake
233
-else ifeq ($(HARDWARE_MOTHERBOARD),1131)
264
+else ifeq ($(HARDWARE_MOTHERBOARD),1133)
234 265
 # TriGorilla Anycubic version 1.3 based on RAMPS EFB
235
-else ifeq ($(HARDWARE_MOTHERBOARD),1132)
266
+else ifeq ($(HARDWARE_MOTHERBOARD),1134)
236 267
 # TriGorilla Anycubic version 1.4 based on RAMPS EFB
237
-else ifeq ($(HARDWARE_MOTHERBOARD),1133)
268
+else ifeq ($(HARDWARE_MOTHERBOARD),1135)
238 269
 # TriGorilla Anycubic version 1.4 Rev 1.1
239
-else ifeq ($(HARDWARE_MOTHERBOARD),1134)
270
+else ifeq ($(HARDWARE_MOTHERBOARD),1136)
240 271
 # Creality: Ender-4, CR-8
241
-else ifeq ($(HARDWARE_MOTHERBOARD),1135)
272
+else ifeq ($(HARDWARE_MOTHERBOARD),1137)
242 273
 # Creality: CR10S, CR20, CR-X
243
-else ifeq ($(HARDWARE_MOTHERBOARD),1136)
274
+else ifeq ($(HARDWARE_MOTHERBOARD),1138)
244 275
 # Dagoma F5
245
-else ifeq ($(HARDWARE_MOTHERBOARD),1137)
276
+else ifeq ($(HARDWARE_MOTHERBOARD),1139)
246 277
 # FYSETC F6 1.3
247
-else ifeq ($(HARDWARE_MOTHERBOARD),1138)
278
+else ifeq ($(HARDWARE_MOTHERBOARD),1140)
248 279
 # FYSETC F6 1.5
249
-else ifeq ($(HARDWARE_MOTHERBOARD),1139)
280
+else ifeq ($(HARDWARE_MOTHERBOARD),1141)
250 281
 # Duplicator i3 Plus
251
-else ifeq ($(HARDWARE_MOTHERBOARD),1140)
282
+else ifeq ($(HARDWARE_MOTHERBOARD),1142)
252 283
 # VORON
253
-else ifeq ($(HARDWARE_MOTHERBOARD),1141)
284
+else ifeq ($(HARDWARE_MOTHERBOARD),1143)
254 285
 # TRONXY V3 1.0
255
-else ifeq ($(HARDWARE_MOTHERBOARD),1142)
286
+else ifeq ($(HARDWARE_MOTHERBOARD),1144)
256 287
 # Z-Bolt X Series
257
-else ifeq ($(HARDWARE_MOTHERBOARD),1143)
288
+else ifeq ($(HARDWARE_MOTHERBOARD),1145)
258 289
 # TT OSCAR
259
-else ifeq ($(HARDWARE_MOTHERBOARD),1144)
290
+else ifeq ($(HARDWARE_MOTHERBOARD),1146)
260 291
 # Overlord/Overlord Pro
261
-else ifeq ($(HARDWARE_MOTHERBOARD),1145)
292
+else ifeq ($(HARDWARE_MOTHERBOARD),1147)
262 293
 # ADIMLab Gantry v1
263
-else ifeq ($(HARDWARE_MOTHERBOARD),1146)
294
+else ifeq ($(HARDWARE_MOTHERBOARD),1148)
264 295
 # ADIMLab Gantry v2
265
-else ifeq ($(HARDWARE_MOTHERBOARD),1147)
296
+else ifeq ($(HARDWARE_MOTHERBOARD),1149)
266 297
 # BIQU Tango V1
267
-else ifeq ($(HARDWARE_MOTHERBOARD),1148)
298
+else ifeq ($(HARDWARE_MOTHERBOARD),1150)
268 299
 # MKS GEN L V2
269
-else ifeq ($(HARDWARE_MOTHERBOARD),1149)
300
+else ifeq ($(HARDWARE_MOTHERBOARD),1151)
301
+# MKS GEN L V2.1
302
+else ifeq ($(HARDWARE_MOTHERBOARD),1152)
303
+# Copymaster 3D
304
+else ifeq ($(HARDWARE_MOTHERBOARD),1153)
305
+# Ortur 4
306
+else ifeq ($(HARDWARE_MOTHERBOARD),1154)
307
+# Tenlog D3 Hero
308
+else ifeq ($(HARDWARE_MOTHERBOARD),1155)
270 309
 
271 310
 #
272 311
 # RAMBo and derivatives
@@ -339,9 +378,11 @@ else ifeq ($(HARDWARE_MOTHERBOARD),1320)
339 378
 # Minitronics v1.0/1.1
340 379
 else ifeq ($(HARDWARE_MOTHERBOARD),1400)
341 380
   MCU              ?= atmega1281
381
+  PROG_MCU         ?= m1281
342 382
 # Silvergate v1.0
343 383
 else ifeq ($(HARDWARE_MOTHERBOARD),1401)
344 384
   MCU              ?= atmega1281
385
+  PROG_MCU         ?= m1281
345 386
 
346 387
 #
347 388
 # Sanguinololu and Derivatives - ATmega644P, ATmega1284P
@@ -351,42 +392,57 @@ else ifeq ($(HARDWARE_MOTHERBOARD),1401)
351 392
 else ifeq ($(HARDWARE_MOTHERBOARD),1500)
352 393
   HARDWARE_VARIANT ?= Sanguino
353 394
   MCU              ?= atmega644p
395
+  PROG_MCU         ?= m644p
354 396
 # Sanguinololu 1.2 and above
355 397
 else ifeq ($(HARDWARE_MOTHERBOARD),1501)
356 398
   HARDWARE_VARIANT ?= Sanguino
357 399
   MCU              ?= atmega644p
400
+  PROG_MCU         ?= m644p
358 401
 # Melzi
359 402
 else ifeq ($(HARDWARE_MOTHERBOARD),1502)
360 403
   HARDWARE_VARIANT ?= Sanguino
361 404
   MCU              ?= atmega644p
362
-# Melzi with ATmega1284 (MaKr3d version)
405
+  PROG_MCU         ?= m644p
406
+# Melzi V2.0
363 407
 else ifeq ($(HARDWARE_MOTHERBOARD),1503)
364 408
   HARDWARE_VARIANT ?= Sanguino
365 409
   MCU              ?= atmega1284p
366
-# Melzi Creality3D board (for CR-10 etc)
410
+  PROG_MCU         ?= m1284p
411
+# Melzi with ATmega1284 (MaKr3d version)
367 412
 else ifeq ($(HARDWARE_MOTHERBOARD),1504)
368 413
   HARDWARE_VARIANT ?= Sanguino
369 414
   MCU              ?= atmega1284p
370
-# Melzi Malyan M150 board
415
+  PROG_MCU         ?= m1284p
416
+# Melzi Creality3D board (for CR-10 etc)
371 417
 else ifeq ($(HARDWARE_MOTHERBOARD),1505)
372 418
   HARDWARE_VARIANT ?= Sanguino
373 419
   MCU              ?= atmega1284p
374
-# Tronxy X5S
420
+  PROG_MCU         ?= m1284p
421
+# Melzi Malyan M150 board
375 422
 else ifeq ($(HARDWARE_MOTHERBOARD),1506)
376 423
   HARDWARE_VARIANT ?= Sanguino
377 424
   MCU              ?= atmega1284p
378
-# STB V1.1
425
+  PROG_MCU         ?= m1284p
426
+# Tronxy X5S
379 427
 else ifeq ($(HARDWARE_MOTHERBOARD),1507)
380 428
   HARDWARE_VARIANT ?= Sanguino
381 429
   MCU              ?= atmega1284p
382
-# Azteeg X1
430
+  PROG_MCU         ?= m1284p
431
+# STB V1.1
383 432
 else ifeq ($(HARDWARE_MOTHERBOARD),1508)
384 433
   HARDWARE_VARIANT ?= Sanguino
385 434
   MCU              ?= atmega1284p
386
-# Anet 1.0 (Melzi clone)
435
+  PROG_MCU         ?= m1284p
436
+# Azteeg X1
387 437
 else ifeq ($(HARDWARE_MOTHERBOARD),1509)
388 438
   HARDWARE_VARIANT ?= Sanguino
389 439
   MCU              ?= atmega1284p
440
+  PROG_MCU         ?= m1284p
441
+# Anet 1.0 (Melzi clone)
442
+else ifeq ($(HARDWARE_MOTHERBOARD),1510)
443
+  HARDWARE_VARIANT ?= Sanguino
444
+  MCU              ?= atmega1284p
445
+  PROG_MCU         ?= m1284p
390 446
 
391 447
 #
392 448
 # Other ATmega644P, ATmega644, ATmega1284P
@@ -396,50 +452,61 @@ else ifeq ($(HARDWARE_MOTHERBOARD),1509)
396 452
 else ifeq ($(HARDWARE_MOTHERBOARD),1600)
397 453
   HARDWARE_VARIANT ?= Sanguino
398 454
   MCU              ?= atmega644p
455
+  PROG_MCU         ?= m644p
399 456
 # Gen3+
400 457
 else ifeq ($(HARDWARE_MOTHERBOARD),1601)
401 458
   HARDWARE_VARIANT ?= Sanguino
402 459
   MCU              ?= atmega644p
460
+  PROG_MCU         ?= m644p
403 461
 # Gen6
404 462
 else ifeq ($(HARDWARE_MOTHERBOARD),1602)
405 463
   HARDWARE_VARIANT ?= Gen6
406 464
   MCU              ?= atmega644p
465
+  PROG_MCU         ?= m644p
407 466
 # Gen6 deluxe
408 467
 else ifeq ($(HARDWARE_MOTHERBOARD),1603)
409 468
   HARDWARE_VARIANT ?= Gen6
410 469
   MCU              ?= atmega644p
470
+  PROG_MCU         ?= m644p
411 471
 # Gen7 custom (Alfons3 Version)
412 472
 else ifeq ($(HARDWARE_MOTHERBOARD),1604)
413 473
   HARDWARE_VARIANT ?= Gen7
414 474
   MCU              ?= atmega644
475
+  PROG_MCU         ?= m644
415 476
   F_CPU            ?= 20000000
416 477
 # Gen7 v1.1, v1.2
417 478
 else ifeq ($(HARDWARE_MOTHERBOARD),1605)
418 479
   HARDWARE_VARIANT ?= Gen7
419 480
   MCU              ?= atmega644p
481
+  PROG_MCU         ?= m644p
420 482
   F_CPU            ?= 20000000
421 483
 # Gen7 v1.3
422 484
 else ifeq ($(HARDWARE_MOTHERBOARD),1606)
423 485
   HARDWARE_VARIANT ?= Gen7
424 486
   MCU              ?= atmega644p
487
+  PROG_MCU         ?= m644p
425 488
   F_CPU            ?= 20000000
426 489
 # Gen7 v1.4
427 490
 else ifeq ($(HARDWARE_MOTHERBOARD),1607)
428 491
   HARDWARE_VARIANT ?= Gen7
429 492
   MCU              ?= atmega1284p
493
+  PROG_MCU         ?= m1284p
430 494
   F_CPU            ?= 20000000
431 495
 # Alpha OMCA board
432 496
 else ifeq ($(HARDWARE_MOTHERBOARD),1608)
433 497
   HARDWARE_VARIANT ?= SanguinoA
434 498
   MCU              ?= atmega644
499
+  PROG_MCU         ?= m644
435 500
 # Final OMCA board
436 501
 else ifeq ($(HARDWARE_MOTHERBOARD),1609)
437 502
   HARDWARE_VARIANT ?= Sanguino
438 503
   MCU              ?= atmega644p
504
+  PROG_MCU         ?= m644p
439 505
 # Sethi 3D_1
440 506
 else ifeq ($(HARDWARE_MOTHERBOARD),1610)
441 507
   HARDWARE_VARIANT ?= Sanguino
442 508
   MCU              ?= atmega644p
509
+  PROG_MCU         ?= m644p
443 510
 
444 511
 #
445 512
 # Teensyduino - AT90USB1286, AT90USB1286P
@@ -449,51 +516,60 @@ else ifeq ($(HARDWARE_MOTHERBOARD),1610)
449 516
 else ifeq ($(HARDWARE_MOTHERBOARD),1700)
450 517
   HARDWARE_VARIANT ?= Teensy
451 518
   MCU              ?= at90usb1286
519
+  PROG_MCU         ?= usb1286
452 520
 # Printrboard (AT90USB1286)
453 521
 else ifeq ($(HARDWARE_MOTHERBOARD),1701)
454 522
   HARDWARE_VARIANT ?= Teensy
455 523
   MCU              ?= at90usb1286
524
+  PROG_MCU         ?= usb1286
456 525
 # Printrboard Revision F (AT90USB1286)
457 526
 else ifeq ($(HARDWARE_MOTHERBOARD),1702)
458 527
   HARDWARE_VARIANT ?= Teensy
459 528
   MCU              ?= at90usb1286
529
+  PROG_MCU         ?= usb1286
460 530
 # Brainwave (AT90USB646)
461 531
 else ifeq ($(HARDWARE_MOTHERBOARD),1703)
462 532
   HARDWARE_VARIANT ?= Teensy
463 533
   MCU              ?= at90usb646
534
+  PROG_MCU         ?= usb646
464 535
 # Brainwave Pro (AT90USB1286)
465 536
 else ifeq ($(HARDWARE_MOTHERBOARD),1704)
466 537
   HARDWARE_VARIANT ?= Teensy
467 538
   MCU              ?= at90usb1286
539
+  PROG_MCU         ?= usb1286
468 540
 # SAV Mk-I (AT90USB1286)
469 541
 else ifeq ($(HARDWARE_MOTHERBOARD),1705)
470 542
   HARDWARE_VARIANT ?= Teensy
471 543
   MCU              ?= at90usb1286
544
+  PROG_MCU         ?= usb1286
472 545
 # Teensy++2.0 (AT90USB1286)
473 546
 else ifeq ($(HARDWARE_MOTHERBOARD),1706)
474 547
   HARDWARE_VARIANT ?= Teensy
475 548
   MCU              ?= at90usb1286
549
+  PROG_MCU         ?= usb1286
476 550
 # 5DPrint D8 Driver Board
477 551
 else ifeq ($(HARDWARE_MOTHERBOARD),1707)
478 552
   HARDWARE_VARIANT ?= Teensy
479 553
   MCU              ?= at90usb1286
554
+  PROG_MCU         ?= usb1286
480 555
 
481 556
 # UltiMachine Archim1 (with DRV8825 drivers)
482 557
 else ifeq ($(HARDWARE_MOTHERBOARD),3023)
483 558
   HARDWARE_VARIANT ?= archim
484 559
   MCPU              = cortex-m3
485
-  F_CPU             = 84000000L
560
+  F_CPU             = 84000000
486 561
   IS_MCU            = 0
487 562
 # UltiMachine Archim2 (with TMC2130 drivers)
488 563
 else ifeq ($(HARDWARE_MOTHERBOARD),3024)
489 564
   HARDWARE_VARIANT ?= archim
490 565
   MCPU              = cortex-m3
491
-  F_CPU             = 84000000L
566
+  F_CPU             = 84000000
492 567
   IS_MCU            = 0
493 568
 endif
494 569
 
495 570
 # Be sure to regenerate speed_lookuptable.h with create_speed_lookuptable.py
496 571
 # if you are setting this to something other than 16MHz
572
+# Do not put the UL suffix, it's done later on.
497 573
 # Set to 16Mhz if not yet set.
498 574
 F_CPU ?= 16000000
499 575
 
@@ -503,7 +579,8 @@ IS_MCU ?= 1
503 579
 ifeq ($(IS_MCU),1)
504 580
   # Set to arduino, ATmega2560 if not yet set.
505 581
   HARDWARE_VARIANT ?= arduino
506
-  MCU ?= atmega2560
582
+  MCU              ?= atmega2560
583
+  PROG_MCU         ?= m2560
507 584
 
508 585
   TOOL_PREFIX = avr
509 586
   MCU_FLAGS   = -mmcu=$(MCU)
@@ -534,27 +611,36 @@ VPATH += $(BUILD_DIR)
534 611
 VPATH += $(HARDWARE_SRC)
535 612
 
536 613
 ifeq ($(HARDWARE_VARIANT), $(filter $(HARDWARE_VARIANT),arduino Teensy Sanguino))
537
-VPATH += $(ARDUINO_INSTALL_DIR)/hardware/marlin/avr/libraries/LiquidCrystal/src
538
-VPATH += $(ARDUINO_INSTALL_DIR)/hardware/marlin/avr/libraries/SPI
614
+  # Old libraries (avr-core 1.6.21 < / Arduino < 1.6.8)
615
+  VPATH += $(ARDUINO_INSTALL_DIR)/hardware/arduino/avr/libraries/SPI
616
+  # New libraries (avr-core >= 1.6.21 / Arduino >= 1.6.8)
617
+  VPATH += $(ARDUINO_INSTALL_DIR)/hardware/arduino/avr/libraries/SPI/src
539 618
 endif
540 619
 
541 620
 ifeq ($(IS_MCU),1)
542 621
   VPATH += $(ARDUINO_INSTALL_DIR)/hardware/arduino/avr/cores/arduino
543 622
 
623
+  # Old libraries (avr-core 1.6.21 < / Arduino < 1.6.8)
544 624
   VPATH += $(ARDUINO_INSTALL_DIR)/hardware/arduino/avr/libraries/SPI
625
+  VPATH += $(ARDUINO_INSTALL_DIR)/hardware/arduino/avr/libraries/SoftwareSerial
626
+  # New libraries (avr-core >= 1.6.21 / Arduino >= 1.6.8)
545 627
   VPATH += $(ARDUINO_INSTALL_DIR)/hardware/arduino/avr/libraries/SPI/src
546 628
   VPATH += $(ARDUINO_INSTALL_DIR)/hardware/arduino/avr/libraries/SoftwareSerial/src
547 629
 endif
548 630
 
549 631
 VPATH += $(ARDUINO_INSTALL_DIR)/libraries/LiquidCrystal/src
632
+
550 633
 ifeq ($(LIQUID_TWI2), 1)
551
-VPATH += $(ARDUINO_INSTALL_DIR)/libraries/Wire
552
-VPATH += $(ARDUINO_INSTALL_DIR)/libraries/Wire/utility
553
-VPATH += $(ARDUINO_INSTALL_DIR)/libraries/LiquidTWI2
634
+  WIRE   = 1
635
+  VPATH += $(ARDUINO_INSTALL_DIR)/libraries/LiquidTWI2
554 636
 endif
555 637
 ifeq ($(WIRE), 1)
556
-VPATH += $(ARDUINO_INSTALL_DIR)/libraries/Wire
557
-VPATH += $(ARDUINO_INSTALL_DIR)/libraries/Wire/utility
638
+  # Old libraries (avr-core 1.6.21 / Arduino < 1.6.8)
639
+  VPATH += $(ARDUINO_INSTALL_DIR)/hardware/arduino/avr/libraries/Wire
640
+  VPATH += $(ARDUINO_INSTALL_DIR)/hardware/arduino/avr/libraries/Wire/utility
641
+  # New libraries (avr-core >= 1.6.21 / Arduino >= 1.6.8)
642
+  VPATH += $(ARDUINO_INSTALL_DIR)/hardware/arduino/avr/libraries/Wire/src
643
+  VPATH += $(ARDUINO_INSTALL_DIR)/hardware/arduino/avr/libraries/Wire/src/utility
558 644
 endif
559 645
 ifeq ($(NEOPIXEL), 1)
560 646
 VPATH += $(ARDUINO_INSTALL_DIR)/libraries/Adafruit_NeoPixel
@@ -626,13 +712,23 @@ ifeq ($(WIRE), 1)
626 712
   LIB_CXXSRC += Wire.cpp
627 713
 endif
628 714
 
715
+ifeq ($(TONE), 1)
716
+  LIB_CXXSRC += Tone.cpp
717
+endif
718
+
629 719
 ifeq ($(U8GLIB), 1)
630 720
   LIB_CXXSRC += U8glib.cpp
631
-  LIB_SRC += u8g_ll_api.c u8g_bitmap.c u8g_clip.c u8g_com_null.c u8g_delay.c u8g_page.c u8g_pb.c u8g_pb16h1.c u8g_rect.c u8g_state.c u8g_font.c u8g_font_6x13.c u8g_font_04b_03.c u8g_font_5x8.c
721
+  LIB_SRC += u8g_ll_api.c u8g_bitmap.c u8g_clip.c u8g_com_null.c u8g_delay.c \
722
+    u8g_page.c u8g_pb.c u8g_pb16h1.c u8g_rect.c u8g_state.c u8g_font.c \
723
+    u8g_font_6x13.c u8g_font_04b_03.c u8g_font_5x8.c
632 724
 endif
633 725
 
634 726
 ifeq ($(TMC), 1)
635
-  LIB_CXXSRC += TMCStepper.cpp COOLCONF.cpp DRV_STATUS.cpp IHOLD_IRUN.cpp CHOPCONF.cpp GCONF.cpp PWMCONF.cpp DRV_CONF.cpp DRVCONF.cpp DRVCTRL.cpp DRVSTATUS.cpp ENCMODE.cpp RAMP_STAT.cpp SGCSCONF.cpp SHORT_CONF.cpp SMARTEN.cpp SW_MODE.cpp SW_SPI.cpp TMC2130Stepper.cpp TMC2208Stepper.cpp TMC2209Stepper.cpp TMC2660Stepper.cpp TMC5130Stepper.cpp TMC5160Stepper.cpp
727
+  LIB_CXXSRC += TMCStepper.cpp COOLCONF.cpp DRV_STATUS.cpp IHOLD_IRUN.cpp \
728
+    CHOPCONF.cpp GCONF.cpp PWMCONF.cpp DRV_CONF.cpp DRVCONF.cpp DRVCTRL.cpp \
729
+    DRVSTATUS.cpp ENCMODE.cpp RAMP_STAT.cpp SGCSCONF.cpp SHORT_CONF.cpp \
730
+    SMARTEN.cpp SW_MODE.cpp SW_SPI.cpp TMC2130Stepper.cpp TMC2208Stepper.cpp \
731
+    TMC2209Stepper.cpp TMC2660Stepper.cpp TMC5130Stepper.cpp TMC5160Stepper.cpp
636 732
 endif
637 733
 
638 734
 ifeq ($(RELOC_WORKAROUND), 1)
@@ -674,17 +770,23 @@ REMOVE = rm -f
674 770
 MV = mv -f
675 771
 
676 772
 # Place -D or -U options here
677
-CDEFS    = -DF_CPU=$(F_CPU) ${addprefix -D , $(DEFINES)} -DARDUINO=$(ARDUINO_VERSION)
773
+CDEFS    = -DF_CPU=$(F_CPU)UL ${addprefix -D , $(DEFINES)} -DARDUINO=$(ARDUINO_VERSION)
678 774
 CXXDEFS  = $(CDEFS)
679 775
 
680 776
 ifeq ($(HARDWARE_VARIANT), Teensy)
681
-  CDEFS  += -DUSB_SERIAL
777
+  CDEFS      += -DUSB_SERIAL
682 778
   LIB_SRC    += usb.c pins_teensy.c
683 779
   LIB_CXXSRC += usb_api.cpp
684 780
 
685 781
 else ifeq ($(HARDWARE_VARIANT), archim)
686
-  CDEFS      += -DARDUINO_SAM_ARCHIM -DARDUINO_ARCH_SAM -D__SAM3X8E__ -DUSB_VID=0x27b1 -DUSB_PID=0x0001 -DUSBCON '-DUSB_MANUFACTURER="UltiMachine"' '-DUSB_PRODUCT="Archim"'
687
-  LIB_CXXSRC += variant.cpp IPAddress.cpp Reset.cpp RingBuffer.cpp Stream.cpp UARTClass.cpp  USARTClass.cpp abi.cpp new.cpp watchdog.cpp CDC.cpp PluggableUSB.cpp  USBCore.cpp
782
+  CDEFS      += -DARDUINO_SAM_ARCHIM -DARDUINO_ARCH_SAM -D__SAM3X8E__
783
+  CDEFS      += -DUSB_VID=0x27B1 -DUSB_PID=0x0001 -DUSBCON
784
+  CDEFS      += '-DUSB_MANUFACTURER="UltiMachine"' '-DUSB_PRODUCT_STRING="Archim"'
785
+
786
+  LIB_CXXSRC += variant.cpp IPAddress.cpp Reset.cpp RingBuffer.cpp Stream.cpp \
787
+    UARTClass.cpp  USARTClass.cpp abi.cpp new.cpp watchdog.cpp CDC.cpp \
788
+    PluggableUSB.cpp USBCore.cpp
789
+
688 790
   LIB_SRC    += cortex_handlers.c iar_calls_sam3.c syscalls_sam3.c dtostrf.c itoa.c
689 791
 
690 792
   ifeq ($(U8GLIB), 1)
@@ -710,16 +812,20 @@ CTUNING = -fsigned-char -funsigned-bitfields -fno-exceptions \
710 812
 ifneq ($(HARDWARE_MOTHERBOARD),)
711 813
   CTUNING += -DMOTHERBOARD=${HARDWARE_MOTHERBOARD}
712 814
 endif
815
+
713 816
 #CEXTRA = -Wa,-adhlns=$(<:.c=.lst)
714 817
 CXXEXTRA = -fno-use-cxa-atexit -fno-threadsafe-statics -fno-rtti
715 818
 CFLAGS := $(CDEBUG) $(CDEFS) $(CINCS) -O$(OPT) $(CEXTRA)   $(CTUNING) $(CSTANDARD)
716 819
 CXXFLAGS :=         $(CDEFS) $(CINCS) -O$(OPT) $(CXXEXTRA) $(CTUNING) $(CXXSTANDARD)
717 820
 ASFLAGS :=          $(CDEFS)
718 821
 #ASFLAGS = -Wa,-adhlns=$(<:.S=.lst),-gstabs
822
+
719 823
 ifeq ($(HARDWARE_VARIANT), archim)
720 824
   LD_PREFIX = -Wl,--gc-sections,-Map,Marlin.ino.map,--cref,--check-sections,--entry=Reset_Handler,--unresolved-symbols=report-all,--warn-common,--warn-section-align
721 825
   LD_SUFFIX = $(LDLIBS)
722
-  LDFLAGS   = -lm -T$(LDSCRIPT) -u _sbrk -u link -u _close -u _fstat -u _isatty -u _lseek -u _read -u _write -u _exit -u kill -u _getpid
826
+
827
+  LDFLAGS   = -lm -T$(LDSCRIPT) -u _sbrk -u link -u _close -u _fstat -u _isatty
828
+  LDFLAGS  += -u _lseek -u _read -u _write -u _exit -u kill -u _getpid
723 829
 else
724 830
   LD_PREFIX = -Wl,--gc-sections,--relax
725 831
   LDFLAGS   = -lm
@@ -735,7 +841,7 @@ else
735 841
   AVRDUDE_CONF = $(ARDUINO_INSTALL_DIR)/hardware/tools/avr/etc/avrdude.conf
736 842
 endif
737 843
 AVRDUDE_FLAGS = -D -C$(AVRDUDE_CONF) \
738
-  -p$(MCU) -P$(AVRDUDE_PORT) -c$(AVRDUDE_PROGRAMMER) \
844
+  -p$(PROG_MCU) -P$(AVRDUDE_PORT) -c$(AVRDUDE_PROGRAMMER) \
739 845
   -b$(UPLOAD_RATE)
740 846
 
741 847
 # Since Marlin 2.0, the source files may be distributed into several
@@ -836,7 +942,7 @@ extcoff: $(TARGET).elf
836 942
 
837 943
 .elf.eep:
838 944
 	-$(OBJCOPY) -j .eeprom --set-section-flags=.eeprom="alloc,load" \
839
-    --change-section-lma .eeprom=0 -O $(FORMAT) $< $@
945
+	  --change-section-lma .eeprom=0 -O $(FORMAT) $< $@
840 946
 
841 947
 # Create extended listing file from ELF output file.
842 948
 .elf.lss:
@@ -850,7 +956,7 @@ extcoff: $(TARGET).elf
850 956
 
851 957
 $(BUILD_DIR)/$(TARGET).elf: $(OBJ) Configuration.h
852 958
 	$(Pecho) "  CXX   $@"
853
-	$P $(CC) $(LD_PREFIX) $(ALL_CXXFLAGS) -o $@ -L. $(OBJ) $(LDFLAGS) $(LD_SUFFIX)
959
+	$P $(CXX) $(LD_PREFIX) $(ALL_CXXFLAGS) -o $@ -L. $(OBJ) $(LDFLAGS) $(LD_SUFFIX)
854 960
 
855 961
 # Object files that were found in "src" will be stored in $(BUILD_DIR)
856 962
 # in directories that mirror the structure of "src"

+ 15
- 11
Marlin/Marlin.ino Voir le fichier

@@ -1,9 +1,8 @@
1
-/*
2
-================================================================================
1
+/*==============================================================================
3 2
 
4 3
   Marlin Firmware
5 4
 
6
-  (c) 2011-2019 MarlinFirmware
5
+  (c) 2011-2020 MarlinFirmware
7 6
   Portions of Marlin are (c) by their respective authors.
8 7
   All code complies with GPLv2 and/or GPLv3
9 8
 
@@ -12,30 +11,33 @@
12 11
 Greetings! Thank you for choosing Marlin 2 as your 3D printer firmware.
13 12
 
14 13
 To configure Marlin you must edit Configuration.h and Configuration_adv.h
15
-located in the root 'Marlin' folder. Check the config/examples folder to see if
16
-there's a more suitable starting-point for your specific hardware.
14
+located in the root 'Marlin' folder. Check our Configurations repository to
15
+see if there's a more suitable starting-point for your specific hardware.
17 16
 
18 17
 Before diving in, we recommend the following essential links:
19 18
 
20 19
 Marlin Firmware Official Website
21 20
 
22
-  - http://marlinfw.org/
21
+  - https://marlinfw.org/
23 22
     The official Marlin Firmware website contains the most up-to-date
24 23
     documentation. Contributions are always welcome!
25 24
 
26 25
 Configuration
27 26
 
27
+  - https://github.com/MarlinFirmware/Configurations
28
+    Example configurations for several printer models.
29
+
28 30
   - https://www.youtube.com/watch?v=3gwWVFtdg-4
29 31
     A good 20-minute overview of Marlin configuration by Tom Sanladerer.
30 32
     (Applies to Marlin 1.0.x, so Jerk and Acceleration should be halved.)
31 33
     Also... https://www.google.com/search?tbs=vid%3A1&q=configure+marlin
32 34
 
33
-  - http://marlinfw.org/docs/configuration/configuration.html
35
+  - https://marlinfw.org/docs/configuration/configuration.html
34 36
     Marlin's configuration options are explained in more detail here.
35 37
 
36 38
 Getting Help
37 39
 
38
-  - http://forums.reprap.org/list.php?415
40
+  - https://reprap.org/forum/list.php?415
39 41
     The Marlin Discussion Forum is a great place to get help from other Marlin
40 42
     users who may have experienced similar issues to your own.
41 43
 
@@ -45,9 +47,11 @@ Getting Help
45 47
 
46 48
 Contributing
47 49
 
48
-  - http://marlinfw.org/docs/development/contributing.html
50
+  - https://marlinfw.org/docs/development/contributing.html
49 51
     If you'd like to contribute to Marlin, read this first!
50 52
 
51
-  - http://marlinfw.org/docs/development/coding_standards.html
53
+  - https://marlinfw.org/docs/development/coding_standards.html
52 54
     Before submitting code get to know the Coding Standards.
53
-*/
55
+
56
+
57
+------------------------------------------------------------------------------*/

+ 8
- 8
Marlin/Version.h Voir le fichier

@@ -16,7 +16,7 @@
16 16
  * GNU General Public License for more details.
17 17
  *
18 18
  * You should have received a copy of the GNU General Public License
19
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
19
+ * along with this program.  If not, see <https://www.gnu.org/licenses/>.
20 20
  *
21 21
  */
22 22
 #pragma once
@@ -28,20 +28,20 @@
28 28
 /**
29 29
  * Marlin release version identifier
30 30
  */
31
-//#define SHORT_BUILD_VERSION "2.0.5"
31
+//#define SHORT_BUILD_VERSION "2.0.7.2"
32 32
 
33 33
 /**
34 34
  * Verbose version identifier which should contain a reference to the location
35 35
  * from where the binary was downloaded or the source code was compiled.
36 36
  */
37
-//#define DETAILED_BUILD_VERSION SHORT_BUILD_VERSION " (Github)"
37
+//#define DETAILED_BUILD_VERSION SHORT_BUILD_VERSION
38 38
 
39 39
 /**
40 40
  * The STRING_DISTRIBUTION_DATE represents when the binary file was built,
41 41
  * here we define this default string as the date where the latest release
42 42
  * version was tagged.
43 43
  */
44
-//#define STRING_DISTRIBUTION_DATE "2020-01-31"
44
+//#define STRING_DISTRIBUTION_DATE "2020-07-09"
45 45
 
46 46
 /**
47 47
  * Defines a generic printer name to be output to the LCD after booting Marlin.
@@ -65,12 +65,12 @@
65 65
  * The WEBSITE_URL is the location where users can get more information such as
66 66
  * documentation about a specific Marlin release.
67 67
  */
68
-//#define WEBSITE_URL "http://marlinfw.org"
68
+//#define WEBSITE_URL "https://marlinfw.org"
69 69
 
70 70
 /**
71 71
  * Set the vendor info the serial USB interface, if changable
72 72
  * Currently only supported by DUE platform
73 73
  */
74
-//#define  USB_DEVICE_VENDOR_ID           0x0000
75
-//#define  USB_DEVICE_PRODUCT_ID          0x0000
76
-//#define  USB_DEVICE_MANUFACTURE_NAME    WEBSITE_URL
74
+//#define USB_DEVICE_VENDOR_ID           0x0000
75
+//#define USB_DEVICE_PRODUCT_ID          0x0000
76
+//#define USB_DEVICE_MANUFACTURE_NAME    WEBSITE_URL

+ 1
- 1
Marlin/lib/readme.txt Voir le fichier

@@ -33,4 +33,4 @@ PlatformIO will find your libraries automatically, configure preprocessor's
33 33
 include paths and build them.
34 34
 
35 35
 More information about PlatformIO Library Dependency Finder
36
-- http://docs.platformio.org/page/librarymanager/ldf.html
36
+- https://docs.platformio.org/page/librarymanager/ldf.html

+ 1
- 2
Marlin/src/HAL/AVR/HAL.cpp Voir le fichier

@@ -16,10 +16,9 @@
16 16
  * GNU General Public License for more details.
17 17
  *
18 18
  * You should have received a copy of the GNU General Public License
19
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
19
+ * along with this program.  If not, see <https://www.gnu.org/licenses/>.
20 20
  *
21 21
  */
22
-
23 22
 #ifdef __AVR__
24 23
 
25 24
 #include "../../inc/MarlinConfig.h"

+ 22
- 246
Marlin/src/HAL/AVR/HAL.h Voir le fichier

@@ -14,7 +14,8 @@
14 14
  * GNU General Public License for more details.
15 15
  *
16 16
  * You should have received a copy of the GNU General Public License
17
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
17
+ * along with this program.  If not, see <https://www.gnu.org/licenses/>.
18
+ *
18 19
  */
19 20
 #pragma once
20 21
 
@@ -24,7 +25,7 @@
24 25
 #include "watchdog.h"
25 26
 #include "math.h"
26 27
 
27
-#ifdef USBCON
28
+#ifdef IS_AT90USB
28 29
   #include <HardwareSerial.h>
29 30
 #else
30 31
   #define HardwareSerial_h // Hack to prevent HardwareSerial.h header inclusion
@@ -50,7 +51,11 @@
50 51
 // Defines
51 52
 // ------------------------
52 53
 
53
-//#define analogInputToDigitalPin(IO) IO
54
+// AVR PROGMEM extension for sprintf_P
55
+#define S_FMT "%S"
56
+
57
+// AVR PROGMEM extension for string define
58
+#define PGMSTR(NAM,STR) const char NAM[] PROGMEM = STR
54 59
 
55 60
 #ifndef CRITICAL_SECTION_START
56 61
   #define CRITICAL_SECTION_START()  unsigned char _sreg = SREG; cli()
@@ -60,16 +65,10 @@
60 65
 #define ENABLE_ISRS()  sei()
61 66
 #define DISABLE_ISRS() cli()
62 67
 
63
-// On AVR this is in math.h?
64
-//#define square(x) ((x)*(x))
65
-
66 68
 // ------------------------
67 69
 // Types
68 70
 // ------------------------
69 71
 
70
-typedef uint16_t hal_timer_t;
71
-#define HAL_TIMER_TYPE_MAX 0xFFFF
72
-
73 72
 typedef int8_t pin_t;
74 73
 
75 74
 #define SHARED_SERVOS HAS_SERVOS
@@ -82,44 +81,30 @@ typedef int8_t pin_t;
82 81
 //extern uint8_t MCUSR;
83 82
 
84 83
 // Serial ports
85
-#ifdef USBCON
86
-  #if ENABLED(BLUETOOTH)
87
-    #define MYSERIAL0 bluetoothSerial
88
-  #else
89
-    #define MYSERIAL0 Serial
90
-  #endif
91
-  #define NUM_SERIAL 1
84
+#ifdef IS_AT90USB
85
+  #define MYSERIAL0 TERN(BLUETOOTH, bluetoothSerial, Serial)
92 86
 #else
93 87
   #if !WITHIN(SERIAL_PORT, -1, 3)
94 88
     #error "SERIAL_PORT must be from -1 to 3. Please update your configuration."
95 89
   #endif
96
-
97 90
   #define MYSERIAL0 customizedSerial1
98 91
 
99 92
   #ifdef SERIAL_PORT_2
100 93
     #if !WITHIN(SERIAL_PORT_2, -1, 3)
101 94
       #error "SERIAL_PORT_2 must be from -1 to 3. Please update your configuration."
102
-    #elif SERIAL_PORT_2 == SERIAL_PORT
103
-      #error "SERIAL_PORT_2 must be different than SERIAL_PORT. Please update your configuration."
104 95
     #endif
105 96
     #define MYSERIAL1 customizedSerial2
106
-    #define NUM_SERIAL 2
107
-  #else
108
-    #define NUM_SERIAL 1
109 97
   #endif
110 98
 #endif
111 99
 
112
-#ifdef DGUS_SERIAL_PORT
113
-  #if !WITHIN(DGUS_SERIAL_PORT, -1, 3)
114
-    #error "DGUS_SERIAL_PORT must be from -1 to 3. Please update your configuration."
115
-  #elif DGUS_SERIAL_PORT == SERIAL_PORT
116
-    #error "DGUS_SERIAL_PORT must be different than SERIAL_PORT. Please update your configuration."
117
-  #elif defined(SERIAL_PORT_2) && DGUS_SERIAL_PORT == SERIAL_PORT_2
118
-    #error "DGUS_SERIAL_PORT must be different than SERIAL_PORT_2. Please update your configuration."
100
+#ifdef LCD_SERIAL_PORT
101
+  #if !WITHIN(LCD_SERIAL_PORT, -1, 3)
102
+    #error "LCD_SERIAL_PORT must be from -1 to 3. Please update your configuration."
103
+  #endif
104
+  #define LCD_SERIAL lcdSerial
105
+  #if HAS_DGUS_LCD
106
+    #define SERIAL_GET_TX_BUFFER_FREE() LCD_SERIAL.get_tx_buffer_free()
119 107
   #endif
120
-  #define DGUS_SERIAL internalDgusSerial
121
-
122
-  #define DGUS_SERIAL_GET_TX_BUFFER_FREE DGUS_SERIAL.get_tx_buffer_free
123 108
 #endif
124 109
 
125 110
 // ------------------------
@@ -135,6 +120,8 @@ void HAL_init();
135 120
 inline void HAL_clear_reset_source() { MCUSR = 0; }
136 121
 inline uint8_t HAL_get_reset_source() { return MCUSR; }
137 122
 
123
+inline void HAL_reboot() {}  // reboot the board or restart the bootloader
124
+
138 125
 #pragma GCC diagnostic push
139 126
 #pragma GCC diagnostic ignored "-Wunused-function"
140 127
 extern "C" {
@@ -142,220 +129,6 @@ extern "C" {
142 129
 }
143 130
 #pragma GCC diagnostic pop
144 131
 
145
-// timers
146
-#define HAL_TIMER_RATE          ((F_CPU) / 8)    // i.e., 2MHz or 2.5MHz
147
-
148
-#define STEP_TIMER_NUM          1
149
-#define TEMP_TIMER_NUM          0
150
-#define PULSE_TIMER_NUM         STEP_TIMER_NUM
151
-
152
-#define TEMP_TIMER_FREQUENCY    ((F_CPU) / 64.0 / 256.0)
153
-
154
-#define STEPPER_TIMER_RATE      HAL_TIMER_RATE
155
-#define STEPPER_TIMER_PRESCALE  8
156
-#define STEPPER_TIMER_TICKS_PER_US ((STEPPER_TIMER_RATE) / 1000000) // Cannot be of type double
157
-
158
-#define PULSE_TIMER_RATE       STEPPER_TIMER_RATE   // frequency of pulse timer
159
-#define PULSE_TIMER_PRESCALE   STEPPER_TIMER_PRESCALE
160
-#define PULSE_TIMER_TICKS_PER_US STEPPER_TIMER_TICKS_PER_US
161
-
162
-#define ENABLE_STEPPER_DRIVER_INTERRUPT()  SBI(TIMSK1, OCIE1A)
163
-#define DISABLE_STEPPER_DRIVER_INTERRUPT() CBI(TIMSK1, OCIE1A)
164
-#define STEPPER_ISR_ENABLED()             TEST(TIMSK1, OCIE1A)
165
-
166
-#define ENABLE_TEMPERATURE_INTERRUPT()     SBI(TIMSK0, OCIE0B)
167
-#define DISABLE_TEMPERATURE_INTERRUPT()    CBI(TIMSK0, OCIE0B)
168
-#define TEMPERATURE_ISR_ENABLED()         TEST(TIMSK0, OCIE0B)
169
-
170
-FORCE_INLINE void HAL_timer_start(const uint8_t timer_num, const uint32_t) {
171
-  switch (timer_num) {
172
-    case STEP_TIMER_NUM:
173
-      // waveform generation = 0100 = CTC
174
-      SET_WGM(1, CTC_OCRnA);
175
-
176
-      // output mode = 00 (disconnected)
177
-      SET_COMA(1, NORMAL);
178
-
179
-      // Set the timer pre-scaler
180
-      // Generally we use a divider of 8, resulting in a 2MHz timer
181
-      // frequency on a 16MHz MCU. If you are going to change this, be
182
-      // sure to regenerate speed_lookuptable.h with
183
-      // create_speed_lookuptable.py
184
-      SET_CS(1, PRESCALER_8);  //  CS 2 = 1/8 prescaler
185
-
186
-      // Init Stepper ISR to 122 Hz for quick starting
187
-      // (F_CPU) / (STEPPER_TIMER_PRESCALE) / frequency
188
-      OCR1A = 0x4000;
189
-      TCNT1 = 0;
190
-      break;
191
-
192
-    case TEMP_TIMER_NUM:
193
-      // Use timer0 for temperature measurement
194
-      // Interleave temperature interrupt with millies interrupt
195
-      OCR0B = 128;
196
-      break;
197
-  }
198
-}
199
-
200
-#define TIMER_OCR_1             OCR1A
201
-#define TIMER_COUNTER_1         TCNT1
202
-
203
-#define TIMER_OCR_0             OCR0A
204
-#define TIMER_COUNTER_0         TCNT0
205
-
206
-#define _CAT(a,V...) a##V
207
-#define HAL_timer_set_compare(timer, compare) (_CAT(TIMER_OCR_, timer) = compare)
208
-#define HAL_timer_get_compare(timer) _CAT(TIMER_OCR_, timer)
209
-#define HAL_timer_get_count(timer) _CAT(TIMER_COUNTER_, timer)
210
-
211
-/**
212
- * On AVR there is no hardware prioritization and preemption of
213
- * interrupts, so this emulates it. The UART has first priority
214
- * (otherwise, characters will be lost due to UART overflow).
215
- * Then: Stepper, Endstops, Temperature, and -finally- all others.
216
- */
217
-#define HAL_timer_isr_prologue(TIMER_NUM)
218
-#define HAL_timer_isr_epilogue(TIMER_NUM)
219
-
220
-/* 18 cycles maximum latency */
221
-#define HAL_STEP_TIMER_ISR() \
222
-extern "C" void TIMER1_COMPA_vect() __attribute__ ((signal, naked, used, externally_visible)); \
223
-extern "C" void TIMER1_COMPA_vect_bottom() asm ("TIMER1_COMPA_vect_bottom") __attribute__ ((used, externally_visible, noinline)); \
224
-void TIMER1_COMPA_vect() { \
225
-  __asm__ __volatile__ ( \
226
-    A("push r16")                      /* 2 Save R16 */ \
227
-    A("in r16, __SREG__")              /* 1 Get SREG */ \
228
-    A("push r16")                      /* 2 Save SREG into stack */ \
229
-    A("lds r16, %[timsk0]")            /* 2 Load into R0 the Temperature timer Interrupt mask register */ \
230
-    A("push r16")                      /* 2 Save TIMSK0 into the stack */ \
231
-    A("andi r16,~%[msk0]")             /* 1 Disable the temperature ISR */ \
232
-    A("sts %[timsk0], r16")            /* 2 And set the new value */ \
233
-    A("lds r16, %[timsk1]")            /* 2 Load into R0 the stepper timer Interrupt mask register [TIMSK1] */ \
234
-    A("andi r16,~%[msk1]")             /* 1 Disable the stepper ISR */ \
235
-    A("sts %[timsk1], r16")            /* 2 And set the new value */ \
236
-    A("push r16")                      /* 2 Save TIMSK1 into stack */ \
237
-    A("in r16, 0x3B")                  /* 1 Get RAMPZ register */ \
238
-    A("push r16")                      /* 2 Save RAMPZ into stack */ \
239
-    A("in r16, 0x3C")                  /* 1 Get EIND register */ \
240
-    A("push r0")                       /* C runtime can modify all the following registers without restoring them */ \
241
-    A("push r1")                       \
242
-    A("push r18")                      \
243
-    A("push r19")                      \
244
-    A("push r20")                      \
245
-    A("push r21")                      \
246
-    A("push r22")                      \
247
-    A("push r23")                      \
248
-    A("push r24")                      \
249
-    A("push r25")                      \
250
-    A("push r26")                      \
251
-    A("push r27")                      \
252
-    A("push r30")                      \
253
-    A("push r31")                      \
254
-    A("clr r1")                        /* C runtime expects this register to be 0 */ \
255
-    A("call TIMER1_COMPA_vect_bottom") /* Call the bottom handler - No inlining allowed, otherwise registers used are not saved */   \
256
-    A("pop r31")                       \
257
-    A("pop r30")                       \
258
-    A("pop r27")                       \
259
-    A("pop r26")                       \
260
-    A("pop r25")                       \
261
-    A("pop r24")                       \
262
-    A("pop r23")                       \
263
-    A("pop r22")                       \
264
-    A("pop r21")                       \
265
-    A("pop r20")                       \
266
-    A("pop r19")                       \
267
-    A("pop r18")                       \
268
-    A("pop r1")                        \
269
-    A("pop r0")                        \
270
-    A("out 0x3C, r16")                 /* 1 Restore EIND register */ \
271
-    A("pop r16")                       /* 2 Get the original RAMPZ register value */ \
272
-    A("out 0x3B, r16")                 /* 1 Restore RAMPZ register to its original value */ \
273
-    A("pop r16")                       /* 2 Get the original TIMSK1 value but with stepper ISR disabled */ \
274
-    A("ori r16,%[msk1]")               /* 1 Reenable the stepper ISR */ \
275
-    A("cli")                           /* 1 Disable global interrupts - Reenabling Stepper ISR can reenter amd temperature can reenter, and we want that, if it happens, after this ISR has ended */ \
276
-    A("sts %[timsk1], r16")            /* 2 And restore the old value - This reenables the stepper ISR */ \
277
-    A("pop r16")                       /* 2 Get the temperature timer Interrupt mask register [TIMSK0] */ \
278
-    A("sts %[timsk0], r16")            /* 2 And restore the old value - This reenables the temperature ISR */ \
279
-    A("pop r16")                       /* 2 Get the old SREG value */ \
280
-    A("out __SREG__, r16")             /* 1 And restore the SREG value */ \
281
-    A("pop r16")                       /* 2 Restore R16 value */ \
282
-    A("reti")                          /* 4 Return from interrupt */ \
283
-    :                                   \
284
-    : [timsk0] "i" ((uint16_t)&TIMSK0), \
285
-      [timsk1] "i" ((uint16_t)&TIMSK1), \
286
-      [msk0] "M" ((uint8_t)(1<<OCIE0B)),\
287
-      [msk1] "M" ((uint8_t)(1<<OCIE1A)) \
288
-    : \
289
-  ); \
290
-} \
291
-void TIMER1_COMPA_vect_bottom()
292
-
293
-/* 14 cycles maximum latency */
294
-#define HAL_TEMP_TIMER_ISR() \
295
-extern "C" void TIMER0_COMPB_vect() __attribute__ ((signal, naked, used, externally_visible)); \
296
-extern "C" void TIMER0_COMPB_vect_bottom()  asm ("TIMER0_COMPB_vect_bottom") __attribute__ ((used, externally_visible, noinline)); \
297
-void TIMER0_COMPB_vect() { \
298
-  __asm__ __volatile__ ( \
299
-    A("push r16")                       /* 2 Save R16 */ \
300
-    A("in r16, __SREG__")               /* 1 Get SREG */ \
301
-    A("push r16")                       /* 2 Save SREG into stack */ \
302
-    A("lds r16, %[timsk0]")             /* 2 Load into R0 the Temperature timer Interrupt mask register */ \
303
-    A("andi r16,~%[msk0]")              /* 1 Disable the temperature ISR */ \
304
-    A("sts %[timsk0], r16")             /* 2 And set the new value */ \
305
-    A("sei")                            /* 1 Enable global interrupts - It is safe, as the temperature ISR is disabled, so we cannot reenter it */    \
306
-    A("push r16")                       /* 2 Save TIMSK0 into stack */ \
307
-    A("in r16, 0x3B")                   /* 1 Get RAMPZ register */ \
308
-    A("push r16")                       /* 2 Save RAMPZ into stack */ \
309
-    A("in r16, 0x3C")                   /* 1 Get EIND register */ \
310
-    A("push r0")                        /* C runtime can modify all the following registers without restoring them */ \
311
-    A("push r1")                        \
312
-    A("push r18")                       \
313
-    A("push r19")                       \
314
-    A("push r20")                       \
315
-    A("push r21")                       \
316
-    A("push r22")                       \
317
-    A("push r23")                       \
318
-    A("push r24")                       \
319
-    A("push r25")                       \
320
-    A("push r26")                       \
321
-    A("push r27")                       \
322
-    A("push r30")                       \
323
-    A("push r31")                       \
324
-    A("clr r1")                         /* C runtime expects this register to be 0 */ \
325
-    A("call TIMER0_COMPB_vect_bottom")  /* Call the bottom handler - No inlining allowed, otherwise registers used are not saved */   \
326
-    A("pop r31")                        \
327
-    A("pop r30")                        \
328
-    A("pop r27")                        \
329
-    A("pop r26")                        \
330
-    A("pop r25")                        \
331
-    A("pop r24")                        \
332
-    A("pop r23")                        \
333
-    A("pop r22")                        \
334
-    A("pop r21")                        \
335
-    A("pop r20")                        \
336
-    A("pop r19")                        \
337
-    A("pop r18")                        \
338
-    A("pop r1")                         \
339
-    A("pop r0")                         \
340
-    A("out 0x3C, r16")                  /* 1 Restore EIND register */ \
341
-    A("pop r16")                        /* 2 Get the original RAMPZ register value */ \
342
-    A("out 0x3B, r16")                  /* 1 Restore RAMPZ register to its original value */ \
343
-    A("pop r16")                        /* 2 Get the original TIMSK0 value but with temperature ISR disabled */ \
344
-    A("ori r16,%[msk0]")                /* 1 Enable temperature ISR */ \
345
-    A("cli")                            /* 1 Disable global interrupts - We must do this, as we will reenable the temperature ISR, and we don't want to reenter this handler until the current one is done */ \
346
-    A("sts %[timsk0], r16")             /* 2 And restore the old value */ \
347
-    A("pop r16")                        /* 2 Get the old SREG */ \
348
-    A("out __SREG__, r16")              /* 1 And restore the SREG value */ \
349
-    A("pop r16")                        /* 2 Restore R16 */ \
350
-    A("reti")                           /* 4 Return from interrupt */ \
351
-    :                                   \
352
-    : [timsk0] "i"((uint16_t)&TIMSK0),  \
353
-      [msk0] "M" ((uint8_t)(1<<OCIE0B)) \
354
-    : \
355
-  ); \
356
-} \
357
-void TIMER0_COMPB_vect_bottom()
358
-
359 132
 // ADC
360 133
 #ifdef DIDR2
361 134
   #define HAL_ANALOG_SELECT(ind) do{ if (ind < 8) SBI(DIDR0, ind); else SBI(DIDR2, ind & 0x07); }while(0)
@@ -378,6 +151,7 @@ inline void HAL_adc_init() {
378 151
   #define HAL_START_ADC(ch) ADCSRB = 0; SET_ADMUX_ADCSRA(ch)
379 152
 #endif
380 153
 
154
+#define HAL_ADC_VREF        5.0
381 155
 #define HAL_ADC_RESOLUTION 10
382 156
 #define HAL_READ_ADC()  ADC
383 157
 #define HAL_ADC_READY() !TEST(ADCSRA, ADSC)
@@ -395,6 +169,8 @@ inline void HAL_adc_init() {
395 169
 // AVR compatibility
396 170
 #define strtof strtod
397 171
 
172
+#define HAL_CAN_SET_PWM_FREQ   // This HAL supports PWM Frequency adjustment
173
+
398 174
 /**
399 175
  *  set_pwm_frequency
400 176
  *  Sets the frequency of the timer corresponding to the provided pin

+ 1
- 1
Marlin/src/HAL/AVR/HAL_SPI.cpp Voir le fichier

@@ -16,7 +16,7 @@
16 16
  * GNU General Public License for more details.
17 17
  *
18 18
  * You should have received a copy of the GNU General Public License
19
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
19
+ * along with this program.  If not, see <https://www.gnu.org/licenses/>.
20 20
  *
21 21
  */
22 22
 

+ 618
- 608
Marlin/src/HAL/AVR/MarlinSerial.cpp
Fichier diff supprimé car celui-ci est trop grand
Voir le fichier


+ 38
- 24
Marlin/src/HAL/AVR/MarlinSerial.h Voir le fichier

@@ -16,7 +16,7 @@
16 16
  * GNU General Public License for more details.
17 17
  *
18 18
  * You should have received a copy of the GNU General Public License
19
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
19
+ * along with this program.  If not, see <https://www.gnu.org/licenses/>.
20 20
  *
21 21
  */
22 22
 #pragma once
@@ -48,11 +48,11 @@
48 48
 
49 49
   // These are macros to build serial port register names for the selected SERIAL_PORT (C preprocessor
50 50
   // requires two levels of indirection to expand macro values properly)
51
-  #define SERIAL_REGNAME(registerbase,number,suffix) SERIAL_REGNAME_INTERNAL(registerbase,number,suffix)
51
+  #define SERIAL_REGNAME(registerbase,number,suffix) _SERIAL_REGNAME(registerbase,number,suffix)
52 52
   #if SERIAL_PORT == 0 && (!defined(UBRR0H) || !defined(UDR0)) // use un-numbered registers if necessary
53
-    #define SERIAL_REGNAME_INTERNAL(registerbase,number,suffix) registerbase##suffix
53
+    #define _SERIAL_REGNAME(registerbase,number,suffix) registerbase##suffix
54 54
   #else
55
-    #define SERIAL_REGNAME_INTERNAL(registerbase,number,suffix) registerbase##number##suffix
55
+    #define _SERIAL_REGNAME(registerbase,number,suffix) registerbase##number##suffix
56 56
   #endif
57 57
 
58 58
   // Registers used by MarlinSerial class (expanded depending on selected serial port)
@@ -217,10 +217,12 @@
217 217
       static ring_buffer_pos_t available();
218 218
       static void write(const uint8_t c);
219 219
       static void flushTX();
220
-      #ifdef DGUS_SERIAL_PORT
220
+      #if HAS_DGUS_LCD
221 221
         static ring_buffer_pos_t get_tx_buffer_free();
222 222
       #endif
223 223
 
224
+      static inline bool emergency_parser_enabled() { return Cfg::EMERGENCYPARSER; }
225
+
224 226
       FORCE_INLINE static uint8_t dropped() { return Cfg::DROPPED_RX ? rx_dropped_bytes : 0; }
225 227
       FORCE_INLINE static uint8_t buffer_overruns() { return Cfg::RX_OVERRUNS ? rx_buffer_overruns : 0; }
226 228
       FORCE_INLINE static uint8_t framing_errors() { return Cfg::RX_FRAMING_ERRORS ? rx_framing_errors : 0; }
@@ -278,41 +280,53 @@
278 280
 
279 281
 #endif // !USBCON
280 282
 
281
-#ifdef INTERNAL_SERIAL_PORT
283
+#ifdef MMU2_SERIAL_PORT
282 284
   template <uint8_t serial>
283
-  struct MarlinInternalSerialCfg {
285
+  struct MMU2SerialCfg {
284 286
     static constexpr int PORT               = serial;
285
-    static constexpr unsigned int RX_SIZE   = 32;
286
-    static constexpr unsigned int TX_SIZE   = 32;
287 287
     static constexpr bool XONOFF            = false;
288 288
     static constexpr bool EMERGENCYPARSER   = false;
289 289
     static constexpr bool DROPPED_RX        = false;
290
-    static constexpr bool RX_OVERRUNS       = false;
291 290
     static constexpr bool RX_FRAMING_ERRORS = false;
292 291
     static constexpr bool MAX_RX_QUEUED     = false;
292
+    static constexpr unsigned int RX_SIZE   = 32;
293
+    static constexpr unsigned int TX_SIZE   = 32;
294
+    static constexpr bool RX_OVERRUNS       = false;
293 295
   };
294 296
 
295
-  extern MarlinSerial<MarlinInternalSerialCfg<INTERNAL_SERIAL_PORT>> internalSerial;
297
+  extern MarlinSerial<MMU2SerialCfg<MMU2_SERIAL_PORT>> mmuSerial;
296 298
 #endif
297 299
 
298
-#ifdef DGUS_SERIAL_PORT
300
+#ifdef LCD_SERIAL_PORT
301
+
299 302
   template <uint8_t serial>
300
-  struct MarlinInternalSerialCfg {
301
-    static constexpr int PORT               = serial;
302
-    static constexpr unsigned int RX_SIZE   = 128;
303
-    static constexpr unsigned int TX_SIZE   = 48;
304
-    static constexpr bool XONOFF            = false;
305
-    static constexpr bool EMERGENCYPARSER   = false;
306
-    static constexpr bool DROPPED_RX        = false;
307
-    static constexpr bool RX_OVERRUNS       = HAS_DGUS_LCD && ENABLED(DGUS_SERIAL_STATS_RX_BUFFER_OVERRUNS);
308
-    static constexpr bool RX_FRAMING_ERRORS = false;
309
-    static constexpr bool MAX_RX_QUEUED     = false;
303
+  struct LCDSerialCfg {
304
+    static constexpr int PORT                 = serial;
305
+    static constexpr bool XONOFF              = false;
306
+    static constexpr bool EMERGENCYPARSER     = ENABLED(EMERGENCY_PARSER);
307
+    static constexpr bool DROPPED_RX          = false;
308
+    static constexpr bool RX_FRAMING_ERRORS   = false;
309
+    static constexpr bool MAX_RX_QUEUED       = false;
310
+    #if HAS_DGUS_LCD
311
+      static constexpr unsigned int RX_SIZE   = DGUS_RX_BUFFER_SIZE;
312
+      static constexpr unsigned int TX_SIZE   = DGUS_TX_BUFFER_SIZE;
313
+      static constexpr bool RX_OVERRUNS       = ENABLED(SERIAL_STATS_RX_BUFFER_OVERRUNS);
314
+    #elif EITHER(ANYCUBIC_LCD_I3MEGA, ANYCUBIC_LCD_CHIRON)
315
+      static constexpr unsigned int RX_SIZE   = 64;
316
+      static constexpr unsigned int TX_SIZE   = 128;
317
+      static constexpr bool RX_OVERRUNS       = false;
318
+    #else
319
+      static constexpr unsigned int RX_SIZE   = 64;
320
+      static constexpr unsigned int TX_SIZE   = 128;
321
+      static constexpr bool RX_OVERRUNS       = false
322
+    #endif
310 323
   };
311 324
 
312
-  extern MarlinSerial<MarlinInternalSerialCfg<DGUS_SERIAL_PORT>> internalDgusSerial;
325
+  extern MarlinSerial<LCDSerialCfg<LCD_SERIAL_PORT>> lcdSerial;
326
+
313 327
 #endif
314 328
 
315 329
 // Use the UART for Bluetooth in AT90USB configurations
316
-#if defined(USBCON) && ENABLED(BLUETOOTH)
330
+#if BOTH(IS_AT90USB, BLUETOOTH)
317 331
   extern HardwareSerial bluetoothSerial;
318 332
 #endif

+ 1
- 3
Marlin/src/HAL/AVR/Servo.cpp Voir le fichier

@@ -16,7 +16,7 @@
16 16
  * GNU General Public License for more details.
17 17
  *
18 18
  * You should have received a copy of the GNU General Public License
19
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
19
+ * along with this program.  If not, see <https://www.gnu.org/licenses/>.
20 20
  *
21 21
  */
22 22
 
@@ -48,7 +48,6 @@
48 48
  * readMicroseconds()    - Get the last-written servo pulse width in microseconds.
49 49
  * attached()            - Return true if a servo is attached.
50 50
  * detach()              - Stop an attached servo from pulsing its i/o pin.
51
- *
52 51
  */
53 52
 
54 53
 #ifdef __AVR__
@@ -59,7 +58,6 @@
59 58
 
60 59
 #include <avr/interrupt.h>
61 60
 
62
-#include "../shared/Marduino.h"
63 61
 #include "../shared/servo.h"
64 62
 #include "../shared/servo_private.h"
65 63
 

+ 6
- 4
Marlin/src/HAL/AVR/ServoTimers.h Voir le fichier

@@ -16,7 +16,7 @@
16 16
  * GNU General Public License for more details.
17 17
  *
18 18
  * You should have received a copy of the GNU General Public License
19
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
19
+ * along with this program.  If not, see <https://www.gnu.org/licenses/>.
20 20
  *
21 21
  */
22 22
 #pragma once
@@ -59,10 +59,12 @@
59 59
 // Say which 16 bit timers can be used and in what order
60 60
 #if defined(__AVR_ATmega1280__) || defined(__AVR_ATmega2560__)
61 61
   //#define _useTimer1
62
-  #define _useTimer3
63 62
   #define _useTimer4
64
-  #if !HAS_MOTOR_CURRENT_PWM
65
-    #define _useTimer5 // Timer 5 is used for motor current PWM and can't be used for servos.
63
+  #if NUM_SERVOS > SERVOS_PER_TIMER
64
+    #define _useTimer3
65
+    #if !HAS_MOTOR_CURRENT_PWM && SERVOS > 2 * SERVOS_PER_TIMER
66
+      #define _useTimer5 // Timer 5 is used for motor current PWM and can't be used for servos.
67
+    #endif
66 68
   #endif
67 69
 #elif defined(__AVR_ATmega32U4__)
68 70
   #define _useTimer3

Marlin/src/HAL/AVR/persistent_store_eeprom.cpp → Marlin/src/HAL/AVR/eeprom.cpp Voir le fichier

@@ -16,7 +16,7 @@
16 16
  * GNU General Public License for more details.
17 17
  *
18 18
  * You should have received a copy of the GNU General Public License
19
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
19
+ * along with this program.  If not, see <https://www.gnu.org/licenses/>.
20 20
  *
21 21
  */
22 22
 #ifdef __AVR__
@@ -25,9 +25,18 @@
25 25
 
26 26
 #if EITHER(EEPROM_SETTINGS, SD_FIRMWARE_UPDATE)
27 27
 
28
-#include "../shared/persistent_store_api.h"
28
+/**
29
+ * PersistentStore for Arduino-style EEPROM interface
30
+ * with implementations supplied by the framework.
31
+ */
29 32
 
30
-bool PersistentStore::access_start() { return true; }
33
+#include "../shared/eeprom_api.h"
34
+
35
+#ifndef MARLIN_EEPROM_SIZE
36
+  #define MARLIN_EEPROM_SIZE size_t(E2END + 1)
37
+#endif
38
+size_t PersistentStore::capacity()    { return MARLIN_EEPROM_SIZE; }
39
+bool PersistentStore::access_start()  { return true; }
31 40
 bool PersistentStore::access_finish() { return true; }
32 41
 
33 42
 bool PersistentStore::write_data(int &pos, const uint8_t *value, size_t size, uint16_t *crc) {
@@ -46,7 +55,7 @@ bool PersistentStore::write_data(int &pos, const uint8_t *value, size_t size, ui
46 55
     crc16(crc, &v, 1);
47 56
     pos++;
48 57
     value++;
49
-  };
58
+  }
50 59
   return false;
51 60
 }
52 61
 
@@ -61,7 +70,5 @@ bool PersistentStore::read_data(int &pos, uint8_t* value, size_t size, uint16_t
61 70
   return false;  // always assume success for AVR's
62 71
 }
63 72
 
64
-size_t PersistentStore::capacity() { return E2END + 1; }
65
-
66 73
 #endif // EEPROM_SETTINGS || SD_FIRMWARE_UPDATE
67 74
 #endif // __AVR__

+ 1
- 1
Marlin/src/HAL/AVR/endstop_interrupts.h Voir le fichier

@@ -16,7 +16,7 @@
16 16
  * GNU General Public License for more details.
17 17
  *
18 18
  * You should have received a copy of the GNU General Public License
19
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
19
+ * along with this program.  If not, see <https://www.gnu.org/licenses/>.
20 20
  *
21 21
  */
22 22
 #pragma once

+ 6
- 6
Marlin/src/HAL/AVR/fast_pwm.cpp Voir le fichier

@@ -16,14 +16,14 @@
16 16
  * GNU General Public License for more details.
17 17
  *
18 18
  * You should have received a copy of the GNU General Public License
19
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
19
+ * along with this program.  If not, see <https://www.gnu.org/licenses/>.
20 20
  *
21 21
  */
22 22
 #ifdef __AVR__
23 23
 
24 24
 #include "../../inc/MarlinConfigPre.h"
25 25
 
26
-#if ENABLED(FAST_PWM_FAN) || SPINDLE_LASER_PWM
26
+#if NEEDS_HARDWARE_PWM // Specific meta-flag for features that mandate PWM
27 27
 
28 28
 #include "HAL.h"
29 29
 
@@ -185,8 +185,8 @@ void set_pwm_frequency(const pin_t pin, int f_desired) {
185 185
         res_temp_phase_correct = rtf / 2;
186 186
       }
187 187
 
188
-      LIMIT(res_temp_fast, 1u, size);
189
-      LIMIT(res_temp_phase_correct, 1u, size);
188
+      LIMIT(res_temp_fast, 1U, size);
189
+      LIMIT(res_temp_phase_correct, 1U, size);
190 190
       // Calculate frequencies of test prescaler and resolution values
191 191
       const int f_temp_fast = (F_CPU) / (prescaler[i] * (1 + res_temp_fast)),
192 192
                 f_temp_phase_correct = (F_CPU) / (2 * prescaler[i] * res_temp_phase_correct),
@@ -274,9 +274,9 @@ void set_pwm_duty(const pin_t pin, const uint16_t v, const uint16_t v_size/*=255
274 274
     else
275 275
       top = *timer.ICRn; // top = ICRn
276 276
 
277
-    _SET_OCRnQ(timer.OCRnQ, timer.q, v * float(top / v_size)); // Scale 8/16-bit v to top value
277
+    _SET_OCRnQ(timer.OCRnQ, timer.q, v * float(top) / float(v_size)); // Scale 8/16-bit v to top value
278 278
   }
279 279
 }
280 280
 
281
-#endif // FAST_PWM_FAN || SPINDLE_LASER_PWM
281
+#endif // NEEDS_HARDWARE_PWM
282 282
 #endif // __AVR__

+ 51
- 1
Marlin/src/HAL/AVR/fastio.cpp Voir le fichier

@@ -16,7 +16,7 @@
16 16
  * GNU General Public License for more details.
17 17
  *
18 18
  * You should have received a copy of the GNU General Public License
19
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
19
+ * along with this program.  If not, see <https://www.gnu.org/licenses/>.
20 20
  *
21 21
  */
22 22
 
@@ -234,5 +234,55 @@ uint8_t extDigitalRead(const int8_t pin) {
234 234
   }
235 235
 }
236 236
 
237
+#if 0
238
+/**
239
+ * Set Timer 5 PWM frequency in Hz, from 3.8Hz up to ~16MHz
240
+ * with a minimum resolution of 100 steps.
241
+ *
242
+ * DC values -1.0 to 1.0. Negative duty cycle inverts the pulse.
243
+ */
244
+uint16_t set_pwm_frequency_hz(const float &hz, const float dca, const float dcb, const float dcc) {
245
+  float count = 0;
246
+  if (hz > 0 && (dca || dcb || dcc)) {
247
+    count = float(F_CPU) / hz;            // 1x prescaler, TOP for 16MHz base freq.
248
+    uint16_t prescaler;                   // Range of 30.5Hz (65535) 64.5KHz (>31)
249
+
250
+         if (count >= 255. * 256.) { prescaler = 1024; SET_CS(5, PRESCALER_1024); }
251
+    else if (count >= 255. * 64.)  { prescaler = 256;  SET_CS(5,  PRESCALER_256); }
252
+    else if (count >= 255. * 8.)   { prescaler = 64;   SET_CS(5,   PRESCALER_64); }
253
+    else if (count >= 255.)        { prescaler = 8;    SET_CS(5,    PRESCALER_8); }
254
+    else                           { prescaler = 1;    SET_CS(5,    PRESCALER_1); }
255
+
256
+    count /= float(prescaler);
257
+    const float pwm_top = round(count);   // Get the rounded count
258
+
259
+    ICR5 = (uint16_t)pwm_top - 1;         // Subtract 1 for TOP
260
+    OCR5A = pwm_top * ABS(dca);          // Update and scale DCs
261
+    OCR5B = pwm_top * ABS(dcb);
262
+    OCR5C = pwm_top * ABS(dcc);
263
+    _SET_COM(5, A, dca ? (dca < 0 ? COM_SET_CLEAR : COM_CLEAR_SET) : COM_NORMAL); // Set compare modes
264
+    _SET_COM(5, B, dcb ? (dcb < 0 ? COM_SET_CLEAR : COM_CLEAR_SET) : COM_NORMAL);
265
+    _SET_COM(5, C, dcc ? (dcc < 0 ? COM_SET_CLEAR : COM_CLEAR_SET) : COM_NORMAL);
266
+
267
+    SET_WGM(5, FAST_PWM_ICRn);            // Fast PWM with ICR5 as TOP
268
+
269
+    //SERIAL_ECHOLNPGM("Timer 5 Settings:");
270
+    //SERIAL_ECHOLNPAIR("  Prescaler=", prescaler);
271
+    //SERIAL_ECHOLNPAIR("        TOP=", ICR5);
272
+    //SERIAL_ECHOLNPAIR("      OCR5A=", OCR5A);
273
+    //SERIAL_ECHOLNPAIR("      OCR5B=", OCR5B);
274
+    //SERIAL_ECHOLNPAIR("      OCR5C=", OCR5C);
275
+  }
276
+  else {
277
+    // Restore the default for Timer 5
278
+    SET_WGM(5, PWM_PC_8);                 // PWM 8-bit (Phase Correct)
279
+    SET_COMS(5, NORMAL, NORMAL, NORMAL);  // Do nothing
280
+    SET_CS(5, PRESCALER_64);              // 16MHz / 64 = 250KHz
281
+    OCR5A = OCR5B = OCR5C = 0;
282
+  }
283
+  return round(count);
284
+}
285
+#endif
286
+
237 287
 #endif // FASTIO_EXT_START
238 288
 #endif // __AVR__

+ 15
- 9
Marlin/src/HAL/AVR/fastio.h Voir le fichier

@@ -16,7 +16,7 @@
16 16
  * GNU General Public License for more details.
17 17
  *
18 18
  * You should have received a copy of the GNU General Public License
19
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
19
+ * along with this program.  If not, see <https://www.gnu.org/licenses/>.
20 20
  *
21 21
  */
22 22
 #pragma once
@@ -29,11 +29,17 @@
29 29
 
30 30
 #include <avr/io.h>
31 31
 
32
-#define AVR_AT90USB1286_FAMILY (defined(__AVR_AT90USB1287__) || defined(__AVR_AT90USB1286__) || defined(__AVR_AT90USB1286P__) || defined(__AVR_AT90USB646__) || defined(__AVR_AT90USB646P__) || defined(__AVR_AT90USB647__))
33
-#define AVR_ATmega1284_FAMILY (defined(__AVR_ATmega644__) || defined(__AVR_ATmega644P__) || defined(__AVR_ATmega644PA__) || defined(__AVR_ATmega1284P__))
34
-#define AVR_ATmega2560_FAMILY (defined(__AVR_ATmega1280__) || defined(__AVR_ATmega2560__))
35
-#define AVR_ATmega2561_FAMILY (defined(__AVR_ATmega1281__) || defined(__AVR_ATmega2561__))
36
-#define AVR_ATmega328_FAMILY (defined(__AVR_ATmega168__) || defined(__AVR_ATmega328__) || defined(__AVR_ATmega328P__))
32
+#if defined(__AVR_AT90USB1287__) || defined(__AVR_AT90USB1286__) || defined(__AVR_AT90USB1286P__) || defined(__AVR_AT90USB646__) || defined(__AVR_AT90USB646P__) || defined(__AVR_AT90USB647__)
33
+  #define AVR_AT90USB1286_FAMILY 1
34
+#elif defined(__AVR_ATmega644__) || defined(__AVR_ATmega644P__) || defined(__AVR_ATmega644PA__) || defined(__AVR_ATmega1284P__)
35
+  #define AVR_ATmega1284_FAMILY 1
36
+#elif defined(__AVR_ATmega1280__) || defined(__AVR_ATmega2560__)
37
+  #define AVR_ATmega2560_FAMILY 1
38
+#elif defined(__AVR_ATmega1281__) || defined(__AVR_ATmega2561__)
39
+  #define AVR_ATmega2561_FAMILY 1
40
+#elif defined(__AVR_ATmega168__) || defined(__AVR_ATmega328__) || defined(__AVR_ATmega328P__)
41
+  #define AVR_ATmega328_FAMILY 1
42
+#endif
37 43
 
38 44
 /**
39 45
  * Include Ports and Functions
@@ -57,7 +63,7 @@
57 63
  *
58 64
  * Now you can simply SET_OUTPUT(PIN); WRITE(PIN, HIGH); WRITE(PIN, LOW);
59 65
  *
60
- * Why double up on these macros? see http://gcc.gnu.org/onlinedocs/cpp/Stringification.html
66
+ * Why double up on these macros? see https://gcc.gnu.org/onlinedocs/cpp/Stringification.html
61 67
  */
62 68
 
63 69
 #define _READ(IO)             TEST(DIO ## IO ## _RPORT, DIO ## IO ## _PIN)
@@ -98,9 +104,9 @@
98 104
 
99 105
 #define SET_INPUT(IO)         _SET_INPUT(IO)
100 106
 #define SET_INPUT_PULLUP(IO)  do{ _SET_INPUT(IO); _WRITE(IO, HIGH); }while(0)
107
+#define SET_INPUT_PULLDOWN    SET_INPUT
101 108
 #define SET_OUTPUT(IO)        _SET_OUTPUT(IO)
102
-
103
-#define SET_PWM(IO)           SET_OUTPUT(IO)
109
+#define SET_PWM               SET_OUTPUT
104 110
 
105 111
 #define IS_INPUT(IO)          _IS_INPUT(IO)
106 112
 #define IS_OUTPUT(IO)         _IS_OUTPUT(IO)

+ 1
- 1
Marlin/src/HAL/AVR/fastio/fastio_1280.h Voir le fichier

@@ -16,7 +16,7 @@
16 16
  * GNU General Public License for more details.
17 17
  *
18 18
  * You should have received a copy of the GNU General Public License
19
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
19
+ * along with this program.  If not, see <https://www.gnu.org/licenses/>.
20 20
  *
21 21
  */
22 22
 #pragma once

+ 1
- 1
Marlin/src/HAL/AVR/fastio/fastio_1281.h Voir le fichier

@@ -16,7 +16,7 @@
16 16
  * GNU General Public License for more details.
17 17
  *
18 18
  * You should have received a copy of the GNU General Public License
19
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
19
+ * along with this program.  If not, see <https://www.gnu.org/licenses/>.
20 20
  *
21 21
  */
22 22
 #pragma once

+ 1
- 1
Marlin/src/HAL/AVR/fastio/fastio_168.h Voir le fichier

@@ -16,7 +16,7 @@
16 16
  * GNU General Public License for more details.
17 17
  *
18 18
  * You should have received a copy of the GNU General Public License
19
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
19
+ * along with this program.  If not, see <https://www.gnu.org/licenses/>.
20 20
  *
21 21
  */
22 22
 #pragma once

+ 1
- 1
Marlin/src/HAL/AVR/fastio/fastio_644.h Voir le fichier

@@ -16,7 +16,7 @@
16 16
  * GNU General Public License for more details.
17 17
  *
18 18
  * You should have received a copy of the GNU General Public License
19
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
19
+ * along with this program.  If not, see <https://www.gnu.org/licenses/>.
20 20
  *
21 21
  */
22 22
 #pragma once

+ 1
- 1
Marlin/src/HAL/AVR/fastio/fastio_AT90USB.h Voir le fichier

@@ -16,7 +16,7 @@
16 16
  * GNU General Public License for more details.
17 17
  *
18 18
  * You should have received a copy of the GNU General Public License
19
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
19
+ * along with this program.  If not, see <https://www.gnu.org/licenses/>.
20 20
  *
21 21
  */
22 22
 #pragma once

+ 5
- 1
Marlin/src/HAL/AVR/inc/Conditionals_LCD.h Voir le fichier

@@ -16,7 +16,11 @@
16 16
  * GNU General Public License for more details.
17 17
  *
18 18
  * You should have received a copy of the GNU General Public License
19
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
19
+ * along with this program.  If not, see <https://www.gnu.org/licenses/>.
20 20
  *
21 21
  */
22 22
 #pragma once
23
+
24
+#if HAS_SPI_TFT || HAS_FSMC_TFT
25
+  #error "Sorry! TFT displays are not available for HAL/AVR."
26
+#endif

+ 1
- 1
Marlin/src/HAL/AVR/inc/Conditionals_adv.h Voir le fichier

@@ -16,7 +16,7 @@
16 16
  * GNU General Public License for more details.
17 17
  *
18 18
  * You should have received a copy of the GNU General Public License
19
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
19
+ * along with this program.  If not, see <https://www.gnu.org/licenses/>.
20 20
  *
21 21
  */
22 22
 #pragma once

+ 1
- 1
Marlin/src/HAL/AVR/inc/Conditionals_post.h Voir le fichier

@@ -16,7 +16,7 @@
16 16
  * GNU General Public License for more details.
17 17
  *
18 18
  * You should have received a copy of the GNU General Public License
19
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
19
+ * along with this program.  If not, see <https://www.gnu.org/licenses/>.
20 20
  *
21 21
  */
22 22
 #pragma once

+ 7
- 14
Marlin/src/HAL/AVR/inc/SanityCheck.h Voir le fichier

@@ -16,7 +16,7 @@
16 16
  * GNU General Public License for more details.
17 17
  *
18 18
  * You should have received a copy of the GNU General Public License
19
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
19
+ * along with this program.  If not, see <https://www.gnu.org/licenses/>.
20 20
  *
21 21
  */
22 22
 #pragma once
@@ -26,16 +26,6 @@
26 26
  */
27 27
 
28 28
 /**
29
- * Digipot requirement
30
- */
31
- #if ENABLED(DIGIPOT_MCP4018)
32
-  #if !defined(DIGIPOTS_I2C_SDA_X) || !defined(DIGIPOTS_I2C_SDA_Y) || !defined(DIGIPOTS_I2C_SDA_Z) \
33
-    || !defined(DIGIPOTS_I2C_SDA_E0) || !defined(DIGIPOTS_I2C_SDA_E1)
34
-      #error "DIGIPOT_MCP4018 requires DIGIPOTS_I2C_SDA_* pins to be defined."
35
-  #endif
36
-#endif
37
-
38
-/**
39 29
  * Checks for FAST PWM
40 30
  */
41 31
 #if ENABLED(FAST_PWM_FAN) && (ENABLED(USE_OCR2A_AS_TOP) && defined(TCCR2))
@@ -46,20 +36,23 @@
46 36
  * Sanity checks for Spindle / Laser PWM
47 37
  */
48 38
 #if ENABLED(SPINDLE_LASER_PWM)
39
+  #include "../ServoTimers.h"   // Needed to check timer availability (_useTimer3)
49 40
   #if SPINDLE_LASER_PWM_PIN == 4 || WITHIN(SPINDLE_LASER_PWM_PIN, 11, 13)
50 41
     #error "Counter/Timer for SPINDLE_LASER_PWM_PIN is used by a system interrupt."
51
-  #elif NUM_SERVOS > 0 && (WITHIN(SPINDLE_LASER_PWM_PIN, 2, 3) || SPINDLE_LASER_PWM_PIN == 5)
42
+  #elif NUM_SERVOS > 0 && defined(_useTimer3) && (WITHIN(SPINDLE_LASER_PWM_PIN, 2, 3) || SPINDLE_LASER_PWM_PIN == 5)
52 43
     #error "Counter/Timer for SPINDLE_LASER_PWM_PIN is used by the servo system."
53 44
   #endif
45
+#elif defined(SPINDLE_LASER_FREQUENCY)
46
+  #error "SPINDLE_LASER_FREQUENCY requires SPINDLE_LASER_PWM."
54 47
 #endif
55 48
 
56 49
 /**
57 50
  * The Trinamic library includes SoftwareSerial.h, leading to a compile error.
58 51
  */
59
-#if HAS_TRINAMIC_CONFIG && ENABLED(ENDSTOP_INTERRUPTS_FEATURE)
52
+#if BOTH(HAS_TRINAMIC_CONFIG, ENDSTOP_INTERRUPTS_FEATURE)
60 53
   #error "TMCStepper includes SoftwareSerial.h which is incompatible with ENDSTOP_INTERRUPTS_FEATURE. Disable ENDSTOP_INTERRUPTS_FEATURE to continue."
61 54
 #endif
62 55
 
63
-#if HAS_TMC_SW_SERIAL && ENABLED(MONITOR_DRIVER_STATUS)
56
+#if BOTH(HAS_TMC_SW_SERIAL, MONITOR_DRIVER_STATUS)
64 57
   #error "MONITOR_DRIVER_STATUS causes performance issues when used with SoftwareSerial-connected drivers. Disable MONITOR_DRIVER_STATUS or use hardware serial to continue."
65 58
 #endif

+ 1
- 1
Marlin/src/HAL/AVR/math.h Voir le fichier

@@ -16,7 +16,7 @@
16 16
  * GNU General Public License for more details.
17 17
  *
18 18
  * You should have received a copy of the GNU General Public License
19
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
19
+ * along with this program.  If not, see <https://www.gnu.org/licenses/>.
20 20
  *
21 21
  */
22 22
 #pragma once

+ 4
- 2
Marlin/src/HAL/AVR/pinsDebug.h Voir le fichier

@@ -13,7 +13,7 @@
13 13
  * GNU General Public License for more details.
14 14
  *
15 15
  * You should have received a copy of the GNU General Public License
16
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
16
+ * along with this program.  If not, see <https://www.gnu.org/licenses/>.
17 17
  *
18 18
  */
19 19
 #pragma once
@@ -26,7 +26,9 @@
26 26
 
27 27
 #define NUMBER_PINS_TOTAL NUM_DIGITAL_PINS
28 28
 
29
-#define AVR_ATmega2560_FAMILY_PLUS_70 MB(BQ_ZUM_MEGA_3D, MIGHTYBOARD_REVE, MINIRAMBO, SCOOVO_X9H)
29
+#if MB(BQ_ZUM_MEGA_3D, MIGHTYBOARD_REVE, MINIRAMBO, SCOOVO_X9H, TRIGORILLA_14)
30
+  #define AVR_ATmega2560_FAMILY_PLUS_70 1
31
+#endif
30 32
 
31 33
 #if AVR_AT90USB1286_FAMILY
32 34
 

+ 1
- 1
Marlin/src/HAL/AVR/pinsDebug_Teensyduino.h Voir le fichier

@@ -13,7 +13,7 @@
13 13
  * GNU General Public License for more details.
14 14
  *
15 15
  * You should have received a copy of the GNU General Public License
16
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
16
+ * along with this program.  If not, see <https://www.gnu.org/licenses/>.
17 17
  *
18 18
  */
19 19
 #pragma once

+ 4
- 7
Marlin/src/HAL/AVR/pinsDebug_plus_70.h Voir le fichier

@@ -13,7 +13,7 @@
13 13
  * GNU General Public License for more details.
14 14
  *
15 15
  * You should have received a copy of the GNU General Public License
16
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
16
+ * along with this program.  If not, see <https://www.gnu.org/licenses/>.
17 17
  *
18 18
  */
19 19
 #pragma once
@@ -22,15 +22,12 @@
22 22
  * Structures for 2560 family boards that use more than 70 pins
23 23
  */
24 24
 
25
-#undef NUM_DIGITAL_PINS
26
-#if MB(BQ_ZUM_MEGA_3D)
25
+#if MB(BQ_ZUM_MEGA_3D, MINIRAMBO, SCOOVO_X9H, TRIGORILLA_14)
26
+  #undef NUM_DIGITAL_PINS
27 27
   #define NUM_DIGITAL_PINS            85
28 28
 #elif MB(MIGHTYBOARD_REVE)
29
+  #undef NUM_DIGITAL_PINS
29 30
   #define NUM_DIGITAL_PINS            80
30
-#elif MB(MINIRAMBO)
31
-  #define NUM_DIGITAL_PINS            85
32
-#elif MB(SCOOVO_X9H)
33
-  #define NUM_DIGITAL_PINS            85
34 31
 #endif
35 32
 
36 33
 #define PA 1

+ 1
- 1
Marlin/src/HAL/AVR/spi_pins.h Voir le fichier

@@ -16,7 +16,7 @@
16 16
  * GNU General Public License for more details.
17 17
  *
18 18
  * You should have received a copy of the GNU General Public License
19
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
19
+ * along with this program.  If not, see <https://www.gnu.org/licenses/>.
20 20
  *
21 21
  */
22 22
 #pragma once

+ 260
- 0
Marlin/src/HAL/AVR/timers.h Voir le fichier

@@ -0,0 +1,260 @@
1
+/**
2
+ * Marlin 3D Printer Firmware
3
+ * Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
4
+ * Copyright (c) 2016 Bob Cousins bobcousins42@googlemail.com
5
+ *
6
+ * This program is free software: you can redistribute it and/or modify
7
+ * it under the terms of the GNU General Public License as published by
8
+ * the Free Software Foundation, either version 3 of the License, or
9
+ * (at your option) any later version.
10
+ *
11
+ * This program is distributed in the hope that it will be useful,
12
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
+ * GNU General Public License for more details.
15
+ *
16
+ * You should have received a copy of the GNU General Public License
17
+ * along with this program.  If not, see <https://www.gnu.org/licenses/>.
18
+ *
19
+ */
20
+#pragma once
21
+
22
+#include <stdint.h>
23
+
24
+// ------------------------
25
+// Types
26
+// ------------------------
27
+
28
+typedef uint16_t hal_timer_t;
29
+#define HAL_TIMER_TYPE_MAX 0xFFFF
30
+
31
+// ------------------------
32
+// Defines
33
+// ------------------------
34
+
35
+#define HAL_TIMER_RATE          ((F_CPU) / 8)    // i.e., 2MHz or 2.5MHz
36
+
37
+#ifndef STEP_TIMER_NUM
38
+  #define STEP_TIMER_NUM        1
39
+#endif
40
+#ifndef PULSE_TIMER_NUM
41
+  #define PULSE_TIMER_NUM       STEP_TIMER_NUM
42
+#endif
43
+#ifndef TEMP_TIMER_NUM
44
+  #define TEMP_TIMER_NUM        0
45
+#endif
46
+
47
+#define TEMP_TIMER_FREQUENCY    ((F_CPU) / 64.0 / 256.0)
48
+
49
+#define STEPPER_TIMER_RATE      HAL_TIMER_RATE
50
+#define STEPPER_TIMER_PRESCALE  8
51
+#define STEPPER_TIMER_TICKS_PER_US ((STEPPER_TIMER_RATE) / 1000000) // Cannot be of type double
52
+
53
+#define PULSE_TIMER_RATE       STEPPER_TIMER_RATE   // frequency of pulse timer
54
+#define PULSE_TIMER_PRESCALE   STEPPER_TIMER_PRESCALE
55
+#define PULSE_TIMER_TICKS_PER_US STEPPER_TIMER_TICKS_PER_US
56
+
57
+#define ENABLE_STEPPER_DRIVER_INTERRUPT()  SBI(TIMSK1, OCIE1A)
58
+#define DISABLE_STEPPER_DRIVER_INTERRUPT() CBI(TIMSK1, OCIE1A)
59
+#define STEPPER_ISR_ENABLED()             TEST(TIMSK1, OCIE1A)
60
+
61
+#define ENABLE_TEMPERATURE_INTERRUPT()     SBI(TIMSK0, OCIE0B)
62
+#define DISABLE_TEMPERATURE_INTERRUPT()    CBI(TIMSK0, OCIE0B)
63
+#define TEMPERATURE_ISR_ENABLED()         TEST(TIMSK0, OCIE0B)
64
+
65
+FORCE_INLINE void HAL_timer_start(const uint8_t timer_num, const uint32_t) {
66
+  switch (timer_num) {
67
+    case STEP_TIMER_NUM:
68
+      // waveform generation = 0100 = CTC
69
+      SET_WGM(1, CTC_OCRnA);
70
+
71
+      // output mode = 00 (disconnected)
72
+      SET_COMA(1, NORMAL);
73
+
74
+      // Set the timer pre-scaler
75
+      // Generally we use a divider of 8, resulting in a 2MHz timer
76
+      // frequency on a 16MHz MCU. If you are going to change this, be
77
+      // sure to regenerate speed_lookuptable.h with
78
+      // create_speed_lookuptable.py
79
+      SET_CS(1, PRESCALER_8);  //  CS 2 = 1/8 prescaler
80
+
81
+      // Init Stepper ISR to 122 Hz for quick starting
82
+      // (F_CPU) / (STEPPER_TIMER_PRESCALE) / frequency
83
+      OCR1A = 0x4000;
84
+      TCNT1 = 0;
85
+      break;
86
+
87
+    case TEMP_TIMER_NUM:
88
+      // Use timer0 for temperature measurement
89
+      // Interleave temperature interrupt with millies interrupt
90
+      OCR0B = 128;
91
+      break;
92
+  }
93
+}
94
+
95
+#define TIMER_OCR_1             OCR1A
96
+#define TIMER_COUNTER_1         TCNT1
97
+
98
+#define TIMER_OCR_0             OCR0A
99
+#define TIMER_COUNTER_0         TCNT0
100
+
101
+#define _CAT(a,V...) a##V
102
+#define HAL_timer_set_compare(timer, compare) (_CAT(TIMER_OCR_, timer) = compare)
103
+#define HAL_timer_get_compare(timer) _CAT(TIMER_OCR_, timer)
104
+#define HAL_timer_get_count(timer) _CAT(TIMER_COUNTER_, timer)
105
+
106
+/**
107
+ * On AVR there is no hardware prioritization and preemption of
108
+ * interrupts, so this emulates it. The UART has first priority
109
+ * (otherwise, characters will be lost due to UART overflow).
110
+ * Then: Stepper, Endstops, Temperature, and -finally- all others.
111
+ */
112
+#define HAL_timer_isr_prologue(TIMER_NUM)
113
+#define HAL_timer_isr_epilogue(TIMER_NUM)
114
+
115
+/* 18 cycles maximum latency */
116
+#ifndef HAL_STEP_TIMER_ISR
117
+
118
+#define HAL_STEP_TIMER_ISR() \
119
+extern "C" void TIMER1_COMPA_vect() __attribute__ ((signal, naked, used, externally_visible)); \
120
+extern "C" void TIMER1_COMPA_vect_bottom() asm ("TIMER1_COMPA_vect_bottom") __attribute__ ((used, externally_visible, noinline)); \
121
+void TIMER1_COMPA_vect() { \
122
+  __asm__ __volatile__ ( \
123
+    A("push r16")                      /* 2 Save R16 */ \
124
+    A("in r16, __SREG__")              /* 1 Get SREG */ \
125
+    A("push r16")                      /* 2 Save SREG into stack */ \
126
+    A("lds r16, %[timsk0]")            /* 2 Load into R0 the Temperature timer Interrupt mask register */ \
127
+    A("push r16")                      /* 2 Save TIMSK0 into the stack */ \
128
+    A("andi r16,~%[msk0]")             /* 1 Disable the temperature ISR */ \
129
+    A("sts %[timsk0], r16")            /* 2 And set the new value */ \
130
+    A("lds r16, %[timsk1]")            /* 2 Load into R0 the stepper timer Interrupt mask register [TIMSK1] */ \
131
+    A("andi r16,~%[msk1]")             /* 1 Disable the stepper ISR */ \
132
+    A("sts %[timsk1], r16")            /* 2 And set the new value */ \
133
+    A("push r16")                      /* 2 Save TIMSK1 into stack */ \
134
+    A("in r16, 0x3B")                  /* 1 Get RAMPZ register */ \
135
+    A("push r16")                      /* 2 Save RAMPZ into stack */ \
136
+    A("in r16, 0x3C")                  /* 1 Get EIND register */ \
137
+    A("push r0")                       /* C runtime can modify all the following registers without restoring them */ \
138
+    A("push r1")                       \
139
+    A("push r18")                      \
140
+    A("push r19")                      \
141
+    A("push r20")                      \
142
+    A("push r21")                      \
143
+    A("push r22")                      \
144
+    A("push r23")                      \
145
+    A("push r24")                      \
146
+    A("push r25")                      \
147
+    A("push r26")                      \
148
+    A("push r27")                      \
149
+    A("push r30")                      \
150
+    A("push r31")                      \
151
+    A("clr r1")                        /* C runtime expects this register to be 0 */ \
152
+    A("call TIMER1_COMPA_vect_bottom") /* Call the bottom handler - No inlining allowed, otherwise registers used are not saved */   \
153
+    A("pop r31")                       \
154
+    A("pop r30")                       \
155
+    A("pop r27")                       \
156
+    A("pop r26")                       \
157
+    A("pop r25")                       \
158
+    A("pop r24")                       \
159
+    A("pop r23")                       \
160
+    A("pop r22")                       \
161
+    A("pop r21")                       \
162
+    A("pop r20")                       \
163
+    A("pop r19")                       \
164
+    A("pop r18")                       \
165
+    A("pop r1")                        \
166
+    A("pop r0")                        \
167
+    A("out 0x3C, r16")                 /* 1 Restore EIND register */ \
168
+    A("pop r16")                       /* 2 Get the original RAMPZ register value */ \
169
+    A("out 0x3B, r16")                 /* 1 Restore RAMPZ register to its original value */ \
170
+    A("pop r16")                       /* 2 Get the original TIMSK1 value but with stepper ISR disabled */ \
171
+    A("ori r16,%[msk1]")               /* 1 Reenable the stepper ISR */ \
172
+    A("cli")                           /* 1 Disable global interrupts - Reenabling Stepper ISR can reenter amd temperature can reenter, and we want that, if it happens, after this ISR has ended */ \
173
+    A("sts %[timsk1], r16")            /* 2 And restore the old value - This reenables the stepper ISR */ \
174
+    A("pop r16")                       /* 2 Get the temperature timer Interrupt mask register [TIMSK0] */ \
175
+    A("sts %[timsk0], r16")            /* 2 And restore the old value - This reenables the temperature ISR */ \
176
+    A("pop r16")                       /* 2 Get the old SREG value */ \
177
+    A("out __SREG__, r16")             /* 1 And restore the SREG value */ \
178
+    A("pop r16")                       /* 2 Restore R16 value */ \
179
+    A("reti")                          /* 4 Return from interrupt */ \
180
+    :                                   \
181
+    : [timsk0] "i" ((uint16_t)&TIMSK0), \
182
+      [timsk1] "i" ((uint16_t)&TIMSK1), \
183
+      [msk0] "M" ((uint8_t)(1<<OCIE0B)),\
184
+      [msk1] "M" ((uint8_t)(1<<OCIE1A)) \
185
+    : \
186
+  ); \
187
+} \
188
+void TIMER1_COMPA_vect_bottom()
189
+
190
+#endif // HAL_STEP_TIMER_ISR
191
+
192
+#ifndef HAL_TEMP_TIMER_ISR
193
+
194
+/* 14 cycles maximum latency */
195
+#define HAL_TEMP_TIMER_ISR() \
196
+extern "C" void TIMER0_COMPB_vect() __attribute__ ((signal, naked, used, externally_visible)); \
197
+extern "C" void TIMER0_COMPB_vect_bottom()  asm ("TIMER0_COMPB_vect_bottom") __attribute__ ((used, externally_visible, noinline)); \
198
+void TIMER0_COMPB_vect() { \
199
+  __asm__ __volatile__ ( \
200
+    A("push r16")                       /* 2 Save R16 */ \
201
+    A("in r16, __SREG__")               /* 1 Get SREG */ \
202
+    A("push r16")                       /* 2 Save SREG into stack */ \
203
+    A("lds r16, %[timsk0]")             /* 2 Load into R0 the Temperature timer Interrupt mask register */ \
204
+    A("andi r16,~%[msk0]")              /* 1 Disable the temperature ISR */ \
205
+    A("sts %[timsk0], r16")             /* 2 And set the new value */ \
206
+    A("sei")                            /* 1 Enable global interrupts - It is safe, as the temperature ISR is disabled, so we cannot reenter it */    \
207
+    A("push r16")                       /* 2 Save TIMSK0 into stack */ \
208
+    A("in r16, 0x3B")                   /* 1 Get RAMPZ register */ \
209
+    A("push r16")                       /* 2 Save RAMPZ into stack */ \
210
+    A("in r16, 0x3C")                   /* 1 Get EIND register */ \
211
+    A("push r0")                        /* C runtime can modify all the following registers without restoring them */ \
212
+    A("push r1")                        \
213
+    A("push r18")                       \
214
+    A("push r19")                       \
215
+    A("push r20")                       \
216
+    A("push r21")                       \
217
+    A("push r22")                       \
218
+    A("push r23")                       \
219
+    A("push r24")                       \
220
+    A("push r25")                       \
221
+    A("push r26")                       \
222
+    A("push r27")                       \
223
+    A("push r30")                       \
224
+    A("push r31")                       \
225
+    A("clr r1")                         /* C runtime expects this register to be 0 */ \
226
+    A("call TIMER0_COMPB_vect_bottom")  /* Call the bottom handler - No inlining allowed, otherwise registers used are not saved */   \
227
+    A("pop r31")                        \
228
+    A("pop r30")                        \
229
+    A("pop r27")                        \
230
+    A("pop r26")                        \
231
+    A("pop r25")                        \
232
+    A("pop r24")                        \
233
+    A("pop r23")                        \
234
+    A("pop r22")                        \
235
+    A("pop r21")                        \
236
+    A("pop r20")                        \
237
+    A("pop r19")                        \
238
+    A("pop r18")                        \
239
+    A("pop r1")                         \
240
+    A("pop r0")                         \
241
+    A("out 0x3C, r16")                  /* 1 Restore EIND register */ \
242
+    A("pop r16")                        /* 2 Get the original RAMPZ register value */ \
243
+    A("out 0x3B, r16")                  /* 1 Restore RAMPZ register to its original value */ \
244
+    A("pop r16")                        /* 2 Get the original TIMSK0 value but with temperature ISR disabled */ \
245
+    A("ori r16,%[msk0]")                /* 1 Enable temperature ISR */ \
246
+    A("cli")                            /* 1 Disable global interrupts - We must do this, as we will reenable the temperature ISR, and we don't want to reenter this handler until the current one is done */ \
247
+    A("sts %[timsk0], r16")             /* 2 And restore the old value */ \
248
+    A("pop r16")                        /* 2 Get the old SREG */ \
249
+    A("out __SREG__, r16")              /* 1 And restore the SREG value */ \
250
+    A("pop r16")                        /* 2 Restore R16 */ \
251
+    A("reti")                           /* 4 Return from interrupt */ \
252
+    :                                   \
253
+    : [timsk0] "i"((uint16_t)&TIMSK0),  \
254
+      [msk0] "M" ((uint8_t)(1<<OCIE0B)) \
255
+    : \
256
+  ); \
257
+} \
258
+void TIMER0_COMPB_vect_bottom()
259
+
260
+#endif // HAL_TEMP_TIMER_ISR

+ 3
- 3
Marlin/src/HAL/AVR/u8g_com_HAL_AVR_sw_spi.cpp Voir le fichier

@@ -16,7 +16,7 @@
16 16
  * GNU General Public License for more details.
17 17
  *
18 18
  * You should have received a copy of the GNU General Public License
19
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
19
+ * along with this program.  If not, see <https://www.gnu.org/licenses/>.
20 20
  *
21 21
  */
22 22
 
@@ -57,7 +57,7 @@
57 57
 
58 58
 #include "../../inc/MarlinConfigPre.h"
59 59
 
60
-#if HAS_GRAPHICAL_LCD
60
+#if HAS_MARLINUI_U8GLIB
61 61
 
62 62
 #include "../shared/Marduino.h"
63 63
 #include "../shared/Delay.h"
@@ -189,5 +189,5 @@ uint8_t u8g_com_HAL_AVR_sw_sp_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void
189 189
   return 1;
190 190
 }
191 191
 
192
-#endif // HAS_GRAPHICAL_LCD
192
+#endif // HAS_MARLINUI_U8GLIB
193 193
 #endif // ARDUINO_ARCH_SAM

+ 1
- 2
Marlin/src/HAL/AVR/watchdog.cpp Voir le fichier

@@ -16,10 +16,9 @@
16 16
  * GNU General Public License for more details.
17 17
  *
18 18
  * You should have received a copy of the GNU General Public License
19
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
19
+ * along with this program.  If not, see <https://www.gnu.org/licenses/>.
20 20
  *
21 21
  */
22
-
23 22
 #ifdef __AVR__
24 23
 
25 24
 #include "../../inc/MarlinConfig.h"

+ 1
- 1
Marlin/src/HAL/AVR/watchdog.h Voir le fichier

@@ -16,7 +16,7 @@
16 16
  * GNU General Public License for more details.
17 17
  *
18 18
  * You should have received a copy of the GNU General Public License
19
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
19
+ * along with this program.  If not, see <https://www.gnu.org/licenses/>.
20 20
  *
21 21
  */
22 22
 #pragma once

+ 1
- 2
Marlin/src/HAL/DUE/DebugMonitor.cpp Voir le fichier

@@ -16,10 +16,9 @@
16 16
  * GNU General Public License for more details.
17 17
  *
18 18
  * You should have received a copy of the GNU General Public License
19
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
19
+ * along with this program.  If not, see <https://www.gnu.org/licenses/>.
20 20
  *
21 21
  */
22
-
23 22
 #ifdef ARDUINO_ARCH_SAM
24 23
 
25 24
 #include "../../core/macros.h"

+ 3
- 4
Marlin/src/HAL/DUE/HAL.cpp Voir le fichier

@@ -14,13 +14,12 @@
14 14
  * GNU General Public License for more details.
15 15
  *
16 16
  * You should have received a copy of the GNU General Public License
17
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
17
+ * along with this program.  If not, see <https://www.gnu.org/licenses/>.
18
+ *
18 19
  */
19 20
 
20 21
 /**
21
- * Description: HAL for Arduino Due and compatible (SAM3X8E)
22
- *
23
- * For ARDUINO_ARCH_SAM
22
+ * HAL for Arduino Due and compatible (SAM3X8E)
24 23
  */
25 24
 
26 25
 #ifdef ARDUINO_ARCH_SAM

+ 23
- 54
Marlin/src/HAL/DUE/HAL.h Voir le fichier

@@ -16,85 +16,59 @@
16 16
  * GNU General Public License for more details.
17 17
  *
18 18
  * You should have received a copy of the GNU General Public License
19
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
19
+ * along with this program.  If not, see <https://www.gnu.org/licenses/>.
20 20
  *
21 21
  */
22 22
 #pragma once
23 23
 
24 24
 /**
25
- * Description: HAL for Arduino Due and compatible (SAM3X8E)
26
- *
27
- * For ARDUINO_ARCH_SAM
25
+ * HAL for Arduino Due and compatible (SAM3X8E)
28 26
  */
29 27
 
30 28
 #define CPU_32_BIT
31 29
 
32 30
 #include "../shared/Marduino.h"
31
+#include "../shared/eeprom_if.h"
33 32
 #include "../shared/math_32bit.h"
34 33
 #include "../shared/HAL_SPI.h"
35 34
 #include "fastio.h"
36 35
 #include "watchdog.h"
37
-#include "timers.h"
38 36
 
39 37
 #include <stdint.h>
40 38
 
39
+#define _MSERIAL(X) Serial##X
40
+#define MSERIAL(X) _MSERIAL(X)
41
+#define Serial0 Serial
42
+
41 43
 // Define MYSERIAL0/1 before MarlinSerial includes!
42
-#if SERIAL_PORT == -1
44
+#if SERIAL_PORT == -1 || ENABLED(EMERGENCY_PARSER)
43 45
   #define MYSERIAL0 customizedSerial1
44
-#elif SERIAL_PORT == 0
45
-  #define MYSERIAL0 Serial
46
-#elif SERIAL_PORT == 1
47
-  #define MYSERIAL0 Serial1
48
-#elif SERIAL_PORT == 2
49
-  #define MYSERIAL0 Serial2
50
-#elif SERIAL_PORT == 3
51
-  #define MYSERIAL0 Serial3
46
+#elif WITHIN(SERIAL_PORT, 0, 3)
47
+  #define MYSERIAL0 MSERIAL(SERIAL_PORT)
52 48
 #else
53 49
   #error "The required SERIAL_PORT must be from -1 to 3. Please update your configuration."
54 50
 #endif
55 51
 
56 52
 #ifdef SERIAL_PORT_2
57
-  #if SERIAL_PORT_2 == SERIAL_PORT
58
-    #error "SERIAL_PORT_2 must be different from SERIAL_PORT. Please update your configuration."
59
-  #elif SERIAL_PORT_2 == -1
53
+  #if SERIAL_PORT_2 == -1 || ENABLED(EMERGENCY_PARSER)
60 54
     #define MYSERIAL1 customizedSerial2
61
-  #elif SERIAL_PORT_2 == 0
62
-    #define MYSERIAL1 Serial
63
-  #elif SERIAL_PORT_2 == 1
64
-    #define MYSERIAL1 Serial1
65
-  #elif SERIAL_PORT_2 == 2
66
-    #define MYSERIAL1 Serial2
67
-  #elif SERIAL_PORT_2 == 3
68
-    #define MYSERIAL1 Serial3
55
+  #elif WITHIN(SERIAL_PORT_2, 0, 3)
56
+    #define MYSERIAL1 MSERIAL(SERIAL_PORT_2)
69 57
   #else
70 58
     #error "SERIAL_PORT_2 must be from -1 to 3. Please update your configuration."
71 59
   #endif
72
-  #define NUM_SERIAL 2
73
-#else
74
-  #define NUM_SERIAL 1
75 60
 #endif
76 61
 
77
-#ifdef DGUS_SERIAL_PORT
78
-  #if DGUS_SERIAL_PORT == SERIAL_PORT
79
-    #error "DGUS_SERIAL_PORT must be different from SERIAL_PORT. Please update your configuration."
80
-  #elif defined(SERIAL_PORT_2) && DGUS_SERIAL_PORT == SERIAL_PORT_2
81
-    #error "DGUS_SERIAL_PORT must be different than SERIAL_PORT_2. Please update your configuration."
82
-  #elif DGUS_SERIAL_PORT == -1
83
-    #define DGUS_SERIAL internalDgusSerial
84
-  #elif DGUS_SERIAL_PORT == 0
85
-    #define DGUS_SERIAL Serial
86
-  #elif DGUS_SERIAL_PORT == 1
87
-    #define DGUS_SERIAL Serial1
88
-  #elif DGUS_SERIAL_PORT == 2
89
-    #define DGUS_SERIAL Serial2
90
-  #elif DGUS_SERIAL_PORT == 3
91
-    #define DGUS_SERIAL Serial3
62
+#ifdef LCD_SERIAL_PORT
63
+  #if LCD_SERIAL_PORT == -1
64
+    #define LCD_SERIAL lcdSerial
65
+  #elif WITHIN(LCD_SERIAL_PORT, 0, 3)
66
+    #define LCD_SERIAL MSERIAL(LCD_SERIAL_PORT)
92 67
   #else
93
-    #error "DGUS_SERIAL_PORT must be from -1 to 3. Please update your configuration."
68
+    #error "LCD_SERIAL_PORT must be from -1 to 3. Please update your configuration."
94 69
   #endif
95 70
 #endif
96 71
 
97
-
98 72
 #include "MarlinSerial.h"
99 73
 #include "MarlinSerialUSB.h"
100 74
 
@@ -131,13 +105,7 @@ void sei();                     // Enable interrupts
131 105
 void HAL_clear_reset_source();  // clear reset reason
132 106
 uint8_t HAL_get_reset_source(); // get reset reason
133 107
 
134
-//
135
-// EEPROM
136
-//
137
-void eeprom_write_byte(uint8_t *pos, unsigned char value);
138
-uint8_t eeprom_read_byte(uint8_t *pos);
139
-void eeprom_read_block (void *__dst, const void *__src, size_t __n);
140
-void eeprom_update_block (const void *__src, void *__dst, size_t __n);
108
+inline void HAL_reboot() {}  // reboot the board or restart the bootloader
141 109
 
142 110
 //
143 111
 // ADC
@@ -145,15 +113,16 @@ void eeprom_update_block (const void *__src, void *__dst, size_t __n);
145 113
 extern uint16_t HAL_adc_result;     // result of last ADC conversion
146 114
 
147 115
 #ifndef analogInputToDigitalPin
148
-  #define analogInputToDigitalPin(p) ((p < 12u) ? (p) + 54u : -1)
116
+  #define analogInputToDigitalPin(p) ((p < 12U) ? (p) + 54U : -1)
149 117
 #endif
150 118
 
151 119
 #define HAL_ANALOG_SELECT(ch)
152 120
 
153 121
 inline void HAL_adc_init() {}//todo
154 122
 
155
-#define HAL_START_ADC(ch)   HAL_adc_start_conversion(ch)
123
+#define HAL_ADC_VREF         3.3
156 124
 #define HAL_ADC_RESOLUTION  10
125
+#define HAL_START_ADC(ch)   HAL_adc_start_conversion(ch)
157 126
 #define HAL_READ_ADC()      HAL_adc_result
158 127
 #define HAL_ADC_READY()     true
159 128
 

+ 3
- 4
Marlin/src/HAL/DUE/HAL_SPI.cpp Voir le fichier

@@ -16,7 +16,7 @@
16 16
  * GNU General Public License for more details.
17 17
  *
18 18
  * You should have received a copy of the GNU General Public License
19
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
19
+ * along with this program.  If not, see <https://www.gnu.org/licenses/>.
20 20
  *
21 21
  */
22 22
 
@@ -30,7 +30,7 @@
30 30
  */
31 31
 
32 32
 /**
33
- * Description: HAL for Arduino Due and compatible (SAM3X8E)
33
+ * HAL for Arduino Due and compatible (SAM3X8E)
34 34
  *
35 35
  * For ARDUINO_ARCH_SAM
36 36
  */
@@ -595,7 +595,7 @@
595 595
       SPI_Enable(SPI0);
596 596
 
597 597
       SET_OUTPUT(DAC0_SYNC);
598
-      #if EXTRUDERS > 1
598
+      #if HAS_MULTI_EXTRUDER
599 599
         SET_OUTPUT(DAC1_SYNC);
600 600
         WRITE(DAC1_SYNC, HIGH);
601 601
       #endif
@@ -759,7 +759,6 @@
759 759
      *
760 760
      *  All of the above can be avoided by defining FORCE_SOFT_SPI to force the
761 761
      *  display to use software SPI.
762
-     *
763 762
      */
764 763
 
765 764
     void spiInit(uint8_t spiRate=6) {  // Default to slowest rate if not specified)

+ 1
- 1
Marlin/src/HAL/DUE/InterruptVectors.cpp Voir le fichier

@@ -16,7 +16,7 @@
16 16
  * GNU General Public License for more details.
17 17
  *
18 18
  * You should have received a copy of the GNU General Public License
19
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
19
+ * along with this program.  If not, see <https://www.gnu.org/licenses/>.
20 20
  *
21 21
  */
22 22
 

+ 1
- 1
Marlin/src/HAL/DUE/InterruptVectors.h Voir le fichier

@@ -16,7 +16,7 @@
16 16
  * GNU General Public License for more details.
17 17
  *
18 18
  * You should have received a copy of the GNU General Public License
19
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
19
+ * along with this program.  If not, see <https://www.gnu.org/licenses/>.
20 20
  *
21 21
  */
22 22
 #pragma once

+ 6
- 16
Marlin/src/HAL/DUE/MarlinSerial.cpp Voir le fichier

@@ -16,7 +16,7 @@
16 16
  * GNU General Public License for more details.
17 17
  *
18 18
  * You should have received a copy of the GNU General Public License
19
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
19
+ * along with this program.  If not, see <https://www.gnu.org/licenses/>.
20 20
  *
21 21
  */
22 22
 
@@ -629,23 +629,13 @@ void MarlinSerial<Cfg>::printFloat(double number, uint8_t digits) {
629 629
 
630 630
 // If not using the USB port as serial port
631 631
 #if SERIAL_PORT >= 0
632
-
633
-  // Preinstantiate
634
-  template class MarlinSerial<MarlinSerialCfg<SERIAL_PORT>>;
635
-
636
-  // Instantiate
637
-  MarlinSerial<MarlinSerialCfg<SERIAL_PORT>> customizedSerial1;
638
-
632
+  template class MarlinSerial<MarlinSerialCfg<SERIAL_PORT>>;      // Define
633
+  MarlinSerial<MarlinSerialCfg<SERIAL_PORT>> customizedSerial1;   // Instantiate
639 634
 #endif
640 635
 
641
-#ifdef SERIAL_PORT_2
642
-
643
-  // Preinstantiate
644
-  template class MarlinSerial<MarlinSerialCfg<SERIAL_PORT_2>>;
645
-
646
-  // Instantiate
647
-  MarlinSerial<MarlinSerialCfg<SERIAL_PORT_2>> customizedSerial2;
648
-
636
+#if defined(SERIAL_PORT_2) && SERIAL_PORT_2 >= 0
637
+  template class MarlinSerial<MarlinSerialCfg<SERIAL_PORT_2>>;    // Define
638
+  MarlinSerial<MarlinSerialCfg<SERIAL_PORT_2>> customizedSerial2; // Instantiate
649 639
 #endif
650 640
 
651 641
 #endif // ARDUINO_ARCH_SAM

+ 5
- 7
Marlin/src/HAL/DUE/MarlinSerial.h Voir le fichier

@@ -16,7 +16,7 @@
16 16
  * GNU General Public License for more details.
17 17
  *
18 18
  * You should have received a copy of the GNU General Public License
19
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
19
+ * along with this program.  If not, see <https://www.gnu.org/licenses/>.
20 20
  *
21 21
  */
22 22
 #pragma once
@@ -122,6 +122,8 @@ public:
122 122
   static void write(const uint8_t c);
123 123
   static void flushTX();
124 124
 
125
+  static inline bool emergency_parser_enabled() { return Cfg::EMERGENCYPARSER; }
126
+
125 127
   FORCE_INLINE static uint8_t dropped() { return Cfg::DROPPED_RX ? rx_dropped_bytes : 0; }
126 128
   FORCE_INLINE static uint8_t buffer_overruns() { return Cfg::RX_OVERRUNS ? rx_buffer_overruns : 0; }
127 129
   FORCE_INLINE static uint8_t framing_errors() { return Cfg::RX_FRAMING_ERRORS ? rx_framing_errors : 0; }
@@ -172,13 +174,9 @@ struct MarlinSerialCfg {
172 174
 };
173 175
 
174 176
 #if SERIAL_PORT >= 0
175
-
176 177
   extern MarlinSerial<MarlinSerialCfg<SERIAL_PORT>> customizedSerial1;
178
+#endif
177 179
 
178
-#endif // SERIAL_PORT >= 0
179
-
180
-#ifdef SERIAL_PORT_2
181
-
180
+#if defined(SERIAL_PORT_2) && SERIAL_PORT_2 >= 0
182 181
   extern MarlinSerial<MarlinSerialCfg<SERIAL_PORT_2>> customizedSerial2;
183
-
184 182
 #endif

+ 11
- 11
Marlin/src/HAL/DUE/MarlinSerialUSB.cpp Voir le fichier

@@ -16,7 +16,7 @@
16 16
  * GNU General Public License for more details.
17 17
  *
18 18
  * You should have received a copy of the GNU General Public License
19
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
19
+ * along with this program.  If not, see <https://www.gnu.org/licenses/>.
20 20
  *
21 21
  */
22 22
 
@@ -29,7 +29,7 @@
29 29
 
30 30
 #include "../../inc/MarlinConfig.h"
31 31
 
32
-#if SERIAL_PORT == -1
32
+#if HAS_USB_SERIAL
33 33
 
34 34
 #include "MarlinSerialUSB.h"
35 35
 
@@ -73,9 +73,7 @@ int MarlinSerialUSB::peek() {
73 73
 
74 74
   pending_char = udi_cdc_getc();
75 75
 
76
-  #if ENABLED(EMERGENCY_PARSER)
77
-    emergency_parser.update(emergency_state, (char)pending_char);
78
-  #endif
76
+  TERN_(EMERGENCY_PARSER, emergency_parser.update(emergency_state, (char)pending_char));
79 77
 
80 78
   return pending_char;
81 79
 }
@@ -97,9 +95,7 @@ int MarlinSerialUSB::read() {
97 95
 
98 96
   int c = udi_cdc_getc();
99 97
 
100
-  #if ENABLED(EMERGENCY_PARSER)
101
-    emergency_parser.update(emergency_state, (char)c);
102
-  #endif
98
+  TERN_(EMERGENCY_PARSER, emergency_parser.update(emergency_state, (char)c));
103 99
 
104 100
   return c;
105 101
 }
@@ -283,8 +279,12 @@ void MarlinSerialUSB::printFloat(double number, uint8_t digits) {
283 279
 }
284 280
 
285 281
 // Preinstantiate
286
-MarlinSerialUSB customizedSerial1;
287
-
288
-#endif // SERIAL_PORT == -1
282
+#if SERIAL_PORT == -1
283
+  MarlinSerialUSB customizedSerial1;
284
+#endif
285
+#if SERIAL_PORT_2 == -1
286
+  MarlinSerialUSB customizedSerial2;
287
+#endif
289 288
 
289
+#endif // HAS_USB_SERIAL
290 290
 #endif // ARDUINO_ARCH_SAM

+ 10
- 4
Marlin/src/HAL/DUE/MarlinSerialUSB.h Voir le fichier

@@ -16,7 +16,7 @@
16 16
  * GNU General Public License for more details.
17 17
  *
18 18
  * You should have received a copy of the GNU General Public License
19
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
19
+ * along with this program.  If not, see <https://www.gnu.org/licenses/>.
20 20
  *
21 21
  */
22 22
 #pragma once
@@ -28,7 +28,7 @@
28 28
 
29 29
 #include "../../inc/MarlinConfig.h"
30 30
 
31
-#if SERIAL_PORT == -1
31
+#if HAS_USB_SERIAL
32 32
 
33 33
 #include <WString.h>
34 34
 
@@ -88,6 +88,12 @@ private:
88 88
   static void printFloat(double, uint8_t);
89 89
 };
90 90
 
91
-extern MarlinSerialUSB customizedSerial1;
91
+#if SERIAL_PORT == -1
92
+  extern MarlinSerialUSB customizedSerial1;
93
+#endif
94
+
95
+#if SERIAL_PORT_2 == -1
96
+  extern MarlinSerialUSB customizedSerial2;
97
+#endif
92 98
 
93
-#endif // SERIAL_PORT == -1
99
+#endif // HAS_USB_SERIAL

+ 1
- 2
Marlin/src/HAL/DUE/Servo.cpp Voir le fichier

@@ -16,7 +16,7 @@
16 16
  * GNU General Public License for more details.
17 17
  *
18 18
  * You should have received a copy of the GNU General Public License
19
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
19
+ * along with this program.  If not, see <https://www.gnu.org/licenses/>.
20 20
  *
21 21
  */
22 22
 
@@ -44,7 +44,6 @@
44 44
 
45 45
 #if HAS_SERVOS
46 46
 
47
-#include "../shared/Marduino.h"
48 47
 #include "../shared/servo.h"
49 48
 #include "../shared/servo_private.h"
50 49
 

+ 2
- 3
Marlin/src/HAL/DUE/Tone.cpp Voir le fichier

@@ -18,20 +18,19 @@
18 18
  * GNU General Public License for more details.
19 19
  *
20 20
  * You should have received a copy of the GNU General Public License
21
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
21
+ * along with this program.  If not, see <https://www.gnu.org/licenses/>.
22 22
  *
23 23
  */
24 24
 
25 25
 /**
26 26
  * Description: Tone function for Arduino Due and compatible (SAM3X8E)
27
- * Derived from http://forum.arduino.cc/index.php?topic=136500.msg2903012#msg2903012
27
+ * Derived from https://forum.arduino.cc/index.php?topic=136500.msg2903012#msg2903012
28 28
  */
29 29
 
30 30
 #ifdef ARDUINO_ARCH_SAM
31 31
 
32 32
 #include "../../inc/MarlinConfig.h"
33 33
 #include "HAL.h"
34
-#include "timers.h"
35 34
 
36 35
 static pin_t tone_pin;
37 36
 volatile static int32_t toggles;

+ 4
- 5
Marlin/src/HAL/DUE/dogm/u8g_com_HAL_DUE_shared_hw_spi.cpp Voir le fichier

@@ -16,7 +16,7 @@
16 16
  * GNU General Public License for more details.
17 17
  *
18 18
  * You should have received a copy of the GNU General Public License
19
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
19
+ * along with this program.  If not, see <https://www.gnu.org/licenses/>.
20 20
  *
21 21
  */
22 22
 
@@ -52,14 +52,13 @@
52 52
  * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
53 53
  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
54 54
  * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
55
- *
56 55
  */
57 56
 
58 57
 #ifdef __SAM3X8E__
59 58
 
60 59
 #include "../../../inc/MarlinConfigPre.h"
61 60
 
62
-#if HAS_GRAPHICAL_LCD
61
+#if HAS_MARLINUI_U8GLIB
63 62
 
64 63
 #include <U8glib.h>
65 64
 
@@ -145,6 +144,6 @@ uint8_t u8g_com_HAL_DUE_shared_hw_spi_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_va
145 144
   return 1;
146 145
 }
147 146
 
148
-#endif // HAS_GRAPHICAL_LCD
147
+#endif // HAS_MARLINUI_U8GLIB
149 148
 
150
-#endif //__SAM3X8E__
149
+#endif // __SAM3X8E__

+ 1
- 1
Marlin/src/HAL/DUE/dogm/u8g_com_HAL_DUE_st7920_sw_spi.cpp Voir le fichier

@@ -16,7 +16,7 @@
16 16
  * GNU General Public License for more details.
17 17
  *
18 18
  * You should have received a copy of the GNU General Public License
19
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
19
+ * along with this program.  If not, see <https://www.gnu.org/licenses/>.
20 20
  *
21 21
  */
22 22
 

+ 3
- 3
Marlin/src/HAL/DUE/dogm/u8g_com_HAL_DUE_sw_spi.cpp Voir le fichier

@@ -16,7 +16,7 @@
16 16
  * GNU General Public License for more details.
17 17
  *
18 18
  * You should have received a copy of the GNU General Public License
19
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
19
+ * along with this program.  If not, see <https://www.gnu.org/licenses/>.
20 20
  *
21 21
  */
22 22
 
@@ -57,7 +57,7 @@
57 57
 
58 58
 #include "../../../inc/MarlinConfigPre.h"
59 59
 
60
-#if HAS_GRAPHICAL_LCD && DISABLED(U8GLIB_ST7920)
60
+#if HAS_MARLINUI_U8GLIB && DISABLED(U8GLIB_ST7920)
61 61
 
62 62
 #undef SPI_SPEED
63 63
 #define SPI_SPEED 2  // About 2 MHz
@@ -144,5 +144,5 @@ uint8_t u8g_com_HAL_DUE_sw_spi_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void
144 144
   return 1;
145 145
 }
146 146
 
147
-#endif // HAS_GRAPHICAL_LCD && !U8GLIB_ST7920
147
+#endif // HAS_MARLINUI_U8GLIB && !U8GLIB_ST7920
148 148
 #endif // ARDUINO_ARCH_SAM

+ 3
- 3
Marlin/src/HAL/DUE/dogm/u8g_com_HAL_DUE_sw_spi_shared.cpp Voir le fichier

@@ -16,7 +16,7 @@
16 16
  * GNU General Public License for more details.
17 17
  *
18 18
  * You should have received a copy of the GNU General Public License
19
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
19
+ * along with this program.  If not, see <https://www.gnu.org/licenses/>.
20 20
  *
21 21
  */
22 22
 
@@ -57,7 +57,7 @@
57 57
 
58 58
 #include "../../../inc/MarlinConfigPre.h"
59 59
 
60
-#if HAS_GRAPHICAL_LCD
60
+#if HAS_MARLINUI_U8GLIB
61 61
 
62 62
 #include "../../shared/Delay.h"
63 63
 
@@ -108,5 +108,5 @@ void u8g_spiSend_sw_DUE_mode_3(uint8_t val) { // 3.5MHz
108 108
   }
109 109
 }
110 110
 
111
-#endif // HAS_GRAPHICAL_LCD
111
+#endif // HAS_MARLINUI_U8GLIB
112 112
 #endif // ARDUINO_ARCH_SAM

+ 1
- 1
Marlin/src/HAL/DUE/dogm/u8g_com_HAL_DUE_sw_spi_shared.h Voir le fichier

@@ -16,7 +16,7 @@
16 16
  * GNU General Public License for more details.
17 17
  *
18 18
  * You should have received a copy of the GNU General Public License
19
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
19
+ * along with this program.  If not, see <https://www.gnu.org/licenses/>.
20 20
  *
21 21
  */
22 22
 #pragma once

Marlin/src/HAL/DUE/EepromEmulation.cpp → Marlin/src/HAL/DUE/eeprom_flash.cpp Voir le fichier

@@ -1,9 +1,10 @@
1 1
 /**
2 2
  * Marlin 3D Printer Firmware
3
- * Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
4 3
  *
5
- * Based on Sprinter and grbl.
6
- * Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
4
+ * Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
5
+ * Copyright (c) 2016 Bob Cousins bobcousins42@googlemail.com
6
+ * Copyright (c) 2015-2016 Nico Tonnhofer wurstnase.reprap@gmail.com
7
+ * Copyright (c) 2016 Victor Perez victor_pv@hotmail.com
7 8
  *
8 9
  * This program is free software: you can redistribute it and/or modify
9 10
  * it under the terms of the GNU General Public License as published by
@@ -16,9 +17,14 @@
16 17
  * GNU General Public License for more details.
17 18
  *
18 19
  * You should have received a copy of the GNU General Public License
19
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
20
+ * along with this program.  If not, see <https://www.gnu.org/licenses/>.
20 21
  *
21 22
  */
23
+#ifdef ARDUINO_ARCH_SAM
24
+
25
+#include "../../inc/MarlinConfig.h"
26
+
27
+#if ENABLED(FLASH_EEPROM_EMULATION)
22 28
 
23 29
 /* EEPROM emulation over flash with reduced wear
24 30
  *
@@ -47,22 +53,14 @@
47 53
  * per page. We can't emulate EE endurance with FLASH for all
48 54
  * bytes, but we can emulate endurance for a given percent of
49 55
  * bytes.
50
- *
51 56
  */
52 57
 
53
-#ifdef ARDUINO_ARCH_SAM
54
-
55
-#include "../../inc/MarlinConfig.h"
56
-
57
-#if ENABLED(FLASH_EEPROM_EMULATION)
58
-
59
-#include "../shared/Marduino.h"
60
-#include "../shared/persistent_store_api.h"
58
+//#define EE_EMU_DEBUG
61 59
 
62 60
 #define EEPROMSize     4096
63 61
 #define PagesPerGroup   128
64 62
 #define GroupCount        2
65
-#define PageSize        256u
63
+#define PageSize        256U
66 64
 
67 65
  /* Flash storage */
68 66
 typedef struct FLASH_SECTOR {
@@ -134,15 +132,18 @@ static uint8_t buffer[256] = {0},   // The RAM buffer to accumulate writes
134 132
                curPage = 0,         // Current FLASH page inside the group
135 133
                curGroup = 0xFF;     // Current FLASH group
136 134
 
137
-//#define EE_EMU_DEBUG
138
-#ifdef EE_EMU_DEBUG
139
-  static void ee_Dump(int page,const void* data) {
135
+#define DEBUG_OUT ENABLED(EE_EMU_DEBUG)
136
+#include "../../core/debug_out.h"
137
+
138
+static void ee_Dump(const int page, const void* data) {
139
+
140
+  #ifdef EE_EMU_DEBUG
140 141
 
141 142
     const uint8_t* c = (const uint8_t*) data;
142 143
     char buffer[80];
143 144
 
144 145
     sprintf_P(buffer, PSTR("Page: %d (0x%04x)\n"), page, page);
145
-    SERIAL_ECHO(buffer);
146
+    DEBUG_ECHO(buffer);
146 147
 
147 148
     char* p = &buffer[0];
148 149
     for (int i = 0; i< PageSize; ++i) {
@@ -152,12 +153,16 @@ static uint8_t buffer[256] = {0},   // The RAM buffer to accumulate writes
152 153
       if ((i & 0xF) == 0xF) {
153 154
         *p++ = '\n';
154 155
         *p = 0;
155
-        SERIAL_ECHO(buffer);
156
+        DEBUG_ECHO(buffer);
156 157
         p = &buffer[0];
157 158
       }
158 159
     }
159
-  }
160
-#endif
160
+
161
+  #else
162
+    UNUSED(page);
163
+    UNUSED(data);
164
+  #endif
165
+}
161 166
 
162 167
 /* Flash Writing Protection Key */
163 168
 #define FWP_KEY    0x5Au
@@ -170,17 +175,16 @@ static uint8_t buffer[256] = {0},   // The RAM buffer to accumulate writes
170 175
   #define EEFC_ERROR_FLAGS  (EEFC_FSR_FLOCKE | EEFC_FSR_FCMDE)
171 176
 #endif
172 177
 
173
-
174 178
 /**
175 179
  * Writes the contents of the specified page (no previous erase)
176 180
  * @param page    (page #)
177 181
  * @param data    (pointer to the data buffer)
178 182
  */
179 183
 __attribute__ ((long_call, section (".ramfunc")))
180
-static bool ee_PageWrite(uint16_t page,const void* data) {
184
+static bool ee_PageWrite(uint16_t page, const void* data) {
181 185
 
182 186
   uint16_t i;
183
-  uint32_t addrflash = ((uint32_t)getFlashStorage(page));
187
+  uint32_t addrflash = uint32_t(getFlashStorage(page));
184 188
 
185 189
   // Read the flash contents
186 190
   uint32_t pageContents[PageSize>>2];
@@ -195,13 +199,11 @@ static bool ee_PageWrite(uint16_t page,const void* data) {
195 199
   for (i = 0; i <PageSize >> 2; i++)
196 200
     pageContents[i] = (((uint32_t*)data)[i]) | (~(pageContents[i] ^ ((uint32_t*)data)[i]));
197 201
 
198
-  #ifdef EE_EMU_DEBUG
199
-    SERIAL_ECHO_START();
200
-    SERIAL_ECHOLNPAIR("EEPROM PageWrite   ", page);
201
-    SERIAL_ECHOLNPAIR(" in FLASH address ", (uint32_t)addrflash);
202
-    SERIAL_ECHOLNPAIR(" base address     ", (uint32_t)getFlashStorage(0));
203
-    SERIAL_FLUSH();
204
-  #endif
202
+  DEBUG_ECHO_START();
203
+  DEBUG_ECHOLNPAIR("EEPROM PageWrite   ", page);
204
+  DEBUG_ECHOLNPAIR(" in FLASH address ", (uint32_t)addrflash);
205
+  DEBUG_ECHOLNPAIR(" base address     ", (uint32_t)getFlashStorage(0));
206
+  DEBUG_FLUSH();
205 207
 
206 208
   // Get the page relative to the start of the EFC controller, and the EFC controller to use
207 209
   Efc *efc;
@@ -243,10 +245,8 @@ static bool ee_PageWrite(uint16_t page,const void* data) {
243 245
     // Reenable interrupts
244 246
     __enable_irq();
245 247
 
246
-    #ifdef EE_EMU_DEBUG
247
-      SERIAL_ECHO_START();
248
-      SERIAL_ECHOLNPAIR("EEPROM Unlock failure for page ", page);
249
-    #endif
248
+    DEBUG_ECHO_START();
249
+    DEBUG_ECHOLNPAIR("EEPROM Unlock failure for page ", page);
250 250
     return false;
251 251
   }
252 252
 
@@ -270,10 +270,9 @@ static bool ee_PageWrite(uint16_t page,const void* data) {
270 270
     // Reenable interrupts
271 271
     __enable_irq();
272 272
 
273
-    #ifdef EE_EMU_DEBUG
274
-      SERIAL_ECHO_START();
275
-      SERIAL_ECHOLNPAIR("EEPROM Write failure for page ", page);
276
-    #endif
273
+    DEBUG_ECHO_START();
274
+    DEBUG_ECHOLNPAIR("EEPROM Write failure for page ", page);
275
+
277 276
     return false;
278 277
   }
279 278
 
@@ -287,11 +286,11 @@ static bool ee_PageWrite(uint16_t page,const void* data) {
287 286
   if (memcmp(getFlashStorage(page),data,PageSize)) {
288 287
 
289 288
     #ifdef EE_EMU_DEBUG
290
-      SERIAL_ECHO_START();
291
-      SERIAL_ECHOLNPAIR("EEPROM Verify Write failure for page ", page);
289
+      DEBUG_ECHO_START();
290
+      DEBUG_ECHOLNPAIR("EEPROM Verify Write failure for page ", page);
292 291
 
293
-      ee_Dump( page,(uint32_t *) addrflash);
294
-      ee_Dump(-page,data);
292
+      ee_Dump( page, (uint32_t *)addrflash);
293
+      ee_Dump(-page, data);
295 294
 
296 295
       // Calculate count of changed bits
297 296
       uint32_t* p1 = (uint32_t*)addrflash;
@@ -307,7 +306,7 @@ static bool ee_PageWrite(uint16_t page,const void* data) {
307 306
           }
308 307
         }
309 308
       }
310
-      SERIAL_ECHOLNPAIR("--> Differing bits: ", count);
309
+      DEBUG_ECHOLNPAIR("--> Differing bits: ", count);
311 310
     #endif
312 311
 
313 312
     return false;
@@ -324,15 +323,13 @@ __attribute__ ((long_call, section (".ramfunc")))
324 323
 static bool ee_PageErase(uint16_t page) {
325 324
 
326 325
   uint16_t i;
327
-  uint32_t addrflash = ((uint32_t)getFlashStorage(page));
326
+  uint32_t addrflash = uint32_t(getFlashStorage(page));
328 327
 
329
-  #ifdef EE_EMU_DEBUG
330
-    SERIAL_ECHO_START();
331
-    SERIAL_ECHOLNPAIR("EEPROM PageErase  ", page);
332
-    SERIAL_ECHOLNPAIR(" in FLASH address ", (uint32_t)addrflash);
333
-    SERIAL_ECHOLNPAIR(" base address     ", (uint32_t)getFlashStorage(0));
334
-    SERIAL_FLUSH();
335
-  #endif
328
+  DEBUG_ECHO_START();
329
+  DEBUG_ECHOLNPAIR("EEPROM PageErase  ", page);
330
+  DEBUG_ECHOLNPAIR(" in FLASH address ", (uint32_t)addrflash);
331
+  DEBUG_ECHOLNPAIR(" base address     ", (uint32_t)getFlashStorage(0));
332
+  DEBUG_FLUSH();
336 333
 
337 334
   // Get the page relative to the start of the EFC controller, and the EFC controller to use
338 335
   Efc *efc;
@@ -373,10 +370,9 @@ static bool ee_PageErase(uint16_t page) {
373 370
     // Reenable interrupts
374 371
     __enable_irq();
375 372
 
376
-    #ifdef EE_EMU_DEBUG
377
-      SERIAL_ECHO_START();
378
-      SERIAL_ECHOLNPAIR("EEPROM Unlock failure for page ",page);
379
-    #endif
373
+    DEBUG_ECHO_START();
374
+    DEBUG_ECHOLNPAIR("EEPROM Unlock failure for page ",page);
375
+
380 376
     return false;
381 377
   }
382 378
 
@@ -398,10 +394,9 @@ static bool ee_PageErase(uint16_t page) {
398 394
     // Reenable interrupts
399 395
     __enable_irq();
400 396
 
401
-    #ifdef EE_EMU_DEBUG
402
-      SERIAL_ECHO_START();
403
-      SERIAL_ECHOLNPAIR("EEPROM Erase failure for page ",page);
404
-    #endif
397
+    DEBUG_ECHO_START();
398
+    DEBUG_ECHOLNPAIR("EEPROM Erase failure for page ",page);
399
+
405 400
     return false;
406 401
   }
407 402
 
@@ -415,20 +410,17 @@ static bool ee_PageErase(uint16_t page) {
415 410
   uint32_t * aligned_src = (uint32_t *) addrflash;
416 411
   for (i = 0; i < PageSize >> 2; i++) {
417 412
     if (*aligned_src++ != 0xFFFFFFFF) {
418
-
419
-      #ifdef EE_EMU_DEBUG
420
-        SERIAL_ECHO_START();
421
-        SERIAL_ECHOLNPAIR("EEPROM Verify Erase failure for page ",page);
422
-
423
-        ee_Dump( page,(uint32_t *) addrflash);
424
-      #endif
413
+      DEBUG_ECHO_START();
414
+      DEBUG_ECHOLNPAIR("EEPROM Verify Erase failure for page ",page);
415
+      ee_Dump(page, (uint32_t *)addrflash);
425 416
       return false;
426 417
     }
427 418
   }
428 419
 
429 420
   return true;
430 421
 }
431
-static uint8_t ee_Read(uint32_t address, bool excludeRAMBuffer = false) {
422
+
423
+static uint8_t ee_Read(uint32_t address, bool excludeRAMBuffer=false) {
432 424
 
433 425
   uint32_t baddr;
434 426
   uint32_t blen;
@@ -511,7 +503,7 @@ static uint8_t ee_Read(uint32_t address, bool excludeRAMBuffer = false) {
511 503
   return 0xFF;
512 504
 }
513 505
 
514
-static uint32_t ee_GetAddrRange(uint32_t address, bool excludeRAMBuffer = false) {
506
+static uint32_t ee_GetAddrRange(uint32_t address, bool excludeRAMBuffer=false) {
515 507
   uint32_t baddr,
516 508
            blen,
517 509
            nextAddr = 0xFFFF,
@@ -603,7 +595,7 @@ static bool ee_IsPageClean(int page) {
603 595
   return true;
604 596
 }
605 597
 
606
-static bool ee_Flush(uint32_t overrideAddress = 0xFFFFFFFF, uint8_t overrideData = 0xFF) {
598
+static bool ee_Flush(uint32_t overrideAddress = 0xFFFFFFFF, uint8_t overrideData=0xFF) {
607 599
 
608 600
   // Check if RAM buffer has something to be written
609 601
   bool isEmpty = true;
@@ -929,11 +921,9 @@ static void ee_Init() {
929 921
   // If all groups seem to be used, default to first group
930 922
   if (curGroup >= GroupCount) curGroup = 0;
931 923
 
932
-  #ifdef EE_EMU_DEBUG
933
-    SERIAL_ECHO_START();
934
-    SERIAL_ECHOLNPAIR("EEPROM Current Group: ",curGroup);
935
-    SERIAL_FLUSH();
936
-  #endif
924
+  DEBUG_ECHO_START();
925
+  DEBUG_ECHOLNPAIR("EEPROM Current Group: ",curGroup);
926
+  DEBUG_FLUSH();
937 927
 
938 928
   // Now, validate that all the other group pages are empty
939 929
   for (int grp = 0; grp < GroupCount; grp++) {
@@ -941,11 +931,9 @@ static void ee_Init() {
941 931
 
942 932
     for (int page = 0; page < PagesPerGroup; page++) {
943 933
       if (!ee_IsPageClean(grp * PagesPerGroup + page)) {
944
-        #ifdef EE_EMU_DEBUG
945
-          SERIAL_ECHO_START();
946
-          SERIAL_ECHOLNPAIR("EEPROM Page ", page, " not clean on group ", grp);
947
-          SERIAL_FLUSH();
948
-        #endif
934
+        DEBUG_ECHO_START();
935
+        DEBUG_ECHOLNPAIR("EEPROM Page ", page, " not clean on group ", grp);
936
+        DEBUG_FLUSH();
949 937
         ee_PageErase(grp * PagesPerGroup + page);
950 938
       }
951 939
     }
@@ -955,66 +943,69 @@ static void ee_Init() {
955 943
   // and also validate that all the other ones are clean
956 944
   for (curPage = 0; curPage < PagesPerGroup; curPage++) {
957 945
     if (ee_IsPageClean(curGroup * PagesPerGroup + curPage)) {
958
-      #ifdef EE_EMU_DEBUG
959
-        ee_Dump(curGroup * PagesPerGroup + curPage, getFlashStorage(curGroup * PagesPerGroup + curPage));
960
-      #endif
946
+      ee_Dump(curGroup * PagesPerGroup + curPage, getFlashStorage(curGroup * PagesPerGroup + curPage));
961 947
       break;
962 948
     }
963 949
   }
964 950
 
965
-  #ifdef EE_EMU_DEBUG
966
-    SERIAL_ECHO_START();
967
-    SERIAL_ECHOLNPAIR("EEPROM Active page: ", curPage);
968
-    SERIAL_FLUSH();
969
-  #endif
951
+  DEBUG_ECHO_START();
952
+  DEBUG_ECHOLNPAIR("EEPROM Active page: ", curPage);
953
+  DEBUG_FLUSH();
970 954
 
971 955
   // Make sure the pages following the first clean one are also clean
972 956
   for (int page = curPage + 1; page < PagesPerGroup; page++) {
973 957
     if (!ee_IsPageClean(curGroup * PagesPerGroup + page)) {
974
-      #ifdef EE_EMU_DEBUG
975
-        SERIAL_ECHO_START();
976
-        SERIAL_ECHOLNPAIR("EEPROM Page ", page, " not clean on active group ", curGroup);
977
-        SERIAL_FLUSH();
978
-        ee_Dump(curGroup * PagesPerGroup + page, getFlashStorage(curGroup * PagesPerGroup + page));
979
-      #endif
958
+      DEBUG_ECHO_START();
959
+      DEBUG_ECHOLNPAIR("EEPROM Page ", page, " not clean on active group ", curGroup);
960
+      DEBUG_FLUSH();
961
+      ee_Dump(curGroup * PagesPerGroup + page, getFlashStorage(curGroup * PagesPerGroup + page));
980 962
       ee_PageErase(curGroup * PagesPerGroup + page);
981 963
     }
982 964
   }
983 965
 }
984 966
 
985
-uint8_t eeprom_read_byte(uint8_t* addr) {
986
-  ee_Init();
987
-  return ee_Read((uint32_t)addr);
988
-}
989
-
990
-void eeprom_write_byte(uint8_t* addr, uint8_t value) {
991
-  ee_Init();
992
-  ee_Write((uint32_t)addr, value);
993
-}
967
+/* PersistentStore -----------------------------------------------------------*/
994 968
 
995
-void eeprom_update_block(const void* __src, void* __dst, size_t __n) {
996
-  uint8_t* dst = (uint8_t*)__dst;
997
-  const uint8_t* src = (const uint8_t*)__src;
998
-  while (__n--) {
999
-    eeprom_write_byte(dst, *src);
1000
-    ++dst;
1001
-    ++src;
1002
-  }
1003
-}
969
+#include "../shared/eeprom_api.h"
1004 970
 
1005
-void eeprom_read_block(void* __dst, const void* __src, size_t __n) {
1006
-  uint8_t* dst = (uint8_t*)__dst;
1007
-  uint8_t* src = (uint8_t*)__src;
1008
-  while (__n--) {
1009
-    *dst = eeprom_read_byte(src);
1010
-    ++dst;
1011
-    ++src;
971
+#ifndef MARLIN_EEPROM_SIZE
972
+  #define MARLIN_EEPROM_SIZE 0x1000 // 4KB
973
+#endif
974
+size_t PersistentStore::capacity()    { return MARLIN_EEPROM_SIZE; }
975
+bool PersistentStore::access_start()  { ee_Init();  return true; }
976
+bool PersistentStore::access_finish() { ee_Flush(); return true; }
977
+
978
+bool PersistentStore::write_data(int &pos, const uint8_t *value, size_t size, uint16_t *crc) {
979
+  while (size--) {
980
+    uint8_t * const p = (uint8_t * const)pos;
981
+    uint8_t v = *value;
982
+    // EEPROM has only ~100,000 write cycles,
983
+    // so only write bytes that have changed!
984
+    if (v != ee_Read(uint32_t(p))) {
985
+      ee_Write(uint32_t(p), v);
986
+      delay(2);
987
+      if (ee_Read(uint32_t(p)) != v) {
988
+        SERIAL_ECHO_MSG(STR_ERR_EEPROM_WRITE);
989
+        return true;
990
+      }
991
+    }
992
+    crc16(crc, &v, 1);
993
+    pos++;
994
+    value++;
1012 995
   }
996
+  return false;
1013 997
 }
1014 998
 
1015
-void eeprom_flush() {
1016
-  ee_Flush();
999
+bool PersistentStore::read_data(int &pos, uint8_t* value, size_t size, uint16_t *crc, const bool writing/*=true*/) {
1000
+  do {
1001
+    uint8_t c = ee_Read(uint32_t(pos));
1002
+    if (writing) *value = c;
1003
+    crc16(crc, &c, 1);
1004
+    pos++;
1005
+    value++;
1006
+  } while (--size);
1007
+  return false;
1017 1008
 }
1018 1009
 
1019 1010
 #endif // FLASH_EEPROM_EMULATION
1020
-#endif // ARDUINO_ARCH_AVR
1011
+#endif // ARDUINO_ARCH_SAM

Marlin/src/HAL/DUE/persistent_store_eeprom.cpp → Marlin/src/HAL/DUE/eeprom_wired.cpp Voir le fichier

@@ -17,32 +17,29 @@
17 17
  * GNU General Public License for more details.
18 18
  *
19 19
  * You should have received a copy of the GNU General Public License
20
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
20
+ * along with this program.  If not, see <https://www.gnu.org/licenses/>.
21 21
  *
22 22
  */
23 23
 #ifdef ARDUINO_ARCH_SAM
24 24
 
25
-#include "../../inc/MarlinConfigPre.h"
26
-
27
-#if ENABLED(EEPROM_SETTINGS)
28
-
29 25
 #include "../../inc/MarlinConfig.h"
30
-#include "../shared/persistent_store_api.h"
31 26
 
32
-#if !defined(E2END) && ENABLED(FLASH_EEPROM_EMULATION)
33
-  #define E2END 0xFFF // Default to Flash emulated EEPROM size (EepromEmulation_Due.cpp)
34
-#endif
27
+#if USE_WIRED_EEPROM
35 28
 
36
-extern void eeprom_flush();
29
+/**
30
+ * PersistentStore for Arduino-style EEPROM interface
31
+ * with simple implementations supplied by Marlin.
32
+ */
37 33
 
38
-bool PersistentStore::access_start() { return true; }
34
+#include "../shared/eeprom_if.h"
35
+#include "../shared/eeprom_api.h"
39 36
 
40
-bool PersistentStore::access_finish() {
41
-  #if ENABLED(FLASH_EEPROM_EMULATION)
42
-    eeprom_flush();
43
-  #endif
44
-  return true;
45
-}
37
+#ifndef MARLIN_EEPROM_SIZE
38
+  #error "MARLIN_EEPROM_SIZE is required for I2C / SPI EEPROM."
39
+#endif
40
+size_t PersistentStore::capacity()    { return MARLIN_EEPROM_SIZE; }
41
+bool PersistentStore::access_start()  { eeprom_init(); return true; }
42
+bool PersistentStore::access_finish() { return true; }
46 43
 
47 44
 bool PersistentStore::write_data(int &pos, const uint8_t *value, size_t size, uint16_t *crc) {
48 45
   while (size--) {
@@ -61,7 +58,7 @@ bool PersistentStore::write_data(int &pos, const uint8_t *value, size_t size, ui
61 58
     crc16(crc, &v, 1);
62 59
     pos++;
63 60
     value++;
64
-  };
61
+  }
65 62
   return false;
66 63
 }
67 64
 
@@ -76,7 +73,5 @@ bool PersistentStore::read_data(int &pos, uint8_t* value, size_t size, uint16_t
76 73
   return false;
77 74
 }
78 75
 
79
-size_t PersistentStore::capacity() { return E2END + 1; }
80
-
81
-#endif // EEPROM_SETTINGS
76
+#endif // USE_WIRED_EEPROM
82 77
 #endif // ARDUINO_ARCH_SAM

+ 18
- 40
Marlin/src/HAL/DUE/endstop_interrupts.h Voir le fichier

@@ -16,7 +16,7 @@
16 16
  * GNU General Public License for more details.
17 17
  *
18 18
  * You should have received a copy of the GNU General Public License
19
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
19
+ * along with this program.  If not, see <https://www.gnu.org/licenses/>.
20 20
  *
21 21
  */
22 22
 #pragma once
@@ -47,43 +47,21 @@ void endstop_ISR() { endstops.update(); }
47 47
 
48 48
 void setup_endstop_interrupts() {
49 49
   #define _ATTACH(P) attachInterrupt(digitalPinToInterrupt(P), endstop_ISR, CHANGE)
50
-  #if HAS_X_MAX
51
-    _ATTACH(X_MAX_PIN);
52
-  #endif
53
-  #if HAS_X_MIN
54
-    _ATTACH(X_MIN_PIN);
55
-  #endif
56
-  #if HAS_Y_MAX
57
-    _ATTACH(Y_MAX_PIN);
58
-  #endif
59
-  #if HAS_Y_MIN
60
-    _ATTACH(Y_MIN_PIN);
61
-  #endif
62
-  #if HAS_Z_MAX
63
-    _ATTACH(Z_MAX_PIN);
64
-  #endif
65
-  #if HAS_Z_MIN
66
-     _ATTACH(Z_MIN_PIN);
67
-  #endif
68
-  #if HAS_Z2_MAX
69
-    _ATTACH(Z2_MAX_PIN);
70
-  #endif
71
-  #if HAS_Z2_MIN
72
-    _ATTACH(Z2_MIN_PIN);
73
-  #endif
74
-  #if HAS_Z3_MAX
75
-    _ATTACH(Z3_MAX_PIN);
76
-  #endif
77
-  #if HAS_Z3_MIN
78
-    _ATTACH(Z3_MIN_PIN);
79
-  #endif
80
-  #if HAS_Z4_MAX
81
-    _ATTACH(Z4_MAX_PIN);
82
-  #endif
83
-  #if HAS_Z4_MIN
84
-    _ATTACH(Z4_MIN_PIN);
85
-  #endif
86
-  #if HAS_Z_MIN_PROBE_PIN
87
-    _ATTACH(Z_MIN_PROBE_PIN);
88
-  #endif
50
+  TERN_(HAS_X_MAX, _ATTACH(X_MAX_PIN));
51
+  TERN_(HAS_X_MIN, _ATTACH(X_MIN_PIN));
52
+  TERN_(HAS_Y_MAX, _ATTACH(Y_MAX_PIN));
53
+  TERN_(HAS_Y_MIN, _ATTACH(Y_MIN_PIN));
54
+  TERN_(HAS_Z_MAX, _ATTACH(Z_MAX_PIN));
55
+  TERN_(HAS_Z_MIN, _ATTACH(Z_MIN_PIN));
56
+  TERN_(HAS_X2_MAX, _ATTACH(X2_MAX_PIN));
57
+  TERN_(HAS_X2_MIN, _ATTACH(X2_MIN_PIN));
58
+  TERN_(HAS_Y2_MAX, _ATTACH(Y2_MAX_PIN));
59
+  TERN_(HAS_Y2_MIN, _ATTACH(Y2_MIN_PIN));
60
+  TERN_(HAS_Z2_MAX, _ATTACH(Z2_MAX_PIN));
61
+  TERN_(HAS_Z2_MIN, _ATTACH(Z2_MIN_PIN));
62
+  TERN_(HAS_Z3_MAX, _ATTACH(Z3_MAX_PIN));
63
+  TERN_(HAS_Z3_MIN, _ATTACH(Z3_MIN_PIN));
64
+  TERN_(HAS_Z4_MAX, _ATTACH(Z4_MAX_PIN));
65
+  TERN_(HAS_Z4_MIN, _ATTACH(Z4_MIN_PIN));
66
+  TERN_(HAS_Z_MIN_PROBE_PIN, _ATTACH(Z_MIN_PROBE_PIN));
89 67
 }

+ 4
- 4
Marlin/src/HAL/DUE/fastio.h Voir le fichier

@@ -16,7 +16,7 @@
16 16
  * GNU General Public License for more details.
17 17
  *
18 18
  * You should have received a copy of the GNU General Public License
19
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
19
+ * along with this program.  If not, see <https://www.gnu.org/licenses/>.
20 20
  *
21 21
  */
22 22
 #pragma once
@@ -58,7 +58,7 @@
58 58
  *
59 59
  * Now you can simply SET_OUTPUT(STEP); WRITE(STEP, HIGH); WRITE(STEP, LOW);
60 60
  *
61
- * Why double up on these macros? see http://gcc.gnu.org/onlinedocs/cpp/Stringification.html
61
+ * Why double up on these macros? see https://gcc.gnu.org/onlinedocs/cpp/Stringification.html
62 62
  */
63 63
 
64 64
 // Read a pin
@@ -166,7 +166,7 @@
166 166
 // Set pin as output (wrapper) -  reads the pin and sets the output to that value
167 167
 #define SET_OUTPUT(IO)       _SET_OUTPUT(IO)
168 168
 // Set pin as PWM
169
-#define SET_PWM(IO)           SET_OUTPUT(IO)
169
+#define SET_PWM               SET_OUTPUT
170 170
 
171 171
 // Check if pin is an input
172 172
 #define IS_INPUT(IO)         ((digitalPinToPort(IO)->PIO_OSR & digitalPinToBitMask(IO)) == 0)
@@ -174,7 +174,7 @@
174 174
 #define IS_OUTPUT(IO)        ((digitalPinToPort(IO)->PIO_OSR & digitalPinToBitMask(IO)) != 0)
175 175
 
176 176
 // Shorthand
177
-#define OUT_WRITE(IO,V)       { SET_OUTPUT(IO); WRITE(IO,V); }
177
+#define OUT_WRITE(IO,V)      do{ SET_OUTPUT(IO); WRITE(IO,V); }while(0)
178 178
 
179 179
 // digitalRead/Write wrappers
180 180
 #define extDigitalRead(IO)    digitalRead(IO)

+ 110
- 49
Marlin/src/HAL/DUE/fastio/G2_PWM.cpp Voir le fichier

@@ -16,7 +16,7 @@
16 16
  * GNU General Public License for more details.
17 17
  *
18 18
  * You should have received a copy of the GNU General Public License
19
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
19
+ * along with this program.  If not, see <https://www.gnu.org/licenses/>.
20 20
  *
21 21
  */
22 22
 
@@ -46,6 +46,31 @@
46 46
 
47 47
 #include "G2_PWM.h"
48 48
 
49
+#if PIN_EXISTS(MOTOR_CURRENT_PWM_X)
50
+  #define G2_PWM_X 1
51
+#else
52
+  #define G2_PWM_X 0
53
+#endif
54
+#if PIN_EXISTS(MOTOR_CURRENT_PWM_Y)
55
+  #define G2_PWM_Y 1
56
+#else
57
+  #define G2_PWM_Y 0
58
+#endif
59
+#if PIN_EXISTS(MOTOR_CURRENT_PWM_Z)
60
+  #define G2_PWM_Z 1
61
+#else
62
+  #define G2_PWM_Z 0
63
+#endif
64
+#if PIN_EXISTS(MOTOR_CURRENT_PWM_E)
65
+  #define G2_PWM_E 1
66
+#else
67
+  #define G2_PWM_E 0
68
+#endif
69
+#define G2_MASK_X(V) (G2_PWM_X * (V))
70
+#define G2_MASK_Y(V) (G2_PWM_Y * (V))
71
+#define G2_MASK_Z(V) (G2_PWM_Z * (V))
72
+#define G2_MASK_E(V) (G2_PWM_E * (V))
73
+
49 74
 volatile uint32_t *SODR_A = &PIOA->PIO_SODR,
50 75
                   *SODR_B = &PIOB->PIO_SODR,
51 76
                   *CODR_A = &PIOA->PIO_CODR,
@@ -55,10 +80,18 @@ PWM_map ISR_table[NUM_PWMS] = PWM_MAP_INIT;
55 80
 
56 81
 void Stepper::digipot_init() {
57 82
 
58
-  OUT_WRITE(MOTOR_CURRENT_PWM_X_PIN, 0);  // init pins
59
-  OUT_WRITE(MOTOR_CURRENT_PWM_Y_PIN, 0);
60
-  OUT_WRITE(MOTOR_CURRENT_PWM_Z_PIN, 0);
61
-  OUT_WRITE(MOTOR_CURRENT_PWM_E_PIN, 0);
83
+  #if PIN_EXISTS(MOTOR_CURRENT_PWM_X)
84
+    OUT_WRITE(MOTOR_CURRENT_PWM_X_PIN, 0);  // init pins
85
+  #endif
86
+  #if PIN_EXISTS(MOTOR_CURRENT_PWM_Y)
87
+    OUT_WRITE(MOTOR_CURRENT_PWM_Y_PIN, 0);
88
+  #endif
89
+  #if G2_PWM_Z
90
+    OUT_WRITE(MOTOR_CURRENT_PWM_Z_PIN, 0);
91
+  #endif
92
+  #if G2_PWM_E
93
+    OUT_WRITE(MOTOR_CURRENT_PWM_E_PIN, 0);
94
+  #endif
62 95
 
63 96
   #define WPKEY          (0x50574D << 8) // “PWM” in ASCII
64 97
   #define WPCMD_DIS_SW   0  // command to disable Write Protect SW
@@ -71,54 +104,82 @@ void Stepper::digipot_init() {
71 104
   PWM->PWM_WPCR = WPKEY | WPRG_ALL | WPCMD_DIS_SW;        // enable setting of all PWM registers
72 105
   PWM->PWM_CLK = PWM_CLOCK_F;                             // enable CLK_A and set it to 1MHz, leave CLK_B disabled
73 106
   PWM->PWM_CH_NUM[0].PWM_CMR = 0b1011;                    // set channel 0 to Clock A input & to left aligned
74
-  PWM->PWM_CH_NUM[1].PWM_CMR = 0b1011;                    // set channel 1 to Clock A input & to left aligned
75
-  PWM->PWM_CH_NUM[2].PWM_CMR = 0b1011;                    // set channel 2 to Clock A input & to left aligned
76
-  PWM->PWM_CH_NUM[3].PWM_CMR = 0b1011;                    // set channel 3 to Clock A input & to left aligned
77
-  PWM->PWM_CH_NUM[4].PWM_CMR = 0b1011;                    // set channel 4 to Clock A input & to left aligned
107
+  if (G2_PWM_X) PWM->PWM_CH_NUM[1].PWM_CMR = 0b1011;      // set channel 1 to Clock A input & to left aligned
108
+  if (G2_PWM_Y) PWM->PWM_CH_NUM[2].PWM_CMR = 0b1011;      // set channel 2 to Clock A input & to left aligned
109
+  if (G2_PWM_Z) PWM->PWM_CH_NUM[3].PWM_CMR = 0b1011;      // set channel 3 to Clock A input & to left aligned
110
+  if (G2_PWM_E) PWM->PWM_CH_NUM[4].PWM_CMR = 0b1011;      // set channel 4 to Clock A input & to left aligned
78 111
 
79 112
   PWM->PWM_CH_NUM[0].PWM_CPRD = PWM_PERIOD_US;            // set channel 0 Period
80 113
 
81 114
   PWM->PWM_IER2 = PWM_IER1_CHID0;                         // generate interrupt when counter0 overflows
82
-  PWM->PWM_IER2 = PWM_IER2_CMPM0 | PWM_IER2_CMPM1 | PWM_IER2_CMPM2 | PWM_IER2_CMPM3 | PWM_IER2_CMPM4;        // generate interrupt on compare event
83
-
84
-  PWM->PWM_CMP[1].PWM_CMPV = 0x010000000LL | G2_VREF_COUNT(G2_VREF(motor_current_setting[0]));   // interrupt when counter0 == CMPV - used to set Motor 1 PWM inactive
85
-  PWM->PWM_CMP[2].PWM_CMPV = 0x010000000LL | G2_VREF_COUNT(G2_VREF(motor_current_setting[0]));   // interrupt when counter0 == CMPV - used to set Motor 2 PWM inactive
86
-  PWM->PWM_CMP[3].PWM_CMPV = 0x010000000LL | G2_VREF_COUNT(G2_VREF(motor_current_setting[1]));   // interrupt when counter0 == CMPV - used to set Motor 3 PWM inactive
87
-  PWM->PWM_CMP[4].PWM_CMPV = 0x010000000LL | G2_VREF_COUNT(G2_VREF(motor_current_setting[2]));   // interrupt when counter0 == CMPV - used to set Motor 4 PWM inactive
88
-
89
-  PWM->PWM_CMP[1].PWM_CMPM = 0x0001;  // enable compare event
90
-  PWM->PWM_CMP[2].PWM_CMPM = 0x0001;  // enable compare event
91
-  PWM->PWM_CMP[3].PWM_CMPM = 0x0001;  // enable compare event
92
-  PWM->PWM_CMP[4].PWM_CMPM = 0x0001;  // enable compare event
93
-
94
-  PWM->PWM_SCM = PWM_SCM_UPDM_MODE0 | PWM_SCM_SYNC0 | PWM_SCM_SYNC1 | PWM_SCM_SYNC2 | PWM_SCM_SYNC3 | PWM_SCM_SYNC4; // sync 1-4 with 0, use mode 0 for updates
95
-
96
-  PWM->PWM_ENA = PWM_ENA_CHID0 | PWM_ENA_CHID1 | PWM_ENA_CHID2 | PWM_ENA_CHID3 | PWM_ENA_CHID4;         // enable the channels used by G2
97
-  PWM->PWM_IER1 = PWM_IER1_CHID0 | PWM_IER1_CHID1 | PWM_IER1_CHID2 | PWM_IER1_CHID3 | PWM_IER1_CHID4;        // enable interrupts for the channels used by G2
115
+  PWM->PWM_IER2 = PWM_IER2_CMPM0
116
+    | G2_MASK_X(PWM_IER2_CMPM1)
117
+    | G2_MASK_Y(PWM_IER2_CMPM2)
118
+    | G2_MASK_Z(PWM_IER2_CMPM3)
119
+    | G2_MASK_E(PWM_IER2_CMPM4)
120
+  ; // generate interrupt on compare event
121
+
122
+  if (G2_PWM_X) PWM->PWM_CMP[1].PWM_CMPV = 0x010000000LL | G2_VREF_COUNT(G2_VREF(motor_current_setting[0])); // interrupt when counter0 == CMPV - used to set Motor 1 PWM inactive
123
+  if (G2_PWM_Y) PWM->PWM_CMP[2].PWM_CMPV = 0x010000000LL | G2_VREF_COUNT(G2_VREF(motor_current_setting[0])); // interrupt when counter0 == CMPV - used to set Motor 2 PWM inactive
124
+  if (G2_PWM_Z) PWM->PWM_CMP[3].PWM_CMPV = 0x010000000LL | G2_VREF_COUNT(G2_VREF(motor_current_setting[1])); // interrupt when counter0 == CMPV - used to set Motor 3 PWM inactive
125
+  if (G2_PWM_E) PWM->PWM_CMP[4].PWM_CMPV = 0x010000000LL | G2_VREF_COUNT(G2_VREF(motor_current_setting[2])); // interrupt when counter0 == CMPV - used to set Motor 4 PWM inactive
126
+
127
+  if (G2_PWM_X) PWM->PWM_CMP[1].PWM_CMPM = 0x0001;  // enable compare event
128
+  if (G2_PWM_Y) PWM->PWM_CMP[2].PWM_CMPM = 0x0001;  // enable compare event
129
+  if (G2_PWM_Z) PWM->PWM_CMP[3].PWM_CMPM = 0x0001;  // enable compare event
130
+  if (G2_PWM_E) PWM->PWM_CMP[4].PWM_CMPM = 0x0001;  // enable compare event
131
+
132
+  PWM->PWM_SCM = PWM_SCM_UPDM_MODE0 | PWM_SCM_SYNC0
133
+    | G2_MASK_X(PWM_SCM_SYNC1)
134
+    | G2_MASK_Y(PWM_SCM_SYNC2)
135
+    | G2_MASK_Z(PWM_SCM_SYNC3)
136
+    | G2_MASK_E(PWM_SCM_SYNC4)
137
+  ; // sync 1-4 with 0, use mode 0 for updates
138
+
139
+  PWM->PWM_ENA = PWM_ENA_CHID0
140
+    | G2_MASK_X(PWM_ENA_CHID1)
141
+    | G2_MASK_Y(PWM_ENA_CHID2)
142
+    | G2_MASK_Z(PWM_ENA_CHID3)
143
+    | G2_MASK_E(PWM_ENA_CHID4)
144
+  ; // enable channels used by G2
145
+
146
+  PWM->PWM_IER1 = PWM_IER1_CHID0
147
+    | G2_MASK_X(PWM_IER1_CHID1)
148
+    | G2_MASK_Y(PWM_IER1_CHID2)
149
+    | G2_MASK_Z(PWM_IER1_CHID3)
150
+    | G2_MASK_E(PWM_IER1_CHID4)
151
+  ; // enable interrupts for channels used by G2
98 152
 
99 153
   NVIC_EnableIRQ(PWM_IRQn);     // Enable interrupt handler
100 154
   NVIC_SetPriority(PWM_IRQn, NVIC_EncodePriority(0, 10, 0));  // normal priority for PWM module (can stand some jitter on the Vref signals)
101 155
 }
102 156
 
103
-void Stepper::digipot_current(const uint8_t driver, const int16_t current) {
157
+void Stepper::set_digipot_current(const uint8_t driver, const int16_t current) {
104 158
 
105 159
   if (!(PWM->PWM_CH_NUM[0].PWM_CPRD == PWM_PERIOD_US)) digipot_init();  // Init PWM system if needed
106 160
 
107 161
   switch (driver) {
108
-    case 0: PWM->PWM_CMP[1].PWM_CMPVUPD = 0x010000000LL | G2_VREF_COUNT(G2_VREF(current));    // update X & Y
109
-            PWM->PWM_CMP[2].PWM_CMPVUPD = 0x010000000LL | G2_VREF_COUNT(G2_VREF(current));
110
-            PWM->PWM_CMP[1].PWM_CMPMUPD = 0x0001;  // enable compare event
111
-            PWM->PWM_CMP[2].PWM_CMPMUPD = 0x0001;  // enable compare event
112
-            PWM->PWM_SCUC = PWM_SCUC_UPDULOCK; // tell the PWM controller to update the values on the next cycle
113
-            break;
114
-    case 1: PWM->PWM_CMP[3].PWM_CMPVUPD = 0x010000000LL | G2_VREF_COUNT(G2_VREF(current));    // update Z
115
-            PWM->PWM_CMP[3].PWM_CMPMUPD = 0x0001;  // enable compare event
116
-            PWM->PWM_SCUC = PWM_SCUC_UPDULOCK; // tell the PWM controller to update the values on the next cycle
117
-            break;
118
-    default:PWM->PWM_CMP[4].PWM_CMPVUPD = 0x010000000LL | G2_VREF_COUNT(G2_VREF(current));    // update E
119
-            PWM->PWM_CMP[4].PWM_CMPMUPD = 0x0001;  // enable compare event
120
-            PWM->PWM_SCUC = PWM_SCUC_UPDULOCK; // tell the PWM controller to update the values on the next cycle
121
-            break;
162
+    case 0:
163
+      if (G2_PWM_X) PWM->PWM_CMP[1].PWM_CMPVUPD = 0x010000000LL | G2_VREF_COUNT(G2_VREF(current));    // update X & Y
164
+      if (G2_PWM_Y) PWM->PWM_CMP[2].PWM_CMPVUPD = 0x010000000LL | G2_VREF_COUNT(G2_VREF(current));
165
+      if (G2_PWM_X) PWM->PWM_CMP[1].PWM_CMPMUPD = 0x0001;  // enable compare event
166
+      if (G2_PWM_Y) PWM->PWM_CMP[2].PWM_CMPMUPD = 0x0001;  // enable compare event
167
+      if (G2_PWM_X || G2_PWM_Y) PWM->PWM_SCUC = PWM_SCUC_UPDULOCK; // tell the PWM controller to update the values on the next cycle
168
+      break;
169
+    case 1:
170
+      if (G2_PWM_Z) {
171
+        PWM->PWM_CMP[3].PWM_CMPVUPD = 0x010000000LL | G2_VREF_COUNT(G2_VREF(current));    // update Z
172
+        PWM->PWM_CMP[3].PWM_CMPMUPD = 0x0001;  // enable compare event
173
+        PWM->PWM_SCUC = PWM_SCUC_UPDULOCK; // tell the PWM controller to update the values on the next cycle
174
+      }
175
+      break;
176
+    default:
177
+      if (G2_PWM_E) {
178
+        PWM->PWM_CMP[4].PWM_CMPVUPD = 0x010000000LL | G2_VREF_COUNT(G2_VREF(current));    // update E
179
+        PWM->PWM_CMP[4].PWM_CMPMUPD = 0x0001;  // enable compare event
180
+        PWM->PWM_SCUC = PWM_SCUC_UPDULOCK; // tell the PWM controller to update the values on the next cycle
181
+      }
182
+      break;
122 183
   }
123 184
 }
124 185
 
@@ -127,17 +188,17 @@ volatile uint32_t PWM_ISR1_STATUS, PWM_ISR2_STATUS;
127 188
 void PWM_Handler() {
128 189
   PWM_ISR1_STATUS = PWM->PWM_ISR1;
129 190
   PWM_ISR2_STATUS = PWM->PWM_ISR2;
130
-  if (PWM_ISR1_STATUS & PWM_IER1_CHID0) {                           // CHAN_0 interrupt
131
-    *ISR_table[0].set_register = ISR_table[0].write_mask;                                          // set X to active
132
-    *ISR_table[1].set_register = ISR_table[1].write_mask;                                          // set Y to active
133
-    *ISR_table[2].set_register = ISR_table[2].write_mask;                                          // set Z to active
134
-    *ISR_table[3].set_register = ISR_table[3].write_mask;                                          // set E to active
191
+  if (PWM_ISR1_STATUS & PWM_IER1_CHID0) {                                                         // CHAN_0 interrupt
192
+    if (G2_PWM_X) *ISR_table[0].set_register = ISR_table[0].write_mask;                           // set X to active
193
+    if (G2_PWM_Y) *ISR_table[1].set_register = ISR_table[1].write_mask;                           // set Y to active
194
+    if (G2_PWM_Z) *ISR_table[2].set_register = ISR_table[2].write_mask;                           // set Z to active
195
+    if (G2_PWM_E) *ISR_table[3].set_register = ISR_table[3].write_mask;                           // set E to active
135 196
   }
136 197
   else {
137
-    if (PWM_ISR2_STATUS & PWM_IER2_CMPM1)  *ISR_table[0].clr_register = ISR_table[0].write_mask;   // set X to inactive
138
-    if (PWM_ISR2_STATUS & PWM_IER2_CMPM2)  *ISR_table[1].clr_register = ISR_table[1].write_mask;   // set Y to inactive
139
-    if (PWM_ISR2_STATUS & PWM_IER2_CMPM3)  *ISR_table[2].clr_register = ISR_table[2].write_mask;   // set Z to inactive
140
-    if (PWM_ISR2_STATUS & PWM_IER2_CMPM4)  *ISR_table[3].clr_register = ISR_table[3].write_mask;   // set E to inactive
198
+    if (G2_PWM_X && (PWM_ISR2_STATUS & PWM_IER2_CMPM1)) *ISR_table[0].clr_register = ISR_table[0].write_mask; // set X to inactive
199
+    if (G2_PWM_Y && (PWM_ISR2_STATUS & PWM_IER2_CMPM2)) *ISR_table[1].clr_register = ISR_table[1].write_mask; // set Y to inactive
200
+    if (G2_PWM_Z && (PWM_ISR2_STATUS & PWM_IER2_CMPM3)) *ISR_table[2].clr_register = ISR_table[2].write_mask; // set Z to inactive
201
+    if (G2_PWM_E && (PWM_ISR2_STATUS & PWM_IER2_CMPM4)) *ISR_table[3].clr_register = ISR_table[3].write_mask; // set E to inactive
141 202
   }
142 203
   return;
143 204
 }

+ 1
- 1
Marlin/src/HAL/DUE/fastio/G2_PWM.h Voir le fichier

@@ -16,7 +16,7 @@
16 16
  * GNU General Public License for more details.
17 17
  *
18 18
  * You should have received a copy of the GNU General Public License
19
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
19
+ * along with this program.  If not, see <https://www.gnu.org/licenses/>.
20 20
  *
21 21
  */
22 22
 #pragma once

+ 1
- 1
Marlin/src/HAL/DUE/fastio/G2_pins.h Voir le fichier

@@ -16,7 +16,7 @@
16 16
  * GNU General Public License for more details.
17 17
  *
18 18
  * You should have received a copy of the GNU General Public License
19
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
19
+ * along with this program.  If not, see <https://www.gnu.org/licenses/>.
20 20
  *
21 21
  */
22 22
 #pragma once

+ 5
- 1
Marlin/src/HAL/DUE/inc/Conditionals_LCD.h Voir le fichier

@@ -16,7 +16,11 @@
16 16
  * GNU General Public License for more details.
17 17
  *
18 18
  * You should have received a copy of the GNU General Public License
19
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
19
+ * along with this program.  If not, see <https://www.gnu.org/licenses/>.
20 20
  *
21 21
  */
22 22
 #pragma once
23
+
24
+#if HAS_SPI_TFT || HAS_FSMC_TFT
25
+  #error "Sorry! TFT displays are not available for HAL/DUE."
26
+#endif

+ 1
- 1
Marlin/src/HAL/DUE/inc/Conditionals_adv.h Voir le fichier

@@ -16,7 +16,7 @@
16 16
  * GNU General Public License for more details.
17 17
  *
18 18
  * You should have received a copy of the GNU General Public License
19
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
19
+ * along with this program.  If not, see <https://www.gnu.org/licenses/>.
20 20
  *
21 21
  */
22 22
 #pragma once

+ 5
- 5
Marlin/src/HAL/DUE/inc/Conditionals_post.h Voir le fichier

@@ -16,13 +16,13 @@
16 16
  * GNU General Public License for more details.
17 17
  *
18 18
  * You should have received a copy of the GNU General Public License
19
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
19
+ * along with this program.  If not, see <https://www.gnu.org/licenses/>.
20 20
  *
21 21
  */
22 22
 #pragma once
23 23
 
24
-#if USE_EMULATED_EEPROM
25
-  #undef SRAM_EEPROM_EMULATION
26
-  #undef SDCARD_EEPROM_EMULATION
27
-  #define FLASH_EEPROM_EMULATION 1
24
+#if USE_FALLBACK_EEPROM
25
+  #define FLASH_EEPROM_EMULATION
26
+#elif EITHER(I2C_EEPROM, SPI_EEPROM)
27
+  #define USE_SHARED_EEPROM 1
28 28
 #endif

+ 3
- 3
Marlin/src/HAL/DUE/inc/SanityCheck.h Voir le fichier

@@ -16,7 +16,7 @@
16 16
  * GNU General Public License for more details.
17 17
  *
18 18
  * You should have received a copy of the GNU General Public License
19
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
19
+ * along with this program.  If not, see <https://www.gnu.org/licenses/>.
20 20
  *
21 21
  */
22 22
 #pragma once
@@ -52,8 +52,8 @@
52 52
   #endif
53 53
 #endif
54 54
 
55
-#if ENABLED(FAST_PWM_FAN)
56
-  #error "FAST_PWM_FAN is not yet implemented for this platform."
55
+#if ENABLED(FAST_PWM_FAN) || SPINDLE_LASER_FREQUENCY
56
+  #error "Features requiring Hardware PWM (FAST_PWM_FAN, SPINDLE_LASER_FREQUENCY) are not yet supported on DUE."
57 57
 #endif
58 58
 
59 59
 #if HAS_TMC_SW_SERIAL

+ 1
- 2
Marlin/src/HAL/DUE/pinsDebug.h Voir le fichier

@@ -13,7 +13,7 @@
13 13
  * GNU General Public License for more details.
14 14
  *
15 15
  * You should have received a copy of the GNU General Public License
16
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
16
+ * along with this program.  If not, see <https://www.gnu.org/licenses/>.
17 17
  *
18 18
  */
19 19
 
@@ -179,5 +179,4 @@ void pwm_details(int32_t pin) {
179 179
  * ----------------+--------
180 180
  *  ID             |  PB11
181 181
  *  VBOF           |  PB10
182
- *
183 182
  */

+ 1
- 1
Marlin/src/HAL/DUE/spi_pins.h Voir le fichier

@@ -16,7 +16,7 @@
16 16
  * GNU General Public License for more details.
17 17
  *
18 18
  * You should have received a copy of the GNU General Public License
19
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
19
+ * along with this program.  If not, see <https://www.gnu.org/licenses/>.
20 20
  *
21 21
  */
22 22
 #pragma once

+ 2
- 6
Marlin/src/HAL/DUE/timers.cpp Voir le fichier

@@ -16,14 +16,12 @@
16 16
  * GNU General Public License for more details.
17 17
  *
18 18
  * You should have received a copy of the GNU General Public License
19
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
19
+ * along with this program.  If not, see <https://www.gnu.org/licenses/>.
20 20
  *
21 21
  */
22 22
 
23 23
 /**
24
- * Description: HAL for Arduino Due and compatible (SAM3X8E)
25
- *
26
- * For ARDUINO_ARCH_SAM
24
+ * HAL Timers for Arduino Due and compatible (SAM3X8E)
27 25
  */
28 26
 
29 27
 #ifdef ARDUINO_ARCH_SAM
@@ -34,8 +32,6 @@
34 32
 #include "../../inc/MarlinConfig.h"
35 33
 #include "HAL.h"
36 34
 
37
-#include "timers.h"
38
-
39 35
 // ------------------------
40 36
 // Local defines
41 37
 // ------------------------

+ 18
- 10
Marlin/src/HAL/DUE/timers.h Voir le fichier

@@ -15,15 +15,13 @@
15 15
  * GNU General Public License for more details.
16 16
  *
17 17
  * You should have received a copy of the GNU General Public License
18
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
18
+ * along with this program.  If not, see <https://www.gnu.org/licenses/>.
19 19
  *
20 20
  */
21 21
 #pragma once
22 22
 
23 23
 /**
24
- * HAL for Arduino Due and compatible (SAM3X8E)
25
- *
26
- * For ARDUINO_ARCH_SAM
24
+ * HAL Timers for Arduino Due and compatible (SAM3X8E)
27 25
  */
28 26
 
29 27
 #include <stdint.h>
@@ -40,11 +38,17 @@ typedef uint32_t hal_timer_t;
40 38
 #define HAL_TIMER_RATE         ((F_CPU) / 2)    // frequency of timers peripherals
41 39
 
42 40
 #ifndef STEP_TIMER_NUM
43
-#define STEP_TIMER_NUM 2  // index of timer to use for stepper
41
+  #define STEP_TIMER_NUM        2  // Timer Index for Stepper
42
+#endif
43
+#ifndef PULSE_TIMER_NUM
44
+  #define PULSE_TIMER_NUM       STEP_TIMER_NUM
45
+#endif
46
+#ifndef TEMP_TIMER_NUM
47
+  #define TEMP_TIMER_NUM        4  // Timer Index for Temperature
48
+#endif
49
+#ifndef TONE_TIMER_NUM
50
+  #define TONE_TIMER_NUM        6  // index of timer to use for beeper tones
44 51
 #endif
45
-#define TEMP_TIMER_NUM 4  // index of timer to use for temperature
46
-#define PULSE_TIMER_NUM STEP_TIMER_NUM
47
-#define TONE_TIMER_NUM 6  // index of timer to use for beeper tones
48 52
 
49 53
 #define TEMP_TIMER_FREQUENCY   1000 // temperature interrupt frequency
50 54
 
@@ -66,8 +70,12 @@ typedef uint32_t hal_timer_t;
66 70
 #ifndef HAL_STEP_TIMER_ISR
67 71
   #define HAL_STEP_TIMER_ISR() void TC2_Handler()
68 72
 #endif
69
-#define HAL_TEMP_TIMER_ISR()  void TC4_Handler()
70
-#define HAL_TONE_TIMER_ISR()  void TC6_Handler()
73
+#ifndef HAL_TEMP_TIMER_ISR
74
+  #define HAL_TEMP_TIMER_ISR() void TC4_Handler()
75
+#endif
76
+#ifndef HAL_TONE_TIMER_ISR
77
+  #define HAL_TONE_TIMER_ISR() void TC6_Handler()
78
+#endif
71 79
 
72 80
 // ------------------------
73 81
 // Types

+ 18
- 0
Marlin/src/HAL/DUE/upload_extra_script.py Voir le fichier

@@ -0,0 +1,18 @@
1
+#
2
+# Set upload_command
3
+#
4
+#  Windows: bossac.exe
5
+#  Other: leave unchanged
6
+#
7
+
8
+import platform
9
+current_OS = platform.system()
10
+
11
+if current_OS == 'Windows':
12
+
13
+	Import("env")
14
+
15
+	# Use bossac.exe on Windows
16
+	env.Replace(
17
+	    UPLOADCMD="bossac --info --unlock --write --verify --reset --erase -U false --boot $SOURCE"
18
+	)

+ 2
- 2
Marlin/src/HAL/DUE/usb/arduino_due_x.h Voir le fichier

@@ -43,7 +43,7 @@
43 43
 #pragma once
44 44
 
45 45
 /**
46
- * Support and FAQ: visit <a href="http://www.atmel.com/design-support/">Atmel Support</a>
46
+ * Support and FAQ: visit <a href="https://www.atmel.com/design-support/">Atmel Support</a>
47 47
  */
48 48
 
49 49
 /**
@@ -93,5 +93,5 @@
93 93
 #define USB_VBOF_GPIO               (PIO_PB10_IDX)
94 94
 #define USB_VBOF_FLAGS              (PIO_PERIPH_A | PIO_DEFAULT)
95 95
 /*! Active level of the USB_VBOF output pin. */
96
-#define USB_VBOF_ACTIVE_LEVEL       LOW
96
+#define USB_VBOF_ACTIVE_STATE       LOW
97 97
 /* ------------------------------------------------------------------------ */

+ 83
- 84
Marlin/src/HAL/DUE/usb/compiler.h Voir le fichier

@@ -41,7 +41,7 @@
41 41
  *
42 42
  */
43 43
 /*
44
- * Support and FAQ: visit <a href="http://www.atmel.com/design-support/">Atmel Support</a>
44
+ * Support and FAQ: visit <a href="https://www.atmel.com/design-support/">Atmel Support</a>
45 45
  */
46 46
 
47 47
 #ifndef UTILS_COMPILER_H
@@ -173,11 +173,11 @@
173 173
 #   define __always_inline   __forceinline
174 174
 #elif (defined __GNUC__)
175 175
 #ifdef __always_inline
176
-#	undef __always_inline
176
+# undef __always_inline
177 177
 #endif
178
-#	define __always_inline   inline __attribute__((__always_inline__))
178
+# define __always_inline   inline __attribute__((__always_inline__))
179 179
 #elif (defined __ICCARM__)
180
-#	define __always_inline   _Pragma("inline=forced")
180
+# define __always_inline   _Pragma("inline=forced")
181 181
 #endif
182 182
 
183 183
 /**
@@ -188,11 +188,11 @@
188 188
  * heuristics and not inline the function.
189 189
  */
190 190
 #ifdef __CC_ARM
191
-#   define __no_inline   __attribute__((noinline))
191
+# define __no_inline   __attribute__((noinline))
192 192
 #elif (defined __GNUC__)
193
-#	define __no_inline   __attribute__((__noinline__))
193
+# define __no_inline   __attribute__((__noinline__))
194 194
 #elif (defined __ICCARM__)
195
-#	define __no_inline   _Pragma("inline=never")
195
+# define __no_inline   _Pragma("inline=never")
196 196
 #endif
197 197
 
198 198
 /*! \brief This macro is used to test fatal errors.
@@ -211,9 +211,9 @@
211 211
 #  else
212 212
 #undef TEST_SUITE_DEFINE_ASSERT_MACRO
213 213
 #    define Assert(expr) \
214
-	{\
215
-		if (!(expr)) while (true);\
216
-	}
214
+  {\
215
+    if (!(expr)) while (true);\
216
+  }
217 217
 #  endif
218 218
 #else
219 219
 #  define Assert(expr) ((void) 0)
@@ -609,37 +609,37 @@ typedef struct
609 609
 #   define clz(u)              ((u) ? __CLZ(u) : 32)
610 610
 #else
611 611
 #   define clz(u)              (((u) == 0)          ? 32 : \
612
-                                ((u) & (1ul << 31)) ?  0 : \
613
-                                ((u) & (1ul << 30)) ?  1 : \
614
-                                ((u) & (1ul << 29)) ?  2 : \
615
-                                ((u) & (1ul << 28)) ?  3 : \
616
-                                ((u) & (1ul << 27)) ?  4 : \
617
-                                ((u) & (1ul << 26)) ?  5 : \
618
-                                ((u) & (1ul << 25)) ?  6 : \
619
-                                ((u) & (1ul << 24)) ?  7 : \
620
-                                ((u) & (1ul << 23)) ?  8 : \
621
-                                ((u) & (1ul << 22)) ?  9 : \
622
-                                ((u) & (1ul << 21)) ? 10 : \
623
-                                ((u) & (1ul << 20)) ? 11 : \
624
-                                ((u) & (1ul << 19)) ? 12 : \
625
-                                ((u) & (1ul << 18)) ? 13 : \
626
-                                ((u) & (1ul << 17)) ? 14 : \
627
-                                ((u) & (1ul << 16)) ? 15 : \
628
-                                ((u) & (1ul << 15)) ? 16 : \
629
-                                ((u) & (1ul << 14)) ? 17 : \
630
-                                ((u) & (1ul << 13)) ? 18 : \
631
-                                ((u) & (1ul << 12)) ? 19 : \
632
-                                ((u) & (1ul << 11)) ? 20 : \
633
-                                ((u) & (1ul << 10)) ? 21 : \
634
-                                ((u) & (1ul <<  9)) ? 22 : \
635
-                                ((u) & (1ul <<  8)) ? 23 : \
636
-                                ((u) & (1ul <<  7)) ? 24 : \
637
-                                ((u) & (1ul <<  6)) ? 25 : \
638
-                                ((u) & (1ul <<  5)) ? 26 : \
639
-                                ((u) & (1ul <<  4)) ? 27 : \
640
-                                ((u) & (1ul <<  3)) ? 28 : \
641
-                                ((u) & (1ul <<  2)) ? 29 : \
642
-                                ((u) & (1ul <<  1)) ? 30 : \
612
+                                ((u) & (1UL << 31)) ?  0 : \
613
+                                ((u) & (1UL << 30)) ?  1 : \
614
+                                ((u) & (1UL << 29)) ?  2 : \
615
+                                ((u) & (1UL << 28)) ?  3 : \
616
+                                ((u) & (1UL << 27)) ?  4 : \
617
+                                ((u) & (1UL << 26)) ?  5 : \
618
+                                ((u) & (1UL << 25)) ?  6 : \
619
+                                ((u) & (1UL << 24)) ?  7 : \
620
+                                ((u) & (1UL << 23)) ?  8 : \
621
+                                ((u) & (1UL << 22)) ?  9 : \
622
+                                ((u) & (1UL << 21)) ? 10 : \
623
+                                ((u) & (1UL << 20)) ? 11 : \
624
+                                ((u) & (1UL << 19)) ? 12 : \
625
+                                ((u) & (1UL << 18)) ? 13 : \
626
+                                ((u) & (1UL << 17)) ? 14 : \
627
+                                ((u) & (1UL << 16)) ? 15 : \
628
+                                ((u) & (1UL << 15)) ? 16 : \
629
+                                ((u) & (1UL << 14)) ? 17 : \
630
+                                ((u) & (1UL << 13)) ? 18 : \
631
+                                ((u) & (1UL << 12)) ? 19 : \
632
+                                ((u) & (1UL << 11)) ? 20 : \
633
+                                ((u) & (1UL << 10)) ? 21 : \
634
+                                ((u) & (1UL <<  9)) ? 22 : \
635
+                                ((u) & (1UL <<  8)) ? 23 : \
636
+                                ((u) & (1UL <<  7)) ? 24 : \
637
+                                ((u) & (1UL <<  6)) ? 25 : \
638
+                                ((u) & (1UL <<  5)) ? 26 : \
639
+                                ((u) & (1UL <<  4)) ? 27 : \
640
+                                ((u) & (1UL <<  3)) ? 28 : \
641
+                                ((u) & (1UL <<  2)) ? 29 : \
642
+                                ((u) & (1UL <<  1)) ? 30 : \
643 643
                                 31)
644 644
 #endif
645 645
 #endif
@@ -654,38 +654,38 @@ typedef struct
654 654
 #if (defined __GNUC__) || (defined __CC_ARM)
655 655
 #   define ctz(u)              ((u) ? __builtin_ctz(u) : 32)
656 656
 #else
657
-#   define ctz(u)              ((u) & (1ul <<  0) ?  0 : \
658
-                                (u) & (1ul <<  1) ?  1 : \
659
-                                (u) & (1ul <<  2) ?  2 : \
660
-                                (u) & (1ul <<  3) ?  3 : \
661
-                                (u) & (1ul <<  4) ?  4 : \
662
-                                (u) & (1ul <<  5) ?  5 : \
663
-                                (u) & (1ul <<  6) ?  6 : \
664
-                                (u) & (1ul <<  7) ?  7 : \
665
-                                (u) & (1ul <<  8) ?  8 : \
666
-                                (u) & (1ul <<  9) ?  9 : \
667
-                                (u) & (1ul << 10) ? 10 : \
668
-                                (u) & (1ul << 11) ? 11 : \
669
-                                (u) & (1ul << 12) ? 12 : \
670
-                                (u) & (1ul << 13) ? 13 : \
671
-                                (u) & (1ul << 14) ? 14 : \
672
-                                (u) & (1ul << 15) ? 15 : \
673
-                                (u) & (1ul << 16) ? 16 : \
674
-                                (u) & (1ul << 17) ? 17 : \
675
-                                (u) & (1ul << 18) ? 18 : \
676
-                                (u) & (1ul << 19) ? 19 : \
677
-                                (u) & (1ul << 20) ? 20 : \
678
-                                (u) & (1ul << 21) ? 21 : \
679
-                                (u) & (1ul << 22) ? 22 : \
680
-                                (u) & (1ul << 23) ? 23 : \
681
-                                (u) & (1ul << 24) ? 24 : \
682
-                                (u) & (1ul << 25) ? 25 : \
683
-                                (u) & (1ul << 26) ? 26 : \
684
-                                (u) & (1ul << 27) ? 27 : \
685
-                                (u) & (1ul << 28) ? 28 : \
686
-                                (u) & (1ul << 29) ? 29 : \
687
-                                (u) & (1ul << 30) ? 30 : \
688
-                                (u) & (1ul << 31) ? 31 : \
657
+#   define ctz(u)              ((u) & (1UL <<  0) ?  0 : \
658
+                                (u) & (1UL <<  1) ?  1 : \
659
+                                (u) & (1UL <<  2) ?  2 : \
660
+                                (u) & (1UL <<  3) ?  3 : \
661
+                                (u) & (1UL <<  4) ?  4 : \
662
+                                (u) & (1UL <<  5) ?  5 : \
663
+                                (u) & (1UL <<  6) ?  6 : \
664
+                                (u) & (1UL <<  7) ?  7 : \
665
+                                (u) & (1UL <<  8) ?  8 : \
666
+                                (u) & (1UL <<  9) ?  9 : \
667
+                                (u) & (1UL << 10) ? 10 : \
668
+                                (u) & (1UL << 11) ? 11 : \
669
+                                (u) & (1UL << 12) ? 12 : \
670
+                                (u) & (1UL << 13) ? 13 : \
671
+                                (u) & (1UL << 14) ? 14 : \
672
+                                (u) & (1UL << 15) ? 15 : \
673
+                                (u) & (1UL << 16) ? 16 : \
674
+                                (u) & (1UL << 17) ? 17 : \
675
+                                (u) & (1UL << 18) ? 18 : \
676
+                                (u) & (1UL << 19) ? 19 : \
677
+                                (u) & (1UL << 20) ? 20 : \
678
+                                (u) & (1UL << 21) ? 21 : \
679
+                                (u) & (1UL << 22) ? 22 : \
680
+                                (u) & (1UL << 23) ? 23 : \
681
+                                (u) & (1UL << 24) ? 24 : \
682
+                                (u) & (1UL << 25) ? 25 : \
683
+                                (u) & (1UL << 26) ? 26 : \
684
+                                (u) & (1UL << 27) ? 27 : \
685
+                                (u) & (1UL << 28) ? 28 : \
686
+                                (u) & (1UL << 29) ? 29 : \
687
+                                (u) & (1UL << 30) ? 30 : \
688
+                                (u) & (1UL << 31) ? 31 : \
689 689
                                 32)
690 690
 #endif
691 691
 #endif
@@ -1106,17 +1106,16 @@ static inline uint16_t convert_byte_array_to_16_bit(uint8_t *data)
1106 1106
 /* Converts a 8 Byte array into a 32-Bit value */
1107 1107
 static inline uint32_t convert_byte_array_to_32_bit(uint8_t *data)
1108 1108
 {
1109
-	union
1110
-	{
1111
-		uint32_t u32;
1112
-		uint8_t u8[8];
1113
-	}long_addr;
1114
-	uint8_t index;
1115
-	for (index = 0; index < 4; index++)
1116
-	{
1117
-		long_addr.u8[index] = *data++;
1118
-	}
1119
-	return long_addr.u32;
1109
+  union
1110
+  {
1111
+    uint32_t u32;
1112
+    uint8_t u8[8];
1113
+  }long_addr;
1114
+  uint8_t index;
1115
+  for (index = 0; index < 4; index++) {
1116
+    long_addr.u8[index] = *data++;
1117
+  }
1118
+  return long_addr.u32;
1120 1119
 }
1121 1120
 
1122 1121
 /**

+ 1
- 1
Marlin/src/HAL/DUE/usb/conf_access.h Voir le fichier

@@ -41,7 +41,7 @@
41 41
  *
42 42
  */
43 43
 /*
44
- * Support and FAQ: visit <a href="http://www.atmel.com/design-support/">Atmel Support</a>
44
+ * Support and FAQ: visit <a href="https://www.atmel.com/design-support/">Atmel Support</a>
45 45
  */
46 46
 
47 47
 #ifndef _CONF_ACCESS_H_

+ 1
- 1
Marlin/src/HAL/DUE/usb/conf_clock.h Voir le fichier

@@ -41,7 +41,7 @@
41 41
  *
42 42
  */
43 43
 /*
44
- * Support and FAQ: visit <a href="http://www.atmel.com/design-support/">Atmel Support</a>
44
+ * Support and FAQ: visit <a href="https://www.atmel.com/design-support/">Atmel Support</a>
45 45
  */
46 46
 
47 47
 #ifndef CONF_CLOCK_H_INCLUDED

+ 1
- 5
Marlin/src/HAL/DUE/usb/conf_usb.h Voir le fichier

@@ -41,7 +41,7 @@
41 41
  *
42 42
  */
43 43
 /*
44
- * Support and FAQ: visit <a href="http://www.atmel.com/design-support/">Atmel Support</a>
44
+ * Support and FAQ: visit <a href="https://www.atmel.com/design-support/">Atmel Support</a>
45 45
  */
46 46
 
47 47
 #ifndef _CONF_USB_H_
@@ -78,10 +78,6 @@
78 78
 //! To define a Full speed device
79 79
 //#define USB_DEVICE_FULL_SPEED
80 80
 
81
-#if MB(ARCHIM1)
82
-  #define USB_DEVICE_FULL_SPEED
83
-#endif
84
-
85 81
 //! To authorize the High speed
86 82
 #ifndef USB_DEVICE_FULL_SPEED
87 83
   #if (UC3A3||UC3A4)

+ 1
- 1
Marlin/src/HAL/DUE/usb/ctrl_access.c Voir le fichier

@@ -53,7 +53,7 @@
53 53
  *
54 54
  ******************************************************************************/
55 55
 /*
56
- * Support and FAQ: visit <a href="http://www.atmel.com/design-support/">Atmel Support</a>
56
+ * Support and FAQ: visit <a href="https://www.atmel.com/design-support/">Atmel Support</a>
57 57
  */
58 58
 
59 59
 #ifdef ARDUINO_ARCH_SAM

+ 1
- 1
Marlin/src/HAL/DUE/usb/ctrl_access.h Voir le fichier

@@ -53,7 +53,7 @@
53 53
  *
54 54
  ******************************************************************************/
55 55
 /*
56
- * Support and FAQ: visit <a href="http://www.atmel.com/design-support/">Atmel Support</a>
56
+ * Support and FAQ: visit <a href="https://www.atmel.com/design-support/">Atmel Support</a>
57 57
  */
58 58
 
59 59
 

+ 1
- 1
Marlin/src/HAL/DUE/usb/genclk.h Voir le fichier

@@ -41,7 +41,7 @@
41 41
  *
42 42
  */
43 43
 /*
44
- * Support and FAQ: visit <a href="http://www.atmel.com/design-support/">Atmel Support</a>
44
+ * Support and FAQ: visit <a href="https://www.atmel.com/design-support/">Atmel Support</a>
45 45
  */
46 46
 
47 47
 #ifndef CHIP_GENCLK_H_INCLUDED

+ 1
- 1
Marlin/src/HAL/DUE/usb/mrepeat.h Voir le fichier

@@ -41,7 +41,7 @@
41 41
  *
42 42
  */
43 43
 /*
44
- * Support and FAQ: visit <a href="http://www.atmel.com/design-support/">Atmel Support</a>
44
+ * Support and FAQ: visit <a href="https://www.atmel.com/design-support/">Atmel Support</a>
45 45
  */
46 46
 
47 47
 #ifndef _MREPEAT_H_

+ 1
- 1
Marlin/src/HAL/DUE/usb/osc.h Voir le fichier

@@ -41,7 +41,7 @@
41 41
  *
42 42
  */
43 43
 /*
44
- * Support and FAQ: visit <a href="http://www.atmel.com/design-support/">Atmel Support</a>
44
+ * Support and FAQ: visit <a href="https://www.atmel.com/design-support/">Atmel Support</a>
45 45
  */
46 46
 
47 47
 #ifndef CHIP_OSC_H_INCLUDED

+ 1
- 1
Marlin/src/HAL/DUE/usb/pll.h Voir le fichier

@@ -41,7 +41,7 @@
41 41
  *
42 42
  */
43 43
 /*
44
- * Support and FAQ: visit <a href="http://www.atmel.com/design-support/">Atmel Support</a>
44
+ * Support and FAQ: visit <a href="https://www.atmel.com/design-support/">Atmel Support</a>
45 45
  */
46 46
 
47 47
 #ifndef CHIP_PLL_H_INCLUDED

+ 1
- 1
Marlin/src/HAL/DUE/usb/preprocessor.h Voir le fichier

@@ -41,7 +41,7 @@
41 41
  *
42 42
  */
43 43
 /*
44
- * Support and FAQ: visit <a href="http://www.atmel.com/design-support/">Atmel Support</a>
44
+ * Support and FAQ: visit <a href="https://www.atmel.com/design-support/">Atmel Support</a>
45 45
  */
46 46
 
47 47
 #ifndef _PREPROCESSOR_H_

+ 1
- 1
Marlin/src/HAL/DUE/usb/sbc_protocol.h Voir le fichier

@@ -52,7 +52,7 @@
52 52
  *
53 53
  */
54 54
 /*
55
- * Support and FAQ: visit <a href="http://www.atmel.com/design-support/">Atmel Support</a>
55
+ * Support and FAQ: visit <a href="https://www.atmel.com/design-support/">Atmel Support</a>
56 56
  */
57 57
 #ifndef _SBC_PROTOCOL_H_
58 58
 #define _SBC_PROTOCOL_H_

+ 1
- 1
Marlin/src/HAL/DUE/usb/sd_mmc_spi_mem.h Voir le fichier

@@ -42,7 +42,7 @@
42 42
  *
43 43
  ******************************************************************************/
44 44
 /*
45
- * Support and FAQ: visit <a href="http://www.atmel.com/design-support/">Atmel Support</a>
45
+ * Support and FAQ: visit <a href="https://www.atmel.com/design-support/">Atmel Support</a>
46 46
  */
47 47
 
48 48
 

+ 0
- 0
Marlin/src/HAL/DUE/usb/spc_protocol.h Voir le fichier


Certains fichiers n'ont pas été affichés car il y a eu trop de fichiers modifiés dans ce diff

Chargement…
Annuler
Enregistrer