Compare commits
599 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 8e027304c8 | |||
| 79dcfe5455 | |||
| 834025e486 | |||
| 05d51f9c7f | |||
| 44589a964d | |||
| b3e3a58e8b | |||
| 16106e3961 | |||
| 6dad386de9 | |||
| 8df0cca036 | |||
| 62c280a60f | |||
| 2087a1330d | |||
| cab94bb030 | |||
| 26d01c5f2c | |||
| 6b22f8152b | |||
| e7cf3c7970 | |||
| 77227f66c2 | |||
| efde96131d | |||
| 051b95c845 | |||
| f595e40ceb | |||
| 0d8a695ea9 | |||
| fcf9f22390 | |||
| 43fa749d27 | |||
| 6cc11b76fd | |||
| c2f7a568f3 | |||
| a8f650079b | |||
| 91fafec424 | |||
| 11f8244573 | |||
| e1df912dc7 | |||
| 35594a23de | |||
| 83922dd4e6 | |||
| a5c5bb9660 | |||
| 18b6d6c8ca | |||
| 2c6ed101c1 | |||
| 644c91ce8b | |||
| 1b3941c0d2 | |||
| e14faf0413 | |||
| f84d51ec06 | |||
| 8aa3273242 | |||
| 6f68942e83 | |||
| 9881f758d7 | |||
| 945d5dbe13 | |||
| 7d08ab4fb7 | |||
| 4a2b08f883 | |||
| 1d2aecaca8 | |||
| a4297ff492 | |||
| 4f299bf867 | |||
| 038042b09e | |||
| 8f4fb42bfb | |||
| 6fdf9bf2ea | |||
| 6c813fcd16 | |||
| 1e525c5976 | |||
| b1239a42a8 | |||
| 06d7d2ada4 | |||
| 9467b68608 | |||
| e338420df8 | |||
| d0e7c2c208 | |||
| 1ab6e5cdc9 | |||
| 551f5ada94 | |||
| e927e58d32 | |||
| 8a3ad7abcc | |||
| 5b0096c350 | |||
| c3b58f1938 | |||
| e003552804 | |||
| 50f79823d2 | |||
| 3c449b220f | |||
| c5af435449 | |||
| 45cf997341 | |||
| 0820f94a5a | |||
| d5cf0b3348 | |||
| 0ae64f1140 | |||
| c80d1ea97d | |||
| 1013323f18 | |||
| 25736abc0f | |||
| dc0b490bf0 | |||
| b95d073f02 | |||
| 9e5c143b87 | |||
| 458e1aea41 | |||
| 0765dfd43f | |||
| 4f9ba7e991 | |||
| 9ab0b18256 | |||
| 57ee26e909 | |||
| d23ab529d8 | |||
| c9ef1277f3 | |||
| 2b23bdce70 | |||
| 61a543a471 | |||
| 83aac65664 | |||
| c46ed8f57d | |||
| 9fc3642f2a | |||
| 328f6d9aff | |||
| 35d4791518 | |||
| 094701cc71 | |||
| f6d109287f | |||
| fdf6445a51 | |||
| 68d4869616 | |||
| 5f61a896d9 | |||
| bcb6f6e85e | |||
| 8e71f7add4 | |||
| 243f7f2834 | |||
| 89f86bc550 | |||
| 1b03fc3f63 | |||
| aa0904600b | |||
| 6542f61aaf | |||
| b229fba98b | |||
| 8a3cd2f47b | |||
| 9b7b1a3635 | |||
| 15a100dafa | |||
| c918e90b8d | |||
| 2635182dcb | |||
| ace358327d | |||
| eabab4322d | |||
| 66e61f4de3 | |||
| 42f8cc4606 | |||
| 82d1851743 | |||
| 6053fae1ac | |||
| 2f91154cbd | |||
| 6704c0bc4c | |||
| b19d44ba0b | |||
| 2a2c161d87 | |||
| f4a5db52e8 | |||
| a76b92bce0 | |||
| e201f4e656 | |||
| 2a1c2e26ed | |||
| 20c72845a0 | |||
| d77027276c | |||
| 6e39bd6c85 | |||
| 34f3e5bd88 | |||
| da3b7ab259 | |||
| 6909f5fa4f | |||
| 03d9254079 | |||
| 4ae9bf3b9d | |||
| 306e03b03b | |||
| e701e0bb25 | |||
| dab60a1cb7 | |||
| 1be5a7b5d7 | |||
| af1c7e1a81 | |||
| 1766ee15a3 | |||
| ce26fccc3e | |||
| 0100b7be4d | |||
| fab4fb7fbb | |||
| b8bd331efd | |||
| e42cbe7500 | |||
| c84f839fc7 | |||
| c2874ca809 | |||
| 4bd4c1f3bc | |||
| 637bff9982 | |||
| 8025117ac0 | |||
| 1a1db10634 | |||
| 5b68a3f79b | |||
| d33111b215 | |||
| 53b202cf9d | |||
| 9c86ca3a19 | |||
| e33dafeb80 | |||
| 5b4af52d04 | |||
| 83320f1052 | |||
| 1dc17aa64c | |||
| 68f13ca9cf | |||
| 5a2cc41f9c | |||
| 7f10f8932e | |||
| 1866e25eef | |||
| ec4db07a51 | |||
| becef39c19 | |||
| 24a7ed44b3 | |||
| a167e2e948 | |||
| 59c2fe4561 | |||
| b7fd046d59 | |||
| 4c9146cffd | |||
| 1bed10c380 | |||
| 1c4fc4603a | |||
| 35d9920ef8 | |||
| 1ad036c52f | |||
| 7f72e78520 | |||
| 6fe317e385 | |||
| e5f2daa001 | |||
| 4ba35d3284 | |||
| 91f9e1671f | |||
| 232a104a92 | |||
| aba35ec1af | |||
| d8df9ffd61 | |||
| f4b6870ad1 | |||
| 8938e4d23c | |||
| 0f0edd2e37 | |||
| 7b0eb2d9f8 | |||
| 44c1f2ef6b | |||
| 9cdfaf693c | |||
| 6f7d14def3 | |||
| a25f321abb | |||
| 7e5d5330d6 | |||
| b4dcdcc885 | |||
| 2dff08c86b | |||
| ca8182344f | |||
| 21c48d9f92 | |||
| 90b5645223 | |||
| d816c1b38d | |||
| 8ccbac5317 | |||
| 223bbc9bca | |||
| 4ffa2e80e4 | |||
| bc0e4c6d50 | |||
| a29fb8088f | |||
| 57ca996c31 | |||
| 8cf4c0515d | |||
| 2634d0cc52 | |||
| deca553e18 | |||
| 007af47768 | |||
| 8455408382 | |||
| 3b4c759872 | |||
| edeea5a6fb | |||
| 6577fba768 | |||
| 7726e26ac0 | |||
| c2972899ca | |||
| 58329b066d | |||
| 2419a167ee | |||
| 0138cb0552 | |||
| aacc2d3dc5 | |||
| 39c5793575 | |||
| 258904e86c | |||
| 57700b4edd | |||
| c5b3bacfc9 | |||
| 999f33b1e7 | |||
| 4b8a1ec86f | |||
| bb3c5aa186 | |||
| 5f2908a117 | |||
| ed2071aabd | |||
| 48e4863cb6 | |||
| 3b4a5a1ae8 | |||
| 6d83f7a579 | |||
| 23926bb4c2 | |||
| 8fd6693d53 | |||
| 9706cd0d7d | |||
| 504fec9823 | |||
| 05a7be7b25 | |||
| fa0ad4b594 | |||
| e84de791ab | |||
| 9be1de54ae | |||
| 147fbd9d39 | |||
| 8a1643587b | |||
| 2f219d6824 | |||
| 33d261141a | |||
| fc0615fbd1 | |||
| 48f0d55097 | |||
| 6eef807520 | |||
| 0f5703a837 | |||
| de0706e52c | |||
| 7361c03aa4 | |||
| e92854b0ed | |||
| 0941e8e869 | |||
| a61fab7302 | |||
| 0dc46a8d27 | |||
| 30ec700a1d | |||
| 8fb54d4621 | |||
| c47575f244 | |||
| 3f4e4a4d89 | |||
| 2dc543c4f5 | |||
| 1d31b6215a | |||
| cee517bc24 | |||
| 3c3c9f1a8e | |||
| 068624a726 | |||
| ec2864be74 | |||
| 1bab0243fd | |||
| 57e27339b6 | |||
| d60a280bc5 | |||
| 0a7be1ac58 | |||
| f101aeb3ec | |||
| 62c0ab072c | |||
| 55b8d1b9d3 | |||
| d924d17209 | |||
| 920799e38d | |||
| f65f7a685b | |||
| 623631286f | |||
| abe139192f | |||
| 5979aab1c7 | |||
| f73fad1b2f | |||
| 1497c40379 | |||
| 64aff274b4 | |||
| 509dfe92d0 | |||
| 58048e7748 | |||
| 9805d2bc38 | |||
| a88e847295 | |||
| 55417b28fe | |||
| 6a67ad4e4a | |||
| 132c37a651 | |||
| e08b293b54 | |||
| f39e2bc1e4 | |||
| e94fa7d5dc | |||
| 954b4493d2 | |||
| fc287b44da | |||
| 54e7b933cd | |||
| 9baeeedd69 | |||
| 3826b13ab1 | |||
| b8741a59df | |||
| 2b6ce3006e | |||
| d956a6ba00 | |||
| 9c376f120c | |||
| b1bb307dab | |||
| cb4a79173b | |||
| 35dbc286bd | |||
| c7923c0397 | |||
| a811005ab2 | |||
| 71368b5fa5 | |||
| f76025b79c | |||
| f5488f96cc | |||
| 4fb1c42500 | |||
| d9ec3795fb | |||
| cc51bc29e1 | |||
| 914501f67e | |||
| 31d286750c | |||
| d6fc3d2b69 | |||
| 93ffd57383 | |||
| 307dfb15ca | |||
| 884f7c7db9 | |||
| 95b70233f2 | |||
| 76d784f75f | |||
| d8545551fe | |||
| b46191715d | |||
| dc5c5bdf82 | |||
| d976f291fd | |||
| 1e66cc39c2 | |||
| 2266f1ad67 | |||
| a0125c85d4 | |||
| 546b3066c3 | |||
| 0aebcc4ded | |||
| 12a869e2ad | |||
| 645c7dc370 | |||
| 1a79537645 | |||
| 6355798bfd | |||
| 58d1b1be28 | |||
| 3c13be165b | |||
| 8c3ba69c98 | |||
| 757156de72 | |||
| 757d66e2c5 | |||
| b06e378703 | |||
| 90d9f1acc9 | |||
| 22f0496c9b | |||
| d0e9ff0e29 | |||
| 975c8f4b77 | |||
| 4520a51bbe | |||
| 432c879328 | |||
| 6cbd7a48d1 | |||
| 751c88aa5b | |||
| 76f1f9d3b3 | |||
| a526c3d77a | |||
| 1a6a604310 | |||
| 0a3c42a87c | |||
| 70eac0fe4f | |||
| 873f6c0b63 | |||
| e1b22a5c75 | |||
| 640282b8dc | |||
| 0ff3018fd2 | |||
| 9c6e0428af | |||
| 43e9fe7f88 | |||
| 20dea22091 | |||
| ee90ae2c87 | |||
| fb76ce841b | |||
| 0ca33429b6 | |||
| e4e6abe5af | |||
| 76a0cab782 | |||
| 3e9fb34892 | |||
| 9e73fd7149 | |||
| 371ac49fc1 | |||
| f6e123430f | |||
| 3b142e531c | |||
| d355ad04a0 | |||
| a7a730f811 | |||
| c9a9b25d41 | |||
| 41a9dea149 | |||
| ec7cc59818 | |||
| ca06c6eab9 | |||
| d08223429b | |||
| 8aca38351c | |||
| 9c872b214c | |||
| 3522d5376c | |||
| 2c0b8b52d8 | |||
| 384ff264d7 | |||
| 2b3ba02f09 | |||
| bcd9bb9628 | |||
| 41f73cb457 | |||
| 845e2f6fb7 | |||
| c9b97b8d64 | |||
| 833ea4ec29 | |||
| 12aded95dc | |||
| 0e8e735e4c | |||
| 49db4ef5e4 | |||
| 08c51a405a | |||
| eda61a2cbd | |||
| f6b425613e | |||
| e260d90d21 | |||
| 30a7c4ca52 | |||
| 85c0875db2 | |||
| 6f3d7d864f | |||
| 3d70aca6e8 | |||
| 58ce5182c2 | |||
| 7dd34848b6 | |||
| 1a555b3812 | |||
| ea7bebb568 | |||
| 68a7a3f88f | |||
| 6ecf52f196 | |||
| eec9c800c9 | |||
| 41a469208a | |||
| a59766195c | |||
| 2b4a89eafe | |||
| 26f5c32872 | |||
| 21d2d22a6f | |||
| 4407ff31ec | |||
| 1f322b565f | |||
| 1d4f928342 | |||
| ff201e6552 | |||
| 460e243693 | |||
| 740f652b6a | |||
| 54c9358964 | |||
| e197695f4c | |||
| eb0c4682d5 | |||
| 0da862fd1e | |||
| 0a8672ae6c | |||
| 31413a7d77 | |||
| 639b1f64c6 | |||
| 7d9bd3a97c | |||
| f26b8bf8ef | |||
| c1ff38c7a0 | |||
| 15b6159f6a | |||
| 04d0d9431b | |||
| a5e1d4c50a | |||
| e88fabafc8 | |||
| c6b5bf7c00 | |||
| 167672dcd7 | |||
| a93146b71d | |||
| d99185be24 | |||
| c5126de559 | |||
| c16ae2451d | |||
| e340a61e52 | |||
| af59056c09 | |||
| 4b0b6e22a7 | |||
| 2bb9e0d58e | |||
| 52eefa90e1 | |||
| 12da2e9288 | |||
| 22c5bd7eae | |||
| 62057d3204 | |||
| 00075990d0 | |||
| 6a880280e4 | |||
| b523ddf1b2 | |||
| c814fe98d7 | |||
| a65e4edb1c | |||
| 310ff23676 | |||
| 7894cd9d6a | |||
| 0b787e8ed3 | |||
| 79789571bc | |||
| e092a02d77 | |||
| 66d94aad21 | |||
| 86fe4fde40 | |||
| 956f7d32fb | |||
| be0f1088f0 | |||
| 66e32cb0fa | |||
| a62dc7c70c | |||
| 0e4348c718 | |||
| 1397cf0eaa | |||
| eb352b11b9 | |||
| 6c2249451e | |||
| a7ade2d63e | |||
| c1b53d63fc | |||
| e438c77c6a | |||
| 8ccc601218 | |||
| b934a4c612 | |||
| cb31a99319 | |||
| ecc138fc9e | |||
| 1e749e4f48 | |||
| 38f4d8abfc | |||
| e039d51d18 | |||
| d1e9f53cb8 | |||
| 64ebb78892 | |||
| f1ab24d0ae | |||
| 84b9de9a19 | |||
| 30eb2aa869 | |||
| 672d0d4448 | |||
| 04fe50936e | |||
| 11c701af9b | |||
| ba95e85e53 | |||
| 918a9cf3d1 | |||
| 8e24b34160 | |||
| 9d32bc3153 | |||
| 3bf768f925 | |||
| 726a38712e | |||
| 4a17589496 | |||
| 198ef1e474 | |||
| 9e43ec9dcd | |||
| 1a9e8c047b | |||
| e43f4207a0 | |||
| 5f4ec82544 | |||
| 2a88cc0fcd | |||
| 505ab1bb62 | |||
| 659b4172aa | |||
| a5b57a09fd | |||
| 6e90272783 | |||
| 9d6b4a2e97 | |||
| 3cea0a00b1 | |||
| 81a6834876 | |||
| df40181357 | |||
| 6237a6a6d3 | |||
| 23a26e4033 | |||
| 492d91791c | |||
| 0a6c58ea71 | |||
| 4c8c02f66f | |||
| b038078541 | |||
| 43b43491ab | |||
| a1d4942f76 | |||
| 3bcbd3259f | |||
| 60f8287208 | |||
| b37d13af72 | |||
| 12eb1e0829 | |||
| 5c47476e0c | |||
| 60b6df4542 | |||
| e633ef895d | |||
| a0a963fe1d | |||
| a8419738be | |||
| 7501d253c7 | |||
| d9ccf0a144 | |||
| bd27490adb | |||
| ac4fefa49a | |||
| 6a05702c20 | |||
| 9188f57938 | |||
| 1a131d17b6 | |||
| 4a73fa18d8 | |||
| fe745fdef0 | |||
| 5b2071448f | |||
| 633fb5f941 | |||
| 741eb0c3e9 | |||
| bf38ef23e5 | |||
| 91cf4eb977 | |||
| 01bb11b415 | |||
| 0ff3035f3a | |||
| 2dcfa140e9 | |||
| 367c11dfa2 | |||
| d507ea117e | |||
| 3905234b0d | |||
| 6fc284231c | |||
| a0d28f1770 | |||
| aca0d3dba5 | |||
| d4fd39f05f | |||
| 42be79b3a2 | |||
| 5844128a77 | |||
| 8aaf64d917 | |||
| 5005c7b64c | |||
| bb5dbd13a8 | |||
| 696ae3cc14 | |||
| 9d623160a6 | |||
| 3d3898145a | |||
| 3b3dbcbeb4 | |||
| fc87834cc0 | |||
| c58c5b09ab | |||
| 2ee39b62f3 | |||
| fd082df077 | |||
| aaf5bf0218 | |||
| fb54d06582 | |||
| 5eeb6e0bca | |||
| b0e974e208 | |||
| d6cc851c67 | |||
| 14603112a4 | |||
| a52dfc0373 | |||
| 3e1dd0d640 | |||
| 2e121014b0 | |||
| cbf8622670 | |||
| 80810f1b18 | |||
| 29d3f6a024 | |||
| 80d09044f7 | |||
| 11c41600a3 | |||
| 416fb66118 | |||
| 2af7657214 | |||
| f31d3c6749 | |||
| c53af0df0b | |||
| cec7836959 | |||
| e4a8c693b0 | |||
| 7ff5e02f6b | |||
| f7cb1ce3f4 | |||
| 577831bf1a | |||
| 6cb1a4a48b | |||
| 3da29b4a04 | |||
| 6ee34331b7 | |||
| e2353be24f | |||
| 46e282bd6d | |||
| 6fa930f043 | |||
| b19f745659 | |||
| febf7e54fe | |||
| 88f36ac82f | |||
| 02f5e2de9c | |||
| 6567e0e0aa | |||
| fc50018b06 | |||
| 32e6767b5a | |||
| f22307a0af | |||
| 877e10205b | |||
| 8b8defeacc | |||
| f5daefb09d | |||
| 1fdad42c5f | |||
| 591fa8b753 | |||
| f7fff4d455 | |||
| 283aca50ba | |||
| 1bc9a530bd | |||
| 01797f74dc | |||
| ff07c2b375 | |||
| 90289b0ca0 | |||
| 19838d97be | |||
| c4873a64ec | |||
| 7ce4a7f641 |
+5
-1
@@ -14,6 +14,10 @@ end_of_line = lf
|
|||||||
indent_style = space
|
indent_style = space
|
||||||
indent_size = 2
|
indent_size = 2
|
||||||
|
|
||||||
[{*.py,*.conf,*.sublime-project}]
|
[{*.py}]
|
||||||
|
indent_style = space
|
||||||
|
indent_size = 4
|
||||||
|
|
||||||
|
[{*.conf,*.sublime-project}]
|
||||||
indent_style = tab
|
indent_style = tab
|
||||||
indent_size = 4
|
indent_size = 4
|
||||||
|
|||||||
@@ -0,0 +1,178 @@
|
|||||||
|
name: 🪲 Report a bug
|
||||||
|
description: Create a bug report to help improve Marlin Firmware
|
||||||
|
title: "[BUG] (bug summary)"
|
||||||
|
body:
|
||||||
|
- type: markdown
|
||||||
|
attributes:
|
||||||
|
value: >
|
||||||
|
Do you want to ask a question? Are you looking for support? Please use one of the [support links](https://github.com/MarlinFirmware/Marlin/issues/new/choose).
|
||||||
|
|
||||||
|
- type: markdown
|
||||||
|
attributes:
|
||||||
|
value: |
|
||||||
|
**Thank you for reporting a bug in Marlin Firmware!**
|
||||||
|
|
||||||
|
## Before Reporting a Bug
|
||||||
|
|
||||||
|
- Read and understand Marlin's [Code of Conduct](https://github.com/MarlinFirmware/Marlin/blob/bugfix-2.1.x/.github/code_of_conduct.md). You are expected to comply with it, including treating everyone with respect.
|
||||||
|
|
||||||
|
- Test with the [`bugfix-2.1.x` branch](https://github.com/MarlinFirmware/Marlin/archive/bugfix-2.1.x.zip) to see whether the issue still exists.
|
||||||
|
|
||||||
|
## Instructions
|
||||||
|
|
||||||
|
Please follow the instructions below. Failure to do so may result in your issue being closed. See [Contributing to Marlin](https://github.com/MarlinFirmware/Marlin/blob/bugfix-2.1.x/.github/contributing.md) for additional guidelines.
|
||||||
|
|
||||||
|
1. Provide a good title starting with [BUG].
|
||||||
|
2. Fill out all sections of this bug report form.
|
||||||
|
3. Always attach configuration files so we can build and test your setup.
|
||||||
|
|
||||||
|
- type: dropdown
|
||||||
|
attributes:
|
||||||
|
label: Did you test the latest `bugfix-2.1.x` code?
|
||||||
|
description: >-
|
||||||
|
Always try the latest code to make sure the issue you are reporting is not already fixed. To download
|
||||||
|
the latest code just [click this link](https://github.com/MarlinFirmware/Marlin/archive/bugfix-2.1.x.zip).
|
||||||
|
options:
|
||||||
|
- Yes, and the problem still exists.
|
||||||
|
- No, but I will test it now!
|
||||||
|
validations:
|
||||||
|
required: true
|
||||||
|
|
||||||
|
- type: markdown
|
||||||
|
attributes:
|
||||||
|
value: |
|
||||||
|
# Bug Details
|
||||||
|
|
||||||
|
- type: textarea
|
||||||
|
attributes:
|
||||||
|
label: Bug Description
|
||||||
|
description: >-
|
||||||
|
Describe the bug in this section. Tell us what you were trying to do and what
|
||||||
|
happened that you did not expect. Provide a clear and concise description of the
|
||||||
|
problem and include as many details as possible.
|
||||||
|
|
||||||
|
When pasting formatted text don't forget to put ` ``` ` (on its own line) before and after to make it readable.
|
||||||
|
placeholder: |
|
||||||
|
Marlin doesn't work.
|
||||||
|
validations:
|
||||||
|
required: true
|
||||||
|
|
||||||
|
- type: input
|
||||||
|
attributes:
|
||||||
|
label: Bug Timeline
|
||||||
|
description: Is this a new bug or an old issue? When did it first start?
|
||||||
|
|
||||||
|
- type: textarea
|
||||||
|
attributes:
|
||||||
|
label: Expected behavior
|
||||||
|
description: >-
|
||||||
|
What did you expect to happen?
|
||||||
|
placeholder: I expected it to move left.
|
||||||
|
|
||||||
|
- type: textarea
|
||||||
|
attributes:
|
||||||
|
label: Actual behavior
|
||||||
|
description: What actually happened instead?
|
||||||
|
placeholder: It moved right instead of left.
|
||||||
|
|
||||||
|
- type: textarea
|
||||||
|
attributes:
|
||||||
|
label: Steps to Reproduce
|
||||||
|
description: >-
|
||||||
|
Please describe the steps needed to reproduce the issue.
|
||||||
|
placeholder: |
|
||||||
|
1. [First Step] ...
|
||||||
|
2. [Second Step] ...
|
||||||
|
3. [and so on] ...
|
||||||
|
|
||||||
|
- type: markdown
|
||||||
|
attributes:
|
||||||
|
value: |
|
||||||
|
# Your Setup
|
||||||
|
|
||||||
|
- type: input
|
||||||
|
attributes:
|
||||||
|
label: Version of Marlin Firmware
|
||||||
|
description: "See the About Menu on the LCD or the output of `M115`. NOTE: For older releases we only patch critical bugs."
|
||||||
|
validations:
|
||||||
|
required: true
|
||||||
|
|
||||||
|
- type: input
|
||||||
|
attributes:
|
||||||
|
label: Printer model
|
||||||
|
description: Creality Ender 3, Prusa mini, or Kossel Delta?
|
||||||
|
|
||||||
|
- type: input
|
||||||
|
attributes:
|
||||||
|
label: Electronics
|
||||||
|
description: Stock electronics, upgrade board, or something else?
|
||||||
|
|
||||||
|
- type: input
|
||||||
|
attributes:
|
||||||
|
label: Add-ons
|
||||||
|
description: Please list any hardware add-ons that could be involved.
|
||||||
|
|
||||||
|
- type: dropdown
|
||||||
|
attributes:
|
||||||
|
label: Bed Leveling
|
||||||
|
description: What kind of bed leveling compensation are you using?
|
||||||
|
options:
|
||||||
|
- UBL Bilinear mesh
|
||||||
|
- ABL Bilinear mesh
|
||||||
|
- ABL Linear grid
|
||||||
|
- ABL 3-point
|
||||||
|
- MBL Manual Bed Leveling
|
||||||
|
- No Bed Leveling
|
||||||
|
|
||||||
|
- type: dropdown
|
||||||
|
attributes:
|
||||||
|
label: Your Slicer
|
||||||
|
description: Do you use Slic3r, Prusa Slicer, Simplify3D, IdeaMaker...?
|
||||||
|
options:
|
||||||
|
- Slic3r
|
||||||
|
- Simplify3D
|
||||||
|
- Prusa Slicer
|
||||||
|
- IdeaMaker
|
||||||
|
- Cura
|
||||||
|
- Other (explain below)
|
||||||
|
|
||||||
|
- type: dropdown
|
||||||
|
attributes:
|
||||||
|
label: Host Software
|
||||||
|
description: Do you use OctoPrint, Repetier Host, Pronterface...?
|
||||||
|
options:
|
||||||
|
- SD Card (headless)
|
||||||
|
- Repetier Host
|
||||||
|
- OctoPrint
|
||||||
|
- Pronterface
|
||||||
|
- Cura
|
||||||
|
- Same as my slicer
|
||||||
|
- Other (explain below)
|
||||||
|
|
||||||
|
- type: markdown
|
||||||
|
attributes:
|
||||||
|
value: |
|
||||||
|
# Attachments
|
||||||
|
|
||||||
|
- type: checkboxes
|
||||||
|
attributes:
|
||||||
|
label: Don't forget to include
|
||||||
|
options:
|
||||||
|
- label: A ZIP file containing your `Configuration.h` and `Configuration_adv.h`.
|
||||||
|
required: true
|
||||||
|
|
||||||
|
- type: markdown
|
||||||
|
attributes:
|
||||||
|
value: |
|
||||||
|
### Optional items to include:
|
||||||
|
- 'Log output from the host. (`M111 S247` for maximum logging.)'
|
||||||
|
- Images or videos demonstrating the problem, if it helps to make it clear.
|
||||||
|
- A G-Code file that exposes the problem, if not affecting _all_ G-code.
|
||||||
|
|
||||||
|
- type: textarea
|
||||||
|
attributes:
|
||||||
|
label: Additional information & file uploads
|
||||||
|
description: >-
|
||||||
|
If you've made any other modifications to the firmware, please describe them in detail.
|
||||||
|
|
||||||
|
When pasting formatted text don't forget to put ` ``` ` (on its own line) before and after to make it readable.
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
blank_issues_enabled: false
|
||||||
|
contact_links:
|
||||||
|
- name: 📖 Marlin Documentation
|
||||||
|
url: https://marlinfw.org/
|
||||||
|
about: Lots of documentation on installing and using Marlin.
|
||||||
|
- name: 👤 MarlinFirmware Facebook group
|
||||||
|
url: https://www.facebook.com/groups/1049718498464482
|
||||||
|
about: Please ask and answer questions here.
|
||||||
|
- name: 🕹 Marlin on Discord
|
||||||
|
url: https://discord.gg/n5NJ59y
|
||||||
|
about: Join the Discord server for support and discussion.
|
||||||
|
- name: 🔗 Marlin Discussion Forum
|
||||||
|
url: https://reprap.org/forum/list.php?415
|
||||||
|
about: A searchable web forum hosted by RepRap dot org.
|
||||||
|
- name: 📺 Marlin Videos on YouTube
|
||||||
|
url: https://www.youtube.com/results?search_query=marlin+firmware
|
||||||
|
about: Tutorials and more from Marlin users all around the world. Great for new users!
|
||||||
|
- name: 💸 Want to donate?
|
||||||
|
url: https://www.thinkyhead.com/donate-to-marlin
|
||||||
|
about: Please take a look at the various options to support Marlin Firmware's development financially!
|
||||||
@@ -0,0 +1,44 @@
|
|||||||
|
name: ✨ Request a feature
|
||||||
|
description: Request a new Marlin Firmware feature
|
||||||
|
title: "[FR] (feature summary)"
|
||||||
|
labels: 'T: Feature Request'
|
||||||
|
body:
|
||||||
|
- type: markdown
|
||||||
|
attributes:
|
||||||
|
value: >
|
||||||
|
Do you want to ask a question? Are you looking for support? Please use one of the [support links](https://github.com/MarlinFirmware/Marlin/issues/new/choose).
|
||||||
|
|
||||||
|
- type: markdown
|
||||||
|
attributes:
|
||||||
|
value: >
|
||||||
|
**Thank you for requesting a new Marlin Firmware feature!**
|
||||||
|
|
||||||
|
## Before Requesting a Feature
|
||||||
|
|
||||||
|
- Read and understand Marlin's [Code of Conduct](https://github.com/MarlinFirmware/Marlin/blob/master/.github/code_of_conduct.md). You are expected to comply with it, including treating everyone with respect.
|
||||||
|
|
||||||
|
- Check the latest [`bugfix-2.1.x` branch](https://github.com/MarlinFirmware/Marlin/archive/bugfix-2.1.x.zip) to see if the feature already exists.
|
||||||
|
|
||||||
|
- Before you proceed with your request, please consider if it is necessary to make it into a firmware feature, or if it may be better suited for a slicer or host feature.
|
||||||
|
|
||||||
|
- type: textarea
|
||||||
|
attributes:
|
||||||
|
label: Is your feature request related to a problem? Please describe.
|
||||||
|
description: A clear description of the problem (e.g., "I need X but Marlin can't do it [...]").
|
||||||
|
|
||||||
|
- type: textarea
|
||||||
|
attributes:
|
||||||
|
label: Are you looking for hardware support?
|
||||||
|
description: Tell us the printer, board, or peripheral that needs support.
|
||||||
|
|
||||||
|
- type: textarea
|
||||||
|
attributes:
|
||||||
|
label: Describe the feature you want
|
||||||
|
description: A clear description of the feature and how you think it should work.
|
||||||
|
validations:
|
||||||
|
required: true
|
||||||
|
|
||||||
|
- type: textarea
|
||||||
|
attributes:
|
||||||
|
label: Additional context
|
||||||
|
description: Add any other context or screenshots about the feature request here.
|
||||||
+10
-7
@@ -34,8 +34,11 @@ This project and everyone participating in it is governed by the [Marlin Code of
|
|||||||
|
|
||||||
We have a Message Board and a Facebook group where our knowledgable user community can provide helpful advice if you have questions.
|
We have a Message Board and a Facebook group where our knowledgable user community can provide helpful advice if you have questions.
|
||||||
|
|
||||||
* [Marlin RepRap forum](https://reprap.org/forum/list.php?415)
|
- [Marlin Documentation](https://marlinfw.org) - Official Marlin documentation
|
||||||
* [MarlinFirmware on Facebook](https://www.facebook.com/groups/1049718498464482/)
|
- Facebook Group ["Marlin Firmware"](https://www.facebook.com/groups/1049718498464482/)
|
||||||
|
- RepRap.org [Marlin Forum](https://forums.reprap.org/list.php?415)
|
||||||
|
- Facebook Group ["Marlin Firmware for 3D Printers"](https://www.facebook.com/groups/3Dtechtalk/)
|
||||||
|
- [Marlin Configuration](https://www.youtube.com/results?search_query=marlin+configuration) on YouTube
|
||||||
|
|
||||||
If chat is more your speed, you can join the MarlinFirmware Discord server:
|
If chat is more your speed, you can join the MarlinFirmware Discord server:
|
||||||
|
|
||||||
@@ -50,13 +53,13 @@ If chat is more your speed, you can join the MarlinFirmware Discord server:
|
|||||||
|
|
||||||
This section guides you through submitting a Bug Report for Marlin. Following these guidelines helps maintainers and the community understand your report, reproduce the behavior, and find related reports.
|
This section guides you through submitting a Bug Report for Marlin. Following these guidelines helps maintainers and the community understand your report, reproduce the behavior, and find related reports.
|
||||||
|
|
||||||
Before creating a Bug Report, please test the "nightly" development branch, as you might find out that you don't need to create one. When you are creating a Bug Report, please [include as many details as possible](#how-do-i-submit-a-good-bug-report). Fill out [the required template](issue_template.md), the information it asks for helps us resolve issues faster.
|
Before creating a Bug Report, please test the "nightly" development branch, as you might find out that you don't need to create one. When you are creating a Bug Report, please [include as many details as possible](#how-do-i-submit-a-good-bug-report). Fill out [the required template](ISSUE_TEMPLATE/bug_report.yml), the information it asks for helps us resolve issues faster.
|
||||||
|
|
||||||
> **Note:** Regressions can happen. If you find a **Closed** issue that seems like your issue, go ahead and open a new issue and include a link to the original issue in the body of your new one. All you need to create a link is the issue number, preceded by #. For example, #8888.
|
> **Note:** Regressions can happen. If you find a **Closed** issue that seems like your issue, go ahead and open a new issue and include a link to the original issue in the body of your new one. All you need to create a link is the issue number, preceded by #. For example, #8888.
|
||||||
|
|
||||||
#### How Do I Submit A (Good) Bug Report?
|
#### How Do I Submit A (Good) Bug Report?
|
||||||
|
|
||||||
Bugs are tracked as [GitHub issues](https://guides.github.com/features/issues/). Use the New Issue button to create an issue and provide the following information by filling in [the template](issue_template.md).
|
Bugs are tracked as [GitHub issues](https://guides.github.com/features/issues/). Use the New Issue button to create an issue and provide the following information by filling in [the template](ISSUE_TEMPLATE/bug_report.yml).
|
||||||
|
|
||||||
Explain the problem and include additional details to help maintainers reproduce the problem:
|
Explain the problem and include additional details to help maintainers reproduce the problem:
|
||||||
|
|
||||||
@@ -88,12 +91,12 @@ Include details about your configuration and environment:
|
|||||||
|
|
||||||
This section guides you through submitting a suggestion for Marlin, including completely new features and minor improvements to existing functionality. Following these guidelines helps maintainers and the community understand your suggestion and find related suggestions.
|
This section guides you through submitting a suggestion for Marlin, including completely new features and minor improvements to existing functionality. Following these guidelines helps maintainers and the community understand your suggestion and find related suggestions.
|
||||||
|
|
||||||
Before creating a suggestion, please check [this list](#before-submitting-a-suggestion) as you might find out that you don't need to create one. When you are creating an enhancement suggestion, please [include as many details as possible](#how-do-i-submit-a-good-enhancement-suggestion). Fill in [the template](issue_template.md), including the steps that you imagine you would take if the feature you're requesting existed.
|
Before creating a suggestion, please check [this list](https://github.com/MarlinFirmware/Marlin/issues?q=is%3Aopen+is%3Aissue+label%3A%22T%3A+Feature+Request%22) as you might find out that you don't need to create one. When you are creating an enhancement suggestion, please [include as many details as possible](#how-do-i-submit-a-good-feature-request). Fill in [the template](ISSUE_TEMPLATE/feature_request.yml), including the steps that you imagine you would take if the feature you're requesting existed.
|
||||||
|
|
||||||
#### Before Submitting a Feature Request
|
#### Before Submitting a Feature Request
|
||||||
|
|
||||||
* **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).
|
* **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).
|
||||||
* **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.
|
* **Perform a [cursory search](https://github.com/MarlinFirmware/Marlin/issues?q=is%3Aopen+is%3Aissue+label%3A%22T%3A+Feature+Request%22)** 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.
|
||||||
|
|
||||||
#### How Do I Submit A (Good) Feature Request?
|
#### How Do I Submit A (Good) Feature Request?
|
||||||
|
|
||||||
@@ -116,7 +119,7 @@ Unsure where to begin contributing to Marlin? You can start by looking through t
|
|||||||
|
|
||||||
### Pull Requests
|
### Pull Requests
|
||||||
|
|
||||||
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.
|
Pull Requests should always be targeted to working branches (e.g., `bugfix-2.1.x` and/or `bugfix-1.1.x`) and never to release branches (e.g., `2.0.x` and/or `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.
|
||||||
|
|
||||||
* Fill in [the required template](pull_request_template.md).
|
* Fill in [the required template](pull_request_template.md).
|
||||||
* Don't include issue numbers in the PR title.
|
* Don't include issue numbers in the PR title.
|
||||||
|
|||||||
@@ -1,35 +0,0 @@
|
|||||||
<!--
|
|
||||||
|
|
||||||
Have you read Marlin's Code of Conduct? By filing an Issue, you are expected to comply with it, including treating everyone with respect: https://github.com/MarlinFirmware/Marlin/blob/bugfix-2.0.x/.github/code_of_conduct.md
|
|
||||||
|
|
||||||
Do you want to ask a question? Are you looking for support? Please don't post here. Instead use one of the following options:
|
|
||||||
|
|
||||||
- The Marlin Firmware forum at https://reprap.org/forum/list.php?415
|
|
||||||
- The MarlinFirmware Facebook Group at https://www.facebook.com/groups/1049718498464482/
|
|
||||||
- The MarlinFirmware Discord Server at https://discord.gg/n5NJ59y.
|
|
||||||
|
|
||||||
Before filing an issue be sure to test the latest "bugfix" branch to see whether the issue is already addressed.
|
|
||||||
|
|
||||||
-->
|
|
||||||
|
|
||||||
### Description
|
|
||||||
|
|
||||||
<!-- Description of the bug or requested feature -->
|
|
||||||
|
|
||||||
### Steps to Reproduce
|
|
||||||
|
|
||||||
<!-- If this is a Bug Report, please describe the steps needed to reproduce the issue -->
|
|
||||||
|
|
||||||
1. [First Step]
|
|
||||||
2. [Second Step]
|
|
||||||
3. [and so on...]
|
|
||||||
|
|
||||||
**Expected behavior:** [What you expect to happen]
|
|
||||||
|
|
||||||
**Actual behavior:** [What actually happens]
|
|
||||||
|
|
||||||
#### Additional Information
|
|
||||||
|
|
||||||
* Include a ZIP file containing your `Configuration.h` and `Configuration_adv.h` files.
|
|
||||||
* Provide pictures or links to videos that clearly demonstrate the issue.
|
|
||||||
* See [How Can I Contribute](#how-can-i-contribute) for additional guidelines.
|
|
||||||
@@ -1,23 +1,33 @@
|
|||||||
### Requirements
|
<!--
|
||||||
|
|
||||||
* Filling out this template is required. Pull Requests without a clear description may be closed at the maintainers' discretion.
|
Submitting a Pull Request
|
||||||
|
|
||||||
|
- Please fill out all sections of this form. You can delete the helpful comments.
|
||||||
|
- Pull Requests without clear information will take longer and may even be rejected.
|
||||||
|
- We get a high volume of submissions so please be patient during review.
|
||||||
|
|
||||||
|
-->
|
||||||
|
|
||||||
### Description
|
### Description
|
||||||
|
|
||||||
<!--
|
<!--
|
||||||
|
|
||||||
We must be able to understand your proposed change from this description. If we can't understand what the code will do from this description, the Pull Request may be closed at the maintainers' discretion. Keep in mind that the maintainer reviewing this PR may not be familiar with or have worked with the code recently, so please walk us through the concepts.
|
Clearly describe the submitted changes with lots of details. Include images where helpful. Initial reviewers may not be familiar with the subject, so be as thorough as possible. You can use MarkDown syntax to improve readability with bullet lists, code blocks, and so on. PREVIEW and fix up formatting before submitting.
|
||||||
|
|
||||||
-->
|
-->
|
||||||
|
|
||||||
|
### Requirements
|
||||||
|
|
||||||
|
<!-- Does this PR require a specific board, LCD, etc.? -->
|
||||||
|
|
||||||
### Benefits
|
### Benefits
|
||||||
|
|
||||||
<!-- What does this fix or improve? -->
|
<!-- What does this PR fix or improve? -->
|
||||||
|
|
||||||
### Configurations
|
### Configurations
|
||||||
|
|
||||||
<!-- Attach any Configuration.h, Configuration_adv.h, or platformio.ini files needed to compile/test your Pull Request. -->
|
<!-- Attach Configurations ZIP and any other files needed to test this PR. -->
|
||||||
|
|
||||||
### Related Issues
|
### Related Issues
|
||||||
|
|
||||||
<!-- Whether this fixes a bug or fulfills a feature request, please list any related Issues here. -->
|
<!-- Does this PR fix a bug or fulfill a Feature Request? Link related Issues here. -->
|
||||||
|
|||||||
@@ -0,0 +1,59 @@
|
|||||||
|
#
|
||||||
|
# bump-date.yml
|
||||||
|
# Bump the distribution date once per day
|
||||||
|
#
|
||||||
|
|
||||||
|
name: Bump Distribution Date
|
||||||
|
|
||||||
|
on:
|
||||||
|
schedule:
|
||||||
|
- cron: '0 */6 * * *'
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
bump_date:
|
||||||
|
name: Bump Distribution Date
|
||||||
|
if: github.repository == 'MarlinFirmware/Marlin'
|
||||||
|
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
steps:
|
||||||
|
|
||||||
|
- name: Check out bugfix-2.1.x
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
with:
|
||||||
|
ref: bugfix-2.1.x
|
||||||
|
|
||||||
|
- name: Bump Date (bugfix-2.0.x)
|
||||||
|
run: |
|
||||||
|
# Inline Bump Script
|
||||||
|
if [[ ! "$( git log -1 --pretty=%B )" =~ ^\[cron\] ]]; then
|
||||||
|
DIST=$( date +"%Y-%m-%d" )
|
||||||
|
eval "sed -E -i 's/(#define +STRING_DISTRIBUTION_DATE) .*$/\1 \"$DIST\"/g' Marlin/src/inc/Version.h" && \
|
||||||
|
eval "sed -E -i 's/(#define +STRING_DISTRIBUTION_DATE) .*$/\1 \"$DIST\"/g' Marlin/Version.h" && \
|
||||||
|
git config user.name "${GITHUB_ACTOR}" && \
|
||||||
|
git config user.email "${GITHUB_ACTOR}@users.noreply.github.com" && \
|
||||||
|
git add . && \
|
||||||
|
git commit -m "[cron] Bump distribution date ($DIST)" && \
|
||||||
|
git push
|
||||||
|
fi
|
||||||
|
exit 0
|
||||||
|
|
||||||
|
- name: Check out bugfix-2.1.x
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
with:
|
||||||
|
ref: bugfix-2.1.x
|
||||||
|
|
||||||
|
- name: Bump Date (bugfix-2.1.x)
|
||||||
|
run: |
|
||||||
|
# Inline Bump Script
|
||||||
|
if [[ ! "$( git log -1 --pretty=%B )" =~ ^\[cron\] ]]; then
|
||||||
|
DIST=$( date +"%Y-%m-%d" )
|
||||||
|
eval "sed -E -i 's/(#define +STRING_DISTRIBUTION_DATE) .*$/\1 \"$DIST\"/g' Marlin/src/inc/Version.h" && \
|
||||||
|
eval "sed -E -i 's/(#define +STRING_DISTRIBUTION_DATE) .*$/\1 \"$DIST\"/g' Marlin/Version.h" && \
|
||||||
|
git config user.name "${GITHUB_ACTOR}" && \
|
||||||
|
git config user.email "${GITHUB_ACTOR}@users.noreply.github.com" && \
|
||||||
|
git add . && \
|
||||||
|
git commit -m "[cron] Bump distribution date ($DIST)" && \
|
||||||
|
git push
|
||||||
|
fi
|
||||||
|
exit 0
|
||||||
@@ -0,0 +1,34 @@
|
|||||||
|
#
|
||||||
|
# check-pr.yml
|
||||||
|
# Close PRs directed at release branches
|
||||||
|
#
|
||||||
|
|
||||||
|
name: PR Bad Target
|
||||||
|
|
||||||
|
on:
|
||||||
|
pull_request_target:
|
||||||
|
types: [opened]
|
||||||
|
branches:
|
||||||
|
- 1.0.x
|
||||||
|
- 1.1.x
|
||||||
|
- 2.0.x
|
||||||
|
- 2.1.x
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
bad_target:
|
||||||
|
name: PR Bad Target
|
||||||
|
if: github.repository == 'MarlinFirmware/Marlin'
|
||||||
|
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- uses: superbrothers/close-pull-request@v3
|
||||||
|
with:
|
||||||
|
comment: >
|
||||||
|
Thanks for your contribution! Unfortunately we can't accept PRs directed at release branches. We make patches to the bugfix branches and only later do we push them out as releases.
|
||||||
|
|
||||||
|
Please redo this PR starting with the `bugfix-2.1.x` branch and be careful to target `bugfix-2.1.x` when resubmitting the PR. Patches may also target `bugfix-2.0.x` if they are specifically for 2.0.9.x.
|
||||||
|
|
||||||
|
It may help to set your fork's default branch to `bugfix-2.0.x`.
|
||||||
|
|
||||||
|
See [this page](https://marlinfw.org/docs/development/getting_started_pull_requests.html) for full instructions.
|
||||||
@@ -0,0 +1,39 @@
|
|||||||
|
#
|
||||||
|
# clean-closed.yml
|
||||||
|
# Remove obsolete labels when an Issue or PR is closed
|
||||||
|
#
|
||||||
|
|
||||||
|
name: Clean Closed
|
||||||
|
|
||||||
|
on:
|
||||||
|
pull_request:
|
||||||
|
types: [closed]
|
||||||
|
issues:
|
||||||
|
types: [closed]
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
remove_label:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
label:
|
||||||
|
- "S: Don't Merge"
|
||||||
|
- "S: Hold for 2.1"
|
||||||
|
- "S: Please Merge"
|
||||||
|
- "S: Please Test"
|
||||||
|
- "help wanted"
|
||||||
|
- "Needs: Discussion"
|
||||||
|
- "Needs: Documentation"
|
||||||
|
- "Needs: More Data"
|
||||||
|
- "Needs: Patch"
|
||||||
|
- "Needs: Testing"
|
||||||
|
- "Needs: Work"
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
- name: Remove Labels
|
||||||
|
uses: actions-ecosystem/action-remove-labels@v1
|
||||||
|
with:
|
||||||
|
github_token: ${{ github.token }}
|
||||||
|
labels: ${{ matrix.label }}
|
||||||
@@ -0,0 +1,28 @@
|
|||||||
|
#
|
||||||
|
# close-stale.yml
|
||||||
|
# Close open issues after a period of inactivity
|
||||||
|
#
|
||||||
|
|
||||||
|
name: Close Stale Issues
|
||||||
|
|
||||||
|
on:
|
||||||
|
schedule:
|
||||||
|
- cron: "22 1 * * *"
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
stale:
|
||||||
|
name: Close Stale Issues
|
||||||
|
if: github.repository == 'MarlinFirmware/Marlin'
|
||||||
|
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- uses: actions/stale@v3
|
||||||
|
with:
|
||||||
|
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
stale-issue-message: 'This issue has had no activity in the last 60 days. Please add a reply if you want to keep this issue active, otherwise it will be automatically closed within 10 days.'
|
||||||
|
days-before-stale: 60
|
||||||
|
days-before-close: 10
|
||||||
|
stale-issue-label: 'stale-closing-soon'
|
||||||
|
exempt-all-assignees: true
|
||||||
|
exempt-issue-labels: 'Bug: Confirmed !,T: Feature Request,Needs: More Data,Needs: Discussion,Needs: Documentation,Needs: Patch,Needs: Work,Needs: Testing,help wanted,no-locking'
|
||||||
@@ -0,0 +1,32 @@
|
|||||||
|
#
|
||||||
|
# lock-closed.yml
|
||||||
|
# Lock closed issues after a period of inactivity
|
||||||
|
#
|
||||||
|
|
||||||
|
name: Lock Closed Issues
|
||||||
|
|
||||||
|
on:
|
||||||
|
schedule:
|
||||||
|
- cron: '0 1/13 * * *'
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
lock:
|
||||||
|
name: Lock Closed Issues
|
||||||
|
if: github.repository == 'MarlinFirmware/Marlin'
|
||||||
|
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- uses: dessant/lock-threads@v2
|
||||||
|
with:
|
||||||
|
github-token: ${{ github.token }}
|
||||||
|
process-only: 'issues'
|
||||||
|
issue-lock-inactive-days: '60'
|
||||||
|
issue-exclude-created-before: ''
|
||||||
|
issue-exclude-labels: 'no-locking'
|
||||||
|
issue-lock-labels: ''
|
||||||
|
issue-lock-comment: >
|
||||||
|
This issue has been automatically locked since there
|
||||||
|
has not been any recent activity after it was closed.
|
||||||
|
Please open a new issue for related bugs.
|
||||||
|
issue-lock-reason: ''
|
||||||
@@ -8,7 +8,7 @@ name: CI
|
|||||||
on:
|
on:
|
||||||
pull_request:
|
pull_request:
|
||||||
branches:
|
branches:
|
||||||
- bugfix-2.0.x
|
- bugfix-2.1.x
|
||||||
paths-ignore:
|
paths-ignore:
|
||||||
- config/**
|
- config/**
|
||||||
- data/**
|
- data/**
|
||||||
@@ -16,7 +16,7 @@ on:
|
|||||||
- '**/*.md'
|
- '**/*.md'
|
||||||
push:
|
push:
|
||||||
branches:
|
branches:
|
||||||
- bugfix-2.0.x
|
- bugfix-2.1.x
|
||||||
paths-ignore:
|
paths-ignore:
|
||||||
- config/**
|
- config/**
|
||||||
- data/**
|
- data/**
|
||||||
@@ -45,6 +45,7 @@ jobs:
|
|||||||
- teensy35
|
- teensy35
|
||||||
- teensy41
|
- teensy41
|
||||||
- SAMD51_grandcentral_m4
|
- SAMD51_grandcentral_m4
|
||||||
|
- PANDA_PI_V29
|
||||||
|
|
||||||
# Extended AVR Environments
|
# Extended AVR Environments
|
||||||
|
|
||||||
@@ -59,13 +60,13 @@ jobs:
|
|||||||
#- STM32F103RC_btt_maple
|
#- STM32F103RC_btt_maple
|
||||||
- STM32F103RC_btt_USB_maple
|
- STM32F103RC_btt_USB_maple
|
||||||
- STM32F103RC_fysetc_maple
|
- STM32F103RC_fysetc_maple
|
||||||
- STM32F103RC_meeb
|
- STM32F103RC_meeb_maple
|
||||||
- jgaurora_a5s_a1_maple
|
- jgaurora_a5s_a1_maple
|
||||||
- STM32F103VE_longer_maple
|
- STM32F103VE_longer_maple
|
||||||
#- mks_robin_maple
|
#- mks_robin_maple
|
||||||
- mks_robin_lite_maple
|
- mks_robin_lite_maple
|
||||||
- mks_robin_pro_maple
|
- mks_robin_pro_maple
|
||||||
#- mks_robin_nano35_maple
|
#- mks_robin_nano_v1v2_maple
|
||||||
#- STM32F103RE_creality_maple
|
#- STM32F103RE_creality_maple
|
||||||
- STM32F103VE_ZM3E4V2_USB_maple
|
- STM32F103VE_ZM3E4V2_USB_maple
|
||||||
|
|
||||||
@@ -76,9 +77,9 @@ jobs:
|
|||||||
- STM32F103RE_btt
|
- STM32F103RE_btt
|
||||||
- STM32F103RE_btt_USB
|
- STM32F103RE_btt_USB
|
||||||
- STM32F103RE_creality
|
- STM32F103RE_creality
|
||||||
|
- STM32F401RC_creality
|
||||||
- STM32F103VE_longer
|
- STM32F103VE_longer
|
||||||
- STM32F407VE_black
|
- STM32F407VE_black
|
||||||
- STM32F401VE_STEVAL
|
|
||||||
- BIGTREE_BTT002
|
- BIGTREE_BTT002
|
||||||
- BIGTREE_SKR_PRO
|
- BIGTREE_SKR_PRO
|
||||||
- BIGTREE_GTR_V1_0
|
- BIGTREE_GTR_V1_0
|
||||||
@@ -92,12 +93,17 @@ jobs:
|
|||||||
- rumba32
|
- rumba32
|
||||||
- LERDGEX
|
- LERDGEX
|
||||||
- LERDGEK
|
- LERDGEK
|
||||||
- mks_robin_nano35
|
- mks_robin_nano_v1v2
|
||||||
|
#- mks_robin_nano_v1v2_usbmod
|
||||||
|
#- mks_robin_nano_v1_3_f4_usbmod
|
||||||
- NUCLEO_F767ZI
|
- NUCLEO_F767ZI
|
||||||
- REMRAM_V1
|
- REMRAM_V1
|
||||||
- BTT_SKR_SE_BX
|
- BTT_SKR_SE_BX
|
||||||
- chitu_f103
|
- chitu_f103
|
||||||
- Index_Mobo_Rev03
|
- Opulo_Lumen_REV3
|
||||||
|
|
||||||
|
# ESP32 environments
|
||||||
|
- mks_tinybee
|
||||||
|
|
||||||
# Put lengthy tests last
|
# Put lengthy tests last
|
||||||
|
|
||||||
@@ -137,8 +143,9 @@ jobs:
|
|||||||
|
|
||||||
- name: Install PlatformIO
|
- name: Install PlatformIO
|
||||||
run: |
|
run: |
|
||||||
pip install -U https://github.com/platformio/platformio-core/archive/v5.2.5.zip
|
pip install -U platformio
|
||||||
platformio update
|
pio upgrade --dev
|
||||||
|
pio pkg update --global
|
||||||
|
|
||||||
- name: Run ${{ matrix.test-platform }} Tests
|
- name: Run ${{ matrix.test-platform }} Tests
|
||||||
run: |
|
run: |
|
||||||
|
|||||||
@@ -0,0 +1,22 @@
|
|||||||
|
#
|
||||||
|
# unlock-reopened.yml
|
||||||
|
# Unlock an issue whenever it is re-opened
|
||||||
|
#
|
||||||
|
|
||||||
|
name: "Unlock reopened issue"
|
||||||
|
|
||||||
|
on:
|
||||||
|
issues:
|
||||||
|
types: [reopened]
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
unlock:
|
||||||
|
name: Unlock Reopened
|
||||||
|
if: github.repository == 'MarlinFirmware/Marlin'
|
||||||
|
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- uses: OSDKDev/unlock-issues@v1.1
|
||||||
|
with:
|
||||||
|
repo-token: "${{ secrets.GITHUB_TOKEN }}"
|
||||||
@@ -147,6 +147,7 @@ vc-fileutils.settings
|
|||||||
imgui.ini
|
imgui.ini
|
||||||
eeprom.dat
|
eeprom.dat
|
||||||
spi_flash.bin
|
spi_flash.bin
|
||||||
|
fs.img
|
||||||
|
|
||||||
#cmake
|
#cmake
|
||||||
CMakeLists.txt
|
CMakeLists.txt
|
||||||
|
|||||||
+404
-164
@@ -35,7 +35,7 @@
|
|||||||
*
|
*
|
||||||
* Advanced settings can be found in Configuration_adv.h
|
* Advanced settings can be found in Configuration_adv.h
|
||||||
*/
|
*/
|
||||||
#define CONFIGURATION_H_VERSION 02010000
|
#define CONFIGURATION_H_VERSION 02010200
|
||||||
|
|
||||||
//===========================================================================
|
//===========================================================================
|
||||||
//============================= Getting Started =============================
|
//============================= Getting Started =============================
|
||||||
@@ -57,15 +57,6 @@
|
|||||||
* https://www.thingiverse.com/thing:1278865
|
* https://www.thingiverse.com/thing:1278865
|
||||||
*/
|
*/
|
||||||
|
|
||||||
//===========================================================================
|
|
||||||
//========================== DELTA / SCARA / TPARA ==========================
|
|
||||||
//===========================================================================
|
|
||||||
//
|
|
||||||
// Download configurations from the link above and customize for your machine.
|
|
||||||
// Examples are located in config/examples/delta, .../SCARA, and .../TPARA.
|
|
||||||
//
|
|
||||||
//===========================================================================
|
|
||||||
|
|
||||||
// @section info
|
// @section info
|
||||||
|
|
||||||
// Author info of this build printed to the host during boot and M115
|
// Author info of this build printed to the host during boot and M115
|
||||||
@@ -121,6 +112,7 @@
|
|||||||
* :[2400, 9600, 19200, 38400, 57600, 115200, 250000, 500000, 1000000]
|
* :[2400, 9600, 19200, 38400, 57600, 115200, 250000, 500000, 1000000]
|
||||||
*/
|
*/
|
||||||
#define BAUDRATE 250000
|
#define BAUDRATE 250000
|
||||||
|
|
||||||
//#define BAUD_RATE_GCODE // Enable G-code M575 to set the baud rate
|
//#define BAUD_RATE_GCODE // Enable G-code M575 to set the baud rate
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -129,7 +121,7 @@
|
|||||||
* :[-2, -1, 0, 1, 2, 3, 4, 5, 6, 7]
|
* :[-2, -1, 0, 1, 2, 3, 4, 5, 6, 7]
|
||||||
*/
|
*/
|
||||||
//#define SERIAL_PORT_2 -1
|
//#define SERIAL_PORT_2 -1
|
||||||
//#define BAUDRATE_2 250000 // Enable to override BAUDRATE
|
//#define BAUDRATE_2 250000 // :[2400, 9600, 19200, 38400, 57600, 115200, 250000, 500000, 1000000] Enable to override BAUDRATE
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Select a third serial port on the board to use for communication with the host.
|
* Select a third serial port on the board to use for communication with the host.
|
||||||
@@ -137,7 +129,7 @@
|
|||||||
* :[-1, 0, 1, 2, 3, 4, 5, 6, 7]
|
* :[-1, 0, 1, 2, 3, 4, 5, 6, 7]
|
||||||
*/
|
*/
|
||||||
//#define SERIAL_PORT_3 1
|
//#define SERIAL_PORT_3 1
|
||||||
//#define BAUDRATE_3 250000 // Enable to override BAUDRATE
|
//#define BAUDRATE_3 250000 // :[2400, 9600, 19200, 38400, 57600, 115200, 250000, 500000, 1000000] Enable to override BAUDRATE
|
||||||
|
|
||||||
// Enable the Bluetooth serial interface on AT90USB devices
|
// Enable the Bluetooth serial interface on AT90USB devices
|
||||||
//#define BLUETOOTH
|
//#define BLUETOOTH
|
||||||
@@ -149,21 +141,45 @@
|
|||||||
// Choose your own or use a service like https://www.uuidgenerator.net/version4
|
// Choose your own or use a service like https://www.uuidgenerator.net/version4
|
||||||
//#define MACHINE_UUID "00000000-0000-0000-0000-000000000000"
|
//#define MACHINE_UUID "00000000-0000-0000-0000-000000000000"
|
||||||
|
|
||||||
|
// @section stepper drivers
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Define the number of coordinated axes.
|
* Stepper Drivers
|
||||||
* See https://github.com/DerAndere1/Marlin/wiki
|
|
||||||
* Each axis gets its own stepper control and endstop:
|
|
||||||
*
|
*
|
||||||
* Steppers: *_STEP_PIN, *_ENABLE_PIN, *_DIR_PIN, *_ENABLE_ON
|
* These settings allow Marlin to tune stepper driver timing and enable advanced options for
|
||||||
* Endstops: *_STOP_PIN, USE_*MIN_PLUG, USE_*MAX_PLUG
|
* stepper drivers that support them. You may also override timing options in Configuration_adv.h.
|
||||||
* Axes: *_MIN_POS, *_MAX_POS, INVERT_*_DIR
|
|
||||||
* Planner: DEFAULT_AXIS_STEPS_PER_UNIT, DEFAULT_MAX_FEEDRATE
|
|
||||||
* DEFAULT_MAX_ACCELERATION, AXIS_RELATIVE_MODES,
|
|
||||||
* MICROSTEP_MODES, MANUAL_FEEDRATE
|
|
||||||
*
|
*
|
||||||
* :[3, 4, 5, 6, 7, 8, 9]
|
* Use TMC2208/TMC2208_STANDALONE for TMC2225 drivers and TMC2209/TMC2209_STANDALONE for TMC2226 drivers.
|
||||||
|
*
|
||||||
|
* Options: A4988, A5984, DRV8825, LV8729, TB6560, TB6600, TMC2100,
|
||||||
|
* TMC2130, TMC2130_STANDALONE, TMC2160, TMC2160_STANDALONE,
|
||||||
|
* TMC2208, TMC2208_STANDALONE, TMC2209, TMC2209_STANDALONE,
|
||||||
|
* TMC26X, TMC26X_STANDALONE, TMC2660, TMC2660_STANDALONE,
|
||||||
|
* TMC5130, TMC5130_STANDALONE, TMC5160, TMC5160_STANDALONE
|
||||||
|
* :['A4988', 'A5984', 'DRV8825', 'LV8729', 'TB6560', 'TB6600', 'TMC2100', 'TMC2130', 'TMC2130_STANDALONE', 'TMC2160', 'TMC2160_STANDALONE', 'TMC2208', 'TMC2208_STANDALONE', 'TMC2209', 'TMC2209_STANDALONE', 'TMC26X', 'TMC26X_STANDALONE', 'TMC2660', 'TMC2660_STANDALONE', 'TMC5130', 'TMC5130_STANDALONE', 'TMC5160', 'TMC5160_STANDALONE']
|
||||||
*/
|
*/
|
||||||
//#define NUM_AXES 3
|
#define X_DRIVER_TYPE A4988
|
||||||
|
#define Y_DRIVER_TYPE A4988
|
||||||
|
#define Z_DRIVER_TYPE A4988
|
||||||
|
//#define X2_DRIVER_TYPE A4988
|
||||||
|
//#define Y2_DRIVER_TYPE A4988
|
||||||
|
//#define Z2_DRIVER_TYPE A4988
|
||||||
|
//#define Z3_DRIVER_TYPE A4988
|
||||||
|
//#define Z4_DRIVER_TYPE A4988
|
||||||
|
//#define I_DRIVER_TYPE A4988
|
||||||
|
//#define J_DRIVER_TYPE A4988
|
||||||
|
//#define K_DRIVER_TYPE A4988
|
||||||
|
//#define U_DRIVER_TYPE A4988
|
||||||
|
//#define V_DRIVER_TYPE A4988
|
||||||
|
//#define W_DRIVER_TYPE A4988
|
||||||
|
#define E0_DRIVER_TYPE A4988
|
||||||
|
//#define E1_DRIVER_TYPE A4988
|
||||||
|
//#define E2_DRIVER_TYPE A4988
|
||||||
|
//#define E3_DRIVER_TYPE A4988
|
||||||
|
//#define E4_DRIVER_TYPE A4988
|
||||||
|
//#define E5_DRIVER_TYPE A4988
|
||||||
|
//#define E6_DRIVER_TYPE A4988
|
||||||
|
//#define E7_DRIVER_TYPE A4988
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Additional Axis Settings
|
* Additional Axis Settings
|
||||||
@@ -182,27 +198,27 @@
|
|||||||
*
|
*
|
||||||
* Regardless of these settings the axes are internally named I, J, K, U, V, W.
|
* Regardless of these settings the axes are internally named I, J, K, U, V, W.
|
||||||
*/
|
*/
|
||||||
#if NUM_AXES >= 4
|
#ifdef I_DRIVER_TYPE
|
||||||
#define AXIS4_NAME 'A' // :['A', 'B', 'C', 'U', 'V', 'W']
|
#define AXIS4_NAME 'A' // :['A', 'B', 'C', 'U', 'V', 'W']
|
||||||
#define AXIS4_ROTATES
|
#define AXIS4_ROTATES
|
||||||
#endif
|
#endif
|
||||||
#if NUM_AXES >= 5
|
#ifdef J_DRIVER_TYPE
|
||||||
#define AXIS5_NAME 'B' // :['B', 'C', 'U', 'V', 'W']
|
#define AXIS5_NAME 'B' // :['B', 'C', 'U', 'V', 'W']
|
||||||
#define AXIS5_ROTATES
|
#define AXIS5_ROTATES
|
||||||
#endif
|
#endif
|
||||||
#if NUM_AXES >= 6
|
#ifdef K_DRIVER_TYPE
|
||||||
#define AXIS6_NAME 'C' // :['C', 'U', 'V', 'W']
|
#define AXIS6_NAME 'C' // :['C', 'U', 'V', 'W']
|
||||||
#define AXIS6_ROTATES
|
#define AXIS6_ROTATES
|
||||||
#endif
|
#endif
|
||||||
#if NUM_AXES >= 7
|
#ifdef U_DRIVER_TYPE
|
||||||
#define AXIS7_NAME 'U' // :['U', 'V', 'W']
|
#define AXIS7_NAME 'U' // :['U', 'V', 'W']
|
||||||
//#define AXIS7_ROTATES
|
//#define AXIS7_ROTATES
|
||||||
#endif
|
#endif
|
||||||
#if NUM_AXES >= 8
|
#ifdef V_DRIVER_TYPE
|
||||||
#define AXIS8_NAME 'V' // :['V', 'W']
|
#define AXIS8_NAME 'V' // :['V', 'W']
|
||||||
//#define AXIS8_ROTATES
|
//#define AXIS8_ROTATES
|
||||||
#endif
|
#endif
|
||||||
#if NUM_AXES >= 9
|
#ifdef W_DRIVER_TYPE
|
||||||
#define AXIS9_NAME 'W' // :['W']
|
#define AXIS9_NAME 'W' // :['W']
|
||||||
//#define AXIS9_ROTATES
|
//#define AXIS9_ROTATES
|
||||||
#endif
|
#endif
|
||||||
@@ -226,6 +242,8 @@
|
|||||||
//#define SINGLENOZZLE_STANDBY_FAN
|
//#define SINGLENOZZLE_STANDBY_FAN
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
// @section multi-material
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Multi-Material Unit
|
* Multi-Material Unit
|
||||||
* Set to one of these predefined models:
|
* Set to one of these predefined models:
|
||||||
@@ -238,6 +256,7 @@
|
|||||||
*
|
*
|
||||||
* Requires NOZZLE_PARK_FEATURE to park print head in case MMU unit fails.
|
* Requires NOZZLE_PARK_FEATURE to park print head in case MMU unit fails.
|
||||||
* See additional options in Configuration_adv.h.
|
* See additional options in Configuration_adv.h.
|
||||||
|
* :["PRUSA_MMU1", "PRUSA_MMU2", "PRUSA_MMU2S", "EXTENDABLE_EMU_MMU2", "EXTENDABLE_EMU_MMU2S"]
|
||||||
*/
|
*/
|
||||||
//#define MMU_MODEL PRUSA_MMU2
|
//#define MMU_MODEL PRUSA_MMU2
|
||||||
|
|
||||||
@@ -257,6 +276,7 @@
|
|||||||
#define SWITCHING_NOZZLE_SERVO_NR 0
|
#define SWITCHING_NOZZLE_SERVO_NR 0
|
||||||
//#define SWITCHING_NOZZLE_E1_SERVO_NR 1 // If two servos are used, the index of the second
|
//#define SWITCHING_NOZZLE_E1_SERVO_NR 1 // If two servos are used, the index of the second
|
||||||
#define SWITCHING_NOZZLE_SERVO_ANGLES { 0, 90 } // Angles for E0, E1 (single servo) or lowered/raised (dual servo)
|
#define SWITCHING_NOZZLE_SERVO_ANGLES { 0, 90 } // Angles for E0, E1 (single servo) or lowered/raised (dual servo)
|
||||||
|
#define SWITCHING_NOZZLE_SERVO_DWELL 2500 // Dwell time to wait for servo to make physical move
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -373,7 +393,7 @@
|
|||||||
//#define HOTEND_OFFSET_Y { 0.0, 5.00 } // (mm) relative Y-offset for each nozzle
|
//#define HOTEND_OFFSET_Y { 0.0, 5.00 } // (mm) relative Y-offset for each nozzle
|
||||||
//#define HOTEND_OFFSET_Z { 0.0, 0.00 } // (mm) relative Z-offset for each nozzle
|
//#define HOTEND_OFFSET_Z { 0.0, 0.00 } // (mm) relative Z-offset for each nozzle
|
||||||
|
|
||||||
// @section machine
|
// @section psu control
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Power Supply Control
|
* Power Supply Control
|
||||||
@@ -476,7 +496,7 @@
|
|||||||
* 30 : 100kΩ Kis3d Silicone heating mat 200W/300W with 6mm precision cast plate (EN AW 5083) NTC100K - beta 3950
|
* 30 : 100kΩ Kis3d Silicone heating mat 200W/300W with 6mm precision cast plate (EN AW 5083) NTC100K - beta 3950
|
||||||
* 60 : 100kΩ Maker's Tool Works Kapton Bed Thermistor - beta 3950
|
* 60 : 100kΩ Maker's Tool Works Kapton Bed Thermistor - beta 3950
|
||||||
* 61 : 100kΩ Formbot/Vivedino 350°C Thermistor - beta 3950
|
* 61 : 100kΩ Formbot/Vivedino 350°C Thermistor - beta 3950
|
||||||
* 66 : 4.7MΩ Dyze Design High Temperature Thermistor
|
* 66 : 4.7MΩ Dyze Design / Trianglelab T-D500 500°C High Temperature Thermistor
|
||||||
* 67 : 500kΩ SliceEngineering 450°C Thermistor
|
* 67 : 500kΩ SliceEngineering 450°C Thermistor
|
||||||
* 68 : PT100 amplifier board from Dyze Design
|
* 68 : PT100 amplifier board from Dyze Design
|
||||||
* 70 : 100kΩ bq Hephestos 2
|
* 70 : 100kΩ bq Hephestos 2
|
||||||
@@ -498,6 +518,7 @@
|
|||||||
* 110 : Pt100 with 1kΩ pullup (atypical)
|
* 110 : Pt100 with 1kΩ pullup (atypical)
|
||||||
* 147 : Pt100 with 4.7kΩ pullup
|
* 147 : Pt100 with 4.7kΩ pullup
|
||||||
* 1010 : Pt1000 with 1kΩ pullup (atypical)
|
* 1010 : Pt1000 with 1kΩ pullup (atypical)
|
||||||
|
* 1022 : Pt1000 with 2.2kΩ pullup
|
||||||
* 1047 : Pt1000 with 4.7kΩ pullup (E3D)
|
* 1047 : Pt1000 with 4.7kΩ pullup (E3D)
|
||||||
* 20 : Pt100 with circuit in the Ultimainboard V2.x with mainboard ADC reference voltage = INA826 amplifier-board supply voltage.
|
* 20 : Pt100 with circuit in the Ultimainboard V2.x with mainboard ADC reference voltage = INA826 amplifier-board supply voltage.
|
||||||
* NOTE: (1) Must use an ADC input with no pullup. (2) Some INA826 amplifiers are unreliable at 3.3V so consider using sensor 147, 110, or 21.
|
* NOTE: (1) Must use an ADC input with no pullup. (2) Some INA826 amplifiers are unreliable at 3.3V so consider using sensor 147, 110, or 21.
|
||||||
@@ -535,22 +556,32 @@
|
|||||||
#define DUMMY_THERMISTOR_999_VALUE 100
|
#define DUMMY_THERMISTOR_999_VALUE 100
|
||||||
|
|
||||||
// Resistor values when using MAX31865 sensors (-5) on TEMP_SENSOR_0 / 1
|
// Resistor values when using MAX31865 sensors (-5) on TEMP_SENSOR_0 / 1
|
||||||
//#define MAX31865_SENSOR_OHMS_0 100 // (Ω) Typically 100 or 1000 (PT100 or PT1000)
|
#if TEMP_SENSOR_IS_MAX_TC(0)
|
||||||
//#define MAX31865_CALIBRATION_OHMS_0 430 // (Ω) Typically 430 for Adafruit PT100; 4300 for Adafruit PT1000
|
#define MAX31865_SENSOR_OHMS_0 100 // (Ω) Typically 100 or 1000 (PT100 or PT1000)
|
||||||
//#define MAX31865_SENSOR_OHMS_1 100
|
#define MAX31865_CALIBRATION_OHMS_0 430 // (Ω) Typically 430 for Adafruit PT100; 4300 for Adafruit PT1000
|
||||||
//#define MAX31865_CALIBRATION_OHMS_1 430
|
#endif
|
||||||
|
#if TEMP_SENSOR_IS_MAX_TC(1)
|
||||||
|
#define MAX31865_SENSOR_OHMS_1 100
|
||||||
|
#define MAX31865_CALIBRATION_OHMS_1 430
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if HAS_E_TEMP_SENSOR
|
||||||
#define TEMP_RESIDENCY_TIME 10 // (seconds) Time to wait for hotend to "settle" in M109
|
#define TEMP_RESIDENCY_TIME 10 // (seconds) Time to wait for hotend to "settle" in M109
|
||||||
#define TEMP_WINDOW 1 // (°C) Temperature proximity for the "temperature reached" timer
|
#define TEMP_WINDOW 1 // (°C) Temperature proximity for the "temperature reached" timer
|
||||||
#define TEMP_HYSTERESIS 3 // (°C) Temperature proximity considered "close enough" to the target
|
#define TEMP_HYSTERESIS 3 // (°C) Temperature proximity considered "close enough" to the target
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if TEMP_SENSOR_BED
|
||||||
#define TEMP_BED_RESIDENCY_TIME 10 // (seconds) Time to wait for bed to "settle" in M190
|
#define TEMP_BED_RESIDENCY_TIME 10 // (seconds) Time to wait for bed to "settle" in M190
|
||||||
#define TEMP_BED_WINDOW 1 // (°C) Temperature proximity for the "temperature reached" timer
|
#define TEMP_BED_WINDOW 1 // (°C) Temperature proximity for the "temperature reached" timer
|
||||||
#define TEMP_BED_HYSTERESIS 3 // (°C) Temperature proximity considered "close enough" to the target
|
#define TEMP_BED_HYSTERESIS 3 // (°C) Temperature proximity considered "close enough" to the target
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if TEMP_SENSOR_CHAMBER
|
||||||
#define TEMP_CHAMBER_RESIDENCY_TIME 10 // (seconds) Time to wait for chamber to "settle" in M191
|
#define TEMP_CHAMBER_RESIDENCY_TIME 10 // (seconds) Time to wait for chamber to "settle" in M191
|
||||||
#define TEMP_CHAMBER_WINDOW 1 // (°C) Temperature proximity for the "temperature reached" timer
|
#define TEMP_CHAMBER_WINDOW 1 // (°C) Temperature proximity for the "temperature reached" timer
|
||||||
#define TEMP_CHAMBER_HYSTERESIS 3 // (°C) Temperature proximity considered "close enough" to the target
|
#define TEMP_CHAMBER_HYSTERESIS 3 // (°C) Temperature proximity considered "close enough" to the target
|
||||||
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Redundant Temperature Sensor (TEMP_SENSOR_REDUNDANT)
|
* Redundant Temperature Sensor (TEMP_SENSOR_REDUNDANT)
|
||||||
@@ -609,6 +640,8 @@
|
|||||||
//============================= PID Settings ================================
|
//============================= PID Settings ================================
|
||||||
//===========================================================================
|
//===========================================================================
|
||||||
|
|
||||||
|
// @section hotend temp
|
||||||
|
|
||||||
// Enable PIDTEMP for PID control or MPCTEMP for Predictive Model.
|
// Enable PIDTEMP for PID control or MPCTEMP for Predictive Model.
|
||||||
// temperature control. Disable both for bang-bang heating.
|
// temperature control. Disable both for bang-bang heating.
|
||||||
#define PIDTEMP // See the PID Tuning Guide at https://reprap.org/wiki/PID_Tuning
|
#define PIDTEMP // See the PID Tuning Guide at https://reprap.org/wiki/PID_Tuning
|
||||||
@@ -619,10 +652,9 @@
|
|||||||
#define PID_K1 0.95 // Smoothing factor within any PID loop
|
#define PID_K1 0.95 // Smoothing factor within any PID loop
|
||||||
|
|
||||||
#if ENABLED(PIDTEMP)
|
#if ENABLED(PIDTEMP)
|
||||||
//#define PID_EDIT_MENU // Add PID editing to the "Advanced Settings" menu. (~700 bytes of PROGMEM)
|
//#define PID_DEBUG // Print PID debug data to the serial port. Use 'M303 D' to toggle activation.
|
||||||
//#define PID_AUTOTUNE_MENU // Add PID auto-tuning to the "Advanced Settings" menu. (~250 bytes of PROGMEM)
|
//#define PID_PARAMS_PER_HOTEND // Use separate PID parameters for each extruder (useful for mismatched extruders)
|
||||||
//#define PID_PARAMS_PER_HOTEND // Uses separate PID parameters for each extruder (useful for mismatched extruders)
|
// Set/get with G-code: M301 E[extruder number, 0-2]
|
||||||
// Set/get with gcode: M301 E[extruder number, 0-2]
|
|
||||||
|
|
||||||
#if ENABLED(PID_PARAMS_PER_HOTEND)
|
#if ENABLED(PID_PARAMS_PER_HOTEND)
|
||||||
// Specify up to one value per hotend here, according to your setup.
|
// Specify up to one value per hotend here, according to your setup.
|
||||||
@@ -642,9 +674,13 @@
|
|||||||
*
|
*
|
||||||
* Use a physical model of the hotend to control temperature. When configured correctly
|
* Use a physical model of the hotend to control temperature. When configured correctly
|
||||||
* this gives better responsiveness and stability than PID and it also removes the need
|
* this gives better responsiveness and stability than PID and it also removes the need
|
||||||
* for PID_EXTRUSION_SCALING and PID_FAN_SCALING. Use M306 to autotune the model.
|
* for PID_EXTRUSION_SCALING and PID_FAN_SCALING. Use M306 T to autotune the model.
|
||||||
|
* @section mpctemp
|
||||||
*/
|
*/
|
||||||
#if ENABLED(MPCTEMP)
|
#if ENABLED(MPCTEMP)
|
||||||
|
//#define MPC_EDIT_MENU // Add MPC editing to the "Advanced Settings" menu. (~1300 bytes of flash)
|
||||||
|
//#define MPC_AUTOTUNE_MENU // Add MPC auto-tuning to the "Advanced Settings" menu. (~350 bytes of flash)
|
||||||
|
|
||||||
#define MPC_MAX BANG_MAX // (0..255) Current to nozzle while MPC is active.
|
#define MPC_MAX BANG_MAX // (0..255) Current to nozzle while MPC is active.
|
||||||
#define MPC_HEATER_POWER { 40.0f } // (W) Heat cartridge powers.
|
#define MPC_HEATER_POWER { 40.0f } // (W) Heat cartridge powers.
|
||||||
|
|
||||||
@@ -664,15 +700,16 @@
|
|||||||
//#define MPC_FAN_0_ACTIVE_HOTEND
|
//#define MPC_FAN_0_ACTIVE_HOTEND
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define FILAMENT_HEAT_CAPACITY_PERMM 5.6e-3f // 0.0056 J/K/mm for 1.75mm PLA (0.0149 J/K/mm for 2.85mm PLA).
|
#define FILAMENT_HEAT_CAPACITY_PERMM { 5.6e-3f } // 0.0056 J/K/mm for 1.75mm PLA (0.0149 J/K/mm for 2.85mm PLA).
|
||||||
//#define FILAMENT_HEAT_CAPACITY_PERMM 3.6e-3f // 0.0036 J/K/mm for 1.75mm PETG (0.0094 J/K/mm for 2.85mm PETG).
|
//#define FILAMENT_HEAT_CAPACITY_PERMM { 3.6e-3f } // 0.0036 J/K/mm for 1.75mm PETG (0.0094 J/K/mm for 2.85mm PETG).
|
||||||
|
|
||||||
// Advanced options
|
// Advanced options
|
||||||
#define MPC_SMOOTHING_FACTOR 0.5f // (0.0...1.0) Noisy temperature sensors may need a lower value for stabilization.
|
#define MPC_SMOOTHING_FACTOR 0.5f // (0.0...1.0) Noisy temperature sensors may need a lower value for stabilization.
|
||||||
#define MPC_MIN_AMBIENT_CHANGE 1.0f // (K/s) Modeled ambient temperature rate of change, when correcting model inaccuracies.
|
#define MPC_MIN_AMBIENT_CHANGE 1.0f // (K/s) Modeled ambient temperature rate of change, when correcting model inaccuracies.
|
||||||
#define MPC_STEADYSTATE 0.5f // (K/s) Temperature change rate for steady state logic to be enforced.
|
#define MPC_STEADYSTATE 0.5f // (K/s) Temperature change rate for steady state logic to be enforced.
|
||||||
|
|
||||||
#define MPC_TUNING_POS { X_CENTER, Y_CENTER, 1.0f } // (mm) M306 Autotuning position, ideally bed center just above the surface.
|
#define MPC_TUNING_POS { X_CENTER, Y_CENTER, 1.0f } // (mm) M306 Autotuning position, ideally bed center at first layer height.
|
||||||
|
#define MPC_TUNING_END_Z 10.0f // (mm) M306 Autotuning final Z position.
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
//===========================================================================
|
//===========================================================================
|
||||||
@@ -691,6 +728,7 @@
|
|||||||
* impact FET heating. This also works fine on a Fotek SSR-10DA Solid State Relay into a 250W
|
* impact FET heating. This also works fine on a Fotek SSR-10DA Solid State Relay into a 250W
|
||||||
* heater. If your configuration is significantly different than this and you don't understand
|
* heater. If your configuration is significantly different than this and you don't understand
|
||||||
* the issues involved, don't use bed PID until someone else verifies that your hardware works.
|
* the issues involved, don't use bed PID until someone else verifies that your hardware works.
|
||||||
|
* @section bed temp
|
||||||
*/
|
*/
|
||||||
//#define PIDTEMPBED
|
//#define PIDTEMPBED
|
||||||
|
|
||||||
@@ -706,7 +744,7 @@
|
|||||||
|
|
||||||
#if ENABLED(PIDTEMPBED)
|
#if ENABLED(PIDTEMPBED)
|
||||||
//#define MIN_BED_POWER 0
|
//#define MIN_BED_POWER 0
|
||||||
//#define PID_BED_DEBUG // Sends debug data to the serial port.
|
//#define PID_BED_DEBUG // Print Bed PID debug data to the serial port.
|
||||||
|
|
||||||
// 120V 250W silicone heater into 4mm borosilicate (MendelMax 1.5+)
|
// 120V 250W silicone heater into 4mm borosilicate (MendelMax 1.5+)
|
||||||
// from FOPDT model - kp=.39 Tp=405 Tdead=66, Tc set to 79.2, aggressive factor of .15 (vs .1, 1, 10)
|
// from FOPDT model - kp=.39 Tp=405 Tdead=66, Tc set to 79.2, aggressive factor of .15 (vs .1, 1, 10)
|
||||||
@@ -734,6 +772,7 @@
|
|||||||
* impact FET heating. This also works fine on a Fotek SSR-10DA Solid State Relay into a 200W
|
* impact FET heating. This also works fine on a Fotek SSR-10DA Solid State Relay into a 200W
|
||||||
* heater. If your configuration is significantly different than this and you don't understand
|
* heater. If your configuration is significantly different than this and you don't understand
|
||||||
* the issues involved, don't use chamber PID until someone else verifies that your hardware works.
|
* the issues involved, don't use chamber PID until someone else verifies that your hardware works.
|
||||||
|
* @section chamber temp
|
||||||
*/
|
*/
|
||||||
//#define PIDTEMPCHAMBER
|
//#define PIDTEMPCHAMBER
|
||||||
//#define CHAMBER_LIMIT_SWITCHING
|
//#define CHAMBER_LIMIT_SWITCHING
|
||||||
@@ -748,7 +787,7 @@
|
|||||||
|
|
||||||
#if ENABLED(PIDTEMPCHAMBER)
|
#if ENABLED(PIDTEMPCHAMBER)
|
||||||
#define MIN_CHAMBER_POWER 0
|
#define MIN_CHAMBER_POWER 0
|
||||||
//#define PID_CHAMBER_DEBUG // Sends debug data to the serial port.
|
//#define PID_CHAMBER_DEBUG // Print Chamber PID debug data to the serial port.
|
||||||
|
|
||||||
// Lasko "MyHeat Personal Heater" (200w) modified with a Fotek SSR-10DA to control only the heating element
|
// Lasko "MyHeat Personal Heater" (200w) modified with a Fotek SSR-10DA to control only the heating element
|
||||||
// and placed inside the small Creality printer enclosure tent.
|
// and placed inside the small Creality printer enclosure tent.
|
||||||
@@ -762,14 +801,16 @@
|
|||||||
#endif // PIDTEMPCHAMBER
|
#endif // PIDTEMPCHAMBER
|
||||||
|
|
||||||
#if ANY(PIDTEMP, PIDTEMPBED, PIDTEMPCHAMBER)
|
#if ANY(PIDTEMP, PIDTEMPBED, PIDTEMPCHAMBER)
|
||||||
//#define PID_DEBUG // Sends debug data to the serial port. Use 'M303 D' to toggle activation.
|
|
||||||
//#define PID_OPENLOOP // Puts PID in open loop. M104/M140 sets the output power from 0 to PID_MAX
|
//#define PID_OPENLOOP // Puts PID in open loop. M104/M140 sets the output power from 0 to PID_MAX
|
||||||
//#define SLOW_PWM_HEATERS // PWM with very low frequency (roughly 0.125Hz=8s) and minimum state time of approximately 1s useful for heaters driven by a relay
|
//#define SLOW_PWM_HEATERS // PWM with very low frequency (roughly 0.125Hz=8s) and minimum state time of approximately 1s useful for heaters driven by a relay
|
||||||
#define PID_FUNCTIONAL_RANGE 10 // If the temperature difference between the target temperature and the actual temperature
|
#define PID_FUNCTIONAL_RANGE 10 // If the temperature difference between the target temperature and the actual temperature
|
||||||
// is more than PID_FUNCTIONAL_RANGE then the PID will be shut off and the heater will be set to min/max.
|
// is more than PID_FUNCTIONAL_RANGE then the PID will be shut off and the heater will be set to min/max.
|
||||||
|
|
||||||
|
//#define PID_EDIT_MENU // Add PID editing to the "Advanced Settings" menu. (~700 bytes of flash)
|
||||||
|
//#define PID_AUTOTUNE_MENU // Add PID auto-tuning to the "Advanced Settings" menu. (~250 bytes of flash)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// @section extruder
|
// @section safety
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Prevent extrusion if the temperature is below EXTRUDE_MINTEMP.
|
* Prevent extrusion if the temperature is below EXTRUDE_MINTEMP.
|
||||||
@@ -837,11 +878,154 @@
|
|||||||
#define POLAR_SEGMENTS_PER_SECOND 5
|
#define POLAR_SEGMENTS_PER_SECOND 5
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
// @section delta
|
||||||
|
|
||||||
|
// Enable for DELTA kinematics and configure below
|
||||||
|
//#define DELTA
|
||||||
|
#if ENABLED(DELTA)
|
||||||
|
|
||||||
|
// Make delta curves from many straight lines (linear interpolation).
|
||||||
|
// This is a trade-off between visible corners (not enough segments)
|
||||||
|
// and processor overload (too many expensive sqrt calls).
|
||||||
|
#define DELTA_SEGMENTS_PER_SECOND 200
|
||||||
|
|
||||||
|
// After homing move down to a height where XY movement is unconstrained
|
||||||
|
//#define DELTA_HOME_TO_SAFE_ZONE
|
||||||
|
|
||||||
|
// Delta calibration menu
|
||||||
|
// uncomment to add three points calibration menu option.
|
||||||
|
// See http://minow.blogspot.com/index.html#4918805519571907051
|
||||||
|
//#define DELTA_CALIBRATION_MENU
|
||||||
|
|
||||||
|
// uncomment to add G33 Delta Auto-Calibration (Enable EEPROM_SETTINGS to store results)
|
||||||
|
//#define DELTA_AUTO_CALIBRATION
|
||||||
|
|
||||||
|
// NOTE NB all values for DELTA_* values MUST be floating point, so always have a decimal point in them
|
||||||
|
|
||||||
|
#if ENABLED(DELTA_AUTO_CALIBRATION)
|
||||||
|
// set the default number of probe points : n*n (1 -> 7)
|
||||||
|
#define DELTA_CALIBRATION_DEFAULT_POINTS 4
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if EITHER(DELTA_AUTO_CALIBRATION, DELTA_CALIBRATION_MENU)
|
||||||
|
// Set the steprate for papertest probing
|
||||||
|
#define PROBE_MANUALLY_STEP 0.05 // (mm)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// Print surface diameter/2 minus unreachable space (avoid collisions with vertical towers).
|
||||||
|
#define DELTA_PRINTABLE_RADIUS 140.0 // (mm)
|
||||||
|
|
||||||
|
// Maximum reachable area
|
||||||
|
#define DELTA_MAX_RADIUS 140.0 // (mm)
|
||||||
|
|
||||||
|
// Center-to-center distance of the holes in the diagonal push rods.
|
||||||
|
#define DELTA_DIAGONAL_ROD 250.0 // (mm)
|
||||||
|
|
||||||
|
// Distance between bed and nozzle Z home position
|
||||||
|
#define DELTA_HEIGHT 250.00 // (mm) Get this value from G33 auto calibrate
|
||||||
|
|
||||||
|
#define DELTA_ENDSTOP_ADJ { 0.0, 0.0, 0.0 } // Get these values from G33 auto calibrate
|
||||||
|
|
||||||
|
// Horizontal distance bridged by diagonal push rods when effector is centered.
|
||||||
|
#define DELTA_RADIUS 124.0 // (mm) Get this value from G33 auto calibrate
|
||||||
|
|
||||||
|
// Trim adjustments for individual towers
|
||||||
|
// tower angle corrections for X and Y tower / rotate XYZ so Z tower angle = 0
|
||||||
|
// measured in degrees anticlockwise looking from above the printer
|
||||||
|
#define DELTA_TOWER_ANGLE_TRIM { 0.0, 0.0, 0.0 } // Get these values from G33 auto calibrate
|
||||||
|
|
||||||
|
// Delta radius and diagonal rod adjustments (mm)
|
||||||
|
//#define DELTA_RADIUS_TRIM_TOWER { 0.0, 0.0, 0.0 }
|
||||||
|
//#define DELTA_DIAGONAL_ROD_TRIM_TOWER { 0.0, 0.0, 0.0 }
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// @section scara
|
||||||
|
|
||||||
|
/**
|
||||||
|
* MORGAN_SCARA was developed by QHARLEY in South Africa in 2012-2013.
|
||||||
|
* Implemented and slightly reworked by JCERNY in June, 2014.
|
||||||
|
*
|
||||||
|
* Mostly Printed SCARA is an open source design by Tyler Williams. See:
|
||||||
|
* https://www.thingiverse.com/thing:2487048
|
||||||
|
* https://www.thingiverse.com/thing:1241491
|
||||||
|
*/
|
||||||
|
//#define MORGAN_SCARA
|
||||||
|
//#define MP_SCARA
|
||||||
|
#if EITHER(MORGAN_SCARA, MP_SCARA)
|
||||||
|
// If movement is choppy try lowering this value
|
||||||
|
#define SCARA_SEGMENTS_PER_SECOND 200
|
||||||
|
|
||||||
|
// Length of inner and outer support arms. Measure arm lengths precisely.
|
||||||
|
#define SCARA_LINKAGE_1 150 // (mm)
|
||||||
|
#define SCARA_LINKAGE_2 150 // (mm)
|
||||||
|
|
||||||
|
// SCARA tower offset (position of Tower relative to bed zero position)
|
||||||
|
// This needs to be reasonably accurate as it defines the printbed position in the SCARA space.
|
||||||
|
#define SCARA_OFFSET_X 100 // (mm)
|
||||||
|
#define SCARA_OFFSET_Y -56 // (mm)
|
||||||
|
|
||||||
|
#if ENABLED(MORGAN_SCARA)
|
||||||
|
|
||||||
|
//#define DEBUG_SCARA_KINEMATICS
|
||||||
|
#define SCARA_FEEDRATE_SCALING // Convert XY feedrate from mm/s to degrees/s on the fly
|
||||||
|
|
||||||
|
// Radius around the center where the arm cannot reach
|
||||||
|
#define MIDDLE_DEAD_ZONE_R 0 // (mm)
|
||||||
|
|
||||||
|
#define THETA_HOMING_OFFSET 0 // Calculated from Calibration Guide and M360 / M114. See http://reprap.harleystudio.co.za/?page_id=1073
|
||||||
|
#define PSI_HOMING_OFFSET 0 // Calculated from Calibration Guide and M364 / M114. See http://reprap.harleystudio.co.za/?page_id=1073
|
||||||
|
|
||||||
|
#elif ENABLED(MP_SCARA)
|
||||||
|
|
||||||
|
#define SCARA_OFFSET_THETA1 12 // degrees
|
||||||
|
#define SCARA_OFFSET_THETA2 131 // degrees
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// @section tpara
|
||||||
|
|
||||||
|
// Enable for TPARA kinematics and configure below
|
||||||
|
//#define AXEL_TPARA
|
||||||
|
#if ENABLED(AXEL_TPARA)
|
||||||
|
#define DEBUG_ROBOT_KINEMATICS
|
||||||
|
#define ROBOT_SEGMENTS_PER_SECOND 200
|
||||||
|
|
||||||
|
// Length of inner and outer support arms. Measure arm lengths precisely.
|
||||||
|
#define ROBOT_LINKAGE_1 120 // (mm)
|
||||||
|
#define ROBOT_LINKAGE_2 120 // (mm)
|
||||||
|
|
||||||
|
// SCARA tower offset (position of Tower relative to bed zero position)
|
||||||
|
// This needs to be reasonably accurate as it defines the printbed position in the SCARA space.
|
||||||
|
#define ROBOT_OFFSET_X 0 // (mm)
|
||||||
|
#define ROBOT_OFFSET_Y 0 // (mm)
|
||||||
|
#define ROBOT_OFFSET_Z 0 // (mm)
|
||||||
|
|
||||||
|
#define SCARA_FEEDRATE_SCALING // Convert XY feedrate from mm/s to degrees/s on the fly
|
||||||
|
|
||||||
|
// Radius around the center where the arm cannot reach
|
||||||
|
#define MIDDLE_DEAD_ZONE_R 0 // (mm)
|
||||||
|
|
||||||
|
// Calculated from Calibration Guide and M360 / M114. See http://reprap.harleystudio.co.za/?page_id=1073
|
||||||
|
#define THETA_HOMING_OFFSET 0
|
||||||
|
#define PSI_HOMING_OFFSET 0
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// @section machine
|
||||||
|
|
||||||
|
// Articulated robot (arm). Joints are directly mapped to axes with no kinematics.
|
||||||
|
//#define ARTICULATED_ROBOT_ARM
|
||||||
|
|
||||||
|
// For a hot wire cutter with parallel horizontal axes (X, I) where the heights of the two wire
|
||||||
|
// ends are controlled by parallel axes (Y, J). Joints are directly mapped to axes (no kinematics).
|
||||||
|
//#define FOAMCUTTER_XYUV
|
||||||
|
|
||||||
//===========================================================================
|
//===========================================================================
|
||||||
//============================== Endstop Settings ===========================
|
//============================== Endstop Settings ===========================
|
||||||
//===========================================================================
|
//===========================================================================
|
||||||
|
|
||||||
// @section homing
|
// @section endstops
|
||||||
|
|
||||||
// Specify here all the endstop connectors that are connected to any endstop or probe.
|
// Specify here all the endstop connectors that are connected to any endstop or probe.
|
||||||
// Almost all printers will be using one per axis. Probes will use one or more of the
|
// Almost all printers will be using one per axis. Probes will use one or more of the
|
||||||
@@ -936,47 +1120,6 @@
|
|||||||
#define W_MAX_ENDSTOP_INVERTING false // Set to true to invert the logic of the endstop.
|
#define W_MAX_ENDSTOP_INVERTING false // Set to true to invert the logic of the endstop.
|
||||||
#define Z_MIN_PROBE_ENDSTOP_INVERTING false // Set to true to invert the logic of the probe.
|
#define Z_MIN_PROBE_ENDSTOP_INVERTING false // Set to true to invert the logic of the probe.
|
||||||
|
|
||||||
/**
|
|
||||||
* Stepper Drivers
|
|
||||||
*
|
|
||||||
* These settings allow Marlin to tune stepper driver timing and enable advanced options for
|
|
||||||
* stepper drivers that support them. You may also override timing options in Configuration_adv.h.
|
|
||||||
*
|
|
||||||
* A4988 is assumed for unspecified drivers.
|
|
||||||
*
|
|
||||||
* Use TMC2208/TMC2208_STANDALONE for TMC2225 drivers and TMC2209/TMC2209_STANDALONE for TMC2226 drivers.
|
|
||||||
*
|
|
||||||
* Options: A4988, A5984, DRV8825, LV8729, L6470, L6474, POWERSTEP01,
|
|
||||||
* TB6560, TB6600, TMC2100,
|
|
||||||
* TMC2130, TMC2130_STANDALONE, TMC2160, TMC2160_STANDALONE,
|
|
||||||
* TMC2208, TMC2208_STANDALONE, TMC2209, TMC2209_STANDALONE,
|
|
||||||
* TMC26X, TMC26X_STANDALONE, TMC2660, TMC2660_STANDALONE,
|
|
||||||
* TMC5130, TMC5130_STANDALONE, TMC5160, TMC5160_STANDALONE
|
|
||||||
* :['A4988', 'A5984', 'DRV8825', 'LV8729', 'L6470', 'L6474', 'POWERSTEP01', 'TB6560', 'TB6600', 'TMC2100', 'TMC2130', 'TMC2130_STANDALONE', 'TMC2160', 'TMC2160_STANDALONE', 'TMC2208', 'TMC2208_STANDALONE', 'TMC2209', 'TMC2209_STANDALONE', 'TMC26X', 'TMC26X_STANDALONE', 'TMC2660', 'TMC2660_STANDALONE', 'TMC5130', 'TMC5130_STANDALONE', 'TMC5160', 'TMC5160_STANDALONE']
|
|
||||||
*/
|
|
||||||
#define X_DRIVER_TYPE A4988
|
|
||||||
#define Y_DRIVER_TYPE A4988
|
|
||||||
#define Z_DRIVER_TYPE A4988
|
|
||||||
//#define X2_DRIVER_TYPE A4988
|
|
||||||
//#define Y2_DRIVER_TYPE A4988
|
|
||||||
//#define Z2_DRIVER_TYPE A4988
|
|
||||||
//#define Z3_DRIVER_TYPE A4988
|
|
||||||
//#define Z4_DRIVER_TYPE A4988
|
|
||||||
//#define I_DRIVER_TYPE A4988
|
|
||||||
//#define J_DRIVER_TYPE A4988
|
|
||||||
//#define K_DRIVER_TYPE A4988
|
|
||||||
//#define U_DRIVER_TYPE A4988
|
|
||||||
//#define V_DRIVER_TYPE A4988
|
|
||||||
//#define W_DRIVER_TYPE A4988
|
|
||||||
#define E0_DRIVER_TYPE A4988
|
|
||||||
//#define E1_DRIVER_TYPE A4988
|
|
||||||
//#define E2_DRIVER_TYPE A4988
|
|
||||||
//#define E3_DRIVER_TYPE A4988
|
|
||||||
//#define E4_DRIVER_TYPE A4988
|
|
||||||
//#define E5_DRIVER_TYPE A4988
|
|
||||||
//#define E6_DRIVER_TYPE A4988
|
|
||||||
//#define E7_DRIVER_TYPE A4988
|
|
||||||
|
|
||||||
// Enable this feature if all enabled endstop pins are interrupt-capable.
|
// Enable this feature if all enabled endstop pins are interrupt-capable.
|
||||||
// This will remove the need to poll the interrupt pins, saving many CPU cycles.
|
// This will remove the need to poll the interrupt pins, saving many CPU cycles.
|
||||||
//#define ENDSTOP_INTERRUPTS_FEATURE
|
//#define ENDSTOP_INTERRUPTS_FEATURE
|
||||||
@@ -1230,6 +1373,27 @@
|
|||||||
#define Z_PROBE_RETRACT_X X_MAX_POS
|
#define Z_PROBE_RETRACT_X X_MAX_POS
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Magnetically Mounted Probe
|
||||||
|
* For probes such as Euclid, Klicky, Klackender, etc.
|
||||||
|
*/
|
||||||
|
//#define MAG_MOUNTED_PROBE
|
||||||
|
#if ENABLED(MAG_MOUNTED_PROBE)
|
||||||
|
#define PROBE_DEPLOY_FEEDRATE (133*60) // (mm/min) Probe deploy speed
|
||||||
|
#define PROBE_STOW_FEEDRATE (133*60) // (mm/min) Probe stow speed
|
||||||
|
|
||||||
|
#define MAG_MOUNTED_DEPLOY_1 { PROBE_DEPLOY_FEEDRATE, { 245, 114, 30 } } // Move to side Dock & Attach probe
|
||||||
|
#define MAG_MOUNTED_DEPLOY_2 { PROBE_DEPLOY_FEEDRATE, { 210, 114, 30 } } // Move probe off dock
|
||||||
|
#define MAG_MOUNTED_DEPLOY_3 { PROBE_DEPLOY_FEEDRATE, { 0, 0, 0 } } // Extra move if needed
|
||||||
|
#define MAG_MOUNTED_DEPLOY_4 { PROBE_DEPLOY_FEEDRATE, { 0, 0, 0 } } // Extra move if needed
|
||||||
|
#define MAG_MOUNTED_DEPLOY_5 { PROBE_DEPLOY_FEEDRATE, { 0, 0, 0 } } // Extra move if needed
|
||||||
|
#define MAG_MOUNTED_STOW_1 { PROBE_STOW_FEEDRATE, { 245, 114, 20 } } // Move to dock
|
||||||
|
#define MAG_MOUNTED_STOW_2 { PROBE_STOW_FEEDRATE, { 245, 114, 0 } } // Place probe beside remover
|
||||||
|
#define MAG_MOUNTED_STOW_3 { PROBE_STOW_FEEDRATE, { 230, 114, 0 } } // Side move to remove probe
|
||||||
|
#define MAG_MOUNTED_STOW_4 { PROBE_STOW_FEEDRATE, { 210, 114, 20 } } // Side move to remove probe
|
||||||
|
#define MAG_MOUNTED_STOW_5 { PROBE_STOW_FEEDRATE, { 0, 0, 0 } } // Extra move if needed
|
||||||
|
#endif
|
||||||
|
|
||||||
// Duet Smart Effector (for delta printers) - https://bit.ly/2ul5U7J
|
// Duet Smart Effector (for delta printers) - https://bit.ly/2ul5U7J
|
||||||
// When the pin is defined you can use M672 to set/reset the probe sensitivity.
|
// When the pin is defined you can use M672 to set/reset the probe sensitivity.
|
||||||
//#define DUET_SMART_EFFECTOR
|
//#define DUET_SMART_EFFECTOR
|
||||||
@@ -1245,9 +1409,37 @@
|
|||||||
*/
|
*/
|
||||||
//#define SENSORLESS_PROBING
|
//#define SENSORLESS_PROBING
|
||||||
|
|
||||||
//
|
/**
|
||||||
// For Z_PROBE_ALLEN_KEY see the Delta example configurations.
|
* Allen key retractable z-probe as seen on many Kossel delta printers - https://reprap.org/wiki/Kossel#Automatic_bed_leveling_probe
|
||||||
//
|
* Deploys by touching z-axis belt. Retracts by pushing the probe down.
|
||||||
|
*/
|
||||||
|
//#define Z_PROBE_ALLEN_KEY
|
||||||
|
#if ENABLED(Z_PROBE_ALLEN_KEY)
|
||||||
|
// 2 or 3 sets of coordinates for deploying and retracting the spring loaded touch probe on G29,
|
||||||
|
// if servo actuated touch probe is not defined. Uncomment as appropriate for your printer/probe.
|
||||||
|
|
||||||
|
#define Z_PROBE_ALLEN_KEY_DEPLOY_1 { 30.0, DELTA_PRINTABLE_RADIUS, 100.0 }
|
||||||
|
#define Z_PROBE_ALLEN_KEY_DEPLOY_1_FEEDRATE XY_PROBE_FEEDRATE
|
||||||
|
|
||||||
|
#define Z_PROBE_ALLEN_KEY_DEPLOY_2 { 0.0, DELTA_PRINTABLE_RADIUS, 100.0 }
|
||||||
|
#define Z_PROBE_ALLEN_KEY_DEPLOY_2_FEEDRATE (XY_PROBE_FEEDRATE)/10
|
||||||
|
|
||||||
|
#define Z_PROBE_ALLEN_KEY_DEPLOY_3 { 0.0, (DELTA_PRINTABLE_RADIUS) * 0.75, 100.0 }
|
||||||
|
#define Z_PROBE_ALLEN_KEY_DEPLOY_3_FEEDRATE XY_PROBE_FEEDRATE
|
||||||
|
|
||||||
|
#define Z_PROBE_ALLEN_KEY_STOW_1 { -64.0, 56.0, 23.0 } // Move the probe into position
|
||||||
|
#define Z_PROBE_ALLEN_KEY_STOW_1_FEEDRATE XY_PROBE_FEEDRATE
|
||||||
|
|
||||||
|
#define Z_PROBE_ALLEN_KEY_STOW_2 { -64.0, 56.0, 3.0 } // Push it down
|
||||||
|
#define Z_PROBE_ALLEN_KEY_STOW_2_FEEDRATE (XY_PROBE_FEEDRATE)/10
|
||||||
|
|
||||||
|
#define Z_PROBE_ALLEN_KEY_STOW_3 { -64.0, 56.0, 50.0 } // Move it up to clear
|
||||||
|
#define Z_PROBE_ALLEN_KEY_STOW_3_FEEDRATE XY_PROBE_FEEDRATE
|
||||||
|
|
||||||
|
#define Z_PROBE_ALLEN_KEY_STOW_4 { 0.0, 0.0, 50.0 }
|
||||||
|
#define Z_PROBE_ALLEN_KEY_STOW_4_FEEDRATE XY_PROBE_FEEDRATE
|
||||||
|
|
||||||
|
#endif // Z_PROBE_ALLEN_KEY
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Nozzle-to-Probe offsets { X, Y, Z }
|
* Nozzle-to-Probe offsets { X, Y, Z }
|
||||||
@@ -1443,7 +1635,7 @@
|
|||||||
#define DISABLE_E false // Disable the extruder when not stepping
|
#define DISABLE_E false // Disable the extruder when not stepping
|
||||||
#define DISABLE_INACTIVE_EXTRUDER // Keep only the active extruder enabled
|
#define DISABLE_INACTIVE_EXTRUDER // Keep only the active extruder enabled
|
||||||
|
|
||||||
// @section machine
|
// @section motion
|
||||||
|
|
||||||
// Invert the stepper direction. Change (or reverse the motor connector) if an axis goes the wrong way.
|
// Invert the stepper direction. Change (or reverse the motor connector) if an axis goes the wrong way.
|
||||||
#define INVERT_X_DIR false
|
#define INVERT_X_DIR false
|
||||||
@@ -1497,7 +1689,7 @@
|
|||||||
//#define V_HOME_DIR -1
|
//#define V_HOME_DIR -1
|
||||||
//#define W_HOME_DIR -1
|
//#define W_HOME_DIR -1
|
||||||
|
|
||||||
// @section machine
|
// @section geometry
|
||||||
|
|
||||||
// The size of the printable area
|
// The size of the printable area
|
||||||
#define X_BED_SIZE 200
|
#define X_BED_SIZE 200
|
||||||
@@ -1700,6 +1892,15 @@
|
|||||||
#define LEVELING_BED_TEMP 50
|
#define LEVELING_BED_TEMP 50
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Bed Distance Sensor
|
||||||
|
*
|
||||||
|
* Measures the distance from bed to nozzle with accuracy of 0.01mm.
|
||||||
|
* For information about this sensor https://github.com/markniu/Bed_Distance_sensor
|
||||||
|
* Uses I2C port, so it requires I2C library markyue/Panda_SoftMasterI2C.
|
||||||
|
*/
|
||||||
|
//#define BD_SENSOR
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Enable detailed logging of G28, G29, M48, etc.
|
* Enable detailed logging of G28, G29, M48, etc.
|
||||||
* Turn on with the command 'M111 S32'.
|
* Turn on with the command 'M111 S32'.
|
||||||
@@ -1819,18 +2020,18 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Add a menu item to move between bed corners for manual bed adjustment
|
// Add a menu item to move between bed corners for manual bed adjustment
|
||||||
//#define LEVEL_BED_CORNERS
|
//#define LCD_BED_TRAMMING
|
||||||
|
|
||||||
#if ENABLED(LEVEL_BED_CORNERS)
|
#if ENABLED(LCD_BED_TRAMMING)
|
||||||
#define LEVEL_CORNERS_INSET_LFRB { 30, 30, 30, 30 } // (mm) Left, Front, Right, Back insets
|
#define BED_TRAMMING_INSET_LFRB { 30, 30, 30, 30 } // (mm) Left, Front, Right, Back insets
|
||||||
#define LEVEL_CORNERS_HEIGHT 0.0 // (mm) Z height of nozzle at leveling points
|
#define BED_TRAMMING_HEIGHT 0.0 // (mm) Z height of nozzle at leveling points
|
||||||
#define LEVEL_CORNERS_Z_HOP 4.0 // (mm) Z height of nozzle between leveling points
|
#define BED_TRAMMING_Z_HOP 4.0 // (mm) Z height of nozzle between leveling points
|
||||||
//#define LEVEL_CENTER_TOO // Move to the center after the last corner
|
//#define BED_TRAMMING_INCLUDE_CENTER // Move to the center after the last corner
|
||||||
//#define LEVEL_CORNERS_USE_PROBE
|
//#define BED_TRAMMING_USE_PROBE
|
||||||
#if ENABLED(LEVEL_CORNERS_USE_PROBE)
|
#if ENABLED(BED_TRAMMING_USE_PROBE)
|
||||||
#define LEVEL_CORNERS_PROBE_TOLERANCE 0.1
|
#define BED_TRAMMING_PROBE_TOLERANCE 0.1 // (mm)
|
||||||
#define LEVEL_CORNERS_VERIFY_RAISED // After adjustment triggers the probe, re-probe to verify
|
#define BED_TRAMMING_VERIFY_RAISED // After adjustment triggers the probe, re-probe to verify
|
||||||
//#define LEVEL_CORNERS_AUDIO_FEEDBACK
|
//#define BED_TRAMMING_AUDIO_FEEDBACK
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -1850,7 +2051,7 @@
|
|||||||
* | 1 2 | | 1 4 | | 1 2 | | 2 |
|
* | 1 2 | | 1 4 | | 1 2 | | 2 |
|
||||||
* LF --------- RF LF --------- RF LF --------- RF LF --------- RF
|
* LF --------- RF LF --------- RF LF --------- RF LF --------- RF
|
||||||
*/
|
*/
|
||||||
#define LEVEL_CORNERS_LEVELING_ORDER { LF, RF, RB, LB }
|
#define BED_TRAMMING_LEVELING_ORDER { LF, RF, RB, LB }
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -1934,9 +2135,8 @@
|
|||||||
#define XY_DIAG_BD 282.8427124746
|
#define XY_DIAG_BD 282.8427124746
|
||||||
#define XY_SIDE_AD 200
|
#define XY_SIDE_AD 200
|
||||||
|
|
||||||
// Or, set the default skew factors directly here
|
// Or, set the XY skew factor directly:
|
||||||
// to override the above measurements:
|
//#define XY_SKEW_FACTOR 0.0
|
||||||
#define XY_SKEW_FACTOR 0.0
|
|
||||||
|
|
||||||
//#define SKEW_CORRECTION_FOR_Z
|
//#define SKEW_CORRECTION_FOR_Z
|
||||||
#if ENABLED(SKEW_CORRECTION_FOR_Z)
|
#if ENABLED(SKEW_CORRECTION_FOR_Z)
|
||||||
@@ -1945,8 +2145,10 @@
|
|||||||
#define YZ_DIAG_AC 282.8427124746
|
#define YZ_DIAG_AC 282.8427124746
|
||||||
#define YZ_DIAG_BD 282.8427124746
|
#define YZ_DIAG_BD 282.8427124746
|
||||||
#define YZ_SIDE_AD 200
|
#define YZ_SIDE_AD 200
|
||||||
#define XZ_SKEW_FACTOR 0.0
|
|
||||||
#define YZ_SKEW_FACTOR 0.0
|
// Or, set the Z skew factors directly:
|
||||||
|
//#define XZ_SKEW_FACTOR 0.0
|
||||||
|
//#define YZ_SKEW_FACTOR 0.0
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Enable this option for M852 to set skew at runtime
|
// Enable this option for M852 to set skew at runtime
|
||||||
@@ -1957,7 +2159,7 @@
|
|||||||
//============================= Additional Features ===========================
|
//============================= Additional Features ===========================
|
||||||
//=============================================================================
|
//=============================================================================
|
||||||
|
|
||||||
// @section extras
|
// @section eeprom
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* EEPROM
|
* EEPROM
|
||||||
@@ -1969,7 +2171,7 @@
|
|||||||
* M502 - Revert settings to "factory" defaults. (Follow with M500 to init the EEPROM.)
|
* M502 - Revert settings to "factory" defaults. (Follow with M500 to init the EEPROM.)
|
||||||
*/
|
*/
|
||||||
//#define EEPROM_SETTINGS // Persistent storage with M500 and M501
|
//#define EEPROM_SETTINGS // Persistent storage with M500 and M501
|
||||||
//#define DISABLE_M503 // Saves ~2700 bytes of PROGMEM. Disable for release!
|
//#define DISABLE_M503 // Saves ~2700 bytes of flash. Disable for release!
|
||||||
#define EEPROM_CHITCHAT // Give feedback on EEPROM commands. Disable to save PROGMEM.
|
#define EEPROM_CHITCHAT // Give feedback on EEPROM commands. Disable to save PROGMEM.
|
||||||
#define EEPROM_BOOT_SILENT // Keep M503 quiet and only give errors during first load
|
#define EEPROM_BOOT_SILENT // Keep M503 quiet and only give errors during first load
|
||||||
#if ENABLED(EEPROM_SETTINGS)
|
#if ENABLED(EEPROM_SETTINGS)
|
||||||
@@ -1977,6 +2179,8 @@
|
|||||||
//#define EEPROM_INIT_NOW // Init EEPROM on first boot after a new build.
|
//#define EEPROM_INIT_NOW // Init EEPROM on first boot after a new build.
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
// @section host
|
||||||
|
|
||||||
//
|
//
|
||||||
// Host Keepalive
|
// Host Keepalive
|
||||||
//
|
//
|
||||||
@@ -1987,6 +2191,8 @@
|
|||||||
#define DEFAULT_KEEPALIVE_INTERVAL 2 // Number of seconds between "busy" messages. Set with M113.
|
#define DEFAULT_KEEPALIVE_INTERVAL 2 // Number of seconds between "busy" messages. Set with M113.
|
||||||
#define BUSY_WHILE_HEATING // Some hosts require "busy" messages even during heating
|
#define BUSY_WHILE_HEATING // Some hosts require "busy" messages even during heating
|
||||||
|
|
||||||
|
// @section units
|
||||||
|
|
||||||
//
|
//
|
||||||
// G20/G21 Inch mode support
|
// G20/G21 Inch mode support
|
||||||
//
|
//
|
||||||
@@ -2000,7 +2206,7 @@
|
|||||||
// @section temperature
|
// @section temperature
|
||||||
|
|
||||||
//
|
//
|
||||||
// Preheat Constants - Up to 5 are supported without changes
|
// Preheat Constants - Up to 10 are supported without changes
|
||||||
//
|
//
|
||||||
#define PREHEAT_1_LABEL "PLA"
|
#define PREHEAT_1_LABEL "PLA"
|
||||||
#define PREHEAT_1_TEMP_HOTEND 180
|
#define PREHEAT_1_TEMP_HOTEND 180
|
||||||
@@ -2014,6 +2220,8 @@
|
|||||||
#define PREHEAT_2_TEMP_CHAMBER 35
|
#define PREHEAT_2_TEMP_CHAMBER 35
|
||||||
#define PREHEAT_2_FAN_SPEED 0 // Value from 0 to 255
|
#define PREHEAT_2_FAN_SPEED 0 // Value from 0 to 255
|
||||||
|
|
||||||
|
// @section motion
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Nozzle Park
|
* Nozzle Park
|
||||||
*
|
*
|
||||||
@@ -2112,6 +2320,8 @@
|
|||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
// @section host
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Print Job Timer
|
* Print Job Timer
|
||||||
*
|
*
|
||||||
@@ -2138,6 +2348,8 @@
|
|||||||
*/
|
*/
|
||||||
#define PRINTJOB_TIMER_AUTOSTART
|
#define PRINTJOB_TIMER_AUTOSTART
|
||||||
|
|
||||||
|
// @section stats
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Print Counter
|
* Print Counter
|
||||||
*
|
*
|
||||||
@@ -2152,9 +2364,11 @@
|
|||||||
*/
|
*/
|
||||||
//#define PRINTCOUNTER
|
//#define PRINTCOUNTER
|
||||||
#if ENABLED(PRINTCOUNTER)
|
#if ENABLED(PRINTCOUNTER)
|
||||||
#define PRINTCOUNTER_SAVE_INTERVAL 60 // (minutes) EEPROM save interval during print
|
#define PRINTCOUNTER_SAVE_INTERVAL 60 // (minutes) EEPROM save interval during print. A value of 0 will save stats at end of print.
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
// @section security
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Password
|
* Password
|
||||||
*
|
*
|
||||||
@@ -2190,7 +2404,7 @@
|
|||||||
//============================= LCD and SD support ============================
|
//============================= LCD and SD support ============================
|
||||||
//=============================================================================
|
//=============================================================================
|
||||||
|
|
||||||
// @section lcd
|
// @section interface
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* LCD LANGUAGE
|
* LCD LANGUAGE
|
||||||
@@ -2306,6 +2520,16 @@
|
|||||||
//
|
//
|
||||||
//#define REVERSE_SELECT_DIRECTION
|
//#define REVERSE_SELECT_DIRECTION
|
||||||
|
|
||||||
|
//
|
||||||
|
// Encoder EMI Noise Filter
|
||||||
|
//
|
||||||
|
// This option increases encoder samples to filter out phantom encoder clicks caused by EMI noise.
|
||||||
|
//
|
||||||
|
//#define ENCODER_NOISE_FILTER
|
||||||
|
#if ENABLED(ENCODER_NOISE_FILTER)
|
||||||
|
#define ENCODER_SAMPLES 10
|
||||||
|
#endif
|
||||||
|
|
||||||
//
|
//
|
||||||
// Individual Axis Homing
|
// Individual Axis Homing
|
||||||
//
|
//
|
||||||
@@ -2336,6 +2560,7 @@
|
|||||||
//======================== LCD / Controller Selection =========================
|
//======================== LCD / Controller Selection =========================
|
||||||
//======================== (Character-based LCDs) =========================
|
//======================== (Character-based LCDs) =========================
|
||||||
//=============================================================================
|
//=============================================================================
|
||||||
|
// @section lcd
|
||||||
|
|
||||||
//
|
//
|
||||||
// RepRapDiscount Smart Controller.
|
// RepRapDiscount Smart Controller.
|
||||||
@@ -2637,6 +2862,12 @@
|
|||||||
//
|
//
|
||||||
//#define SILVER_GATE_GLCD_CONTROLLER
|
//#define SILVER_GATE_GLCD_CONTROLLER
|
||||||
|
|
||||||
|
//
|
||||||
|
// eMotion Tech LCD with SD
|
||||||
|
// https://www.reprap-france.com/produit/1234568748-ecran-graphique-128-x-64-points-2-1
|
||||||
|
//
|
||||||
|
//#define EMOTION_TECH_LCD
|
||||||
|
|
||||||
//=============================================================================
|
//=============================================================================
|
||||||
//============================== OLED Displays ==============================
|
//============================== OLED Displays ==============================
|
||||||
//=============================================================================
|
//=============================================================================
|
||||||
@@ -2700,38 +2931,38 @@
|
|||||||
//========================== Extensible UI Displays ===========================
|
//========================== Extensible UI Displays ===========================
|
||||||
//=============================================================================
|
//=============================================================================
|
||||||
|
|
||||||
//
|
/**
|
||||||
// DGUS Touch Display with DWIN OS. (Choose one.)
|
* DGUS Touch Display with DWIN OS. (Choose one.)
|
||||||
// ORIGIN : https://www.aliexpress.com/item/32993409517.html
|
* ORIGIN : https://www.aliexpress.com/item/32993409517.html
|
||||||
// FYSETC : https://www.aliexpress.com/item/32961471929.html
|
* FYSETC : https://www.aliexpress.com/item/32961471929.html
|
||||||
// MKS : https://www.aliexpress.com/item/1005002008179262.html
|
* MKS : https://www.aliexpress.com/item/1005002008179262.html
|
||||||
//
|
*
|
||||||
// Flash display with DGUS Displays for Marlin:
|
* Flash display with DGUS Displays for Marlin:
|
||||||
// - Format the SD card to FAT32 with an allocation size of 4kb.
|
* - Format the SD card to FAT32 with an allocation size of 4kb.
|
||||||
// - Download files as specified for your type of display.
|
* - Download files as specified for your type of display.
|
||||||
// - Plug the microSD card into the back of the display.
|
* - Plug the microSD card into the back of the display.
|
||||||
// - Boot the display and wait for the update to complete.
|
* - Boot the display and wait for the update to complete.
|
||||||
//
|
*
|
||||||
// ORIGIN (Marlin DWIN_SET)
|
* ORIGIN (Marlin DWIN_SET)
|
||||||
// - Download https://github.com/coldtobi/Marlin_DGUS_Resources
|
* - Download https://github.com/coldtobi/Marlin_DGUS_Resources
|
||||||
// - Copy the downloaded DWIN_SET folder to the SD card.
|
* - Copy the downloaded DWIN_SET folder to the SD card.
|
||||||
//
|
*
|
||||||
// FYSETC (Supplier default)
|
* FYSETC (Supplier default)
|
||||||
// - Download https://github.com/FYSETC/FYSTLCD-2.0
|
* - Download https://github.com/FYSETC/FYSTLCD-2.0
|
||||||
// - Copy the downloaded SCREEN folder to the SD card.
|
* - Copy the downloaded SCREEN folder to the SD card.
|
||||||
//
|
*
|
||||||
// HIPRECY (Supplier default)
|
* HIPRECY (Supplier default)
|
||||||
// - Download https://github.com/HiPrecy/Touch-Lcd-LEO
|
* - Download https://github.com/HiPrecy/Touch-Lcd-LEO
|
||||||
// - Copy the downloaded DWIN_SET folder to the SD card.
|
* - Copy the downloaded DWIN_SET folder to the SD card.
|
||||||
//
|
*
|
||||||
// MKS (MKS-H43) (Supplier default)
|
* MKS (MKS-H43) (Supplier default)
|
||||||
// - Download https://github.com/makerbase-mks/MKS-H43
|
* - Download https://github.com/makerbase-mks/MKS-H43
|
||||||
// - Copy the downloaded DWIN_SET folder to the SD card.
|
* - Copy the downloaded DWIN_SET folder to the SD card.
|
||||||
//
|
*
|
||||||
// RELOADED (T5UID1)
|
* RELOADED (T5UID1)
|
||||||
// - Download https://github.com/Desuuuu/DGUS-reloaded/releases
|
* - Download https://github.com/Desuuuu/DGUS-reloaded/releases
|
||||||
// - Copy the downloaded DWIN_SET folder to the SD card.
|
* - Copy the downloaded DWIN_SET folder to the SD card.
|
||||||
//
|
*/
|
||||||
//#define DGUS_LCD_UI_ORIGIN
|
//#define DGUS_LCD_UI_ORIGIN
|
||||||
//#define DGUS_LCD_UI_FYSETC
|
//#define DGUS_LCD_UI_FYSETC
|
||||||
//#define DGUS_LCD_UI_HIPRECY
|
//#define DGUS_LCD_UI_HIPRECY
|
||||||
@@ -2745,9 +2976,6 @@
|
|||||||
// Touch-screen LCD for Malyan M200/M300 printers
|
// Touch-screen LCD for Malyan M200/M300 printers
|
||||||
//
|
//
|
||||||
//#define MALYAN_LCD
|
//#define MALYAN_LCD
|
||||||
#if ENABLED(MALYAN_LCD)
|
|
||||||
#define LCD_SERIAL_PORT 1 // Default is 1 for Malyan M200
|
|
||||||
#endif
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Touch UI for FTDI EVE (FT800/FT810) displays
|
// Touch UI for FTDI EVE (FT800/FT810) displays
|
||||||
@@ -2761,17 +2989,14 @@
|
|||||||
//#define ANYCUBIC_LCD_I3MEGA
|
//#define ANYCUBIC_LCD_I3MEGA
|
||||||
//#define ANYCUBIC_LCD_CHIRON
|
//#define ANYCUBIC_LCD_CHIRON
|
||||||
#if EITHER(ANYCUBIC_LCD_I3MEGA, ANYCUBIC_LCD_CHIRON)
|
#if EITHER(ANYCUBIC_LCD_I3MEGA, ANYCUBIC_LCD_CHIRON)
|
||||||
#define LCD_SERIAL_PORT 3 // Default is 3 for Anycubic
|
|
||||||
//#define ANYCUBIC_LCD_DEBUG
|
//#define ANYCUBIC_LCD_DEBUG
|
||||||
|
//#define ANYCUBIC_LCD_GCODE_EXT // Add ".gcode" to menu entries for DGUS clone compatibility
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
//
|
//
|
||||||
// 320x240 Nextion 2.8" serial TFT Resistive Touch Screen NX3224T028
|
// 320x240 Nextion 2.8" serial TFT Resistive Touch Screen NX3224T028
|
||||||
//
|
//
|
||||||
//#define NEXTION_TFT
|
//#define NEXTION_TFT
|
||||||
#if ENABLED(NEXTION_TFT)
|
|
||||||
#define LCD_SERIAL_PORT 1 // Default is 1 for Nextion
|
|
||||||
#endif
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Third-party or vendor-customized controller interfaces.
|
// Third-party or vendor-customized controller interfaces.
|
||||||
@@ -2936,7 +3161,8 @@
|
|||||||
#define BUTTON_DELAY_EDIT 50 // (ms) Button repeat delay for edit screens
|
#define BUTTON_DELAY_EDIT 50 // (ms) Button repeat delay for edit screens
|
||||||
#define BUTTON_DELAY_MENU 250 // (ms) Button repeat delay for menus
|
#define BUTTON_DELAY_MENU 250 // (ms) Button repeat delay for menus
|
||||||
|
|
||||||
//#define TOUCH_IDLE_SLEEP 300 // (s) Turn off the TFT backlight if set (5mn)
|
//#define DISABLE_ENCODER // Disable the click encoder, if any
|
||||||
|
//#define TOUCH_IDLE_SLEEP_MINS 5 // (minutes) Display Sleep after a period of inactivity. Set with M255 S.
|
||||||
|
|
||||||
#define TOUCH_SCREEN_CALIBRATION
|
#define TOUCH_SCREEN_CALIBRATION
|
||||||
|
|
||||||
@@ -2971,7 +3197,7 @@
|
|||||||
//=============================== Extra Features ==============================
|
//=============================== Extra Features ==============================
|
||||||
//=============================================================================
|
//=============================================================================
|
||||||
|
|
||||||
// @section extras
|
// @section fans
|
||||||
|
|
||||||
// Set number of user-controlled fans. Disable to use all board-defined fans.
|
// Set number of user-controlled fans. Disable to use all board-defined fans.
|
||||||
// :[1,2,3,4,5,6,7,8]
|
// :[1,2,3,4,5,6,7,8]
|
||||||
@@ -2995,14 +3221,18 @@
|
|||||||
// duty cycle is attained.
|
// duty cycle is attained.
|
||||||
//#define SOFT_PWM_DITHER
|
//#define SOFT_PWM_DITHER
|
||||||
|
|
||||||
|
// @section extras
|
||||||
|
|
||||||
|
// Support for the BariCUDA Paste Extruder
|
||||||
|
//#define BARICUDA
|
||||||
|
|
||||||
|
// @section lights
|
||||||
|
|
||||||
// Temperature status LEDs that display the hotend and bed temperature.
|
// Temperature status LEDs that display the hotend and bed temperature.
|
||||||
// If all hotends, bed temperature, and target temperature are under 54C
|
// If all hotends, bed temperature, and target temperature are under 54C
|
||||||
// then the BLUE led is on. Otherwise the RED led is on. (1C hysteresis)
|
// then the BLUE led is on. Otherwise the RED led is on. (1C hysteresis)
|
||||||
//#define TEMP_STAT_LEDS
|
//#define TEMP_STAT_LEDS
|
||||||
|
|
||||||
// Support for the BariCUDA Paste Extruder
|
|
||||||
//#define BARICUDA
|
|
||||||
|
|
||||||
// Support for BlinkM/CyzRgb
|
// Support for BlinkM/CyzRgb
|
||||||
//#define BLINKM
|
//#define BLINKM
|
||||||
|
|
||||||
@@ -3023,16 +3253,19 @@
|
|||||||
* luminance values can be set from 0 to 255.
|
* luminance values can be set from 0 to 255.
|
||||||
* For NeoPixel LED an overall brightness parameter is also available.
|
* For NeoPixel LED an overall brightness parameter is also available.
|
||||||
*
|
*
|
||||||
* *** CAUTION ***
|
* === CAUTION ===
|
||||||
* LED Strips require a MOSFET Chip between PWM lines and LEDs,
|
* LED Strips require a MOSFET Chip between PWM lines and LEDs,
|
||||||
* as the Arduino cannot handle the current the LEDs will require.
|
* as the Arduino cannot handle the current the LEDs will require.
|
||||||
* Failure to follow this precaution can destroy your Arduino!
|
* Failure to follow this precaution can destroy your Arduino!
|
||||||
|
*
|
||||||
* NOTE: A separate 5V power supply is required! The NeoPixel LED needs
|
* NOTE: A separate 5V power supply is required! The NeoPixel LED needs
|
||||||
* more current than the Arduino 5V linear regulator can produce.
|
* more current than the Arduino 5V linear regulator can produce.
|
||||||
* *** CAUTION ***
|
|
||||||
*
|
*
|
||||||
* LED Type. Enable only one of the following two options.
|
* Requires PWM frequency between 50 <> 100Hz (Check HAL or variant)
|
||||||
|
* Use FAST_PWM_FAN, if possible, to reduce fan noise.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
// LED Type. Enable only one of the following two options:
|
||||||
//#define RGB_LED
|
//#define RGB_LED
|
||||||
//#define RGBW_LED
|
//#define RGBW_LED
|
||||||
|
|
||||||
@@ -3041,12 +3274,17 @@
|
|||||||
//#define RGB_LED_G_PIN 43
|
//#define RGB_LED_G_PIN 43
|
||||||
//#define RGB_LED_B_PIN 35
|
//#define RGB_LED_B_PIN 35
|
||||||
//#define RGB_LED_W_PIN -1
|
//#define RGB_LED_W_PIN -1
|
||||||
|
//#define RGB_STARTUP_TEST // For PWM pins, fade between all colors
|
||||||
|
#if ENABLED(RGB_STARTUP_TEST)
|
||||||
|
#define RGB_STARTUP_TEST_INNER_MS 10 // (ms) Reduce or increase fading speed
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Support for Adafruit NeoPixel LED driver
|
// Support for Adafruit NeoPixel LED driver
|
||||||
//#define NEOPIXEL_LED
|
//#define NEOPIXEL_LED
|
||||||
#if ENABLED(NEOPIXEL_LED)
|
#if ENABLED(NEOPIXEL_LED)
|
||||||
#define NEOPIXEL_TYPE NEO_GRBW // NEO_GRBW / NEO_GRB - four/three channel driver type (defined in Adafruit_NeoPixel.h)
|
#define NEOPIXEL_TYPE NEO_GRBW // NEO_GRBW, NEO_RGBW, NEO_GRB, NEO_RBG, etc.
|
||||||
|
// See https://github.com/adafruit/Adafruit_NeoPixel/blob/master/Adafruit_NeoPixel.h
|
||||||
//#define NEOPIXEL_PIN 4 // LED driving pin
|
//#define NEOPIXEL_PIN 4 // LED driving pin
|
||||||
//#define NEOPIXEL2_TYPE NEOPIXEL_TYPE
|
//#define NEOPIXEL2_TYPE NEOPIXEL_TYPE
|
||||||
//#define NEOPIXEL2_PIN 5
|
//#define NEOPIXEL2_PIN 5
|
||||||
@@ -3087,6 +3325,8 @@
|
|||||||
#define PRINTER_EVENT_LEDS
|
#define PRINTER_EVENT_LEDS
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
// @section servos
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Number of servos
|
* Number of servos
|
||||||
*
|
*
|
||||||
|
|||||||
+341
-471
File diff suppressed because it is too large
Load Diff
+6
-119
@@ -109,7 +109,7 @@ LIQUID_TWI2 ?= 0
|
|||||||
# This defines if Wire is needed
|
# This defines if Wire is needed
|
||||||
WIRE ?= 0
|
WIRE ?= 0
|
||||||
|
|
||||||
# This defines if Tone is needed (i.e SPEAKER is defined in Configuration.h)
|
# This defines if Tone is needed (i.e., SPEAKER is defined in Configuration.h)
|
||||||
# Disabling this (and SPEAKER) saves approximately 350 bytes of memory.
|
# Disabling this (and SPEAKER) saves approximately 350 bytes of memory.
|
||||||
TONE ?= 1
|
TONE ?= 1
|
||||||
|
|
||||||
@@ -317,123 +317,10 @@ else ifeq ($(HARDWARE_MOTHERBOARD),1159)
|
|||||||
else ifeq ($(HARDWARE_MOTHERBOARD),1160)
|
else ifeq ($(HARDWARE_MOTHERBOARD),1160)
|
||||||
# Longer LKx PRO / Alfawise Uxx Pro (PRO version)
|
# Longer LKx PRO / Alfawise Uxx Pro (PRO version)
|
||||||
else ifeq ($(HARDWARE_MOTHERBOARD),1161)
|
else ifeq ($(HARDWARE_MOTHERBOARD),1161)
|
||||||
|
# Zonestar zrib V5.3 (Chinese RAMPS replica)
|
||||||
|
else ifeq ($(HARDWARE_MOTHERBOARD),1162)
|
||||||
# 3Drag Controller
|
# Pxmalion Core I3
|
||||||
else ifeq ($(HARDWARE_MOTHERBOARD),1100)
|
else ifeq ($(HARDWARE_MOTHERBOARD),1163)
|
||||||
# Velleman K8200 Controller (derived from 3Drag Controller)
|
|
||||||
else ifeq ($(HARDWARE_MOTHERBOARD),1101)
|
|
||||||
# Velleman K8400 Controller (derived from 3Drag Controller)
|
|
||||||
else ifeq ($(HARDWARE_MOTHERBOARD),1102)
|
|
||||||
# Velleman K8600 Controller (Vertex Nano)
|
|
||||||
else ifeq ($(HARDWARE_MOTHERBOARD),1103)
|
|
||||||
# Velleman K8800 Controller (Vertex Delta)
|
|
||||||
else ifeq ($(HARDWARE_MOTHERBOARD),1104)
|
|
||||||
# 2PrintBeta BAM&DICE with STK drivers
|
|
||||||
else ifeq ($(HARDWARE_MOTHERBOARD),1105)
|
|
||||||
# 2PrintBeta BAM&DICE Due with STK drivers
|
|
||||||
else ifeq ($(HARDWARE_MOTHERBOARD),1106)
|
|
||||||
# MKS BASE v1.0
|
|
||||||
else ifeq ($(HARDWARE_MOTHERBOARD),1107)
|
|
||||||
# MKS v1.4 with A4982 stepper drivers
|
|
||||||
else ifeq ($(HARDWARE_MOTHERBOARD),1108)
|
|
||||||
# MKS v1.5 with Allegro A4982 stepper drivers
|
|
||||||
else ifeq ($(HARDWARE_MOTHERBOARD),1109)
|
|
||||||
# MKS v1.6 with Allegro A4982 stepper drivers
|
|
||||||
else ifeq ($(HARDWARE_MOTHERBOARD),1110)
|
|
||||||
# MKS BASE 1.0 with Heroic HR4982 stepper drivers
|
|
||||||
else ifeq ($(HARDWARE_MOTHERBOARD),1111)
|
|
||||||
# MKS GEN v1.3 or 1.4
|
|
||||||
else ifeq ($(HARDWARE_MOTHERBOARD),1112)
|
|
||||||
# MKS GEN L
|
|
||||||
else ifeq ($(HARDWARE_MOTHERBOARD),1113)
|
|
||||||
# zrib V2.0 control board (Chinese RAMPS replica)
|
|
||||||
else ifeq ($(HARDWARE_MOTHERBOARD),1114)
|
|
||||||
# BigTreeTech or BIQU KFB2.0
|
|
||||||
else ifeq ($(HARDWARE_MOTHERBOARD),1115)
|
|
||||||
# Felix 2.0+ Electronics Board (RAMPS like)
|
|
||||||
else ifeq ($(HARDWARE_MOTHERBOARD),1116)
|
|
||||||
# Invent-A-Part RigidBoard
|
|
||||||
else ifeq ($(HARDWARE_MOTHERBOARD),1117)
|
|
||||||
# Invent-A-Part RigidBoard V2
|
|
||||||
else ifeq ($(HARDWARE_MOTHERBOARD),1118)
|
|
||||||
# Sainsmart 2-in-1 board
|
|
||||||
else ifeq ($(HARDWARE_MOTHERBOARD),1119)
|
|
||||||
# Ultimaker
|
|
||||||
else ifeq ($(HARDWARE_MOTHERBOARD),1120)
|
|
||||||
# Ultimaker (Older electronics. Pre 1.5.4. This is rare)
|
|
||||||
else ifeq ($(HARDWARE_MOTHERBOARD),1121)
|
|
||||||
MCU ?= atmega1280
|
|
||||||
PROG_MCU ?= m1280
|
|
||||||
|
|
||||||
# Azteeg X3
|
|
||||||
else ifeq ($(HARDWARE_MOTHERBOARD),1122)
|
|
||||||
# Azteeg X3 Pro
|
|
||||||
else ifeq ($(HARDWARE_MOTHERBOARD),1123)
|
|
||||||
# Ultimainboard 2.x (Uses TEMP_SENSOR 20)
|
|
||||||
else ifeq ($(HARDWARE_MOTHERBOARD),1124)
|
|
||||||
# Rumba
|
|
||||||
else ifeq ($(HARDWARE_MOTHERBOARD),1125)
|
|
||||||
# Raise3D Rumba
|
|
||||||
else ifeq ($(HARDWARE_MOTHERBOARD),1126)
|
|
||||||
# Rapide Lite RL200 Rumba
|
|
||||||
else ifeq ($(HARDWARE_MOTHERBOARD),1127)
|
|
||||||
# Formbot T-Rex 2 Plus
|
|
||||||
else ifeq ($(HARDWARE_MOTHERBOARD),1128)
|
|
||||||
# Formbot T-Rex 3
|
|
||||||
else ifeq ($(HARDWARE_MOTHERBOARD),1129)
|
|
||||||
# Formbot Raptor
|
|
||||||
else ifeq ($(HARDWARE_MOTHERBOARD),1130)
|
|
||||||
# Formbot Raptor 2
|
|
||||||
else ifeq ($(HARDWARE_MOTHERBOARD),1131)
|
|
||||||
# bq ZUM Mega 3D
|
|
||||||
else ifeq ($(HARDWARE_MOTHERBOARD),1132)
|
|
||||||
# MakeBoard Mini v2.1.2 is a control board sold by MicroMake
|
|
||||||
else ifeq ($(HARDWARE_MOTHERBOARD),1133)
|
|
||||||
# TriGorilla Anycubic version 1.3 based on RAMPS EFB
|
|
||||||
else ifeq ($(HARDWARE_MOTHERBOARD),1134)
|
|
||||||
# TriGorilla Anycubic version 1.4 based on RAMPS EFB
|
|
||||||
else ifeq ($(HARDWARE_MOTHERBOARD),1135)
|
|
||||||
# TriGorilla Anycubic version 1.4 Rev 1.1
|
|
||||||
else ifeq ($(HARDWARE_MOTHERBOARD),1136)
|
|
||||||
# Creality: Ender-4, CR-8
|
|
||||||
else ifeq ($(HARDWARE_MOTHERBOARD),1137)
|
|
||||||
# Creality: CR10S, CR20, CR-X
|
|
||||||
else ifeq ($(HARDWARE_MOTHERBOARD),1138)
|
|
||||||
# Dagoma F5
|
|
||||||
else ifeq ($(HARDWARE_MOTHERBOARD),1139)
|
|
||||||
# FYSETC F6 1.3
|
|
||||||
else ifeq ($(HARDWARE_MOTHERBOARD),1140)
|
|
||||||
# FYSETC F6 1.5
|
|
||||||
else ifeq ($(HARDWARE_MOTHERBOARD),1141)
|
|
||||||
# Duplicator i3 Plus
|
|
||||||
else ifeq ($(HARDWARE_MOTHERBOARD),1142)
|
|
||||||
# VORON
|
|
||||||
else ifeq ($(HARDWARE_MOTHERBOARD),1143)
|
|
||||||
# TRONXY V3 1.0
|
|
||||||
else ifeq ($(HARDWARE_MOTHERBOARD),1144)
|
|
||||||
# Z-Bolt X Series
|
|
||||||
else ifeq ($(HARDWARE_MOTHERBOARD),1145)
|
|
||||||
# TT OSCAR
|
|
||||||
else ifeq ($(HARDWARE_MOTHERBOARD),1146)
|
|
||||||
# Overlord/Overlord Pro
|
|
||||||
else ifeq ($(HARDWARE_MOTHERBOARD),1147)
|
|
||||||
# ADIMLab Gantry v1
|
|
||||||
else ifeq ($(HARDWARE_MOTHERBOARD),1148)
|
|
||||||
# ADIMLab Gantry v2
|
|
||||||
else ifeq ($(HARDWARE_MOTHERBOARD),1149)
|
|
||||||
# BIQU Tango V1
|
|
||||||
else ifeq ($(HARDWARE_MOTHERBOARD),1150)
|
|
||||||
# MKS GEN L V2
|
|
||||||
else ifeq ($(HARDWARE_MOTHERBOARD),1151)
|
|
||||||
# MKS GEN L V2.1
|
|
||||||
else ifeq ($(HARDWARE_MOTHERBOARD),1152)
|
|
||||||
# Copymaster 3D
|
|
||||||
else ifeq ($(HARDWARE_MOTHERBOARD),1153)
|
|
||||||
# Ortur 4
|
|
||||||
else ifeq ($(HARDWARE_MOTHERBOARD),1154)
|
|
||||||
# Tenlog D3 Hero
|
|
||||||
else ifeq ($(HARDWARE_MOTHERBOARD),1155)
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# RAMBo and derivatives
|
# RAMBo and derivatives
|
||||||
@@ -512,7 +399,7 @@ else ifeq ($(HARDWARE_MOTHERBOARD),1324)
|
|||||||
else ifeq ($(HARDWARE_MOTHERBOARD),1325)
|
else ifeq ($(HARDWARE_MOTHERBOARD),1325)
|
||||||
# Intamsys 4.0 (Funmat HT)
|
# Intamsys 4.0 (Funmat HT)
|
||||||
else ifeq ($(HARDWARE_MOTHERBOARD),1326)
|
else ifeq ($(HARDWARE_MOTHERBOARD),1326)
|
||||||
# Malyan M180 Mainboard Version 2 (no display function, direct gcode only)
|
# Malyan M180 Mainboard Version 2 (no display function, direct G-code only)
|
||||||
else ifeq ($(HARDWARE_MOTHERBOARD),1327)
|
else ifeq ($(HARDWARE_MOTHERBOARD),1327)
|
||||||
# Geeetech GT2560 Rev B for A20(M/T/D)
|
# Geeetech GT2560 Rev B for A20(M/T/D)
|
||||||
else ifeq ($(HARDWARE_MOTHERBOARD),1328)
|
else ifeq ($(HARDWARE_MOTHERBOARD),1328)
|
||||||
|
|||||||
+2
-2
@@ -28,7 +28,7 @@
|
|||||||
/**
|
/**
|
||||||
* Marlin release version identifier
|
* Marlin release version identifier
|
||||||
*/
|
*/
|
||||||
//#define SHORT_BUILD_VERSION "bugfix-2.0.x"
|
//#define SHORT_BUILD_VERSION "bugfix-2.1.x"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Verbose version identifier which should contain a reference to the location
|
* Verbose version identifier which should contain a reference to the location
|
||||||
@@ -41,7 +41,7 @@
|
|||||||
* here we define this default string as the date where the latest release
|
* here we define this default string as the date where the latest release
|
||||||
* version was tagged.
|
* version was tagged.
|
||||||
*/
|
*/
|
||||||
//#define STRING_DISTRIBUTION_DATE "2022-04-03"
|
//#define STRING_DISTRIBUTION_DATE "2022-10-12"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Defines a generic printer name to be output to the LCD after booting Marlin.
|
* Defines a generic printer name to be output to the LCD after booting Marlin.
|
||||||
|
|||||||
@@ -0,0 +1,211 @@
|
|||||||
|
#
|
||||||
|
# Marlin Firmware
|
||||||
|
# config.ini - Options to apply before the build
|
||||||
|
#
|
||||||
|
[config:base]
|
||||||
|
ini_use_config = none
|
||||||
|
|
||||||
|
# Load all config: sections in this file
|
||||||
|
;ini_use_config = all
|
||||||
|
# Load config file relative to Marlin/
|
||||||
|
;ini_use_config = another.ini
|
||||||
|
# Download configurations from GitHub
|
||||||
|
;ini_use_config = example/Creality/Ender-5 Plus @ bugfix-2.1.x
|
||||||
|
# Download configurations from your server
|
||||||
|
;ini_use_config = https://me.myserver.com/path/to/configs
|
||||||
|
# Evaluate config:base and do a config dump
|
||||||
|
;ini_use_config = base
|
||||||
|
;config_export = 2
|
||||||
|
|
||||||
|
[config:minimal]
|
||||||
|
motherboard = BOARD_RAMPS_14_EFB
|
||||||
|
serial_port = 0
|
||||||
|
baudrate = 250000
|
||||||
|
|
||||||
|
use_watchdog = on
|
||||||
|
thermal_protection_hotends = on
|
||||||
|
thermal_protection_hysteresis = 4
|
||||||
|
thermal_protection_period = 40
|
||||||
|
|
||||||
|
bufsize = 4
|
||||||
|
block_buffer_size = 16
|
||||||
|
max_cmd_size = 96
|
||||||
|
|
||||||
|
extruders = 1
|
||||||
|
temp_sensor_0 = 1
|
||||||
|
|
||||||
|
temp_hysteresis = 3
|
||||||
|
heater_0_mintemp = 5
|
||||||
|
heater_0_maxtemp = 275
|
||||||
|
preheat_1_temp_hotend = 180
|
||||||
|
|
||||||
|
bang_max = 255
|
||||||
|
pidtemp = on
|
||||||
|
pid_k1 = 0.95
|
||||||
|
pid_max = BANG_MAX
|
||||||
|
pid_functional_range = 10
|
||||||
|
|
||||||
|
default_kp = 22.20
|
||||||
|
default_ki = 1.08
|
||||||
|
default_kd = 114.00
|
||||||
|
|
||||||
|
x_driver_type = A4988
|
||||||
|
y_driver_type = A4988
|
||||||
|
z_driver_type = A4988
|
||||||
|
e0_driver_type = A4988
|
||||||
|
|
||||||
|
x_bed_size = 200
|
||||||
|
x_min_pos = 0
|
||||||
|
x_max_pos = X_BED_SIZE
|
||||||
|
|
||||||
|
y_bed_size = 200
|
||||||
|
y_min_pos = 0
|
||||||
|
y_max_pos = Y_BED_SIZE
|
||||||
|
|
||||||
|
z_min_pos = 0
|
||||||
|
z_max_pos = 200
|
||||||
|
|
||||||
|
x_home_dir = -1
|
||||||
|
y_home_dir = -1
|
||||||
|
z_home_dir = -1
|
||||||
|
|
||||||
|
use_xmin_plug = on
|
||||||
|
use_ymin_plug = on
|
||||||
|
use_zmin_plug = on
|
||||||
|
|
||||||
|
x_min_endstop_inverting = false
|
||||||
|
y_min_endstop_inverting = false
|
||||||
|
z_min_endstop_inverting = false
|
||||||
|
|
||||||
|
default_axis_steps_per_unit = { 80, 80, 400, 500 }
|
||||||
|
axis_relative_modes = { false, false, false, false }
|
||||||
|
default_max_feedrate = { 300, 300, 5, 25 }
|
||||||
|
default_max_acceleration = { 3000, 3000, 100, 10000 }
|
||||||
|
|
||||||
|
homing_feedrate_mm_m = { (50*60), (50*60), (4*60) }
|
||||||
|
homing_bump_divisor = { 2, 2, 4 }
|
||||||
|
|
||||||
|
x_enable_on = 0
|
||||||
|
y_enable_on = 0
|
||||||
|
z_enable_on = 0
|
||||||
|
e_enable_on = 0
|
||||||
|
|
||||||
|
invert_x_dir = false
|
||||||
|
invert_y_dir = true
|
||||||
|
invert_z_dir = false
|
||||||
|
invert_e0_dir = false
|
||||||
|
|
||||||
|
invert_e_step_pin = false
|
||||||
|
invert_x_step_pin = false
|
||||||
|
invert_y_step_pin = false
|
||||||
|
invert_z_step_pin = false
|
||||||
|
|
||||||
|
disable_x = false
|
||||||
|
disable_y = false
|
||||||
|
disable_z = false
|
||||||
|
disable_e = false
|
||||||
|
|
||||||
|
proportional_font_ratio = 1.0
|
||||||
|
default_nominal_filament_dia = 1.75
|
||||||
|
|
||||||
|
junction_deviation_mm = 0.013
|
||||||
|
|
||||||
|
default_acceleration = 3000
|
||||||
|
default_travel_acceleration = 3000
|
||||||
|
default_retract_acceleration = 3000
|
||||||
|
|
||||||
|
default_minimumfeedrate = 0.0
|
||||||
|
default_mintravelfeedrate = 0.0
|
||||||
|
|
||||||
|
minimum_planner_speed = 0.05
|
||||||
|
min_steps_per_segment = 6
|
||||||
|
default_minsegmenttime = 20000
|
||||||
|
|
||||||
|
[config:basic]
|
||||||
|
bed_overshoot = 10
|
||||||
|
busy_while_heating = on
|
||||||
|
default_ejerk = 5.0
|
||||||
|
default_keepalive_interval = 2
|
||||||
|
default_leveling_fade_height = 0.0
|
||||||
|
disable_inactive_extruder = on
|
||||||
|
display_charset_hd44780 = JAPANESE
|
||||||
|
eeprom_boot_silent = on
|
||||||
|
eeprom_chitchat = on
|
||||||
|
endstoppullups = on
|
||||||
|
extrude_maxlength = 200
|
||||||
|
extrude_mintemp = 170
|
||||||
|
host_keepalive_feature = on
|
||||||
|
hotend_overshoot = 15
|
||||||
|
jd_handle_small_segments = on
|
||||||
|
lcd_info_screen_style = 0
|
||||||
|
lcd_language = en
|
||||||
|
max_bed_power = 255
|
||||||
|
mesh_inset = 0
|
||||||
|
min_software_endstops = on
|
||||||
|
max_software_endstops = on
|
||||||
|
min_software_endstop_x = on
|
||||||
|
min_software_endstop_y = on
|
||||||
|
min_software_endstop_z = on
|
||||||
|
max_software_endstop_x = on
|
||||||
|
max_software_endstop_y = on
|
||||||
|
max_software_endstop_z = on
|
||||||
|
preheat_1_fan_speed = 0
|
||||||
|
preheat_1_label = "PLA"
|
||||||
|
preheat_1_temp_bed = 70
|
||||||
|
prevent_cold_extrusion = on
|
||||||
|
prevent_lengthy_extrude = on
|
||||||
|
printjob_timer_autostart = on
|
||||||
|
probing_margin = 10
|
||||||
|
show_bootscreen = on
|
||||||
|
soft_pwm_scale = 0
|
||||||
|
string_config_h_author = "(none, default config)"
|
||||||
|
temp_bed_hysteresis = 3
|
||||||
|
temp_bed_residency_time = 10
|
||||||
|
temp_bed_window = 1
|
||||||
|
temp_residency_time = 10
|
||||||
|
temp_window = 1
|
||||||
|
validate_homing_endstops = on
|
||||||
|
xy_probe_feedrate = (133*60)
|
||||||
|
z_clearance_between_probes = 5
|
||||||
|
z_clearance_deploy_probe = 10
|
||||||
|
z_clearance_multi_probe = 5
|
||||||
|
|
||||||
|
[config:advanced]
|
||||||
|
arc_support = on
|
||||||
|
auto_report_temperatures = on
|
||||||
|
autotemp = on
|
||||||
|
autotemp_oldweight = 0.98
|
||||||
|
bed_check_interval = 5000
|
||||||
|
default_stepper_deactive_time = 120
|
||||||
|
default_volumetric_extruder_limit = 0.00
|
||||||
|
disable_inactive_e = true
|
||||||
|
disable_inactive_x = true
|
||||||
|
disable_inactive_y = true
|
||||||
|
disable_inactive_z = true
|
||||||
|
e0_auto_fan_pin = -1
|
||||||
|
encoder_100x_steps_per_sec = 80
|
||||||
|
encoder_10x_steps_per_sec = 30
|
||||||
|
encoder_rate_multiplier = on
|
||||||
|
extended_capabilities_report = on
|
||||||
|
extruder_auto_fan_speed = 255
|
||||||
|
extruder_auto_fan_temperature = 50
|
||||||
|
fanmux0_pin = -1
|
||||||
|
fanmux1_pin = -1
|
||||||
|
fanmux2_pin = -1
|
||||||
|
faster_gcode_parser = on
|
||||||
|
homing_bump_mm = { 5, 5, 2 }
|
||||||
|
max_arc_segment_mm = 1.0
|
||||||
|
min_arc_segment_mm = 0.1
|
||||||
|
min_circle_segments = 72
|
||||||
|
n_arc_correction = 25
|
||||||
|
serial_overrun_protection = on
|
||||||
|
slowdown = on
|
||||||
|
slowdown_divisor = 2
|
||||||
|
temp_sensor_bed = 0
|
||||||
|
thermal_protection_bed_hysteresis = 2
|
||||||
|
thermocouple_max_errors = 15
|
||||||
|
tx_buffer_size = 0
|
||||||
|
watch_bed_temp_increase = 2
|
||||||
|
watch_bed_temp_period = 60
|
||||||
|
watch_temp_increase = 2
|
||||||
|
watch_temp_period = 20
|
||||||
@@ -23,6 +23,7 @@
|
|||||||
|
|
||||||
#include "../../inc/MarlinConfig.h"
|
#include "../../inc/MarlinConfig.h"
|
||||||
#include "HAL.h"
|
#include "HAL.h"
|
||||||
|
#include <avr/wdt.h>
|
||||||
|
|
||||||
#ifdef USBCON
|
#ifdef USBCON
|
||||||
DefaultSerial1 MSerial0(false, Serial);
|
DefaultSerial1 MSerial0(false, Serial);
|
||||||
@@ -88,6 +89,62 @@ void MarlinHAL::reboot() {
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ------------------------
|
||||||
|
// Watchdog Timer
|
||||||
|
// ------------------------
|
||||||
|
|
||||||
|
#if ENABLED(USE_WATCHDOG)
|
||||||
|
|
||||||
|
#include <avr/wdt.h>
|
||||||
|
#include "../../MarlinCore.h"
|
||||||
|
|
||||||
|
// Initialize watchdog with 8s timeout, if possible. Otherwise, make it 4s.
|
||||||
|
void MarlinHAL::watchdog_init() {
|
||||||
|
#if ENABLED(WATCHDOG_DURATION_8S) && defined(WDTO_8S)
|
||||||
|
#define WDTO_NS WDTO_8S
|
||||||
|
#else
|
||||||
|
#define WDTO_NS WDTO_4S
|
||||||
|
#endif
|
||||||
|
#if ENABLED(WATCHDOG_RESET_MANUAL)
|
||||||
|
// Enable the watchdog timer, but only for the interrupt.
|
||||||
|
// Take care, as this requires the correct order of operation, with interrupts disabled.
|
||||||
|
// See the datasheet of any AVR chip for details.
|
||||||
|
wdt_reset();
|
||||||
|
cli();
|
||||||
|
_WD_CONTROL_REG = _BV(_WD_CHANGE_BIT) | _BV(WDE);
|
||||||
|
_WD_CONTROL_REG = _BV(WDIE) | (WDTO_NS & 0x07) | ((WDTO_NS & 0x08) << 2); // WDTO_NS directly does not work. bit 0-2 are consecutive in the register but the highest value bit is at bit 5
|
||||||
|
// So worked for up to WDTO_2S
|
||||||
|
sei();
|
||||||
|
wdt_reset();
|
||||||
|
#else
|
||||||
|
wdt_enable(WDTO_NS); // The function handles the upper bit correct.
|
||||||
|
#endif
|
||||||
|
//delay(10000); // test it!
|
||||||
|
}
|
||||||
|
|
||||||
|
//===========================================================================
|
||||||
|
//=================================== ISR ===================================
|
||||||
|
//===========================================================================
|
||||||
|
|
||||||
|
// Watchdog timer interrupt, called if main program blocks >4sec and manual reset is enabled.
|
||||||
|
#if ENABLED(WATCHDOG_RESET_MANUAL)
|
||||||
|
ISR(WDT_vect) {
|
||||||
|
sei(); // With the interrupt driven serial we need to allow interrupts.
|
||||||
|
SERIAL_ERROR_MSG(STR_WATCHDOG_FIRED);
|
||||||
|
minkill(); // interrupt-safe final kill and infinite loop
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// Reset watchdog. MUST be called at least every 4 seconds after the
|
||||||
|
// first watchdog_init or AVR will go into emergency procedures.
|
||||||
|
void MarlinHAL::watchdog_refresh() { wdt_reset(); }
|
||||||
|
|
||||||
|
#endif // USE_WATCHDOG
|
||||||
|
|
||||||
|
// ------------------------
|
||||||
|
// Free Memory Accessor
|
||||||
|
// ------------------------
|
||||||
|
|
||||||
#if ENABLED(SDSUPPORT)
|
#if ENABLED(SDSUPPORT)
|
||||||
|
|
||||||
#include "../../sd/SdFatUtil.h"
|
#include "../../sd/SdFatUtil.h"
|
||||||
|
|||||||
@@ -19,16 +19,18 @@
|
|||||||
*/
|
*/
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
/**
|
||||||
|
* HAL for Arduino AVR
|
||||||
|
*/
|
||||||
|
|
||||||
#include "../shared/Marduino.h"
|
#include "../shared/Marduino.h"
|
||||||
#include "../shared/HAL_SPI.h"
|
#include "../shared/HAL_SPI.h"
|
||||||
#include "fastio.h"
|
#include "fastio.h"
|
||||||
#include "watchdog.h"
|
|
||||||
#include "math.h"
|
#include "math.h"
|
||||||
|
|
||||||
#ifdef USBCON
|
#ifdef USBCON
|
||||||
#include <HardwareSerial.h>
|
#include <HardwareSerial.h>
|
||||||
#else
|
#else
|
||||||
#define HardwareSerial_h // Hack to prevent HardwareSerial.h header inclusion
|
|
||||||
#include "MarlinSerial.h"
|
#include "MarlinSerial.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -164,7 +166,7 @@ typedef Servo hal_servo_t;
|
|||||||
#define strtof strtod
|
#define strtof strtod
|
||||||
|
|
||||||
// ------------------------
|
// ------------------------
|
||||||
// Class Utilities
|
// Free Memory Accessor
|
||||||
// ------------------------
|
// ------------------------
|
||||||
|
|
||||||
#pragma GCC diagnostic push
|
#pragma GCC diagnostic push
|
||||||
@@ -186,6 +188,10 @@ public:
|
|||||||
// Earliest possible init, before setup()
|
// Earliest possible init, before setup()
|
||||||
MarlinHAL() {}
|
MarlinHAL() {}
|
||||||
|
|
||||||
|
// Watchdog
|
||||||
|
static void watchdog_init() IF_DISABLED(USE_WATCHDOG, {});
|
||||||
|
static void watchdog_refresh() IF_DISABLED(USE_WATCHDOG, {});
|
||||||
|
|
||||||
static void init(); // Called early in setup()
|
static void init(); // Called early in setup()
|
||||||
static void init_board() {} // Called less early in setup()
|
static void init_board() {} // Called less early in setup()
|
||||||
static void reboot(); // Restart the firmware from 0x0
|
static void reboot(); // Restart the firmware from 0x0
|
||||||
@@ -229,7 +235,7 @@ public:
|
|||||||
SBI(DIDR0, ch);
|
SBI(DIDR0, ch);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Begin ADC sampling on the given channel
|
// Begin ADC sampling on the given channel. Called from Temperature::isr!
|
||||||
static void adc_start(const uint8_t ch) {
|
static void adc_start(const uint8_t ch) {
|
||||||
#ifdef MUX5
|
#ifdef MUX5
|
||||||
ADCSRB = ch > 7 ? _BV(MUX5) : 0;
|
ADCSRB = ch > 7 ? _BV(MUX5) : 0;
|
||||||
|
|||||||
@@ -66,27 +66,26 @@ static volatile int8_t Channel[_Nbr_16timers]; // counter for the s
|
|||||||
|
|
||||||
/************ static functions common to all instances ***********************/
|
/************ static functions common to all instances ***********************/
|
||||||
|
|
||||||
static inline void handle_interrupts(timer16_Sequence_t timer, volatile uint16_t* TCNTn, volatile uint16_t* OCRnA) {
|
static inline void handle_interrupts(const timer16_Sequence_t timer, volatile uint16_t* TCNTn, volatile uint16_t* OCRnA) {
|
||||||
if (Channel[timer] < 0)
|
int8_t cho = Channel[timer]; // Handle the prior Channel[timer] first
|
||||||
*TCNTn = 0; // channel set to -1 indicated that refresh interval completed so reset the timer
|
if (cho < 0) // Channel -1 indicates the refresh interval completed...
|
||||||
else {
|
*TCNTn = 0; // ...so reset the timer
|
||||||
if (SERVO_INDEX(timer, Channel[timer]) < ServoCount && SERVO(timer, Channel[timer]).Pin.isActive)
|
else if (SERVO_INDEX(timer, cho) < ServoCount) // prior channel handled?
|
||||||
extDigitalWrite(SERVO(timer, Channel[timer]).Pin.nbr, LOW); // pulse this channel low if activated
|
extDigitalWrite(SERVO(timer, cho).Pin.nbr, LOW); // pulse the prior channel LOW
|
||||||
}
|
|
||||||
|
|
||||||
Channel[timer]++; // increment to the next channel
|
Channel[timer] = ++cho; // Handle the next channel (or 0)
|
||||||
if (SERVO_INDEX(timer, Channel[timer]) < ServoCount && Channel[timer] < SERVOS_PER_TIMER) {
|
if (cho < SERVOS_PER_TIMER && SERVO_INDEX(timer, cho) < ServoCount) {
|
||||||
*OCRnA = *TCNTn + SERVO(timer, Channel[timer]).ticks;
|
*OCRnA = *TCNTn + SERVO(timer, cho).ticks; // set compare to current ticks plus duration
|
||||||
if (SERVO(timer, Channel[timer]).Pin.isActive) // check if activated
|
if (SERVO(timer, cho).Pin.isActive) // activated?
|
||||||
extDigitalWrite(SERVO(timer, Channel[timer]).Pin.nbr, HIGH); // it's an active channel so pulse it high
|
extDigitalWrite(SERVO(timer, cho).Pin.nbr, HIGH); // yes: pulse HIGH
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
// finished all channels so wait for the refresh period to expire before starting over
|
// finished all channels so wait for the refresh period to expire before starting over
|
||||||
if (((unsigned)*TCNTn) + 4 < usToTicks(REFRESH_INTERVAL)) // allow a few ticks to ensure the next OCR1A not missed
|
const unsigned int cval = ((unsigned)*TCNTn) + 32 / (SERVO_TIMER_PRESCALER), // allow 32 cycles to ensure the next OCR1A not missed
|
||||||
*OCRnA = (unsigned int)usToTicks(REFRESH_INTERVAL);
|
ival = (unsigned int)usToTicks(REFRESH_INTERVAL); // at least REFRESH_INTERVAL has elapsed
|
||||||
else
|
*OCRnA = max(cval, ival);
|
||||||
*OCRnA = *TCNTn + 4; // at least REFRESH_INTERVAL has elapsed
|
|
||||||
Channel[timer] = -1; // this will get incremented at the end of the refresh period to start again at the first channel
|
Channel[timer] = -1; // reset the timer counter to 0 on the next call
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -123,9 +122,12 @@ static inline void handle_interrupts(timer16_Sequence_t timer, volatile uint16_t
|
|||||||
|
|
||||||
/****************** end of static functions ******************************/
|
/****************** end of static functions ******************************/
|
||||||
|
|
||||||
void initISR(timer16_Sequence_t timer) {
|
void initISR(const timer16_Sequence_t timer_index) {
|
||||||
|
switch (timer_index) {
|
||||||
|
default: break;
|
||||||
|
|
||||||
#ifdef _useTimer1
|
#ifdef _useTimer1
|
||||||
if (timer == _timer1) {
|
case _timer1:
|
||||||
TCCR1A = 0; // normal counting mode
|
TCCR1A = 0; // normal counting mode
|
||||||
TCCR1B = _BV(CS11); // set prescaler of 8
|
TCCR1B = _BV(CS11); // set prescaler of 8
|
||||||
TCNT1 = 0; // clear the timer count
|
TCNT1 = 0; // clear the timer count
|
||||||
@@ -140,11 +142,11 @@ void initISR(timer16_Sequence_t timer) {
|
|||||||
#ifdef WIRING
|
#ifdef WIRING
|
||||||
timerAttach(TIMER1OUTCOMPAREA_INT, Timer1Service);
|
timerAttach(TIMER1OUTCOMPAREA_INT, Timer1Service);
|
||||||
#endif
|
#endif
|
||||||
}
|
break;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef _useTimer3
|
#ifdef _useTimer3
|
||||||
if (timer == _timer3) {
|
case _timer3:
|
||||||
TCCR3A = 0; // normal counting mode
|
TCCR3A = 0; // normal counting mode
|
||||||
TCCR3B = _BV(CS31); // set prescaler of 8
|
TCCR3B = _BV(CS31); // set prescaler of 8
|
||||||
TCNT3 = 0; // clear the timer count
|
TCNT3 = 0; // clear the timer count
|
||||||
@@ -158,56 +160,64 @@ void initISR(timer16_Sequence_t timer) {
|
|||||||
#ifdef WIRING
|
#ifdef WIRING
|
||||||
timerAttach(TIMER3OUTCOMPAREA_INT, Timer3Service); // for Wiring platform only
|
timerAttach(TIMER3OUTCOMPAREA_INT, Timer3Service); // for Wiring platform only
|
||||||
#endif
|
#endif
|
||||||
}
|
break;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef _useTimer4
|
#ifdef _useTimer4
|
||||||
if (timer == _timer4) {
|
case _timer4:
|
||||||
TCCR4A = 0; // normal counting mode
|
TCCR4A = 0; // normal counting mode
|
||||||
TCCR4B = _BV(CS41); // set prescaler of 8
|
TCCR4B = _BV(CS41); // set prescaler of 8
|
||||||
TCNT4 = 0; // clear the timer count
|
TCNT4 = 0; // clear the timer count
|
||||||
TIFR4 = _BV(OCF4A); // clear any pending interrupts;
|
TIFR4 = _BV(OCF4A); // clear any pending interrupts;
|
||||||
TIMSK4 = _BV(OCIE4A); // enable the output compare interrupt
|
TIMSK4 = _BV(OCIE4A); // enable the output compare interrupt
|
||||||
}
|
break;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef _useTimer5
|
#ifdef _useTimer5
|
||||||
if (timer == _timer5) {
|
case _timer5:
|
||||||
TCCR5A = 0; // normal counting mode
|
TCCR5A = 0; // normal counting mode
|
||||||
TCCR5B = _BV(CS51); // set prescaler of 8
|
TCCR5B = _BV(CS51); // set prescaler of 8
|
||||||
TCNT5 = 0; // clear the timer count
|
TCNT5 = 0; // clear the timer count
|
||||||
TIFR5 = _BV(OCF5A); // clear any pending interrupts;
|
TIFR5 = _BV(OCF5A); // clear any pending interrupts;
|
||||||
TIMSK5 = _BV(OCIE5A); // enable the output compare interrupt
|
TIMSK5 = _BV(OCIE5A); // enable the output compare interrupt
|
||||||
}
|
break;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void finISR(timer16_Sequence_t timer) {
|
void finISR(const timer16_Sequence_t timer_index) {
|
||||||
// Disable use of the given timer
|
// Disable use of the given timer
|
||||||
#ifdef WIRING
|
#ifdef WIRING
|
||||||
if (timer == _timer1) {
|
switch (timer_index) {
|
||||||
|
default: break;
|
||||||
|
|
||||||
|
case _timer1:
|
||||||
CBI(
|
CBI(
|
||||||
#if defined(__AVR_ATmega1281__) || defined(__AVR_ATmega2561__)
|
#if defined(__AVR_ATmega1281__) || defined(__AVR_ATmega2561__)
|
||||||
TIMSK1
|
TIMSK1
|
||||||
#else
|
#else
|
||||||
TIMSK
|
TIMSK
|
||||||
#endif
|
#endif
|
||||||
, OCIE1A); // disable timer 1 output compare interrupt
|
, OCIE1A // disable timer 1 output compare interrupt
|
||||||
|
);
|
||||||
timerDetach(TIMER1OUTCOMPAREA_INT);
|
timerDetach(TIMER1OUTCOMPAREA_INT);
|
||||||
}
|
break;
|
||||||
else if (timer == _timer3) {
|
|
||||||
|
case _timer3:
|
||||||
CBI(
|
CBI(
|
||||||
#if defined(__AVR_ATmega1281__) || defined(__AVR_ATmega2561__)
|
#if defined(__AVR_ATmega1281__) || defined(__AVR_ATmega2561__)
|
||||||
TIMSK3
|
TIMSK3
|
||||||
#else
|
#else
|
||||||
ETIMSK
|
ETIMSK
|
||||||
#endif
|
#endif
|
||||||
, OCIE3A); // disable the timer3 output compare A interrupt
|
, OCIE3A // disable the timer3 output compare A interrupt
|
||||||
|
);
|
||||||
timerDetach(TIMER3OUTCOMPAREA_INT);
|
timerDetach(TIMER3OUTCOMPAREA_INT);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
#else // !WIRING
|
#else // !WIRING
|
||||||
// For arduino - in future: call here to a currently undefined function to reset the timer
|
// For arduino - in future: call here to a currently undefined function to reset the timer
|
||||||
UNUSED(timer);
|
UNUSED(timer_index);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -25,6 +25,38 @@
|
|||||||
* Test AVR-specific configuration values for errors at compile-time.
|
* Test AVR-specific configuration values for errors at compile-time.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check for common serial pin conflicts
|
||||||
|
*/
|
||||||
|
#define CHECK_SERIAL_PIN(N) ( \
|
||||||
|
X_STOP_PIN == N || Y_STOP_PIN == N || Z_STOP_PIN == N \
|
||||||
|
|| X_MIN_PIN == N || Y_MIN_PIN == N || Z_MIN_PIN == N \
|
||||||
|
|| X_MAX_PIN == N || Y_MAX_PIN == N || Z_MAX_PIN == N \
|
||||||
|
|| X_STEP_PIN == N || Y_STEP_PIN == N || Z_STEP_PIN == N \
|
||||||
|
|| X_DIR_PIN == N || Y_DIR_PIN == N || Z_DIR_PIN == N \
|
||||||
|
|| X_ENA_PIN == N || Y_ENA_PIN == N || Z_ENA_PIN == N \
|
||||||
|
|| BTN_EN1 == N || BTN_EN2 == N \
|
||||||
|
)
|
||||||
|
#if CONF_SERIAL_IS(0)
|
||||||
|
// D0-D1. No known conflicts.
|
||||||
|
#endif
|
||||||
|
#if NOT_TARGET(__AVR_ATmega644P__, __AVR_ATmega1284P__)
|
||||||
|
#if CONF_SERIAL_IS(1) && (CHECK_SERIAL_PIN(18) || CHECK_SERIAL_PIN(19))
|
||||||
|
#error "Serial Port 1 pin D18 and/or D19 conflicts with another pin on the board."
|
||||||
|
#endif
|
||||||
|
#else
|
||||||
|
#if CONF_SERIAL_IS(1) && (CHECK_SERIAL_PIN(10) || CHECK_SERIAL_PIN(11))
|
||||||
|
#error "Serial Port 1 pin D10 and/or D11 conflicts with another pin on the board."
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
#if CONF_SERIAL_IS(2) && (CHECK_SERIAL_PIN(16) || CHECK_SERIAL_PIN(17))
|
||||||
|
#error "Serial Port 2 pin D16 and/or D17 conflicts with another pin on the board."
|
||||||
|
#endif
|
||||||
|
#if CONF_SERIAL_IS(3) && (CHECK_SERIAL_PIN(14) || CHECK_SERIAL_PIN(15))
|
||||||
|
#error "Serial Port 3 pin D14 and/or D15 conflicts with another pin on the board."
|
||||||
|
#endif
|
||||||
|
#undef CHECK_SERIAL_PIN
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks for FAST PWM
|
* Checks for FAST PWM
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -74,7 +74,7 @@
|
|||||||
#define MULTI_NAME_PAD 26 // space needed to be pretty if not first name assigned to a pin
|
#define MULTI_NAME_PAD 26 // space needed to be pretty if not first name assigned to a pin
|
||||||
|
|
||||||
void PRINT_ARRAY_NAME(uint8_t x) {
|
void PRINT_ARRAY_NAME(uint8_t x) {
|
||||||
char *name_mem_pointer = (char*)pgm_read_ptr(&pin_array[x].name);
|
PGM_P const name_mem_pointer = (PGM_P)pgm_read_ptr(&pin_array[x].name);
|
||||||
LOOP_L_N(y, MAX_NAME_LENGTH) {
|
LOOP_L_N(y, MAX_NAME_LENGTH) {
|
||||||
char temp_char = pgm_read_byte(name_mem_pointer + y);
|
char temp_char = pgm_read_byte(name_mem_pointer + y);
|
||||||
if (temp_char != 0)
|
if (temp_char != 0)
|
||||||
|
|||||||
@@ -1,70 +0,0 @@
|
|||||||
/**
|
|
||||||
* Marlin 3D Printer Firmware
|
|
||||||
* Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
|
|
||||||
*
|
|
||||||
* Based on Sprinter and grbl.
|
|
||||||
* Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
|
|
||||||
*
|
|
||||||
* This program is free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
#ifdef __AVR__
|
|
||||||
|
|
||||||
#include "../../inc/MarlinConfig.h"
|
|
||||||
|
|
||||||
#if ENABLED(USE_WATCHDOG)
|
|
||||||
|
|
||||||
#include "watchdog.h"
|
|
||||||
|
|
||||||
#include "../../MarlinCore.h"
|
|
||||||
|
|
||||||
// Initialize watchdog with 8s timeout, if possible. Otherwise, make it 4s.
|
|
||||||
void watchdog_init() {
|
|
||||||
#if ENABLED(WATCHDOG_DURATION_8S) && defined(WDTO_8S)
|
|
||||||
#define WDTO_NS WDTO_8S
|
|
||||||
#else
|
|
||||||
#define WDTO_NS WDTO_4S
|
|
||||||
#endif
|
|
||||||
#if ENABLED(WATCHDOG_RESET_MANUAL)
|
|
||||||
// Enable the watchdog timer, but only for the interrupt.
|
|
||||||
// Take care, as this requires the correct order of operation, with interrupts disabled.
|
|
||||||
// See the datasheet of any AVR chip for details.
|
|
||||||
wdt_reset();
|
|
||||||
cli();
|
|
||||||
_WD_CONTROL_REG = _BV(_WD_CHANGE_BIT) | _BV(WDE);
|
|
||||||
_WD_CONTROL_REG = _BV(WDIE) | (WDTO_NS & 0x07) | ((WDTO_NS & 0x08) << 2); // WDTO_NS directly does not work. bit 0-2 are consecutive in the register but the highest value bit is at bit 5
|
|
||||||
// So worked for up to WDTO_2S
|
|
||||||
sei();
|
|
||||||
wdt_reset();
|
|
||||||
#else
|
|
||||||
wdt_enable(WDTO_NS); // The function handles the upper bit correct.
|
|
||||||
#endif
|
|
||||||
//delay(10000); // test it!
|
|
||||||
}
|
|
||||||
|
|
||||||
//===========================================================================
|
|
||||||
//=================================== ISR ===================================
|
|
||||||
//===========================================================================
|
|
||||||
|
|
||||||
// Watchdog timer interrupt, called if main program blocks >4sec and manual reset is enabled.
|
|
||||||
#if ENABLED(WATCHDOG_RESET_MANUAL)
|
|
||||||
ISR(WDT_vect) {
|
|
||||||
sei(); // With the interrupt driven serial we need to allow interrupts.
|
|
||||||
SERIAL_ERROR_MSG(STR_WATCHDOG_FIRED);
|
|
||||||
minkill(); // interrupt-safe final kill and infinite loop
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif // USE_WATCHDOG
|
|
||||||
#endif // __AVR__
|
|
||||||
+106
-4
@@ -25,7 +25,7 @@
|
|||||||
#ifdef ARDUINO_ARCH_SAM
|
#ifdef ARDUINO_ARCH_SAM
|
||||||
|
|
||||||
#include "../../inc/MarlinConfig.h"
|
#include "../../inc/MarlinConfig.h"
|
||||||
#include "HAL.h"
|
#include "../../MarlinCore.h"
|
||||||
|
|
||||||
#include <Wire.h>
|
#include <Wire.h>
|
||||||
#include "usb/usb_task.h"
|
#include "usb/usb_task.h"
|
||||||
@@ -40,14 +40,15 @@ uint16_t MarlinHAL::adc_result;
|
|||||||
// Public functions
|
// Public functions
|
||||||
// ------------------------
|
// ------------------------
|
||||||
|
|
||||||
TERN_(POSTMORTEM_DEBUGGING, extern void install_min_serial());
|
#if ENABLED(POSTMORTEM_DEBUGGING)
|
||||||
|
extern void install_min_serial();
|
||||||
|
#endif
|
||||||
|
|
||||||
void MarlinHAL::init() {
|
void MarlinHAL::init() {
|
||||||
// Initialize the USB stack
|
|
||||||
#if ENABLED(SDSUPPORT)
|
#if ENABLED(SDSUPPORT)
|
||||||
OUT_WRITE(SDSS, HIGH); // Try to set SDSS inactive before any other SPI users start up
|
OUT_WRITE(SDSS, HIGH); // Try to set SDSS inactive before any other SPI users start up
|
||||||
#endif
|
#endif
|
||||||
usb_task_init();
|
usb_task_init(); // Initialize the USB stack
|
||||||
TERN_(POSTMORTEM_DEBUGGING, install_min_serial()); // Install the min serial handler
|
TERN_(POSTMORTEM_DEBUGGING, install_min_serial()); // Install the min serial handler
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -72,6 +73,103 @@ uint8_t MarlinHAL::get_reset_source() {
|
|||||||
|
|
||||||
void MarlinHAL::reboot() { rstc_start_software_reset(RSTC); }
|
void MarlinHAL::reboot() { rstc_start_software_reset(RSTC); }
|
||||||
|
|
||||||
|
// ------------------------
|
||||||
|
// Watchdog Timer
|
||||||
|
// ------------------------
|
||||||
|
|
||||||
|
#if ENABLED(USE_WATCHDOG)
|
||||||
|
|
||||||
|
// Initialize watchdog - On SAM3X, Watchdog was already configured
|
||||||
|
// and enabled or disabled at startup, so no need to reconfigure it
|
||||||
|
// here.
|
||||||
|
void MarlinHAL::watchdog_init() { WDT_Restart(WDT); } // Reset watchdog to start clean
|
||||||
|
|
||||||
|
// Reset watchdog. MUST be called at least every 4 seconds after the
|
||||||
|
// first watchdog_init or AVR will go into emergency procedures.
|
||||||
|
void MarlinHAL::watchdog_refresh() { watchdogReset(); }
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// Override Arduino runtime to either config or disable the watchdog
|
||||||
|
//
|
||||||
|
// We need to configure the watchdog as soon as possible in the boot
|
||||||
|
// process, because watchdog initialization at hardware reset on SAM3X8E
|
||||||
|
// is unreliable, and there is risk of unintended resets if we delay
|
||||||
|
// that initialization to a later time.
|
||||||
|
void watchdogSetup() {
|
||||||
|
|
||||||
|
#if ENABLED(USE_WATCHDOG)
|
||||||
|
|
||||||
|
// 4 seconds timeout
|
||||||
|
uint32_t timeout = TERN(WATCHDOG_DURATION_8S, 8000, 4000);
|
||||||
|
|
||||||
|
// Calculate timeout value in WDT counter ticks: This assumes
|
||||||
|
// the slow clock is running at 32.768 kHz watchdog
|
||||||
|
// frequency is therefore 32768 / 128 = 256 Hz
|
||||||
|
timeout = (timeout << 8) / 1000;
|
||||||
|
if (timeout == 0)
|
||||||
|
timeout = 1;
|
||||||
|
else if (timeout > 0xFFF)
|
||||||
|
timeout = 0xFFF;
|
||||||
|
|
||||||
|
// We want to enable the watchdog with the specified timeout
|
||||||
|
uint32_t value =
|
||||||
|
WDT_MR_WDV(timeout) | // With the specified timeout
|
||||||
|
WDT_MR_WDD(timeout) | // and no invalid write window
|
||||||
|
#if !(SAMV70 || SAMV71 || SAME70 || SAMS70)
|
||||||
|
WDT_MR_WDRPROC | // WDT fault resets processor only - We want
|
||||||
|
// to keep PIO controller state
|
||||||
|
#endif
|
||||||
|
WDT_MR_WDDBGHLT | // WDT stops in debug state.
|
||||||
|
WDT_MR_WDIDLEHLT; // WDT stops in idle state.
|
||||||
|
|
||||||
|
#if ENABLED(WATCHDOG_RESET_MANUAL)
|
||||||
|
// We enable the watchdog timer, but only for the interrupt.
|
||||||
|
|
||||||
|
// Configure WDT to only trigger an interrupt
|
||||||
|
value |= WDT_MR_WDFIEN; // Enable WDT fault interrupt.
|
||||||
|
|
||||||
|
// Disable WDT interrupt (just in case, to avoid triggering it!)
|
||||||
|
NVIC_DisableIRQ(WDT_IRQn);
|
||||||
|
|
||||||
|
// We NEED memory barriers to ensure Interrupts are actually disabled!
|
||||||
|
// ( https://dzone.com/articles/nvic-disabling-interrupts-on-arm-cortex-m-and-the )
|
||||||
|
__DSB();
|
||||||
|
__ISB();
|
||||||
|
|
||||||
|
// Initialize WDT with the given parameters
|
||||||
|
WDT_Enable(WDT, value);
|
||||||
|
|
||||||
|
// Configure and enable WDT interrupt.
|
||||||
|
NVIC_ClearPendingIRQ(WDT_IRQn);
|
||||||
|
NVIC_SetPriority(WDT_IRQn, 0); // Use highest priority, so we detect all kinds of lockups
|
||||||
|
NVIC_EnableIRQ(WDT_IRQn);
|
||||||
|
|
||||||
|
#else
|
||||||
|
|
||||||
|
// a WDT fault triggers a reset
|
||||||
|
value |= WDT_MR_WDRSTEN;
|
||||||
|
|
||||||
|
// Initialize WDT with the given parameters
|
||||||
|
WDT_Enable(WDT, value);
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// Reset the watchdog
|
||||||
|
WDT_Restart(WDT);
|
||||||
|
|
||||||
|
#else
|
||||||
|
|
||||||
|
// Make sure to completely disable the Watchdog
|
||||||
|
WDT_Disable(WDT);
|
||||||
|
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
// ------------------------
|
||||||
|
// Free Memory Accessor
|
||||||
|
// ------------------------
|
||||||
|
|
||||||
extern "C" {
|
extern "C" {
|
||||||
extern unsigned int _ebss; // end of bss section
|
extern unsigned int _ebss; // end of bss section
|
||||||
}
|
}
|
||||||
@@ -82,6 +180,10 @@ int freeMemory() {
|
|||||||
return (int)&free_memory - (heap_end ?: (int)&_ebss);
|
return (int)&free_memory - (heap_end ?: (int)&_ebss);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ------------------------
|
||||||
|
// Serial Ports
|
||||||
|
// ------------------------
|
||||||
|
|
||||||
// Forward the default serial ports
|
// Forward the default serial ports
|
||||||
#if USING_HW_SERIAL0
|
#if USING_HW_SERIAL0
|
||||||
DefaultSerial1 MSerial0(false, Serial);
|
DefaultSerial1 MSerial0(false, Serial);
|
||||||
|
|||||||
@@ -32,7 +32,6 @@
|
|||||||
#include "../shared/math_32bit.h"
|
#include "../shared/math_32bit.h"
|
||||||
#include "../shared/HAL_SPI.h"
|
#include "../shared/HAL_SPI.h"
|
||||||
#include "fastio.h"
|
#include "fastio.h"
|
||||||
#include "watchdog.h"
|
|
||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
||||||
@@ -115,8 +114,8 @@ typedef Servo hal_servo_t;
|
|||||||
//
|
//
|
||||||
// Interrupts
|
// Interrupts
|
||||||
//
|
//
|
||||||
#define sei() noInterrupts()
|
#define sei() interrupts()
|
||||||
#define cli() interrupts()
|
#define cli() noInterrupts()
|
||||||
|
|
||||||
#define CRITICAL_SECTION_START() const bool _irqon = hal.isr_state(); hal.isr_off()
|
#define CRITICAL_SECTION_START() const bool _irqon = hal.isr_state(); hal.isr_off()
|
||||||
#define CRITICAL_SECTION_END() if (_irqon) hal.isr_on()
|
#define CRITICAL_SECTION_END() if (_irqon) hal.isr_on()
|
||||||
@@ -176,9 +175,13 @@ public:
|
|||||||
// Earliest possible init, before setup()
|
// Earliest possible init, before setup()
|
||||||
MarlinHAL() {}
|
MarlinHAL() {}
|
||||||
|
|
||||||
|
// Watchdog
|
||||||
|
static void watchdog_init() IF_DISABLED(USE_WATCHDOG, {});
|
||||||
|
static void watchdog_refresh() IF_DISABLED(USE_WATCHDOG, {});
|
||||||
|
|
||||||
static void init(); // Called early in setup()
|
static void init(); // Called early in setup()
|
||||||
static void init_board(); // Called less early in setup()
|
static void init_board(); // Called less early in setup()
|
||||||
static void reboot(); // Software reset
|
static void reboot(); // Restart the firmware
|
||||||
|
|
||||||
// Interrupts
|
// Interrupts
|
||||||
static bool isr_state() { return !__get_PRIMASK(); }
|
static bool isr_state() { return !__get_PRIMASK(); }
|
||||||
@@ -207,9 +210,9 @@ public:
|
|||||||
static void adc_init() {}
|
static void adc_init() {}
|
||||||
|
|
||||||
// Called by Temperature::init for each sensor at startup
|
// Called by Temperature::init for each sensor at startup
|
||||||
static void adc_enable(const uint8_t ch) {}
|
static void adc_enable(const uint8_t /*ch*/) {}
|
||||||
|
|
||||||
// Begin ADC sampling on the given channel
|
// Begin ADC sampling on the given channel. Called from Temperature::isr!
|
||||||
static void adc_start(const uint8_t ch) { adc_result = analogRead(ch); }
|
static void adc_start(const uint8_t ch) { adc_result = analogRead(ch); }
|
||||||
|
|
||||||
// Is the ADC ready for reading?
|
// Is the ADC ready for reading?
|
||||||
|
|||||||
@@ -31,8 +31,6 @@
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* HAL for Arduino Due and compatible (SAM3X8E)
|
* HAL for Arduino Due and compatible (SAM3X8E)
|
||||||
*
|
|
||||||
* For ARDUINO_ARCH_SAM
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifdef ARDUINO_ARCH_SAM
|
#ifdef ARDUINO_ARCH_SAM
|
||||||
@@ -249,12 +247,12 @@
|
|||||||
b <<= 1; // little setup time
|
b <<= 1; // little setup time
|
||||||
|
|
||||||
WRITE(SD_SCK_PIN, HIGH);
|
WRITE(SD_SCK_PIN, HIGH);
|
||||||
DELAY_NS(spiDelayNS);
|
DELAY_NS_VAR(spiDelayNS);
|
||||||
|
|
||||||
b |= (READ(SD_MISO_PIN) != 0);
|
b |= (READ(SD_MISO_PIN) != 0);
|
||||||
|
|
||||||
WRITE(SD_SCK_PIN, LOW);
|
WRITE(SD_SCK_PIN, LOW);
|
||||||
DELAY_NS(spiDelayNS);
|
DELAY_NS_VAR(spiDelayNS);
|
||||||
} while (--bits);
|
} while (--bits);
|
||||||
return b;
|
return b;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -41,7 +41,7 @@
|
|||||||
practice, we need alignment to 256 bytes to make this work in all
|
practice, we need alignment to 256 bytes to make this work in all
|
||||||
cases */
|
cases */
|
||||||
__attribute__ ((aligned(256)))
|
__attribute__ ((aligned(256)))
|
||||||
static DeviceVectors ram_tab = { nullptr };
|
static DeviceVectors ram_tab[61] = { nullptr };
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This function checks if the exception/interrupt table is already in SRAM or not.
|
* This function checks if the exception/interrupt table is already in SRAM or not.
|
||||||
|
|||||||
@@ -25,7 +25,7 @@
|
|||||||
|
|
||||||
#if ENABLED(POSTMORTEM_DEBUGGING)
|
#if ENABLED(POSTMORTEM_DEBUGGING)
|
||||||
|
|
||||||
#include "../shared/HAL_MinSerial.h"
|
#include "../shared/MinSerial.h"
|
||||||
|
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
|
|
||||||
@@ -47,12 +47,12 @@
|
|||||||
#include "../shared/servo.h"
|
#include "../shared/servo.h"
|
||||||
#include "../shared/servo_private.h"
|
#include "../shared/servo_private.h"
|
||||||
|
|
||||||
static volatile int8_t Channel[_Nbr_16timers]; // counter for the servo being pulsed for each timer (or -1 if refresh interval)
|
static Flags<_Nbr_16timers> DisablePending; // ISR should disable the timer at the next timer reset
|
||||||
|
|
||||||
// ------------------------
|
// ------------------------
|
||||||
/// Interrupt handler for the TC0 channel 1.
|
/// Interrupt handler for the TC0 channel 1.
|
||||||
// ------------------------
|
// ------------------------
|
||||||
void Servo_Handler(timer16_Sequence_t timer, Tc *pTc, uint8_t channel);
|
void Servo_Handler(const timer16_Sequence_t, Tc*, const uint8_t);
|
||||||
|
|
||||||
#ifdef _useTimer1
|
#ifdef _useTimer1
|
||||||
void HANDLER_FOR_TIMER1() { Servo_Handler(_timer1, TC_FOR_TIMER1, CHANNEL_FOR_TIMER1); }
|
void HANDLER_FOR_TIMER1() { Servo_Handler(_timer1, TC_FOR_TIMER1, CHANNEL_FOR_TIMER1); }
|
||||||
@@ -70,88 +70,92 @@ void Servo_Handler(timer16_Sequence_t timer, Tc *pTc, uint8_t channel);
|
|||||||
void HANDLER_FOR_TIMER5() { Servo_Handler(_timer5, TC_FOR_TIMER5, CHANNEL_FOR_TIMER5); }
|
void HANDLER_FOR_TIMER5() { Servo_Handler(_timer5, TC_FOR_TIMER5, CHANNEL_FOR_TIMER5); }
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void Servo_Handler(timer16_Sequence_t timer, Tc *tc, uint8_t channel) {
|
void Servo_Handler(const timer16_Sequence_t timer, Tc *tc, const uint8_t channel) {
|
||||||
// clear interrupt
|
static int8_t Channel[_Nbr_16timers]; // Servo counters to pulse (or -1 for refresh interval)
|
||||||
tc->TC_CHANNEL[channel].TC_SR;
|
int8_t cho = Channel[timer]; // Handle the prior Channel[timer] first
|
||||||
if (Channel[timer] < 0)
|
if (cho < 0) { // Channel -1 indicates the refresh interval completed...
|
||||||
tc->TC_CHANNEL[channel].TC_CCR |= TC_CCR_SWTRG; // channel set to -1 indicated that refresh interval completed so reset the timer
|
tc->TC_CHANNEL[channel].TC_CCR |= TC_CCR_SWTRG; // ...so reset the timer
|
||||||
else if (SERVO_INDEX(timer, Channel[timer]) < ServoCount && SERVO(timer, Channel[timer]).Pin.isActive)
|
if (DisablePending[timer]) {
|
||||||
extDigitalWrite(SERVO(timer, Channel[timer]).Pin.nbr, LOW); // pulse this channel low if activated
|
// Disabling only after the full servo period expires prevents
|
||||||
|
// pulses being too close together if immediately re-enabled.
|
||||||
|
DisablePending.clear(timer);
|
||||||
|
TC_Stop(tc, channel);
|
||||||
|
tc->TC_CHANNEL[channel].TC_SR; // clear interrupt
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (SERVO_INDEX(timer, cho) < ServoCount) // prior channel handled?
|
||||||
|
extDigitalWrite(SERVO(timer, cho).Pin.nbr, LOW); // pulse the prior channel LOW
|
||||||
|
|
||||||
Channel[timer]++; // increment to the next channel
|
Channel[timer] = ++cho; // go to the next channel (or 0)
|
||||||
if (SERVO_INDEX(timer, Channel[timer]) < ServoCount && Channel[timer] < SERVOS_PER_TIMER) {
|
if (cho < SERVOS_PER_TIMER && SERVO_INDEX(timer, cho) < ServoCount) {
|
||||||
tc->TC_CHANNEL[channel].TC_RA = tc->TC_CHANNEL[channel].TC_CV + SERVO(timer,Channel[timer]).ticks;
|
tc->TC_CHANNEL[channel].TC_RA = tc->TC_CHANNEL[channel].TC_CV + SERVO(timer, cho).ticks;
|
||||||
if (SERVO(timer,Channel[timer]).Pin.isActive) // check if activated
|
if (SERVO(timer, cho).Pin.isActive) // activated?
|
||||||
extDigitalWrite(SERVO(timer, Channel[timer]).Pin.nbr, HIGH); // its an active channel so pulse it high
|
extDigitalWrite(SERVO(timer, cho).Pin.nbr, HIGH); // yes: pulse HIGH
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
// finished all channels so wait for the refresh period to expire before starting over
|
// finished all channels so wait for the refresh period to expire before starting over
|
||||||
tc->TC_CHANNEL[channel].TC_RA =
|
const unsigned int cval = tc->TC_CHANNEL[channel].TC_CV + 128 / (SERVO_TIMER_PRESCALER), // allow 128 cycles to ensure the next CV not missed
|
||||||
tc->TC_CHANNEL[channel].TC_CV < usToTicks(REFRESH_INTERVAL) - 4
|
ival = (unsigned int)usToTicks(REFRESH_INTERVAL); // at least REFRESH_INTERVAL has elapsed
|
||||||
? (unsigned int)usToTicks(REFRESH_INTERVAL) // allow a few ticks to ensure the next OCR1A not missed
|
tc->TC_CHANNEL[channel].TC_RA = max(cval, ival);
|
||||||
: tc->TC_CHANNEL[channel].TC_CV + 4; // at least REFRESH_INTERVAL has elapsed
|
|
||||||
Channel[timer] = -1; // this will get incremented at the end of the refresh period to start again at the first channel
|
Channel[timer] = -1; // reset the timer CCR on the next call
|
||||||
}
|
}
|
||||||
|
|
||||||
|
tc->TC_CHANNEL[channel].TC_SR; // clear interrupt
|
||||||
}
|
}
|
||||||
|
|
||||||
static void _initISR(Tc *tc, uint32_t channel, uint32_t id, IRQn_Type irqn) {
|
static void _initISR(Tc *tc, uint32_t channel, uint32_t id, IRQn_Type irqn) {
|
||||||
pmc_enable_periph_clk(id);
|
pmc_enable_periph_clk(id);
|
||||||
TC_Configure(tc, channel,
|
TC_Configure(tc, channel,
|
||||||
TC_CMR_TCCLKS_TIMER_CLOCK3 | // MCK/32
|
TC_CMR_WAVE // Waveform mode
|
||||||
TC_CMR_WAVE | // Waveform mode
|
| TC_CMR_WAVSEL_UP_RC // Counter running up and reset when equal to RC
|
||||||
TC_CMR_WAVSEL_UP_RC ); // Counter running up and reset when equals to RC
|
| (SERVO_TIMER_PRESCALER == 2 ? TC_CMR_TCCLKS_TIMER_CLOCK1 : 0) // MCK/2
|
||||||
|
| (SERVO_TIMER_PRESCALER == 8 ? TC_CMR_TCCLKS_TIMER_CLOCK2 : 0) // MCK/8
|
||||||
|
| (SERVO_TIMER_PRESCALER == 32 ? TC_CMR_TCCLKS_TIMER_CLOCK3 : 0) // MCK/32
|
||||||
|
| (SERVO_TIMER_PRESCALER == 128 ? TC_CMR_TCCLKS_TIMER_CLOCK4 : 0) // MCK/128
|
||||||
|
);
|
||||||
|
|
||||||
/* 84MHz, MCK/32, for 1.5ms: 3937 */
|
// Wait 1ms before the first ISR
|
||||||
TC_SetRA(tc, channel, 2625); // 1ms
|
TC_SetRA(tc, channel, (F_CPU) / (SERVO_TIMER_PRESCALER) / 1000UL); // 1ms
|
||||||
|
|
||||||
/* Configure and enable interrupt */
|
// Configure and enable interrupt
|
||||||
NVIC_EnableIRQ(irqn);
|
NVIC_EnableIRQ(irqn);
|
||||||
// TC_IER_CPAS: RA Compare
|
tc->TC_CHANNEL[channel].TC_IER = TC_IER_CPAS; // TC_IER_CPAS: RA Compare
|
||||||
tc->TC_CHANNEL[channel].TC_IER = TC_IER_CPAS;
|
|
||||||
|
|
||||||
// Enables the timer clock and performs a software reset to start the counting
|
// Enables the timer clock and performs a software reset to start the counting
|
||||||
TC_Start(tc, channel);
|
TC_Start(tc, channel);
|
||||||
}
|
}
|
||||||
|
|
||||||
void initISR(timer16_Sequence_t timer) {
|
void initISR(const timer16_Sequence_t timer_index) {
|
||||||
|
CRITICAL_SECTION_START();
|
||||||
|
const bool disable_soon = DisablePending[timer_index];
|
||||||
|
DisablePending.clear(timer_index);
|
||||||
|
CRITICAL_SECTION_END();
|
||||||
|
|
||||||
|
if (!disable_soon) switch (timer_index) {
|
||||||
|
default: break;
|
||||||
#ifdef _useTimer1
|
#ifdef _useTimer1
|
||||||
if (timer == _timer1)
|
case _timer1: return _initISR(TC_FOR_TIMER1, CHANNEL_FOR_TIMER1, ID_TC_FOR_TIMER1, IRQn_FOR_TIMER1);
|
||||||
_initISR(TC_FOR_TIMER1, CHANNEL_FOR_TIMER1, ID_TC_FOR_TIMER1, IRQn_FOR_TIMER1);
|
|
||||||
#endif
|
#endif
|
||||||
#ifdef _useTimer2
|
#ifdef _useTimer2
|
||||||
if (timer == _timer2)
|
case _timer2: return _initISR(TC_FOR_TIMER2, CHANNEL_FOR_TIMER2, ID_TC_FOR_TIMER2, IRQn_FOR_TIMER2);
|
||||||
_initISR(TC_FOR_TIMER2, CHANNEL_FOR_TIMER2, ID_TC_FOR_TIMER2, IRQn_FOR_TIMER2);
|
|
||||||
#endif
|
#endif
|
||||||
#ifdef _useTimer3
|
#ifdef _useTimer3
|
||||||
if (timer == _timer3)
|
case _timer3: return _initISR(TC_FOR_TIMER3, CHANNEL_FOR_TIMER3, ID_TC_FOR_TIMER3, IRQn_FOR_TIMER3);
|
||||||
_initISR(TC_FOR_TIMER3, CHANNEL_FOR_TIMER3, ID_TC_FOR_TIMER3, IRQn_FOR_TIMER3);
|
|
||||||
#endif
|
#endif
|
||||||
#ifdef _useTimer4
|
#ifdef _useTimer4
|
||||||
if (timer == _timer4)
|
case _timer4: return _initISR(TC_FOR_TIMER4, CHANNEL_FOR_TIMER4, ID_TC_FOR_TIMER4, IRQn_FOR_TIMER4);
|
||||||
_initISR(TC_FOR_TIMER4, CHANNEL_FOR_TIMER4, ID_TC_FOR_TIMER4, IRQn_FOR_TIMER4);
|
|
||||||
#endif
|
#endif
|
||||||
#ifdef _useTimer5
|
#ifdef _useTimer5
|
||||||
if (timer == _timer5)
|
case _timer5: return _initISR(TC_FOR_TIMER5, CHANNEL_FOR_TIMER5, ID_TC_FOR_TIMER5, IRQn_FOR_TIMER5);
|
||||||
_initISR(TC_FOR_TIMER5, CHANNEL_FOR_TIMER5, ID_TC_FOR_TIMER5, IRQn_FOR_TIMER5);
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void finISR(timer16_Sequence_t) {
|
void finISR(const timer16_Sequence_t timer_index) {
|
||||||
#ifdef _useTimer1
|
// Timer is disabled from the ISR, to ensure proper final pulse length.
|
||||||
TC_Stop(TC_FOR_TIMER1, CHANNEL_FOR_TIMER1);
|
DisablePending.set(timer_index);
|
||||||
#endif
|
|
||||||
#ifdef _useTimer2
|
|
||||||
TC_Stop(TC_FOR_TIMER2, CHANNEL_FOR_TIMER2);
|
|
||||||
#endif
|
|
||||||
#ifdef _useTimer3
|
|
||||||
TC_Stop(TC_FOR_TIMER3, CHANNEL_FOR_TIMER3);
|
|
||||||
#endif
|
|
||||||
#ifdef _useTimer4
|
|
||||||
TC_Stop(TC_FOR_TIMER4, CHANNEL_FOR_TIMER4);
|
|
||||||
#endif
|
|
||||||
#ifdef _useTimer5
|
|
||||||
TC_Stop(TC_FOR_TIMER5, CHANNEL_FOR_TIMER5);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // HAS_SERVOS
|
#endif // HAS_SERVOS
|
||||||
|
|||||||
@@ -37,7 +37,7 @@
|
|||||||
#define _useTimer5
|
#define _useTimer5
|
||||||
|
|
||||||
#define TRIM_DURATION 2 // compensation ticks to trim adjust for digitalWrite delays
|
#define TRIM_DURATION 2 // compensation ticks to trim adjust for digitalWrite delays
|
||||||
#define SERVO_TIMER_PRESCALER 32 // timer prescaler
|
#define SERVO_TIMER_PRESCALER 2 // timer prescaler
|
||||||
|
|
||||||
/*
|
/*
|
||||||
TC0, chan 0 => TC0_Handler
|
TC0, chan 0 => TC0_Handler
|
||||||
|
|||||||
@@ -199,8 +199,7 @@ static bool ee_PageWrite(uint16_t page, const void *data) {
|
|||||||
for (i = 0; i <PageSize >> 2; i++)
|
for (i = 0; i <PageSize >> 2; i++)
|
||||||
pageContents[i] = (((uint32_t*)data)[i]) | (~(pageContents[i] ^ ((uint32_t*)data)[i]));
|
pageContents[i] = (((uint32_t*)data)[i]) | (~(pageContents[i] ^ ((uint32_t*)data)[i]));
|
||||||
|
|
||||||
DEBUG_ECHO_START();
|
DEBUG_ECHO_MSG("EEPROM PageWrite ", page);
|
||||||
DEBUG_ECHOLNPGM("EEPROM PageWrite ", page);
|
|
||||||
DEBUG_ECHOLNPGM(" in FLASH address ", (uint32_t)addrflash);
|
DEBUG_ECHOLNPGM(" in FLASH address ", (uint32_t)addrflash);
|
||||||
DEBUG_ECHOLNPGM(" base address ", (uint32_t)getFlashStorage(0));
|
DEBUG_ECHOLNPGM(" base address ", (uint32_t)getFlashStorage(0));
|
||||||
DEBUG_FLUSH();
|
DEBUG_FLUSH();
|
||||||
@@ -245,8 +244,7 @@ static bool ee_PageWrite(uint16_t page, const void *data) {
|
|||||||
// Reenable interrupts
|
// Reenable interrupts
|
||||||
__enable_irq();
|
__enable_irq();
|
||||||
|
|
||||||
DEBUG_ECHO_START();
|
DEBUG_ECHO_MSG("EEPROM Unlock failure for page ", page);
|
||||||
DEBUG_ECHOLNPGM("EEPROM Unlock failure for page ", page);
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -270,8 +268,7 @@ static bool ee_PageWrite(uint16_t page, const void *data) {
|
|||||||
// Reenable interrupts
|
// Reenable interrupts
|
||||||
__enable_irq();
|
__enable_irq();
|
||||||
|
|
||||||
DEBUG_ECHO_START();
|
DEBUG_ECHO_MSG("EEPROM Write failure for page ", page);
|
||||||
DEBUG_ECHOLNPGM("EEPROM Write failure for page ", page);
|
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -286,8 +283,7 @@ static bool ee_PageWrite(uint16_t page, const void *data) {
|
|||||||
if (memcmp(getFlashStorage(page),data,PageSize)) {
|
if (memcmp(getFlashStorage(page),data,PageSize)) {
|
||||||
|
|
||||||
#ifdef EE_EMU_DEBUG
|
#ifdef EE_EMU_DEBUG
|
||||||
DEBUG_ECHO_START();
|
DEBUG_ECHO_MSG("EEPROM Verify Write failure for page ", page);
|
||||||
DEBUG_ECHOLNPGM("EEPROM Verify Write failure for page ", page);
|
|
||||||
|
|
||||||
ee_Dump( page, (uint32_t *)addrflash);
|
ee_Dump( page, (uint32_t *)addrflash);
|
||||||
ee_Dump(-page, data);
|
ee_Dump(-page, data);
|
||||||
@@ -325,8 +321,7 @@ static bool ee_PageErase(uint16_t page) {
|
|||||||
uint16_t i;
|
uint16_t i;
|
||||||
uint32_t addrflash = uint32_t(getFlashStorage(page));
|
uint32_t addrflash = uint32_t(getFlashStorage(page));
|
||||||
|
|
||||||
DEBUG_ECHO_START();
|
DEBUG_ECHO_MSG("EEPROM PageErase ", page);
|
||||||
DEBUG_ECHOLNPGM("EEPROM PageErase ", page);
|
|
||||||
DEBUG_ECHOLNPGM(" in FLASH address ", (uint32_t)addrflash);
|
DEBUG_ECHOLNPGM(" in FLASH address ", (uint32_t)addrflash);
|
||||||
DEBUG_ECHOLNPGM(" base address ", (uint32_t)getFlashStorage(0));
|
DEBUG_ECHOLNPGM(" base address ", (uint32_t)getFlashStorage(0));
|
||||||
DEBUG_FLUSH();
|
DEBUG_FLUSH();
|
||||||
@@ -370,8 +365,7 @@ static bool ee_PageErase(uint16_t page) {
|
|||||||
// Reenable interrupts
|
// Reenable interrupts
|
||||||
__enable_irq();
|
__enable_irq();
|
||||||
|
|
||||||
DEBUG_ECHO_START();
|
DEBUG_ECHO_MSG("EEPROM Unlock failure for page ",page);
|
||||||
DEBUG_ECHOLNPGM("EEPROM Unlock failure for page ",page);
|
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -394,8 +388,7 @@ static bool ee_PageErase(uint16_t page) {
|
|||||||
// Reenable interrupts
|
// Reenable interrupts
|
||||||
__enable_irq();
|
__enable_irq();
|
||||||
|
|
||||||
DEBUG_ECHO_START();
|
DEBUG_ECHO_MSG("EEPROM Erase failure for page ",page);
|
||||||
DEBUG_ECHOLNPGM("EEPROM Erase failure for page ",page);
|
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -410,8 +403,7 @@ static bool ee_PageErase(uint16_t page) {
|
|||||||
uint32_t * aligned_src = (uint32_t *) addrflash;
|
uint32_t * aligned_src = (uint32_t *) addrflash;
|
||||||
for (i = 0; i < PageSize >> 2; i++) {
|
for (i = 0; i < PageSize >> 2; i++) {
|
||||||
if (*aligned_src++ != 0xFFFFFFFF) {
|
if (*aligned_src++ != 0xFFFFFFFF) {
|
||||||
DEBUG_ECHO_START();
|
DEBUG_ECHO_MSG("EEPROM Verify Erase failure for page ",page);
|
||||||
DEBUG_ECHOLNPGM("EEPROM Verify Erase failure for page ",page);
|
|
||||||
ee_Dump(page, (uint32_t *)addrflash);
|
ee_Dump(page, (uint32_t *)addrflash);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -921,8 +913,7 @@ static void ee_Init() {
|
|||||||
// If all groups seem to be used, default to first group
|
// If all groups seem to be used, default to first group
|
||||||
if (curGroup >= GroupCount) curGroup = 0;
|
if (curGroup >= GroupCount) curGroup = 0;
|
||||||
|
|
||||||
DEBUG_ECHO_START();
|
DEBUG_ECHO_MSG("EEPROM Current Group: ",curGroup);
|
||||||
DEBUG_ECHOLNPGM("EEPROM Current Group: ",curGroup);
|
|
||||||
DEBUG_FLUSH();
|
DEBUG_FLUSH();
|
||||||
|
|
||||||
// Now, validate that all the other group pages are empty
|
// Now, validate that all the other group pages are empty
|
||||||
@@ -931,8 +922,7 @@ static void ee_Init() {
|
|||||||
|
|
||||||
for (int page = 0; page < PagesPerGroup; page++) {
|
for (int page = 0; page < PagesPerGroup; page++) {
|
||||||
if (!ee_IsPageClean(grp * PagesPerGroup + page)) {
|
if (!ee_IsPageClean(grp * PagesPerGroup + page)) {
|
||||||
DEBUG_ECHO_START();
|
DEBUG_ECHO_MSG("EEPROM Page ", page, " not clean on group ", grp);
|
||||||
DEBUG_ECHOLNPGM("EEPROM Page ", page, " not clean on group ", grp);
|
|
||||||
DEBUG_FLUSH();
|
DEBUG_FLUSH();
|
||||||
ee_PageErase(grp * PagesPerGroup + page);
|
ee_PageErase(grp * PagesPerGroup + page);
|
||||||
}
|
}
|
||||||
@@ -948,15 +938,13 @@ static void ee_Init() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
DEBUG_ECHO_START();
|
DEBUG_ECHO_MSG("EEPROM Active page: ", curPage);
|
||||||
DEBUG_ECHOLNPGM("EEPROM Active page: ", curPage);
|
|
||||||
DEBUG_FLUSH();
|
DEBUG_FLUSH();
|
||||||
|
|
||||||
// Make sure the pages following the first clean one are also clean
|
// Make sure the pages following the first clean one are also clean
|
||||||
for (int page = curPage + 1; page < PagesPerGroup; page++) {
|
for (int page = curPage + 1; page < PagesPerGroup; page++) {
|
||||||
if (!ee_IsPageClean(curGroup * PagesPerGroup + page)) {
|
if (!ee_IsPageClean(curGroup * PagesPerGroup + page)) {
|
||||||
DEBUG_ECHO_START();
|
DEBUG_ECHO_MSG("EEPROM Page ", page, " not clean on active group ", curGroup);
|
||||||
DEBUG_ECHOLNPGM("EEPROM Page ", page, " not clean on active group ", curGroup);
|
|
||||||
DEBUG_FLUSH();
|
DEBUG_FLUSH();
|
||||||
ee_Dump(curGroup * PagesPerGroup + page, getFlashStorage(curGroup * PagesPerGroup + page));
|
ee_Dump(curGroup * PagesPerGroup + page, getFlashStorage(curGroup * PagesPerGroup + page));
|
||||||
ee_PageErase(curGroup * PagesPerGroup + page);
|
ee_PageErase(curGroup * PagesPerGroup + page);
|
||||||
|
|||||||
@@ -25,6 +25,30 @@
|
|||||||
* Test Arduino Due specific configuration values for errors at compile-time.
|
* Test Arduino Due specific configuration values for errors at compile-time.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check for common serial pin conflicts
|
||||||
|
*/
|
||||||
|
#define CHECK_SERIAL_PIN(N) ( \
|
||||||
|
X_STOP_PIN == N || Y_STOP_PIN == N || Z_STOP_PIN == N \
|
||||||
|
|| X_MIN_PIN == N || Y_MIN_PIN == N || Z_MIN_PIN == N \
|
||||||
|
|| X_MAX_PIN == N || Y_MAX_PIN == N || Z_MAX_PIN == N \
|
||||||
|
|| X_STEP_PIN == N || Y_STEP_PIN == N || Z_STEP_PIN == N \
|
||||||
|
|| X_DIR_PIN == N || Y_DIR_PIN == N || Z_DIR_PIN == N \
|
||||||
|
|| X_ENA_PIN == N || Y_ENA_PIN == N || Z_ENA_PIN == N \
|
||||||
|
)
|
||||||
|
#if CONF_SERIAL_IS(0) // D0-D1. No known conflicts.
|
||||||
|
#endif
|
||||||
|
#if CONF_SERIAL_IS(1) && (CHECK_SERIAL_PIN(18) || CHECK_SERIAL_PIN(19))
|
||||||
|
#error "Serial Port 1 pin D18 and/or D19 conflicts with another pin on the board."
|
||||||
|
#endif
|
||||||
|
#if CONF_SERIAL_IS(2) && (CHECK_SERIAL_PIN(16) || CHECK_SERIAL_PIN(17))
|
||||||
|
#error "Serial Port 2 pin D16 and/or D17 conflicts with another pin on the board."
|
||||||
|
#endif
|
||||||
|
#if CONF_SERIAL_IS(3) && (CHECK_SERIAL_PIN(14) || CHECK_SERIAL_PIN(15))
|
||||||
|
#error "Serial Port 3 pin D14 and/or D15 conflicts with another pin on the board."
|
||||||
|
#endif
|
||||||
|
#undef CHECK_SERIAL_PIN
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* HARDWARE VS. SOFTWARE SPI COMPATIBILITY
|
* HARDWARE VS. SOFTWARE SPI COMPATIBILITY
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -70,7 +70,7 @@
|
|||||||
#define PRINT_PIN_ANALOG(p) do{ sprintf_P(buffer, PSTR(" (A%2d) "), DIGITAL_PIN_TO_ANALOG_PIN(pin)); SERIAL_ECHO(buffer); }while(0)
|
#define PRINT_PIN_ANALOG(p) do{ sprintf_P(buffer, PSTR(" (A%2d) "), DIGITAL_PIN_TO_ANALOG_PIN(pin)); SERIAL_ECHO(buffer); }while(0)
|
||||||
#define GET_ARRAY_PIN(p) pin_array[p].pin
|
#define GET_ARRAY_PIN(p) pin_array[p].pin
|
||||||
#define GET_ARRAY_IS_DIGITAL(p) pin_array[p].is_digital
|
#define GET_ARRAY_IS_DIGITAL(p) pin_array[p].is_digital
|
||||||
#define VALID_PIN(pin) (pin >= 0 && pin < (int8_t)NUMBER_PINS_TOTAL ? 1 : 0)
|
#define VALID_PIN(pin) (pin >= 0 && pin < int8_t(NUMBER_PINS_TOTAL))
|
||||||
#define DIGITAL_PIN_TO_ANALOG_PIN(p) int(p - analogInputToDigitalPin(0))
|
#define DIGITAL_PIN_TO_ANALOG_PIN(p) int(p - analogInputToDigitalPin(0))
|
||||||
#define IS_ANALOG(P) WITHIN(P, char(analogInputToDigitalPin(0)), char(analogInputToDigitalPin(NUM_ANALOG_INPUTS - 1)))
|
#define IS_ANALOG(P) WITHIN(P, char(analogInputToDigitalPin(0)), char(analogInputToDigitalPin(NUM_ANALOG_INPUTS - 1)))
|
||||||
#define pwm_status(pin) (((g_pinStatus[pin] & 0xF) == PIN_STATUS_PWM) && \
|
#define pwm_status(pin) (((g_pinStatus[pin] & 0xF) == PIN_STATUS_PWM) && \
|
||||||
@@ -86,7 +86,6 @@ bool GET_PINMODE(int8_t pin) { // 1: output, 0: input
|
|||||||
|| pwm_status(pin));
|
|| pwm_status(pin));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void pwm_details(int32_t pin) {
|
void pwm_details(int32_t pin) {
|
||||||
if (pwm_status(pin)) {
|
if (pwm_status(pin)) {
|
||||||
uint32_t chan = g_APinDescription[pin].ulPWMChannel;
|
uint32_t chan = g_APinDescription[pin].ulPWMChannel;
|
||||||
|
|||||||
@@ -89,10 +89,17 @@ void HAL_timer_start(const uint8_t timer_num, const uint32_t frequency) {
|
|||||||
NVIC_SetPriority(irq, timer_config[timer_num].priority);
|
NVIC_SetPriority(irq, timer_config[timer_num].priority);
|
||||||
|
|
||||||
// wave mode, reset counter on match with RC,
|
// wave mode, reset counter on match with RC,
|
||||||
TC_Configure(tc, channel, TC_CMR_WAVE | TC_CMR_WAVSEL_UP_RC | TC_CMR_TCCLKS_TIMER_CLOCK1);
|
TC_Configure(tc, channel,
|
||||||
|
TC_CMR_WAVE
|
||||||
|
| TC_CMR_WAVSEL_UP_RC
|
||||||
|
| (HAL_TIMER_PRESCALER == 2 ? TC_CMR_TCCLKS_TIMER_CLOCK1 : 0)
|
||||||
|
| (HAL_TIMER_PRESCALER == 8 ? TC_CMR_TCCLKS_TIMER_CLOCK2 : 0)
|
||||||
|
| (HAL_TIMER_PRESCALER == 32 ? TC_CMR_TCCLKS_TIMER_CLOCK3 : 0)
|
||||||
|
| (HAL_TIMER_PRESCALER == 128 ? TC_CMR_TCCLKS_TIMER_CLOCK4 : 0)
|
||||||
|
);
|
||||||
|
|
||||||
// Set compare value
|
// Set compare value
|
||||||
TC_SetRC(tc, channel, VARIANT_MCK / 2 / frequency);
|
TC_SetRC(tc, channel, VARIANT_MCK / (HAL_TIMER_PRESCALER) / frequency);
|
||||||
|
|
||||||
// And start timer
|
// And start timer
|
||||||
TC_Start(tc, channel);
|
TC_Start(tc, channel);
|
||||||
|
|||||||
@@ -35,7 +35,8 @@
|
|||||||
typedef uint32_t hal_timer_t;
|
typedef uint32_t hal_timer_t;
|
||||||
#define HAL_TIMER_TYPE_MAX 0xFFFFFFFF
|
#define HAL_TIMER_TYPE_MAX 0xFFFFFFFF
|
||||||
|
|
||||||
#define HAL_TIMER_RATE ((F_CPU) / 2) // frequency of timers peripherals
|
#define HAL_TIMER_PRESCALER 2
|
||||||
|
#define HAL_TIMER_RATE ((F_CPU) / (HAL_TIMER_PRESCALER)) // frequency of timers peripherals
|
||||||
|
|
||||||
#ifndef MF_TIMER_STEP
|
#ifndef MF_TIMER_STEP
|
||||||
#define MF_TIMER_STEP 2 // Timer Index for Stepper
|
#define MF_TIMER_STEP 2 // Timer Index for Stepper
|
||||||
|
|||||||
@@ -1059,7 +1059,7 @@ static inline void convert_64_bit_to_byte_array(uint64_t value, uint8_t *data)
|
|||||||
while (val_index < 8)
|
while (val_index < 8)
|
||||||
{
|
{
|
||||||
data[val_index++] = value & 0xFF;
|
data[val_index++] = value & 0xFF;
|
||||||
value = value >> 8;
|
value >>= 8;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -62,7 +62,7 @@ void usb_task_idle(void) {
|
|||||||
// Attend SD card access from the USB MSD -- Prioritize access to improve speed
|
// Attend SD card access from the USB MSD -- Prioritize access to improve speed
|
||||||
int delay = 2;
|
int delay = 2;
|
||||||
while (main_b_msc_enable && --delay > 0) {
|
while (main_b_msc_enable && --delay > 0) {
|
||||||
if (udi_msc_process_trans()) delay = 10000;
|
if (udi_msc_process_trans()) delay = 20;
|
||||||
|
|
||||||
// Reset the watchdog, just to be sure
|
// Reset the watchdog, just to be sure
|
||||||
REG_WDT_CR = WDT_CR_WDRSTT | WDT_CR_KEY(0xA5);
|
REG_WDT_CR = WDT_CR_WDRSTT | WDT_CR_KEY(0xA5);
|
||||||
|
|||||||
@@ -1,114 +0,0 @@
|
|||||||
/**
|
|
||||||
* Marlin 3D Printer Firmware
|
|
||||||
* Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
|
|
||||||
*
|
|
||||||
* Based on Sprinter and grbl.
|
|
||||||
* Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
|
|
||||||
*
|
|
||||||
* This program is free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
#ifdef ARDUINO_ARCH_SAM
|
|
||||||
|
|
||||||
#include "../../inc/MarlinConfig.h"
|
|
||||||
#include "../../MarlinCore.h"
|
|
||||||
#include "watchdog.h"
|
|
||||||
|
|
||||||
// Override Arduino runtime to either config or disable the watchdog
|
|
||||||
//
|
|
||||||
// We need to configure the watchdog as soon as possible in the boot
|
|
||||||
// process, because watchdog initialization at hardware reset on SAM3X8E
|
|
||||||
// is unreliable, and there is risk of unintended resets if we delay
|
|
||||||
// that initialization to a later time.
|
|
||||||
void watchdogSetup() {
|
|
||||||
|
|
||||||
#if ENABLED(USE_WATCHDOG)
|
|
||||||
|
|
||||||
// 4 seconds timeout
|
|
||||||
uint32_t timeout = TERN(WATCHDOG_DURATION_8S, 8000, 4000);
|
|
||||||
|
|
||||||
// Calculate timeout value in WDT counter ticks: This assumes
|
|
||||||
// the slow clock is running at 32.768 kHz watchdog
|
|
||||||
// frequency is therefore 32768 / 128 = 256 Hz
|
|
||||||
timeout = (timeout << 8) / 1000;
|
|
||||||
if (timeout == 0)
|
|
||||||
timeout = 1;
|
|
||||||
else if (timeout > 0xFFF)
|
|
||||||
timeout = 0xFFF;
|
|
||||||
|
|
||||||
// We want to enable the watchdog with the specified timeout
|
|
||||||
uint32_t value =
|
|
||||||
WDT_MR_WDV(timeout) | // With the specified timeout
|
|
||||||
WDT_MR_WDD(timeout) | // and no invalid write window
|
|
||||||
#if !(SAMV70 || SAMV71 || SAME70 || SAMS70)
|
|
||||||
WDT_MR_WDRPROC | // WDT fault resets processor only - We want
|
|
||||||
// to keep PIO controller state
|
|
||||||
#endif
|
|
||||||
WDT_MR_WDDBGHLT | // WDT stops in debug state.
|
|
||||||
WDT_MR_WDIDLEHLT; // WDT stops in idle state.
|
|
||||||
|
|
||||||
#if ENABLED(WATCHDOG_RESET_MANUAL)
|
|
||||||
// We enable the watchdog timer, but only for the interrupt.
|
|
||||||
|
|
||||||
// Configure WDT to only trigger an interrupt
|
|
||||||
value |= WDT_MR_WDFIEN; // Enable WDT fault interrupt.
|
|
||||||
|
|
||||||
// Disable WDT interrupt (just in case, to avoid triggering it!)
|
|
||||||
NVIC_DisableIRQ(WDT_IRQn);
|
|
||||||
|
|
||||||
// We NEED memory barriers to ensure Interrupts are actually disabled!
|
|
||||||
// ( https://dzone.com/articles/nvic-disabling-interrupts-on-arm-cortex-m-and-the )
|
|
||||||
__DSB();
|
|
||||||
__ISB();
|
|
||||||
|
|
||||||
// Initialize WDT with the given parameters
|
|
||||||
WDT_Enable(WDT, value);
|
|
||||||
|
|
||||||
// Configure and enable WDT interrupt.
|
|
||||||
NVIC_ClearPendingIRQ(WDT_IRQn);
|
|
||||||
NVIC_SetPriority(WDT_IRQn, 0); // Use highest priority, so we detect all kinds of lockups
|
|
||||||
NVIC_EnableIRQ(WDT_IRQn);
|
|
||||||
|
|
||||||
#else
|
|
||||||
|
|
||||||
// a WDT fault triggers a reset
|
|
||||||
value |= WDT_MR_WDRSTEN;
|
|
||||||
|
|
||||||
// Initialize WDT with the given parameters
|
|
||||||
WDT_Enable(WDT, value);
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// Reset the watchdog
|
|
||||||
WDT_Restart(WDT);
|
|
||||||
|
|
||||||
#else
|
|
||||||
|
|
||||||
// Make sure to completely disable the Watchdog
|
|
||||||
WDT_Disable(WDT);
|
|
||||||
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
#if ENABLED(USE_WATCHDOG)
|
|
||||||
// Initialize watchdog - On SAM3X, Watchdog was already configured
|
|
||||||
// and enabled or disabled at startup, so no need to reconfigure it
|
|
||||||
// here.
|
|
||||||
void watchdog_init() {
|
|
||||||
// Reset watchdog to start clean
|
|
||||||
WDT_Restart(WDT);
|
|
||||||
}
|
|
||||||
#endif // USE_WATCHDOG
|
|
||||||
|
|
||||||
#endif
|
|
||||||
@@ -65,6 +65,7 @@ portMUX_TYPE MarlinHAL::spinlock = portMUX_INITIALIZER_UNLOCKED;
|
|||||||
// ------------------------
|
// ------------------------
|
||||||
|
|
||||||
uint16_t MarlinHAL::adc_result;
|
uint16_t MarlinHAL::adc_result;
|
||||||
|
pwm_pin_t MarlinHAL::pwm_pin_data[MAX_EXPANDER_BITS];
|
||||||
|
|
||||||
// ------------------------
|
// ------------------------
|
||||||
// Private Variables
|
// Private Variables
|
||||||
@@ -179,6 +180,31 @@ void _delay_ms(int delay_ms) { delay(delay_ms); }
|
|||||||
// return free memory between end of heap (or end bss) and whatever is current
|
// return free memory between end of heap (or end bss) and whatever is current
|
||||||
int MarlinHAL::freeMemory() { return ESP.getFreeHeap(); }
|
int MarlinHAL::freeMemory() { return ESP.getFreeHeap(); }
|
||||||
|
|
||||||
|
// ------------------------
|
||||||
|
// Watchdog Timer
|
||||||
|
// ------------------------
|
||||||
|
|
||||||
|
#if ENABLED(USE_WATCHDOG)
|
||||||
|
|
||||||
|
#define WDT_TIMEOUT_US TERN(WATCHDOG_DURATION_8S, 8000000, 4000000) // 4 or 8 second timeout
|
||||||
|
|
||||||
|
extern "C" {
|
||||||
|
esp_err_t esp_task_wdt_reset();
|
||||||
|
}
|
||||||
|
|
||||||
|
void watchdogSetup() {
|
||||||
|
// do whatever. don't remove this function.
|
||||||
|
}
|
||||||
|
|
||||||
|
void MarlinHAL::watchdog_init() {
|
||||||
|
// TODO
|
||||||
|
}
|
||||||
|
|
||||||
|
// Reset watchdog.
|
||||||
|
void MarlinHAL::watchdog_refresh() { esp_task_wdt_reset(); }
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
// ------------------------
|
// ------------------------
|
||||||
// ADC
|
// ADC
|
||||||
// ------------------------
|
// ------------------------
|
||||||
@@ -244,7 +270,8 @@ void MarlinHAL::adc_start(const pin_t pin) {
|
|||||||
const adc1_channel_t chan = get_channel(pin);
|
const adc1_channel_t chan = get_channel(pin);
|
||||||
uint32_t mv;
|
uint32_t mv;
|
||||||
esp_adc_cal_get_voltage((adc_channel_t)chan, &characteristics[attenuations[chan]], &mv);
|
esp_adc_cal_get_voltage((adc_channel_t)chan, &characteristics[attenuations[chan]], &mv);
|
||||||
adc_result = mv * 1023.0f / float(ADC_REFERENCE_VOLTAGE) / 1000.0f;
|
|
||||||
|
adc_result = mv * isr_float_t(1023) / isr_float_t(ADC_REFERENCE_VOLTAGE) / isr_float_t(1000);
|
||||||
|
|
||||||
// Change the attenuation level based on the new reading
|
// Change the attenuation level based on the new reading
|
||||||
adc_atten_t atten;
|
adc_atten_t atten;
|
||||||
@@ -304,14 +331,38 @@ int8_t get_pwm_channel(const pin_t pin, const uint32_t freq, const uint16_t res)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void MarlinHAL::set_pwm_duty(const pin_t pin, const uint16_t v, const uint16_t v_size/*=_BV(PWM_RESOLUTION)-1*/, const bool invert/*=false*/) {
|
void MarlinHAL::set_pwm_duty(const pin_t pin, const uint16_t v, const uint16_t v_size/*=_BV(PWM_RESOLUTION)-1*/, const bool invert/*=false*/) {
|
||||||
|
#if ENABLED(I2S_STEPPER_STREAM)
|
||||||
|
if (pin > 127) {
|
||||||
|
const uint8_t pinlo = pin & 0x7F;
|
||||||
|
pwm_pin_t &pindata = pwm_pin_data[pinlo];
|
||||||
|
const uint32_t duty = map(invert ? v_size - v : v, 0, v_size, 0, pindata.pwm_cycle_ticks);
|
||||||
|
if (duty == 0 || duty == pindata.pwm_cycle_ticks) { // max or min (i.e., on/off)
|
||||||
|
pindata.pwm_duty_ticks = 0; // turn off PWM for this pin
|
||||||
|
duty ? SBI32(i2s_port_data, pinlo) : CBI32(i2s_port_data, pinlo); // set pin level
|
||||||
|
}
|
||||||
|
else
|
||||||
|
pindata.pwm_duty_ticks = duty; // PWM duty count = # of 4µs ticks per full PWM cycle
|
||||||
|
}
|
||||||
|
else
|
||||||
|
#endif
|
||||||
|
{
|
||||||
const int8_t cid = get_pwm_channel(pin, PWM_FREQUENCY, PWM_RESOLUTION);
|
const int8_t cid = get_pwm_channel(pin, PWM_FREQUENCY, PWM_RESOLUTION);
|
||||||
if (cid >= 0) {
|
if (cid >= 0) {
|
||||||
uint32_t duty = map(invert ? v_size - v : v, 0, v_size, 0, _BV(PWM_RESOLUTION)-1);
|
const uint32_t duty = map(invert ? v_size - v : v, 0, v_size, 0, _BV(PWM_RESOLUTION)-1);
|
||||||
ledcWrite(cid, duty);
|
ledcWrite(cid, duty);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
int8_t MarlinHAL::set_pwm_frequency(const pin_t pin, const uint32_t f_desired) {
|
int8_t MarlinHAL::set_pwm_frequency(const pin_t pin, const uint32_t f_desired) {
|
||||||
|
#if ENABLED(I2S_STEPPER_STREAM)
|
||||||
|
if (pin > 127) {
|
||||||
|
pwm_pin_data[pin & 0x7F].pwm_cycle_ticks = 1000000UL / f_desired / 4; // # of 4µs ticks per full PWM cycle
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
#endif
|
||||||
|
{
|
||||||
const int8_t cid = channel_for_pin(pin);
|
const int8_t cid = channel_for_pin(pin);
|
||||||
if (cid >= 0) {
|
if (cid >= 0) {
|
||||||
if (f_desired == ledcReadFreq(cid)) return cid; // no freq change
|
if (f_desired == ledcReadFreq(cid)) return cid; // no freq change
|
||||||
@@ -320,6 +371,7 @@ int8_t MarlinHAL::set_pwm_frequency(const pin_t pin, const uint32_t f_desired) {
|
|||||||
}
|
}
|
||||||
return get_pwm_channel(pin, f_desired, PWM_RESOLUTION); // try for new one
|
return get_pwm_channel(pin, f_desired, PWM_RESOLUTION); // try for new one
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// use hardware PWM if avail, if not then ISR
|
// use hardware PWM if avail, if not then ISR
|
||||||
void analogWrite(const pin_t pin, const uint16_t value, const uint32_t freq/*=PWM_FREQUENCY*/, const uint16_t res/*=8*/) { // always 8 bit resolution!
|
void analogWrite(const pin_t pin, const uint16_t value, const uint32_t freq/*=PWM_FREQUENCY*/, const uint16_t res/*=8*/) { // always 8 bit resolution!
|
||||||
|
|||||||
@@ -32,7 +32,6 @@
|
|||||||
#include "../shared/HAL_SPI.h"
|
#include "../shared/HAL_SPI.h"
|
||||||
|
|
||||||
#include "fastio.h"
|
#include "fastio.h"
|
||||||
#include "watchdog.h"
|
|
||||||
#include "i2s.h"
|
#include "i2s.h"
|
||||||
|
|
||||||
#if ENABLED(WIFISUPPORT)
|
#if ENABLED(WIFISUPPORT)
|
||||||
@@ -61,21 +60,31 @@
|
|||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define CRITICAL_SECTION_START() portENTER_CRITICAL(&spinlock)
|
#define CRITICAL_SECTION_START() portENTER_CRITICAL(&hal.spinlock)
|
||||||
#define CRITICAL_SECTION_END() portEXIT_CRITICAL(&spinlock)
|
#define CRITICAL_SECTION_END() portEXIT_CRITICAL(&hal.spinlock)
|
||||||
|
|
||||||
#define HAL_CAN_SET_PWM_FREQ // This HAL supports PWM Frequency adjustment
|
#define HAL_CAN_SET_PWM_FREQ // This HAL supports PWM Frequency adjustment
|
||||||
#define PWM_FREQUENCY 1000u // Default PWM frequency when set_pwm_duty() is called without set_pwm_frequency()
|
#define PWM_FREQUENCY 1000u // Default PWM frequency when set_pwm_duty() is called without set_pwm_frequency()
|
||||||
#define PWM_RESOLUTION 10u // Default PWM bit resolution
|
#define PWM_RESOLUTION 10u // Default PWM bit resolution
|
||||||
#define CHANNEL_MAX_NUM 15u // max PWM channel # to allocate (7 to only use low speed, 15 to use low & high)
|
#define CHANNEL_MAX_NUM 15u // max PWM channel # to allocate (7 to only use low speed, 15 to use low & high)
|
||||||
#define MAX_PWM_IOPIN 33u // hardware pwm pins < 34
|
#define MAX_PWM_IOPIN 33u // hardware pwm pins < 34
|
||||||
|
#ifndef MAX_EXPANDER_BITS
|
||||||
|
#define MAX_EXPANDER_BITS 32 // I2S expander bit width (max 32)
|
||||||
|
#endif
|
||||||
|
|
||||||
// ------------------------
|
// ------------------------
|
||||||
// Types
|
// Types
|
||||||
// ------------------------
|
// ------------------------
|
||||||
|
|
||||||
|
typedef double isr_float_t; // FPU ops are used for single-precision, so use double for ISRs.
|
||||||
typedef int16_t pin_t;
|
typedef int16_t pin_t;
|
||||||
|
|
||||||
|
typedef struct pwm_pin {
|
||||||
|
uint32_t pwm_cycle_ticks = 1000000UL / (PWM_FREQUENCY) / 4; // # ticks per pwm cycle
|
||||||
|
uint32_t pwm_tick_count = 0; // current tick count
|
||||||
|
uint32_t pwm_duty_ticks = 0; // # of ticks for current duty cycle
|
||||||
|
} pwm_pin_t;
|
||||||
|
|
||||||
class Servo;
|
class Servo;
|
||||||
typedef Servo hal_servo_t;
|
typedef Servo hal_servo_t;
|
||||||
|
|
||||||
@@ -88,7 +97,7 @@ typedef Servo hal_servo_t;
|
|||||||
//
|
//
|
||||||
void tone(const pin_t _pin, const unsigned int frequency, const unsigned long duration=0);
|
void tone(const pin_t _pin, const unsigned int frequency, const unsigned long duration=0);
|
||||||
void noTone(const pin_t _pin);
|
void noTone(const pin_t _pin);
|
||||||
|
int8_t get_pwm_channel(const pin_t pin, const uint32_t freq, const uint16_t res);
|
||||||
void analogWrite(const pin_t pin, const uint16_t value, const uint32_t freq=PWM_FREQUENCY, const uint16_t res=8);
|
void analogWrite(const pin_t pin, const uint16_t value, const uint32_t freq=PWM_FREQUENCY, const uint16_t res=8);
|
||||||
|
|
||||||
//
|
//
|
||||||
@@ -171,6 +180,10 @@ public:
|
|||||||
// Earliest possible init, before setup()
|
// Earliest possible init, before setup()
|
||||||
MarlinHAL() {}
|
MarlinHAL() {}
|
||||||
|
|
||||||
|
// Watchdog
|
||||||
|
static void watchdog_init() IF_DISABLED(USE_WATCHDOG, {});
|
||||||
|
static void watchdog_refresh() IF_DISABLED(USE_WATCHDOG, {});
|
||||||
|
|
||||||
static void init() {} // Called early in setup()
|
static void init() {} // Called early in setup()
|
||||||
static void init_board(); // Called less early in setup()
|
static void init_board(); // Called less early in setup()
|
||||||
static void reboot(); // Restart the firmware
|
static void reboot(); // Restart the firmware
|
||||||
@@ -193,6 +206,8 @@ public:
|
|||||||
// Free SRAM
|
// Free SRAM
|
||||||
static int freeMemory();
|
static int freeMemory();
|
||||||
|
|
||||||
|
static pwm_pin_t pwm_pin_data[MAX_EXPANDER_BITS];
|
||||||
|
|
||||||
//
|
//
|
||||||
// ADC Methods
|
// ADC Methods
|
||||||
//
|
//
|
||||||
@@ -205,7 +220,7 @@ public:
|
|||||||
// Called by Temperature::init for each sensor at startup
|
// Called by Temperature::init for each sensor at startup
|
||||||
static void adc_enable(const pin_t pin) {}
|
static void adc_enable(const pin_t pin) {}
|
||||||
|
|
||||||
// Begin ADC sampling on the given channel
|
// Begin ADC sampling on the given pin. Called from Temperature::isr!
|
||||||
static void adc_start(const pin_t pin);
|
static void adc_start(const pin_t pin);
|
||||||
|
|
||||||
// Is the ADC ready for reading?
|
// Is the ADC ready for reading?
|
||||||
|
|||||||
@@ -139,22 +139,40 @@ static void IRAM_ATTR i2s_intr_handler_default(void *arg) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void stepperTask(void *parameter) {
|
void stepperTask(void *parameter) {
|
||||||
uint32_t remaining = 0;
|
uint32_t nextMainISR = 0;
|
||||||
|
#if ENABLED(LIN_ADVANCE)
|
||||||
|
uint32_t nextAdvanceISR = Stepper::LA_ADV_NEVER;
|
||||||
|
#endif
|
||||||
|
|
||||||
while (1) {
|
for (;;) {
|
||||||
xQueueReceive(dma.queue, &dma.current, portMAX_DELAY);
|
xQueueReceive(dma.queue, &dma.current, portMAX_DELAY);
|
||||||
dma.rw_pos = 0;
|
dma.rw_pos = 0;
|
||||||
|
|
||||||
while (dma.rw_pos < DMA_SAMPLE_COUNT) {
|
while (dma.rw_pos < DMA_SAMPLE_COUNT) {
|
||||||
// Fill with the port data post pulse_phase until the next step
|
// Fill with the port data post pulse_phase until the next step
|
||||||
if (remaining) {
|
if (nextMainISR && TERN1(LIN_ADVANCE, nextAdvanceISR))
|
||||||
i2s_push_sample();
|
i2s_push_sample();
|
||||||
remaining--;
|
|
||||||
|
// i2s_push_sample() is also called from Stepper::pulse_phase_isr() and Stepper::advance_isr()
|
||||||
|
// in a rare case where both are called, we need to double decrement the counters
|
||||||
|
const uint8_t push_count = 1 + (!nextMainISR && TERN0(LIN_ADVANCE, !nextAdvanceISR));
|
||||||
|
|
||||||
|
#if ENABLED(LIN_ADVANCE)
|
||||||
|
if (!nextAdvanceISR) {
|
||||||
|
Stepper::advance_isr();
|
||||||
|
nextAdvanceISR = Stepper::la_interval;
|
||||||
}
|
}
|
||||||
else {
|
else if (nextAdvanceISR == Stepper::LA_ADV_NEVER)
|
||||||
|
nextAdvanceISR = Stepper::la_interval;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
if (!nextMainISR) {
|
||||||
Stepper::pulse_phase_isr();
|
Stepper::pulse_phase_isr();
|
||||||
remaining = Stepper::block_phase_isr();
|
nextMainISR = Stepper::block_phase_isr();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
nextMainISR -= push_count;
|
||||||
|
TERN_(LIN_ADVANCE, nextAdvanceISR -= push_count);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -337,6 +355,26 @@ uint8_t i2s_state(uint8_t pin) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void i2s_push_sample() {
|
void i2s_push_sample() {
|
||||||
|
// Every 4µs (when space in DMA buffer) toggle each expander PWM output using
|
||||||
|
// the current duty cycle/frequency so they sync with any steps (once
|
||||||
|
// through the DMA/FIFO buffers). PWM signal inversion handled by other functions
|
||||||
|
LOOP_L_N(p, MAX_EXPANDER_BITS) {
|
||||||
|
if (hal.pwm_pin_data[p].pwm_duty_ticks > 0) { // pin has active pwm?
|
||||||
|
if (hal.pwm_pin_data[p].pwm_tick_count == 0) {
|
||||||
|
if (TEST32(i2s_port_data, p)) { // hi->lo
|
||||||
|
CBI32(i2s_port_data, p);
|
||||||
|
hal.pwm_pin_data[p].pwm_tick_count = hal.pwm_pin_data[p].pwm_cycle_ticks - hal.pwm_pin_data[p].pwm_duty_ticks;
|
||||||
|
}
|
||||||
|
else { // lo->hi
|
||||||
|
SBI32(i2s_port_data, p);
|
||||||
|
hal.pwm_pin_data[p].pwm_tick_count = hal.pwm_pin_data[p].pwm_duty_ticks;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
hal.pwm_pin_data[p].pwm_tick_count--;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
dma.current[dma.rw_pos++] = i2s_port_data;
|
dma.current[dma.rw_pos++] = i2s_port_data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -20,3 +20,10 @@
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
//
|
||||||
|
// Board-specific options need to be defined before HAL.h
|
||||||
|
//
|
||||||
|
#if MB(MKS_TINYBEE)
|
||||||
|
#define MAX_EXPANDER_BITS 24 // TinyBee has 3 x HC595
|
||||||
|
#endif
|
||||||
|
|||||||
@@ -45,6 +45,14 @@
|
|||||||
#error "FAST_PWM_FAN is not available on TinyBee."
|
#error "FAST_PWM_FAN is not available on TinyBee."
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if BOTH(I2S_STEPPER_STREAM, BABYSTEPPING) && DISABLED(INTEGRATED_BABYSTEPPING)
|
||||||
|
#error "BABYSTEPPING on I2S stream requires INTEGRATED_BABYSTEPPING."
|
||||||
|
#endif
|
||||||
|
|
||||||
#if USING_PULLDOWNS
|
#if USING_PULLDOWNS
|
||||||
#error "PULLDOWN pin mode is not available on ESP32 boards."
|
#error "PULLDOWN pin mode is not available on ESP32 boards."
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if BOTH(I2S_STEPPER_STREAM, LIN_ADVANCE) && DISABLED(EXPERIMENTAL_I2S_LA)
|
||||||
|
#error "I2S stream is currently incompatible with LIN_ADVANCE."
|
||||||
|
#endif
|
||||||
|
|||||||
@@ -23,24 +23,24 @@
|
|||||||
*/
|
*/
|
||||||
#ifdef ARDUINO_ARCH_ESP32
|
#ifdef ARDUINO_ARCH_ESP32
|
||||||
|
|
||||||
#include "../../inc/MarlinConfigPre.h"
|
#include "../../inc/MarlinConfig.h"
|
||||||
|
|
||||||
#if ENABLED(FYSETC_MINI_12864_2_1)
|
#if EITHER(MKS_MINI_12864, FYSETC_MINI_12864_2_1)
|
||||||
|
|
||||||
#include <U8glib-HAL.h>
|
#include <U8glib-HAL.h>
|
||||||
#include "Arduino.h"
|
|
||||||
#include "../shared/HAL_SPI.h"
|
#include "../shared/HAL_SPI.h"
|
||||||
#include "HAL.h"
|
#include "HAL.h"
|
||||||
#include "SPI.h"
|
#include "SPI.h"
|
||||||
|
|
||||||
|
#if ENABLED(SDSUPPORT)
|
||||||
|
#include "../../sd/cardreader.h"
|
||||||
|
#if ENABLED(ESP3D_WIFISUPPORT)
|
||||||
|
#include "sd_ESP32.h"
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
static SPISettings spiConfig;
|
static SPISettings spiConfig;
|
||||||
|
|
||||||
#define MDOGLCD_MOSI 23
|
|
||||||
#define MDOGLCD_SCK 18
|
|
||||||
#define MLCD_RESET_PIN 0
|
|
||||||
#define MLCD_PINS_DC 4
|
|
||||||
#define MDOGLCD_CS 21
|
|
||||||
#define MDOGLCD_A0 4
|
|
||||||
|
|
||||||
#ifndef LCD_SPI_SPEED
|
#ifndef LCD_SPI_SPEED
|
||||||
#ifdef SD_SPI_SPEED
|
#ifdef SD_SPI_SPEED
|
||||||
@@ -52,6 +52,11 @@ static SPISettings spiConfig;
|
|||||||
|
|
||||||
uint8_t u8g_eps_hw_spi_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_ptr) {
|
uint8_t u8g_eps_hw_spi_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_ptr) {
|
||||||
static uint8_t msgInitCount = 2; // Ignore all messages until 2nd U8G_COM_MSG_INIT
|
static uint8_t msgInitCount = 2; // Ignore all messages until 2nd U8G_COM_MSG_INIT
|
||||||
|
|
||||||
|
#if ENABLED(PAUSE_LCD_FOR_BUSY_SD)
|
||||||
|
if (card.flag.saving || card.flag.logging || TERN0(ESP3D_WIFISUPPORT, sd_busy_lock == true)) return 0;
|
||||||
|
#endif
|
||||||
|
|
||||||
if (msgInitCount) {
|
if (msgInitCount) {
|
||||||
if (msg == U8G_COM_MSG_INIT) msgInitCount--;
|
if (msg == U8G_COM_MSG_INIT) msgInitCount--;
|
||||||
if (msgInitCount) return -1;
|
if (msgInitCount) return -1;
|
||||||
@@ -61,24 +66,24 @@ uint8_t u8g_eps_hw_spi_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_pt
|
|||||||
case U8G_COM_MSG_STOP: break;
|
case U8G_COM_MSG_STOP: break;
|
||||||
|
|
||||||
case U8G_COM_MSG_INIT:
|
case U8G_COM_MSG_INIT:
|
||||||
OUT_WRITE(MDOGLCD_CS, HIGH);
|
OUT_WRITE(DOGLCD_CS, HIGH);
|
||||||
OUT_WRITE(MDOGLCD_A0, HIGH);
|
OUT_WRITE(DOGLCD_A0, HIGH);
|
||||||
OUT_WRITE(MLCD_RESET_PIN, HIGH);
|
OUT_WRITE(LCD_RESET_PIN, HIGH);
|
||||||
u8g_Delay(5);
|
u8g_Delay(5);
|
||||||
spiBegin();
|
spiBegin();
|
||||||
spiInit(LCD_SPI_SPEED);
|
spiInit(LCD_SPI_SPEED);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case U8G_COM_MSG_ADDRESS: /* define cmd (arg_val = 0) or data mode (arg_val = 1) */
|
case U8G_COM_MSG_ADDRESS: /* define cmd (arg_val = 0) or data mode (arg_val = 1) */
|
||||||
WRITE(MDOGLCD_A0, arg_val ? HIGH : LOW);
|
WRITE(DOGLCD_A0, arg_val ? HIGH : LOW);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case U8G_COM_MSG_CHIP_SELECT: /* arg_val == 0 means HIGH level of U8G_PI_CS */
|
case U8G_COM_MSG_CHIP_SELECT: /* arg_val == 0 means HIGH level of U8G_PI_CS */
|
||||||
WRITE(MDOGLCD_CS, arg_val ? LOW : HIGH);
|
WRITE(DOGLCD_CS, arg_val ? LOW : HIGH);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case U8G_COM_MSG_RESET:
|
case U8G_COM_MSG_RESET:
|
||||||
WRITE(MLCD_RESET_PIN, arg_val);
|
WRITE(LCD_RESET_PIN, arg_val);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case U8G_COM_MSG_WRITE_BYTE:
|
case U8G_COM_MSG_WRITE_BYTE:
|
||||||
@@ -96,5 +101,6 @@ uint8_t u8g_eps_hw_spi_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_pt
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // FYSETC_MINI_12864_2_1
|
#endif // EITHER(MKS_MINI_12864, FYSETC_MINI_12864_2_1)
|
||||||
|
|
||||||
#endif // ARDUINO_ARCH_ESP32
|
#endif // ARDUINO_ARCH_ESP32
|
||||||
|
|||||||
@@ -1,42 +0,0 @@
|
|||||||
/**
|
|
||||||
* Marlin 3D Printer Firmware
|
|
||||||
* Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
|
|
||||||
*
|
|
||||||
* Based on Sprinter and grbl.
|
|
||||||
* Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
|
|
||||||
*
|
|
||||||
* This program is free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
#ifdef ARDUINO_ARCH_ESP32
|
|
||||||
|
|
||||||
#include "../../inc/MarlinConfig.h"
|
|
||||||
|
|
||||||
#if ENABLED(USE_WATCHDOG)
|
|
||||||
|
|
||||||
#define WDT_TIMEOUT_US TERN(WATCHDOG_DURATION_8S, 8000000, 4000000) // 4 or 8 second timeout
|
|
||||||
|
|
||||||
#include "watchdog.h"
|
|
||||||
|
|
||||||
void watchdogSetup() {
|
|
||||||
// do whatever. don't remove this function.
|
|
||||||
}
|
|
||||||
|
|
||||||
void watchdog_init() {
|
|
||||||
// TODO
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif // USE_WATCHDOG
|
|
||||||
|
|
||||||
#endif // ARDUINO_ARCH_ESP32
|
|
||||||
@@ -28,6 +28,7 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include HAL_PATH(.,HAL.h)
|
#include HAL_PATH(.,HAL.h)
|
||||||
|
extern MarlinHAL hal;
|
||||||
|
|
||||||
#define HAL_ADC_RANGE _BV(HAL_ADC_RESOLUTION)
|
#define HAL_ADC_RANGE _BV(HAL_ADC_RESOLUTION)
|
||||||
|
|
||||||
@@ -44,7 +45,3 @@
|
|||||||
#ifndef PGMSTR
|
#ifndef PGMSTR
|
||||||
#define PGMSTR(NAM,STR) const char NAM[] = STR
|
#define PGMSTR(NAM,STR) const char NAM[] = STR
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
inline void watchdog_refresh() {
|
|
||||||
TERN_(USE_WATCHDOG, HAL_watchdog_refresh());
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -21,6 +21,8 @@
|
|||||||
*/
|
*/
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include "../../inc/MarlinConfigPre.h"
|
||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
@@ -29,12 +31,10 @@
|
|||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
|
||||||
#include "hardware/Clock.h"
|
#include "hardware/Clock.h"
|
||||||
|
|
||||||
#include "../shared/Marduino.h"
|
#include "../shared/Marduino.h"
|
||||||
#include "../shared/math_32bit.h"
|
#include "../shared/math_32bit.h"
|
||||||
#include "../shared/HAL_SPI.h"
|
#include "../shared/HAL_SPI.h"
|
||||||
#include "fastio.h"
|
#include "fastio.h"
|
||||||
#include "watchdog.h"
|
|
||||||
#include "serial.h"
|
#include "serial.h"
|
||||||
|
|
||||||
// ------------------------
|
// ------------------------
|
||||||
@@ -106,6 +106,10 @@ public:
|
|||||||
// Earliest possible init, before setup()
|
// Earliest possible init, before setup()
|
||||||
MarlinHAL() {}
|
MarlinHAL() {}
|
||||||
|
|
||||||
|
// Watchdog
|
||||||
|
static void watchdog_init() {}
|
||||||
|
static void watchdog_refresh() {}
|
||||||
|
|
||||||
static void init() {} // Called early in setup()
|
static void init() {} // Called early in setup()
|
||||||
static void init_board() {} // Called less early in setup()
|
static void init_board() {} // Called less early in setup()
|
||||||
static void reboot(); // Reset the application state and GPIO
|
static void reboot(); // Reset the application state and GPIO
|
||||||
|
|||||||
@@ -74,7 +74,7 @@ bool PersistentStore::write_data(int &pos, const uint8_t *value, size_t size, ui
|
|||||||
}
|
}
|
||||||
|
|
||||||
crc16(crc, value, size);
|
crc16(crc, value, size);
|
||||||
pos = pos + size;
|
pos += size;
|
||||||
return (bytes_written != size); // return true for any error
|
return (bytes_written != size); // return true for any error
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -96,7 +96,7 @@ bool PersistentStore::read_data(int &pos, uint8_t *value, const size_t size, uin
|
|||||||
crc16(crc, temp, size);
|
crc16(crc, temp, size);
|
||||||
}
|
}
|
||||||
|
|
||||||
pos = pos + size;
|
pos += size;
|
||||||
return bytes_read != size; // return true for any error
|
return bytes_read != size; // return true for any error
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -26,8 +26,8 @@
|
|||||||
struct LowpassFilter {
|
struct LowpassFilter {
|
||||||
uint64_t data_delay = 0;
|
uint64_t data_delay = 0;
|
||||||
uint16_t update(uint16_t value) {
|
uint16_t update(uint16_t value) {
|
||||||
data_delay = data_delay - (data_delay >> 6) + value;
|
data_delay += value - (data_delay >> 6);
|
||||||
return (uint16_t)(data_delay >> 6);
|
return uint16_t(data_delay >> 6);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -1,37 +0,0 @@
|
|||||||
/**
|
|
||||||
* Marlin 3D Printer Firmware
|
|
||||||
* Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
|
|
||||||
*
|
|
||||||
* Based on Sprinter and grbl.
|
|
||||||
* Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
|
|
||||||
*
|
|
||||||
* This program is free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
#ifdef __PLAT_LINUX__
|
|
||||||
|
|
||||||
#include "../../inc/MarlinConfig.h"
|
|
||||||
|
|
||||||
#if ENABLED(USE_WATCHDOG)
|
|
||||||
|
|
||||||
#include "watchdog.h"
|
|
||||||
|
|
||||||
#define WDT_TIMEOUT_US TERN(WATCHDOG_DURATION_8S, 8000000, 4000000) // 4 or 8 second timeout
|
|
||||||
|
|
||||||
void watchdog_init() {}
|
|
||||||
void HAL_watchdog_refresh() {}
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif // __PLAT_LINUX__
|
|
||||||
@@ -25,10 +25,6 @@
|
|||||||
#include "../shared/Delay.h"
|
#include "../shared/Delay.h"
|
||||||
#include "../../../gcode/parser.h"
|
#include "../../../gcode/parser.h"
|
||||||
|
|
||||||
#if ENABLED(USE_WATCHDOG)
|
|
||||||
#include "watchdog.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
DefaultSerial1 USBSerial(false, UsbSerial);
|
DefaultSerial1 USBSerial(false, UsbSerial);
|
||||||
|
|
||||||
uint32_t MarlinHAL::adc_result = 0;
|
uint32_t MarlinHAL::adc_result = 0;
|
||||||
@@ -61,9 +57,7 @@ uint8_t MarlinHAL::get_reset_source() {
|
|||||||
return RST_POWER_ON;
|
return RST_POWER_ON;
|
||||||
}
|
}
|
||||||
|
|
||||||
void MarlinHAL::clear_reset_source() {
|
void MarlinHAL::clear_reset_source() { watchdog_clear_timeout_flag(); }
|
||||||
TERN_(USE_WATCHDOG, watchdog_clear_timeout_flag());
|
|
||||||
}
|
|
||||||
|
|
||||||
void flashFirmware(const int16_t) {
|
void flashFirmware(const int16_t) {
|
||||||
delay(500); // Give OS time to disconnect
|
delay(500); // Give OS time to disconnect
|
||||||
@@ -72,6 +66,52 @@ void flashFirmware(const int16_t) {
|
|||||||
hal.reboot();
|
hal.reboot();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if ENABLED(USE_WATCHDOG)
|
||||||
|
|
||||||
|
#include <lpc17xx_wdt.h>
|
||||||
|
|
||||||
|
#define WDT_TIMEOUT_US TERN(WATCHDOG_DURATION_8S, 8000000, 4000000) // 4 or 8 second timeout
|
||||||
|
|
||||||
|
void MarlinHAL::watchdog_init() {
|
||||||
|
#if ENABLED(WATCHDOG_RESET_MANUAL)
|
||||||
|
// We enable the watchdog timer, but only for the interrupt.
|
||||||
|
|
||||||
|
// Configure WDT to only trigger an interrupt
|
||||||
|
// Disable WDT interrupt (just in case, to avoid triggering it!)
|
||||||
|
NVIC_DisableIRQ(WDT_IRQn);
|
||||||
|
|
||||||
|
// We NEED memory barriers to ensure Interrupts are actually disabled!
|
||||||
|
// ( https://dzone.com/articles/nvic-disabling-interrupts-on-arm-cortex-m-and-the )
|
||||||
|
__DSB();
|
||||||
|
__ISB();
|
||||||
|
|
||||||
|
// Configure WDT to only trigger an interrupt
|
||||||
|
// Initialize WDT with the given parameters
|
||||||
|
WDT_Init(WDT_CLKSRC_IRC, WDT_MODE_INT_ONLY);
|
||||||
|
|
||||||
|
// Configure and enable WDT interrupt.
|
||||||
|
NVIC_ClearPendingIRQ(WDT_IRQn);
|
||||||
|
NVIC_SetPriority(WDT_IRQn, 0); // Use highest priority, so we detect all kinds of lockups
|
||||||
|
NVIC_EnableIRQ(WDT_IRQn);
|
||||||
|
#else
|
||||||
|
WDT_Init(WDT_CLKSRC_IRC, WDT_MODE_RESET);
|
||||||
|
#endif
|
||||||
|
WDT_Start(WDT_TIMEOUT_US);
|
||||||
|
}
|
||||||
|
|
||||||
|
void MarlinHAL::watchdog_refresh() {
|
||||||
|
WDT_Feed();
|
||||||
|
#if DISABLED(PINS_DEBUGGING) && PIN_EXISTS(LED)
|
||||||
|
TOGGLE(LED_PIN); // heartbeat indicator
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
// Timeout state
|
||||||
|
bool MarlinHAL::watchdog_timed_out() { return TEST(WDT_ReadTimeOutFlag(), 0); }
|
||||||
|
void MarlinHAL::watchdog_clear_timeout_flag() { WDT_ClrTimeOutFlag(); }
|
||||||
|
|
||||||
|
#endif // USE_WATCHDOG
|
||||||
|
|
||||||
// For M42/M43, scan command line for pin code
|
// For M42/M43, scan command line for pin code
|
||||||
// return index into pin map array if found and the pin is valid.
|
// return index into pin map array if found and the pin is valid.
|
||||||
// return dval if not found or not a valid pin.
|
// return dval if not found or not a valid pin.
|
||||||
|
|||||||
@@ -38,7 +38,6 @@ extern "C" volatile uint32_t _millis;
|
|||||||
#include "../shared/math_32bit.h"
|
#include "../shared/math_32bit.h"
|
||||||
#include "../shared/HAL_SPI.h"
|
#include "../shared/HAL_SPI.h"
|
||||||
#include "fastio.h"
|
#include "fastio.h"
|
||||||
#include "watchdog.h"
|
|
||||||
#include "MarlinSerial.h"
|
#include "MarlinSerial.h"
|
||||||
|
|
||||||
#include <adc.h>
|
#include <adc.h>
|
||||||
@@ -177,7 +176,7 @@ void flashFirmware(const int16_t);
|
|||||||
#define CPU_ST7920_DELAY_3 750
|
#define CPU_ST7920_DELAY_3 750
|
||||||
|
|
||||||
// ------------------------
|
// ------------------------
|
||||||
// Class Utilities
|
// Free Memory Accessor
|
||||||
// ------------------------
|
// ------------------------
|
||||||
|
|
||||||
#pragma GCC diagnostic push
|
#pragma GCC diagnostic push
|
||||||
@@ -210,6 +209,12 @@ public:
|
|||||||
|
|
||||||
static void delay_ms(const int ms) { _delay_ms(ms); }
|
static void delay_ms(const int ms) { _delay_ms(ms); }
|
||||||
|
|
||||||
|
// Watchdog
|
||||||
|
static void watchdog_init() IF_DISABLED(USE_WATCHDOG, {});
|
||||||
|
static void watchdog_refresh() IF_DISABLED(USE_WATCHDOG, {});
|
||||||
|
static bool watchdog_timed_out() IF_DISABLED(USE_WATCHDOG, { return false; });
|
||||||
|
static void watchdog_clear_timeout_flag() IF_DISABLED(USE_WATCHDOG, {});
|
||||||
|
|
||||||
// Tasks, called from idle()
|
// Tasks, called from idle()
|
||||||
static void idletask();
|
static void idletask();
|
||||||
|
|
||||||
@@ -234,7 +239,7 @@ public:
|
|||||||
FilteredADC::enable_channel(pin);
|
FilteredADC::enable_channel(pin);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Begin ADC sampling on the given pin
|
// Begin ADC sampling on the given pin. Called from Temperature::isr!
|
||||||
static uint32_t adc_result;
|
static uint32_t adc_result;
|
||||||
static void adc_start(const pin_t pin) {
|
static void adc_start(const pin_t pin) {
|
||||||
adc_result = FilteredADC::read(pin) >> (16 - HAL_ADC_RESOLUTION); // returns 16bit value, reduce to required bits
|
adc_result = FilteredADC::read(pin) >> (16 - HAL_ADC_RESOLUTION); // returns 16bit value, reduce to required bits
|
||||||
|
|||||||
@@ -26,7 +26,7 @@
|
|||||||
|
|
||||||
#if ENABLED(POSTMORTEM_DEBUGGING)
|
#if ENABLED(POSTMORTEM_DEBUGGING)
|
||||||
|
|
||||||
#include "../shared/HAL_MinSerial.h"
|
#include "../shared/MinSerial.h"
|
||||||
#include <debug_frmwrk.h>
|
#include <debug_frmwrk.h>
|
||||||
|
|
||||||
static void TX(char c) { _DBC(c); }
|
static void TX(char c) { _DBC(c); }
|
||||||
@@ -34,7 +34,7 @@
|
|||||||
#include "../shared/eeprom_api.h"
|
#include "../shared/eeprom_api.h"
|
||||||
|
|
||||||
#ifndef MARLIN_EEPROM_SIZE
|
#ifndef MARLIN_EEPROM_SIZE
|
||||||
#define MARLIN_EEPROM_SIZE 0x8000 // 32KB
|
#define MARLIN_EEPROM_SIZE 0x8000 // 32K
|
||||||
#endif
|
#endif
|
||||||
size_t PersistentStore::capacity() { return MARLIN_EEPROM_SIZE; }
|
size_t PersistentStore::capacity() { return MARLIN_EEPROM_SIZE; }
|
||||||
|
|
||||||
|
|||||||
@@ -29,6 +29,6 @@
|
|||||||
|
|
||||||
// LPC1768 boards seem to lose steps when saving to EEPROM during print (issue #20785)
|
// LPC1768 boards seem to lose steps when saving to EEPROM during print (issue #20785)
|
||||||
// TODO: Which other boards are incompatible?
|
// TODO: Which other boards are incompatible?
|
||||||
#if defined(MCU_LPC1768) && PRINTCOUNTER_SAVE_INTERVAL > 0
|
#if defined(MCU_LPC1768) && ENABLED(FLASH_EEPROM_EMULATION) && PRINTCOUNTER_SAVE_INTERVAL > 0
|
||||||
#define PRINTCOUNTER_SYNC 1
|
#define PRINTCOUNTER_SYNC 1
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ if pioutil.is_pio_build():
|
|||||||
target_filename = "FIRMWARE.CUR"
|
target_filename = "FIRMWARE.CUR"
|
||||||
target_drive = "REARM"
|
target_drive = "REARM"
|
||||||
|
|
||||||
import os,getpass,platform
|
import platform
|
||||||
|
|
||||||
current_OS = platform.system()
|
current_OS = platform.system()
|
||||||
Import("env")
|
Import("env")
|
||||||
@@ -26,6 +26,7 @@ if pioutil.is_pio_build():
|
|||||||
|
|
||||||
def before_upload(source, target, env):
|
def before_upload(source, target, env):
|
||||||
try:
|
try:
|
||||||
|
from pathlib import Path
|
||||||
#
|
#
|
||||||
# Find a disk for upload
|
# Find a disk for upload
|
||||||
#
|
#
|
||||||
@@ -38,6 +39,7 @@ if pioutil.is_pio_build():
|
|||||||
# Windows - doesn't care about the disk's name, only cares about the drive letter
|
# Windows - doesn't care about the disk's name, only cares about the drive letter
|
||||||
import subprocess,string
|
import subprocess,string
|
||||||
from ctypes import windll
|
from ctypes import windll
|
||||||
|
from pathlib import PureWindowsPath
|
||||||
|
|
||||||
# getting list of drives
|
# getting list of drives
|
||||||
# https://stackoverflow.com/questions/827371/is-there-a-way-to-list-all-the-available-drive-letters-in-python
|
# https://stackoverflow.com/questions/827371/is-there-a-way-to-list-all-the-available-drive-letters-in-python
|
||||||
@@ -49,7 +51,7 @@ if pioutil.is_pio_build():
|
|||||||
bitmask >>= 1
|
bitmask >>= 1
|
||||||
|
|
||||||
for drive in drives:
|
for drive in drives:
|
||||||
final_drive_name = drive + ':\\'
|
final_drive_name = drive + ':'
|
||||||
# print ('disc check: {}'.format(final_drive_name))
|
# print ('disc check: {}'.format(final_drive_name))
|
||||||
try:
|
try:
|
||||||
volume_info = str(subprocess.check_output('cmd /C dir ' + final_drive_name, stderr=subprocess.STDOUT))
|
volume_info = str(subprocess.check_output('cmd /C dir ' + final_drive_name, stderr=subprocess.STDOUT))
|
||||||
@@ -59,29 +61,33 @@ if pioutil.is_pio_build():
|
|||||||
else:
|
else:
|
||||||
if target_drive in volume_info and not target_file_found: # set upload if not found target file yet
|
if target_drive in volume_info and not target_file_found: # set upload if not found target file yet
|
||||||
target_drive_found = True
|
target_drive_found = True
|
||||||
upload_disk = final_drive_name
|
upload_disk = PureWindowsPath(final_drive_name)
|
||||||
if target_filename in volume_info:
|
if target_filename in volume_info:
|
||||||
if not target_file_found:
|
if not target_file_found:
|
||||||
upload_disk = final_drive_name
|
upload_disk = PureWindowsPath(final_drive_name)
|
||||||
target_file_found = True
|
target_file_found = True
|
||||||
|
|
||||||
elif current_OS == 'Linux':
|
elif current_OS == 'Linux':
|
||||||
#
|
#
|
||||||
# platformio.ini will accept this for a Linux upload port designation: 'upload_port = /media/media_name/drive'
|
# platformio.ini will accept this for a Linux upload port designation: 'upload_port = /media/media_name/drive'
|
||||||
#
|
#
|
||||||
drives = os.listdir(os.path.join(os.sep, 'media', getpass.getuser()))
|
import getpass
|
||||||
|
user = getpass.getuser()
|
||||||
|
mpath = Path('/media', user)
|
||||||
|
drives = [ x for x in mpath.iterdir() if x.is_dir() ]
|
||||||
if target_drive in drives: # If target drive is found, use it.
|
if target_drive in drives: # If target drive is found, use it.
|
||||||
target_drive_found = True
|
target_drive_found = True
|
||||||
upload_disk = os.path.join(os.sep, 'media', getpass.getuser(), target_drive) + os.sep
|
upload_disk = mpath / target_drive
|
||||||
else:
|
else:
|
||||||
for drive in drives:
|
for drive in drives:
|
||||||
try:
|
try:
|
||||||
files = os.listdir(os.path.join(os.sep, 'media', getpass.getuser(), drive))
|
fpath = mpath / drive
|
||||||
|
filenames = [ x.name for x in fpath.iterdir() if x.is_file() ]
|
||||||
except:
|
except:
|
||||||
continue
|
continue
|
||||||
else:
|
else:
|
||||||
if target_filename in files:
|
if target_filename in filenames:
|
||||||
upload_disk = os.path.join(os.sep, 'media', getpass.getuser(), drive) + os.sep
|
upload_disk = mpath / drive
|
||||||
target_file_found = True
|
target_file_found = True
|
||||||
break
|
break
|
||||||
#
|
#
|
||||||
@@ -97,26 +103,28 @@ if pioutil.is_pio_build():
|
|||||||
#
|
#
|
||||||
# platformio.ini will accept this for a OSX upload port designation: 'upload_port = /media/media_name/drive'
|
# platformio.ini will accept this for a OSX upload port designation: 'upload_port = /media/media_name/drive'
|
||||||
#
|
#
|
||||||
drives = os.listdir('/Volumes') # human readable names
|
dpath = Path('/Volumes') # human readable names
|
||||||
|
drives = [ x for x in dpath.iterdir() if x.is_dir() ]
|
||||||
if target_drive in drives and not target_file_found: # set upload if not found target file yet
|
if target_drive in drives and not target_file_found: # set upload if not found target file yet
|
||||||
target_drive_found = True
|
target_drive_found = True
|
||||||
upload_disk = '/Volumes/' + target_drive + '/'
|
upload_disk = dpath / target_drive
|
||||||
for drive in drives:
|
for drive in drives:
|
||||||
try:
|
try:
|
||||||
filenames = os.listdir('/Volumes/' + drive + '/') # will get an error if the drive is protected
|
fpath = dpath / drive # will get an error if the drive is protected
|
||||||
|
filenames = [ x.name for x in fpath.iterdir() if x.is_file() ]
|
||||||
except:
|
except:
|
||||||
continue
|
continue
|
||||||
else:
|
else:
|
||||||
if target_filename in filenames:
|
if target_filename in filenames:
|
||||||
if not target_file_found:
|
upload_disk = dpath / drive
|
||||||
upload_disk = '/Volumes/' + drive + '/'
|
|
||||||
target_file_found = True
|
target_file_found = True
|
||||||
|
break
|
||||||
|
|
||||||
#
|
#
|
||||||
# Set upload_port to drive if found
|
# Set upload_port to drive if found
|
||||||
#
|
#
|
||||||
if target_file_found or target_drive_found:
|
if target_file_found or target_drive_found:
|
||||||
env.Replace(UPLOAD_PORT=upload_disk)
|
env.Replace(UPLOAD_PORT=str(upload_disk))
|
||||||
print('\nUpload disk: ', upload_disk, '\n')
|
print('\nUpload disk: ', upload_disk, '\n')
|
||||||
else:
|
else:
|
||||||
print_error('Autodetect Error')
|
print_error('Autodetect Error')
|
||||||
|
|||||||
@@ -1,72 +0,0 @@
|
|||||||
/**
|
|
||||||
* Marlin 3D Printer Firmware
|
|
||||||
* Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
|
|
||||||
*
|
|
||||||
* Based on Sprinter and grbl.
|
|
||||||
* Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
|
|
||||||
*
|
|
||||||
* This program is free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
#ifdef TARGET_LPC1768
|
|
||||||
|
|
||||||
#include "../../inc/MarlinConfig.h"
|
|
||||||
|
|
||||||
#if ENABLED(USE_WATCHDOG)
|
|
||||||
|
|
||||||
#include <lpc17xx_wdt.h>
|
|
||||||
#include "watchdog.h"
|
|
||||||
|
|
||||||
#define WDT_TIMEOUT_US TERN(WATCHDOG_DURATION_8S, 8000000, 4000000) // 4 or 8 second timeout
|
|
||||||
|
|
||||||
void watchdog_init() {
|
|
||||||
#if ENABLED(WATCHDOG_RESET_MANUAL)
|
|
||||||
// We enable the watchdog timer, but only for the interrupt.
|
|
||||||
|
|
||||||
// Configure WDT to only trigger an interrupt
|
|
||||||
// Disable WDT interrupt (just in case, to avoid triggering it!)
|
|
||||||
NVIC_DisableIRQ(WDT_IRQn);
|
|
||||||
|
|
||||||
// We NEED memory barriers to ensure Interrupts are actually disabled!
|
|
||||||
// ( https://dzone.com/articles/nvic-disabling-interrupts-on-arm-cortex-m-and-the )
|
|
||||||
__DSB();
|
|
||||||
__ISB();
|
|
||||||
|
|
||||||
// Configure WDT to only trigger an interrupt
|
|
||||||
// Initialize WDT with the given parameters
|
|
||||||
WDT_Init(WDT_CLKSRC_IRC, WDT_MODE_INT_ONLY);
|
|
||||||
|
|
||||||
// Configure and enable WDT interrupt.
|
|
||||||
NVIC_ClearPendingIRQ(WDT_IRQn);
|
|
||||||
NVIC_SetPriority(WDT_IRQn, 0); // Use highest priority, so we detect all kinds of lockups
|
|
||||||
NVIC_EnableIRQ(WDT_IRQn);
|
|
||||||
#else
|
|
||||||
WDT_Init(WDT_CLKSRC_IRC, WDT_MODE_RESET);
|
|
||||||
#endif
|
|
||||||
WDT_Start(WDT_TIMEOUT_US);
|
|
||||||
}
|
|
||||||
|
|
||||||
void HAL_watchdog_refresh() {
|
|
||||||
WDT_Feed();
|
|
||||||
#if DISABLED(PINS_DEBUGGING) && PIN_EXISTS(LED)
|
|
||||||
TOGGLE(LED_PIN); // heartbeat indicator
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
// Timeout state
|
|
||||||
bool watchdog_timed_out() { return TEST(WDT_ReadTimeOutFlag(), 0); }
|
|
||||||
void watchdog_clear_timeout_flag() { WDT_ClrTimeOutFlag(); }
|
|
||||||
|
|
||||||
#endif // USE_WATCHDOG
|
|
||||||
#endif // TARGET_LPC1768
|
|
||||||
@@ -45,7 +45,6 @@ uint8_t _getc();
|
|||||||
#include "../shared/math_32bit.h"
|
#include "../shared/math_32bit.h"
|
||||||
#include "../shared/HAL_SPI.h"
|
#include "../shared/HAL_SPI.h"
|
||||||
#include "fastio.h"
|
#include "fastio.h"
|
||||||
#include "watchdog.h"
|
|
||||||
#include "serial.h"
|
#include "serial.h"
|
||||||
|
|
||||||
// ------------------------
|
// ------------------------
|
||||||
@@ -186,7 +185,7 @@ constexpr inline char* strstr_constexpr(char* str, const char* target) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// ------------------------
|
// ------------------------
|
||||||
// Class Utilities
|
// Free Memory Accessor
|
||||||
// ------------------------
|
// ------------------------
|
||||||
|
|
||||||
#pragma GCC diagnostic push
|
#pragma GCC diagnostic push
|
||||||
@@ -208,6 +207,10 @@ public:
|
|||||||
// Earliest possible init, before setup()
|
// Earliest possible init, before setup()
|
||||||
MarlinHAL() {}
|
MarlinHAL() {}
|
||||||
|
|
||||||
|
// Watchdog
|
||||||
|
static void watchdog_init() IF_DISABLED(USE_WATCHDOG, {});
|
||||||
|
static void watchdog_refresh() IF_DISABLED(USE_WATCHDOG, {});
|
||||||
|
|
||||||
static void init() {} // Called early in setup()
|
static void init() {} // Called early in setup()
|
||||||
static void init_board() {} // Called less early in setup()
|
static void init_board() {} // Called less early in setup()
|
||||||
static void reboot(); // Restart the firmware from 0x0
|
static void reboot(); // Restart the firmware from 0x0
|
||||||
@@ -242,7 +245,7 @@ public:
|
|||||||
// Called by Temperature::init for each sensor at startup
|
// Called by Temperature::init for each sensor at startup
|
||||||
static void adc_enable(const uint8_t ch);
|
static void adc_enable(const uint8_t ch);
|
||||||
|
|
||||||
// Begin ADC sampling on the given channel
|
// Begin ADC sampling on the given channel. Called from Temperature::isr!
|
||||||
static void adc_start(const uint8_t ch);
|
static void adc_start(const uint8_t ch);
|
||||||
|
|
||||||
// Is the ADC ready for reading?
|
// Is the ADC ready for reading?
|
||||||
|
|||||||
@@ -44,7 +44,7 @@
|
|||||||
*
|
*
|
||||||
* Now you can simply SET_OUTPUT(STEP); WRITE(STEP, HIGH); WRITE(STEP, LOW);
|
* Now you can simply SET_OUTPUT(STEP); WRITE(STEP, HIGH); WRITE(STEP, LOW);
|
||||||
*
|
*
|
||||||
* Why double up on these macros? see http://gcc.gnu.org/onlinedocs/cpp/Stringification.html
|
* Why double up on these macros? see https://gcc.gnu.org/onlinedocs/cpp/Stringification.html
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/// Read a pin
|
/// Read a pin
|
||||||
|
|||||||
@@ -51,7 +51,7 @@ enum XPTCoordinate : uint8_t {
|
|||||||
XPT2046_Z2 = 0x40 | XPT2046_CONTROL | XPT2046_DFR_MODE,
|
XPT2046_Z2 = 0x40 | XPT2046_CONTROL | XPT2046_DFR_MODE,
|
||||||
};
|
};
|
||||||
|
|
||||||
#if !defined(XPT2046_Z1_THRESHOLD)
|
#ifndef XPT2046_Z1_THRESHOLD
|
||||||
#define XPT2046_Z1_THRESHOLD 10
|
#define XPT2046_Z1_THRESHOLD 10
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
@@ -38,13 +38,13 @@
|
|||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void u8g_SetPinOutput(uint8_t internal_pin_number) { SET_DIR_OUTPUT(internal_pin_number); }
|
void u8g_SetPinOutput(uint8_t internal_pin_number) { SET_DIR_OUTPUT(internal_pin_number); }
|
||||||
void u8g_SetPinInput(uint8_t internal_pin_number) { SET_DIR_INPUT(internal_pin_number); }
|
void u8g_SetPinInput(uint8_t internal_pin_number) { SET_DIR_INPUT(internal_pin_number); }
|
||||||
void u8g_SetPinLevel(uint8_t pin, uint8_t pin_status) { WRITE_PIN(pin, pin_status); }
|
void u8g_SetPinLevel(uint8_t pin, uint8_t pin_status) { WRITE_PIN(pin, pin_status); }
|
||||||
uint8_t u8g_GetPinLevel(uint8_t pin) { return READ_PIN(pin); }
|
uint8_t u8g_GetPinLevel(uint8_t pin) { return READ_PIN(pin); }
|
||||||
void usleep(uint64_t microsec){
|
void usleep(uint64_t microsec) { assert(false); /* why we here? */ }
|
||||||
assert(false); // why we here?
|
|
||||||
}
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -203,6 +203,40 @@ enum ADCIndex {
|
|||||||
ADC_COUNT
|
ADC_COUNT
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#if ENABLED(USE_WATCHDOG)
|
||||||
|
|
||||||
|
#define WDT_TIMEOUT_REG TERN(WATCHDOG_DURATION_8S, WDT_CONFIG_PER_CYC8192, WDT_CONFIG_PER_CYC4096) // 4 or 8 second timeout
|
||||||
|
|
||||||
|
void MarlinHAL::watchdog_init() {
|
||||||
|
// The low-power oscillator used by the WDT runs at 32,768 Hz with
|
||||||
|
// a 1:32 prescale, thus 1024 Hz, though probably not super precise.
|
||||||
|
|
||||||
|
// Setup WDT clocks
|
||||||
|
MCLK->APBAMASK.bit.OSC32KCTRL_ = true;
|
||||||
|
MCLK->APBAMASK.bit.WDT_ = true;
|
||||||
|
OSC32KCTRL->OSCULP32K.bit.EN1K = true; // Enable out 1K (this is what WDT uses)
|
||||||
|
|
||||||
|
WDT->CTRLA.bit.ENABLE = false; // Disable watchdog for config
|
||||||
|
SYNC(WDT->SYNCBUSY.bit.ENABLE);
|
||||||
|
|
||||||
|
WDT->INTENCLR.reg = WDT_INTENCLR_EW; // Disable early warning interrupt
|
||||||
|
WDT->CONFIG.reg = WDT_TIMEOUT_REG; // Set a 4s or 8s period for chip reset
|
||||||
|
|
||||||
|
hal.watchdog_refresh();
|
||||||
|
|
||||||
|
WDT->CTRLA.reg = WDT_CTRLA_ENABLE; // Start watchdog now in normal mode
|
||||||
|
SYNC(WDT->SYNCBUSY.bit.ENABLE);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Reset watchdog. MUST be called at least every 4 seconds after the
|
||||||
|
// first watchdog_init or SAMD will go into emergency procedures.
|
||||||
|
void MarlinHAL::watchdog_refresh() {
|
||||||
|
SYNC(WDT->SYNCBUSY.bit.CLEAR); // Test first if previous is 'ongoing' to save time waiting for command execution
|
||||||
|
WDT->CLEAR.reg = WDT_CLEAR_CLEAR_KEY;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
// ------------------------
|
// ------------------------
|
||||||
// Types
|
// Types
|
||||||
// ------------------------
|
// ------------------------
|
||||||
@@ -564,7 +598,7 @@ void MarlinHAL::dma_init() {
|
|||||||
void MarlinHAL::init() {
|
void MarlinHAL::init() {
|
||||||
TERN_(DMA_IS_REQUIRED, dma_init());
|
TERN_(DMA_IS_REQUIRED, dma_init());
|
||||||
#if ENABLED(SDSUPPORT)
|
#if ENABLED(SDSUPPORT)
|
||||||
#if SD_CONNECTION_IS(ONBOARD) && PIN_EXISTS(SD_DETECT)
|
#if HAS_SD_DETECT && SD_CONNECTION_IS(ONBOARD)
|
||||||
SET_INPUT_PULLUP(SD_DETECT_PIN);
|
SET_INPUT_PULLUP(SD_DETECT_PIN);
|
||||||
#endif
|
#endif
|
||||||
OUT_WRITE(SDSS, HIGH); // Try to set SDSS inactive before any other SPI users start up
|
OUT_WRITE(SDSS, HIGH); // Try to set SDSS inactive before any other SPI users start up
|
||||||
|
|||||||
@@ -26,7 +26,6 @@
|
|||||||
#include "../shared/math_32bit.h"
|
#include "../shared/math_32bit.h"
|
||||||
#include "../shared/HAL_SPI.h"
|
#include "../shared/HAL_SPI.h"
|
||||||
#include "fastio.h"
|
#include "fastio.h"
|
||||||
#include "watchdog.h"
|
|
||||||
|
|
||||||
#ifdef ADAFRUIT_GRAND_CENTRAL_M4
|
#ifdef ADAFRUIT_GRAND_CENTRAL_M4
|
||||||
#include "MarlinSerial_AGCM4.h"
|
#include "MarlinSerial_AGCM4.h"
|
||||||
@@ -157,6 +156,10 @@ public:
|
|||||||
// Earliest possible init, before setup()
|
// Earliest possible init, before setup()
|
||||||
MarlinHAL() {}
|
MarlinHAL() {}
|
||||||
|
|
||||||
|
// Watchdog
|
||||||
|
static void watchdog_init() IF_DISABLED(USE_WATCHDOG, {});
|
||||||
|
static void watchdog_refresh() IF_DISABLED(USE_WATCHDOG, {});
|
||||||
|
|
||||||
static void init(); // Called early in setup()
|
static void init(); // Called early in setup()
|
||||||
static void init_board() {} // Called less early in setup()
|
static void init_board() {} // Called less early in setup()
|
||||||
static void reboot(); // Restart the firmware from 0x0
|
static void reboot(); // Restart the firmware from 0x0
|
||||||
@@ -190,7 +193,7 @@ public:
|
|||||||
// Called by Temperature::init for each sensor at startup
|
// Called by Temperature::init for each sensor at startup
|
||||||
static void adc_enable(const uint8_t ch) {}
|
static void adc_enable(const uint8_t ch) {}
|
||||||
|
|
||||||
// Begin ADC sampling on the given channel
|
// Begin ADC sampling on the given pin. Called from Temperature::isr!
|
||||||
static void adc_start(const pin_t pin);
|
static void adc_start(const pin_t pin);
|
||||||
|
|
||||||
// Is the ADC ready for reading?
|
// Is the ADC ready for reading?
|
||||||
|
|||||||
@@ -77,7 +77,8 @@ HAL_SERVO_TIMER_ISR() {
|
|||||||
;
|
;
|
||||||
const uint8_t tcChannel = TIMER_TCCHANNEL(timer);
|
const uint8_t tcChannel = TIMER_TCCHANNEL(timer);
|
||||||
|
|
||||||
if (currentServoIndex[timer] < 0) {
|
int8_t cho = currentServoIndex[timer]; // Handle the prior servo first
|
||||||
|
if (cho < 0) { // Servo -1 indicates the refresh interval completed...
|
||||||
#if defined(_useTimer1) && defined(_useTimer2)
|
#if defined(_useTimer1) && defined(_useTimer2)
|
||||||
if (currentServoIndex[timer ^ 1] >= 0) {
|
if (currentServoIndex[timer ^ 1] >= 0) {
|
||||||
// Wait for both channels
|
// Wait for both channels
|
||||||
@@ -86,45 +87,37 @@ HAL_SERVO_TIMER_ISR() {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
tc->COUNT16.COUNT.reg = TC_COUNTER_START_VAL;
|
tc->COUNT16.COUNT.reg = TC_COUNTER_START_VAL; // ...so reset the timer
|
||||||
SYNC(tc->COUNT16.SYNCBUSY.bit.COUNT);
|
SYNC(tc->COUNT16.SYNCBUSY.bit.COUNT);
|
||||||
}
|
}
|
||||||
else if (SERVO_INDEX(timer, currentServoIndex[timer]) < ServoCount && SERVO(timer, currentServoIndex[timer]).Pin.isActive)
|
else if (SERVO_INDEX(timer, cho) < ServoCount) // prior channel handled?
|
||||||
digitalWrite(SERVO(timer, currentServoIndex[timer]).Pin.nbr, LOW); // pulse this channel low if activated
|
digitalWrite(SERVO(timer, cho).Pin.nbr, LOW); // pulse the prior channel LOW
|
||||||
|
|
||||||
// Select the next servo controlled by this timer
|
currentServoIndex[timer] = ++cho; // go to the next channel (or 0)
|
||||||
currentServoIndex[timer]++;
|
if (cho < SERVOS_PER_TIMER && SERVO_INDEX(timer, cho) < ServoCount) {
|
||||||
|
if (SERVO(timer, cho).Pin.isActive) // activated?
|
||||||
|
digitalWrite(SERVO(timer, cho).Pin.nbr, HIGH); // yes: pulse HIGH
|
||||||
|
|
||||||
if (SERVO_INDEX(timer, currentServoIndex[timer]) < ServoCount && currentServoIndex[timer] < SERVOS_PER_TIMER) {
|
tc->COUNT16.CC[tcChannel].reg = getTimerCount() - (uint16_t)SERVO(timer, cho).ticks;
|
||||||
if (SERVO(timer, currentServoIndex[timer]).Pin.isActive) // check if activated
|
|
||||||
digitalWrite(SERVO(timer, currentServoIndex[timer]).Pin.nbr, HIGH); // it's an active channel so pulse it high
|
|
||||||
|
|
||||||
tc->COUNT16.CC[tcChannel].reg = getTimerCount() - (uint16_t)SERVO(timer, currentServoIndex[timer]).ticks;
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
// finished all channels so wait for the refresh period to expire before starting over
|
// finished all channels so wait for the refresh period to expire before starting over
|
||||||
currentServoIndex[timer] = -1; // this will get incremented at the end of the refresh period to start again at the first channel
|
currentServoIndex[timer] = -1; // reset the timer COUNT.reg on the next call
|
||||||
|
const uint16_t cval = getTimerCount() - 256 / (SERVO_TIMER_PRESCALER), // allow 256 cycles to ensure the next CV not missed
|
||||||
const uint16_t tcCounterValue = getTimerCount();
|
ival = (TC_COUNTER_START_VAL) - (uint16_t)usToTicks(REFRESH_INTERVAL); // at least REFRESH_INTERVAL has elapsed
|
||||||
|
tc->COUNT16.CC[tcChannel].reg = min(cval, ival);
|
||||||
if ((TC_COUNTER_START_VAL - tcCounterValue) + 4UL < usToTicks(REFRESH_INTERVAL)) // allow a few ticks to ensure the next OCR1A not missed
|
|
||||||
tc->COUNT16.CC[tcChannel].reg = TC_COUNTER_START_VAL - (uint16_t)usToTicks(REFRESH_INTERVAL);
|
|
||||||
else
|
|
||||||
tc->COUNT16.CC[tcChannel].reg = (uint16_t)(tcCounterValue - 4UL); // at least REFRESH_INTERVAL has elapsed
|
|
||||||
}
|
}
|
||||||
if (tcChannel == 0) {
|
if (tcChannel == 0) {
|
||||||
SYNC(tc->COUNT16.SYNCBUSY.bit.CC0);
|
SYNC(tc->COUNT16.SYNCBUSY.bit.CC0);
|
||||||
// Clear the interrupt
|
tc->COUNT16.INTFLAG.reg = TC_INTFLAG_MC0; // Clear the interrupt
|
||||||
tc->COUNT16.INTFLAG.reg = TC_INTFLAG_MC0;
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
SYNC(tc->COUNT16.SYNCBUSY.bit.CC1);
|
SYNC(tc->COUNT16.SYNCBUSY.bit.CC1);
|
||||||
// Clear the interrupt
|
tc->COUNT16.INTFLAG.reg = TC_INTFLAG_MC1; // Clear the interrupt
|
||||||
tc->COUNT16.INTFLAG.reg = TC_INTFLAG_MC1;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void initISR(timer16_Sequence_t timer) {
|
void initISR(const timer16_Sequence_t timer) {
|
||||||
Tc * const tc = timer_config[SERVO_TC].pTc;
|
Tc * const tc = timer_config[SERVO_TC].pTc;
|
||||||
const uint8_t tcChannel = TIMER_TCCHANNEL(timer);
|
const uint8_t tcChannel = TIMER_TCCHANNEL(timer);
|
||||||
|
|
||||||
@@ -201,9 +194,9 @@ void initISR(timer16_Sequence_t timer) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void finISR(timer16_Sequence_t timer) {
|
void finISR(const timer16_Sequence_t timer_index) {
|
||||||
Tc * const tc = timer_config[SERVO_TC].pTc;
|
Tc * const tc = timer_config[SERVO_TC].pTc;
|
||||||
const uint8_t tcChannel = TIMER_TCCHANNEL(timer);
|
const uint8_t tcChannel = TIMER_TCCHANNEL(timer_index);
|
||||||
|
|
||||||
// Disable the match channel interrupt request
|
// Disable the match channel interrupt request
|
||||||
tc->COUNT16.INTENCLR.reg = (tcChannel == 0) ? TC_INTENCLR_MC0 : TC_INTENCLR_MC1;
|
tc->COUNT16.INTENCLR.reg = (tcChannel == 0) ? TC_INTENCLR_MC0 : TC_INTENCLR_MC1;
|
||||||
|
|||||||
@@ -29,7 +29,7 @@
|
|||||||
#define PRINT_PIN_ANALOG(p) do{ sprintf_P(buffer, PSTR(" (A%2d) "), DIGITAL_PIN_TO_ANALOG_PIN(pin)); SERIAL_ECHO(buffer); }while(0)
|
#define PRINT_PIN_ANALOG(p) do{ sprintf_P(buffer, PSTR(" (A%2d) "), DIGITAL_PIN_TO_ANALOG_PIN(pin)); SERIAL_ECHO(buffer); }while(0)
|
||||||
#define GET_ARRAY_PIN(p) pin_array[p].pin
|
#define GET_ARRAY_PIN(p) pin_array[p].pin
|
||||||
#define GET_ARRAY_IS_DIGITAL(p) pin_array[p].is_digital
|
#define GET_ARRAY_IS_DIGITAL(p) pin_array[p].is_digital
|
||||||
#define VALID_PIN(pin) (pin >= 0 && pin < (int8_t)NUMBER_PINS_TOTAL)
|
#define VALID_PIN(pin) (pin >= 0 && pin < int8_t(NUMBER_PINS_TOTAL))
|
||||||
#define DIGITAL_PIN_TO_ANALOG_PIN(p) digitalPinToAnalogInput(p)
|
#define DIGITAL_PIN_TO_ANALOG_PIN(p) digitalPinToAnalogInput(p)
|
||||||
#define IS_ANALOG(P) (DIGITAL_PIN_TO_ANALOG_PIN(P)!=-1)
|
#define IS_ANALOG(P) (DIGITAL_PIN_TO_ANALOG_PIN(P)!=-1)
|
||||||
#define pwm_status(pin) digitalPinHasPWM(pin)
|
#define pwm_status(pin) digitalPinHasPWM(pin)
|
||||||
|
|||||||
@@ -1,54 +0,0 @@
|
|||||||
/**
|
|
||||||
* Marlin 3D Printer Firmware
|
|
||||||
*
|
|
||||||
* Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
|
|
||||||
* SAMD51 HAL developed by Giuliano Zaro (AKA GMagician)
|
|
||||||
*
|
|
||||||
* This program is free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
#ifdef __SAMD51__
|
|
||||||
|
|
||||||
#include "../../inc/MarlinConfig.h"
|
|
||||||
|
|
||||||
#if ENABLED(USE_WATCHDOG)
|
|
||||||
|
|
||||||
#include "watchdog.h"
|
|
||||||
|
|
||||||
#define WDT_TIMEOUT_REG TERN(WATCHDOG_DURATION_8S, WDT_CONFIG_PER_CYC8192, WDT_CONFIG_PER_CYC4096) // 4 or 8 second timeout
|
|
||||||
|
|
||||||
void watchdog_init() {
|
|
||||||
// The low-power oscillator used by the WDT runs at 32,768 Hz with
|
|
||||||
// a 1:32 prescale, thus 1024 Hz, though probably not super precise.
|
|
||||||
|
|
||||||
// Setup WDT clocks
|
|
||||||
MCLK->APBAMASK.bit.OSC32KCTRL_ = true;
|
|
||||||
MCLK->APBAMASK.bit.WDT_ = true;
|
|
||||||
OSC32KCTRL->OSCULP32K.bit.EN1K = true; // Enable out 1K (this is what WDT uses)
|
|
||||||
|
|
||||||
WDT->CTRLA.bit.ENABLE = false; // Disable watchdog for config
|
|
||||||
SYNC(WDT->SYNCBUSY.bit.ENABLE);
|
|
||||||
|
|
||||||
WDT->INTENCLR.reg = WDT_INTENCLR_EW; // Disable early warning interrupt
|
|
||||||
WDT->CONFIG.reg = WDT_TIMEOUT_REG; // Set a 4s or 8s period for chip reset
|
|
||||||
|
|
||||||
HAL_watchdog_refresh();
|
|
||||||
|
|
||||||
WDT->CTRLA.reg = WDT_CTRLA_ENABLE; // Start watchdog now in normal mode
|
|
||||||
SYNC(WDT->SYNCBUSY.bit.ENABLE);
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif // USE_WATCHDOG
|
|
||||||
|
|
||||||
#endif // __SAMD51__
|
|
||||||
@@ -1,31 +0,0 @@
|
|||||||
/**
|
|
||||||
* Marlin 3D Printer Firmware
|
|
||||||
*
|
|
||||||
* Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
|
|
||||||
* SAMD51 HAL developed by Giuliano Zaro (AKA GMagician)
|
|
||||||
*
|
|
||||||
* This program is free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
// Initialize watchdog with a 4 second interrupt time
|
|
||||||
void watchdog_init();
|
|
||||||
|
|
||||||
// Reset watchdog. MUST be called at least every 4 seconds after the
|
|
||||||
// first watchdog_init or SAMD will go into emergency procedures.
|
|
||||||
inline void HAL_watchdog_refresh() {
|
|
||||||
SYNC(WDT->SYNCBUSY.bit.CLEAR); // Test first if previous is 'ongoing' to save time waiting for command execution
|
|
||||||
WDT->CLEAR.reg = WDT_CLEAR_CLEAR_KEY;
|
|
||||||
}
|
|
||||||
@@ -24,14 +24,13 @@
|
|||||||
|
|
||||||
#ifdef HAL_STM32
|
#ifdef HAL_STM32
|
||||||
|
|
||||||
#include "HAL.h"
|
|
||||||
#include "usb_serial.h"
|
|
||||||
|
|
||||||
#include "../../inc/MarlinConfig.h"
|
#include "../../inc/MarlinConfig.h"
|
||||||
#include "../shared/Delay.h"
|
#include "../shared/Delay.h"
|
||||||
|
|
||||||
|
#include "usb_serial.h"
|
||||||
|
|
||||||
#ifdef USBCON
|
#ifdef USBCON
|
||||||
DefaultSerial1 MSerial0(false, SerialUSB);
|
DefaultSerial1 MSerialUSB(false, SerialUSB);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if ENABLED(SRAM_EEPROM_EMULATION)
|
#if ENABLED(SRAM_EEPROM_EMULATION)
|
||||||
@@ -141,6 +140,29 @@ uint8_t MarlinHAL::get_reset_source() {
|
|||||||
|
|
||||||
void MarlinHAL::clear_reset_source() { __HAL_RCC_CLEAR_RESET_FLAGS(); }
|
void MarlinHAL::clear_reset_source() { __HAL_RCC_CLEAR_RESET_FLAGS(); }
|
||||||
|
|
||||||
|
// ------------------------
|
||||||
|
// Watchdog Timer
|
||||||
|
// ------------------------
|
||||||
|
|
||||||
|
#if ENABLED(USE_WATCHDOG)
|
||||||
|
|
||||||
|
#define WDT_TIMEOUT_US TERN(WATCHDOG_DURATION_8S, 8000000, 4000000) // 4 or 8 second timeout
|
||||||
|
|
||||||
|
#include <IWatchdog.h>
|
||||||
|
|
||||||
|
void MarlinHAL::watchdog_init() {
|
||||||
|
IF_DISABLED(DISABLE_WATCHDOG_INIT, IWatchdog.begin(WDT_TIMEOUT_US));
|
||||||
|
}
|
||||||
|
|
||||||
|
void MarlinHAL::watchdog_refresh() {
|
||||||
|
IWatchdog.reload();
|
||||||
|
#if DISABLED(PINS_DEBUGGING) && PIN_EXISTS(LED)
|
||||||
|
TOGGLE(LED_PIN); // heartbeat indicator
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
extern "C" {
|
extern "C" {
|
||||||
extern unsigned int _ebss; // end of bss section
|
extern unsigned int _ebss; // end of bss section
|
||||||
}
|
}
|
||||||
|
|||||||
+38
-23
@@ -30,7 +30,6 @@
|
|||||||
#include "../shared/HAL_SPI.h"
|
#include "../shared/HAL_SPI.h"
|
||||||
#include "fastio.h"
|
#include "fastio.h"
|
||||||
#include "Servo.h"
|
#include "Servo.h"
|
||||||
#include "watchdog.h"
|
|
||||||
#include "MarlinSerial.h"
|
#include "MarlinSerial.h"
|
||||||
|
|
||||||
#include "../../inc/MarlinConfigPre.h"
|
#include "../../inc/MarlinConfigPre.h"
|
||||||
@@ -51,57 +50,67 @@
|
|||||||
#include <USBSerial.h>
|
#include <USBSerial.h>
|
||||||
#include "../../core/serial_hook.h"
|
#include "../../core/serial_hook.h"
|
||||||
typedef ForwardSerial1Class< decltype(SerialUSB) > DefaultSerial1;
|
typedef ForwardSerial1Class< decltype(SerialUSB) > DefaultSerial1;
|
||||||
extern DefaultSerial1 MSerial0;
|
extern DefaultSerial1 MSerialUSB;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define _MSERIAL(X) MSerial##X
|
#define _MSERIAL(X) MSerial##X
|
||||||
#define MSERIAL(X) _MSERIAL(X)
|
#define MSERIAL(X) _MSERIAL(X)
|
||||||
|
|
||||||
#if SERIAL_PORT == -1
|
#if WITHIN(SERIAL_PORT, 1, 6)
|
||||||
#define MYSERIAL1 MSerial0
|
|
||||||
#elif WITHIN(SERIAL_PORT, 1, 6)
|
|
||||||
#define MYSERIAL1 MSERIAL(SERIAL_PORT)
|
#define MYSERIAL1 MSERIAL(SERIAL_PORT)
|
||||||
|
#elif !defined(USBCON)
|
||||||
|
#error "SERIAL_PORT must be from 1 to 6."
|
||||||
|
#elif SERIAL_PORT == -1
|
||||||
|
#define MYSERIAL1 MSerialUSB
|
||||||
#else
|
#else
|
||||||
#error "SERIAL_PORT must be from 1 to 6. You can also use -1 if the board supports Native USB."
|
#error "SERIAL_PORT must be from 1 to 6, or -1 for Native USB."
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef SERIAL_PORT_2
|
#ifdef SERIAL_PORT_2
|
||||||
#if SERIAL_PORT_2 == -1
|
#if WITHIN(SERIAL_PORT_2, 1, 6)
|
||||||
#define MYSERIAL2 MSerial0
|
|
||||||
#elif WITHIN(SERIAL_PORT_2, 1, 6)
|
|
||||||
#define MYSERIAL2 MSERIAL(SERIAL_PORT_2)
|
#define MYSERIAL2 MSERIAL(SERIAL_PORT_2)
|
||||||
|
#elif !defined(USBCON)
|
||||||
|
#error "SERIAL_PORT must be from 1 to 6."
|
||||||
|
#elif SERIAL_PORT_2 == -1
|
||||||
|
#define MYSERIAL2 MSerialUSB
|
||||||
#else
|
#else
|
||||||
#error "SERIAL_PORT_2 must be from 1 to 6. You can also use -1 if the board supports Native USB."
|
#error "SERIAL_PORT_2 must be from 1 to 6, or -1 for Native USB."
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef SERIAL_PORT_3
|
#ifdef SERIAL_PORT_3
|
||||||
#if SERIAL_PORT_3 == -1
|
#if WITHIN(SERIAL_PORT_3, 1, 6)
|
||||||
#define MYSERIAL3 MSerial0
|
|
||||||
#elif WITHIN(SERIAL_PORT_3, 1, 6)
|
|
||||||
#define MYSERIAL3 MSERIAL(SERIAL_PORT_3)
|
#define MYSERIAL3 MSERIAL(SERIAL_PORT_3)
|
||||||
|
#elif !defined(USBCON)
|
||||||
|
#error "SERIAL_PORT must be from 1 to 6."
|
||||||
|
#elif SERIAL_PORT_3 == -1
|
||||||
|
#define MYSERIAL3 MSerialUSB
|
||||||
#else
|
#else
|
||||||
#error "SERIAL_PORT_3 must be from 1 to 6. You can also use -1 if the board supports Native USB."
|
#error "SERIAL_PORT_3 must be from 1 to 6, or -1 for Native USB."
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef MMU2_SERIAL_PORT
|
#ifdef MMU2_SERIAL_PORT
|
||||||
#if MMU2_SERIAL_PORT == -1
|
#if WITHIN(MMU2_SERIAL_PORT, 1, 6)
|
||||||
#define MMU2_SERIAL MSerial0
|
|
||||||
#elif WITHIN(MMU2_SERIAL_PORT, 1, 6)
|
|
||||||
#define MMU2_SERIAL MSERIAL(MMU2_SERIAL_PORT)
|
#define MMU2_SERIAL MSERIAL(MMU2_SERIAL_PORT)
|
||||||
|
#elif !defined(USBCON)
|
||||||
|
#error "SERIAL_PORT must be from 1 to 6."
|
||||||
|
#elif MMU2_SERIAL_PORT == -1
|
||||||
|
#define MMU2_SERIAL MSerialUSB
|
||||||
#else
|
#else
|
||||||
#error "MMU2_SERIAL_PORT must be from 1 to 6. You can also use -1 if the board supports Native USB."
|
#error "MMU2_SERIAL_PORT must be from 1 to 6, or -1 for Native USB."
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef LCD_SERIAL_PORT
|
#ifdef LCD_SERIAL_PORT
|
||||||
#if LCD_SERIAL_PORT == -1
|
#if WITHIN(LCD_SERIAL_PORT, 1, 6)
|
||||||
#define LCD_SERIAL MSerial0
|
|
||||||
#elif WITHIN(LCD_SERIAL_PORT, 1, 6)
|
|
||||||
#define LCD_SERIAL MSERIAL(LCD_SERIAL_PORT)
|
#define LCD_SERIAL MSERIAL(LCD_SERIAL_PORT)
|
||||||
|
#elif !defined(USBCON)
|
||||||
|
#error "SERIAL_PORT must be from 1 to 6."
|
||||||
|
#elif LCD_SERIAL_PORT == -1
|
||||||
|
#define LCD_SERIAL MSerialUSB
|
||||||
#else
|
#else
|
||||||
#error "LCD_SERIAL_PORT must be from 1 to 6. You can also use -1 if the board supports Native USB."
|
#error "LCD_SERIAL_PORT must be from 1 to 6, or -1 for Native USB."
|
||||||
#endif
|
#endif
|
||||||
#if HAS_DGUS_LCD
|
#if HAS_DGUS_LCD
|
||||||
#define SERIAL_GET_TX_BUFFER_FREE() LCD_SERIAL.availableForWrite()
|
#define SERIAL_GET_TX_BUFFER_FREE() LCD_SERIAL.availableForWrite()
|
||||||
@@ -127,6 +136,8 @@
|
|||||||
// Types
|
// Types
|
||||||
// ------------------------
|
// ------------------------
|
||||||
|
|
||||||
|
typedef double isr_float_t; // FPU ops are used for single-precision, so use double for ISRs.
|
||||||
|
|
||||||
#ifdef STM32G0B1xx
|
#ifdef STM32G0B1xx
|
||||||
typedef int32_t pin_t;
|
typedef int32_t pin_t;
|
||||||
#else
|
#else
|
||||||
@@ -206,6 +217,10 @@ public:
|
|||||||
// Earliest possible init, before setup()
|
// Earliest possible init, before setup()
|
||||||
MarlinHAL() {}
|
MarlinHAL() {}
|
||||||
|
|
||||||
|
// Watchdog
|
||||||
|
static void watchdog_init() IF_DISABLED(USE_WATCHDOG, {});
|
||||||
|
static void watchdog_refresh() IF_DISABLED(USE_WATCHDOG, {});
|
||||||
|
|
||||||
static void init(); // Called early in setup()
|
static void init(); // Called early in setup()
|
||||||
static void init_board() {} // Called less early in setup()
|
static void init_board() {} // Called less early in setup()
|
||||||
static void reboot(); // Restart the firmware from 0x0
|
static void reboot(); // Restart the firmware from 0x0
|
||||||
@@ -241,7 +256,7 @@ public:
|
|||||||
// Called by Temperature::init for each sensor at startup
|
// Called by Temperature::init for each sensor at startup
|
||||||
static void adc_enable(const pin_t pin) { pinMode(pin, INPUT); }
|
static void adc_enable(const pin_t pin) { pinMode(pin, INPUT); }
|
||||||
|
|
||||||
// Begin ADC sampling on the given channel
|
// Begin ADC sampling on the given pin. Called from Temperature::isr!
|
||||||
static void adc_start(const pin_t pin) { adc_result = analogRead(pin); }
|
static void adc_start(const pin_t pin) { adc_result = analogRead(pin); }
|
||||||
|
|
||||||
// Is the ADC ready for reading?
|
// Is the ADC ready for reading?
|
||||||
|
|||||||
@@ -28,8 +28,7 @@
|
|||||||
|
|
||||||
#if ENABLED(POSTMORTEM_DEBUGGING)
|
#if ENABLED(POSTMORTEM_DEBUGGING)
|
||||||
|
|
||||||
#include "../shared/HAL_MinSerial.h"
|
#include "../shared/MinSerial.h"
|
||||||
#include "watchdog.h"
|
|
||||||
|
|
||||||
/* Instruction Synchronization Barrier */
|
/* Instruction Synchronization Barrier */
|
||||||
#define isb() __asm__ __volatile__ ("isb" : : : "memory")
|
#define isb() __asm__ __volatile__ ("isb" : : : "memory")
|
||||||
@@ -120,7 +119,7 @@ static void TX(char c) {
|
|||||||
#if WITHIN(SERIAL_PORT, 1, 6)
|
#if WITHIN(SERIAL_PORT, 1, 6)
|
||||||
constexpr uint32_t usart_sr_txe = _BV(7);
|
constexpr uint32_t usart_sr_txe = _BV(7);
|
||||||
while (!(regs->SR & usart_sr_txe)) {
|
while (!(regs->SR & usart_sr_txe)) {
|
||||||
TERN_(USE_WATCHDOG, HAL_watchdog_refresh());
|
hal.watchdog_refresh();
|
||||||
sw_barrier();
|
sw_barrier();
|
||||||
}
|
}
|
||||||
regs->DR = c;
|
regs->DR = c;
|
||||||
@@ -27,3 +27,8 @@
|
|||||||
#elif EITHER(I2C_EEPROM, SPI_EEPROM)
|
#elif EITHER(I2C_EEPROM, SPI_EEPROM)
|
||||||
#define USE_SHARED_EEPROM 1
|
#define USE_SHARED_EEPROM 1
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
// Some STM32F4 boards may lose steps when saving to EEPROM during print (PR #17946)
|
||||||
|
#if defined(STM32F4xx) && ENABLED(FLASH_EEPROM_EMULATION) && PRINTCOUNTER_SAVE_INTERVAL > 0
|
||||||
|
#define PRINTCOUNTER_SYNC 1
|
||||||
|
#endif
|
||||||
|
|||||||
@@ -37,11 +37,6 @@
|
|||||||
#error "SDCARD_EEPROM_EMULATION requires SDSUPPORT. Enable SDSUPPORT or choose another EEPROM emulation."
|
#error "SDCARD_EEPROM_EMULATION requires SDSUPPORT. Enable SDSUPPORT or choose another EEPROM emulation."
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(STM32F4xx) && BOTH(PRINTCOUNTER, FLASH_EEPROM_EMULATION)
|
|
||||||
#warning "FLASH_EEPROM_EMULATION may cause long delays when writing and should not be used while printing."
|
|
||||||
#error "Disable PRINTCOUNTER or choose another EEPROM emulation."
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if !defined(STM32F4xx) && ENABLED(FLASH_EEPROM_LEVELING)
|
#if !defined(STM32F4xx) && ENABLED(FLASH_EEPROM_LEVELING)
|
||||||
#error "FLASH_EEPROM_LEVELING is currently only supported on STM32F4 hardware."
|
#error "FLASH_EEPROM_LEVELING is currently only supported on STM32F4 hardware."
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -57,7 +57,7 @@ public:
|
|||||||
auto sd2card = diskIODriver();
|
auto sd2card = diskIODriver();
|
||||||
// single block
|
// single block
|
||||||
if (blkLen == 1) {
|
if (blkLen == 1) {
|
||||||
watchdog_refresh();
|
hal.watchdog_refresh();
|
||||||
sd2card->writeBlock(blkAddr, pBuf);
|
sd2card->writeBlock(blkAddr, pBuf);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -65,7 +65,7 @@ public:
|
|||||||
// multi block optimization
|
// multi block optimization
|
||||||
sd2card->writeStart(blkAddr, blkLen);
|
sd2card->writeStart(blkAddr, blkLen);
|
||||||
while (blkLen--) {
|
while (blkLen--) {
|
||||||
watchdog_refresh();
|
hal.watchdog_refresh();
|
||||||
sd2card->writeData(pBuf);
|
sd2card->writeData(pBuf);
|
||||||
pBuf += BLOCK_SIZE;
|
pBuf += BLOCK_SIZE;
|
||||||
}
|
}
|
||||||
@@ -77,7 +77,7 @@ public:
|
|||||||
auto sd2card = diskIODriver();
|
auto sd2card = diskIODriver();
|
||||||
// single block
|
// single block
|
||||||
if (blkLen == 1) {
|
if (blkLen == 1) {
|
||||||
watchdog_refresh();
|
hal.watchdog_refresh();
|
||||||
sd2card->readBlock(blkAddr, pBuf);
|
sd2card->readBlock(blkAddr, pBuf);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -85,7 +85,7 @@ public:
|
|||||||
// multi block optimization
|
// multi block optimization
|
||||||
sd2card->readStart(blkAddr);
|
sd2card->readStart(blkAddr);
|
||||||
while (blkLen--) {
|
while (blkLen--) {
|
||||||
watchdog_refresh();
|
hal.watchdog_refresh();
|
||||||
sd2card->readData(pBuf);
|
sd2card->readData(pBuf);
|
||||||
pBuf += BLOCK_SIZE;
|
pBuf += BLOCK_SIZE;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -79,7 +79,6 @@
|
|||||||
// make a list of the Arduino pin numbers in the Port/Pin order
|
// make a list of the Arduino pin numbers in the Port/Pin order
|
||||||
//
|
//
|
||||||
|
|
||||||
#define _PIN_ADD_2(NAME_ALPHA, ARDUINO_NUM) { {NAME_ALPHA}, ARDUINO_NUM },
|
|
||||||
#define _PIN_ADD(NAME_ALPHA, ARDUINO_NUM) { NAME_ALPHA, ARDUINO_NUM },
|
#define _PIN_ADD(NAME_ALPHA, ARDUINO_NUM) { NAME_ALPHA, ARDUINO_NUM },
|
||||||
#define PIN_ADD(NAME) _PIN_ADD(#NAME, NAME)
|
#define PIN_ADD(NAME) _PIN_ADD(#NAME, NAME)
|
||||||
|
|
||||||
@@ -108,8 +107,13 @@ const XrefInfo pin_xref[] PROGMEM = {
|
|||||||
/**
|
/**
|
||||||
* Translation of routines & variables used by pinsDebug.h
|
* Translation of routines & variables used by pinsDebug.h
|
||||||
*/
|
*/
|
||||||
#define NUMBER_PINS_TOTAL NUM_DIGITAL_PINS
|
|
||||||
#define VALID_PIN(ANUM) ((ANUM) >= 0 && (ANUM) < NUMBER_PINS_TOTAL)
|
#if NUM_ANALOG_FIRST >= NUM_DIGITAL_PINS
|
||||||
|
#define HAS_HIGH_ANALOG_PINS 1
|
||||||
|
#endif
|
||||||
|
#define NUM_ANALOG_LAST ((NUM_ANALOG_FIRST) + (NUM_ANALOG_INPUTS) - 1)
|
||||||
|
#define NUMBER_PINS_TOTAL ((NUM_DIGITAL_PINS) + TERN0(HAS_HIGH_ANALOG_PINS, NUM_ANALOG_INPUTS))
|
||||||
|
#define VALID_PIN(P) (WITHIN(P, 0, (NUM_DIGITAL_PINS) - 1) || TERN0(HAS_HIGH_ANALOG_PINS, WITHIN(P, NUM_ANALOG_FIRST, NUM_ANALOG_LAST)))
|
||||||
#define digitalRead_mod(Ard_num) extDigitalRead(Ard_num) // must use Arduino pin numbers when doing reads
|
#define digitalRead_mod(Ard_num) extDigitalRead(Ard_num) // must use Arduino pin numbers when doing reads
|
||||||
#define PRINT_PIN(Q)
|
#define PRINT_PIN(Q)
|
||||||
#define PRINT_PIN_ANALOG(p) do{ sprintf_P(buffer, PSTR(" (A%2d) "), DIGITAL_PIN_TO_ANALOG_PIN(pin)); SERIAL_ECHO(buffer); }while(0)
|
#define PRINT_PIN_ANALOG(p) do{ sprintf_P(buffer, PSTR(" (A%2d) "), DIGITAL_PIN_TO_ANALOG_PIN(pin)); SERIAL_ECHO(buffer); }while(0)
|
||||||
@@ -164,17 +168,20 @@ bool GET_PINMODE(const pin_t Ard_num) {
|
|||||||
return pin_mode == MODE_PIN_OUTPUT || pin_mode == MODE_PIN_ALT; // assume all alt definitions are PWM
|
return pin_mode == MODE_PIN_OUTPUT || pin_mode == MODE_PIN_ALT; // assume all alt definitions are PWM
|
||||||
}
|
}
|
||||||
|
|
||||||
int8_t digital_pin_to_analog_pin(pin_t Ard_num) {
|
int8_t digital_pin_to_analog_pin(const pin_t Ard_num) {
|
||||||
Ard_num -= NUM_ANALOG_FIRST;
|
if (WITHIN(Ard_num, NUM_ANALOG_FIRST, NUM_ANALOG_LAST))
|
||||||
return (Ard_num >= 0 && Ard_num < NUM_ANALOG_INPUTS) ? Ard_num : -1;
|
return Ard_num - NUM_ANALOG_FIRST;
|
||||||
|
|
||||||
|
const uint32_t ind = digitalPinToAnalogInput(Ard_num);
|
||||||
|
return (ind < NUM_ANALOG_INPUTS) ? ind : -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool IS_ANALOG(const pin_t Ard_num) {
|
bool IS_ANALOG(const pin_t Ard_num) {
|
||||||
return get_pin_mode(Ard_num) == MODE_PIN_ANALOG;
|
return get_pin_mode(Ard_num) == MODE_PIN_ANALOG;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool is_digital(const pin_t x) {
|
bool is_digital(const pin_t Ard_num) {
|
||||||
const uint8_t pin_mode = get_pin_mode(pin_array[x].pin);
|
const uint8_t pin_mode = get_pin_mode(pin_array[Ard_num].pin);
|
||||||
return pin_mode == MODE_PIN_INPUT || pin_mode == MODE_PIN_OUTPUT;
|
return pin_mode == MODE_PIN_INPUT || pin_mode == MODE_PIN_OUTPUT;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -200,10 +207,18 @@ void port_print(const pin_t Ard_num) {
|
|||||||
SERIAL_ECHO_SP(7);
|
SERIAL_ECHO_SP(7);
|
||||||
|
|
||||||
// Print number to be used with M42
|
// Print number to be used with M42
|
||||||
sprintf_P(buffer, PSTR(" M42 P%d "), Ard_num);
|
int calc_p = Ard_num;
|
||||||
SERIAL_ECHO(buffer);
|
if (Ard_num > NUM_DIGITAL_PINS) {
|
||||||
if (Ard_num < 10) SERIAL_CHAR(' ');
|
calc_p -= NUM_ANALOG_FIRST;
|
||||||
if (Ard_num < 100) SERIAL_CHAR(' ');
|
if (calc_p > 7) calc_p += 8;
|
||||||
|
}
|
||||||
|
SERIAL_ECHOPGM(" M42 P", calc_p);
|
||||||
|
SERIAL_CHAR(' ');
|
||||||
|
if (calc_p < 100) {
|
||||||
|
SERIAL_CHAR(' ');
|
||||||
|
if (calc_p < 10)
|
||||||
|
SERIAL_CHAR(' ');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool pwm_status(const pin_t Ard_num) {
|
bool pwm_status(const pin_t Ard_num) {
|
||||||
|
|||||||
+204
-73
@@ -33,7 +33,6 @@
|
|||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
|
|
||||||
// use local drivers
|
|
||||||
#if defined(STM32F103xE) || defined(STM32F103xG)
|
#if defined(STM32F103xE) || defined(STM32F103xG)
|
||||||
#include <stm32f1xx_hal_rcc_ex.h>
|
#include <stm32f1xx_hal_rcc_ex.h>
|
||||||
#include <stm32f1xx_hal_sd.h>
|
#include <stm32f1xx_hal_sd.h>
|
||||||
@@ -47,15 +46,123 @@
|
|||||||
#include <stm32f7xx_hal_dma.h>
|
#include <stm32f7xx_hal_dma.h>
|
||||||
#include <stm32f7xx_hal_gpio.h>
|
#include <stm32f7xx_hal_gpio.h>
|
||||||
#include <stm32f7xx_hal_sd.h>
|
#include <stm32f7xx_hal_sd.h>
|
||||||
|
#elif defined(STM32H7xx)
|
||||||
|
#define SDIO_FOR_STM32H7
|
||||||
|
#include <stm32h7xx_hal_rcc.h>
|
||||||
|
#include <stm32h7xx_hal_dma.h>
|
||||||
|
#include <stm32h7xx_hal_gpio.h>
|
||||||
|
#include <stm32h7xx_hal_sd.h>
|
||||||
#else
|
#else
|
||||||
#error "SDIO only supported with STM32F103xE, STM32F103xG, STM32F4xx, or STM32F7xx."
|
#error "SDIO is only supported with STM32F103xE, STM32F103xG, STM32F4xx, STM32F7xx, and STM32H7xx."
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// SDIO Max Clock (naming from STM Manual, don't change)
|
||||||
|
#define SDIOCLK 48000000
|
||||||
|
|
||||||
|
// Target Clock, configurable. Default is 18MHz, from STM32F1
|
||||||
|
#ifndef SDIO_CLOCK
|
||||||
|
#define SDIO_CLOCK 18000000 // 18 MHz
|
||||||
|
#endif
|
||||||
|
|
||||||
|
SD_HandleTypeDef hsd; // SDIO structure
|
||||||
|
|
||||||
|
static uint32_t clock_to_divider(uint32_t clk) {
|
||||||
|
#ifdef SDIO_FOR_STM32H7
|
||||||
|
// SDMMC_CK frequency = sdmmc_ker_ck / [2 * CLKDIV].
|
||||||
|
uint32_t sdmmc_clk = HAL_RCCEx_GetPeriphCLKFreq(RCC_PERIPHCLK_SDMMC);
|
||||||
|
return sdmmc_clk / (2U * SDIO_CLOCK) + (sdmmc_clk % (2U * SDIO_CLOCK) != 0);
|
||||||
|
#else
|
||||||
|
// limit the SDIO master clock to 8/3 of PCLK2. See STM32 Manuals
|
||||||
|
// Also limited to no more than 48Mhz (SDIOCLK).
|
||||||
|
const uint32_t pclk2 = HAL_RCC_GetPCLK2Freq();
|
||||||
|
clk = min(clk, (uint32_t)(pclk2 * 8 / 3));
|
||||||
|
clk = min(clk, (uint32_t)SDIOCLK);
|
||||||
|
// Round up divider, so we don't run the card over the speed supported,
|
||||||
|
// and subtract by 2, because STM32 will add 2, as written in the manual:
|
||||||
|
// SDIO_CK frequency = SDIOCLK / [CLKDIV + 2]
|
||||||
|
return pclk2 / clk + (pclk2 % clk != 0) - 2;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
// Start the SDIO clock
|
||||||
|
void HAL_SD_MspInit(SD_HandleTypeDef *hsd) {
|
||||||
|
UNUSED(hsd);
|
||||||
|
#ifdef SDIO_FOR_STM32H7
|
||||||
|
pinmap_pinout(PC_12, PinMap_SD);
|
||||||
|
pinmap_pinout(PD_2, PinMap_SD);
|
||||||
|
pinmap_pinout(PC_8, PinMap_SD);
|
||||||
|
#if PINS_EXIST(SDIO_D1, SDIO_D2, SDIO_D3) // Define D1-D3 only for 4-bit wide SDIO bus
|
||||||
|
pinmap_pinout(PC_9, PinMap_SD);
|
||||||
|
pinmap_pinout(PC_10, PinMap_SD);
|
||||||
|
pinmap_pinout(PC_11, PinMap_SD);
|
||||||
|
#endif
|
||||||
|
__HAL_RCC_SDMMC1_CLK_ENABLE();
|
||||||
|
HAL_NVIC_EnableIRQ(SDMMC1_IRQn);
|
||||||
|
#else
|
||||||
|
__HAL_RCC_SDIO_CLK_ENABLE();
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifdef SDIO_FOR_STM32H7
|
||||||
|
|
||||||
|
#define SD_TIMEOUT 1000 // ms
|
||||||
|
|
||||||
|
extern "C" void SDMMC1_IRQHandler(void) { HAL_SD_IRQHandler(&hsd); }
|
||||||
|
|
||||||
|
uint8_t waitingRxCplt = 0, waitingTxCplt = 0;
|
||||||
|
void HAL_SD_TxCpltCallback(SD_HandleTypeDef *hsdio) { waitingTxCplt = 0; }
|
||||||
|
void HAL_SD_RxCpltCallback(SD_HandleTypeDef *hsdio) { waitingRxCplt = 0; }
|
||||||
|
|
||||||
|
void HAL_SD_MspDeInit(SD_HandleTypeDef *hsd) {
|
||||||
|
__HAL_RCC_SDMMC1_FORCE_RESET(); delay(10);
|
||||||
|
__HAL_RCC_SDMMC1_RELEASE_RESET(); delay(10);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool SDIO_Init() {
|
||||||
|
HAL_StatusTypeDef sd_state = HAL_OK;
|
||||||
|
if (hsd.Instance == SDMMC1) HAL_SD_DeInit(&hsd);
|
||||||
|
|
||||||
|
// HAL SD initialization
|
||||||
|
hsd.Instance = SDMMC1;
|
||||||
|
hsd.Init.ClockEdge = SDMMC_CLOCK_EDGE_RISING;
|
||||||
|
hsd.Init.ClockPowerSave = SDMMC_CLOCK_POWER_SAVE_DISABLE;
|
||||||
|
hsd.Init.BusWide = SDMMC_BUS_WIDE_1B;
|
||||||
|
hsd.Init.HardwareFlowControl = SDMMC_HARDWARE_FLOW_CONTROL_DISABLE;
|
||||||
|
hsd.Init.ClockDiv = clock_to_divider(SDIO_CLOCK);
|
||||||
|
sd_state = HAL_SD_Init(&hsd);
|
||||||
|
|
||||||
|
#if PINS_EXIST(SDIO_D1, SDIO_D2, SDIO_D3)
|
||||||
|
if (sd_state == HAL_OK)
|
||||||
|
sd_state = HAL_SD_ConfigWideBusOperation(&hsd, SDMMC_BUS_WIDE_4B);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
return (sd_state == HAL_OK);
|
||||||
|
}
|
||||||
|
|
||||||
|
#else // !SDIO_FOR_STM32H7
|
||||||
|
|
||||||
|
#define SD_TIMEOUT 500 // ms
|
||||||
|
|
||||||
|
// SDIO retries, configurable. Default is 3, from STM32F1
|
||||||
|
#ifndef SDIO_READ_RETRIES
|
||||||
|
#define SDIO_READ_RETRIES 3
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
SD_HandleTypeDef hsd; // create SDIO structure
|
|
||||||
// F4 supports one DMA for RX and another for TX, but Marlin will never
|
// F4 supports one DMA for RX and another for TX, but Marlin will never
|
||||||
// do read and write at same time, so we use the same DMA for both.
|
// do read and write at same time, so we use the same DMA for both.
|
||||||
DMA_HandleTypeDef hdma_sdio;
|
DMA_HandleTypeDef hdma_sdio;
|
||||||
|
|
||||||
|
#ifdef STM32F1xx
|
||||||
|
#define DMA_IRQ_HANDLER DMA2_Channel4_5_IRQHandler
|
||||||
|
#elif defined(STM32F4xx)
|
||||||
|
#define DMA_IRQ_HANDLER DMA2_Stream3_IRQHandler
|
||||||
|
#else
|
||||||
|
#error "Unknown STM32 architecture."
|
||||||
|
#endif
|
||||||
|
|
||||||
|
extern "C" void SDIO_IRQHandler(void) { HAL_SD_IRQHandler(&hsd); }
|
||||||
|
extern "C" void DMA_IRQ_HANDLER(void) { HAL_DMA_IRQHandler(&hdma_sdio); }
|
||||||
|
|
||||||
/*
|
/*
|
||||||
SDIO_INIT_CLK_DIV is 118
|
SDIO_INIT_CLK_DIV is 118
|
||||||
SDIO clock frequency is 48MHz / (TRANSFER_CLOCK_DIV + 2)
|
SDIO clock frequency is 48MHz / (TRANSFER_CLOCK_DIV + 2)
|
||||||
@@ -65,39 +172,10 @@ DMA_HandleTypeDef hdma_sdio;
|
|||||||
Default SDIO clock frequency is 48MHz / (2 + 2) = 12 MHz
|
Default SDIO clock frequency is 48MHz / (2 + 2) = 12 MHz
|
||||||
This might be too fast for stable SDIO operations
|
This might be too fast for stable SDIO operations
|
||||||
|
|
||||||
MKS Robin board seems to have stable SDIO with BusWide 1bit and ClockDiv 8 i.e. 4.8MHz SDIO clock frequency
|
MKS Robin SDIO seems stable with BusWide 1bit and ClockDiv 8 (i.e., 4.8MHz SDIO clock frequency)
|
||||||
Additional testing is required as there are clearly some 4bit initialization problems
|
More testing is required as there are clearly some 4bit init problems.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef USBD_OK
|
|
||||||
#define USBD_OK 0
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// Target Clock, configurable. Default is 18MHz, from STM32F1
|
|
||||||
#ifndef SDIO_CLOCK
|
|
||||||
#define SDIO_CLOCK 18000000 // 18 MHz
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// SDIO retries, configurable. Default is 3, from STM32F1
|
|
||||||
#ifndef SDIO_READ_RETRIES
|
|
||||||
#define SDIO_READ_RETRIES 3
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// SDIO Max Clock (naming from STM Manual, don't change)
|
|
||||||
#define SDIOCLK 48000000
|
|
||||||
|
|
||||||
static uint32_t clock_to_divider(uint32_t clk) {
|
|
||||||
// limit the SDIO master clock to 8/3 of PCLK2. See STM32 Manuals
|
|
||||||
// Also limited to no more than 48Mhz (SDIOCLK).
|
|
||||||
const uint32_t pclk2 = HAL_RCC_GetPCLK2Freq();
|
|
||||||
clk = min(clk, (uint32_t)(pclk2 * 8 / 3));
|
|
||||||
clk = min(clk, (uint32_t)SDIOCLK);
|
|
||||||
// Round up divider, so we don't run the card over the speed supported,
|
|
||||||
// and subtract by 2, because STM32 will add 2, as written in the manual:
|
|
||||||
// SDIO_CK frequency = SDIOCLK / [CLKDIV + 2]
|
|
||||||
return pclk2 / clk + (pclk2 % clk != 0) - 2;
|
|
||||||
}
|
|
||||||
|
|
||||||
void go_to_transfer_speed() {
|
void go_to_transfer_speed() {
|
||||||
/* Default SDIO peripheral configuration for SD card initialization */
|
/* Default SDIO peripheral configuration for SD card initialization */
|
||||||
hsd.Init.ClockEdge = hsd.Init.ClockEdge;
|
hsd.Init.ClockEdge = hsd.Init.ClockEdge;
|
||||||
@@ -111,16 +189,17 @@ void go_to_transfer_speed() {
|
|||||||
SDIO_Init(hsd.Instance, hsd.Init);
|
SDIO_Init(hsd.Instance, hsd.Init);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SD_LowLevel_Init(void) {
|
void SD_LowLevel_Init() {
|
||||||
uint32_t tempreg;
|
uint32_t tempreg;
|
||||||
|
|
||||||
__HAL_RCC_GPIOC_CLK_ENABLE(); //enable GPIO clocks
|
// Enable GPIO clocks
|
||||||
__HAL_RCC_GPIOD_CLK_ENABLE(); //enable GPIO clocks
|
__HAL_RCC_GPIOC_CLK_ENABLE();
|
||||||
|
__HAL_RCC_GPIOD_CLK_ENABLE();
|
||||||
|
|
||||||
GPIO_InitTypeDef GPIO_InitStruct;
|
GPIO_InitTypeDef GPIO_InitStruct;
|
||||||
|
|
||||||
GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
|
GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
|
||||||
GPIO_InitStruct.Pull = 1; //GPIO_NOPULL;
|
GPIO_InitStruct.Pull = 1; // GPIO_NOPULL
|
||||||
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_HIGH;
|
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_HIGH;
|
||||||
|
|
||||||
#if DISABLED(STM32F1xx)
|
#if DISABLED(STM32F1xx)
|
||||||
@@ -140,7 +219,7 @@ void SD_LowLevel_Init(void) {
|
|||||||
HAL_GPIO_Init(GPIOD, &GPIO_InitStruct);
|
HAL_GPIO_Init(GPIOD, &GPIO_InitStruct);
|
||||||
|
|
||||||
// Setup DMA
|
// Setup DMA
|
||||||
#if defined(STM32F1xx)
|
#ifdef STM32F1xx
|
||||||
hdma_sdio.Init.Mode = DMA_NORMAL;
|
hdma_sdio.Init.Mode = DMA_NORMAL;
|
||||||
hdma_sdio.Instance = DMA2_Channel4;
|
hdma_sdio.Instance = DMA2_Channel4;
|
||||||
HAL_NVIC_EnableIRQ(DMA2_Channel4_5_IRQn);
|
HAL_NVIC_EnableIRQ(DMA2_Channel4_5_IRQn);
|
||||||
@@ -163,27 +242,23 @@ void SD_LowLevel_Init(void) {
|
|||||||
__HAL_LINKDMA(&hsd, hdmarx, hdma_sdio);
|
__HAL_LINKDMA(&hsd, hdmarx, hdma_sdio);
|
||||||
__HAL_LINKDMA(&hsd, hdmatx, hdma_sdio);
|
__HAL_LINKDMA(&hsd, hdmatx, hdma_sdio);
|
||||||
|
|
||||||
#if defined(STM32F1xx)
|
#ifdef STM32F1xx
|
||||||
__HAL_RCC_SDIO_CLK_ENABLE();
|
__HAL_RCC_SDIO_CLK_ENABLE();
|
||||||
__HAL_RCC_DMA2_CLK_ENABLE();
|
__HAL_RCC_DMA2_CLK_ENABLE();
|
||||||
#else
|
#else
|
||||||
__HAL_RCC_SDIO_FORCE_RESET();
|
__HAL_RCC_SDIO_FORCE_RESET(); delay(2);
|
||||||
delay(2);
|
__HAL_RCC_SDIO_RELEASE_RESET(); delay(2);
|
||||||
__HAL_RCC_SDIO_RELEASE_RESET();
|
|
||||||
delay(2);
|
|
||||||
__HAL_RCC_SDIO_CLK_ENABLE();
|
__HAL_RCC_SDIO_CLK_ENABLE();
|
||||||
|
|
||||||
__HAL_RCC_DMA2_FORCE_RESET();
|
__HAL_RCC_DMA2_FORCE_RESET(); delay(2);
|
||||||
delay(2);
|
__HAL_RCC_DMA2_RELEASE_RESET(); delay(2);
|
||||||
__HAL_RCC_DMA2_RELEASE_RESET();
|
|
||||||
delay(2);
|
|
||||||
__HAL_RCC_DMA2_CLK_ENABLE();
|
__HAL_RCC_DMA2_CLK_ENABLE();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Initialize the SDIO (with initial <400Khz Clock)
|
// Initialize the SDIO (with initial <400Khz Clock)
|
||||||
tempreg = 0; //Reset value
|
tempreg = 0 // Reset value
|
||||||
tempreg |= SDIO_CLKCR_CLKEN; // Clock enabled
|
| SDIO_CLKCR_CLKEN // Clock enabled
|
||||||
tempreg |= SDIO_INIT_CLK_DIV; // Clock Divider. Clock = 48000 / (118 + 2) = 400Khz
|
| SDIO_INIT_CLK_DIV; // Clock Divider. Clock = 48000 / (118 + 2) = 400Khz
|
||||||
// Keep the rest at 0 => HW_Flow Disabled, Rising Clock Edge, Disable CLK ByPass, Bus Width = 0, Power save Disable
|
// Keep the rest at 0 => HW_Flow Disabled, Rising Clock Edge, Disable CLK ByPass, Bus Width = 0, Power save Disable
|
||||||
SDIO->CLKCR = tempreg;
|
SDIO->CLKCR = tempreg;
|
||||||
|
|
||||||
@@ -192,11 +267,6 @@ void SD_LowLevel_Init(void) {
|
|||||||
hsd.Instance = SDIO;
|
hsd.Instance = SDIO;
|
||||||
}
|
}
|
||||||
|
|
||||||
void HAL_SD_MspInit(SD_HandleTypeDef *hsd) { // application specific init
|
|
||||||
UNUSED(hsd); // Prevent unused argument(s) compilation warning
|
|
||||||
__HAL_RCC_SDIO_CLK_ENABLE(); // turn on SDIO clock
|
|
||||||
}
|
|
||||||
|
|
||||||
bool SDIO_Init() {
|
bool SDIO_Init() {
|
||||||
uint8_t retryCnt = SDIO_READ_RETRIES;
|
uint8_t retryCnt = SDIO_READ_RETRIES;
|
||||||
|
|
||||||
@@ -208,7 +278,7 @@ bool SDIO_Init() {
|
|||||||
|
|
||||||
uint8_t retry_Cnt = retryCnt;
|
uint8_t retry_Cnt = retryCnt;
|
||||||
for (;;) {
|
for (;;) {
|
||||||
TERN_(USE_WATCHDOG, HAL_watchdog_refresh());
|
hal.watchdog_refresh();
|
||||||
status = (bool) HAL_SD_Init(&hsd);
|
status = (bool) HAL_SD_Init(&hsd);
|
||||||
if (!status) break;
|
if (!status) break;
|
||||||
if (!--retry_Cnt) return false; // return failing status if retries are exhausted
|
if (!--retry_Cnt) return false; // return failing status if retries are exhausted
|
||||||
@@ -219,7 +289,7 @@ bool SDIO_Init() {
|
|||||||
#if PINS_EXIST(SDIO_D1, SDIO_D2, SDIO_D3) // go to 4 bit wide mode if pins are defined
|
#if PINS_EXIST(SDIO_D1, SDIO_D2, SDIO_D3) // go to 4 bit wide mode if pins are defined
|
||||||
retry_Cnt = retryCnt;
|
retry_Cnt = retryCnt;
|
||||||
for (;;) {
|
for (;;) {
|
||||||
TERN_(USE_WATCHDOG, HAL_watchdog_refresh());
|
hal.watchdog_refresh();
|
||||||
if (!HAL_SD_ConfigWideBusOperation(&hsd, SDIO_BUS_WIDE_4B)) break; // some cards are only 1 bit wide so a pass here is not required
|
if (!HAL_SD_ConfigWideBusOperation(&hsd, SDIO_BUS_WIDE_4B)) break; // some cards are only 1 bit wide so a pass here is not required
|
||||||
if (!--retry_Cnt) break;
|
if (!--retry_Cnt) break;
|
||||||
}
|
}
|
||||||
@@ -228,7 +298,7 @@ bool SDIO_Init() {
|
|||||||
SD_LowLevel_Init();
|
SD_LowLevel_Init();
|
||||||
retry_Cnt = retryCnt;
|
retry_Cnt = retryCnt;
|
||||||
for (;;) {
|
for (;;) {
|
||||||
TERN_(USE_WATCHDOG, HAL_watchdog_refresh());
|
hal.watchdog_refresh();
|
||||||
status = (bool) HAL_SD_Init(&hsd);
|
status = (bool) HAL_SD_Init(&hsd);
|
||||||
if (!status) break;
|
if (!status) break;
|
||||||
if (!--retry_Cnt) return false; // return failing status if retries are exhausted
|
if (!--retry_Cnt) return false; // return failing status if retries are exhausted
|
||||||
@@ -240,10 +310,20 @@ bool SDIO_Init() {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Read or Write a block
|
||||||
|
* @details Read or Write a block with SDIO
|
||||||
|
*
|
||||||
|
* @param block The block index
|
||||||
|
* @param src The data buffer source for a write
|
||||||
|
* @param dst The data buffer destination for a read
|
||||||
|
*
|
||||||
|
* @return true on success
|
||||||
|
*/
|
||||||
static bool SDIO_ReadWriteBlock_DMA(uint32_t block, const uint8_t *src, uint8_t *dst) {
|
static bool SDIO_ReadWriteBlock_DMA(uint32_t block, const uint8_t *src, uint8_t *dst) {
|
||||||
if (HAL_SD_GetCardState(&hsd) != HAL_SD_CARD_TRANSFER) return false;
|
if (HAL_SD_GetCardState(&hsd) != HAL_SD_CARD_TRANSFER) return false;
|
||||||
|
|
||||||
TERN_(USE_WATCHDOG, HAL_watchdog_refresh());
|
hal.watchdog_refresh();
|
||||||
|
|
||||||
HAL_StatusTypeDef ret;
|
HAL_StatusTypeDef ret;
|
||||||
if (src) {
|
if (src) {
|
||||||
@@ -263,7 +343,7 @@ static bool SDIO_ReadWriteBlock_DMA(uint32_t block, const uint8_t *src, uint8_t
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
millis_t timeout = millis() + 500;
|
millis_t timeout = millis() + SD_TIMEOUT;
|
||||||
// Wait the transfer
|
// Wait the transfer
|
||||||
while (hsd.State != HAL_SD_STATE_READY) {
|
while (hsd.State != HAL_SD_STATE_READY) {
|
||||||
if (ELAPSED(millis(), timeout)) {
|
if (ELAPSED(millis(), timeout)) {
|
||||||
@@ -279,22 +359,84 @@ static bool SDIO_ReadWriteBlock_DMA(uint32_t block, const uint8_t *src, uint8_t
|
|||||||
HAL_DMA_Abort_IT(&hdma_sdio);
|
HAL_DMA_Abort_IT(&hdma_sdio);
|
||||||
HAL_DMA_DeInit(&hdma_sdio);
|
HAL_DMA_DeInit(&hdma_sdio);
|
||||||
|
|
||||||
timeout = millis() + 500;
|
timeout = millis() + SD_TIMEOUT;
|
||||||
while (HAL_SD_GetCardState(&hsd) != HAL_SD_CARD_TRANSFER) if (ELAPSED(millis(), timeout)) return false;
|
while (HAL_SD_GetCardState(&hsd) != HAL_SD_CARD_TRANSFER) if (ELAPSED(millis(), timeout)) return false;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif // !SDIO_FOR_STM32H7
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Read a block
|
||||||
|
* @details Read a block from media with SDIO
|
||||||
|
*
|
||||||
|
* @param block The block index
|
||||||
|
* @param src The block buffer
|
||||||
|
*
|
||||||
|
* @return true on success
|
||||||
|
*/
|
||||||
bool SDIO_ReadBlock(uint32_t block, uint8_t *dst) {
|
bool SDIO_ReadBlock(uint32_t block, uint8_t *dst) {
|
||||||
|
#ifdef SDIO_FOR_STM32H7
|
||||||
|
|
||||||
|
uint32_t timeout = HAL_GetTick() + SD_TIMEOUT;
|
||||||
|
|
||||||
|
while (HAL_SD_GetCardState(&hsd) != HAL_SD_CARD_TRANSFER)
|
||||||
|
if (HAL_GetTick() >= timeout) return false;
|
||||||
|
|
||||||
|
waitingRxCplt = 1;
|
||||||
|
if (HAL_SD_ReadBlocks_DMA(&hsd, (uint8_t*)dst, block, 1) != HAL_OK)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
timeout = HAL_GetTick() + SD_TIMEOUT;
|
||||||
|
while (waitingRxCplt)
|
||||||
|
if (HAL_GetTick() >= timeout) return false;
|
||||||
|
|
||||||
|
return true;
|
||||||
|
|
||||||
|
#else
|
||||||
|
|
||||||
uint8_t retries = SDIO_READ_RETRIES;
|
uint8_t retries = SDIO_READ_RETRIES;
|
||||||
while (retries--) if (SDIO_ReadWriteBlock_DMA(block, nullptr, dst)) return true;
|
while (retries--) if (SDIO_ReadWriteBlock_DMA(block, nullptr, dst)) return true;
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Write a block
|
||||||
|
* @details Write a block to media with SDIO
|
||||||
|
*
|
||||||
|
* @param block The block index
|
||||||
|
* @param src The block data
|
||||||
|
*
|
||||||
|
* @return true on success
|
||||||
|
*/
|
||||||
bool SDIO_WriteBlock(uint32_t block, const uint8_t *src) {
|
bool SDIO_WriteBlock(uint32_t block, const uint8_t *src) {
|
||||||
|
#ifdef SDIO_FOR_STM32H7
|
||||||
|
|
||||||
|
uint32_t timeout = HAL_GetTick() + SD_TIMEOUT;
|
||||||
|
|
||||||
|
while (HAL_SD_GetCardState(&hsd) != HAL_SD_CARD_TRANSFER)
|
||||||
|
if (HAL_GetTick() >= timeout) return false;
|
||||||
|
|
||||||
|
waitingTxCplt = 1;
|
||||||
|
if (HAL_SD_WriteBlocks_DMA(&hsd, (uint8_t*)src, block, 1) != HAL_OK)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
timeout = HAL_GetTick() + SD_TIMEOUT;
|
||||||
|
while (waitingTxCplt)
|
||||||
|
if (HAL_GetTick() >= timeout) return false;
|
||||||
|
|
||||||
|
return true;
|
||||||
|
|
||||||
|
#else
|
||||||
|
|
||||||
uint8_t retries = SDIO_READ_RETRIES;
|
uint8_t retries = SDIO_READ_RETRIES;
|
||||||
while (retries--) if (SDIO_ReadWriteBlock_DMA(block, src, nullptr)) return true;
|
while (retries--) if (SDIO_ReadWriteBlock_DMA(block, src, nullptr)) return true;
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SDIO_IsReady() {
|
bool SDIO_IsReady() {
|
||||||
@@ -305,16 +447,5 @@ uint32_t SDIO_GetCardSize() {
|
|||||||
return (uint32_t)(hsd.SdCard.BlockNbr) * (hsd.SdCard.BlockSize);
|
return (uint32_t)(hsd.SdCard.BlockNbr) * (hsd.SdCard.BlockSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(STM32F1xx)
|
|
||||||
#define DMA_IRQ_HANDLER DMA2_Channel4_5_IRQHandler
|
|
||||||
#elif defined(STM32F4xx)
|
|
||||||
#define DMA_IRQ_HANDLER DMA2_Stream3_IRQHandler
|
|
||||||
#else
|
|
||||||
#error "Unknown STM32 architecture."
|
|
||||||
#endif
|
|
||||||
|
|
||||||
extern "C" void SDIO_IRQHandler(void) { HAL_SD_IRQHandler(&hsd); }
|
|
||||||
extern "C" void DMA_IRQ_HANDLER(void) { HAL_DMA_IRQHandler(&hdma_sdio); }
|
|
||||||
|
|
||||||
#endif // SDIO_SUPPORT
|
#endif // SDIO_SUPPORT
|
||||||
#endif // HAL_STM32
|
#endif // HAL_STM32
|
||||||
|
|||||||
@@ -159,24 +159,28 @@ void GT911::read_reg(uint16_t reg, uint8_t reg_len, uint8_t* r_data, uint8_t r_l
|
|||||||
void GT911::Init() {
|
void GT911::Init() {
|
||||||
OUT_WRITE(GT911_RST_PIN, LOW);
|
OUT_WRITE(GT911_RST_PIN, LOW);
|
||||||
OUT_WRITE(GT911_INT_PIN, LOW);
|
OUT_WRITE(GT911_INT_PIN, LOW);
|
||||||
delay(20);
|
delay(11);
|
||||||
|
WRITE(GT911_INT_PIN, HIGH);
|
||||||
|
delayMicroseconds(110);
|
||||||
WRITE(GT911_RST_PIN, HIGH);
|
WRITE(GT911_RST_PIN, HIGH);
|
||||||
|
delay(6);
|
||||||
|
WRITE(GT911_INT_PIN, LOW);
|
||||||
|
delay(55);
|
||||||
SET_INPUT(GT911_INT_PIN);
|
SET_INPUT(GT911_INT_PIN);
|
||||||
|
|
||||||
sw_iic.init();
|
sw_iic.init();
|
||||||
|
|
||||||
uint8_t clear_reg = 0x0000;
|
uint8_t clear_reg = 0x00;
|
||||||
write_reg(0x814E, 2, &clear_reg, 2); // Reset to 0 for start
|
write_reg(0x814E, 2, &clear_reg, 1); // Reset to 0 for start
|
||||||
}
|
}
|
||||||
|
|
||||||
bool GT911::getFirstTouchPoint(int16_t *x, int16_t *y) {
|
bool GT911::getFirstTouchPoint(int16_t *x, int16_t *y) {
|
||||||
read_reg(0x814E, 2, ®.REG.status, 1);
|
read_reg(0x814E, 2, ®.REG.status, 1);
|
||||||
|
|
||||||
if (reg.REG.status & 0x80) {
|
if (reg.REG.status >= 0x80 && reg.REG.status <= 0x85) {
|
||||||
|
read_reg(0x8150, 2, reg.map + 2, 38);
|
||||||
uint8_t clear_reg = 0x00;
|
uint8_t clear_reg = 0x00;
|
||||||
write_reg(0x814E, 2, &clear_reg, 1); // Reset to 0 for start
|
write_reg(0x814E, 2, &clear_reg, 1); // Reset to 0 for start
|
||||||
read_reg(0x8150, 2, reg.map + 2, 8 * (reg.REG.status & 0x0F));
|
|
||||||
|
|
||||||
// First touch point
|
// First touch point
|
||||||
*x = ((reg.REG.point[0].xh & 0x0F) << 8) | reg.REG.point[0].xl;
|
*x = ((reg.REG.point[0].xh & 0x0F) << 8) | reg.REG.point[0].xl;
|
||||||
*y = ((reg.REG.point[0].yh & 0x0F) << 8) | reg.REG.point[0].yl;
|
*y = ((reg.REG.point[0].yh & 0x0F) << 8) | reg.REG.point[0].yl;
|
||||||
|
|||||||
@@ -23,7 +23,7 @@
|
|||||||
|
|
||||||
#include "../../../inc/MarlinConfig.h"
|
#include "../../../inc/MarlinConfig.h"
|
||||||
|
|
||||||
#define GT911_SLAVE_ADDRESS 0xBA
|
#define GT911_SLAVE_ADDRESS 0x28
|
||||||
|
|
||||||
#if !PIN_EXISTS(GT911_RST)
|
#if !PIN_EXISTS(GT911_RST)
|
||||||
#error "GT911_RST_PIN is not defined."
|
#error "GT911_RST_PIN is not defined."
|
||||||
|
|||||||
@@ -147,7 +147,7 @@ uint32_t TFT_FSMC::ReadID(tft_data_t Reg) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool TFT_FSMC::isBusy() {
|
bool TFT_FSMC::isBusy() {
|
||||||
#if defined(STM32F1xx)
|
#ifdef STM32F1xx
|
||||||
volatile bool dmaEnabled = (DMAtx.Instance->CCR & DMA_CCR_EN) != RESET;
|
volatile bool dmaEnabled = (DMAtx.Instance->CCR & DMA_CCR_EN) != RESET;
|
||||||
#elif defined(STM32F4xx)
|
#elif defined(STM32F4xx)
|
||||||
volatile bool dmaEnabled = DMAtx.Instance->CR & DMA_SxCR_EN;
|
volatile bool dmaEnabled = DMAtx.Instance->CR & DMA_SxCR_EN;
|
||||||
|
|||||||
@@ -372,9 +372,9 @@ void TFT_LTDC::TransmitDMA(uint32_t MemoryIncrease, uint16_t *Data, uint16_t Cou
|
|||||||
if (MemoryIncrease == DMA_PINC_ENABLE) {
|
if (MemoryIncrease == DMA_PINC_ENABLE) {
|
||||||
DrawImage(x_min, y_cur, x_min + width, y_cur + height, Data);
|
DrawImage(x_min, y_cur, x_min + width, y_cur + height, Data);
|
||||||
Data += width * height;
|
Data += width * height;
|
||||||
} else {
|
|
||||||
DrawRect(x_min, y_cur, x_min + width, y_cur + height, *Data);
|
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
DrawRect(x_min, y_cur, x_min + width, y_cur + height, *Data);
|
||||||
y_cur += height;
|
y_cur += height;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -179,7 +179,7 @@ uint32_t TFT_SPI::ReadID(uint16_t Reg) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool TFT_SPI::isBusy() {
|
bool TFT_SPI::isBusy() {
|
||||||
#if defined(STM32F1xx)
|
#ifdef STM32F1xx
|
||||||
volatile bool dmaEnabled = (DMAtx.Instance->CCR & DMA_CCR_EN) != RESET;
|
volatile bool dmaEnabled = (DMAtx.Instance->CCR & DMA_CCR_EN) != RESET;
|
||||||
#elif defined(STM32F4xx)
|
#elif defined(STM32F4xx)
|
||||||
volatile bool dmaEnabled = DMAtx.Instance->CR & DMA_SxCR_EN;
|
volatile bool dmaEnabled = DMAtx.Instance->CR & DMA_SxCR_EN;
|
||||||
|
|||||||
@@ -83,6 +83,7 @@
|
|||||||
// ------------------------
|
// ------------------------
|
||||||
|
|
||||||
#if defined(SERIAL_USB) && !HAS_SD_HOST_DRIVE
|
#if defined(SERIAL_USB) && !HAS_SD_HOST_DRIVE
|
||||||
|
|
||||||
USBSerial SerialUSB;
|
USBSerial SerialUSB;
|
||||||
DefaultSerial1 MSerial0(true, SerialUSB);
|
DefaultSerial1 MSerial0(true, SerialUSB);
|
||||||
|
|
||||||
@@ -112,6 +113,47 @@
|
|||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
// ------------------------
|
||||||
|
// Watchdog Timer
|
||||||
|
// ------------------------
|
||||||
|
|
||||||
|
#if ENABLED(USE_WATCHDOG)
|
||||||
|
|
||||||
|
#include <libmaple/iwdg.h>
|
||||||
|
|
||||||
|
void watchdogSetup() {
|
||||||
|
// do whatever. don't remove this function.
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The watchdog clock is 40Khz. So for a 4s or 8s interval use a /256 preescaler and 625 or 1250 reload value (counts down to 0).
|
||||||
|
*/
|
||||||
|
#define STM32F1_WD_RELOAD TERN(WATCHDOG_DURATION_8S, 1250, 625) // 4 or 8 second timeout
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Initialize the independent hardware watchdog.
|
||||||
|
*
|
||||||
|
* @return No return
|
||||||
|
*
|
||||||
|
* @details The watchdog clock is 40Khz. So for a 4s or 8s interval use a /256 preescaler and 625 or 1250 reload value (counts down to 0).
|
||||||
|
*/
|
||||||
|
void MarlinHAL::watchdog_init() {
|
||||||
|
#if DISABLED(DISABLE_WATCHDOG_INIT)
|
||||||
|
iwdg_init(IWDG_PRE_256, STM32F1_WD_RELOAD);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
// Reset watchdog. MUST be called every 4 or 8 seconds after the
|
||||||
|
// first watchdog_init or the STM32F1 will reset.
|
||||||
|
void MarlinHAL::watchdog_refresh() {
|
||||||
|
#if DISABLED(PINS_DEBUGGING) && PIN_EXISTS(LED)
|
||||||
|
TOGGLE(LED_PIN); // heartbeat indicator
|
||||||
|
#endif
|
||||||
|
iwdg_feed();
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif // USE_WATCHDOG
|
||||||
|
|
||||||
// ------------------------
|
// ------------------------
|
||||||
// ADC
|
// ADC
|
||||||
// ------------------------
|
// ------------------------
|
||||||
@@ -211,6 +253,10 @@ void MarlinHAL::idletask() {
|
|||||||
|
|
||||||
void MarlinHAL::reboot() { nvic_sys_reset(); }
|
void MarlinHAL::reboot() { nvic_sys_reset(); }
|
||||||
|
|
||||||
|
// ------------------------
|
||||||
|
// Free Memory Accessor
|
||||||
|
// ------------------------
|
||||||
|
|
||||||
extern "C" {
|
extern "C" {
|
||||||
extern unsigned int _ebss; // end of bss section
|
extern unsigned int _ebss; // end of bss section
|
||||||
}
|
}
|
||||||
@@ -243,9 +289,9 @@ extern "C" {
|
|||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
//
|
// ------------------------
|
||||||
// ADC
|
// ADC
|
||||||
//
|
// ------------------------
|
||||||
|
|
||||||
enum ADCIndex : uint8_t {
|
enum ADCIndex : uint8_t {
|
||||||
OPTITEM(HAS_TEMP_ADC_0, TEMP_0)
|
OPTITEM(HAS_TEMP_ADC_0, TEMP_0)
|
||||||
|
|||||||
@@ -34,7 +34,6 @@
|
|||||||
#include "../shared/HAL_SPI.h"
|
#include "../shared/HAL_SPI.h"
|
||||||
|
|
||||||
#include "fastio.h"
|
#include "fastio.h"
|
||||||
#include "watchdog.h"
|
|
||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <util/atomic.h>
|
#include <util/atomic.h>
|
||||||
@@ -247,6 +246,10 @@ public:
|
|||||||
// Earliest possible init, before setup()
|
// Earliest possible init, before setup()
|
||||||
MarlinHAL() {}
|
MarlinHAL() {}
|
||||||
|
|
||||||
|
// Watchdog
|
||||||
|
static void watchdog_init() IF_DISABLED(USE_WATCHDOG, {});
|
||||||
|
static void watchdog_refresh() IF_DISABLED(USE_WATCHDOG, {});
|
||||||
|
|
||||||
static void init(); // Called early in setup()
|
static void init(); // Called early in setup()
|
||||||
static void init_board() {} // Called less early in setup()
|
static void init_board() {} // Called less early in setup()
|
||||||
static void reboot(); // Restart the firmware from 0x0
|
static void reboot(); // Restart the firmware from 0x0
|
||||||
@@ -280,7 +283,7 @@ public:
|
|||||||
// Called by Temperature::init for each sensor at startup
|
// Called by Temperature::init for each sensor at startup
|
||||||
static void adc_enable(const pin_t pin) { pinMode(pin, INPUT_ANALOG); }
|
static void adc_enable(const pin_t pin) { pinMode(pin, INPUT_ANALOG); }
|
||||||
|
|
||||||
// Begin ADC sampling on the given channel
|
// Begin ADC sampling on the given pin. Called from Temperature::isr!
|
||||||
static void adc_start(const pin_t pin);
|
static void adc_start(const pin_t pin);
|
||||||
|
|
||||||
// Is the ADC ready for reading?
|
// Is the ADC ready for reading?
|
||||||
|
|||||||
@@ -26,8 +26,7 @@
|
|||||||
|
|
||||||
#if ENABLED(POSTMORTEM_DEBUGGING)
|
#if ENABLED(POSTMORTEM_DEBUGGING)
|
||||||
|
|
||||||
#include "../shared/HAL_MinSerial.h"
|
#include "../shared/MinSerial.h"
|
||||||
#include "watchdog.h"
|
|
||||||
|
|
||||||
#include <libmaple/usart.h>
|
#include <libmaple/usart.h>
|
||||||
#include <libmaple/rcc.h>
|
#include <libmaple/rcc.h>
|
||||||
@@ -82,7 +81,7 @@ static void TX(char c) {
|
|||||||
#if WITHIN(SERIAL_PORT, 1, 6)
|
#if WITHIN(SERIAL_PORT, 1, 6)
|
||||||
struct usart_dev* dev = MYSERIAL1.c_dev();
|
struct usart_dev* dev = MYSERIAL1.c_dev();
|
||||||
while (!(dev->regs->SR & USART_SR_TXE)) {
|
while (!(dev->regs->SR & USART_SR_TXE)) {
|
||||||
TERN_(USE_WATCHDOG, HAL_watchdog_refresh());
|
hal.watchdog_refresh();
|
||||||
sw_barrier();
|
sw_barrier();
|
||||||
}
|
}
|
||||||
dev->regs->DR = c;
|
dev->regs->DR = c;
|
||||||
@@ -147,17 +147,17 @@ void libServo::move(const int32_t value) {
|
|||||||
uint16_t SR = timer_get_status(tdev);
|
uint16_t SR = timer_get_status(tdev);
|
||||||
if (SR & TIMER_SR_CC1IF) { // channel 1 off
|
if (SR & TIMER_SR_CC1IF) { // channel 1 off
|
||||||
#ifdef SERVO0_PWM_OD
|
#ifdef SERVO0_PWM_OD
|
||||||
OUT_WRITE_OD(SERVO0_PIN, 1); // off
|
OUT_WRITE_OD(SERVO0_PIN, HIGH); // off
|
||||||
#else
|
#else
|
||||||
OUT_WRITE(SERVO0_PIN, 0);
|
OUT_WRITE(SERVO0_PIN, LOW);
|
||||||
#endif
|
#endif
|
||||||
timer_reset_status_bit(tdev, TIMER_SR_CC1IF_BIT);
|
timer_reset_status_bit(tdev, TIMER_SR_CC1IF_BIT);
|
||||||
}
|
}
|
||||||
if (SR & TIMER_SR_CC2IF) { // channel 2 resume
|
if (SR & TIMER_SR_CC2IF) { // channel 2 resume
|
||||||
#ifdef SERVO0_PWM_OD
|
#ifdef SERVO0_PWM_OD
|
||||||
OUT_WRITE_OD(SERVO0_PIN, 0); // on
|
OUT_WRITE_OD(SERVO0_PIN, LOW); // on
|
||||||
#else
|
#else
|
||||||
OUT_WRITE(SERVO0_PIN, 1);
|
OUT_WRITE(SERVO0_PIN, HIGH);
|
||||||
#endif
|
#endif
|
||||||
timer_reset_status_bit(tdev, TIMER_SR_CC2IF_BIT);
|
timer_reset_status_bit(tdev, TIMER_SR_CC2IF_BIT);
|
||||||
}
|
}
|
||||||
@@ -167,9 +167,9 @@ void libServo::move(const int32_t value) {
|
|||||||
timer_dev *tdev = HAL_get_timer_dev(MF_TIMER_SERVO0);
|
timer_dev *tdev = HAL_get_timer_dev(MF_TIMER_SERVO0);
|
||||||
if (!tdev) return false;
|
if (!tdev) return false;
|
||||||
#ifdef SERVO0_PWM_OD
|
#ifdef SERVO0_PWM_OD
|
||||||
OUT_WRITE_OD(inPin, 1);
|
OUT_WRITE_OD(inPin, HIGH);
|
||||||
#else
|
#else
|
||||||
OUT_WRITE(inPin, 0);
|
OUT_WRITE(inPin, LOW);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
timer_pause(tdev);
|
timer_pause(tdev);
|
||||||
@@ -200,9 +200,9 @@ void libServo::move(const int32_t value) {
|
|||||||
timer_disable_irq(tdev, 1);
|
timer_disable_irq(tdev, 1);
|
||||||
timer_disable_irq(tdev, 2);
|
timer_disable_irq(tdev, 2);
|
||||||
#ifdef SERVO0_PWM_OD
|
#ifdef SERVO0_PWM_OD
|
||||||
OUT_WRITE_OD(pin, 1); // off
|
OUT_WRITE_OD(pin, HIGH); // off
|
||||||
#else
|
#else
|
||||||
OUT_WRITE(pin, 0);
|
OUT_WRITE(pin, LOW);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ SPIClass TFT_SPI::SPIx(1);
|
|||||||
|
|
||||||
void TFT_SPI::Init() {
|
void TFT_SPI::Init() {
|
||||||
#if PIN_EXISTS(TFT_RESET)
|
#if PIN_EXISTS(TFT_RESET)
|
||||||
OUT_WRITE(TFT_RST_PIN, HIGH);
|
OUT_WRITE(TFT_RESET_PIN, HIGH);
|
||||||
delay(100);
|
delay(100);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
@@ -1,66 +0,0 @@
|
|||||||
/**
|
|
||||||
* Marlin 3D Printer Firmware
|
|
||||||
* Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
|
|
||||||
*
|
|
||||||
* Based on Sprinter and grbl.
|
|
||||||
* Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
|
|
||||||
*
|
|
||||||
* This program is free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* HAL for stm32duino.com based on Libmaple and compatible (STM32F1)
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifdef __STM32F1__
|
|
||||||
|
|
||||||
#include "../../inc/MarlinConfig.h"
|
|
||||||
|
|
||||||
#if ENABLED(USE_WATCHDOG)
|
|
||||||
|
|
||||||
#include <libmaple/iwdg.h>
|
|
||||||
#include "watchdog.h"
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The watchdog clock is 40Khz. So for a 4s or 8s interval use a /256 preescaler and 625 or 1250 reload value (counts down to 0).
|
|
||||||
*/
|
|
||||||
#define STM32F1_WD_RELOAD TERN(WATCHDOG_DURATION_8S, 1250, 625) // 4 or 8 second timeout
|
|
||||||
|
|
||||||
void HAL_watchdog_refresh() {
|
|
||||||
#if DISABLED(PINS_DEBUGGING) && PIN_EXISTS(LED)
|
|
||||||
TOGGLE(LED_PIN); // heartbeat indicator
|
|
||||||
#endif
|
|
||||||
iwdg_feed();
|
|
||||||
}
|
|
||||||
|
|
||||||
void watchdogSetup() {
|
|
||||||
// do whatever. don't remove this function.
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Initialized the independent hardware watchdog.
|
|
||||||
*
|
|
||||||
* @return No return
|
|
||||||
*
|
|
||||||
* @details The watchdog clock is 40Khz. So for a 4s or 8s interval use a /256 preescaler and 625 or 1250 reload value (counts down to 0).
|
|
||||||
*/
|
|
||||||
void watchdog_init() {
|
|
||||||
#if DISABLED(DISABLE_WATCHDOG_INIT)
|
|
||||||
iwdg_init(IWDG_PRE_256, STM32F1_WD_RELOAD);
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif // USE_WATCHDOG
|
|
||||||
#endif // __STM32F1__
|
|
||||||
@@ -44,25 +44,6 @@
|
|||||||
#endif
|
#endif
|
||||||
USBSerialType USBSerial(false, SerialUSB);
|
USBSerialType USBSerial(false, SerialUSB);
|
||||||
|
|
||||||
// ------------------------
|
|
||||||
// Class Utilities
|
|
||||||
// ------------------------
|
|
||||||
|
|
||||||
extern "C" {
|
|
||||||
extern char __bss_end;
|
|
||||||
extern char __heap_start;
|
|
||||||
extern void* __brkval;
|
|
||||||
|
|
||||||
int freeMemory() {
|
|
||||||
int free_memory;
|
|
||||||
if ((int)__brkval == 0)
|
|
||||||
free_memory = ((int)&free_memory) - ((int)&__bss_end);
|
|
||||||
else
|
|
||||||
free_memory = ((int)&free_memory) - ((int)__brkval);
|
|
||||||
return free_memory;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// ------------------------
|
// ------------------------
|
||||||
// MarlinHAL Class
|
// MarlinHAL Class
|
||||||
// ------------------------
|
// ------------------------
|
||||||
@@ -81,7 +62,31 @@ uint8_t MarlinHAL::get_reset_source() {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ------------------------
|
||||||
|
// Watchdog Timer
|
||||||
|
// ------------------------
|
||||||
|
|
||||||
|
#if ENABLED(USE_WATCHDOG)
|
||||||
|
|
||||||
|
#define WDT_TIMEOUT_MS TERN(WATCHDOG_DURATION_8S, 8000, 4000) // 4 or 8 second timeout
|
||||||
|
|
||||||
|
void MarlinHAL::watchdog_init() {
|
||||||
|
WDOG_TOVALH = 0;
|
||||||
|
WDOG_TOVALL = WDT_TIMEOUT_MS;
|
||||||
|
WDOG_STCTRLH = WDOG_STCTRLH_WDOGEN;
|
||||||
|
}
|
||||||
|
|
||||||
|
void MarlinHAL::watchdog_refresh() {
|
||||||
|
// Watchdog refresh sequence
|
||||||
|
WDOG_REFRESH = 0xA602;
|
||||||
|
WDOG_REFRESH = 0xB480;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// ------------------------
|
||||||
// ADC
|
// ADC
|
||||||
|
// ------------------------
|
||||||
|
|
||||||
void MarlinHAL::adc_init() {
|
void MarlinHAL::adc_init() {
|
||||||
analog_init();
|
analog_init();
|
||||||
@@ -102,4 +107,23 @@ void MarlinHAL::adc_start(const pin_t pin) {
|
|||||||
|
|
||||||
uint16_t MarlinHAL::adc_value() { return ADC0_RA; }
|
uint16_t MarlinHAL::adc_value() { return ADC0_RA; }
|
||||||
|
|
||||||
|
// ------------------------
|
||||||
|
// Free Memory Accessor
|
||||||
|
// ------------------------
|
||||||
|
|
||||||
|
extern "C" {
|
||||||
|
extern char __bss_end;
|
||||||
|
extern char __heap_start;
|
||||||
|
extern void* __brkval;
|
||||||
|
|
||||||
|
int freeMemory() {
|
||||||
|
int free_memory;
|
||||||
|
if ((int)__brkval == 0)
|
||||||
|
free_memory = ((int)&free_memory) - ((int)&__bss_end);
|
||||||
|
else
|
||||||
|
free_memory = ((int)&free_memory) - ((int)__brkval);
|
||||||
|
return free_memory;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#endif // __MK20DX256__
|
#endif // __MK20DX256__
|
||||||
|
|||||||
@@ -32,7 +32,6 @@
|
|||||||
#include "../shared/HAL_SPI.h"
|
#include "../shared/HAL_SPI.h"
|
||||||
|
|
||||||
#include "fastio.h"
|
#include "fastio.h"
|
||||||
#include "watchdog.h"
|
|
||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
||||||
@@ -135,6 +134,10 @@ public:
|
|||||||
// Earliest possible init, before setup()
|
// Earliest possible init, before setup()
|
||||||
MarlinHAL() {}
|
MarlinHAL() {}
|
||||||
|
|
||||||
|
// Watchdog
|
||||||
|
static void watchdog_init() IF_DISABLED(USE_WATCHDOG, {});
|
||||||
|
static void watchdog_refresh() IF_DISABLED(USE_WATCHDOG, {});
|
||||||
|
|
||||||
static void init() {} // Called early in setup()
|
static void init() {} // Called early in setup()
|
||||||
static void init_board() {} // Called less early in setup()
|
static void init_board() {} // Called less early in setup()
|
||||||
static void reboot(); // Restart the firmware from 0x0
|
static void reboot(); // Restart the firmware from 0x0
|
||||||
@@ -166,7 +169,7 @@ public:
|
|||||||
// Called by Temperature::init for each sensor at startup
|
// Called by Temperature::init for each sensor at startup
|
||||||
static void adc_enable(const pin_t ch) {}
|
static void adc_enable(const pin_t ch) {}
|
||||||
|
|
||||||
// Begin ADC sampling on the given channel
|
// Begin ADC sampling on the given channel. Called from Temperature::isr!
|
||||||
static void adc_start(const pin_t ch);
|
static void adc_start(const pin_t ch);
|
||||||
|
|
||||||
// Is the ADC ready for reading?
|
// Is the ADC ready for reading?
|
||||||
|
|||||||
@@ -1,40 +0,0 @@
|
|||||||
/**
|
|
||||||
* Marlin 3D Printer Firmware
|
|
||||||
* Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
|
|
||||||
*
|
|
||||||
* Based on Sprinter and grbl.
|
|
||||||
* Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
|
|
||||||
*
|
|
||||||
* This program is free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
#ifdef __MK20DX256__
|
|
||||||
|
|
||||||
#include "../../inc/MarlinConfig.h"
|
|
||||||
|
|
||||||
#if ENABLED(USE_WATCHDOG)
|
|
||||||
|
|
||||||
#include "watchdog.h"
|
|
||||||
|
|
||||||
#define WDT_TIMEOUT_MS TERN(WATCHDOG_DURATION_8S, 8000, 4000) // 4 or 8 second timeout
|
|
||||||
|
|
||||||
void watchdog_init() {
|
|
||||||
WDOG_TOVALH = 0;
|
|
||||||
WDOG_TOVALL = WDT_TIMEOUT_MS;
|
|
||||||
WDOG_STCTRLH = WDOG_STCTRLH_WDOGEN;
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif // USE_WATCHDOG
|
|
||||||
|
|
||||||
#endif // __MK20DX256__
|
|
||||||
@@ -1,34 +0,0 @@
|
|||||||
/**
|
|
||||||
* Marlin 3D Printer Firmware
|
|
||||||
* Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
|
|
||||||
*
|
|
||||||
* Based on Sprinter and grbl.
|
|
||||||
* Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
|
|
||||||
*
|
|
||||||
* This program is free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
#include "HAL.h"
|
|
||||||
|
|
||||||
// Arduino Due core now has watchdog support
|
|
||||||
|
|
||||||
void watchdog_init();
|
|
||||||
|
|
||||||
inline void HAL_watchdog_refresh() {
|
|
||||||
// Watchdog refresh sequence
|
|
||||||
WDOG_REFRESH = 0xA602;
|
|
||||||
WDOG_REFRESH = 0xB480;
|
|
||||||
}
|
|
||||||
@@ -43,33 +43,12 @@
|
|||||||
|
|
||||||
USBSerialType USBSerial(false, SerialUSB);
|
USBSerialType USBSerial(false, SerialUSB);
|
||||||
|
|
||||||
// ------------------------
|
|
||||||
// Class Utilities
|
|
||||||
// ------------------------
|
|
||||||
|
|
||||||
extern "C" {
|
|
||||||
extern char __bss_end;
|
|
||||||
extern char __heap_start;
|
|
||||||
extern void* __brkval;
|
|
||||||
|
|
||||||
int freeMemory() {
|
|
||||||
int free_memory;
|
|
||||||
if ((int)__brkval == 0)
|
|
||||||
free_memory = ((int)&free_memory) - ((int)&__bss_end);
|
|
||||||
else
|
|
||||||
free_memory = ((int)&free_memory) - ((int)__brkval);
|
|
||||||
return free_memory;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// ------------------------
|
// ------------------------
|
||||||
// MarlinHAL Class
|
// MarlinHAL Class
|
||||||
// ------------------------
|
// ------------------------
|
||||||
|
|
||||||
void MarlinHAL::reboot() { _reboot_Teensyduino_(); }
|
void MarlinHAL::reboot() { _reboot_Teensyduino_(); }
|
||||||
|
|
||||||
// Reset
|
|
||||||
|
|
||||||
uint8_t MarlinHAL::get_reset_source() {
|
uint8_t MarlinHAL::get_reset_source() {
|
||||||
switch (RCM_SRS0) {
|
switch (RCM_SRS0) {
|
||||||
case 128: return RST_POWER_ON; break;
|
case 128: return RST_POWER_ON; break;
|
||||||
@@ -82,7 +61,31 @@ uint8_t MarlinHAL::get_reset_source() {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ------------------------
|
||||||
|
// Watchdog Timer
|
||||||
|
// ------------------------
|
||||||
|
|
||||||
|
#if ENABLED(USE_WATCHDOG)
|
||||||
|
|
||||||
|
#define WDT_TIMEOUT_MS TERN(WATCHDOG_DURATION_8S, 8000, 4000) // 4 or 8 second timeout
|
||||||
|
|
||||||
|
void MarlinHAL::watchdog_init() {
|
||||||
|
WDOG_TOVALH = 0;
|
||||||
|
WDOG_TOVALL = WDT_TIMEOUT_MS;
|
||||||
|
WDOG_STCTRLH = WDOG_STCTRLH_WDOGEN;
|
||||||
|
}
|
||||||
|
|
||||||
|
void MarlinHAL::watchdog_refresh() {
|
||||||
|
// Watchdog refresh sequence
|
||||||
|
WDOG_REFRESH = 0xA602;
|
||||||
|
WDOG_REFRESH = 0xB480;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// ------------------------
|
||||||
// ADC
|
// ADC
|
||||||
|
// ------------------------
|
||||||
|
|
||||||
int8_t MarlinHAL::adc_select;
|
int8_t MarlinHAL::adc_select;
|
||||||
|
|
||||||
@@ -131,4 +134,23 @@ uint16_t MarlinHAL::adc_value() {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ------------------------
|
||||||
|
// Free Memory Accessor
|
||||||
|
// ------------------------
|
||||||
|
|
||||||
|
extern "C" {
|
||||||
|
extern char __bss_end;
|
||||||
|
extern char __heap_start;
|
||||||
|
extern void* __brkval;
|
||||||
|
|
||||||
|
int freeMemory() {
|
||||||
|
int free_memory;
|
||||||
|
if ((int)__brkval == 0)
|
||||||
|
free_memory = ((int)&free_memory) - ((int)&__bss_end);
|
||||||
|
else
|
||||||
|
free_memory = ((int)&free_memory) - ((int)__brkval);
|
||||||
|
return free_memory;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#endif // __MK64FX512__ || __MK66FX1M0__
|
#endif // __MK64FX512__ || __MK66FX1M0__
|
||||||
|
|||||||
@@ -32,7 +32,6 @@
|
|||||||
#include "../shared/HAL_SPI.h"
|
#include "../shared/HAL_SPI.h"
|
||||||
|
|
||||||
#include "fastio.h"
|
#include "fastio.h"
|
||||||
#include "watchdog.h"
|
|
||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <util/atomic.h>
|
#include <util/atomic.h>
|
||||||
@@ -118,7 +117,7 @@ typedef int8_t pin_t;
|
|||||||
#define PARSED_PIN_INDEX(code, dval) parser.intval(code, dval)
|
#define PARSED_PIN_INDEX(code, dval) parser.intval(code, dval)
|
||||||
|
|
||||||
// ------------------------
|
// ------------------------
|
||||||
// Class Utilities
|
// Free Memory Accessor
|
||||||
// ------------------------
|
// ------------------------
|
||||||
|
|
||||||
#pragma GCC diagnostic push
|
#pragma GCC diagnostic push
|
||||||
@@ -140,6 +139,10 @@ public:
|
|||||||
// Earliest possible init, before setup()
|
// Earliest possible init, before setup()
|
||||||
MarlinHAL() {}
|
MarlinHAL() {}
|
||||||
|
|
||||||
|
// Watchdog
|
||||||
|
static void watchdog_init() IF_DISABLED(USE_WATCHDOG, {});
|
||||||
|
static void watchdog_refresh() IF_DISABLED(USE_WATCHDOG, {});
|
||||||
|
|
||||||
static void init() {} // Called early in setup()
|
static void init() {} // Called early in setup()
|
||||||
static void init_board() {} // Called less early in setup()
|
static void init_board() {} // Called less early in setup()
|
||||||
static void reboot(); // Restart the firmware from 0x0
|
static void reboot(); // Restart the firmware from 0x0
|
||||||
@@ -173,7 +176,7 @@ public:
|
|||||||
// Called by Temperature::init for each sensor at startup
|
// Called by Temperature::init for each sensor at startup
|
||||||
static void adc_enable(const pin_t) {}
|
static void adc_enable(const pin_t) {}
|
||||||
|
|
||||||
// Begin ADC sampling on the given channel
|
// Begin ADC sampling on the given pin. Called from Temperature::isr!
|
||||||
static void adc_start(const pin_t pin);
|
static void adc_start(const pin_t pin);
|
||||||
|
|
||||||
// Is the ADC ready for reading?
|
// Is the ADC ready for reading?
|
||||||
|
|||||||
@@ -1,40 +0,0 @@
|
|||||||
/**
|
|
||||||
* Marlin 3D Printer Firmware
|
|
||||||
* Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
|
|
||||||
*
|
|
||||||
* Based on Sprinter and grbl.
|
|
||||||
* Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
|
|
||||||
*
|
|
||||||
* This program is free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
#if defined(__MK64FX512__) || defined(__MK66FX1M0__)
|
|
||||||
|
|
||||||
#include "../../inc/MarlinConfig.h"
|
|
||||||
|
|
||||||
#if ENABLED(USE_WATCHDOG)
|
|
||||||
|
|
||||||
#include "watchdog.h"
|
|
||||||
|
|
||||||
#define WDT_TIMEOUT_MS TERN(WATCHDOG_DURATION_8S, 8000, 4000) // 4 or 8 second timeout
|
|
||||||
|
|
||||||
void watchdog_init() {
|
|
||||||
WDOG_TOVALH = 0;
|
|
||||||
WDOG_TOVALL = WDT_TIMEOUT_MS;
|
|
||||||
WDOG_STCTRLH = WDOG_STCTRLH_WDOGEN;
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif // USE_WATCHDOG
|
|
||||||
|
|
||||||
#endif // __MK64FX512__ || __MK66FX1M0__
|
|
||||||
@@ -1,30 +0,0 @@
|
|||||||
/**
|
|
||||||
* Marlin 3D Printer Firmware
|
|
||||||
* Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
|
|
||||||
*
|
|
||||||
* Based on Sprinter and grbl.
|
|
||||||
* Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
|
|
||||||
*
|
|
||||||
* This program is free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
void watchdog_init();
|
|
||||||
|
|
||||||
inline void HAL_watchdog_refresh() {
|
|
||||||
// Watchdog refresh sequence
|
|
||||||
WDOG_REFRESH = 0xA602;
|
|
||||||
WDOG_REFRESH = 0xB480;
|
|
||||||
}
|
|
||||||
@@ -44,25 +44,6 @@
|
|||||||
#endif
|
#endif
|
||||||
USBSerialType USBSerial(false, SerialUSB);
|
USBSerialType USBSerial(false, SerialUSB);
|
||||||
|
|
||||||
// ------------------------
|
|
||||||
// Class Utilities
|
|
||||||
// ------------------------
|
|
||||||
|
|
||||||
#define __bss_end _ebss
|
|
||||||
|
|
||||||
extern "C" {
|
|
||||||
extern char __bss_end;
|
|
||||||
extern char __heap_start;
|
|
||||||
extern void* __brkval;
|
|
||||||
|
|
||||||
// Doesn't work on Teensy 4.x
|
|
||||||
uint32_t freeMemory() {
|
|
||||||
uint32_t free_memory;
|
|
||||||
free_memory = ((uint32_t)&free_memory) - (((uint32_t)__brkval) ?: ((uint32_t)&__bss_end));
|
|
||||||
return free_memory;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// ------------------------
|
// ------------------------
|
||||||
// FastIO
|
// FastIO
|
||||||
// ------------------------
|
// ------------------------
|
||||||
@@ -97,7 +78,34 @@ void MarlinHAL::clear_reset_source() {
|
|||||||
SRC_SRSR = reset_source;
|
SRC_SRSR = reset_source;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ------------------------
|
||||||
|
// Watchdog Timer
|
||||||
|
// ------------------------
|
||||||
|
|
||||||
|
#if ENABLED(USE_WATCHDOG)
|
||||||
|
|
||||||
|
#define WDT_TIMEOUT TERN(WATCHDOG_DURATION_8S, 8, 4) // 4 or 8 second timeout
|
||||||
|
|
||||||
|
constexpr uint8_t timeoutval = (WDT_TIMEOUT - 0.5f) / 0.5f;
|
||||||
|
|
||||||
|
void MarlinHAL::watchdog_init() {
|
||||||
|
CCM_CCGR3 |= CCM_CCGR3_WDOG1(3); // enable WDOG1 clocks
|
||||||
|
WDOG1_WMCR = 0; // disable power down PDE
|
||||||
|
WDOG1_WCR |= WDOG_WCR_SRS | WDOG_WCR_WT(timeoutval);
|
||||||
|
WDOG1_WCR |= WDOG_WCR_WDE | WDOG_WCR_WDT | WDOG_WCR_SRE;
|
||||||
|
}
|
||||||
|
|
||||||
|
void MarlinHAL::watchdog_refresh() {
|
||||||
|
// Watchdog refresh sequence
|
||||||
|
WDOG1_WSR = 0x5555;
|
||||||
|
WDOG1_WSR = 0xAAAA;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// ------------------------
|
||||||
// ADC
|
// ADC
|
||||||
|
// ------------------------
|
||||||
|
|
||||||
int8_t MarlinHAL::adc_select;
|
int8_t MarlinHAL::adc_select;
|
||||||
|
|
||||||
@@ -180,4 +188,23 @@ uint16_t MarlinHAL::adc_value() {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ------------------------
|
||||||
|
// Free Memory Accessor
|
||||||
|
// ------------------------
|
||||||
|
|
||||||
|
#define __bss_end _ebss
|
||||||
|
|
||||||
|
extern "C" {
|
||||||
|
extern char __bss_end;
|
||||||
|
extern char __heap_start;
|
||||||
|
extern void* __brkval;
|
||||||
|
|
||||||
|
// Doesn't work on Teensy 4.x
|
||||||
|
uint32_t freeMemory() {
|
||||||
|
uint32_t free_memory;
|
||||||
|
free_memory = ((uint32_t)&free_memory) - (((uint32_t)__brkval) ?: ((uint32_t)&__bss_end));
|
||||||
|
return free_memory;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#endif // __IMXRT1062__
|
#endif // __IMXRT1062__
|
||||||
|
|||||||
@@ -32,7 +32,6 @@
|
|||||||
#include "../shared/HAL_SPI.h"
|
#include "../shared/HAL_SPI.h"
|
||||||
|
|
||||||
#include "fastio.h"
|
#include "fastio.h"
|
||||||
#include "watchdog.h"
|
|
||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <util/atomic.h>
|
#include <util/atomic.h>
|
||||||
@@ -140,7 +139,7 @@ typedef int8_t pin_t;
|
|||||||
bool is_output(pin_t pin);
|
bool is_output(pin_t pin);
|
||||||
|
|
||||||
// ------------------------
|
// ------------------------
|
||||||
// Class Utilities
|
// Free Memory Accessor
|
||||||
// ------------------------
|
// ------------------------
|
||||||
|
|
||||||
#pragma GCC diagnostic push
|
#pragma GCC diagnostic push
|
||||||
@@ -162,6 +161,10 @@ public:
|
|||||||
// Earliest possible init, before setup()
|
// Earliest possible init, before setup()
|
||||||
MarlinHAL() {}
|
MarlinHAL() {}
|
||||||
|
|
||||||
|
// Watchdog
|
||||||
|
static void watchdog_init() IF_DISABLED(USE_WATCHDOG, {});
|
||||||
|
static void watchdog_refresh() IF_DISABLED(USE_WATCHDOG, {});
|
||||||
|
|
||||||
static void init() {} // Called early in setup()
|
static void init() {} // Called early in setup()
|
||||||
static void init_board() {} // Called less early in setup()
|
static void init_board() {} // Called less early in setup()
|
||||||
static void reboot(); // Restart the firmware from 0x0
|
static void reboot(); // Restart the firmware from 0x0
|
||||||
@@ -195,7 +198,7 @@ public:
|
|||||||
// Called by Temperature::init for each sensor at startup
|
// Called by Temperature::init for each sensor at startup
|
||||||
static void adc_enable(const pin_t pin) {}
|
static void adc_enable(const pin_t pin) {}
|
||||||
|
|
||||||
// Begin ADC sampling on the given channel
|
// Begin ADC sampling on the given pin. Called from Temperature::isr!
|
||||||
static void adc_start(const pin_t pin);
|
static void adc_start(const pin_t pin);
|
||||||
|
|
||||||
// Is the ADC ready for reading?
|
// Is the ADC ready for reading?
|
||||||
|
|||||||
@@ -36,7 +36,7 @@
|
|||||||
#define PRINT_PIN_ANALOG(p) do{ sprintf_P(buffer, PSTR(" (A%2d) "), DIGITAL_PIN_TO_ANALOG_PIN(pin)); SERIAL_ECHO(buffer); }while(0)
|
#define PRINT_PIN_ANALOG(p) do{ sprintf_P(buffer, PSTR(" (A%2d) "), DIGITAL_PIN_TO_ANALOG_PIN(pin)); SERIAL_ECHO(buffer); }while(0)
|
||||||
#define GET_ARRAY_PIN(p) pin_array[p].pin
|
#define GET_ARRAY_PIN(p) pin_array[p].pin
|
||||||
#define GET_ARRAY_IS_DIGITAL(p) pin_array[p].is_digital
|
#define GET_ARRAY_IS_DIGITAL(p) pin_array[p].is_digital
|
||||||
#define VALID_PIN(pin) (pin >= 0 && pin < (int8_t)NUMBER_PINS_TOTAL ? 1 : 0)
|
#define VALID_PIN(pin) (pin >= 0 && pin < int8_t(NUMBER_PINS_TOTAL))
|
||||||
#define DIGITAL_PIN_TO_ANALOG_PIN(p) int(p - analogInputToDigitalPin(0))
|
#define DIGITAL_PIN_TO_ANALOG_PIN(p) int(p - analogInputToDigitalPin(0))
|
||||||
#define IS_ANALOG(P) ((P) >= analogInputToDigitalPin(0) && (P) <= analogInputToDigitalPin(13)) || ((P) >= analogInputToDigitalPin(14) && (P) <= analogInputToDigitalPin(17))
|
#define IS_ANALOG(P) ((P) >= analogInputToDigitalPin(0) && (P) <= analogInputToDigitalPin(13)) || ((P) >= analogInputToDigitalPin(14) && (P) <= analogInputToDigitalPin(17))
|
||||||
#define pwm_status(pin) HAL_pwm_status(pin)
|
#define pwm_status(pin) HAL_pwm_status(pin)
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user