Compare commits
642 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| d46cf60548 | |||
| e94a1b16c4 | |||
| b44c03c203 | |||
| 67cdaa89cf | |||
| db9763c65f | |||
| 1f84f50fd8 | |||
| 3326c749f8 | |||
| 0269106066 | |||
| 95d38a8e54 | |||
| dca6afc26e | |||
| 19684f23bc | |||
| 52a561399e | |||
| 0683e8a9a3 | |||
| 1bb4a042e2 | |||
| d10861e478 | |||
| cf7c86d581 | |||
| d99e150097 | |||
| 9e88eb6100 | |||
| 71d9a3e1df | |||
| 6575dcc803 | |||
| 2715e5ba1b | |||
| 9a570b23a3 | |||
| 1b091ecb87 | |||
| 0055b6b423 | |||
| ab38abb237 | |||
| 907761e2bb | |||
| eba4b1f556 | |||
| 30ba2241e3 | |||
| 6bb17e68c1 | |||
| 7a7f723eb6 | |||
| 1daa885dbc | |||
| c995ecb933 | |||
| 901628c53e | |||
| b8229c14d4 | |||
| 8bd0501bdf | |||
| b436a19f23 | |||
| 97179ddad3 | |||
| 57815d2d65 | |||
| 67aa28f0c1 | |||
| 8d4eadefef | |||
| 56a41810d2 | |||
| b5d7f3ef12 | |||
| e0ff391eba | |||
| 8d44b6c427 | |||
| 953ea9f16e | |||
| 59dffb5f1c | |||
| d3704f834a | |||
| 13395db032 | |||
| ebde4ceb35 | |||
| 6128d61186 | |||
| 55cd1f51a4 | |||
| 900464dc72 | |||
| b87f2a86c9 | |||
| 6657c44cc7 | |||
| 52c37ee699 | |||
| 97e0ed7393 | |||
| 7862493991 | |||
| 63e91dc0af | |||
| e713d5ee2b | |||
| 52f1474281 | |||
| a512f6b40a | |||
| 911093a28c | |||
| b05b35ece9 | |||
| 0fa6605b49 | |||
| b007343710 | |||
| 7e02ffb9e9 | |||
| 73c2954ecb | |||
| 1e8f6ba749 | |||
| 134958a535 | |||
| 99378bfad4 | |||
| 3eb7bc37b8 | |||
| d347e6ab22 | |||
| 793e1c0b1d | |||
| 69c6b0f812 | |||
| fa25cab5ce | |||
| 33afb53201 | |||
| 6dc15e953f | |||
| 19a449cdaa | |||
| 9ebc74c1e7 | |||
| d69b857d8b | |||
| 0a9ea5968a | |||
| 4c90eb0173 | |||
| 7bcfede5b7 | |||
| 7385ce389a | |||
| a1b0bfc23a | |||
| 773a894209 | |||
| d873148f2f | |||
| 0f7ef6b586 | |||
| 0766fcd082 | |||
| f2060b5c34 | |||
| 01479cab84 | |||
| 056db1c3ae | |||
| 57e4fe6381 | |||
| 6531db383c | |||
| 401f5cf1ca | |||
| ab427804ac | |||
| 3a4d705308 | |||
| 56ee00f354 | |||
| f434f368ac | |||
| 1d9cf20d4b | |||
| 313014515c | |||
| 11d9bb4a66 | |||
| 7591c8661f | |||
| 456b0a4011 | |||
| 278c49e9de | |||
| 0ed4727767 | |||
| fcbc6a929c | |||
| 3c9b927291 | |||
| aa3cd470da | |||
| 004fd179d1 | |||
| eab01ba183 | |||
| 42bd6e74a7 | |||
| 67d6f2f877 | |||
| 5e10f6d8d1 | |||
| 3a1f3a4ba3 | |||
| 9697434981 | |||
| 6dec98e54c | |||
| 39201418ce | |||
| 8a30019a18 | |||
| a1c5735d6f | |||
| b02badf25e | |||
| 686fe6fe74 | |||
| 8ece5bcbee | |||
| ae9fe880f8 | |||
| 9c48d93a36 | |||
| fad005fdc2 | |||
| 0cf916ce13 | |||
| 0a54b35981 | |||
| 3b7871005a | |||
| 9cbb6b1512 | |||
| 0bd0b3df80 | |||
| 549619995f | |||
| 47c0dc631c | |||
| 5c39469b94 | |||
| 8ea02e3ede | |||
| a33f7ddc8c | |||
| 462b586c76 | |||
| af85a271a5 | |||
| 1bab76a98a | |||
| 25de1facb5 | |||
| c43d064122 | |||
| 5a9736bfa3 | |||
| 359258701f | |||
| 04f5a42c60 | |||
| 6dc27f6fc0 | |||
| b010d0782f | |||
| 6fd0c3f6a8 | |||
| 8f7735655e | |||
| 5f431c140f | |||
| 23f580bd03 | |||
| a7eacbcc49 | |||
| 05e2e059e3 | |||
| 2752234e14 | |||
| c87943cff1 | |||
| 661abff6e6 | |||
| 7e0478c97d | |||
| a0ed4d51bc | |||
| 005019b82d | |||
| 55d943e9d2 | |||
| f3e8919552 | |||
| 2bd9bcf61b | |||
| 3ec124f417 | |||
| c5263830d8 | |||
| 050e0db3a3 | |||
| f8f918590c | |||
| 5d56a71423 | |||
| 93b664182e | |||
| e0990f1b65 | |||
| 0a55425552 | |||
| 47c0c7072a | |||
| beb163a183 | |||
| cd67b87f22 | |||
| e5f087bd98 | |||
| 1fcad0b87c | |||
| bf698efc93 | |||
| f0e950db72 | |||
| 200a3957d9 | |||
| b243c67de2 | |||
| 20d107adf2 | |||
| 5e3c15bd39 | |||
| 05cbeef2c6 | |||
| 2ab4b9bd13 | |||
| 1cc33f318c | |||
| 78e3a829ba | |||
| 60dc55c3bf | |||
| ef12aa5a6c | |||
| b8f90b2d71 | |||
| ee91c915ee | |||
| e7fac26f2b | |||
| e66a2fdbf4 | |||
| f96a4a53ef | |||
| 096c146f16 | |||
| 5111e8d3a3 | |||
| 775850a245 | |||
| 8401c6d267 | |||
| bdeceae5b4 | |||
| c6ace0d4a5 | |||
| e9c9f07b8b | |||
| 8386ae0f4d | |||
| 237ad14388 | |||
| 1c194d4e16 | |||
| fb5ee94263 | |||
| 7bfcba1cf7 | |||
| 147cda7c1d | |||
| 6016ef7ba1 | |||
| a82e3147fd | |||
| fa73edd76a | |||
| 591a42cdd0 | |||
| 6b74e0f142 | |||
| 4cdec14648 | |||
| e4e9f01bf0 | |||
| 01ef9afdd0 | |||
| 21f8741982 | |||
| fa80adf92c | |||
| 9e4cce23d4 | |||
| 868967d08c | |||
| 48dc25407e | |||
| b88833a1cd | |||
| 391a07b2bf | |||
| c8faaca998 | |||
| 01ab324a12 | |||
| 00152be921 | |||
| be5078f8ab | |||
| cacdb2d818 | |||
| 3553ef4c00 | |||
| 64cf8316e1 | |||
| b6ad2db3a9 | |||
| 47222bcdde | |||
| 22f2a8baa7 | |||
| 08b92c3d1c | |||
| 474111f1c9 | |||
| b35125e1a2 | |||
| 3a1646b2e8 | |||
| b99b6250ee | |||
| 947ee4560e | |||
| 11a0186b35 | |||
| db74ac3ce1 | |||
| 2b46761060 | |||
| 97e1768ffe | |||
| 8e83784656 | |||
| 73b0c506e4 | |||
| 4678bb49b9 | |||
| f581502cc4 | |||
| dfc3007326 | |||
| 7f691fc5c1 | |||
| 01e7a5cb76 | |||
| fa72415812 | |||
| 0b6ecbd553 | |||
| de6246f826 | |||
| e813742ae0 | |||
| 46c8204990 | |||
| bdfe4ca4d1 | |||
| adabc63617 | |||
| 6741f5182d | |||
| d8508c5110 | |||
| dae60f4b29 | |||
| e16655a011 | |||
| 0d576bb529 | |||
| 61c3d122c9 | |||
| 123086d14c | |||
| 10fd6df83d | |||
| d40750cde8 | |||
| 489b75ae3c | |||
| 378fc12628 | |||
| 0cedad36d1 | |||
| 07b2480d30 | |||
| dd88eb56ee | |||
| fc77afd93e | |||
| 26af3e70bc | |||
| 0c15e8e751 | |||
| 639a2dc0b3 | |||
| 91a094d8cb | |||
| 66efa0b09b | |||
| e1c5f8418d | |||
| 4a0769ec1b | |||
| 991f21c74c | |||
| 9ebf358b8a | |||
| 70c26fd4ca | |||
| 9e66a87122 | |||
| f177bd32eb | |||
| 8df38008ef | |||
| ec5d623c93 | |||
| aca3184ce4 | |||
| 7cda9dbf84 | |||
| 71d530e594 | |||
| 24e8499ef6 | |||
| 0821c72d39 | |||
| 2abf5f0ad8 | |||
| 5c59a3d7c7 | |||
| a9e7df859c | |||
| f6a48f82aa | |||
| c0f0964329 | |||
| 0322dfd76e | |||
| 2d651fc785 | |||
| bd967ba7a2 | |||
| cc1a4f5f70 | |||
| d43c557404 | |||
| c4ba4600dc | |||
| 0bbc122475 | |||
| 1868db82aa | |||
| 23091e566b | |||
| 0ac94f6a2f | |||
| 3d804bd314 | |||
| e0de16f3a8 | |||
| 7421731eed | |||
| 43bc8c3865 | |||
| c13d290934 | |||
| 49eb72816e | |||
| ec0c72e2f0 | |||
| ff221cdacd | |||
| af177e719e | |||
| c713b14143 | |||
| 44c21f477e | |||
| 9f2e0238df | |||
| fd72d771e6 | |||
| dc1a4080db | |||
| 1e3cd5ca8b | |||
| 09f1c97c6e | |||
| 13b16b4062 | |||
| 7f5f9724de | |||
| 92a7943d4e | |||
| 448abd5de2 | |||
| 37f4924ac1 | |||
| 1c269eda1e | |||
| d8573b97eb | |||
| 5a94a8e1c0 | |||
| e067dc4713 | |||
| 1f6da0c1b4 | |||
| 8bb4484af5 | |||
| 6cc524dd50 | |||
| 728539bb23 | |||
| a67b346523 | |||
| 4b767d7623 | |||
| 7e149b2532 | |||
| 3b7b4b48d8 | |||
| 49fd9bdb77 | |||
| 5bcf64f17c | |||
| a3e960c251 | |||
| a7696f32fd | |||
| b4d3f03a26 | |||
| 42c6324f68 | |||
| 4d15eb94e4 | |||
| 3d688fc324 | |||
| 58e54f6746 | |||
| bf7a48ed31 | |||
| dc52c64424 | |||
| 0e29cd8cc5 | |||
| 844fe9b24d | |||
| 2b19dc3232 | |||
| f41c78d178 | |||
| 6270df927e | |||
| cbcc1bc084 | |||
| ab1d124bf9 | |||
| 5b7215df43 | |||
| b589cac5ff | |||
| 44aaa4f042 | |||
| afef0b9dec | |||
| f7767be8a5 | |||
| 2f5e28dd66 | |||
| 0397d384d2 | |||
| 212dfb4050 | |||
| 59ff070dba | |||
| c7af93b39f | |||
| 794ea13ae8 | |||
| 227f014fb5 | |||
| e22408f3f9 | |||
| 9e8e1c1113 | |||
| 1427290e84 | |||
| 1c7b232d05 | |||
| 005dad193a | |||
| 88f502cac5 | |||
| 0cc286757b | |||
| d843e2be2b | |||
| cede5b22c9 | |||
| 43f996d68a | |||
| bd426d40cd | |||
| 099c329238 | |||
| 3db4452d28 | |||
| 385bab2f36 | |||
| 1fab2ef94f | |||
| 102c43dcd5 | |||
| 5284f45c62 | |||
| 9aaa7b1100 | |||
| ef661cd295 | |||
| d068769f2c | |||
| a6c4c5a3f7 | |||
| 78c57f2847 | |||
| 90b0be5e12 | |||
| c24456353f | |||
| ec7a4eb69e | |||
| 4f62ae9764 | |||
| 0cc6955ab7 | |||
| 86d2d5d0a8 | |||
| 5a994f0c9a | |||
| 39ee694856 | |||
| 10a16c8c75 | |||
| aa2763442e | |||
| f44a11f5ff | |||
| 7748fa84dd | |||
| cb506ec639 | |||
| 5e4f7516c1 | |||
| 6443790c6f | |||
| 9a238fa7f9 | |||
| 723fc88e78 | |||
| 4b4a4ba163 | |||
| 57250c8340 | |||
| 6bf069d1ab | |||
| 1921015d1f | |||
| 24f3400c46 | |||
| b8c9e823ca | |||
| 3801d831d4 | |||
| 6f4b2ce4a2 | |||
| ef85eeed2a | |||
| cd98d0cf5c | |||
| 6f57a7311c | |||
| dc19c60a0e | |||
| 38c79a4585 | |||
| 541e074f97 | |||
| 2a01b8ea62 | |||
| 38fd3782f9 | |||
| f5cfc65c1d | |||
| 00f3397cad | |||
| 8e6f5f90c5 | |||
| db0b14d97e | |||
| 84158b912b | |||
| 21f8c8d7f8 | |||
| e2363dc64c | |||
| 1f439cd89a | |||
| f3ddc1f8b6 | |||
| 223971c47f | |||
| c2eeda01de | |||
| 5ea4241ea3 | |||
| 04845c80e9 | |||
| 8194b7f5fc | |||
| e735948969 | |||
| 634ddeef7e | |||
| ea78c6bf61 | |||
| b52168e37c | |||
| ba7368ce3a | |||
| 69d06dd872 | |||
| a92b627d00 | |||
| b9aa338c19 | |||
| 27e105b890 | |||
| 494a9a90bb | |||
| d876e6b80a | |||
| 97da6e97b9 | |||
| 671ab75bce | |||
| 6a98f4e1be | |||
| dd86d60a32 | |||
| 706260d39f | |||
| bae9d18ee9 | |||
| df31aa486e | |||
| 9a4d0fec6c | |||
| b1f96cf4f7 | |||
| 916aaa4881 | |||
| 4a4820d84f | |||
| 8eeea354cd | |||
| b26e53156f | |||
| ce46fafd92 | |||
| 7d9ee39285 | |||
| bf8074c108 | |||
| dd82d2d217 | |||
| 1ee599a2ba | |||
| 8adb58c266 | |||
| 173b0f8bd1 | |||
| e77f6d855b | |||
| 23ce68436a | |||
| 6e15859ce2 | |||
| e76f769690 | |||
| 0a2ba2fadf | |||
| 37d5f55396 | |||
| eca2080a3f | |||
| d2fc1daf50 | |||
| 782fe78ea0 | |||
| 084c45a6ee | |||
| 94d8fc8e8a | |||
| 491d82f93e | |||
| 49fd0950ee | |||
| 06425bf4b7 | |||
| e9660aeed7 | |||
| 6480f0939d | |||
| d0e9c21aff | |||
| 63d1ae1021 | |||
| 5a4b2ba5c5 | |||
| a80c371340 | |||
| 6d39a6fc55 | |||
| 02fe3a6818 | |||
| be44105ae9 | |||
| 10e5d92dec | |||
| 2e11485da4 | |||
| d305f0a14b | |||
| 5f30e9fe1c | |||
| 80c8218d94 | |||
| bed2bfdc24 | |||
| 6f2967a8dc | |||
| 6496cedc17 | |||
| 7b01993bbc | |||
| 07a1b00a25 | |||
| 7325d66de5 | |||
| 865737345f | |||
| dfa6c2f4f1 | |||
| 0a2f0cca93 | |||
| dbbdf11d75 | |||
| 6430489e21 | |||
| 04d4fca75d | |||
| 486cf92c5c | |||
| 820aff4e7c | |||
| 120da68133 | |||
| 747e21ee3e | |||
| 53e8c005b7 | |||
| ef01aecd47 | |||
| 6ff92f3215 | |||
| ba5bab1a3a | |||
| af0b39982b | |||
| 680135583a | |||
| bdc256c048 | |||
| 0948c589d6 | |||
| fbf069ebe0 | |||
| 160f8ef0bc | |||
| 93ecbfa88c | |||
| 19d004b342 | |||
| 8b67e72afc | |||
| 9c863b1c67 | |||
| e4c4acbcc5 | |||
| 7dd2fe3f6c | |||
| a399028c77 | |||
| 840beb78be | |||
| 1181724b2b | |||
| 227aac34a2 | |||
| ecb6e215c5 | |||
| 8f09db27bd | |||
| 39e4ae2d7a | |||
| 8c181685d2 | |||
| 4f2730b6f8 | |||
| bc12ada74d | |||
| 7e97639e38 | |||
| c217fd3e66 | |||
| 6f69a30435 | |||
| 96d880e745 | |||
| d768f875ac | |||
| 02d54b9ce7 | |||
| 7070628ef9 | |||
| 1a89a43532 | |||
| 25faa304ee | |||
| 18a0f68ac0 | |||
| 7262ad3fc4 | |||
| b456959b97 | |||
| d20182aa91 | |||
| dc86dd9fae | |||
| e887033c0d | |||
| d786ba1773 | |||
| 3f0a4cfe25 | |||
| 442327d92e | |||
| 345ac6e8fe | |||
| 1b47fe8c64 | |||
| 67e9ee7bf2 | |||
| 7aecff2ba6 | |||
| 2e6d7308f6 | |||
| 9c5ee355e8 | |||
| 656946a0ff | |||
| 48e02a3210 | |||
| 6891ef5d00 | |||
| c392e6bf07 | |||
| de564f9b0a | |||
| c9aab13192 | |||
| 9ba9f654c4 | |||
| a13ebba41a | |||
| b1153cff1e | |||
| 9aa0004de6 | |||
| 3a9f043c58 | |||
| 80123bfdf2 | |||
| 923ce8e1d8 | |||
| c72fc3eaec | |||
| 3aa0763f26 | |||
| 96bee60be9 | |||
| b5df47bdf7 | |||
| c27474f396 | |||
| 6af2c36c50 | |||
| 577ebc6ba4 | |||
| 4b0135c022 | |||
| 27e95f2aab | |||
| 247385e94e | |||
| aafa3af088 | |||
| 12e230ca30 | |||
| 225a89004b | |||
| 0b6aa3cb2d | |||
| e7d3e67dc4 | |||
| 8fd37402a3 | |||
| 7cf72d5867 | |||
| a348c3caa9 | |||
| 6f5430f00a | |||
| 63821d87f9 | |||
| b5f447f144 | |||
| 4a56689801 | |||
| 0216e032be | |||
| 2d8aa0cea1 | |||
| 50f10fc57f | |||
| 12180f20e5 | |||
| f5dc8d73ee | |||
| 00e3806613 | |||
| 7296538849 | |||
| 6c4e3e9215 | |||
| 4f050e8dc9 | |||
| e50e446676 | |||
| b795860c5a | |||
| b97b2b9df8 | |||
| c6bdb2cd95 | |||
| f409cf8c87 | |||
| fbb75f41c2 | |||
| d560a493b2 | |||
| 0395b7563e | |||
| ebd414b3d5 | |||
| 0c8bafba38 | |||
| 65d5c57957 | |||
| b1d667c04a | |||
| ee8ea7a0b5 | |||
| 89ac692bcc | |||
| 88410b3cfe | |||
| 60eb467bfe | |||
| 1c3407ed62 | |||
| 82064d2341 | |||
| 16b7cffe0f | |||
| 638bac84cf | |||
| 9d3ad76d50 | |||
| 6edb31f58c | |||
| 01297cab24 | |||
| 80fa195db3 | |||
| 052b4387d3 | |||
| dd5481b001 | |||
| 59e1371f89 | |||
| 4fdcae6677 | |||
| 1c3dcae659 | |||
| ec425de694 | |||
| 29899e6fe8 | |||
| f7eaa32bc9 | |||
| 508dc26394 | |||
| 600d5922da | |||
| a2efee8b7b | |||
| 239e4737a8 | |||
| c8577bc673 | |||
| 3bd2ed7310 | |||
| 79414a1398 |
@@ -1,9 +1,9 @@
|
||||
#
|
||||
# test-builds.yml
|
||||
# ci-build-tests.yml
|
||||
# Do test builds to catch compile errors
|
||||
#
|
||||
|
||||
name: CI
|
||||
name: CI - Build Tests
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
@@ -27,7 +27,7 @@ on:
|
||||
|
||||
jobs:
|
||||
test_builds:
|
||||
name: Run All Tests
|
||||
name: Build Test
|
||||
if: github.repository == 'MarlinFirmware/Marlin'
|
||||
|
||||
runs-on: ubuntu-latest
|
||||
@@ -0,0 +1,73 @@
|
||||
#
|
||||
# ci-unit-tests.yml
|
||||
# Build and execute unit tests to catch functional issues in code
|
||||
#
|
||||
|
||||
name: CI - Unit Tests
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
branches:
|
||||
- bugfix-2.1.x
|
||||
# Cannot be enabled on 2.1.x until it contains the unit test framework
|
||||
#- 2.1.x
|
||||
paths-ignore:
|
||||
- config/**
|
||||
- data/**
|
||||
- docs/**
|
||||
- '**/*.md'
|
||||
push:
|
||||
branches:
|
||||
- bugfix-2.1.x
|
||||
# Cannot be enabled on 2.1.x until it contains the unit test framework
|
||||
#- 2.1.x
|
||||
paths-ignore:
|
||||
- config/**
|
||||
- data/**
|
||||
- docs/**
|
||||
- '**/*.md'
|
||||
|
||||
jobs:
|
||||
# This runs all unit tests as a single job. While it should be possible to break this up into
|
||||
# multiple jobs, they currently run quickly and finish long before the compilation tests.
|
||||
run_unit_tests:
|
||||
name: Unit Test
|
||||
# These tests will only be able to run on the bugfix-2.1.x branch, until the next release
|
||||
# pulls them into additional branches.
|
||||
if: github.repository == 'MarlinFirmware/Marlin'
|
||||
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Check out the PR
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Cache pip
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: ~/.cache/pip
|
||||
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-pip-
|
||||
|
||||
- name: Cache PlatformIO
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: ~/.platformio
|
||||
key: ${{ runner.os }}-${{ hashFiles('**/lockfiles') }}
|
||||
|
||||
- name: Select Python 3.9
|
||||
uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: '3.9'
|
||||
architecture: 'x64'
|
||||
|
||||
- name: Install PlatformIO
|
||||
run: |
|
||||
pip install -U platformio
|
||||
pio upgrade --dev
|
||||
pio pkg update --global
|
||||
|
||||
- name: Run All Unit Tests
|
||||
run: |
|
||||
make unit-test-all-local
|
||||
@@ -12,7 +12,12 @@ help:
|
||||
@echo "make tests-single-local-docker : Run a single test locally, using docker"
|
||||
@echo "make tests-all-local : Run all tests locally"
|
||||
@echo "make tests-all-local-docker : Run all tests locally, using docker"
|
||||
@echo "make setup-local-docker : Build the local docker image"
|
||||
# @echo "make unit-test-single-ci : Run a single code test from inside the CI"
|
||||
# @echo "make unit-test-single-local : Run a single code test locally"
|
||||
# @echo "make unit-test-single-local-docker : Run a single code test locally, using docker-compose"
|
||||
@echo "make unit-test-all-local : Run all code tests locally"
|
||||
@echo "make unit-test-all-local-docker : Run all code tests locally, using docker-compose"
|
||||
@echo "make setup-local-docker : Setup local docker-compose"
|
||||
@echo ""
|
||||
@echo "Options for testing:"
|
||||
@echo " TEST_TARGET Set when running tests-single-*, to select the"
|
||||
@@ -43,7 +48,7 @@ tests-single-local:
|
||||
tests-single-local-docker:
|
||||
@if ! test -n "$(TEST_TARGET)" ; then echo "***ERROR*** Set TEST_TARGET=<your-module> or use make tests-all-local-docker" ; return 1; fi
|
||||
@if ! $(CONTAINER_RT_BIN) images -q $(CONTAINER_IMAGE) > /dev/null ; then $(MAKE) setup-local-docker ; fi
|
||||
$(CONTAINER_RT_BIN) run $(CONTAINER_RT_OPTS) $(CONTAINER_IMAGE) $(MAKE) tests-single-local TEST_TARGET=$(TEST_TARGET) VERBOSE_PLATFORMIO=$(VERBOSE_PLATFORMIO) GIT_RESET_HARD=$(GIT_RESET_HARD) ONLY_TEST="$(ONLY_TEST)"
|
||||
$(CONTAINER_RT_BIN) run $(CONTAINER_RT_OPTS) $(CONTAINER_IMAGE) make tests-single-local TEST_TARGET=$(TEST_TARGET) VERBOSE_PLATFORMIO=$(VERBOSE_PLATFORMIO) GIT_RESET_HARD=$(GIT_RESET_HARD) ONLY_TEST="$(ONLY_TEST)"
|
||||
|
||||
tests-all-local:
|
||||
export PATH="./buildroot/bin/:./buildroot/tests/:${PATH}" \
|
||||
@@ -52,10 +57,31 @@ tests-all-local:
|
||||
|
||||
tests-all-local-docker:
|
||||
@if ! $(CONTAINER_RT_BIN) images -q $(CONTAINER_IMAGE) > /dev/null ; then $(MAKE) setup-local-docker ; fi
|
||||
$(CONTAINER_RT_BIN) run $(CONTAINER_RT_OPTS) $(CONTAINER_IMAGE) $(MAKE) tests-all-local VERBOSE_PLATFORMIO=$(VERBOSE_PLATFORMIO) GIT_RESET_HARD=$(GIT_RESET_HARD)
|
||||
$(CONTAINER_RT_BIN) run $(CONTAINER_RT_OPTS) $(CONTAINER_IMAGE) make tests-all-local VERBOSE_PLATFORMIO=$(VERBOSE_PLATFORMIO) GIT_RESET_HARD=$(GIT_RESET_HARD)
|
||||
|
||||
#unit-test-single-ci:
|
||||
# export GIT_RESET_HARD=true
|
||||
# $(MAKE) unit-test-single-local TEST_TARGET=$(TEST_TARGET)
|
||||
|
||||
# TODO: How can we limit tests with ONLY_TEST with platformio?
|
||||
#unit-test-single-local:
|
||||
# @if ! test -n "$(TEST_TARGET)" ; then echo "***ERROR*** Set TEST_TARGET=<your-module> or use make unit-test-all-local" ; return 1; fi
|
||||
# platformio run -t marlin_$(TEST_TARGET)
|
||||
|
||||
#unit-test-single-local-docker:
|
||||
# @if ! test -n "$(TEST_TARGET)" ; then echo "***ERROR*** Set TEST_TARGET=<your-module> or use make unit-test-all-local-docker" ; return 1; fi
|
||||
# @if ! $(CONTAINER_RT_BIN) images -q $(CONTAINER_IMAGE) > /dev/null ; then $(MAKE) setup-local-docker ; fi
|
||||
# $(CONTAINER_RT_BIN) run $(CONTAINER_RT_OPTS) $(CONTAINER_IMAGE) make unit-test-single-local TEST_TARGET=$(TEST_TARGET) ONLY_TEST="$(ONLY_TEST)"
|
||||
|
||||
unit-test-all-local:
|
||||
platformio run -t test-marlin -e linux_native_test
|
||||
|
||||
unit-test-all-local-docker:
|
||||
@if ! $(CONTAINER_RT_BIN) images -q $(CONTAINER_IMAGE) > /dev/null ; then $(MAKE) setup-local-docker ; fi
|
||||
$(CONTAINER_RT_BIN) run $(CONTAINER_RT_OPTS) $(CONTAINER_IMAGE) make unit-test-all-local
|
||||
|
||||
setup-local-docker:
|
||||
$(CONTAINER_RT_BIN) build -t $(CONTAINER_IMAGE) -f docker/Dockerfile .
|
||||
$(CONTAINER_RT_BIN) buildx build -t $(CONTAINER_IMAGE) -f docker/Dockerfile .
|
||||
|
||||
PINS := $(shell find Marlin/src/pins -mindepth 2 -name '*.h')
|
||||
|
||||
|
||||
+1869
-343
File diff suppressed because it is too large
Load Diff
+416
-213
File diff suppressed because it is too large
Load Diff
+162
-10
@@ -16,7 +16,7 @@
|
||||
* 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/>.
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
#pragma once
|
||||
@@ -28,25 +28,177 @@
|
||||
/**
|
||||
* Marlin release version identifier
|
||||
*/
|
||||
//#define SHORT_BUILD_VERSION "bugfix-2.1.x"
|
||||
#define SHORT_BUILD_VERSION "DW7.4.9"
|
||||
|
||||
/**
|
||||
* Verbose version identifier which should contain a reference to the location
|
||||
* from where the binary was downloaded or the source code was compiled.
|
||||
*/
|
||||
//#define DETAILED_BUILD_VERSION SHORT_BUILD_VERSION
|
||||
|
||||
#if(ENABLED(MachineMini))
|
||||
#define VerChar1 "M"
|
||||
#elif(ENABLED(MachineEnder2))
|
||||
#define VerChar1 "E2"
|
||||
#elif(ENABLED(MachineEnder2Pro))
|
||||
#define VerChar1 "E2P"
|
||||
#elif(ENABLED(MachineEnder3))
|
||||
#define VerChar1 "E3"
|
||||
#elif ENABLED(MachineEnder3V2)
|
||||
#define VerChar1 "E3V2"
|
||||
#elif ENABLED(MachineEnder3S1)
|
||||
#define VerChar1 "E3S1"
|
||||
#elif ENABLED(MachineEnder3Max)
|
||||
#define VerChar1 "E3M"
|
||||
#elif(ENABLED(MachineEnder4))
|
||||
#define VerChar1 "E4"
|
||||
#elif(ENABLED(MachineEnder5))
|
||||
#define VerChar1 "E5"
|
||||
#elif(ENABLED(MachineEnder6))
|
||||
#define VerChar1 "E6"
|
||||
#elif(ENABLED(MachineEnder7))
|
||||
#define VerChar1 "E7"
|
||||
#elif(ENABLED(MachineSermoonD1))
|
||||
#define VerChar1 "D1"
|
||||
#elif(ENABLED(MachineEnder5Plus))
|
||||
#define VerChar1 "E5P"
|
||||
#elif(ENABLED(MachineCR20))
|
||||
#define VerChar1 "2"
|
||||
#elif(ENABLED(MachineCR10Orig))
|
||||
#define VerChar1 "O"
|
||||
#elif(ENABLED(MachineCR10Std))
|
||||
#define VerChar1 "S"
|
||||
#elif(ENABLED(MachineCRX))
|
||||
#define VerChar1 "X"
|
||||
#elif(ENABLED(MachineCR6))
|
||||
#define VerChar1 "CR6"
|
||||
#elif(ENABLED(MachineCR5))
|
||||
#define VerChar1 "CR5"
|
||||
#elif(ENABLED(MachineCR6Max))
|
||||
#define VerChar1 "CR6M"
|
||||
#elif(ENABLED(MachineS4))
|
||||
#define VerChar1 "4"
|
||||
#elif(ENABLED(MachineS5) || ENABLED(MachineCR10Max))
|
||||
#define VerChar1 "5"
|
||||
#elif ENABLED(MachineCR2020)
|
||||
#define VerChar1 "20"
|
||||
#elif(ENABLED(MachineCR30))
|
||||
#define VerChar1 "CR30"
|
||||
#endif
|
||||
|
||||
#if(ENABLED(HotendStock))
|
||||
#define VerChar2 "S"
|
||||
#elif(ENABLED(HotendE3D))
|
||||
#define VerChar2 "E"
|
||||
#elif ENABLED(HotendMosquito)
|
||||
#define VerChar2 "M"
|
||||
#endif
|
||||
|
||||
#if(ENABLED(HotendAllMetal))
|
||||
#define VerChar3 "M"
|
||||
#else
|
||||
#define VerChar3 "S"
|
||||
#endif
|
||||
|
||||
|
||||
#if(ENABLED(BedAC))
|
||||
#define VerChar4 "A"
|
||||
#elif(ENABLED(BedDC))
|
||||
#define VerChar4 "D"
|
||||
#else
|
||||
#define VerChar4 "N"
|
||||
#endif
|
||||
|
||||
#if(ENABLED(ABL_EZABL))
|
||||
#define VerChar5 "A"
|
||||
#elif(ENABLED(ABL_BLTOUCH))
|
||||
#define VerChar5 "B"
|
||||
#else
|
||||
#define VerChar5 "N"
|
||||
#endif
|
||||
|
||||
#if(ENABLED(ABL_UBL))
|
||||
#define VerChar6 "U"
|
||||
#elif(ENABLED(ABL_BI))
|
||||
#define VerChar6 "B"
|
||||
#else
|
||||
#define VerChar6 "N"
|
||||
#endif
|
||||
|
||||
#define DETAILED_BUILD_VERSION SHORT_BUILD_VERSION " TM3D " VerChar1 VerChar2 VerChar3 VerChar4 VerChar5 VerChar6
|
||||
|
||||
/**
|
||||
* The STRING_DISTRIBUTION_DATE represents when the binary file was built,
|
||||
* here we define this default string as the date where the latest release
|
||||
* version was tagged.
|
||||
*/
|
||||
//#define STRING_DISTRIBUTION_DATE "2024-04-10"
|
||||
#define STRING_DISTRIBUTION_DATE "2024-04-08"
|
||||
|
||||
/**
|
||||
* Defines a generic printer name to be output to the LCD after booting Marlin.
|
||||
*/
|
||||
//#define MACHINE_NAME "3D Printer"
|
||||
#if(ENABLED(MachineMini))
|
||||
#define CUSTOM_MACHINE_NAME "Mini SuPeR"
|
||||
#elif(ENABLED(MachineCR10Smart))
|
||||
#define CUSTOM_MACHINE_NAME "TM3D CR10Smart"
|
||||
#elif(ENABLED(MachineCR10SmartPro))
|
||||
#define CUSTOM_MACHINE_NAME "TM3D CR10SmartPro"
|
||||
#elif(ENABLED(MachineEnder2))
|
||||
#define CUSTOM_MACHINE_NAME "TM3D Ender2"
|
||||
#elif(ENABLED(MachineEnder2Pro))
|
||||
#define CUSTOM_MACHINE_NAME "TM3D Ender2 Pro"
|
||||
#elif(ENABLED(MachineEnder3))
|
||||
#define CUSTOM_MACHINE_NAME "TM3D Ender3"
|
||||
#elif(ENABLED(MachineEnder3Max))
|
||||
#define CUSTOM_MACHINE_NAME "TM3D E3Max"
|
||||
#elif(ENABLED(MachineEnder6))
|
||||
#define CUSTOM_MACHINE_NAME "TM3D Ender6"
|
||||
#elif(ENABLED(MachineEnder7))
|
||||
#define CUSTOM_MACHINE_NAME "TM3D Ender7"
|
||||
#elif(ENABLED(MachineEnder3V2))
|
||||
#define CUSTOM_MACHINE_NAME "TM3D Ender3V2"
|
||||
#elif(ENABLED(MachineEnder3S1))
|
||||
#define CUSTOM_MACHINE_NAME "TM3D Ender3S1"
|
||||
#elif(ENABLED(MachineEnder4))
|
||||
#define CUSTOM_MACHINE_NAME "TM3D Ender4"
|
||||
#elif(ENABLED(MachineEnder5))
|
||||
#define CUSTOM_MACHINE_NAME "TM3D Ender5"
|
||||
#elif(ENABLED(MachineEnder5Plus))
|
||||
#define CUSTOM_MACHINE_NAME "TM3D E5 Plus"
|
||||
#elif(ENABLED(MachineCR20))
|
||||
#define CUSTOM_MACHINE_NAME "SuPeR CR-20"
|
||||
#elif(ENABLED(MachineCR10Orig))
|
||||
#define CUSTOM_MACHINE_NAME "SuPeR CR-10"
|
||||
#elif(ENABLED(MachineCRX))
|
||||
#define CUSTOM_MACHINE_NAME "TM3D CR-X"
|
||||
#elif ENABLED(MachineCR10SProV2)
|
||||
#define CUSTOM_MACHINE_NAME "TM3D 10SProV2"
|
||||
#elif(ENABLED(MachineCR10SPro))
|
||||
#define CUSTOM_MACHINE_NAME "TM3D 10S Pro"
|
||||
#elif(ENABLED(MachineCR10Max))
|
||||
#define CUSTOM_MACHINE_NAME "TM3D Max"
|
||||
#elif(ENABLED(MachineCR10SV3))
|
||||
#define CUSTOM_MACHINE_NAME "TM3D CR10V3"
|
||||
#elif(ENABLED(MachineCR10SV2))
|
||||
#define CUSTOM_MACHINE_NAME "TM3D CR10V2"
|
||||
#elif(ENABLED(MachineCR10Std))
|
||||
#define CUSTOM_MACHINE_NAME "300 SuPeR"
|
||||
#elif(ENABLED(MachineS4))
|
||||
#define CUSTOM_MACHINE_NAME "400 SuPeR"
|
||||
#elif(ENABLED(MachineS5))
|
||||
#define CUSTOM_MACHINE_NAME "500 SuPeR"
|
||||
#elif ENABLED(MachineCR2020)
|
||||
#define CUSTOM_MACHINE_NAME "TM3D 2020"
|
||||
#elif ENABLED(MachineSermoonD1)
|
||||
#define CUSTOM_MACHINE_NAME "SermoonD1"
|
||||
#elif ENABLED(MachineCR5)
|
||||
#define CUSTOM_MACHINE_NAME "CR5 Pro"
|
||||
#elif ENABLED(MachineCR6)
|
||||
#define CUSTOM_MACHINE_NAME "CR6"
|
||||
#elif ENABLED(MachineCR6Max)
|
||||
#define CUSTOM_MACHINE_NAME "CR6 Max"
|
||||
#elif ENABLED(MachineCR30)
|
||||
#define CUSTOM_MACHINE_NAME "CR30 Printmill"
|
||||
#endif
|
||||
|
||||
/**
|
||||
* The SOURCE_CODE_URL is the location where users will find the Marlin Source
|
||||
@@ -54,7 +206,7 @@
|
||||
* has a distinct Github fork— the Source Code URL should just be the main
|
||||
* Marlin repository.
|
||||
*/
|
||||
//#define SOURCE_CODE_URL "github.com/MarlinFirmware/Marlin"
|
||||
#define SOURCE_CODE_URL "https://github.com/InsanityAutomation/Marlin/tree/CrealityDwin_2.0"
|
||||
|
||||
/**
|
||||
* Default generic printer UUID.
|
||||
@@ -65,12 +217,12 @@
|
||||
* The WEBSITE_URL is the location where users can get more information such as
|
||||
* documentation about a specific Marlin release.
|
||||
*/
|
||||
//#define WEBSITE_URL "marlinfw.org"
|
||||
#define WEBSITE_URL "tinymachines3d.com"
|
||||
|
||||
/**
|
||||
* Set the vendor info the serial USB interface, if changable
|
||||
* Currently only supported by DUE platform
|
||||
*/
|
||||
//#define USB_DEVICE_VENDOR_ID 0x0000
|
||||
//#define USB_DEVICE_PRODUCT_ID 0x0000
|
||||
//#define USB_DEVICE_MANUFACTURE_NAME WEBSITE_URL
|
||||
//#define USB_DEVICE_VENDOR_ID 0x0000
|
||||
//#define USB_DEVICE_PRODUCT_ID 0x0000
|
||||
//#define USB_DEVICE_MANUFACTURE_NAME WEBSITE_URL
|
||||
@@ -0,0 +1,93 @@
|
||||
/**
|
||||
* Marlin 3D Printer Firmware
|
||||
* Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
|
||||
*
|
||||
* Based on Sprinter and grbl.
|
||||
* Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* Custom Bitmap for splashscreen
|
||||
*
|
||||
* You may use one of the following tools to generate the C++ bitmap array from
|
||||
* a black and white image:
|
||||
*
|
||||
* - http://www.marlinfw.org/tools/u8glib/converter.html
|
||||
* - http://www.digole.com/tools/PicturetoC_Hex_converter.php
|
||||
*/
|
||||
|
||||
#define CUSTOM_BOOTSCREEN_TIMEOUT 2500
|
||||
#define CUSTOM_BOOTSCREEN_BMPWIDTH 128
|
||||
#define CUSTOM_BOOTSCREEN_INVERTED
|
||||
|
||||
const unsigned char custom_start_bmp[] PROGMEM = {
|
||||
B11111101,B01010101,B01010101,B01010101,B01010101,B01010101,B01011111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,
|
||||
B11111110,B00000000,B00000000,B00000000,B00000000,B00000000,B00111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,
|
||||
B11111101,B00000000,B00000000,B00000111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,
|
||||
B11111110,B00000111,B11000000,B00000101,B01010101,B01010101,B01010101,B01010101,B01010101,B01011111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,
|
||||
B11111100,B00001010,B00100000,B00000110,B00000000,B00000000,B00000000,B00000000,B00000000,B00111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,
|
||||
B11111110,B00010100,B00010000,B00000101,B00000000,B00000000,B00000111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,
|
||||
B11111100,B00101000,B00001000,B00000110,B00000111,B11000000,B00000101,B01010101,B01010101,B01010101,B01010101,B01010101,B01011111,B11111111,B11111111,B11111111,
|
||||
B11111110,B01010100,B00000100,B00000100,B00001010,B00100000,B00000110,B00000000,B00000000,B00000000,B00000000,B00000000,B00111111,B11111111,B11111111,B11111111,
|
||||
B11111100,B01100000,B00000100,B00000110,B00010100,B00010000,B00000101,B00000000,B00000000,B00000111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,
|
||||
B11111110,B01010000,B00000100,B00000100,B00101000,B00001000,B00000110,B00000111,B11000000,B00000101,B01010101,B01010101,B01010101,B01010101,B01010101,B01011111,
|
||||
B11111100,B01100000,B00000100,B00000110,B01010100,B00000100,B00000100,B00001010,B00100000,B00000110,B00000000,B00000000,B00000000,B00000000,B00000000,B00111111,
|
||||
B11111110,B01010100,B00000100,B00011100,B01100000,B00000100,B00000110,B00010100,B00010000,B00000101,B00000000,B00000000,B00000000,B00000000,B00000000,B00011111,
|
||||
B11111100,B00101000,B00001000,B00101110,B01010000,B00000100,B00000100,B00101000,B00001000,B00000110,B00000111,B11000000,B00000000,B00000001,B11110000,B00111111,
|
||||
B11111110,B00010100,B00010000,B01010100,B01100000,B00000100,B00000110,B01010100,B00000100,B00000100,B00001010,B00100000,B00000000,B00000010,B00001000,B00011111,
|
||||
B11111100,B00001010,B00100000,B01100110,B01010100,B00000100,B00011100,B01100000,B00000100,B00000110,B00010100,B00010000,B00000000,B00000101,B00000100,B00111111,
|
||||
B11111110,B00000111,B11000000,B01010100,B00101000,B00001000,B00101110,B01010000,B00000100,B00000100,B00101000,B00001000,B00000000,B00001010,B00000010,B00011111,
|
||||
B11111100,B00000000,B00000000,B00101110,B00010100,B00010000,B01010100,B01100000,B00000100,B00000110,B01010100,B00000100,B00000000,B00010101,B00000001,B00111111,
|
||||
B11111110,B00000000,B00000000,B00011100,B00001010,B00100000,B01100110,B01010100,B00000100,B00011100,B01100000,B00000100,B00000000,B00011000,B00000001,B00011111,
|
||||
B11111100,B00000000,B00000000,B00000110,B00000111,B11000000,B01010100,B00101000,B00001000,B00101110,B01010000,B00000100,B00000000,B00010100,B00000001,B00111111,
|
||||
B11111110,B00000000,B00000000,B00000100,B00000000,B00000000,B00101110,B00010100,B00010000,B01010100,B01100000,B00000100,B00000000,B00011000,B00000001,B00011111,
|
||||
B11111100,B11111111,B11111111,B11111110,B00000000,B00000000,B00011100,B00001010,B00100000,B01100110,B01010100,B00000100,B00011100,B00010101,B00000001,B00111111,
|
||||
B11111110,B11010101,B01010101,B01010100,B00000000,B00000000,B00000110,B00000111,B11000000,B01010100,B00101000,B00001000,B00101010,B00001010,B00000010,B00011111,
|
||||
B11111100,B10000100,B00010000,B01000110,B00000000,B00000000,B00000100,B00000000,B00000000,B00101110,B00010100,B00010000,B01010001,B00000101,B00000100,B00111111,
|
||||
B11111110,B11000100,B00010000,B01000100,B11111111,B11111111,B11111110,B00000000,B00000000,B00011100,B00001010,B00100000,B01100001,B00000010,B10001000,B00011111,
|
||||
B11111100,B10000100,B00010000,B01000110,B11010101,B01010101,B01010100,B00000000,B00000000,B00000110,B00000111,B11000000,B01010001,B00000001,B11110000,B00111111,
|
||||
B11111110,B10000100,B00010000,B01000100,B10000100,B00010000,B01000110,B00000000,B00000000,B00000100,B00000000,B00000000,B00101010,B00000000,B00000000,B00011111,
|
||||
B11111100,B11000100,B00010000,B01000110,B11000100,B00010000,B01000100,B11111111,B11111111,B11111110,B00000000,B00000000,B00011100,B00000000,B00000000,B00111111,
|
||||
B11111110,B10000100,B00010000,B01000100,B10000100,B00010000,B01000110,B11010101,B01010101,B01010100,B00000000,B00000000,B00000000,B00000000,B00000000,B00011111,
|
||||
B11111100,B11010101,B01010101,B01010110,B10000100,B00010000,B01000100,B10000100,B00010000,B01000110,B00000000,B00000000,B00000000,B00000000,B00000000,B00111111,
|
||||
B11111100,B11111111,B11111111,B11111100,B11000100,B00010000,B01000110,B11000100,B00010000,B01000100,B11111111,B11111111,B11111111,B11111111,B11111111,B10011111,
|
||||
B11111110,B00000000,B00000000,B00000110,B10000100,B00010000,B01000100,B10000100,B00010000,B01000110,B11010101,B01010101,B01010101,B01010101,B01010101,B10111111,
|
||||
B11111101,B01010101,B01010101,B01010100,B11010101,B01010101,B01010110,B10000100,B00010000,B01000100,B10000100,B00010000,B01000001,B00000100,B00010000,B10011111,
|
||||
B11111111,B11111111,B11111111,B11111100,B11111111,B11111111,B11111100,B11000100,B00010000,B01000110,B11000100,B00010000,B01000001,B00000100,B00010001,B10111111,
|
||||
B11111111,B11111111,B11111111,B11111110,B00000000,B00000000,B00000110,B10000100,B00010000,B01000100,B10000100,B00010000,B01000001,B00000100,B00010000,B10011111,
|
||||
B11111111,B11111111,B11111111,B11111101,B01010101,B01010101,B01010100,B11010101,B01010101,B01010110,B10000100,B00010000,B01000001,B00000100,B00010000,B10011111,
|
||||
B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111100,B11111111,B11111111,B11111100,B11000100,B00010000,B01000001,B00000100,B00010001,B10111111,
|
||||
B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111110,B00000000,B00000000,B00000110,B10000100,B00010000,B01000001,B00000100,B00010000,B10011111,
|
||||
B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111101,B01010101,B01010101,B01010100,B11010101,B01010101,B01010101,B01010101,B01010101,B10111111,
|
||||
B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111100,B11111111,B11111111,B11111111,B11111111,B11111111,B10011111,
|
||||
B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111110,B00000000,B00000000,B00000000,B00000000,B00000000,B00111111,
|
||||
B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111101,B01010101,B01010101,B01010101,B01010101,B01010101,B01011111,
|
||||
B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,
|
||||
B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,
|
||||
B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,
|
||||
B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,
|
||||
B11100000,B00101110,B11111011,B01111101,B11111011,B11111011,B11001111,B11000001,B11011111,B10111011,B00111110,B11000000,B11100001,B11111110,B00111100,B00011111,
|
||||
B11111101,B11101110,B01111011,B00111001,B11111001,B11110011,B11001111,B10011110,B11011111,B10111011,B00111110,B11011111,B11011110,B11111100,B11011101,B11100111,
|
||||
B11111101,B11101110,B00111011,B10111011,B11111001,B11101011,B11010111,B10111111,B01011111,B10111011,B01011110,B11011111,B11011110,B11111101,B11101101,B11110111,
|
||||
B11111101,B11101110,B10111011,B11010011,B11111010,B11101011,B10110111,B00111111,B11011111,B10111011,B01001110,B11011111,B11011111,B11111111,B11001101,B11110011,
|
||||
B11111101,B11101110,B11011011,B11000111,B11111010,B11101011,B10111011,B01111111,B11000000,B00111011,B01101110,B11000000,B11100011,B11111111,B00011101,B11110011,
|
||||
B11111101,B11101110,B11001011,B11101111,B11111010,B11011011,B10111011,B01111111,B11011111,B10111011,B01100110,B11011111,B11111000,B11111111,B11001101,B11110011,
|
||||
B11111101,B11101110,B11101011,B11101111,B11111011,B01011011,B00000011,B00111111,B01011111,B10111011,B01110110,B11011111,B11111110,B01111111,B11101101,B11110011,
|
||||
B11111101,B11101110,B11110011,B11101111,B11111011,B01011011,B01111001,B10111110,B11011111,B10111011,B01111010,B11011111,B11011110,B01111101,B11101101,B11110111,
|
||||
B11111101,B11101110,B11110011,B11101111,B11111011,B10111010,B11111101,B10011110,B11011111,B10111011,B01111100,B11011111,B11011110,B11111101,B11001101,B11100111,
|
||||
B11111101,B11101110,B11111011,B11101111,B11111011,B10111010,B11111101,B11000001,B11011111,B10111011,B01111110,B11000000,B11100000,B11111110,B00011100,B00011111
|
||||
};
|
||||
@@ -0,0 +1,74 @@
|
||||
/**
|
||||
* Marlin 3D Printer Firmware
|
||||
* Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
|
||||
*
|
||||
* Based on Sprinter and grbl.
|
||||
* Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* Custom Status Screen bitmap
|
||||
*
|
||||
* Place this file in the root with your configuration files
|
||||
* and enable CUSTOM_STATUS_SCREEN_IMAGE in Configuration.h.
|
||||
*
|
||||
* Use the Marlin Bitmap Converter to make your own:
|
||||
* http://marlinfw.org/tools/u8glib/converter.html
|
||||
*/
|
||||
|
||||
//
|
||||
// Status Screen Logo bitmap
|
||||
//
|
||||
#define STATUS_LOGO_Y 3
|
||||
#define STATUS_LOGO_WIDTH 24
|
||||
|
||||
const unsigned char status_logo_bmp[] PROGMEM = {
|
||||
B11111111,B11111111,B11111111,
|
||||
B10000000,B00000000,B00000001,
|
||||
B10001110,B00000000,B11100001,
|
||||
B10011111,B00000001,B11110001,
|
||||
B10010011,B10000001,B00111001,
|
||||
B10011111,B10000001,B11111001,
|
||||
B10011111,B10000001,B11111001,
|
||||
B10011111,B10111001,B11111001,
|
||||
B10001111,B00101000,B11110001,
|
||||
B10000000,B00111000,B00000001,
|
||||
B10000000,B00000000,B00000001,
|
||||
B10011111,B11111111,B11111001,
|
||||
B10010001,B01110100,B10011001,
|
||||
B10011011,B00000110,B10101001,
|
||||
B10011011,B01010100,B10101001,
|
||||
B10011011,B01010110,B10101001,
|
||||
B10011011,B01010100,B10011001,
|
||||
B10011111,B11111111,B11111001,
|
||||
B11111111,B11111111,B11111111
|
||||
};
|
||||
|
||||
//
|
||||
// Use default bitmaps
|
||||
//
|
||||
#define STATUS_HOTEND_ANIM
|
||||
#define STATUS_BED_ANIM
|
||||
#if HOTENDS < 2
|
||||
#define STATUS_LOGO_X 8
|
||||
#define STATUS_HEATERS_X 40
|
||||
#define STATUS_BED_X 72
|
||||
#else
|
||||
#define STATUS_LOGO_X 0
|
||||
#define STATUS_HEATERS_X 32
|
||||
#define STATUS_BED_X 80
|
||||
#endif
|
||||
@@ -141,8 +141,8 @@ typedef Servo hal_servo_t;
|
||||
#error "LCD_SERIAL_PORT must be from 0 to 3."
|
||||
#endif
|
||||
#define LCD_SERIAL lcdSerial
|
||||
#if HAS_DGUS_LCD
|
||||
#define LCD_SERIAL_TX_BUFFER_FREE() LCD_SERIAL.get_tx_buffer_free()
|
||||
#if HAS_DGUS_LCD || ENABLED(DGUS_LCD_UI_CREALITY_TOUCH) || ENABLED(EXTENSIBLE_UI)
|
||||
#define SERIAL_GET_TX_BUFFER_FREE() LCD_SERIAL.get_tx_buffer_free()
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
@@ -629,7 +629,7 @@ MSerialT1 customizedSerial1(MSerialT1::HasEmergencyParser);
|
||||
template class MarlinSerial< LCDSerialCfg<LCD_SERIAL_PORT> >;
|
||||
MSerialLCD lcdSerial(MSerialLCD::HasEmergencyParser);
|
||||
|
||||
#if HAS_DGUS_LCD
|
||||
#if HAS_DGUS_LCD || ENABLED(DGUS_LCD_UI_CREALITY_TOUCH) || ENABLED(EXTENSIBLE_UI)
|
||||
template<typename Cfg>
|
||||
typename MarlinSerial<Cfg>::ring_buffer_pos_t MarlinSerial<Cfg>::get_tx_buffer_free() {
|
||||
const ring_buffer_pos_t t = tx_buffer.tail, // next byte to send.
|
||||
|
||||
@@ -205,7 +205,7 @@
|
||||
static ring_buffer_pos_t available();
|
||||
static void write(const uint8_t c);
|
||||
static void flushTX();
|
||||
#if HAS_DGUS_LCD
|
||||
#if HAS_DGUS_LCD || ENABLED(DGUS_LCD_UI_CREALITY_TOUCH) || ENABLED(EXTENSIBLE_UI)
|
||||
static ring_buffer_pos_t get_tx_buffer_free();
|
||||
#endif
|
||||
|
||||
@@ -276,7 +276,7 @@
|
||||
static constexpr bool DROPPED_RX = false;
|
||||
static constexpr bool RX_FRAMING_ERRORS = false;
|
||||
static constexpr bool MAX_RX_QUEUED = false;
|
||||
static constexpr bool RX_OVERRUNS = ALL(HAS_DGUS_LCD, SERIAL_STATS_RX_BUFFER_OVERRUNS);
|
||||
static constexpr bool RX_OVERRUNS = (ANY(HAS_DGUS_LCD, SERIAL_STATS_RX_BUFFER_OVERRUNS) || ENABLED(DWINOS_4));
|
||||
};
|
||||
|
||||
typedef Serial1Class< MarlinSerial< LCDSerialCfg<LCD_SERIAL_PORT> > > MSerialLCD;
|
||||
|
||||
@@ -123,6 +123,11 @@ void MarlinHAL::init() {
|
||||
|
||||
// Register min serial
|
||||
TERN_(POSTMORTEM_DEBUGGING, install_min_serial());
|
||||
|
||||
// warn if low memory after init
|
||||
if (freeMemory() < 1024) {
|
||||
SERIAL_WARN_MSG("HAL: low memory after init!\n");
|
||||
}
|
||||
}
|
||||
|
||||
void MarlinHAL::init_board() {}
|
||||
@@ -147,7 +152,31 @@ void MarlinHAL::delay_ms(const int ms) {
|
||||
delay(ms);
|
||||
}
|
||||
|
||||
void MarlinHAL::idletask() {}
|
||||
void MarlinHAL::idletask() {
|
||||
#if ENABLED(MARLIN_DEV_MODE)
|
||||
// check & print serial RX errors
|
||||
MSerialT *serials[] = { &MSerial1, &MSerial2 };
|
||||
for (int serial = 0; serial < 2; serial++) {
|
||||
usart_receive_error_t err = serials[serial]->getReceiveError();
|
||||
if (err != usart_receive_error_t::None) {
|
||||
// "Warning: MSerial[n] RX [Framing|Parity|Overrun] Error"
|
||||
SERIAL_WARN_START();
|
||||
SERIAL_ECHOPGM(" MSerial");
|
||||
SERIAL_ECHO(serial + 1);
|
||||
SERIAL_ECHOPGM(" RX ");
|
||||
switch(err) {
|
||||
case usart_receive_error_t::FramingError: SERIAL_ECHOPGM("Framing"); break;
|
||||
case usart_receive_error_t::ParityError: SERIAL_ECHOPGM("Parity"); break;
|
||||
case usart_receive_error_t::OverrunError: SERIAL_ECHOPGM("Overrun"); break;
|
||||
case usart_receive_error_t::RxDataDropped: SERIAL_ECHOPGM("DataDropped"); break;
|
||||
default: break;
|
||||
}
|
||||
SERIAL_ECHOPGM(" Error");
|
||||
SERIAL_EOL();
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
uint8_t MarlinHAL::get_reset_source() {
|
||||
// Query reset cause from RMU
|
||||
|
||||
@@ -46,14 +46,34 @@ constexpr bool serial_handles_emergency(int port) {
|
||||
//
|
||||
// Define serial ports
|
||||
//
|
||||
#define DEFINE_HWSERIAL_MARLIN(name, n) \
|
||||
|
||||
// serial port where RX and TX use IRQs
|
||||
#define DEFINE_IRQ_SERIAL_MARLIN(name, n) \
|
||||
MSerialT name(serial_handles_emergency(n), \
|
||||
&USART##n##_config, \
|
||||
BOARD_USART##n##_TX_PIN, \
|
||||
BOARD_USART##n##_RX_PIN);
|
||||
|
||||
DEFINE_HWSERIAL_MARLIN(MSerial1, 1);
|
||||
DEFINE_HWSERIAL_MARLIN(MSerial2, 2);
|
||||
// serial port where RX uses DMA and TX uses IRQs
|
||||
// all serial ports use DMA1
|
||||
// since there are 4 USARTs and 4 DMA channels, we can use the USART number as the DMA channel
|
||||
#define DEFINE_DMA_SERIAL_MARLIN(name, n) \
|
||||
MSerialT name(serial_handles_emergency(n), \
|
||||
&USART##n##_config, \
|
||||
BOARD_USART##n##_TX_PIN, \
|
||||
BOARD_USART##n##_RX_PIN, \
|
||||
M4_DMA1, \
|
||||
((en_dma_channel_t)(n - 1))); // map USART1 to DMA channel 0, USART2 to DMA channel 1, etc.
|
||||
|
||||
#define DEFINE_SERIAL_MARLIN(name, n) TERN(SERIAL_DMA, DEFINE_DMA_SERIAL_MARLIN(name, n), DEFINE_IRQ_SERIAL_MARLIN(name, n))
|
||||
|
||||
DEFINE_SERIAL_MARLIN(MSerial1, 1);
|
||||
DEFINE_SERIAL_MARLIN(MSerial2, 2);
|
||||
|
||||
// TODO: remove this warning when SERIAL_DMA has been tested some more
|
||||
#if ENABLED(SERIAL_DMA)
|
||||
#warning "SERIAL_DMA may be unstable on HC32F460."
|
||||
#endif
|
||||
|
||||
//
|
||||
// Serial port assertions
|
||||
|
||||
@@ -25,17 +25,42 @@
|
||||
#include <drivers/usart/Usart.h>
|
||||
|
||||
// Optionally set uart IRQ priority to reduce overflow errors
|
||||
// #define UART_IRQ_PRIO 1
|
||||
//#define UART_RX_IRQ_PRIO 1
|
||||
//#define UART_TX_IRQ_PRIO 1
|
||||
//#define UART_RX_DMA_IRQ_PRIO 1
|
||||
|
||||
struct MarlinSerial : public Usart {
|
||||
MarlinSerial(struct usart_config_t *usart_device, gpio_pin_t tx_pin, gpio_pin_t rx_pin) : Usart(usart_device, tx_pin, rx_pin) {}
|
||||
MarlinSerial(
|
||||
struct usart_config_t *usart_device,
|
||||
gpio_pin_t tx_pin,
|
||||
gpio_pin_t rx_pin
|
||||
#if ENABLED(SERIAL_DMA)
|
||||
, M4_DMA_TypeDef *dma_unit = nullptr,
|
||||
en_dma_channel_t rx_dma_channel = DmaCh0
|
||||
#endif
|
||||
) : Usart(usart_device, tx_pin, rx_pin) {
|
||||
#if ENABLED(SERIAL_DMA)
|
||||
if (dma_unit != nullptr) {
|
||||
enableRxDma(dma_unit, rx_dma_channel);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef UART_IRQ_PRIO
|
||||
#if defined(UART_RX_IRQ_PRIO) || defined(UART_TX_IRQ_PRIO) || defined(UART_RX_DMA_IRQ_PRIO)
|
||||
void setPriority() {
|
||||
NVIC_SetPriority(c_dev()->interrupts.rx_data_available.interrupt_number, UART_IRQ_PRIO);
|
||||
NVIC_SetPriority(c_dev()->interrupts.rx_error.interrupt_number, UART_IRQ_PRIO);
|
||||
NVIC_SetPriority(c_dev()->interrupts.tx_buffer_empty.interrupt_number, UART_IRQ_PRIO);
|
||||
NVIC_SetPriority(c_dev()->interrupts.tx_complete.interrupt_number, UART_IRQ_PRIO);
|
||||
#if defined(UART_RX_IRQ_PRIO)
|
||||
NVIC_SetPriority(c_dev()->interrupts.rx_data_available.interrupt_number, UART_RX_IRQ_PRIO);
|
||||
NVIC_SetPriority(c_dev()->interrupts.rx_error.interrupt_number, UART_RX_IRQ_PRIO);
|
||||
#endif
|
||||
|
||||
#if defined(UART_TX_IRQ_PRIO)
|
||||
NVIC_SetPriority(c_dev()->interrupts.tx_buffer_empty.interrupt_number, UART_TX_IRQ_PRIO);
|
||||
NVIC_SetPriority(c_dev()->interrupts.tx_complete.interrupt_number, UART_TX_IRQ_PRIO);
|
||||
#endif
|
||||
|
||||
#if defined(UART_RX_DMA_IRQ_PRIO) && ENABLED(SERIAL_DMA)
|
||||
NVIC_SetPriority(c_dev()->dma.rx.rx_data_available_dma_btc.interrupt_number, UART_RX_DMA_IRQ_PRIO);
|
||||
#endif
|
||||
}
|
||||
|
||||
void begin(uint32_t baud) {
|
||||
@@ -47,7 +72,12 @@ struct MarlinSerial : public Usart {
|
||||
Usart::begin(baud, config);
|
||||
setPriority();
|
||||
}
|
||||
#endif
|
||||
|
||||
void begin(uint32_t baud, const stc_usart_uart_init_t *config, const bool rxNoiseFilter = true) {
|
||||
Usart::begin(baud, config, rxNoiseFilter);
|
||||
setPriority();
|
||||
}
|
||||
#endif // UART_RX_IRQ_PRIO || UART_TX_IRQ_PRIO || UART_RX_DMA_IRQ_PRIO
|
||||
};
|
||||
|
||||
typedef Serial1Class<MarlinSerial> MSerialT;
|
||||
|
||||
@@ -0,0 +1,70 @@
|
||||
/**
|
||||
* app_config.h is included by the hc32f460 arduino build script for every source file.
|
||||
* it is used to configure the arduino core (and ddl) automatically according
|
||||
* to the settings in Configuration.h and Configuration_adv.h.
|
||||
*/
|
||||
#pragma once
|
||||
#ifndef _HC32_APP_CONFIG_H_
|
||||
#define _HC32_APP_CONFIG_H_
|
||||
|
||||
#include "../../inc/MarlinConfigPre.h"
|
||||
|
||||
//
|
||||
// dev mode
|
||||
//
|
||||
#if ENABLED(MARLIN_DEV_MODE)
|
||||
#define __DEBUG 1
|
||||
#define __CORE_DEBUG 1
|
||||
#endif
|
||||
|
||||
//
|
||||
// Fault Handlers and Panic
|
||||
//
|
||||
|
||||
#if ENABLED(POSTMORTEM_DEBUGGING)
|
||||
// disable arduino core fault handler, as we define our own
|
||||
#define CORE_DISABLE_FAULT_HANDLER 1
|
||||
#endif
|
||||
|
||||
// force-enable panic handler so that we can use our custom one (in MinSerial)
|
||||
#define PANIC_ENABLE 1
|
||||
|
||||
// use short filenames in ddl debug and core panic output
|
||||
#define __DEBUG_SHORT_FILENAMES 1
|
||||
#define __PANIC_SHORT_FILENAMES 1
|
||||
|
||||
// omit panic messages in core panic output
|
||||
#define __OMIT_PANIC_MESSAGE 1
|
||||
|
||||
//
|
||||
// Usart
|
||||
//
|
||||
|
||||
// disable serial globals (Serial1, Serial2, ...), as we define our own
|
||||
#define DISABLE_SERIAL_GLOBALS 1
|
||||
|
||||
// increase the size of the Usart buffers (both RX and TX)
|
||||
// NOTE:
|
||||
// the heap usage will increase by (SERIAL_BUFFER_SIZE - 64) * "number of serial ports used"
|
||||
// if running out of heap, the system may become unstable
|
||||
//#define SERIAL_BUFFER_SIZE 256
|
||||
|
||||
// enable support for Usart Clock Divider / Oversampling auto config
|
||||
#define USART_AUTO_CLKDIV_OS_CONFIG 1
|
||||
|
||||
// enable USART_RX_DMA_SUPPORT core option when SERIAL_DMA is enabled
|
||||
#if ENABLED(SERIAL_DMA)
|
||||
#define USART_RX_DMA_SUPPORT 1
|
||||
#endif
|
||||
|
||||
//
|
||||
// Misc.
|
||||
//
|
||||
|
||||
// redirect printf to host serial
|
||||
#define REDIRECT_PRINTF_TO_SERIAL 1
|
||||
|
||||
// FIXME override F_CPU to PCLK1, as marlin freaks out otherwise
|
||||
#define F_CPU (SYSTEM_CLOCK_FREQUENCIES.pclk1)
|
||||
|
||||
#endif // _HC32_APP_CONFIG_H_
|
||||
@@ -20,6 +20,20 @@
|
||||
*
|
||||
*/
|
||||
#pragma once
|
||||
#include <core_util.h>
|
||||
|
||||
#if !defined(ARDUINO_CORE_VERSION_INT) || !defined(GET_VERSION_INT)
|
||||
// version macros were introduced in arduino core version 1.1.0
|
||||
// below that version, we polyfill them
|
||||
#define GET_VERSION_INT(major, minor, patch) ((major * 100000) + (minor * 1000) + patch)
|
||||
#define ARDUINO_CORE_VERSION_INT GET_VERSION_INT(1, 0, 0)
|
||||
#endif
|
||||
|
||||
#if ARDUINO_CORE_VERSION_INT < GET_VERSION_INT(1, 1, 0)
|
||||
// because we use app_config.h introduced in arduino core version 1.1.0, the
|
||||
// HAL is not compatible with older versions
|
||||
#error "The HC32 HAL is not compatible with Arduino Core versions < 1.1.0. Consider updating the Arduino Core."
|
||||
#endif
|
||||
|
||||
#ifndef BOARD_XTAL_FREQUENCY
|
||||
#error "BOARD_XTAL_FREQUENCY is required for HC32F460."
|
||||
@@ -74,3 +88,18 @@
|
||||
#error "HC32 HAL uses a custom panic handler. Do not define PANIC_USARTx_TX_PIN."
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if ENABLED(SERIAL_DMA)
|
||||
#if !defined(USART_RX_DMA_SUPPORT)
|
||||
#error "SERIAL_DMA requires USART_RX_DMA_SUPPORT to be enabled in the arduino core."
|
||||
#endif
|
||||
|
||||
// USART_RX_DMA_SUPPORT does not implement core_hook_usart_rx_irq, which is required for the emergency parser
|
||||
#if ENABLED(EMERGENCY_PARSER)
|
||||
#error "EMERGENCY_PARSER is not supported with SERIAL_DMA. Please disable either SERIAL_DMA or EMERGENCY_PARSER."
|
||||
#endif
|
||||
|
||||
#if ARDUINO_CORE_VERSION_INT < GET_VERSION_INT(1, 1, 0)
|
||||
#error "SERIAL_DMA is not supported with arduino core version < 1.1.0."
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@@ -54,7 +54,7 @@
|
||||
fn \
|
||||
}
|
||||
|
||||
stc_sd_handle_t *handle;
|
||||
stc_sd_handle_t *handle = nullptr;
|
||||
|
||||
bool SDIO_Init() {
|
||||
// Configure SDIO pins
|
||||
@@ -66,36 +66,45 @@ bool SDIO_Init() {
|
||||
GPIO_SetFunc(BOARD_SDIO_CMD, Func_Sdio);
|
||||
GPIO_SetFunc(BOARD_SDIO_DET, Func_Sdio);
|
||||
|
||||
// If a handle is already initialized, free it before creating a new one
|
||||
// otherwise, we will leak memory, which will eventually crash the system
|
||||
if (handle != nullptr) {
|
||||
delete handle->pstcDmaInitCfg;
|
||||
delete handle->pstcCardInitCfg;
|
||||
delete handle;
|
||||
handle = nullptr;
|
||||
}
|
||||
|
||||
// Create DMA configuration
|
||||
stc_sdcard_dma_init_t *dmaConf = new stc_sdcard_dma_init_t;
|
||||
dmaConf->DMAx = SDIO_DMA_PERIPHERAL;
|
||||
dmaConf->enDmaCh = SDIO_DMA_CHANNEL;
|
||||
|
||||
// Create card configuration
|
||||
// This should be a fairly safe configuration for most cards
|
||||
stc_sdcard_init_t *cardConf = new stc_sdcard_init_t;
|
||||
cardConf->enBusWidth = SdiocBusWidth4Bit;
|
||||
cardConf->enClkFreq = SdiocClk400K;
|
||||
cardConf->enSpeedMode = SdiocNormalSpeedMode;
|
||||
cardConf->pstcInitCfg = nullptr;
|
||||
|
||||
// Create handle in DMA mode
|
||||
handle = new stc_sd_handle_t;
|
||||
handle->SDIOCx = SDIO_PERIPHERAL;
|
||||
handle->enDevMode = SdCardDmaMode;
|
||||
handle->pstcDmaInitCfg = dmaConf;
|
||||
|
||||
// Create card configuration
|
||||
// This should be a fairly safe configuration for most cards
|
||||
stc_sdcard_init_t cardConf = {
|
||||
.enBusWidth = SdiocBusWidth4Bit,
|
||||
.enClkFreq = SdiocClk400K,
|
||||
.enSpeedMode = SdiocNormalSpeedMode,
|
||||
//.pstcInitCfg = NULL,
|
||||
};
|
||||
//handle->pstcCardInitCfg = cardConf; // assigned in SDCARD_Init
|
||||
|
||||
// Initialize sd card
|
||||
en_result_t rc = SDCARD_Init(handle, &cardConf);
|
||||
en_result_t rc = SDCARD_Init(handle, cardConf);
|
||||
if (rc != Ok) printf("SDIO_Init() error (rc=%u)\n", rc);
|
||||
|
||||
return rc == Ok;
|
||||
}
|
||||
|
||||
bool SDIO_ReadBlock(uint32_t block, uint8_t *dst) {
|
||||
CORE_ASSERT(handle != NULL, "SDIO not initialized");
|
||||
CORE_ASSERT(dst != NULL, "SDIO_ReadBlock dst is NULL");
|
||||
CORE_ASSERT(handle != nullptr, "SDIO not initialized", return false);
|
||||
CORE_ASSERT(dst != nullptr, "SDIO_ReadBlock dst is NULL", return false);
|
||||
|
||||
WITH_RETRY(SDIO_READ_RETRIES, {
|
||||
en_result_t rc = SDCARD_ReadBlocks(handle, block, 1, dst, SDIO_READ_TIMEOUT);
|
||||
@@ -107,8 +116,8 @@ bool SDIO_ReadBlock(uint32_t block, uint8_t *dst) {
|
||||
}
|
||||
|
||||
bool SDIO_WriteBlock(uint32_t block, const uint8_t *src) {
|
||||
CORE_ASSERT(handle != NULL, "SDIO not initialized");
|
||||
CORE_ASSERT(src != NULL, "SDIO_WriteBlock src is NULL");
|
||||
CORE_ASSERT(handle != nullptr, "SDIO not initialized", return false);
|
||||
CORE_ASSERT(src != nullptr, "SDIO_WriteBlock src is NULL", return false);
|
||||
|
||||
WITH_RETRY(SDIO_WRITE_RETRIES, {
|
||||
en_result_t rc = SDCARD_WriteBlocks(handle, block, 1, (uint8_t *)src, SDIO_WRITE_TIMEOUT);
|
||||
@@ -120,12 +129,12 @@ bool SDIO_WriteBlock(uint32_t block, const uint8_t *src) {
|
||||
}
|
||||
|
||||
bool SDIO_IsReady() {
|
||||
CORE_ASSERT(handle != NULL, "SDIO not initialized");
|
||||
CORE_ASSERT(handle != nullptr, "SDIO not initialized", return false);
|
||||
return bool(handle->stcCardStatus.READY_FOR_DATA);
|
||||
}
|
||||
|
||||
uint32_t SDIO_GetCardSize() {
|
||||
CORE_ASSERT(handle != NULL, "SDIO not initialized");
|
||||
CORE_ASSERT(handle != nullptr, "SDIO not initialized", return 0);
|
||||
|
||||
// Multiply number of blocks with block size to get size in bytes
|
||||
const uint64_t cardSizeBytes = uint64_t(handle->stcSdCardInfo.u32LogBlockNbr) * uint64_t(handle->stcSdCardInfo.u32LogBlockSize);
|
||||
|
||||
@@ -37,7 +37,10 @@ Timer::Timer() {
|
||||
}
|
||||
|
||||
Timer::~Timer() {
|
||||
timer_delete(timerid);
|
||||
if (timerid != 0) {
|
||||
timer_delete(timerid);
|
||||
timerid = 0;
|
||||
}
|
||||
}
|
||||
|
||||
void Timer::init(uint32_t sig_id, uint32_t sim_freq, callback_fn* fn) {
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
*/
|
||||
|
||||
#ifdef __PLAT_LINUX__
|
||||
#ifndef UNIT_TEST
|
||||
|
||||
//#define GPIO_LOGGING // Full GPIO and Positional Logging
|
||||
|
||||
@@ -135,4 +136,5 @@ int main() {
|
||||
read_serial.join();
|
||||
}
|
||||
|
||||
#endif // UNIT_TEST
|
||||
#endif // __PLAT_LINUX__
|
||||
|
||||
@@ -100,7 +100,7 @@ extern DefaultSerial1 USBSerial;
|
||||
#else
|
||||
#error "LCD_SERIAL_PORT must be from 0 to 3. You can also use -1 if the board supports Native USB."
|
||||
#endif
|
||||
#if HAS_DGUS_LCD
|
||||
#if HAS_DGUS_LCD || ENABLED(DWINOS_4)
|
||||
#define LCD_SERIAL_TX_BUFFER_FREE() LCD_SERIAL.available()
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@@ -112,7 +112,7 @@
|
||||
#else
|
||||
#error "LCD_SERIAL_PORT must be from 1 to 9, or -1 for Native USB."
|
||||
#endif
|
||||
#if HAS_DGUS_LCD
|
||||
#if HAS_DGUS_LCD || ENABLED(DGUS_LCD_UI_CREALITY_TOUCH) || ENABLED(EXTENSIBLE_UI)
|
||||
#define LCD_SERIAL_TX_BUFFER_FREE() LCD_SERIAL.availableForWrite()
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@@ -43,6 +43,7 @@
|
||||
|
||||
#else // Arduino non-DMA
|
||||
|
||||
FORCE_INLINE static uint8_t buffer_overruns() { return 0; }
|
||||
typedef void (*usart_rx_callback_t)(serial_t * obj);
|
||||
|
||||
struct MarlinSerial : public HardwareSerial {
|
||||
@@ -53,6 +54,8 @@
|
||||
inline void begin(unsigned long baud) { begin(baud, SERIAL_8N1); }
|
||||
|
||||
void _rx_complete_irq(serial_t *obj);
|
||||
FORCE_INLINE static uint8_t buffer_overruns() { return 0; } // Not implemented. Void to avoid platform-dependent code.
|
||||
FORCE_INLINE uint32_t dropped() { return 0; }
|
||||
|
||||
protected:
|
||||
usart_rx_callback_t _rx_callback;
|
||||
|
||||
@@ -138,7 +138,7 @@
|
||||
#define LCD_SERIAL MSERIAL(1) // dummy port
|
||||
static_assert(false, "LCD_SERIAL_PORT must be from 1 to " STRINGIFY(NUM_UARTS) ". You can also use -1 if the board supports Native USB.")
|
||||
#endif
|
||||
#if HAS_DGUS_LCD
|
||||
#if HAS_DGUS_LCD || ENABLED(DGUS_LCD_UI_CREALITY_TOUCH) || ENABLED(DWINOS_4)
|
||||
#define LCD_SERIAL_TX_BUFFER_FREE() LCD_SERIAL.availableForWrite()
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@@ -474,11 +474,16 @@ inline void manage_inactivity(const bool no_stepper_sleep=false) {
|
||||
|
||||
#if HAS_KILL
|
||||
|
||||
// Check if the kill button was pressed and wait just in case it was an accidental
|
||||
// key kill key press
|
||||
// Check if the kill button was pressed and wait to ensure the signal is not noise
|
||||
// typically caused by poor insulation and grounding on LCD cables.
|
||||
// Lower numbers here will increase response time and therefore safety rating.
|
||||
// It is recommended to set this as low as possibe without false triggers.
|
||||
// -------------------------------------------------------------------------------
|
||||
#ifndef KILL_DELAY
|
||||
#define KILL_DELAY 250
|
||||
#endif
|
||||
|
||||
static int killCount = 0; // make the inactivity button a bit less responsive
|
||||
const int KILL_DELAY = 750;
|
||||
if (kill_state())
|
||||
killCount++;
|
||||
else if (killCount > 0)
|
||||
|
||||
@@ -131,6 +131,7 @@
|
||||
#define BOARD_PXMALION_CORE_I3 1164 // Pxmalion Core I3
|
||||
#define BOARD_PANOWIN_CUTLASS 1165 // Panowin Cutlass (as found in the Panowin F1)
|
||||
#define BOARD_KODAMA_BARDO 1166 // Kodama Bardo V1.x (as found in the Kodama Trinus)
|
||||
#define BOARD_DAGOMA_D6 1167 // Dagoma D6 (as found in the Dagoma DiscoUltimate V2 TMC)
|
||||
|
||||
//
|
||||
// RAMBo and derivatives
|
||||
|
||||
@@ -197,7 +197,7 @@ void HostUI::action(FSTR_P const fstr, const bool eol) {
|
||||
#endif
|
||||
#if HAS_FILAMENT_SENSOR
|
||||
if (runout.filament_ran_out) { // Disable a triggered sensor
|
||||
runout.enabled = false;
|
||||
runout.enabled[active_extruder] = false;
|
||||
runout.reset();
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -135,7 +135,7 @@ void MMU2::reset() {
|
||||
int8_t MMU2::get_current_tool() { return extruder == MMU2_NO_TOOL ? -1 : extruder; }
|
||||
|
||||
#if ANY(HAS_PRUSA_MMU2S, MMU_EXTRUDER_SENSOR)
|
||||
#define FILAMENT_PRESENT() (READ(FIL_RUNOUT1_PIN) != FIL_RUNOUT1_STATE)
|
||||
#define FILAMENT_PRESENT() (READ(FIL_RUNOUT1_PIN) != runout.out_state())
|
||||
#else
|
||||
#define FILAMENT_PRESENT() true
|
||||
#endif
|
||||
|
||||
@@ -214,12 +214,21 @@ bool load_filament(const_float_t slow_load_length/*=0*/, const_float_t fast_load
|
||||
impatient_beep(max_beep_count);
|
||||
#if ALL(FILAMENT_CHANGE_RESUME_ON_INSERT, FILAMENT_RUNOUT_SENSOR)
|
||||
#if MULTI_FILAMENT_SENSOR
|
||||
#define _CASE_INSERTED(N) case N-1: if (READ(FIL_RUNOUT##N##_PIN) != FIL_RUNOUT##N##_STATE) wait_for_user = false; break;
|
||||
switch (active_extruder) {
|
||||
REPEAT_1(NUM_RUNOUT_SENSORS, _CASE_INSERTED)
|
||||
LOOP_S_LE_N(i, 1, NUM_RUNOUT_SENSORS) {
|
||||
pin_t pin;
|
||||
switch (i) {
|
||||
default: continue;
|
||||
#define _CASE_RUNOUT(N) case N: pin = FIL_RUNOUT##N##_PIN; break;
|
||||
REPEAT_1(NUM_RUNOUT_SENSORS, _CASE_RUNOUT)
|
||||
#undef _CASE_RUNOUT
|
||||
}
|
||||
const RunoutMode rm = runout.mode[i - 1];
|
||||
if (rm != RM_NONE && rm != RM_MOTION_SENSOR && extDigitalRead(pin) != runout.out_state(i - 1))
|
||||
wait_for_user = false;
|
||||
}
|
||||
#else
|
||||
if (READ(FIL_RUNOUT_PIN) != FIL_RUNOUT_STATE) wait_for_user = false;
|
||||
if (READ(FIL_RUNOUT_PIN) != runout.out_state(active_extruder))
|
||||
wait_for_user = false;
|
||||
#endif
|
||||
#endif
|
||||
idle_no_sleep();
|
||||
@@ -680,7 +689,7 @@ void resume_print(const_float_t slow_load_length/*=0*/, const_float_t fast_load_
|
||||
#endif
|
||||
|
||||
// If resume_position is negative
|
||||
if (resume_position.e < 0) unscaled_e_move(resume_position.e, feedRate_t(PAUSE_PARK_RETRACT_FEEDRATE));
|
||||
//if (resume_position.e < 0) unscaled_e_move(resume_position.e, feedRate_t(PAUSE_PARK_RETRACT_FEEDRATE));
|
||||
#ifdef ADVANCED_PAUSE_RESUME_PRIME
|
||||
if (ADVANCED_PAUSE_RESUME_PRIME != 0)
|
||||
unscaled_e_move(ADVANCED_PAUSE_RESUME_PRIME, feedRate_t(ADVANCED_PAUSE_PURGE_FEEDRATE));
|
||||
@@ -689,7 +698,7 @@ void resume_print(const_float_t slow_load_length/*=0*/, const_float_t fast_load_
|
||||
// Now all extrusion positions are resumed and ready to be confirmed
|
||||
// Set extruder to saved position
|
||||
planner.set_e_position_mm((destination.e = current_position.e = resume_position.e));
|
||||
|
||||
sync_plan_position_e();
|
||||
ui.pause_show_message(PAUSE_MESSAGE_STATUS);
|
||||
|
||||
#ifdef ACTION_ON_RESUMED
|
||||
|
||||
@@ -57,9 +57,7 @@ enum PauseMessage : char {
|
||||
};
|
||||
|
||||
#if M600_PURGE_MORE_RESUMABLE
|
||||
/**
|
||||
* Input methods can Purge More, Resume, or request input
|
||||
*/
|
||||
// Input methods can Purge More, Resume, or request input
|
||||
enum PauseMenuResponse : char {
|
||||
PAUSE_RESPONSE_WAIT_FOR,
|
||||
PAUSE_RESPONSE_EXTRUDE_MORE,
|
||||
@@ -109,7 +107,7 @@ void wait_for_confirmation(
|
||||
void resume_print(
|
||||
const_float_t slow_load_length=0, // (mm) Slow Load Length for finishing move
|
||||
const_float_t fast_load_length=0, // (mm) Fast Load Length for initial move
|
||||
const_float_t extrude_length=ADVANCED_PAUSE_PURGE_LENGTH, // (mm) Purge length
|
||||
const_float_t purge_length=ADVANCED_PAUSE_PURGE_LENGTH, // (mm) Purge length
|
||||
const int8_t max_beep_count=0, // Beep alert for attention
|
||||
const celsius_t targetTemp=0 // (°C) A target temperature for the hotend
|
||||
DXC_PARAMS // Dual-X-Carriage extruder index
|
||||
@@ -118,7 +116,7 @@ void resume_print(
|
||||
bool load_filament(
|
||||
const_float_t slow_load_length=0, // (mm) Slow Load Length for finishing move
|
||||
const_float_t fast_load_length=0, // (mm) Fast Load Length for initial move
|
||||
const_float_t extrude_length=0, // (mm) Purge length
|
||||
const_float_t purge_length=0, // (mm) Purge length
|
||||
const int8_t max_beep_count=0, // Beep alert for attention
|
||||
const bool show_lcd=false, // Set LCD status messages?
|
||||
const bool pause_for_user=false, // Pause for user before returning?
|
||||
|
||||
@@ -122,6 +122,7 @@ void Power::power_off() {
|
||||
TERN_(HAS_SUICIDE, suicide());
|
||||
|
||||
if (!psu_on) return;
|
||||
SERIAL_ECHOLNPGM(STR_POWEROFF);
|
||||
|
||||
SERIAL_ECHOLNPGM(STR_POWEROFF);
|
||||
|
||||
|
||||
@@ -32,9 +32,9 @@
|
||||
|
||||
FilamentMonitor runout;
|
||||
|
||||
bool FilamentMonitorBase::enabled = true,
|
||||
FilamentMonitorBase::filament_ran_out; // = false
|
||||
|
||||
bool FilamentMonitorBase::enabled[NUM_RUNOUT_SENSORS], // Initialized by settings.load
|
||||
FilamentMonitorBase::filament_ran_out; // = false
|
||||
RunoutMode FilamentMonitorBase::mode[NUM_RUNOUT_SENSORS]; // Initialized by settings.load
|
||||
#if ENABLED(HOST_ACTION_COMMANDS)
|
||||
bool FilamentMonitorBase::host_handling; // = false
|
||||
#endif
|
||||
@@ -45,15 +45,10 @@ bool FilamentMonitorBase::enabled = true,
|
||||
#include "../core/debug_out.h"
|
||||
#endif
|
||||
|
||||
#if HAS_FILAMENT_RUNOUT_DISTANCE
|
||||
float RunoutResponseDelayed::runout_distance_mm = FILAMENT_RUNOUT_DISTANCE_MM;
|
||||
countdown_t RunoutResponseDelayed::mm_countdown;
|
||||
#if ENABLED(FILAMENT_MOTION_SENSOR)
|
||||
uint8_t FilamentSensorEncoder::motion_detected;
|
||||
#endif
|
||||
#else
|
||||
int8_t RunoutResponseDebounced::runout_count[NUM_RUNOUT_SENSORS]; // = 0
|
||||
#endif
|
||||
float RunoutResponseDelayed::runout_distance_mm[NUM_RUNOUT_SENSORS]; // Initialized by settings.load
|
||||
countdown_t RunoutResponseDelayed::mm_countdown;
|
||||
uint8_t FilamentSensorCore::motion_detected;
|
||||
int8_t RunoutResponseDelayed::runout_count[NUM_RUNOUT_SENSORS]; // = 0
|
||||
|
||||
//
|
||||
// Filament Runout event handler
|
||||
|
||||
+107
-223
@@ -44,12 +44,6 @@
|
||||
#define FILAMENT_RUNOUT_THRESHOLD 5
|
||||
#endif
|
||||
|
||||
#if ENABLED(FILAMENT_MOTION_SENSOR)
|
||||
#define HAS_FILAMENT_MOTION 1
|
||||
#endif
|
||||
#if DISABLED(FILAMENT_MOTION_SENSOR) || ENABLED(FILAMENT_SWITCH_AND_MOTION)
|
||||
#define HAS_FILAMENT_SWITCH 1
|
||||
#endif
|
||||
|
||||
typedef Flags<
|
||||
#if NUM_MOTION_SENSORS > NUM_RUNOUT_SENSORS
|
||||
@@ -64,24 +58,37 @@ inline bool should_monitor_runout() { return did_pause_print || printingIsActive
|
||||
|
||||
template<class RESPONSE_T, class SENSOR_T>
|
||||
class TFilamentMonitor;
|
||||
class FilamentSensor;
|
||||
class FilamentSensorCore;
|
||||
class RunoutResponseDelayed;
|
||||
class RunoutResponseDebounced;
|
||||
|
||||
/********************************* TEMPLATE SPECIALIZATION *********************************/
|
||||
|
||||
typedef TFilamentMonitor<
|
||||
TERN(HAS_FILAMENT_RUNOUT_DISTANCE, RunoutResponseDelayed, RunoutResponseDebounced),
|
||||
FilamentSensor
|
||||
RunoutResponseDelayed,
|
||||
FilamentSensorCore
|
||||
> FilamentMonitor;
|
||||
|
||||
extern FilamentMonitor runout;
|
||||
|
||||
/*******************************************************************************************/
|
||||
|
||||
enum RunoutMode : uint8_t {
|
||||
RM_NONE,
|
||||
RM_OUT_ON_LOW,
|
||||
RM_OUT_ON_HIGH,
|
||||
RM_RESERVED3,
|
||||
RM_RESERVED4,
|
||||
RM_RESERVED5,
|
||||
RM_RESERVED6,
|
||||
RM_MOTION_SENSOR
|
||||
};
|
||||
|
||||
class FilamentMonitorBase {
|
||||
public:
|
||||
static bool enabled, filament_ran_out;
|
||||
static bool enabled[NUM_RUNOUT_SENSORS], filament_ran_out;
|
||||
static RunoutMode mode[NUM_RUNOUT_SENSORS];
|
||||
|
||||
static uint8_t out_state(const uint8_t e=0) { return mode[e] == RM_OUT_ON_HIGH ? HIGH : LOW; }
|
||||
|
||||
#if ENABLED(HOST_ACTION_COMMANDS)
|
||||
static bool host_handling;
|
||||
@@ -111,24 +118,14 @@ class TFilamentMonitor : public FilamentMonitorBase {
|
||||
|
||||
// Call this method when filament is present,
|
||||
// so the response can reset its counter.
|
||||
static void filament_present(const uint8_t extruder) {
|
||||
response.filament_present(extruder);
|
||||
}
|
||||
#if ENABLED(FILAMENT_SWITCH_AND_MOTION)
|
||||
static void filament_motion_present(const uint8_t extruder) {
|
||||
response.filament_motion_present(extruder);
|
||||
}
|
||||
#endif
|
||||
|
||||
#if HAS_FILAMENT_RUNOUT_DISTANCE
|
||||
static float& runout_distance() { return response.runout_distance_mm; }
|
||||
static void set_runout_distance(const_float_t mm) { response.runout_distance_mm = mm; }
|
||||
#endif
|
||||
static void filament_present(const uint8_t e) { response.filament_present(e); }
|
||||
static float& runout_distance(const uint8_t e=0) { return response.runout_distance_mm[e]; }
|
||||
static void set_runout_distance(const_float_t mm, const uint8_t e=0) { response.runout_distance_mm[e] = mm; }
|
||||
|
||||
// Handle a block completion. RunoutResponseDelayed uses this to
|
||||
// add up the length of filament moved while the filament is out.
|
||||
static void block_completed(const block_t * const b) {
|
||||
if (enabled) {
|
||||
if (enabled[active_extruder]) {
|
||||
response.block_completed(b);
|
||||
sensor.block_completed(b);
|
||||
}
|
||||
@@ -137,11 +134,11 @@ class TFilamentMonitor : public FilamentMonitorBase {
|
||||
// Give the response a chance to update its counter.
|
||||
static void run() {
|
||||
if (enabled && !filament_ran_out && should_monitor_runout()) {
|
||||
TERN_(HAS_FILAMENT_RUNOUT_DISTANCE, cli()); // Prevent RunoutResponseDelayed::block_completed from accumulating here
|
||||
cli(); // Prevent RunoutResponseDelayed::block_completed from accumulating here
|
||||
response.run();
|
||||
sensor.run();
|
||||
const runout_flags_t runout_flags = response.has_run_out();
|
||||
TERN_(HAS_FILAMENT_RUNOUT_DISTANCE, sei());
|
||||
sei();
|
||||
#if MULTI_FILAMENT_SENSOR
|
||||
#if ENABLED(WATCH_ALL_RUNOUT_SENSORS)
|
||||
const bool ran_out = bool(runout_flags); // any sensor triggers
|
||||
@@ -182,27 +179,40 @@ class FilamentSensorBase {
|
||||
static void filament_present(const uint8_t extruder) {
|
||||
runout.filament_present(extruder); // ...which calls response.filament_present(extruder)
|
||||
}
|
||||
#if ENABLED(FILAMENT_SWITCH_AND_MOTION)
|
||||
static void filament_motion_present(const uint8_t extruder) {
|
||||
runout.filament_motion_present(extruder); // ...which calls response.filament_motion_present(extruder)
|
||||
}
|
||||
#endif
|
||||
|
||||
public:
|
||||
static void setup() {
|
||||
#define _INIT_RUNOUT_PIN(P,S,U,D) do{ if (ENABLED(U)) SET_INPUT_PULLUP(P); else if (ENABLED(D)) SET_INPUT_PULLDOWN(P); else SET_INPUT(P); }while(0);
|
||||
#define INIT_RUNOUT_PIN(N) _INIT_RUNOUT_PIN(FIL_RUNOUT##N##_PIN, FIL_RUNOUT##N##_STATE, FIL_RUNOUT##N##_PULLUP, FIL_RUNOUT##N##_PULLDOWN);
|
||||
REPEAT_1(NUM_RUNOUT_SENSORS, INIT_RUNOUT_PIN)
|
||||
#undef INIT_RUNOUT_PIN
|
||||
|
||||
#if ENABLED(FILAMENT_SWITCH_AND_MOTION)
|
||||
#define INIT_MOTION_PIN(N) _INIT_RUNOUT_PIN(FIL_MOTION##N##_PIN, FIL_MOTION##N##_STATE, FIL_MOTION##N##_PULLUP, FIL_MOTION##N##_PULLDOWN);
|
||||
REPEAT_1(NUM_MOTION_SENSORS, INIT_MOTION_PIN)
|
||||
#undef INIT_MOTION_PIN
|
||||
#define _INIT_RUNOUT_PIN(P,S,U,D) do{ if (ENABLED(U)) SET_INPUT_PULLUP(P); else if (ENABLED(D)) SET_INPUT_PULLDOWN(P); else SET_INPUT(P); }while(0)
|
||||
#define INIT_RUNOUT_PIN(N) _INIT_RUNOUT_PIN(FIL_RUNOUT##N##_PIN, FIL_RUNOUT##N##_STATE, FIL_RUNOUT##N##_PULLUP, FIL_RUNOUT##N##_PULLDOWN)
|
||||
#if NUM_RUNOUT_SENSORS >= 1
|
||||
INIT_RUNOUT_PIN(1);
|
||||
#endif
|
||||
#if NUM_RUNOUT_SENSORS >= 2
|
||||
INIT_RUNOUT_PIN(2);
|
||||
#endif
|
||||
#if NUM_RUNOUT_SENSORS >= 3
|
||||
INIT_RUNOUT_PIN(3);
|
||||
#endif
|
||||
#if NUM_RUNOUT_SENSORS >= 4
|
||||
INIT_RUNOUT_PIN(4);
|
||||
#endif
|
||||
#if NUM_RUNOUT_SENSORS >= 5
|
||||
INIT_RUNOUT_PIN(5);
|
||||
#endif
|
||||
#if NUM_RUNOUT_SENSORS >= 6
|
||||
INIT_RUNOUT_PIN(6);
|
||||
#endif
|
||||
#if NUM_RUNOUT_SENSORS >= 7
|
||||
INIT_RUNOUT_PIN(7);
|
||||
#endif
|
||||
#if NUM_RUNOUT_SENSORS >= 8
|
||||
INIT_RUNOUT_PIN(8);
|
||||
#endif
|
||||
#undef _INIT_RUNOUT_PIN
|
||||
#undef INIT_RUNOUT_PIN
|
||||
}
|
||||
|
||||
|
||||
// Return a bitmask of runout pin states
|
||||
static uint8_t poll_runout_pins() {
|
||||
#define _OR_RUNOUT(N) | (READ(FIL_RUNOUT##N##_PIN) ? _BV((N) - 1) : 0)
|
||||
@@ -212,7 +222,7 @@ class FilamentSensorBase {
|
||||
|
||||
// Return a bitmask of runout flag states (1 bits always indicates runout)
|
||||
static uint8_t poll_runout_states() {
|
||||
#define _INVERT_BIT(N) | (FIL_RUNOUT##N##_STATE ? 0 : _BV(N - 1))
|
||||
#define _INVERT_BIT(N) | (runout.out_state(N-1) ? 0 : _BV(N-1))
|
||||
return poll_runout_pins() ^ uint8_t(0 REPEAT_1(NUM_RUNOUT_SENSORS, _INVERT_BIT));
|
||||
#undef _INVERT_BIT
|
||||
}
|
||||
@@ -234,17 +244,21 @@ class FilamentSensorBase {
|
||||
#endif
|
||||
};
|
||||
|
||||
#if HAS_FILAMENT_MOTION
|
||||
class FilamentSensorCore : public FilamentSensorBase {
|
||||
private:
|
||||
static uint8_t motion_detected;
|
||||
|
||||
/**
|
||||
* This sensor uses a magnetic encoder disc and a Hall effect
|
||||
* sensor (or a slotted disc and optical sensor). The state
|
||||
* will toggle between 0 and 1 on filament movement. It can detect
|
||||
* filament runout and stripouts or jams.
|
||||
*/
|
||||
class FilamentSensorEncoder : public FilamentSensorBase {
|
||||
private:
|
||||
static uint8_t motion_detected;
|
||||
static bool poll_runout_state(const uint8_t extruder) {
|
||||
const uint8_t runout_states = poll_runout_states();
|
||||
#if MULTI_FILAMENT_SENSOR
|
||||
if ( !TERN0(DUAL_X_CARRIAGE, idex_is_duplicating())
|
||||
&& !TERN0(MULTI_NOZZLE_DUPLICATION, extruder_duplication_enabled)
|
||||
) return TEST(runout_states, extruder); // A specific extruder ran out
|
||||
#else
|
||||
UNUSED(extruder);
|
||||
#endif
|
||||
return !!runout_states; // Any extruder ran out
|
||||
}
|
||||
|
||||
static void poll_motion_sensor() {
|
||||
static uint8_t old_state;
|
||||
@@ -252,17 +266,17 @@ class FilamentSensorBase {
|
||||
change = old_state ^ new_state;
|
||||
old_state = new_state;
|
||||
|
||||
#if ENABLED(FILAMENT_RUNOUT_SENSOR_DEBUG)
|
||||
if (change) {
|
||||
SERIAL_ECHOPGM("Motion detected:");
|
||||
for (uint8_t e = 0; e < TERN(FILAMENT_SWITCH_AND_MOTION, NUM_MOTION_SENSORS, NUM_RUNOUT_SENSORS); ++e)
|
||||
if (TEST(change, e)) SERIAL_CHAR(' ', '0' + e);
|
||||
SERIAL_EOL();
|
||||
}
|
||||
#endif
|
||||
#if ENABLED(FILAMENT_RUNOUT_SENSOR_DEBUG)
|
||||
if (change) {
|
||||
SERIAL_ECHOPGM("Motion detected:");
|
||||
for(uint8_t e = 0; e < NUM_RUNOUT_SENSORS; ++e)
|
||||
if (TEST(change, e)) SERIAL_CHAR(' ', '0' + e);
|
||||
SERIAL_EOL();
|
||||
}
|
||||
#endif
|
||||
|
||||
motion_detected |= change;
|
||||
}
|
||||
motion_detected |= change;
|
||||
}
|
||||
|
||||
public:
|
||||
static void block_completed(const block_t * const b) {
|
||||
@@ -275,36 +289,12 @@ class FilamentSensorBase {
|
||||
motion_detected = 0;
|
||||
}
|
||||
|
||||
static void run() { poll_motion_sensor(); }
|
||||
};
|
||||
|
||||
#endif // HAS_FILAMENT_MOTION
|
||||
|
||||
#if HAS_FILAMENT_SWITCH
|
||||
|
||||
/**
|
||||
* This is a simple endstop switch in the path of the filament.
|
||||
* It can detect filament runout, but not stripouts or jams.
|
||||
*/
|
||||
class FilamentSensorSwitch : public FilamentSensorBase {
|
||||
private:
|
||||
static bool poll_runout_state(const uint8_t extruder) {
|
||||
const uint8_t runout_states = poll_runout_states();
|
||||
#if MULTI_FILAMENT_SENSOR
|
||||
if ( !TERN0(DUAL_X_CARRIAGE, idex_is_duplicating())
|
||||
&& !TERN0(MULTI_NOZZLE_DUPLICATION, extruder_duplication_enabled)
|
||||
) return TEST(runout_states, extruder); // A specific extruder ran out
|
||||
#else
|
||||
UNUSED(extruder);
|
||||
#endif
|
||||
return !!runout_states; // Any extruder ran out
|
||||
static void run() {
|
||||
if (runout.mode[active_extruder] == RM_MOTION_SENSOR) {
|
||||
poll_motion_sensor();
|
||||
}
|
||||
|
||||
public:
|
||||
static void block_completed(const block_t * const) {}
|
||||
|
||||
static void run() {
|
||||
for (uint8_t s = 0; s < NUM_RUNOUT_SENSORS; ++s) {
|
||||
else if (runout.mode[active_extruder] != RM_NONE) {
|
||||
for(uint8_t s = 0; s < NUM_RUNOUT_SENSORS; ++s) {
|
||||
const bool out = poll_runout_state(s);
|
||||
if (!out) filament_present(s);
|
||||
#if ENABLED(FILAMENT_RUNOUT_SENSOR_DEBUG)
|
||||
@@ -316,36 +306,12 @@ class FilamentSensorBase {
|
||||
#endif
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
#endif // HAS_FILAMENT_SWITCH
|
||||
|
||||
/**
|
||||
* This is a simple endstop switch in the path of the filament.
|
||||
* It can detect filament runout, but not stripouts or jams.
|
||||
*/
|
||||
class FilamentSensor : public FilamentSensorBase {
|
||||
private:
|
||||
TERN_(HAS_FILAMENT_MOTION, static FilamentSensorEncoder encoder_sensor);
|
||||
TERN_(HAS_FILAMENT_SWITCH, static FilamentSensorSwitch switch_sensor);
|
||||
|
||||
public:
|
||||
static void block_completed(const block_t * const b) {
|
||||
TERN_(HAS_FILAMENT_MOTION, encoder_sensor.block_completed(b));
|
||||
TERN_(HAS_FILAMENT_SWITCH, switch_sensor.block_completed(b));
|
||||
}
|
||||
|
||||
static void run() {
|
||||
TERN_(HAS_FILAMENT_MOTION, encoder_sensor.run());
|
||||
TERN_(HAS_FILAMENT_SWITCH, switch_sensor.run());
|
||||
}
|
||||
};
|
||||
}
|
||||
};
|
||||
|
||||
/********************************* RESPONSE TYPE *********************************/
|
||||
|
||||
#if HAS_FILAMENT_RUNOUT_DISTANCE
|
||||
|
||||
typedef struct {
|
||||
typedef struct {
|
||||
float runout[NUM_RUNOUT_SENSORS];
|
||||
Flags<NUM_RUNOUT_SENSORS> runout_reset; // Reset runout later
|
||||
#if ENABLED(FILAMENT_SWITCH_AND_MOTION)
|
||||
@@ -354,15 +320,16 @@ class FilamentSensorBase {
|
||||
#endif
|
||||
} countdown_t;
|
||||
|
||||
// RunoutResponseDelayed triggers a runout event only if the length
|
||||
// of filament specified by FILAMENT_RUNOUT_DISTANCE_MM has been fed
|
||||
// during a runout condition.
|
||||
class RunoutResponseDelayed {
|
||||
private:
|
||||
static countdown_t mm_countdown;
|
||||
// RunoutResponseDelayed triggers a runout event only if the length
|
||||
// of filament specified by FIL_RUNOUT_DISTANCE_MM has been fed
|
||||
// during a runout condition.
|
||||
class RunoutResponseDelayed {
|
||||
private:
|
||||
static countdown_t mm_countdown;
|
||||
|
||||
public:
|
||||
static float runout_distance_mm;
|
||||
public:
|
||||
static float runout_distance_mm[NUM_RUNOUT_SENSORS];
|
||||
static int8_t runout_count[NUM_RUNOUT_SENSORS];
|
||||
|
||||
static void reset() {
|
||||
for (uint8_t i = 0; i < NUM_RUNOUT_SENSORS; ++i) filament_present(i);
|
||||
@@ -371,116 +338,33 @@ class FilamentSensorBase {
|
||||
#endif
|
||||
}
|
||||
|
||||
static void run() {
|
||||
#if ENABLED(FILAMENT_RUNOUT_SENSOR_DEBUG)
|
||||
static millis_t t = 0;
|
||||
const millis_t ms = millis();
|
||||
if (ELAPSED(ms, t)) {
|
||||
t = millis() + 1000UL;
|
||||
for (uint8_t i = 0; i < NUM_RUNOUT_SENSORS; ++i)
|
||||
SERIAL_ECHO(i ? F(", ") : F("Runout remaining mm: "), mm_countdown.runout[i]);
|
||||
static void run() {
|
||||
#if ENABLED(FILAMENT_RUNOUT_SENSOR_DEBUG)
|
||||
static millis_t t = 0;
|
||||
const millis_t ms = millis();
|
||||
if (ELAPSED(ms, t)) {
|
||||
t = millis() + 1000UL;
|
||||
for(uint8_t i; i < NUM_RUNOUT_SENSORS; ++i)
|
||||
SERIAL_ECHO(i ? F(", ") : F("Remaining mm: "), mm_countdown[i]);
|
||||
#if ENABLED(FILAMENT_SWITCH_AND_MOTION)
|
||||
for (uint8_t i = 0; i < NUM_MOTION_SENSORS; ++i)
|
||||
SERIAL_ECHO(i ? F(", ") : F("Motion remaining mm: "), mm_countdown.motion[i]);
|
||||
#endif
|
||||
SERIAL_EOL();
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
static runout_flags_t has_run_out() {
|
||||
runout_flags_t runout_flags{0};
|
||||
for (uint8_t i = 0; i < NUM_RUNOUT_SENSORS; ++i) if (mm_countdown.runout[i] < 0) runout_flags.set(i);
|
||||
#if ENABLED(FILAMENT_SWITCH_AND_MOTION)
|
||||
for (uint8_t i = 0; i < NUM_MOTION_SENSORS; ++i) if (mm_countdown.motion[i] < 0) runout_flags.set(i);
|
||||
#endif
|
||||
return runout_flags;
|
||||
}
|
||||
|
||||
static void filament_present(const uint8_t extruder) {
|
||||
if (mm_countdown.runout[extruder] < runout_distance_mm || did_pause_print) {
|
||||
// Reset runout only if it is smaller than runout_distance or printing is paused.
|
||||
// On Bowden systems retract may be larger than runout_distance_mm, so if retract
|
||||
// was added leave it in place, or the following unretract will cause runout event.
|
||||
mm_countdown.runout[extruder] = runout_distance_mm;
|
||||
mm_countdown.runout_reset.clear(extruder);
|
||||
}
|
||||
else {
|
||||
// If runout is larger than runout distance, we cannot reset right now, as Bowden and retract
|
||||
// distance larger than runout_distance_mm leads to negative runout right after unretract.
|
||||
// But we cannot ignore filament_present event. After unretract, runout will become smaller
|
||||
// than runout_distance_mm and should be reset after that. So activate delayed reset.
|
||||
mm_countdown.runout_reset.set(extruder);
|
||||
}
|
||||
}
|
||||
|
||||
#if ENABLED(FILAMENT_SWITCH_AND_MOTION)
|
||||
static void filament_motion_present(const uint8_t extruder) {
|
||||
// Same logic as filament_present
|
||||
if (mm_countdown.motion[extruder] < runout_distance_mm || did_pause_print) {
|
||||
mm_countdown.motion[extruder] = runout_distance_mm;
|
||||
mm_countdown.motion_reset.clear(extruder);
|
||||
}
|
||||
else
|
||||
mm_countdown.motion_reset.set(extruder);
|
||||
SERIAL_EOL();
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
static void block_completed(const block_t * const b) {
|
||||
const int32_t esteps = b->steps.e;
|
||||
if (!esteps) return;
|
||||
|
||||
// No calculation unless paused or printing
|
||||
if (!should_monitor_runout()) return;
|
||||
|
||||
// No need to ignore retract/unretract movement since they complement each other
|
||||
const uint8_t e = b->extruder;
|
||||
const float mm = (b->direction_bits.e ? esteps : -esteps) * planner.mm_per_step[E_AXIS_N(e)];
|
||||
|
||||
if (e < NUM_RUNOUT_SENSORS) {
|
||||
mm_countdown.runout[e] -= mm;
|
||||
if (mm_countdown.runout_reset[e]) filament_present(e); // Reset pending. Try to reset.
|
||||
}
|
||||
|
||||
#if ENABLED(FILAMENT_SWITCH_AND_MOTION)
|
||||
if (e < NUM_MOTION_SENSORS) {
|
||||
mm_countdown.motion[e] -= mm;
|
||||
if (mm_countdown.motion_reset[e]) filament_motion_present(e); // Reset pending. Try to reset.
|
||||
}
|
||||
#endif
|
||||
}
|
||||
};
|
||||
|
||||
#else // !HAS_FILAMENT_RUNOUT_DISTANCE
|
||||
|
||||
// RunoutResponseDebounced triggers a runout event after a runout
|
||||
// condition has been detected runout_threshold times in a row.
|
||||
|
||||
class RunoutResponseDebounced {
|
||||
private:
|
||||
static constexpr int8_t runout_threshold = FILAMENT_RUNOUT_THRESHOLD;
|
||||
static int8_t runout_count[NUM_RUNOUT_SENSORS];
|
||||
|
||||
public:
|
||||
static void reset() {
|
||||
for (uint8_t i = 0; i < NUM_RUNOUT_SENSORS; ++i) filament_present(i);
|
||||
}
|
||||
|
||||
static void run() {
|
||||
for (uint8_t i = 0; i < NUM_RUNOUT_SENSORS; ++i) if (runout_count[i] >= 0) runout_count[i]--;
|
||||
}
|
||||
|
||||
static runout_flags_t has_run_out() {
|
||||
runout_flags_t runout_flags{0};
|
||||
static runout_flags_t has_run_out() {
|
||||
runout_flags_t runout_flags{0};
|
||||
for (uint8_t i = 0; i < NUM_RUNOUT_SENSORS; ++i) if (runout_count[i] < 0) runout_flags.set(i);
|
||||
return runout_flags;
|
||||
}
|
||||
}
|
||||
|
||||
static void block_completed(const block_t * const) { }
|
||||
|
||||
static void filament_present(const uint8_t extruder) {
|
||||
runout_count[extruder] = runout_threshold;
|
||||
runout_count[extruder] = runout_distance_mm[extruder];
|
||||
}
|
||||
};
|
||||
|
||||
#endif // !HAS_FILAMENT_RUNOUT_DISTANCE
|
||||
|
||||
@@ -985,6 +985,9 @@ G29_TYPE GcodeSuite::G29() {
|
||||
process_subcommands_now(F(EVENT_GCODE_AFTER_G29));
|
||||
#endif
|
||||
|
||||
TERN_(HAS_DWIN_E3V2_BASIC, DWIN_LevelingDone());
|
||||
TERN_(EXTENSIBLE_UI, ExtUI::onLevelingDone());
|
||||
TERN_(HAS_MULTI_HOTEND, if (active_extruder != 0) tool_change(0));
|
||||
probe.use_probing_tool(false);
|
||||
|
||||
report_current_position();
|
||||
|
||||
@@ -66,7 +66,7 @@ void GcodeSuite::M111() {
|
||||
SERIAL_ECHOPGM(STR_DEBUG_OFF);
|
||||
#if !(defined(__AVR__) && defined(USBCON))
|
||||
#if ENABLED(SERIAL_STATS_RX_BUFFER_OVERRUNS)
|
||||
SERIAL_ECHOPGM("\nBuffer Overruns: ", MYSERIAL1.buffer_overruns());
|
||||
//SERIAL_ECHOPGM("\nBuffer Overruns: ", MYSERIAL1.buffer_overruns());
|
||||
#endif
|
||||
#if ENABLED(SERIAL_STATS_RX_FRAMING_ERRORS)
|
||||
SERIAL_ECHOPGM("\nFraming Errors: ", MYSERIAL1.framing_errors());
|
||||
|
||||
@@ -94,7 +94,7 @@ void GcodeSuite::M600() {
|
||||
// In this case, for duplicating modes set DXC_ext to the extruder that ran out.
|
||||
#if MULTI_FILAMENT_SENSOR
|
||||
if (idex_is_duplicating())
|
||||
DXC_ext = (READ(FIL_RUNOUT2_PIN) == FIL_RUNOUT2_STATE) ? 1 : 0;
|
||||
DXC_ext = (READ(FIL_RUNOUT2_PIN) == runout.out_state(1)) ? 1 : 0;
|
||||
#else
|
||||
DXC_ext = active_extruder;
|
||||
#endif
|
||||
|
||||
@@ -72,6 +72,7 @@ void GcodeSuite::M413_report(const bool forReplay/*=true*/) {
|
||||
, " B", recovery.bed_temp_threshold
|
||||
#endif
|
||||
);
|
||||
SERIAL_ECHO(" ; ");
|
||||
serialprintln_onoff(recovery.enabled);
|
||||
}
|
||||
|
||||
|
||||
+36
-25
@@ -28,36 +28,46 @@
|
||||
#include "../../../feature/runout.h"
|
||||
|
||||
/**
|
||||
* M412: Enable / Disable filament runout detection
|
||||
* M591: Configure filament runout detection
|
||||
*
|
||||
* Parameters
|
||||
* R : Reset the runout sensor
|
||||
* S<bool> : Reset and enable/disable the runout sensor
|
||||
* H<bool> : Enable/disable host handling of filament runout
|
||||
* D<linear> : Extra distance to continue after runout is triggered
|
||||
* L<linear> : Extra distance to continue after runout is triggered or motion interval
|
||||
* D<linear> : Alias for L
|
||||
* P<index> : Mode 0 = NONE
|
||||
* 1 = Switch NO (HIGH = filament present)
|
||||
* 2 = Switch NC (LOW = filament present)
|
||||
* 3 = Encoder / Motion Sensor
|
||||
*/
|
||||
void GcodeSuite::M412() {
|
||||
if (parser.seen("RS"
|
||||
TERN_(HAS_FILAMENT_RUNOUT_DISTANCE, "D")
|
||||
TERN_(HOST_ACTION_COMMANDS, "H")
|
||||
)) {
|
||||
void GcodeSuite::M591() {
|
||||
if (parser.seen("RSDP" TERN_(HOST_ACTION_COMMANDS, "H"))) {
|
||||
#if ENABLED(HOST_ACTION_COMMANDS)
|
||||
if (parser.seen('H')) runout.host_handling = parser.value_bool();
|
||||
#endif
|
||||
const bool seenR = parser.seen_test('R'), seenS = parser.seen('S');
|
||||
if (seenR || seenS) runout.reset();
|
||||
if (seenS) runout.enabled = parser.value_bool();
|
||||
#if HAS_FILAMENT_RUNOUT_DISTANCE
|
||||
if (parser.seenval('D')) runout.set_runout_distance(parser.value_linear_units());
|
||||
#endif
|
||||
const uint8_t tool = TERN0(MULTI_FILAMENT_SENSOR, parser.ushortval('E', active_extruder));
|
||||
if (seenS) runout.enabled[tool] = parser.value_bool();
|
||||
if (parser.seen('D') || parser.seen('L')) runout.set_runout_distance(parser.value_linear_units(), tool);
|
||||
if (parser.seen('P')) {
|
||||
const RunoutMode tmp_mode = (RunoutMode)parser.value_int();
|
||||
switch (tmp_mode) {
|
||||
case RM_NONE ... RM_OUT_ON_HIGH:
|
||||
case RM_MOTION_SENSOR:
|
||||
runout.mode[tool] = tmp_mode;
|
||||
runout.setup();
|
||||
default: break;
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
SERIAL_ECHO_START();
|
||||
SERIAL_ECHOPGM("Filament runout ");
|
||||
serialprint_onoff(runout.enabled);
|
||||
#if HAS_FILAMENT_RUNOUT_DISTANCE
|
||||
SERIAL_ECHOPGM(" ; Distance ", runout.runout_distance(), "mm");
|
||||
#endif
|
||||
serialprint_onoff(runout.enabled[active_extruder]);
|
||||
SERIAL_ECHOPGM(" ; Distance ", runout.runout_distance(active_extruder), "mm");
|
||||
SERIAL_ECHOPGM(" ; Mode ", runout.mode[active_extruder]);
|
||||
#if ENABLED(HOST_ACTION_COMMANDS)
|
||||
SERIAL_ECHOPGM(" ; Host handling ");
|
||||
serialprint_onoff(runout.host_handling);
|
||||
@@ -66,18 +76,19 @@ void GcodeSuite::M412() {
|
||||
}
|
||||
}
|
||||
|
||||
void GcodeSuite::M412_report(const bool forReplay/*=true*/) {
|
||||
void GcodeSuite::M591_report(const bool forReplay/*=true*/) {
|
||||
TERN_(MARLIN_SMALL_BUILD, return);
|
||||
|
||||
report_heading_etc(forReplay, F(STR_FILAMENT_RUNOUT_SENSOR));
|
||||
SERIAL_ECHOPGM(
|
||||
" M412 S", runout.enabled
|
||||
#if HAS_FILAMENT_RUNOUT_DISTANCE
|
||||
, " D", LINEAR_UNIT(runout.runout_distance())
|
||||
#endif
|
||||
, " ; Sensor "
|
||||
);
|
||||
serialprintln_onoff(runout.enabled);
|
||||
for(int e=0; e < NUM_RUNOUT_SENSORS; e++)
|
||||
SERIAL_ECHOLNPGM(
|
||||
" M591"
|
||||
#if MULTI_FILAMENT_SENSOR
|
||||
" E", e,
|
||||
#endif
|
||||
" S", runout.enabled[e]
|
||||
, " D", LINEAR_UNIT(runout.runout_distance(e))
|
||||
, " P", runout.mode[e]
|
||||
);
|
||||
}
|
||||
|
||||
#endif // HAS_FILAMENT_SENSOR
|
||||
@@ -865,10 +865,6 @@ void GcodeSuite::process_parsed_command(const bool no_ok/*=false*/) {
|
||||
case 407: M407(); break; // M407: Display measured filament diameter
|
||||
#endif
|
||||
|
||||
#if HAS_FILAMENT_SENSOR
|
||||
case 412: M412(); break; // M412: Enable/Disable filament runout detection
|
||||
#endif
|
||||
|
||||
#if HAS_MULTI_LANGUAGE
|
||||
case 414: M414(); break; // M414: Select multi language menu
|
||||
#endif
|
||||
@@ -943,6 +939,11 @@ void GcodeSuite::process_parsed_command(const bool no_ok/*=false*/) {
|
||||
case 575: M575(); break; // M575: Set serial baudrate
|
||||
#endif
|
||||
|
||||
#if HAS_FILAMENT_SENSOR
|
||||
case 412: M412(); break; // Alias to M591
|
||||
case 591: M591(); break; // M591 Configure filament runout detection
|
||||
#endif
|
||||
|
||||
#if ENABLED(NONLINEAR_EXTRUSION)
|
||||
case 592: M592(); break; // M592: Nonlinear Extrusion control
|
||||
#endif
|
||||
|
||||
@@ -234,7 +234,6 @@
|
||||
* M406 - Disable Filament Sensor flow control. (Requires FILAMENT_WIDTH_SENSOR)
|
||||
* M407 - Display measured filament diameter in millimeters. (Requires FILAMENT_WIDTH_SENSOR)
|
||||
* M410 - Quickstop. Abort all planned moves.
|
||||
* M412 - Enable / Disable Filament Runout Detection. (Requires FILAMENT_RUNOUT_SENSOR)
|
||||
* M413 - Enable / Disable Power-Loss Recovery. (Requires POWER_LOSS_RECOVERY)
|
||||
* M414 - Set language by index. (Requires LCD_LANGUAGE_2...)
|
||||
* M420 - Enable/Disable Leveling (with current values) S1=enable S0=disable (Requires MESH_BED_LEVELING or ABL)
|
||||
@@ -259,6 +258,7 @@
|
||||
* M554 - Get or set IP gateway. (Requires enabled Ethernet port)
|
||||
* M569 - Enable stealthChop on an axis. (Requires at least one _DRIVER_TYPE to be TMC2130/2160/2208/2209/5130/5160)
|
||||
* M575 - Change the serial baud rate. (Requires BAUD_RATE_GCODE)
|
||||
* M591 - Configure Filament Runout Detection. (Requires FILAMENT_RUNOUT_SENSOR)
|
||||
* M592 - Get or set nonlinear extrusion parameters. (Requires NONLINEAR_EXTRUSION)
|
||||
* M593 - Get or set input shaping parameters. (Requires INPUT_SHAPING_[XY])
|
||||
* M600 - Pause for filament change: "M600 X<pos> Y<pos> Z<raise> E<first_retract> L<later_retract>". (Requires ADVANCED_PAUSE_FEATURE)
|
||||
@@ -1035,8 +1035,9 @@ private:
|
||||
#endif
|
||||
|
||||
#if HAS_FILAMENT_SENSOR
|
||||
static void M412();
|
||||
static void M412_report(const bool forReplay=true);
|
||||
static void M412() { M591(); }
|
||||
static void M591();
|
||||
static void M591_report(const bool forReplay=true);
|
||||
#endif
|
||||
|
||||
#if HAS_MULTI_LANGUAGE
|
||||
|
||||
@@ -154,7 +154,7 @@ void GcodeSuite::M115() {
|
||||
// AUTOLEVEL (G29)
|
||||
cap_line(F("AUTOLEVEL"), ENABLED(HAS_AUTOLEVEL));
|
||||
|
||||
// RUNOUT (M412, M600)
|
||||
// RUNOUT (M591, M600)
|
||||
cap_line(F("RUNOUT"), ENABLED(FILAMENT_RUNOUT_SENSOR));
|
||||
|
||||
// Z_PROBE (G30)
|
||||
|
||||
@@ -373,6 +373,8 @@ void plan_arc(
|
||||
planner.apply_leveling(raw);
|
||||
#endif
|
||||
|
||||
hints.curve_radius = i > 1 ? radius : 0;
|
||||
|
||||
// calculate safe speed for stopping by the end of the arc
|
||||
const float arc_mm_remaining = flat_mm - segment_mm * i;
|
||||
hints.safe_exit_speed_sqr = _MIN(limiting_speed_sqr, 2 * limiting_accel * arc_mm_remaining);
|
||||
|
||||
@@ -1191,10 +1191,14 @@
|
||||
* Fill in undefined Filament Sensor options
|
||||
*/
|
||||
#if ENABLED(FILAMENT_RUNOUT_SENSOR)
|
||||
#define HAS_FILAMENT_SENSOR 1
|
||||
#ifndef NUM_RUNOUT_SENSORS
|
||||
#define NUM_RUNOUT_SENSORS E_STEPPERS
|
||||
#endif
|
||||
#if ENABLED(MIXING_EXTRUDER)
|
||||
#define WATCH_ALL_RUNOUT_SENSORS
|
||||
#endif
|
||||
#if NUM_RUNOUT_SENSORS >= 1
|
||||
#ifndef FIL_RUNOUT1_STATE
|
||||
#define FIL_RUNOUT1_STATE FIL_RUNOUT_STATE
|
||||
#endif
|
||||
#ifndef FIL_RUNOUT1_PULLUP
|
||||
#define FIL_RUNOUT1_PULLUP FIL_RUNOUT_PULLUP
|
||||
#endif
|
||||
@@ -1203,9 +1207,7 @@
|
||||
#endif
|
||||
#endif
|
||||
#if NUM_RUNOUT_SENSORS >= 2
|
||||
#ifndef FIL_RUNOUT2_STATE
|
||||
#define FIL_RUNOUT2_STATE FIL_RUNOUT_STATE
|
||||
#endif
|
||||
#define MULTI_FILAMENT_SENSOR 1
|
||||
#ifndef FIL_RUNOUT2_PULLUP
|
||||
#define FIL_RUNOUT2_PULLUP FIL_RUNOUT_PULLUP
|
||||
#endif
|
||||
@@ -1214,9 +1216,6 @@
|
||||
#endif
|
||||
#endif
|
||||
#if NUM_RUNOUT_SENSORS >= 3
|
||||
#ifndef FIL_RUNOUT3_STATE
|
||||
#define FIL_RUNOUT3_STATE FIL_RUNOUT_STATE
|
||||
#endif
|
||||
#ifndef FIL_RUNOUT3_PULLUP
|
||||
#define FIL_RUNOUT3_PULLUP FIL_RUNOUT_PULLUP
|
||||
#endif
|
||||
@@ -1225,9 +1224,6 @@
|
||||
#endif
|
||||
#endif
|
||||
#if NUM_RUNOUT_SENSORS >= 4
|
||||
#ifndef FIL_RUNOUT4_STATE
|
||||
#define FIL_RUNOUT4_STATE FIL_RUNOUT_STATE
|
||||
#endif
|
||||
#ifndef FIL_RUNOUT4_PULLUP
|
||||
#define FIL_RUNOUT4_PULLUP FIL_RUNOUT_PULLUP
|
||||
#endif
|
||||
@@ -1236,9 +1232,6 @@
|
||||
#endif
|
||||
#endif
|
||||
#if NUM_RUNOUT_SENSORS >= 5
|
||||
#ifndef FIL_RUNOUT5_STATE
|
||||
#define FIL_RUNOUT5_STATE FIL_RUNOUT_STATE
|
||||
#endif
|
||||
#ifndef FIL_RUNOUT5_PULLUP
|
||||
#define FIL_RUNOUT5_PULLUP FIL_RUNOUT_PULLUP
|
||||
#endif
|
||||
@@ -1247,9 +1240,6 @@
|
||||
#endif
|
||||
#endif
|
||||
#if NUM_RUNOUT_SENSORS >= 6
|
||||
#ifndef FIL_RUNOUT6_STATE
|
||||
#define FIL_RUNOUT6_STATE FIL_RUNOUT_STATE
|
||||
#endif
|
||||
#ifndef FIL_RUNOUT6_PULLUP
|
||||
#define FIL_RUNOUT6_PULLUP FIL_RUNOUT_PULLUP
|
||||
#endif
|
||||
@@ -1258,9 +1248,6 @@
|
||||
#endif
|
||||
#endif
|
||||
#if NUM_RUNOUT_SENSORS >= 7
|
||||
#ifndef FIL_RUNOUT7_STATE
|
||||
#define FIL_RUNOUT7_STATE FIL_RUNOUT_STATE
|
||||
#endif
|
||||
#ifndef FIL_RUNOUT7_PULLUP
|
||||
#define FIL_RUNOUT7_PULLUP FIL_RUNOUT_PULLUP
|
||||
#endif
|
||||
@@ -1269,9 +1256,6 @@
|
||||
#endif
|
||||
#endif
|
||||
#if NUM_RUNOUT_SENSORS >= 8
|
||||
#ifndef FIL_RUNOUT8_STATE
|
||||
#define FIL_RUNOUT8_STATE FIL_RUNOUT_STATE
|
||||
#endif
|
||||
#ifndef FIL_RUNOUT8_PULLUP
|
||||
#define FIL_RUNOUT8_PULLUP FIL_RUNOUT_PULLUP
|
||||
#endif
|
||||
@@ -1881,6 +1865,30 @@
|
||||
#define NEOPIXEL_BKGD_INDEX_LAST NEOPIXEL_BKGD_INDEX_FIRST
|
||||
#endif
|
||||
|
||||
/*** TEMPORARY COMPATIBILITY ***/
|
||||
|
||||
#if HAS_FILAMENT_SENSOR
|
||||
#ifndef FIL_RUNOUT_ENABLED
|
||||
#if FIL_RUNOUT_ENABLED_DEFAULT
|
||||
#define FIL_RUNOUT_ENABLED ARRAY_N_1(NUM_RUNOUT_SENSORS, true)
|
||||
#else
|
||||
#define FIL_RUNOUT_ENABLED ARRAY_N_1(NUM_RUNOUT_SENSORS, false)
|
||||
#endif
|
||||
#endif
|
||||
#ifndef FIL_RUNOUT_MODE
|
||||
#if FIL_RUNOUT_STATE
|
||||
#define FIL_RUNOUT_MODE ARRAY_N_1(NUM_RUNOUT_SENSORS, 1)
|
||||
#else
|
||||
#define FIL_RUNOUT_MODE ARRAY_N_1(NUM_RUNOUT_SENSORS, 2)
|
||||
#endif
|
||||
#endif
|
||||
#ifndef FIL_RUNOUT_DISTANCE_MM
|
||||
#define FIL_RUNOUT_DISTANCE_MM ARRAY_N_1(NUM_RUNOUT_SENSORS, 10)
|
||||
#endif
|
||||
#undef FIL_RUNOUT_ENABLED_DEFAULT
|
||||
#undef FIL_RUNOUT_STATE
|
||||
#undef FILAMENT_RUNOUT_DISTANCE_MM
|
||||
#endif
|
||||
#if ALL(SPI_FLASH, HAS_MEDIA, MARLIN_DEV_MODE)
|
||||
#define SPI_FLASH_BACKUP 1
|
||||
#endif
|
||||
|
||||
@@ -954,6 +954,12 @@
|
||||
#define HAS_MOTOR_CURRENT_I2C 1
|
||||
#endif
|
||||
|
||||
#if ENABLED(DUAL_X_CARRIAGE)
|
||||
#ifndef INVERT_X2_DIR
|
||||
#define INVERT_X2_DIR INVERT_X_DIR
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// X2 but not IDEX => Dual Synchronized X Steppers
|
||||
#if defined(X2_DRIVER_TYPE) && DISABLED(DUAL_X_CARRIAGE)
|
||||
#define HAS_SYNCED_X_STEPPERS 1
|
||||
|
||||
@@ -2902,7 +2902,7 @@
|
||||
#define HAS_TEMPERATURE 1
|
||||
#endif
|
||||
|
||||
#if HAS_TEMPERATURE && ANY(HAS_MARLINUI_MENU, HAS_DWIN_E3V2, HAS_DGUS_LCD_CLASSIC)
|
||||
#if HAS_TEMPERATURE && ANY(HAS_MARLINUI_MENU, HAS_DWIN_E3V2, HAS_DGUS_LCD_CLASSIC, DGUS_LCD_UI_CREALITY_TOUCH)
|
||||
#ifdef PREHEAT_10_LABEL
|
||||
#define PREHEAT_COUNT 10
|
||||
#elif defined(PREHEAT_9_LABEL)
|
||||
|
||||
@@ -235,9 +235,11 @@ static_assert(COUNT(arm) == LOGICAL_AXES, "AXIS_RELATIVE_MODES must contain " _L
|
||||
#error "SERIAL_XON_XOFF and SERIAL_STATS_* features not supported on USB-native AVR devices."
|
||||
#endif
|
||||
|
||||
// Serial DMA is only available for some STM32 MCUs
|
||||
// Serial DMA is only available for some STM32 MCUs and HC32
|
||||
#if ENABLED(SERIAL_DMA)
|
||||
#if !HAL_STM32 || NONE(STM32F0xx, STM32F1xx, STM32F2xx, STM32F4xx, STM32F7xx)
|
||||
#if defined(ARDUINO_ARCH_HC32)
|
||||
// checks for HC32 are located in HAL/HC32/inc/SanityCheck.h
|
||||
#elif !HAL_STM32 || NONE(STM32F0xx, STM32F1xx, STM32F2xx, STM32F4xx, STM32F7xx)
|
||||
#error "SERIAL_DMA is only available for some STM32 MCUs and requires HAL/STM32."
|
||||
#elif !defined(HAL_UART_MODULE_ENABLED) || defined(HAL_UART_MODULE_ONLY)
|
||||
#error "SERIAL_DMA requires STM32 platform HAL UART (without HAL_UART_MODULE_ONLY)."
|
||||
@@ -539,10 +541,71 @@ static_assert(COUNT(arm) == LOGICAL_AXES, "AXIS_RELATIVE_MODES must contain " _L
|
||||
#error "You can't enable FIL_RUNOUT7_PULLUP and FIL_RUNOUT7_PULLDOWN at the same time."
|
||||
#elif ALL(FIL_RUNOUT8_PULLUP, FIL_RUNOUT8_PULLDOWN)
|
||||
#error "You can't enable FIL_RUNOUT8_PULLUP and FIL_RUNOUT8_PULLDOWN at the same time."
|
||||
#elif FILAMENT_RUNOUT_DISTANCE_MM < 0
|
||||
#error "FILAMENT_RUNOUT_DISTANCE_MM must be greater than or equal to zero."
|
||||
#elif DISABLED(ADVANCED_PAUSE_FEATURE) && defined(FILAMENT_RUNOUT_SCRIPT)
|
||||
static_assert(nullptr == strstr(FILAMENT_RUNOUT_SCRIPT, "M600"), "FILAMENT_RUNOUT_SCRIPT cannot make use of M600 unless ADVANCED_PAUSE_FEATURE is enabled");
|
||||
#elif DISABLED(ADVANCED_PAUSE_FEATURE)
|
||||
static_assert(nullptr == strstr(FILAMENT_RUNOUT_SCRIPT, "M600"), "ADVANCED_PAUSE_FEATURE is required to use M600 with FILAMENT_RUNOUT_SENSOR.");
|
||||
#elif defined(FIL_RUNOUT_ENABLED_DEFAULT)
|
||||
#error "FIL_RUNOUT_ENABLED_DEFAULT is now set with the FILAMENT_RUNOUT_ENABLED array."
|
||||
#elif defined(FILAMENT_RUNOUT_DISTANCE_MM)
|
||||
#error "FILAMENT_RUNOUT_DISTANCE_MM is now set with the FIL_RUNOUT_DISTANCE_MM array."
|
||||
#elif defined(FIL_RUNOUT_STATE) || defined(FIL_RUNOUT2_STATE) || defined(FIL_RUNOUT3_STATE) || defined(FIL_RUNOUT4_STATE) || defined(FIL_RUNOUT5_STATE) || defined(FIL_RUNOUT6_STATE) || defined(FIL_RUNOUT7_STATE) || defined(FIL_RUNOUT8_STATE)
|
||||
#ifdef FIL_RUNOUT_STATE
|
||||
#if FIL_RUNOUT_STATE
|
||||
#error "FIL_RUNOUT_STATE HIGH is now set with FIL_RUNOUT_MODE { 2 ... }."
|
||||
#else
|
||||
#error "FIL_RUNOUT_STATE LOW is now set with FIL_RUNOUT_MODE { 1 ... }."
|
||||
#endif
|
||||
#endif
|
||||
#ifdef FIL_RUNOUT2_STATE
|
||||
#if FIL_RUNOUT2_STATE
|
||||
#error "FIL_RUNOUT2_STATE HIGH is now set with FIL_RUNOUT_MODE { n, 2 ... }."
|
||||
#else
|
||||
#error "FIL_RUNOUT2_STATE LOW is now set with FIL_RUNOUT_MODE { n, 1 ... }."
|
||||
#endif
|
||||
#endif
|
||||
#ifdef FIL_RUNOUT3_STATE
|
||||
#if FIL_RUNOUT3_STATE
|
||||
#error "FIL_RUNOUT3_STATE HIGH is now set with FIL_RUNOUT_MODE { n, n, 2 ... }."
|
||||
#else
|
||||
#error "FIL_RUNOUT3_STATE LOW is now set with FIL_RUNOUT_MODE { n, n, 1 ... }."
|
||||
#endif
|
||||
#endif
|
||||
#ifdef FIL_RUNOUT4_STATE
|
||||
#if FIL_RUNOUT4_STATE
|
||||
#error "FIL_RUNOUT4_STATE HIGH is now set with FIL_RUNOUT_MODE { n, n, n, 2 ... }."
|
||||
#else
|
||||
#error "FIL_RUNOUT4_STATE LOW is now set with FIL_RUNOUT_MODE { n, n, n, 1 ... }."
|
||||
#endif
|
||||
#endif
|
||||
#ifdef FIL_RUNOUT5_STATE
|
||||
#if FIL_RUNOUT5_STATE
|
||||
#error "FIL_RUNOUT5_STATE HIGH is now set with FIL_RUNOUT_MODE { n, n, n, n, 2 ... }."
|
||||
#else
|
||||
#error "FIL_RUNOUT5_STATE LOW is now set with FIL_RUNOUT_MODE { n, n, n, n, 1 ... }."
|
||||
#endif
|
||||
#endif
|
||||
#ifdef FIL_RUNOUT6_STATE
|
||||
#if FIL_RUNOUT6_STATE
|
||||
#error "FIL_RUNOUT6_STATE HIGH is now set with FIL_RUNOUT_MODE { n, n, n, n, n, 2 ... }."
|
||||
#else
|
||||
#error "FIL_RUNOUT6_STATE LOW is now set with FIL_RUNOUT_MODE { n, n, n, n, n, 1 ... }."
|
||||
#endif
|
||||
#endif
|
||||
#ifdef FIL_RUNOUT7_STATE
|
||||
#if FIL_RUNOUT7_STATE
|
||||
#error "FIL_RUNOUT7_STATE HIGH is now set with FIL_RUNOUT_MODE { n, n, n, n, n, n, 2 ... }."
|
||||
#else
|
||||
#error "FIL_RUNOUT7_STATE LOW is now set with FIL_RUNOUT_MODE { n, n, n, n, n, n, 1 ... }."
|
||||
#endif
|
||||
#endif
|
||||
#ifdef FIL_RUNOUT8_STATE
|
||||
#if FIL_RUNOUT8_STATE
|
||||
#error "FIL_RUNOUT8_STATE HIGH is now set with FIL_RUNOUT_MODE { n, n, n, n, n, n, n, 2 ... }."
|
||||
#else
|
||||
#error "FIL_RUNOUT8_STATE LOW is now set with FIL_RUNOUT_MODE { n, n, n, n, n, n, n, 1 ... }."
|
||||
#endif
|
||||
#endif
|
||||
#elif ENABLED(FILAMENT_MOTION_SENSOR)
|
||||
#error "FILAMENT_MOTION_SENSOR is now set with FIL_RUNOUT_MODE { 7 ... }."
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@@ -1534,14 +1597,16 @@ static_assert(NUM_SERVOS <= NUM_SERVO_PLUGS, "NUM_SERVOS (or some servo index) i
|
||||
#endif
|
||||
|
||||
#if ENABLED(LCD_BED_TRAMMING)
|
||||
#ifndef BED_TRAMMING_INSET_LFRB
|
||||
#error "LCD_BED_TRAMMING requires BED_TRAMMING_INSET_LFRB values."
|
||||
#elif ENABLED(BED_TRAMMING_USE_PROBE)
|
||||
#if ENABLED(BED_TRAMMING_USE_PROBE)
|
||||
#if !HAS_BED_PROBE
|
||||
#error "BED_TRAMMING_USE_PROBE requires a real probe."
|
||||
#elif ENABLED(SENSORLESS_PROBING)
|
||||
#error "BED_TRAMMING_USE_PROBE is incompatible with SENSORLESS_PROBING."
|
||||
#endif
|
||||
#else
|
||||
#ifndef BED_TRAMMING_INSET_LFRB
|
||||
#error "LCD_BED_TRAMMING requires BED_TRAMMING_INSET_LFRB values."
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@@ -1837,6 +1902,8 @@ static_assert(NUM_SERVOS <= NUM_SERVO_PLUGS, "NUM_SERVOS (or some servo index) i
|
||||
#error "DUAL_X_CARRIAGE requires X2_HOME_POS, X2_MIN_POS, and X2_MAX_POS."
|
||||
#elif X_HOME_TO_MAX
|
||||
#error "DUAL_X_CARRIAGE requires X_HOME_DIR -1."
|
||||
#elif (X2_HOME_POS <= X1_MAX_POS) || (X2_MAX_POS < X1_MAX_POS)
|
||||
#error "DUAL_X_CARRIAGE will crash if X1 can meet or exceed X2 travel."
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@@ -2640,7 +2707,7 @@ static_assert(NUM_SERVOS <= NUM_SERVO_PLUGS, "NUM_SERVOS (or some servo index) i
|
||||
+ COUNT_ENABLED(ANYCUBIC_LCD_I3MEGA, ANYCUBIC_LCD_CHIRON, ANYCUBIC_TFT35, ANYCUBIC_LCD_VYPER) \
|
||||
+ DGUS_UI_IS(ORIGIN) + DGUS_UI_IS(FYSETC) + DGUS_UI_IS(HIPRECY) + DGUS_UI_IS(MKS) + DGUS_UI_IS(RELOADED) + DGUS_UI_IS(IA_CREALITY) \
|
||||
+ COUNT_ENABLED(ENDER2_STOCKDISPLAY, CR10_STOCKDISPLAY) \
|
||||
+ COUNT_ENABLED(DWIN_CREALITY_LCD, DWIN_LCD_PROUI, DWIN_CREALITY_LCD_JYERSUI, DWIN_MARLINUI_PORTRAIT, DWIN_MARLINUI_LANDSCAPE) \
|
||||
+ COUNT_ENABLED(DWIN_CREALITY_LCD, DWIN_LCD_PROUI, DWIN_CREALITY_LCD_JYERSUI, DWIN_MARLINUI_PORTRAIT, DWIN_MARLINUI_LANDSCAPE, DGUS_LCD_UI_CREALITY_TOUCH) \
|
||||
+ COUNT_ENABLED(FYSETC_MINI_12864_X_X, FYSETC_MINI_12864_1_2, FYSETC_MINI_12864_2_0, FYSETC_GENERIC_12864_1_1) \
|
||||
+ COUNT_ENABLED(LCD_SAINSMART_I2C_1602, LCD_SAINSMART_I2C_2004) \
|
||||
+ COUNT_ENABLED(MKS_12864OLED, MKS_12864OLED_SSD1306) \
|
||||
@@ -3568,9 +3635,9 @@ static_assert(_PLUS_TEST(3), "DEFAULT_MAX_ACCELERATION values must be positive."
|
||||
#error "LED_CONTROL_MENU requires an LCD controller that implements the menu."
|
||||
#endif
|
||||
|
||||
#if ENABLED(CUSTOM_MENU_MAIN) && NONE(HAS_MARLINUI_MENU, TOUCH_UI_FTDI_EVE, TFT_LVGL_UI)
|
||||
#error "CUSTOM_MENU_MAIN requires an LCD controller that implements the menu."
|
||||
#endif
|
||||
//#if ENABLED(CUSTOM_MENU_MAIN) && NONE(HAS_MARLINUI_MENU, TOUCH_UI_FTDI_EVE, TFT_LVGL_UI)
|
||||
//#error "CUSTOM_MENU_MAIN requires an LCD controller that implements the menu."
|
||||
//#endif
|
||||
|
||||
#if ENABLED(CASE_LIGHT_USE_NEOPIXEL) && DISABLED(NEOPIXEL_LED)
|
||||
#error "CASE_LIGHT_USE_NEOPIXEL requires NEOPIXEL_LED."
|
||||
|
||||
@@ -42,7 +42,7 @@
|
||||
* version was tagged.
|
||||
*/
|
||||
#ifndef STRING_DISTRIBUTION_DATE
|
||||
#define STRING_DISTRIBUTION_DATE "2024-04-10"
|
||||
#define STRING_DISTRIBUTION_DATE "2024-04-15"
|
||||
#endif
|
||||
|
||||
/**
|
||||
|
||||
@@ -99,7 +99,7 @@
|
||||
#warning "Warning! Don't use dummy thermistors (998/999) for final build!"
|
||||
#endif
|
||||
|
||||
#if NONE(HAS_RESUME_CONTINUE, HOST_PROMPT_SUPPORT)
|
||||
#if NONE(HAS_RESUME_CONTINUE, HOST_PROMPT_SUPPORT, UNIT_TEST)
|
||||
#warning "Your Configuration provides no method to acquire user feedback!"
|
||||
#endif
|
||||
|
||||
|
||||
@@ -1169,7 +1169,7 @@ void MarlinUI::draw_status_screen() {
|
||||
|
||||
lcd_moveto(LCD_WIDTH - 9, 2);
|
||||
lcd_put_lchar('S');
|
||||
|
||||
|
||||
|
||||
#endif // LCD_INFO_SCREEN_STYLE
|
||||
|
||||
|
||||
@@ -377,7 +377,13 @@ void MarlinUI::draw_kill_screen() {
|
||||
void MarlinUI::clear_lcd() { } // Automatically cleared by Picture Loop
|
||||
|
||||
#if HAS_DISPLAY_SLEEP
|
||||
void MarlinUI::sleep_display(const bool sleep/*=true*/) { sleep ? u8g.sleepOn() : u8g.sleepOff(); }
|
||||
void MarlinUI::sleep_display(const bool sleep/*=true*/) {
|
||||
static bool asleep = false;
|
||||
if (asleep != sleep){
|
||||
sleep ? u8g.sleepOn() : u8g.sleepOff();
|
||||
asleep = sleep;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#if HAS_LCD_BRIGHTNESS
|
||||
|
||||
@@ -2950,7 +2950,11 @@ void hmiControl() {
|
||||
void hmiLeveling() {
|
||||
popupWindowLeveling();
|
||||
dwinUpdateLCD();
|
||||
queue.inject(F("G28O\nG29"));
|
||||
#if defined(MAIN_MENU_ITEM_1_GCODE)
|
||||
queue.inject(F(MAIN_MENU_ITEM_1_GCODE));
|
||||
#else
|
||||
queue.inject(F("G28O\nG29\nG28\nG1Z0"));
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -4068,8 +4072,8 @@ void hmiInit() {
|
||||
hmiSDCardInit();
|
||||
|
||||
for (uint16_t t = 0; t <= 100; t += 2) {
|
||||
dwinIconShow(ICON, ICON_Bar, 15, 260);
|
||||
dwinDrawRectangle(1, COLOR_BG_BLACK, 15 + t * 242 / 100, 260, 257, 280);
|
||||
dwinIconShow(ICON, ICON_Bar, 15, 450);
|
||||
dwinDrawRectangle(1, COLOR_BG_BLACK, 15 + t * 242 / 100, 450, 257, 470);
|
||||
dwinUpdateLCD();
|
||||
delay(20);
|
||||
}
|
||||
|
||||
@@ -48,6 +48,7 @@ void dwinStartup() {
|
||||
dwinFrameClear(COLOR_BG_BLACK); // MarlinUI handles the bootscreen so just clear here
|
||||
dwinJPGShowAndCache(3);
|
||||
dwinUpdateLCD();
|
||||
dwinJPGShowAndCache(3);
|
||||
}
|
||||
|
||||
/*---------------------------------------- Picture related functions ----------------------------------------*/
|
||||
|
||||
@@ -108,8 +108,8 @@ void MarlinUI::clear_lcd() {
|
||||
#define INFO_CENTER ((LCD_PIXEL_WIDTH) - 200 / 2)
|
||||
#define VERSION_Y 84
|
||||
#endif
|
||||
|
||||
dwinDrawString(false, font10x20, COLOR_YELLOW, COLOR_BG_BLACK, INFO_CENTER - (dwin_string.length * 10) / 2, VERSION_Y, S(dwin_string.string()));
|
||||
dwinJPGShowAndCache(0); // Ensure DACAI stays on boot screen
|
||||
dwinDrawString(false, font10x20, COLOR_YELLOW, COLOR_BG_BLACK, INFO_CENTER - (dwin_string.length * 10) / 2, 230, S(dwin_string.string()));
|
||||
TERN_(SHOW_CUSTOM_BOOTSCREEN, safe_delay(CUSTOM_BOOTSCREEN_TIMEOUT));
|
||||
clear_lcd();
|
||||
|
||||
|
||||
@@ -199,7 +199,7 @@ typedef struct {
|
||||
} select_t;
|
||||
select_t select_page{0}, select_print{0};
|
||||
|
||||
#if ENABLED(LCD_BED_TRAMMING)
|
||||
#if ENABLED(LCD_BED_TRAMMING) && DISABLED(BED_TRAMMING_USE_PROBE)
|
||||
constexpr float bed_tramming_inset_lfbr[] = BED_TRAMMING_INSET_LFRB;
|
||||
#endif
|
||||
|
||||
@@ -2318,12 +2318,12 @@ void setMoveZ() { hmiValue.axis = Z_AXIS; setPFloatOnClick(Z_MIN_POS, Z_MAX_POS,
|
||||
#if HAS_FILAMENT_SENSOR
|
||||
void setRunoutEnable() {
|
||||
runout.reset();
|
||||
toggleCheckboxLine(runout.enabled);
|
||||
runout.enabled[0] = !runout.enabled[0];
|
||||
Draw_Chkb_Line(CurrentMenu->line(), runout.enabled[0]);
|
||||
DWIN_UpdateLCD();
|
||||
}
|
||||
#if HAS_FILAMENT_RUNOUT_DISTANCE
|
||||
void applyRunoutDistance() { runout.set_runout_distance(menuData.value / MINUNITMULT); }
|
||||
void setRunoutDistance() { setFloatOnClick(0, 999, UNITFDIGITS, runout.runout_distance(), applyRunoutDistance); }
|
||||
#endif
|
||||
void ApplyRunoutDistance() { runout.set_runout_distance(MenuData.Value / MINUNITMULT); }
|
||||
void SetRunoutDistance() { SetFloatOnClick(0, 999, UNITFDIGITS, runout.runout_distance(), ApplyRunoutDistance); }
|
||||
#endif
|
||||
|
||||
#if ENABLED(CONFIGURE_FILAMENT_CHANGE)
|
||||
@@ -2388,6 +2388,11 @@ void setFlow() { setPIntOnClick(FLOW_EDIT_MIN, FLOW_EDIT_MAX, []{ planner.refres
|
||||
#if ENABLED(LCD_BED_TRAMMING)
|
||||
|
||||
void tramXY(const uint8_t point, float &x, float &y) {
|
||||
#if ENABLED(BED_TRAMMING_USE_PROBE)
|
||||
float bed_tramming_inset_lfbr[] = {X_MIN_BED + probe.min_x() + 0.01f, Y_MIN_BED + probe.min_y() + 0.01f,
|
||||
X_MAX_BED - probe.max_x() - 0.01f, Y_MAX_BED - probe.max_y() - 0.01f };
|
||||
#endif
|
||||
|
||||
switch (point) {
|
||||
case 0:
|
||||
LCD_MESSAGE(MSG_TRAM_FL);
|
||||
|
||||
@@ -85,7 +85,7 @@ void ESDiag::update() {
|
||||
TERN_(USE_X_MIN, ES_REPORT(X_MIN)); TERN_(USE_X_MAX, ES_REPORT(X_MAX));
|
||||
TERN_(USE_Y_MIN, ES_REPORT(Y_MIN)); TERN_(USE_Y_MAX, ES_REPORT(Y_MAX));
|
||||
TERN_(USE_Z_MIN, ES_REPORT(Z_MIN)); TERN_(USE_Z_MAX, ES_REPORT(Z_MAX));
|
||||
TERN_(HAS_FILAMENT_SENSOR, draw_es_state(READ(FIL_RUNOUT1_PIN) != FIL_RUNOUT1_STATE));
|
||||
TERN_(HAS_FILAMENT_SENSOR, draw_es_state(READ(FIL_RUNOUT1_PIN) != runout.out_state());
|
||||
dwinUpdateLCD();
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,357 @@
|
||||
/**
|
||||
* 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/>.
|
||||
*
|
||||
*/
|
||||
|
||||
/* DGUS implementation written by coldtobi in 2019 for Marlin */
|
||||
|
||||
#include "../../../inc/MarlinConfigPre.h"
|
||||
|
||||
#if ENABLED(DGUS_LCD_UI_CREALITY_TOUCH)
|
||||
|
||||
#define DEBUG_ECHOLNPAIR DEBUG_ECHOLNPGM
|
||||
|
||||
#if HOTENDS > 2
|
||||
#error "More than 2 hotends not implemented on the Display UI design."
|
||||
#endif
|
||||
|
||||
#include "../ui_api.h"
|
||||
|
||||
#include "../../../MarlinCore.h"
|
||||
#include "../../../module/temperature.h"
|
||||
#include "../../../module/motion.h"
|
||||
#include "../../../gcode/queue.h"
|
||||
#include "../../../module/planner.h"
|
||||
#include "../../../sd/cardreader.h"
|
||||
#include "../../../libs/duration_t.h"
|
||||
#include "../../../module/printcounter.h"
|
||||
#if ENABLED(POWER_LOSS_RECOVERY)
|
||||
#include "../../../feature/powerloss.h"
|
||||
#endif
|
||||
|
||||
#include "DGUSDisplay.h"
|
||||
#include "DGUSVPVariable.h"
|
||||
#include "DGUSDisplayDef.h"
|
||||
|
||||
// Preamble... 2 Bytes, usually 0x5A 0xA5, but configurable
|
||||
constexpr uint8_t DGUS_HEADER1 = 0x5A;
|
||||
constexpr uint8_t DGUS_HEADER2 = 0xA5;
|
||||
|
||||
constexpr uint8_t DGUS_CMD_WRITEVAR = 0x82;
|
||||
constexpr uint8_t DGUS_CMD_READVAR = 0x83;
|
||||
|
||||
#if ENABLED(DEBUG_DGUSLCD)
|
||||
bool dguslcd_local_debug; // = false;
|
||||
#endif
|
||||
|
||||
#define dgusserial LCD_SERIAL
|
||||
|
||||
void DGUSDisplay::InitDisplay() {
|
||||
dgusserial.begin(LCD_BAUDRATE);
|
||||
|
||||
/*delay(500); // Attempt to fix possible handshake error
|
||||
|
||||
ResetDisplay(); // Reset for firmware update
|
||||
|
||||
delay(500); // Attempt to fix possible handshake error
|
||||
*/
|
||||
if (true
|
||||
#if ENABLED(POWER_LOSS_RECOVERY)
|
||||
&& !recovery.valid()
|
||||
#endif
|
||||
)
|
||||
RequestScreen(
|
||||
#if ENABLED(SHOW_BOOTSCREEN)
|
||||
DGUSLCD_SCREEN_BOOT
|
||||
#else
|
||||
DGUSLCD_SCREEN_MAIN
|
||||
#endif
|
||||
);
|
||||
}
|
||||
|
||||
void DGUSDisplay::ResetDisplay() {
|
||||
SERIAL_ECHOLN("ResetDisplay");
|
||||
const unsigned char resetCommand[] = { 0x55, 0xAA, 0x5A, 0xA5 };
|
||||
WriteVariable(0x04, resetCommand, sizeof(resetCommand));
|
||||
}
|
||||
|
||||
void DGUSDisplay::ReadVariable(uint16_t adr) {
|
||||
WriteHeader(adr, DGUS_CMD_READVAR, sizeof(uint8_t));
|
||||
|
||||
// Specify to read one byte
|
||||
dgusserial.write(static_cast<uint8_t>(1));
|
||||
}
|
||||
|
||||
void DGUSDisplay::WriteVariable(uint16_t adr, const void* values, uint8_t valueslen, bool isstr, char fillChar) {
|
||||
const char* myvalues = static_cast<const char*>(values);
|
||||
bool strend = !myvalues;
|
||||
WriteHeader(adr, DGUS_CMD_WRITEVAR, valueslen);
|
||||
while (valueslen--) {
|
||||
char x;
|
||||
if (!strend) x = *myvalues++;
|
||||
if ((isstr && !x) || strend) {
|
||||
strend = true;
|
||||
x = fillChar;
|
||||
}
|
||||
dgusserial.write(x);
|
||||
}
|
||||
}
|
||||
|
||||
void DGUSDisplay::WriteVariable(uint16_t adr, uint16_t value) {
|
||||
value = (value & 0xffU) << 8U | (value >> 8U);
|
||||
WriteVariable(adr, static_cast<const void*>(&value), sizeof(uint16_t));
|
||||
}
|
||||
|
||||
void DGUSDisplay::WriteVariable(uint16_t adr, int16_t value) {
|
||||
union { int16_t l; char lb[2]; } endian;
|
||||
char tmp[2];
|
||||
endian.l = value;
|
||||
tmp[0] = endian.lb[1];
|
||||
tmp[1] = endian.lb[0];
|
||||
|
||||
WriteVariable(adr, static_cast<const void*>(&tmp), sizeof(int16_t));
|
||||
}
|
||||
|
||||
void DGUSDisplay::WriteVariable(uint16_t adr, uint8_t value) {
|
||||
WriteVariable(adr, static_cast<const void*>(&value), sizeof(uint8_t));
|
||||
}
|
||||
|
||||
void DGUSDisplay::WriteVariable(uint16_t adr, int8_t value) {
|
||||
WriteVariable(adr, static_cast<const void*>(&value), sizeof(int8_t));
|
||||
}
|
||||
|
||||
void DGUSDisplay::WriteVariable(uint16_t adr, long value) {
|
||||
union { long l; char lb[4]; } endian;
|
||||
char tmp[4];
|
||||
endian.l = value;
|
||||
tmp[0] = endian.lb[3];
|
||||
tmp[1] = endian.lb[2];
|
||||
tmp[2] = endian.lb[1];
|
||||
tmp[3] = endian.lb[0];
|
||||
WriteVariable(adr, static_cast<const void*>(&tmp), sizeof(long));
|
||||
}
|
||||
|
||||
void DGUSDisplay::WriteVariable(uint16_t adr, float value) {
|
||||
static_assert(sizeof(float) == 4);
|
||||
|
||||
union { float l; char lb[4]; } endian;
|
||||
char tmp[4];
|
||||
endian.l = value;
|
||||
tmp[0] = endian.lb[3];
|
||||
tmp[1] = endian.lb[2];
|
||||
tmp[2] = endian.lb[1];
|
||||
tmp[3] = endian.lb[0];
|
||||
WriteVariable(adr, static_cast<const void*>(&tmp), sizeof(float));
|
||||
}
|
||||
|
||||
void DGUSDisplay::WriteVariablePGM(uint16_t adr, const void* values, uint8_t valueslen, bool isstr, char fillChar) {
|
||||
const char* myvalues = static_cast<const char*>(values);
|
||||
bool strend = !myvalues;
|
||||
WriteHeader(adr, DGUS_CMD_WRITEVAR, valueslen);
|
||||
while (valueslen--) {
|
||||
char x;
|
||||
if (!strend) x = pgm_read_byte(myvalues++);
|
||||
if ((isstr && !x) || strend) {
|
||||
strend = true;
|
||||
x = fillChar;
|
||||
}
|
||||
dgusserial.write(x);
|
||||
}
|
||||
}
|
||||
|
||||
void DGUSDisplay::SetVariableDisplayColor(uint16_t sp, uint16_t color) {
|
||||
WriteVariable(sp + 0x03, color);
|
||||
}
|
||||
|
||||
void DGUSDisplay::ProcessRx() {
|
||||
|
||||
#if ENABLED(DGUS_SERIAL_STATS_RX_BUFFER_OVERRUNS)
|
||||
if (!dgusserial.available() && dgusserial.buffer_overruns()) {
|
||||
// Overrun, but reset the flag only when the buffer is empty
|
||||
// We want to extract as many as valid datagrams possible...
|
||||
DEBUG_ECHOPGM("OVFL");
|
||||
rx_datagram_state = DGUS_IDLE;
|
||||
//dgusserial.reset_rx_overun();
|
||||
dgusserial.flush();
|
||||
}
|
||||
#endif
|
||||
|
||||
uint8_t receivedbyte;
|
||||
while (dgusserial.available()) {
|
||||
switch (rx_datagram_state) {
|
||||
|
||||
case DGUS_IDLE: // Waiting for the first header byte
|
||||
receivedbyte = dgusserial.read();
|
||||
//DEBUGLCDCOMM_ECHOPAIR("< ",receivedbyte);
|
||||
if (DGUS_HEADER1 == receivedbyte) rx_datagram_state = DGUS_HEADER1_SEEN;
|
||||
break;
|
||||
|
||||
case DGUS_HEADER1_SEEN: // Waiting for the second header byte
|
||||
receivedbyte = dgusserial.read();
|
||||
//DEBUGLCDCOMM_ECHOPAIR(" ", receivedbyte);
|
||||
rx_datagram_state = (DGUS_HEADER2 == receivedbyte) ? DGUS_HEADER2_SEEN : DGUS_IDLE;
|
||||
break;
|
||||
|
||||
case DGUS_HEADER2_SEEN: // Waiting for the length byte
|
||||
rx_datagram_len = dgusserial.read();
|
||||
//DEBUGLCDCOMM_ECHOPAIR(" (", rx_datagram_len, ") ");
|
||||
|
||||
// Telegram min len is 3 (command and one word of payload)
|
||||
rx_datagram_state = WITHIN(rx_datagram_len, 3, DGUS_RX_BUFFER_SIZE) ? DGUS_WAIT_TELEGRAM : DGUS_IDLE;
|
||||
break;
|
||||
|
||||
case DGUS_WAIT_TELEGRAM: // wait for complete datagram to arrive.
|
||||
if (dgusserial.available() < rx_datagram_len) return;
|
||||
|
||||
Initialized = true; // We've talked to it, so we defined it as initialized.
|
||||
uint8_t command = dgusserial.read();
|
||||
|
||||
// DEBUGLCDCOMM_ECHOPAIR("# ", command);
|
||||
|
||||
uint8_t readlen = rx_datagram_len - 1; // command is part of len.
|
||||
unsigned char tmp[rx_datagram_len - 1];
|
||||
unsigned char *ptmp = tmp;
|
||||
while (readlen--) {
|
||||
receivedbyte = dgusserial.read();
|
||||
//DEBUGLCDCOMM_ECHOPAIR(" ", receivedbyte);
|
||||
*ptmp++ = receivedbyte;
|
||||
}
|
||||
//DEBUGLCDCOMM_ECHOPGM(" # ");
|
||||
// mostly we'll get this: 5A A5 03 82 4F 4B -- ACK on 0x82, so discard it.
|
||||
if (command == DGUS_CMD_WRITEVAR && 'O' == tmp[0] && 'K' == tmp[1]) {
|
||||
//DEBUG_ECHOLNPGM(">");
|
||||
rx_datagram_state = DGUS_IDLE;
|
||||
break;
|
||||
}
|
||||
|
||||
/* AutoUpload, (and answer to) Command 0x83 :
|
||||
| tmp[0 1 2 3 4 ... ]
|
||||
| Example 5A A5 06 83 20 01 01 78 01 ……
|
||||
| / / | | \ / | \ \
|
||||
| Header | | | | \_____\_ DATA (Words!)
|
||||
| DatagramLen / VPAdr |
|
||||
| Command DataLen (in Words) */
|
||||
if (command == DGUS_CMD_READVAR) {
|
||||
const uint16_t vp = tmp[0] << 8 | tmp[1];
|
||||
|
||||
//const uint8_t dlen = tmp[2] << 1; // Convert to Bytes. (Display works with words)
|
||||
//DEBUG_ECHOPAIR(" vp=", vp, " dlen=", dlen);
|
||||
DGUS_VP_Variable ramcopy;
|
||||
DEBUG_ECHOLNPAIR("VP received: ", vp , " - val ", tmp[3]);
|
||||
if (populate_VPVar(vp, &ramcopy)) {
|
||||
if (ramcopy.set_by_display_handler)
|
||||
ramcopy.set_by_display_handler(ramcopy, &tmp[3]);
|
||||
else
|
||||
DEBUG_ECHOLNPGM(" VPVar found, no handler.");
|
||||
}
|
||||
else
|
||||
DEBUG_ECHOLNPAIR(" VPVar not found:", vp);
|
||||
|
||||
rx_datagram_state = DGUS_IDLE;
|
||||
break;
|
||||
}
|
||||
|
||||
// discard anything else
|
||||
rx_datagram_state = DGUS_IDLE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
size_t DGUSDisplay::GetFreeTxBuffer() { return SERIAL_GET_TX_BUFFER_FREE(); }
|
||||
|
||||
void DGUSDisplay::WriteHeader(uint16_t adr, uint8_t cmd, uint8_t payloadlen) {
|
||||
dgusserial.write(DGUS_HEADER1);
|
||||
dgusserial.write(DGUS_HEADER2);
|
||||
dgusserial.write(payloadlen + 3);
|
||||
dgusserial.write(cmd);
|
||||
dgusserial.write(adr >> 8);
|
||||
dgusserial.write(adr & 0xFF);
|
||||
}
|
||||
|
||||
void DGUSDisplay::WritePGM(const char str[], uint8_t len) {
|
||||
while (len--) dgusserial.write(pgm_read_byte(str++));
|
||||
}
|
||||
|
||||
void DGUSDisplay::loop() {
|
||||
// protect against recursion… ProcessRx() may indirectly call idle() when injecting gcode commands.
|
||||
if (!no_reentrance) {
|
||||
no_reentrance = true;
|
||||
ProcessRx();
|
||||
//Because crappy VPHELPER macros cant take calcs or functions, process updated value here. If we handle only in button handler code, we will miss changes over M290
|
||||
dgusdisplay.WriteVariable(VP_Z_OFFSET, (int16_t)(100*ExtUI::getZOffset_mm()));
|
||||
|
||||
no_reentrance = false;
|
||||
}
|
||||
}
|
||||
|
||||
void DGUSDisplay::RequestScreen(DGUSLCD_Screens screen) {
|
||||
displayRequest = screen;
|
||||
|
||||
DEBUG_ECHOLNPAIR("GotoScreen ", screen);
|
||||
const unsigned char gotoscreen[] = { 0x5A, 0x01, (unsigned char) (screen >> 8U), (unsigned char) (screen & 0xFFU) };
|
||||
WriteVariable(0x84, gotoscreen, sizeof(gotoscreen));
|
||||
}
|
||||
|
||||
void DGUSDisplay::SetTouchScreenConfiguration(bool enable_standby, bool enable_sound, uint8_t standby_brightness, uint8_t brightness, uint16_t standbyTimeSeconds) {
|
||||
// Main configuration (System_Config)
|
||||
unsigned char cfg_bits = 0x0;
|
||||
cfg_bits |= 1UL << 5; // 5: load 22 touch file
|
||||
cfg_bits |= 1UL << 4; // 4: auto-upload should always be enabled
|
||||
if (enable_sound) cfg_bits |= 1UL << 3; // 3: audio
|
||||
if (enable_standby) cfg_bits |= 1UL << 2; // 2: backlight on standby
|
||||
cfg_bits |= 1UL << 1; // 1 & 0: 270 degrees orientation of display
|
||||
cfg_bits |= 1UL << 0;
|
||||
|
||||
DEBUG_ECHOLNPAIR("Update touch screen config - standby ", enable_standby);
|
||||
DEBUG_ECHOLNPAIR("Update touch screen config - sound ", enable_sound);
|
||||
|
||||
const unsigned char config_set[] = { 0x5A, 0x00, (unsigned char) (cfg_bits >> 8U), (unsigned char) (cfg_bits & 0xFFU) };
|
||||
WriteVariable(0x80 /*System_Config*/, config_set, sizeof(config_set));
|
||||
|
||||
// Standby brightness (LED_Config)
|
||||
uint16_t dwinStandbyTimeSeconds = 100 * standbyTimeSeconds; /* milliseconds, but divided by 10 (not 5 like the docs say) */
|
||||
const unsigned char brightness_set[] = {
|
||||
brightness /*% active*/,
|
||||
standby_brightness /*% standby*/,
|
||||
static_cast<uint8_t>(dwinStandbyTimeSeconds >> 8),
|
||||
static_cast<uint8_t>(dwinStandbyTimeSeconds)
|
||||
};
|
||||
WriteVariable(0x82 /*LED_Config*/, brightness_set, sizeof(brightness_set));
|
||||
}
|
||||
|
||||
rx_datagram_state_t DGUSDisplay::rx_datagram_state = DGUS_IDLE;
|
||||
uint8_t DGUSDisplay::rx_datagram_len = 0;
|
||||
bool DGUSDisplay::Initialized = false;
|
||||
bool DGUSDisplay::no_reentrance = false;
|
||||
DGUSLCD_Screens DGUSDisplay::displayRequest = DGUSLCD_SCREEN_BOOT;
|
||||
|
||||
// A SW memory barrier, to ensure GCC does not overoptimize loops
|
||||
#define sw_barrier() asm volatile("": : :"memory");
|
||||
|
||||
bool populate_VPVar(const uint16_t VP, DGUS_VP_Variable * const ramcopy) {
|
||||
//DEBUG_ECHOLNPAIR("populate_VPVar ", VP);
|
||||
const DGUS_VP_Variable *pvp = DGUSLCD_FindVPVar(VP);
|
||||
// DEBUG_ECHOLNPAIR(" pvp ", (uint16_t )pvp);
|
||||
if (!pvp) return false;
|
||||
memcpy_P(ramcopy, pvp, sizeof(DGUS_VP_Variable));
|
||||
return true;
|
||||
}
|
||||
|
||||
#endif // HAS_DGUS_LCD
|
||||
@@ -0,0 +1,136 @@
|
||||
/**
|
||||
* 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
|
||||
|
||||
//#define DEBUG_DGUSLCD
|
||||
//#define DEBUG_DGUSLCD_OUTGOING_COMM
|
||||
|
||||
|
||||
/* Creality DGUS implementation written by Sebastiaan Dammann in 2020 for Marlin */
|
||||
|
||||
#include "../../../inc/MarlinConfigPre.h"
|
||||
|
||||
#include "../../../MarlinCore.h"
|
||||
#if HAS_BED_PROBE
|
||||
#include "../../../module/probe.h"
|
||||
#endif
|
||||
|
||||
#include "DGUSVPVariable.h"
|
||||
|
||||
enum DGUSLCD_Screens : uint8_t;
|
||||
|
||||
#ifndef DEBUG_OUT
|
||||
#define DEBUG_OUT ENABLED(DEBUG_DGUSLCD)
|
||||
#endif
|
||||
|
||||
#include "../../../core/debug_out.h"
|
||||
|
||||
|
||||
typedef enum : uint8_t {
|
||||
DGUS_IDLE, //< waiting for DGUS_HEADER1.
|
||||
DGUS_HEADER1_SEEN, //< DGUS_HEADER1 received
|
||||
DGUS_HEADER2_SEEN, //< DGUS_HEADER2 received
|
||||
DGUS_WAIT_TELEGRAM, //< LEN received, Waiting for to receive all bytes.
|
||||
} rx_datagram_state_t;
|
||||
|
||||
typedef void (*UPDATE_CURRENT_SCREEN_CALLBACK)(DGUSLCD_Screens screen);
|
||||
|
||||
// Low-Level access to the display.
|
||||
class DGUSDisplay {
|
||||
public:
|
||||
|
||||
DGUSDisplay() = default;
|
||||
|
||||
static void InitDisplay();
|
||||
static void ResetDisplay();
|
||||
|
||||
// Variable access.
|
||||
static void WriteVariable(uint16_t adr, const void* values, uint8_t valueslen, bool isstr=false, char fillChar = ' ');
|
||||
static void WriteVariablePGM(uint16_t adr, const void* values, uint8_t valueslen, bool isstr=false, char fillChar = ' ');
|
||||
static void WriteVariable(uint16_t adr, int16_t value);
|
||||
static void WriteVariable(uint16_t adr, uint16_t value);
|
||||
static void WriteVariable(uint16_t adr, uint8_t value);
|
||||
static void WriteVariable(uint16_t adr, int8_t value);
|
||||
static void WriteVariable(uint16_t adr, long value);
|
||||
static void WriteVariable(uint16_t adr, float value);
|
||||
|
||||
static void SetVariableDisplayColor(uint16_t sp, uint16_t color);
|
||||
|
||||
static void ReadVariable(uint16_t adr);
|
||||
|
||||
// Utility functions for bridging ui_api and dgus
|
||||
template<typename T, float(*Getter)(const T), T selector, typename WireType=uint16_t>
|
||||
static void SetVariable(DGUS_VP_Variable &var) {
|
||||
WriteVariable(var.VP, (WireType)Getter(selector));
|
||||
}
|
||||
|
||||
template<typename T, void(*Setter)(const float V, const T), T selector>
|
||||
static void GetVariable(DGUS_VP_Variable &var, void *val_ptr) {
|
||||
uint16_t newvalue = swap16(*(uint16_t*)val_ptr);
|
||||
Setter(newvalue, selector);
|
||||
}
|
||||
|
||||
// Force display into another screen.
|
||||
// (And trigger update of containing VPs)
|
||||
// (to implement a pop up message, which may not be nested)
|
||||
static void RequestScreen(DGUSLCD_Screens screen);
|
||||
|
||||
static void SetTouchScreenConfiguration(bool enable_standby, bool enable_sound, uint8_t standby_brightness, uint8_t active_brightness, uint16_t standbyTimeSeconds);
|
||||
|
||||
// Periodic tasks, eg. Rx-Queue handling.
|
||||
static void loop();
|
||||
|
||||
public:
|
||||
// Helper for users of this class to estimate if an interaction would be blocking.
|
||||
static size_t GetFreeTxBuffer();
|
||||
|
||||
// Checks two things: Can we confirm the presence of the display and has we initiliazed it.
|
||||
// (both boils down that the display answered to our chatting)
|
||||
static inline bool isInitialized() { return Initialized; }
|
||||
|
||||
private:
|
||||
static void WriteHeader(uint16_t adr, uint8_t cmd, uint8_t payloadlen);
|
||||
static void WritePGM(const char str[], uint8_t len);
|
||||
static void ProcessRx();
|
||||
|
||||
static inline uint16_t swap16(const uint16_t value) { return (value & 0xffU) << 8U | (value >> 8U); }
|
||||
static rx_datagram_state_t rx_datagram_state;
|
||||
static uint8_t rx_datagram_len;
|
||||
static bool Initialized, no_reentrance;
|
||||
|
||||
static DGUSLCD_Screens displayRequest;
|
||||
};
|
||||
|
||||
#define GET_VARIABLE(f, t, V...) (&DGUSDisplay::GetVariable<decltype(t), f, t, ##V>)
|
||||
#define SET_VARIABLE(f, t, V...) (&DGUSDisplay::SetVariable<decltype(t), f, t, ##V>)
|
||||
|
||||
extern DGUSDisplay dgusdisplay;
|
||||
|
||||
// compile-time x^y
|
||||
template<typename T>
|
||||
constexpr T cpow(const T x, const int y) { return y == 0 ? 1.0 : x * cpow(x, y - 1); }
|
||||
|
||||
/// Find the flash address of a DGUS_VP_Variable for the VP.
|
||||
const DGUS_VP_Variable* DGUSLCD_FindVPVar(const uint16_t vp);
|
||||
|
||||
/// Helper to populate a DGUS_VP_Variable for a given VP. Return false if not found.
|
||||
bool populate_VPVar(const uint16_t VP, DGUS_VP_Variable * const ramcopy);
|
||||
@@ -0,0 +1,53 @@
|
||||
/**
|
||||
* 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
|
||||
|
||||
/* DGUS implementation written by Sebastiaan Dammann in 2020 for Marlin */
|
||||
|
||||
#include "DGUSVPVariable.h"
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
// This file defines the interaction between Marlin and the display firmware.
|
||||
|
||||
// information on which screen which VP is displayed
|
||||
// As this is a sparse table, two arrays are needed:
|
||||
// one to list the VPs of one screen and one to map screens to the lists.
|
||||
// (Strictly this would not be necessary, but allows to only send data the display needs and reducing load on Marlin)
|
||||
struct VPMapping {
|
||||
const uint8_t screen;
|
||||
const uint16_t *VPList; // The list is null-terminated.
|
||||
};
|
||||
|
||||
extern const struct VPMapping VPMap[];
|
||||
|
||||
// List of VPs handled by Marlin / The Display.
|
||||
extern const struct DGUS_VP_Variable ListOfVP[];
|
||||
|
||||
#define DWIN_DEFAULT_FILLER_CHAR ' '
|
||||
#define DWIN_SCROLLER_FILLER_CHAR 0x0
|
||||
|
||||
#include "../../../inc/MarlinConfig.h"
|
||||
|
||||
#if ENABLED(DGUS_LCD_UI_CREALITY_TOUCH)
|
||||
#include "creality_touch/DGUSDisplayDef.h"
|
||||
#endif
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,469 @@
|
||||
/**
|
||||
* 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 "DGUSDisplay.h"
|
||||
#include "DGUSVPVariable.h"
|
||||
|
||||
#include "../../../inc/MarlinConfig.h"
|
||||
|
||||
#if HAS_COLOR_LEDS
|
||||
#include "../../../feature/leds/leds.h"
|
||||
|
||||
#if ENABLED(PRINTER_EVENT_LEDS)
|
||||
#define HAS_COLOR_LEDS_PREFERENCES 1
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#include "../../../module/motion.h"
|
||||
|
||||
enum DGUSLCD_Screens : uint8_t;
|
||||
|
||||
struct creality_dwin_settings_t {
|
||||
size_t settings_size;
|
||||
uint8_t settings_version;
|
||||
|
||||
bool led_state;
|
||||
bool display_standby;
|
||||
bool display_sound;
|
||||
int16_t standby_screen_brightness;
|
||||
int16_t screen_brightness;
|
||||
int16_t standby_time_seconds;
|
||||
|
||||
#if HAS_COLOR_LEDS_PREFERENCES
|
||||
LEDColor LastLEDColor;
|
||||
#endif
|
||||
};
|
||||
|
||||
class DGUSScreenHandler {
|
||||
public:
|
||||
DGUSScreenHandler() = default;
|
||||
|
||||
static bool loop();
|
||||
|
||||
static void Init();
|
||||
static void DefaultSettings();
|
||||
static void LoadSettings(const char* buff);
|
||||
static void StoreSettings(char* buff);
|
||||
static void SetTouchScreenConfiguration();
|
||||
static void KillScreenCalled();
|
||||
|
||||
static void OnPowerlossResume();
|
||||
|
||||
static void RequestSaveSettings();
|
||||
|
||||
// Send all 4 strings that are displayed on the infoscreen, confirmation screen and kill screen
|
||||
// The bools specifying whether the strings are in RAM or FLASH.
|
||||
static void sendinfoscreen(const char *line1, const char *line2, const char *line3, const char *line4, bool l1inflash, bool l2inflash, bool l3inflash, bool liinflash);
|
||||
static inline void sendinfoscreen(FSTR_P const line1, FSTR_P const line2, const char *line3, const char *line4, bool l1inflash, bool l2inflash, bool l3inflash, bool liinflash) {
|
||||
sendinfoscreen(FTOP(line1), FTOP(line2), line3, line4, l1inflash, l2inflash, l3inflash, liinflash);
|
||||
}
|
||||
static inline void sendinfoscreen(FSTR_P const line1, FSTR_P const line2, FSTR_P const line3, FSTR_P const line4, bool l1inflash, bool l2inflash, bool l3inflash, bool liinflash) {
|
||||
sendinfoscreen(FTOP(line1), FTOP(line2), FTOP(line3), FTOP(line4), l1inflash, l2inflash, l3inflash, liinflash);
|
||||
}
|
||||
|
||||
static void HandleUserConfirmationPopUp(uint16_t ConfirmVP, const char* line1, const char* line2, const char* line3, const char* line4, bool l1inflash, bool l2inflash, bool l3inflash, bool liinflash);
|
||||
|
||||
static void HandleDevelopmentTestButton(DGUS_VP_Variable &var, void *val_ptr);
|
||||
|
||||
/// "M117" Message -- msg is a RAM ptr.
|
||||
static void setstatusmessage(const char* msg);
|
||||
/// The same for messages from Flash
|
||||
static void setstatusmessagePGM(PGM_P const msg);
|
||||
|
||||
// Callback for VP "Display wants to change screen on idle printer"
|
||||
static void ScreenChangeHookIfIdle(DGUS_VP_Variable &var, void *val_ptr);
|
||||
// Callback for VP "Screen has been changed"
|
||||
static void ScreenChangeHook(DGUS_VP_Variable &var, void *val_ptr);
|
||||
// Callback for VP "All Heaters Off"
|
||||
static void HandleAllHeatersOff(DGUS_VP_Variable &var, void *val_ptr);
|
||||
// Hook for "Change this temperature"
|
||||
static void HandleTemperatureChanged(DGUS_VP_Variable &var, void *val_ptr);
|
||||
static void HandleFanSpeedChanged(DGUS_VP_Variable &var, void *val_ptr);
|
||||
// Hook for "Change Flowrate"
|
||||
static void HandleFlowRateChanged(DGUS_VP_Variable &var, void *val_ptr);
|
||||
// Hook for manual extrude.
|
||||
static void HandleManualExtrude(DGUS_VP_Variable &var, void *val_ptr);
|
||||
// Hook for motor lock and unlook
|
||||
static void HandleMotorLockUnlock(DGUS_VP_Variable &var, void *val_ptr);
|
||||
#if ENABLED(POWER_LOSS_RECOVERY)
|
||||
static void TogglePowerLossRecovery(DGUS_VP_Variable &var, void *val_ptr);
|
||||
|
||||
// Hook for power loss recovery.
|
||||
static void HandlePowerLossRecovery(DGUS_VP_Variable &var, void *val_ptr);
|
||||
#endif
|
||||
|
||||
// Version sanity check
|
||||
static void HandleScreenVersion(DGUS_VP_Variable &var, void *val_ptr);
|
||||
|
||||
// Hook for settings
|
||||
static void HandleStepPerMMChanged(DGUS_VP_Variable &var, void *val_ptr);
|
||||
static void HandleStepPerMMExtruderChanged(DGUS_VP_Variable &var, void *val_ptr);
|
||||
static void HandleFadeHeight(DGUS_VP_Variable &var, void *val_ptr);
|
||||
|
||||
// Hook for move to position
|
||||
static void HandlePositionChange(DGUS_VP_Variable &var, void *val_ptr);
|
||||
|
||||
static void HandleToggleTouchScreenMute(DGUS_VP_Variable &var, void *val_ptr);
|
||||
static void HandleToggleTouchScreenStandbySetting(DGUS_VP_Variable &var, void *val_ptr);
|
||||
static void HandleTouchScreenBrightnessSetting(DGUS_VP_Variable &var, void *val_ptr);
|
||||
static void HandleTouchScreenStandbyBrightnessSetting(DGUS_VP_Variable &var, void *val_ptr);
|
||||
static void HandleTouchScreenStandbyTimeSetting(DGUS_VP_Variable &var, void *val_ptr);
|
||||
|
||||
#if HAS_PROBE_SETTINGS
|
||||
static void HandleToggleProbeHeaters(DGUS_VP_Variable &var, void *val_ptr);
|
||||
static void HandleToggleProbeTemperatureStabilization(DGUS_VP_Variable &var, void *val_ptr);
|
||||
static void HandleToggleProbePreheatTemp(DGUS_VP_Variable &var, void *val_ptr);
|
||||
#endif
|
||||
|
||||
#if HAS_PID_HEATING
|
||||
// Hook for "Change this temperature PID para"
|
||||
static void HandleTemperaturePIDChanged(DGUS_VP_Variable &var, void *val_ptr);
|
||||
// Hook for PID autotune
|
||||
static void HandlePIDAutotune(DGUS_VP_Variable &var, void *val_ptr);
|
||||
#endif
|
||||
|
||||
|
||||
static void HandleZoffsetChange(DGUS_VP_Variable &var, void *val_ptr);
|
||||
|
||||
#if HAS_MESH
|
||||
// Hook for "Change probe offset z"
|
||||
|
||||
static void OnMeshLevelingStart();
|
||||
|
||||
static void OnMeshLevelingUpdate(const int8_t x, const int8_t y, const float z);
|
||||
|
||||
static void InitMeshValues();
|
||||
|
||||
static void ResetMeshValues();
|
||||
|
||||
static void UpdateMeshValue(const int8_t x, const int8_t y, const float z);
|
||||
|
||||
static void HandleMeshPoint(DGUS_VP_Variable &var, void *val_ptr);
|
||||
#endif
|
||||
|
||||
// LED
|
||||
#if HAS_COLOR_LEDS
|
||||
static void HandleLED(DGUS_VP_Variable &var, void *val_ptr);
|
||||
static void SendLEDToDisplay(DGUS_VP_Variable &var);
|
||||
#endif
|
||||
|
||||
// Hook for live z adjust action
|
||||
static void HandleLiveAdjustZ(DGUS_VP_Variable &var, void *val_ptr);
|
||||
|
||||
// Hook for heater control
|
||||
static void HandleHeaterControl(DGUS_VP_Variable &var, void *val_ptr);
|
||||
#if ENABLED(DGUS_PREHEAT_UI)
|
||||
// Hook for preheat
|
||||
static void HandlePreheat(DGUS_VP_Variable &var, void *val_ptr);
|
||||
#endif
|
||||
#if ENABLED(DGUS_FILAMENT_LOADUNLOAD)
|
||||
// Hook for filament load and unload filament option
|
||||
static void HandleFilamentOption(DGUS_VP_Variable &var, void *val_ptr);
|
||||
// Hook for filament load and unload
|
||||
static void HandleFilamentLoadUnload(DGUS_VP_Variable &var);
|
||||
#endif
|
||||
|
||||
#if ENABLED(SDSUPPORT)
|
||||
// Callback for VP "Display wants to change screen when there is a SD card"
|
||||
static void ScreenChangeHookIfSD(DGUS_VP_Variable &var, void *val_ptr);
|
||||
/// Scroll buttons on the file listing screen.
|
||||
static void DGUSLCD_SD_ScrollFilelist(DGUS_VP_Variable &var, void *val_ptr);
|
||||
/// File touched.
|
||||
static void DGUSLCD_SD_FileSelected(DGUS_VP_Variable &var, void *val_ptr);
|
||||
/// start print after confirmation received.
|
||||
static void DGUSLCD_SD_StartPrint(DGUS_VP_Variable &var, void *val_ptr);
|
||||
/// Send a single filename to the display.
|
||||
static void DGUSLCD_SD_SendFilename(DGUS_VP_Variable &var);
|
||||
/// Marlin informed us that a new SD has been inserted.
|
||||
static void SDCardInserted();
|
||||
/// Marlin informed us that the SD Card has been removed().
|
||||
static void SDCardRemoved();
|
||||
/// Marlin informed us about a bad SD Card.
|
||||
static void SDCardError();
|
||||
|
||||
static void SetPrintingFromHost();
|
||||
#endif
|
||||
|
||||
static void HandleLEDToggle();
|
||||
|
||||
static void HandleFanToggle();
|
||||
|
||||
static void FilamentRunout();
|
||||
|
||||
static void OnFactoryReset();
|
||||
|
||||
#if HAS_BUZZER || ENABLED(SPEAKER)
|
||||
static void Buzzer(const uint16_t frequency, const uint16_t duration);
|
||||
#endif
|
||||
|
||||
static void OnHomingStart();
|
||||
static void OnHomingComplete();
|
||||
static void OnPrintFinished();
|
||||
|
||||
// OK Button the Confirm screen.
|
||||
static void ScreenConfirmedOK(DGUS_VP_Variable &var, void *val_ptr);
|
||||
|
||||
// Update data after went to new screen (by display or by GotoScreen)
|
||||
// remember: store the last-displayed screen, so it can get returned to.
|
||||
// (e.g for pop up messages)
|
||||
static void UpdateNewScreen(DGUSLCD_Screens newscreen, bool save_current_screen=true);
|
||||
|
||||
// Recall the remembered screen.
|
||||
static void PopToOldScreen();
|
||||
static void OnBackButton(DGUS_VP_Variable &var, void *val_ptr);
|
||||
|
||||
// Make the display show the screen and update all VPs in it.
|
||||
static void GotoScreen(DGUSLCD_Screens screen, bool save_current_screen = true);
|
||||
|
||||
static void UpdateScreenVPData();
|
||||
|
||||
// Helpers to convert and transfer data to the display.
|
||||
static void DGUSLCD_SendWordValueToDisplay(DGUS_VP_Variable &var);
|
||||
static void DGUSLCD_SendStringToDisplay(DGUS_VP_Variable &var);
|
||||
static void DGUSLCD_SendScrollingStringToDisplay(DGUS_VP_Variable &var);
|
||||
static void DGUSLCD_SendStringToDisplayPGM(DGUS_VP_Variable &var);
|
||||
static void DGUSLCD_SendScrollingStringToDisplayPGM(DGUS_VP_Variable &var);
|
||||
static void DGUSLCD_SendTemperaturePID(DGUS_VP_Variable &var);
|
||||
static void DGUSLCD_SendPercentageToDisplay(DGUS_VP_Variable &var);
|
||||
static void DGUSLCD_SendPrintProgressToDisplay(DGUS_VP_Variable &var);
|
||||
static void DGUSLCD_SendPrintTimeToDisplay(DGUS_VP_Variable &var);
|
||||
static void DGUSLCD_SendPrintTimeWithRemainingToDisplay(DGUS_VP_Variable &var);
|
||||
static void DGUSLCD_SendPrintTimeRemainingToDisplay(DGUS_VP_Variable &var);
|
||||
#if ENABLED(PRINTCOUNTER)
|
||||
static void DGUSLCD_SendPrintAccTimeToDisplay(DGUS_VP_Variable &var);
|
||||
static void DGUSLCD_SendPrintsTotalToDisplay(DGUS_VP_Variable &var);
|
||||
#endif
|
||||
#if HAS_FAN
|
||||
static void DGUSLCD_SendFanStatusToDisplay(DGUS_VP_Variable &var);
|
||||
static void DGUSLCD_SendFanSpeedToDisplay(DGUS_VP_Variable &var);
|
||||
#endif
|
||||
static void DGUSLCD_SendHeaterStatusToDisplay(DGUS_VP_Variable &var);
|
||||
#if ENABLED(DGUS_UI_WAITING)
|
||||
static void DGUSLCD_SendWaitingStatusToDisplay(DGUS_VP_Variable &var);
|
||||
#endif
|
||||
|
||||
static void DGUSLCD_SendAboutFirmwareWebsite(DGUS_VP_Variable &var);
|
||||
static void DGUSLCD_SendAboutFirmwareVersion(DGUS_VP_Variable &var);
|
||||
static void DGUSLCD_SendAboutPrintSize(DGUS_VP_Variable &var);
|
||||
|
||||
/// Send a value from 0..100 to a variable with a range from 0..255
|
||||
static void DGUSLCD_PercentageToUint8(DGUS_VP_Variable &var, void *val_ptr);
|
||||
|
||||
template<typename T>
|
||||
static void DGUSLCD_SetValueDirectly(DGUS_VP_Variable &var, void *val_ptr) {
|
||||
if (!var.memadr) return;
|
||||
union { unsigned char tmp[sizeof(T)]; T t; } x;
|
||||
unsigned char *ptr = (unsigned char*)val_ptr;
|
||||
LOOP_L_N(i, sizeof(T)) x.tmp[i] = ptr[sizeof(T) - i - 1];
|
||||
*(T*)var.memadr = x.t;
|
||||
}
|
||||
|
||||
template<DGUSLCD_Screens TPage>
|
||||
static void DGUSLCD_NavigateToPage(DGUS_VP_Variable &var, void *val_ptr) {
|
||||
GotoScreen(TPage);
|
||||
}
|
||||
|
||||
template<DGUSLCD_Screens TPage, typename Handler>
|
||||
static void DGUSLCD_NavigateToPage(DGUS_VP_Variable &var, void *val_ptr) {
|
||||
GotoScreen(TPage);
|
||||
Handler::Init();
|
||||
}
|
||||
|
||||
/// Send a float value to the display.
|
||||
/// Display will get a 4-byte integer scaled to the number of digits:
|
||||
/// Tell the display the number of digits and it cheats by displaying a dot between...
|
||||
template<unsigned int decimals>
|
||||
static void DGUSLCD_SendFloatAsLongValueToDisplay(DGUS_VP_Variable &var) {
|
||||
if (var.memadr) {
|
||||
double d = static_cast<double>(*(float *)var.memadr);
|
||||
d *= cpow(10, decimals);
|
||||
|
||||
// Round - truncated values look like skipped numbers
|
||||
static_assert(sizeof(long) == 4, "Assuming long is 4 bytes");
|
||||
long roundedValue = static_cast<long>(round(d));
|
||||
dgusdisplay.WriteVariable(var.VP, roundedValue);
|
||||
}
|
||||
}
|
||||
|
||||
// Receive a float from the display - Display will send a 2-byte integer scaled to the number of digits
|
||||
template<unsigned int decimals>
|
||||
static void DGUSLCD_SetFloatAsIntFromDisplay(DGUS_VP_Variable &var, void *val_ptr) {
|
||||
if (var.memadr) {
|
||||
uint16_t value_raw = swap16(*(uint16_t*)val_ptr);
|
||||
|
||||
float value = static_cast<float>(static_cast<double>(value_raw) /cpow(10, decimals));
|
||||
*(float *)var.memadr = value;
|
||||
}
|
||||
}
|
||||
|
||||
// Receive a float from the display - Display will send a 4-byte integer scaled to the number of digits
|
||||
template<unsigned int decimals>
|
||||
static void DGUSLCD_SetFloatAsLongFromDisplay(DGUS_VP_Variable &var, void *val_ptr) {
|
||||
if (var.memadr) {
|
||||
uint32_t value_raw = uInt32Value(*(uint32_t*)val_ptr);
|
||||
|
||||
float value = static_cast<float>(static_cast<double>(value_raw) /cpow(10, decimals));
|
||||
*(float *)var.memadr = value;
|
||||
}
|
||||
}
|
||||
|
||||
static void DGUSLCD_SendULongToDisplay(DGUS_VP_Variable &var) {
|
||||
if (var.memadr) {
|
||||
// Round - truncated values look like skipped numbers
|
||||
long roundedValue = *(uint32_t *) var.memadr;
|
||||
dgusdisplay.WriteVariable(var.VP, roundedValue);
|
||||
}
|
||||
}
|
||||
|
||||
static void DGUSLCD_ReceiveULongFromDisplay(DGUS_VP_Variable &var, void* val_ptr) {
|
||||
if (var.memadr) {
|
||||
// Round - truncated values look like skipped numbers
|
||||
uint32_t incomingValue = *(uint32_t *) val_ptr;
|
||||
|
||||
*(uint32_t*)var.memadr = uInt32Value(incomingValue);
|
||||
}
|
||||
}
|
||||
|
||||
// Toggle a boolean at the specified memory address
|
||||
static void DGUSLCD_ToggleBoolean(DGUS_VP_Variable &var, void *val_ptr) {
|
||||
if (var.memadr) {
|
||||
SERIAL_ECHOLNPGM("Toggle boolean - ", var.VP);
|
||||
|
||||
bool* val = (bool *)var.memadr;
|
||||
*val = !*val;
|
||||
}
|
||||
}
|
||||
|
||||
// Send an icon to the display, depending on whether it is true or false
|
||||
template<unsigned int value_if_true, unsigned int value_if_false>
|
||||
static void DGUSLCD_SendIconValue(DGUS_VP_Variable &var) {
|
||||
if (var.memadr) {
|
||||
bool value = *(bool *)var.memadr;
|
||||
uint16_t valueToSend = value ? value_if_true : value_if_false;
|
||||
dgusdisplay.WriteVariable(var.VP, valueToSend);
|
||||
}
|
||||
}
|
||||
|
||||
/// Send a float value to the display.
|
||||
/// Display will get a 2-byte integer scaled to the number of digits:
|
||||
/// Tell the display the number of digits and it cheats by displaying a dot between...
|
||||
template<unsigned int decimals>
|
||||
static void DGUSLCD_SendFloatAsIntValueToDisplay(DGUS_VP_Variable &var) {
|
||||
if (var.memadr) {
|
||||
double d = static_cast<double>(*(float *)var.memadr);
|
||||
d *= cpow(10, decimals);
|
||||
|
||||
// Round - truncated values look like skipped numbers
|
||||
int16_t roundedValue = static_cast<int16_t>(round(d));
|
||||
dgusdisplay.WriteVariable(var.VP, roundedValue);
|
||||
}
|
||||
}
|
||||
|
||||
template<AxisEnum Axis>
|
||||
static void SendAxisTrustValue(DGUS_VP_Variable &var) {
|
||||
bool trust = axis_is_trusted(Axis);
|
||||
|
||||
uint16_t color = trust ? 0xFFFF /*White*/ : 0XF800 /*Red*/;
|
||||
dgusdisplay.SetVariableDisplayColor(var.VP, color);
|
||||
}
|
||||
|
||||
/// Force an update of all VP on the current screen.
|
||||
static inline void ForceCompleteUpdate() { update_ptr = 0; ScreenComplete = false; }
|
||||
/// Has all VPs sent to the screen
|
||||
static inline bool IsScreenComplete() { return ScreenComplete; }
|
||||
|
||||
static inline DGUSLCD_Screens getCurrentScreen() { return current_screen; }
|
||||
|
||||
static bool HandlePendingUserConfirmation();
|
||||
|
||||
static void SetSynchronousOperationStart();
|
||||
static void SetSynchronousOperationFinish();
|
||||
static bool HasCurrentSynchronousOperation() { return HasSynchronousOperation; }
|
||||
static void SendBusyState(DGUS_VP_Variable &var);
|
||||
|
||||
static void SetViewMeshLevelState();
|
||||
|
||||
static bool fwretract_available;
|
||||
|
||||
private:
|
||||
static void HandleScreenVersionMismatchLEDFlash();
|
||||
|
||||
static DGUSLCD_Screens current_screen; ///< currently on screen
|
||||
static constexpr uint8_t NUM_PAST_SCREENS = 4;
|
||||
static DGUSLCD_Screens past_screens[NUM_PAST_SCREENS]; ///< LIFO with past screens for the "back" button.
|
||||
|
||||
static uint8_t update_ptr; ///< Last sent entry in the VPList for the actual screen.
|
||||
static uint16_t skipVP; ///< When updating the screen data, skip this one, because the user is interacting with it.
|
||||
static bool ScreenComplete; ///< All VPs sent to screen?
|
||||
|
||||
static uint16_t ConfirmVP; ///< context for confirm screen (VP that will be emulated-sent on "OK").
|
||||
|
||||
static uint8_t MeshLevelIndex;
|
||||
static uint8_t MeshLevelIconIndex;
|
||||
static bool SaveSettingsRequested;
|
||||
static bool HasScreenVersionMismatch;
|
||||
static bool HasSynchronousOperation;
|
||||
|
||||
#if ENABLED(SDSUPPORT)
|
||||
static int16_t top_file; ///< file on top of file chooser
|
||||
static int16_t file_to_print; ///< touched file to be confirmed
|
||||
#endif
|
||||
|
||||
private:
|
||||
FORCE_INLINE static DGUSLCD_Screens GetPreviousScreen() {
|
||||
return past_screens[0];
|
||||
}
|
||||
|
||||
public: // Needed for VP auto-upload
|
||||
static bool HasRGBSettings;
|
||||
static creality_dwin_settings_t Settings;
|
||||
};
|
||||
|
||||
extern DGUSScreenHandler ScreenHandler;
|
||||
|
||||
struct DGUSSynchronousOperation {
|
||||
private:
|
||||
bool is_running;
|
||||
|
||||
public:
|
||||
DGUSSynchronousOperation() : is_running(false) {}
|
||||
|
||||
// Don't allow this to be created on the stack
|
||||
void* operator new (std::size_t size) = delete;
|
||||
|
||||
void start() {
|
||||
is_running = true;
|
||||
ScreenHandler.SetSynchronousOperationStart();
|
||||
}
|
||||
|
||||
void done() {
|
||||
is_running = false;
|
||||
ScreenHandler.SetSynchronousOperationFinish();
|
||||
}
|
||||
|
||||
~DGUSSynchronousOperation() {
|
||||
if (is_running) {
|
||||
ScreenHandler.SetSynchronousOperationFinish();
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,67 @@
|
||||
/**
|
||||
* 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 <stdint.h>
|
||||
|
||||
/**
|
||||
* DGUSVPVariable.h
|
||||
*
|
||||
* Created on: Feb 9, 2019
|
||||
* Author: tobi
|
||||
*/
|
||||
|
||||
struct DGUS_VP_Variable {
|
||||
uint16_t VP;
|
||||
void* memadr; // If nullptr, the value cannot be uploaded to the display.
|
||||
uint8_t size;
|
||||
|
||||
// Callback that will be called if the display modified the value.
|
||||
// nullptr makes it readonly for the display.
|
||||
void (*set_by_display_handler)(DGUS_VP_Variable &var, void *val_ptr);
|
||||
void (*send_to_display_handler)(DGUS_VP_Variable &var);
|
||||
|
||||
template<typename T>
|
||||
DGUS_VP_Variable& operator =(T &o) {
|
||||
*(T*)memadr = o; // warning this is not typesafe.
|
||||
// TODO: Call out the display or mark as dirty for the next update.
|
||||
return *this;
|
||||
}
|
||||
};
|
||||
|
||||
// endianness swap
|
||||
FORCE_INLINE uint16_t swap16(const uint16_t value) { return (value & 0xffU) << 8U | (value >> 8U); }
|
||||
|
||||
FORCE_INLINE int16_t swap16(const int16_t value) {
|
||||
union { int16_t l; char lb[2]; } endian;
|
||||
|
||||
endian.l = value;
|
||||
char tmp = endian.lb[1];
|
||||
endian.lb[1] = endian.lb[0];
|
||||
endian.lb[0] = tmp;
|
||||
|
||||
return endian.l;
|
||||
}
|
||||
|
||||
FORCE_INLINE uint32_t uInt32Value(const uint32_t value) { return ((value>>24)&0xff) | ((value<<8)&0xff0000) | ((value>>8)&0xff00) | ((value<<24)&0xff000000); }
|
||||
|
||||
FORCE_INLINE uint16_t uInt16Value(void *val_ptr) { return swap16(*static_cast<uint16_t*>(val_ptr)); }
|
||||
@@ -0,0 +1,230 @@
|
||||
|
||||
#include "../../../../inc/MarlinConfigPre.h"
|
||||
|
||||
#if ENABLED(DGUS_LCD_UI_CREALITY_TOUCH)
|
||||
|
||||
#include "../DGUSDisplayDef.h"
|
||||
#include "../DGUSDisplay.h"
|
||||
#include "../DGUSScreenHandler.h"
|
||||
|
||||
#include "EstepsHandler.h"
|
||||
#include "AxisSettingsHandler.h"
|
||||
|
||||
#include "../../ui_api.h"
|
||||
#include "../../../marlinui.h"
|
||||
|
||||
#include "../../../../module/temperature.h"
|
||||
#include "../../../../module/settings.h"
|
||||
#include "../../../../module/planner.h"
|
||||
#include "../../../../gcode/gcode.h"
|
||||
|
||||
#if HAS_TRINAMIC_CONFIG
|
||||
#include "../../../../feature/tmc_util.h"
|
||||
#include "../../../../module/stepper/indirection.h"
|
||||
#endif
|
||||
|
||||
AxisEnum AxisSettingsHandler::current_axis;
|
||||
uint16_t AxisSettingsHandler::axis_settings_title_icon = ICON_AXIS_SETTINGS_TITLE_X;
|
||||
|
||||
float AxisSettingsHandler::axis_steps_mm;
|
||||
uint16_t AxisSettingsHandler::max_acceleration_mm_per_s2;
|
||||
float AxisSettingsHandler::jerk;
|
||||
feedRate_t AxisSettingsHandler::max_feedrate;
|
||||
|
||||
#if HAS_TRINAMIC_CONFIG
|
||||
bool AxisSettingsHandler::has_tmc_settings = true;
|
||||
#else
|
||||
bool AxisSettingsHandler::has_tmc_settings = false;
|
||||
#endif
|
||||
|
||||
uint16_t AxisSettingsHandler::tmc_current;
|
||||
bool AxisSettingsHandler::stealthchop;
|
||||
uint32_t AxisSettingsHandler::hybrid_threshold;
|
||||
|
||||
void AxisSettingsHandler::HandleNavigation(DGUS_VP_Variable &var, void *val_ptr) {
|
||||
switch (uInt16Value(val_ptr)) {
|
||||
case AXIS_SETTINGS_NAV_BUTTON_VAL_X:
|
||||
current_axis = X_AXIS;
|
||||
axis_settings_title_icon = ICON_AXIS_SETTINGS_TITLE_X;
|
||||
break;
|
||||
|
||||
case AXIS_SETTINGS_NAV_BUTTON_VAL_Y:
|
||||
current_axis = Y_AXIS;
|
||||
axis_settings_title_icon = ICON_AXIS_SETTINGS_TITLE_Y;
|
||||
break;
|
||||
|
||||
case AXIS_SETTINGS_NAV_BUTTON_VAL_Z:
|
||||
current_axis = Z_AXIS;
|
||||
axis_settings_title_icon = ICON_AXIS_SETTINGS_TITLE_Z;
|
||||
break;
|
||||
|
||||
case AXIS_SETTINGS_NAV_BUTTON_VAL_E:
|
||||
current_axis = E_AXIS;
|
||||
axis_settings_title_icon = ICON_AXIS_SETTINGS_TITLE_E;
|
||||
break;
|
||||
}
|
||||
|
||||
// Load settings for axis
|
||||
axis_steps_mm = planner.settings.axis_steps_per_mm[current_axis];
|
||||
max_acceleration_mm_per_s2 = static_cast<uint16_t>(planner.settings.max_acceleration_mm_per_s2[current_axis]);
|
||||
IF_ENABLED(CLASSIC_JERK, jerk = planner.max_jerk[current_axis]);
|
||||
max_feedrate = planner.settings.max_feedrate_mm_s[current_axis];
|
||||
|
||||
#if HAS_TRINAMIC_CONFIG
|
||||
switch (current_axis){
|
||||
#if AXIS_IS_TMC(X)
|
||||
case X_AXIS:
|
||||
tmc_current = stepperX.getMilliamps();
|
||||
|
||||
#if AXIS_HAS_STEALTHCHOP(X)
|
||||
stealthchop = stepperX.get_stored_stealthChop();
|
||||
|
||||
#if ENABLED(HYBRID_THRESHOLD)
|
||||
hybrid_threshold = static_cast<uint32_t>(stepperX.get_pwm_thrs());
|
||||
#endif
|
||||
#endif
|
||||
break;
|
||||
#endif
|
||||
|
||||
#if AXIS_IS_TMC(Y)
|
||||
case Y_AXIS:
|
||||
tmc_current = stepperY.getMilliamps();
|
||||
|
||||
#if AXIS_HAS_STEALTHCHOP(Y)
|
||||
stealthchop = stepperY.get_stored_stealthChop();
|
||||
|
||||
#if ENABLED(HYBRID_THRESHOLD)
|
||||
hybrid_threshold = static_cast<uint32_t>(stepperY.get_pwm_thrs());
|
||||
#endif
|
||||
#endif
|
||||
break;
|
||||
#endif
|
||||
|
||||
#if AXIS_IS_TMC(Z)
|
||||
case Z_AXIS:
|
||||
tmc_current = stepperZ.getMilliamps();
|
||||
|
||||
#if AXIS_HAS_STEALTHCHOP(Z)
|
||||
stealthchop = stepperZ.get_stored_stealthChop();
|
||||
|
||||
#if ENABLED(HYBRID_THRESHOLD)
|
||||
hybrid_threshold = static_cast<uint32_t>(stepperZ.get_pwm_thrs());
|
||||
#endif
|
||||
#endif
|
||||
break;
|
||||
#endif
|
||||
|
||||
#if AXIS_IS_TMC(E0)
|
||||
case E_AXIS:
|
||||
tmc_current = stepperE0.getMilliamps();
|
||||
|
||||
#if AXIS_HAS_STEALTHCHOP(E0)
|
||||
stealthchop = stepperE0.get_stored_stealthChop();
|
||||
|
||||
#if ENABLED(HYBRID_THRESHOLD)
|
||||
hybrid_threshold = static_cast<uint32_t>(stepperE0.get_pwm_thrs());
|
||||
#endif
|
||||
#endif
|
||||
break;
|
||||
#endif
|
||||
|
||||
default:
|
||||
// Too bad
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
|
||||
// Nav
|
||||
ScreenHandler.GotoScreen(DGUSLCD_SCREEN_AXIS_SETTINGS_AXIS);
|
||||
}
|
||||
|
||||
void AxisSettingsHandler::HandleBackNavigation(DGUS_VP_Variable &var, void *val_ptr) {
|
||||
// Save settings for axis
|
||||
planner.settings.axis_steps_per_mm[current_axis] = axis_steps_mm;
|
||||
planner.settings.max_acceleration_mm_per_s2[current_axis] = max_acceleration_mm_per_s2;
|
||||
IF_ENABLED(CLASSIC_JERK, planner.max_jerk[current_axis] = jerk);
|
||||
planner.settings.max_feedrate_mm_s[current_axis] = max_feedrate;
|
||||
|
||||
// If we're handling the E-axis, the back button might end on that screen. Show that we didn't forget the settings.
|
||||
if (current_axis == E_AXIS) {
|
||||
EstepsHandler::set_esteps = axis_steps_mm;
|
||||
EstepsHandler::calculated_esteps = axis_steps_mm;
|
||||
}
|
||||
|
||||
#if HAS_TRINAMIC_CONFIG
|
||||
switch (current_axis){
|
||||
#if AXIS_IS_TMC(X)
|
||||
case X_AXIS:
|
||||
stepperX.rms_current(tmc_current);
|
||||
|
||||
#if AXIS_HAS_STEALTHCHOP(X)
|
||||
stepperX.set_stealthChop(stealthchop);
|
||||
|
||||
#if ENABLED(HYBRID_THRESHOLD)
|
||||
stepperX.set_pwm_thrs(hybrid_threshold);
|
||||
#endif
|
||||
#endif
|
||||
break;
|
||||
#endif
|
||||
|
||||
#if AXIS_IS_TMC(Y)
|
||||
case Y_AXIS:
|
||||
stepperY.rms_current(tmc_current);
|
||||
|
||||
#if AXIS_HAS_STEALTHCHOP(Y)
|
||||
stepperY.set_stealthChop(stealthchop);
|
||||
|
||||
#if ENABLED(HYBRID_THRESHOLD)
|
||||
stepperY.set_pwm_thrs(hybrid_threshold);
|
||||
#endif
|
||||
#endif
|
||||
break;
|
||||
#endif
|
||||
|
||||
#if AXIS_IS_TMC(Z)
|
||||
case Z_AXIS:
|
||||
stepperZ.rms_current(tmc_current);
|
||||
|
||||
#if AXIS_HAS_STEALTHCHOP(Z)
|
||||
stepperZ.set_stealthChop(stealthchop);
|
||||
|
||||
#if ENABLED(HYBRID_THRESHOLD)
|
||||
stepperZ.set_pwm_thrs(hybrid_threshold);
|
||||
#endif
|
||||
#endif
|
||||
break;
|
||||
#endif
|
||||
|
||||
#if AXIS_IS_TMC(E0)
|
||||
case E_AXIS:
|
||||
stepperE0.rms_current(tmc_current);
|
||||
|
||||
#if AXIS_HAS_STEALTHCHOP(E0)
|
||||
stepperE0.set_stealthChop(stealthchop);
|
||||
|
||||
#if ENABLED(HYBRID_THRESHOLD)
|
||||
stepperE0.set_pwm_thrs(hybrid_threshold);
|
||||
#endif
|
||||
#endif
|
||||
break;
|
||||
#endif
|
||||
|
||||
default:
|
||||
// Too bad
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
|
||||
// Save and pop
|
||||
ScreenHandler.PopToOldScreen();
|
||||
|
||||
settings.save();
|
||||
}
|
||||
|
||||
void AxisSettingsHandler::HandleTMCNavigation(DGUS_VP_Variable &var, void *val_ptr) {
|
||||
#if HAS_TRINAMIC_CONFIG
|
||||
ScreenHandler.GotoScreen(DGUSLCD_SCREEN_AXIS_SETTINGS_TMC);
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,26 @@
|
||||
#include <cstdint>
|
||||
|
||||
class AxisSettingsHandler {
|
||||
private:
|
||||
static AxisEnum current_axis;
|
||||
|
||||
public:
|
||||
static uint16_t axis_settings_title_icon;
|
||||
|
||||
static float axis_steps_mm;
|
||||
static uint16_t max_acceleration_mm_per_s2;
|
||||
|
||||
static float jerk;
|
||||
static feedRate_t max_feedrate;
|
||||
|
||||
static bool has_tmc_settings;
|
||||
static uint16_t tmc_current;
|
||||
static bool stealthchop;
|
||||
static uint32_t hybrid_threshold;
|
||||
|
||||
public:
|
||||
static void HandleNavigation(DGUS_VP_Variable &var, void *val_ptr);
|
||||
static void HandleBackNavigation(DGUS_VP_Variable &var, void *val_ptr);
|
||||
static void HandleTMCNavigation(DGUS_VP_Variable &var, void *val_ptr);
|
||||
};
|
||||
|
||||
@@ -0,0 +1,796 @@
|
||||
/**
|
||||
* 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/>.
|
||||
*
|
||||
*/
|
||||
|
||||
/* DGUS implementation written by Sebastiaan Dammann in 2020 for Marlin */
|
||||
|
||||
#include "../../../../inc/MarlinConfigPre.h"
|
||||
|
||||
#if ENABLED(DGUS_LCD_UI_CREALITY_TOUCH)
|
||||
|
||||
#include "../DGUSDisplayDef.h"
|
||||
#include "../DGUSDisplay.h"
|
||||
#include "../DGUSScreenHandler.h"
|
||||
#include "AxisSettingsHandler.h"
|
||||
#include "EstepsHandler.h"
|
||||
#include "FilamentLoadUnloadHandler.h"
|
||||
#include "PIDHandler.h"
|
||||
#include "MeshValidationHandler.h"
|
||||
|
||||
#include "../../../../module/temperature.h"
|
||||
#include "../../../../module/motion.h"
|
||||
#include "../../../../module/planner.h"
|
||||
|
||||
#include "../../../../feature/caselight.h"
|
||||
#if ENABLED(BABYSTEPPING)
|
||||
#include "../../../../feature/babystep.h"
|
||||
#endif
|
||||
|
||||
#if ENABLED(FWRETRACT)
|
||||
#include "../../../../feature/fwretract.h"
|
||||
#endif
|
||||
|
||||
#if HAS_COLOR_LEDS
|
||||
#include "../../../../feature/leds/leds.h"
|
||||
#endif
|
||||
|
||||
#if ENABLED(POWER_LOSS_RECOVERY)
|
||||
#include "../../../../feature/powerloss.h"
|
||||
#endif
|
||||
|
||||
#if ENABLED(FILAMENT_RUNOUT_SENSOR)
|
||||
#include "../../../../feature/runout.h"
|
||||
#endif
|
||||
|
||||
#include "../../ui_api.h"
|
||||
#include "../../../marlinui.h"
|
||||
|
||||
#include "PageHandlers.h"
|
||||
|
||||
#if ENABLED(DGUS_UI_MOVE_DIS_OPTION)
|
||||
uint16_t distanceToMove = 10;
|
||||
#endif
|
||||
using namespace ExtUI;
|
||||
|
||||
|
||||
const char MarlinVersion[] PROGMEM = SHORT_BUILD_VERSION;
|
||||
|
||||
// ----- Common var lists
|
||||
#if HOTENDS >= 1
|
||||
#define VPList_HeatHotend VP_T_E0_Is, VP_T_E0_Set,
|
||||
#else
|
||||
#define VPList_HeatHotend
|
||||
#endif
|
||||
|
||||
#if HAS_HEATED_BED
|
||||
#define VPList_HeatBed VP_T_Bed_Is, VP_T_Bed_Set,
|
||||
#else
|
||||
#define VPList_HeatBed
|
||||
#endif
|
||||
|
||||
#define VPList_Common VP_BACK_BUTTON_STATE, VP_Z_OFFSET, VP_BUTTON_BEDLEVELKEY
|
||||
#define VPList_CommonWithStatus VPList_HeatHotend VPList_HeatBed VP_Z_OFFSET, VP_Feedrate_Percentage, VP_BACK_BUTTON_STATE
|
||||
#define VPList_CommonWithHeatOnly VPList_HeatHotend VPList_HeatBed VP_BACK_BUTTON_STATE, VP_Z_OFFSET
|
||||
|
||||
// ----- Which variables to auto-update on which screens
|
||||
const uint16_t VPList_None[] PROGMEM = {
|
||||
VPList_Common,
|
||||
|
||||
0x0000
|
||||
};
|
||||
|
||||
const uint16_t VPList_DialogStop[] PROGMEM = {
|
||||
VPList_Common,
|
||||
|
||||
0x0000
|
||||
};
|
||||
|
||||
const uint16_t VPList_Main[] PROGMEM = {
|
||||
VPList_CommonWithStatus,
|
||||
|
||||
0x0000
|
||||
};
|
||||
|
||||
const uint16_t VPList_SDFileList[] PROGMEM = {
|
||||
VPList_CommonWithStatus,
|
||||
|
||||
VP_SD_FileName0,
|
||||
VP_SD_FileName1,
|
||||
VP_SD_FileName2,
|
||||
VP_SD_FileName3,
|
||||
VP_SD_FileName4,
|
||||
VP_SD_FileName5,
|
||||
|
||||
0x0000
|
||||
};
|
||||
|
||||
const uint16_t VPList_Control[] PROGMEM = {
|
||||
VPList_CommonWithStatus,
|
||||
|
||||
VP_LED_TOGGLE,
|
||||
VP_MUTE_ICON,
|
||||
|
||||
0x0000
|
||||
};
|
||||
|
||||
const uint16_t VPList_Feed[] PROGMEM = {
|
||||
VPList_CommonWithStatus,
|
||||
|
||||
VP_FILCHANGE_NOZZLE_TEMP,
|
||||
VP_FILCHANGE_LENGTH,
|
||||
|
||||
0x0000
|
||||
};
|
||||
|
||||
const uint16_t VPList_Temp[] PROGMEM = {
|
||||
VPList_CommonWithStatus,
|
||||
|
||||
VP_FAN_TOGGLE,
|
||||
|
||||
0x0000
|
||||
};
|
||||
|
||||
|
||||
const uint16_t VPList_PreheatPLASettings[] PROGMEM = {
|
||||
VPList_CommonWithStatus,
|
||||
|
||||
VP_PREHEAT_PLA_HOTEND_TEMP,
|
||||
VP_PREHEAT_PLA_BED_TEMP,
|
||||
|
||||
0x0000
|
||||
};
|
||||
|
||||
const uint16_t VPList_PreheatABSSettings[] PROGMEM = {
|
||||
VPList_CommonWithStatus,
|
||||
|
||||
VP_PREHEAT_ABS_HOTEND_TEMP,
|
||||
VP_PREHEAT_ABS_BED_TEMP,
|
||||
|
||||
0x0000
|
||||
};
|
||||
|
||||
|
||||
const uint16_t VPList_PrintPausingError[] PROGMEM = {
|
||||
VPList_CommonWithStatus,
|
||||
|
||||
VP_X_POSITION,
|
||||
VP_Y_POSITION,
|
||||
VP_Z_POSITION_PRECISION,
|
||||
VP_Z_OFFSET,
|
||||
VP_Fan0_Percentage,
|
||||
VP_Feedrate_Percentage,
|
||||
|
||||
VP_PrintProgress_Percentage,
|
||||
VP_PrintTimeProgressBar,
|
||||
VP_PrintTime,
|
||||
VP_PrintTimeWithRemainingVisible,
|
||||
VP_PrintTimeRemaining,
|
||||
VP_LINEAR_ADVANCE_FACTOR,
|
||||
|
||||
0x0000
|
||||
};
|
||||
|
||||
const uint16_t VPList_PrintScreen[] PROGMEM = {
|
||||
VPList_CommonWithStatus,
|
||||
|
||||
VP_X_POSITION, VP_Y_POSITION, VP_Z_POSITION, VP_Z_POSITION_PRECISION,
|
||||
SP_X_POSITION, SP_Y_POSITION, SP_Z_POSITION,
|
||||
|
||||
VP_Flowrate_E0,
|
||||
VP_Fan0_Percentage,
|
||||
|
||||
VP_PrintProgress_Percentage,
|
||||
VP_PrintTimeProgressBar,
|
||||
VP_PrintTime,
|
||||
VP_PrintTimeWithRemainingVisible,
|
||||
VP_PrintTimeRemaining,
|
||||
VP_LINEAR_ADVANCE_FACTOR,
|
||||
|
||||
VP_FWRETRACT_INDICATOR_ICON,
|
||||
|
||||
0x0000
|
||||
};
|
||||
|
||||
const uint16_t VPList_Leveling[] PROGMEM = {
|
||||
VPList_CommonWithStatus,
|
||||
|
||||
VP_MESH_LEVEL_TEMP,
|
||||
|
||||
0x0000
|
||||
};
|
||||
|
||||
const uint16_t VPList_ZOffsetLevel[] PROGMEM = {
|
||||
VPList_CommonWithStatus,
|
||||
|
||||
0x0000
|
||||
};
|
||||
|
||||
const uint16_t VPList_TuneScreen[] PROGMEM = {
|
||||
VPList_CommonWithStatus,
|
||||
|
||||
VP_PrintTime,
|
||||
|
||||
VP_Flowrate_E0,
|
||||
|
||||
VP_LED_TOGGLE,
|
||||
VP_FAN_TOGGLE,
|
||||
VP_Fan0_Percentage,
|
||||
|
||||
0x0000
|
||||
};
|
||||
|
||||
|
||||
const uint16_t VPList_TuneExtraScreen[] PROGMEM = {
|
||||
VPList_CommonWithStatus,
|
||||
|
||||
VP_LINEAR_ADVANCE_FACTOR,
|
||||
VP_RGB_NAV_BUTTON_ICON,
|
||||
|
||||
0x0000
|
||||
};
|
||||
|
||||
|
||||
const uint16_t VPList_Prepare[] PROGMEM = {
|
||||
VPList_CommonWithStatus,
|
||||
|
||||
VP_PrintTime,
|
||||
|
||||
0x0000
|
||||
};
|
||||
|
||||
const uint16_t VPList_Info[] PROGMEM = {
|
||||
VPList_CommonWithStatus,
|
||||
|
||||
VP_PrintTime,
|
||||
|
||||
VP_PRINTER_BEDSIZE,
|
||||
VP_MARLIN_WEBSITE,
|
||||
VP_MARLIN_VERSION,
|
||||
|
||||
0x0000
|
||||
};
|
||||
|
||||
const uint16_t VPList_EstepsCalibration[] PROGMEM = {
|
||||
VPList_CommonWithHeatOnly,
|
||||
|
||||
VP_ESTEPS_CURRENT,
|
||||
VP_ESTEPS_CALIBRATION_TEMP,
|
||||
VP_ESTEPS_CALIBRATION_LENGTH,
|
||||
VP_ESTEPS_CALIBRATION_LEFTOVER_LENGTH,
|
||||
VP_ESTEPS_CALIBRATION_MARK_LENGTH,
|
||||
VP_ESTEPS_CALCULATED_ESTEPS,
|
||||
|
||||
0x0000
|
||||
};
|
||||
|
||||
const uint16_t VPList_PidTune[] PROGMEM = {
|
||||
VPList_CommonWithHeatOnly,
|
||||
|
||||
VP_PIDTUNE_TARGET_TEMP,
|
||||
VP_PIDTUNE_FAN_TOGGLE_ICON,
|
||||
VP_PIDTUNE_CYCLES,
|
||||
|
||||
0x0000
|
||||
};
|
||||
|
||||
const uint16_t VPList_FWRetractTune[] PROGMEM = {
|
||||
VPList_CommonWithStatus,
|
||||
|
||||
VP_FWRETRACT_RETRACT_LENGTH,
|
||||
VP_FWRETRACT_RETRACT_FEEDRATE,
|
||||
VP_FWRETRACT_RETRACT_ZHOP,
|
||||
VP_FWRETRACT_RESTART_LENGTH,
|
||||
VP_FWRETRACT_RESTART_FEEDRATE,
|
||||
|
||||
VP_FWRETRACT_TOGGLE_BUTTON_ICON,
|
||||
|
||||
0x0000
|
||||
};
|
||||
|
||||
const uint16_t VPList_LevelingSettings[] PROGMEM = {
|
||||
VPList_CommonWithStatus,
|
||||
|
||||
VP_TOGGLE_PROBING_HEATERS_OFF_ONOFF_ICON,
|
||||
VP_TOGGLE_PROBE_PREHEAT_HOTEND_TEMP,
|
||||
VP_TOGGLE_PROBE_PREHEAT_BED_TEMP,
|
||||
VP_TOGGLE_POST_PROBING_TEMPERATURE_STABILIZATION_ICON,
|
||||
VP_LEVELING_FADE_HEIGHT,
|
||||
|
||||
0x0000
|
||||
};
|
||||
|
||||
const uint16_t VPList_AxisSettingsNav[] PROGMEM = {
|
||||
VPList_CommonWithStatus,
|
||||
|
||||
0x0000
|
||||
};
|
||||
|
||||
const uint16_t VPList_AxisSettingsAxis[] PROGMEM = {
|
||||
VPList_CommonWithHeatOnly,
|
||||
|
||||
VP_AXIS_SETTINGS_TITLE_ICON,
|
||||
|
||||
VP_AXIS_SETTINGS_AXIS_STEPSMM,
|
||||
VP_AXIS_SETTINGS_AXIS_MAX_ACCEL,
|
||||
VP_AXIS_SETTINGS_AXIS_JERK,
|
||||
VP_AXIS_SETTINGS_AXIS_FEEDRATE,
|
||||
|
||||
VP_AXIS_TMC_NAV_ICON,
|
||||
|
||||
0x0000
|
||||
};
|
||||
|
||||
const uint16_t VPList_AxisSettingsTMC[] PROGMEM = {
|
||||
VPList_CommonWithHeatOnly,
|
||||
|
||||
VP_AXIS_SETTINGS_AXIS_TMCCURRENT,
|
||||
VP_AXIS_SETTINGS_AXIS_TMCSTEALTHCHOP_ICON,
|
||||
VP_AXIS_SETTINGS_AXIS_TMCHYBRIDTHRESHOLD,
|
||||
|
||||
0x0000
|
||||
};
|
||||
|
||||
const uint16_t VPList_AdvMovementSettings[] PROGMEM = {
|
||||
VPList_CommonWithHeatOnly,
|
||||
|
||||
VP_MOV_MINIMUM_SEGMENT_TIME,
|
||||
VP_MOV_MINIMUM_FEEDRATE,
|
||||
VP_MOV_NORMAL_ACCELERATION,
|
||||
VP_MOV_RETRACT_ACCELERATION,
|
||||
|
||||
VP_MOV_MINIMUM_TRAVEL_FEEDRATE,
|
||||
VP_MOV_MINIMUM_TRAVEL_ACCELERATION,
|
||||
|
||||
0x0000
|
||||
};
|
||||
|
||||
const uint16_t VPList_MiscSettings[] PROGMEM = {
|
||||
VPList_CommonWithHeatOnly,
|
||||
|
||||
VP_FILAMENTRUNOUT_SENSOR_TOGGLE_ICON,
|
||||
|
||||
VP_PLR_TOGGLE_ICON,
|
||||
|
||||
VP_STANDBY_BACKLIGHT_ICON,
|
||||
VP_SCREEN_BACKLIGHT_STANDBY,
|
||||
VP_SCREEN_BACKLIGHT,
|
||||
VP_SCREEN_STANDBY_TIME,
|
||||
VP_RGB_NAV_BUTTON_ICON,
|
||||
|
||||
0x0000
|
||||
};
|
||||
|
||||
const uint16_t VPList_MeshValidation[] PROGMEM = {
|
||||
VPList_CommonWithHeatOnly,
|
||||
|
||||
VP_MESHPATTERN_NOZZLE_TEMP,
|
||||
VP_MESHPATTERN_BED_TEMP,
|
||||
|
||||
VP_MESHPATTERN_BUTTON_ICON,
|
||||
|
||||
0x0000
|
||||
};
|
||||
|
||||
const uint16_t VPList_Calibrate[] PROGMEM = {
|
||||
VPList_CommonWithStatus,
|
||||
|
||||
0x0000
|
||||
};
|
||||
|
||||
const uint16_t VPList_RGB[] PROGMEM = {
|
||||
VPList_CommonWithHeatOnly,
|
||||
|
||||
VP_RGB_CONTROL_R,
|
||||
VP_RGB_CONTROL_G,
|
||||
VP_RGB_CONTROL_B,
|
||||
VP_RGB_CONTROL_W,
|
||||
VP_RGB_CONTROL_I,
|
||||
|
||||
0x0000
|
||||
};
|
||||
|
||||
|
||||
// -- Mapping from screen to variable list
|
||||
const struct VPMapping VPMap[] PROGMEM = {
|
||||
{ DGUSLCD_SCREEN_BOOT, VPList_None },
|
||||
{ DGUSLCD_SCREEN_MAIN, VPList_Main },
|
||||
|
||||
{ DGUSLCD_SCREEN_SDFILELIST, VPList_SDFileList },
|
||||
|
||||
{ DGUSLCD_SCREEN_FILAMENTRUNOUT1, VPList_PrintPausingError },
|
||||
{ DGUSLCD_SCREEN_FILAMENTRUNOUT2, VPList_PrintPausingError },
|
||||
|
||||
{ DGUSLCD_SCREEN_PRINT_FINISH, VPList_PrintScreen },
|
||||
{ DGUSLCD_SCREEN_PRINT_RUNNING, VPList_PrintScreen },
|
||||
{ DGUSLCD_SCREEN_PRINT_PAUSED, VPList_PrintScreen },
|
||||
|
||||
{ DGUSLCD_SCREEN_TUNING, VPList_TuneScreen },
|
||||
{ DGUSLCD_SCREEN_TUNING_EXTRA, VPList_TuneExtraScreen },
|
||||
{ DGUSLCD_SCREEN_PREPARE, VPList_Prepare },
|
||||
|
||||
{ DGUSLCD_SCREEN_INFO, VPList_Info },
|
||||
|
||||
{ DGUSLCD_SCREEN_MOVE1MM, VPList_PrintScreen },
|
||||
{ DGUSLCD_SCREEN_MOVE10MM, VPList_PrintScreen },
|
||||
{ DGUSLCD_SCREEN_MOVE01MM, VPList_PrintScreen },
|
||||
|
||||
{ DGUSLCD_SCREEN_FEED, VPList_Feed },
|
||||
{ DGUSLCD_SCREEN_SETUP, VPList_Control },
|
||||
|
||||
{ DGUSLCD_SCREEN_TEMP, VPList_Temp },
|
||||
{ DGUSLCD_SCREEN_TEMP_PLA, VPList_PreheatPLASettings },
|
||||
{ DGUSLCD_SCREEN_TEMP_ABS, VPList_PreheatABSSettings },
|
||||
|
||||
{ DGUSLCD_SCREEN_INFO, VPList_PrintScreen },
|
||||
{ DGUSLCD_SCREEN_ZOFFSET_LEVEL, VPList_ZOffsetLevel },
|
||||
{ DGUSLCD_SCREEN_LEVELING, VPList_Leveling },
|
||||
|
||||
{ DGUSLCD_SCREEN_POWER_LOSS, VPList_None },
|
||||
{ DGUSLCD_SCREEN_THERMAL_RUNAWAY, VPList_None },
|
||||
{ DGUSLCD_SCREEN_HEATING_FAILED, VPList_None },
|
||||
{ DGUSLCD_SCREEN_THERMISTOR_ERROR, VPList_None },
|
||||
|
||||
{ DGUSLCD_SCREEN_AUTOHOME, VPList_PrintScreen },
|
||||
|
||||
{ DGUSLCD_SCREEN_DIALOG_PAUSE, VPList_None },
|
||||
{ DGUSLCD_SCREEN_DIALOG_STOP, VPList_DialogStop },
|
||||
|
||||
{ DGUSLCD_SCREEN_CONFIRM, VPList_None },
|
||||
{ DGUSLCD_SCREEN_POPUP, VPList_None },
|
||||
|
||||
{ DGUSLCD_SCREEN_ESTEPS_CALIBRATION, VPList_EstepsCalibration },
|
||||
{ DGUSLCD_SCREEN_PIDTUNE_CALIBRATION, VPList_PidTune },
|
||||
|
||||
{ DGUSLCD_SCREEN_TUNEFWRETRACT, VPList_FWRetractTune },
|
||||
|
||||
{ DGUSLCD_SCREEN_ESTEPS_CALIBRATION_RESULTS, VPList_EstepsCalibration },
|
||||
{ DGUSLCD_SCREEN_LEVELING_SETTINGS, VPList_LevelingSettings },
|
||||
|
||||
{ DGUSLCD_SCREEN_AXIS_SETTINGS_NAV, VPList_AxisSettingsNav },
|
||||
{ DGUSLCD_SCREEN_AXIS_SETTINGS_AXIS , VPList_AxisSettingsAxis },
|
||||
{ DGUSLCD_SCREEN_AXIS_SETTINGS_TMC, VPList_AxisSettingsTMC },
|
||||
{ DGUSLCD_SCREEN_ADV_MOV_SETTINGS, VPList_AdvMovementSettings },
|
||||
|
||||
{ DGUSLCD_SCREEN_MISC_SETTINGS, VPList_MiscSettings },
|
||||
{ DGUSLCD_SCREEN_MESH_VALIDATION, VPList_MeshValidation },
|
||||
|
||||
{ DGUSLCD_SCREEN_CALIBRATE, VPList_Calibrate },
|
||||
{ DGUSLCD_SCREEN_RGB, VPList_RGB},
|
||||
|
||||
{ 0 , nullptr } // List is terminated with an nullptr as table entry.
|
||||
};
|
||||
|
||||
// Helper to define a DGUS_VP_Variable for common use cases.
|
||||
#define VPHELPER(VPADR, VPADRVAR, RXFPTR, TXFPTR ) { .VP=VPADR, .memadr=VPADRVAR, .size=sizeof(VPADRVAR), \
|
||||
.set_by_display_handler = RXFPTR, .send_to_display_handler = TXFPTR }
|
||||
|
||||
// Helper to define a DGUS_VP_Variable when the sizeo of the var cannot be determined automaticalyl (eg. a string)
|
||||
#define VPHELPER_STR(VPADR, VPADRVAR, STRLEN, RXFPTR, TXFPTR ) { .VP=VPADR, .memadr=VPADRVAR, .size=STRLEN, \
|
||||
.set_by_display_handler = RXFPTR, .send_to_display_handler = TXFPTR }
|
||||
|
||||
|
||||
const struct DGUS_VP_Variable ListOfVP[] PROGMEM = {
|
||||
// Back button state
|
||||
VPHELPER(VP_BACK_BUTTON_STATE, nullptr, nullptr, ScreenHandler.SendBusyState),
|
||||
|
||||
// Screen version
|
||||
VPHELPER(VP_UI_VERSION_MAJOR, nullptr, ScreenHandler.HandleScreenVersion, nullptr),
|
||||
|
||||
#if HOTENDS >= 1
|
||||
VPHELPER(VP_Flowrate_E0, &planner.flow_percentage[ExtUI::extruder_t::E0], ScreenHandler.HandleFlowRateChanged, &ScreenHandler.DGUSLCD_SendWordValueToDisplay),
|
||||
VPHELPER(VP_T_E0_Is, &thermalManager.temp_hotend[0].celsius, nullptr, ScreenHandler.DGUSLCD_SendFloatAsIntValueToDisplay<0>),
|
||||
VPHELPER(VP_T_E0_Set, &thermalManager.temp_hotend[0].target, ScreenHandler.HandleTemperatureChanged, &ScreenHandler.DGUSLCD_SendWordValueToDisplay),
|
||||
#endif
|
||||
|
||||
#if HAS_HEATED_BED
|
||||
VPHELPER(VP_T_Bed_Is, &thermalManager.temp_bed.celsius, nullptr, ScreenHandler.DGUSLCD_SendFloatAsIntValueToDisplay<0>),
|
||||
VPHELPER(VP_T_Bed_Set, &thermalManager.temp_bed.target, ScreenHandler.HandleTemperatureChanged, &ScreenHandler.DGUSLCD_SendWordValueToDisplay),
|
||||
#endif
|
||||
|
||||
VPHELPER(VP_MESH_LEVEL_TEMP, &thermalManager.temp_hotend[0].target, nullptr, &ScreenHandler.DGUSLCD_SendWordValueToDisplay),
|
||||
|
||||
// Feedrate
|
||||
VPHELPER(VP_Feedrate_Percentage, &feedrate_percentage, ScreenHandler.DGUSLCD_SetValueDirectly<int16_t>, &ScreenHandler.DGUSLCD_SendWordValueToDisplay),
|
||||
|
||||
VPHELPER(VP_PrintProgress_Percentage, nullptr, nullptr, ScreenHandler.DGUSLCD_SendPrintProgressToDisplay),
|
||||
VPHELPER(VP_PrintTimeProgressBar, nullptr, nullptr, ScreenHandler.DGUSLCD_SendPrintProgressToDisplay),
|
||||
|
||||
// Calibration
|
||||
// ... e-steps
|
||||
VPHELPER(VP_ESTEPS_CURRENT, &EstepsHandler::set_esteps, ScreenHandler.DGUSLCD_SetFloatAsIntFromDisplay<1>, ScreenHandler.DGUSLCD_SendFloatAsIntValueToDisplay<1>),
|
||||
VPHELPER(VP_ESTEPS_CALIBRATION_TEMP, &EstepsHandler::calibration_temperature, ScreenHandler.DGUSLCD_SetValueDirectly<uint16_t>, ScreenHandler.DGUSLCD_SendWordValueToDisplay),
|
||||
VPHELPER(VP_ESTEPS_CALIBRATION_LENGTH, &EstepsHandler::filament_to_extrude, ScreenHandler.DGUSLCD_SetFloatAsIntFromDisplay<1>, ScreenHandler.DGUSLCD_SendFloatAsIntValueToDisplay<1>),
|
||||
VPHELPER(VP_ESTEPS_CALIBRATION_MARK_LENGTH, &EstepsHandler::mark_filament_mm, ScreenHandler.DGUSLCD_SetFloatAsIntFromDisplay<1>, ScreenHandler.DGUSLCD_SendFloatAsIntValueToDisplay<1>),
|
||||
VPHELPER(VP_ESTEPS_CALIBRATION_LEFTOVER_LENGTH, &EstepsHandler::remaining_filament, EstepsHandler::HandleRemainingFilament, ScreenHandler.DGUSLCD_SendFloatAsIntValueToDisplay<1>),
|
||||
VPHELPER(VP_ESTEPS_CALCULATED_ESTEPS, &EstepsHandler::calculated_esteps, ScreenHandler.DGUSLCD_SetFloatAsIntFromDisplay<1>, ScreenHandler.DGUSLCD_SendFloatAsIntValueToDisplay<1>),
|
||||
|
||||
VPHELPER(VP_ESTEPS_CALIBRATESTART_BUTTON, nullptr, EstepsHandler::HandleStartButton, nullptr),
|
||||
VPHELPER(VP_ESTEPS_APPLY_BUTTON, nullptr, EstepsHandler::HandleApplyButton, nullptr),
|
||||
VPHELPER(VP_ESTEPS_BACK_BUTTON, nullptr, EstepsHandler::HandleBackButton, nullptr),
|
||||
|
||||
VPHELPER(VP_ESTEP_NAV_BUTTON, nullptr, (ScreenHandler.DGUSLCD_NavigateToPage<DGUSLCD_SCREEN_ESTEPS_CALIBRATION, EstepsHandler>), nullptr),
|
||||
|
||||
// ... PID
|
||||
VPHELPER(VP_PIDTUNE_TARGET_TEMP, &PIDHandler::calibration_temperature, ScreenHandler.DGUSLCD_SetValueDirectly<uint16_t>, ScreenHandler.DGUSLCD_SendWordValueToDisplay),
|
||||
VPHELPER(VP_PIDTUNE_CYCLES, &PIDHandler::cycles, ScreenHandler.DGUSLCD_SetValueDirectly<uint16_t>, ScreenHandler.DGUSLCD_SendWordValueToDisplay),
|
||||
VPHELPER(VP_PIDTUNE_FAN_TOGGLE, &PIDHandler::fan_on, ScreenHandler.DGUSLCD_ToggleBoolean, nullptr),
|
||||
VPHELPER(VP_PIDTUNE_FAN_TOGGLE_ICON, &PIDHandler::fan_on, nullptr, (ScreenHandler.DGUSLCD_SendIconValue<ICON_TOGGLE_ON, ICON_TOGGLE_OFF>)),
|
||||
|
||||
VPHELPER(VP_PIDTUNE_START_BUTTON, nullptr, PIDHandler::HandleStartButton, nullptr),
|
||||
|
||||
VPHELPER(VP_PIDTUNE_NAV_BUTTON, nullptr, (ScreenHandler.DGUSLCD_NavigateToPage<DGUSLCD_SCREEN_PIDTUNE_CALIBRATION, PIDHandler>), nullptr),
|
||||
|
||||
VPHELPER(VP_GENERIC_BACK_BUTTON, nullptr, ScreenHandler.OnBackButton, nullptr),
|
||||
|
||||
#if HAS_MESH
|
||||
// ... Mesh validation
|
||||
VPHELPER(VP_MESHPATTERN_NOZZLE_TEMP, &MeshValidationHandler::nozzle_temperature, MeshValidationHandler::HandleTemperature, ScreenHandler.DGUSLCD_SendWordValueToDisplay),
|
||||
VPHELPER(VP_MESHPATTERN_BED_TEMP, &MeshValidationHandler::bed_temperature, MeshValidationHandler::HandleTemperature, ScreenHandler.DGUSLCD_SendWordValueToDisplay),
|
||||
|
||||
VPHELPER(VP_MESHPATTERN_BUTTON_ICON, &MeshValidationHandler::is_running, nullptr, (ScreenHandler.DGUSLCD_SendIconValue<MESHPATTERN_BUTTON_CANCEL, MESHPATTERN_BUTTON_START>)),
|
||||
|
||||
VPHELPER(VP_MESHPATTERN_START_BUTTON, nullptr, MeshValidationHandler::HandleStartOrCancelButton, nullptr),
|
||||
VPHELPER(VP_MESHPATTERN_NAV_BUTTON, nullptr, (ScreenHandler.DGUSLCD_NavigateToPage<DGUSLCD_SCREEN_MESH_VALIDATION, MeshValidationHandler>), nullptr),
|
||||
#endif
|
||||
|
||||
// Axis settings
|
||||
VPHELPER(VP_AXIS_SETTINGS_NAV_BUTTON, nullptr, AxisSettingsHandler::HandleNavigation, nullptr),
|
||||
VPHELPER(VP_AXIS_SETTINGS_TITLE_ICON, &AxisSettingsHandler::axis_settings_title_icon, nullptr, ScreenHandler.DGUSLCD_SendWordValueToDisplay),
|
||||
|
||||
VPHELPER(VP_AXIS_SETTINGS_AXIS_STEPSMM, &AxisSettingsHandler::axis_steps_mm, ScreenHandler.DGUSLCD_SetFloatAsIntFromDisplay<1>, ScreenHandler.DGUSLCD_SendFloatAsIntValueToDisplay<1>),
|
||||
VPHELPER(VP_AXIS_SETTINGS_AXIS_MAX_ACCEL, &AxisSettingsHandler::max_acceleration_mm_per_s2, ScreenHandler.DGUSLCD_SetValueDirectly<uint16_t>, ScreenHandler.DGUSLCD_SendWordValueToDisplay),
|
||||
|
||||
VPHELPER(VP_AXIS_SETTINGS_AXIS_JERK, &AxisSettingsHandler::jerk, ScreenHandler.DGUSLCD_SetFloatAsIntFromDisplay<1>, ScreenHandler.DGUSLCD_SendFloatAsIntValueToDisplay<1>),
|
||||
VPHELPER(VP_AXIS_SETTINGS_AXIS_FEEDRATE, &AxisSettingsHandler::max_feedrate, ScreenHandler.DGUSLCD_SetFloatAsIntFromDisplay<1>, ScreenHandler.DGUSLCD_SendFloatAsIntValueToDisplay<1>),
|
||||
|
||||
VPHELPER(VP_AXIS_SETTINGS_AXIS_TMCCURRENT, &AxisSettingsHandler::tmc_current, ScreenHandler.DGUSLCD_SetValueDirectly<uint16_t>, ScreenHandler.DGUSLCD_SendWordValueToDisplay),
|
||||
VPHELPER(VP_AXIS_SETTINGS_AXIS_TMCSTEALTHCHOP_BUTTON, &AxisSettingsHandler::stealthchop, ScreenHandler.DGUSLCD_ToggleBoolean, nullptr),
|
||||
VPHELPER(VP_AXIS_SETTINGS_AXIS_TMCSTEALTHCHOP_ICON, &AxisSettingsHandler::stealthchop, nullptr, (ScreenHandler.DGUSLCD_SendIconValue<ICON_TOGGLE_ON, ICON_TOGGLE_OFF>)),
|
||||
VPHELPER(VP_AXIS_SETTINGS_AXIS_TMCHYBRIDTHRESHOLD, &AxisSettingsHandler::hybrid_threshold, ScreenHandler.DGUSLCD_ReceiveULongFromDisplay, ScreenHandler.DGUSLCD_SendULongToDisplay),
|
||||
|
||||
VPHELPER(VP_AXIS_TMC_NAV_ICON, &AxisSettingsHandler::has_tmc_settings, nullptr, (ScreenHandler.DGUSLCD_SendIconValue<AXIS_TMC_NAV_ICON_SHOWING, AXIS_TMC_NAV_ICON_HIDING>)),
|
||||
|
||||
VPHELPER(VP_AXIS_SETTINGS_NAV_BACKBUTTON, nullptr, AxisSettingsHandler::HandleBackNavigation, nullptr),
|
||||
|
||||
VPHELPER(VP_AXIS_TUNING_NAV_BUTTON, nullptr, (ScreenHandler.DGUSLCD_NavigateToPage<DGUSLCD_SCREEN_AXIS_SETTINGS_NAV>), nullptr),
|
||||
VPHELPER(VP_AXIS_TMC_NAV_BUTTON, nullptr, (ScreenHandler.DGUSLCD_NavigateToPage<DGUSLCD_SCREEN_AXIS_SETTINGS_TMC>), nullptr),
|
||||
|
||||
// Advanced movement settings
|
||||
VPHELPER(VP_MOV_NAV_BUTTON, nullptr, (ScreenHandler.DGUSLCD_NavigateToPage<DGUSLCD_SCREEN_ADV_MOV_SETTINGS>), nullptr),
|
||||
|
||||
VPHELPER(VP_MOV_MINIMUM_SEGMENT_TIME, &planner.settings.min_segment_time_us, ScreenHandler.DGUSLCD_SetValueDirectly<uint16_t>, ScreenHandler.DGUSLCD_SendWordValueToDisplay),
|
||||
|
||||
VPHELPER(VP_MOV_MINIMUM_FEEDRATE, &planner.settings.min_feedrate_mm_s, ScreenHandler.DGUSLCD_SetFloatAsIntFromDisplay<1>, ScreenHandler.DGUSLCD_SendFloatAsIntValueToDisplay<1>),
|
||||
VPHELPER(VP_MOV_NORMAL_ACCELERATION, &planner.settings.acceleration, ScreenHandler.DGUSLCD_SetFloatAsIntFromDisplay<1>, ScreenHandler.DGUSLCD_SendFloatAsIntValueToDisplay<1>),
|
||||
VPHELPER(VP_MOV_RETRACT_ACCELERATION, &planner.settings.retract_acceleration, ScreenHandler.DGUSLCD_SetFloatAsLongFromDisplay<1>, ScreenHandler.DGUSLCD_SendFloatAsLongValueToDisplay<1>),
|
||||
|
||||
VPHELPER(VP_MOV_MINIMUM_TRAVEL_FEEDRATE, &planner.settings.min_travel_feedrate_mm_s, ScreenHandler.DGUSLCD_SetFloatAsIntFromDisplay<1>, ScreenHandler.DGUSLCD_SendFloatAsIntValueToDisplay<1>),
|
||||
VPHELPER(VP_MOV_MINIMUM_TRAVEL_ACCELERATION, &planner.settings.travel_acceleration, ScreenHandler.DGUSLCD_SetFloatAsIntFromDisplay<1>, ScreenHandler.DGUSLCD_SendFloatAsIntValueToDisplay<1>),
|
||||
|
||||
// Misc settings
|
||||
VPHELPER(VP_MISCSETTINGS_NAV_BUTTON, nullptr, (ScreenHandler.DGUSLCD_NavigateToPage<DGUSLCD_SCREEN_MISC_SETTINGS>), nullptr),
|
||||
|
||||
#if ENABLED(FILAMENT_RUNOUT_SENSOR)
|
||||
VPHELPER(VP_FILAMENTRUNOUT_SENSOR_TOGGLE_BUTTON, &runout.enabled, ScreenHandler.DGUSLCD_ToggleBoolean, nullptr),
|
||||
VPHELPER(VP_FILAMENTRUNOUT_SENSOR_TOGGLE_ICON, &runout.enabled, nullptr, (ScreenHandler.DGUSLCD_SendIconValue<ICON_TOGGLE_ON, ICON_TOGGLE_OFF>)),
|
||||
#endif
|
||||
|
||||
#if ENABLED(POWER_LOSS_RECOVERY)
|
||||
VPHELPER(VP_PLR_TOGGLE_BUTTON, nullptr, ScreenHandler.TogglePowerLossRecovery, nullptr),
|
||||
VPHELPER(VP_PLR_TOGGLE_ICON, &PrintJobRecovery::enabled, nullptr, (ScreenHandler.DGUSLCD_SendIconValue<ICON_TOGGLE_ON, ICON_TOGGLE_OFF>)),
|
||||
#endif
|
||||
|
||||
// Preheat settings
|
||||
#ifdef PREHEAT_1_LABEL
|
||||
VPHELPER(VP_PREHEAT_PLA_HOTEND_TEMP, &ui.material_preset[0].hotend_temp, ScreenHandler.DGUSLCD_SetValueDirectly<int16_t>, &ScreenHandler.DGUSLCD_SendWordValueToDisplay),
|
||||
VPHELPER(VP_PREHEAT_PLA_BED_TEMP, &ui.material_preset[0].bed_temp, ScreenHandler.DGUSLCD_SetValueDirectly<int16_t>, &ScreenHandler.DGUSLCD_SendWordValueToDisplay),
|
||||
#endif
|
||||
|
||||
#ifdef PREHEAT_2_LABEL
|
||||
VPHELPER(VP_PREHEAT_ABS_HOTEND_TEMP, &ui.material_preset[1].hotend_temp, ScreenHandler.DGUSLCD_SetValueDirectly<int16_t>, &ScreenHandler.DGUSLCD_SendWordValueToDisplay),
|
||||
VPHELPER(VP_PREHEAT_ABS_BED_TEMP, &ui.material_preset[1].bed_temp, ScreenHandler.DGUSLCD_SetValueDirectly<int16_t>, &ScreenHandler.DGUSLCD_SendWordValueToDisplay),
|
||||
#endif
|
||||
|
||||
// About info
|
||||
VPHELPER_STR(VP_MARLIN_WEBSITE, nullptr, VP_MARLIN_WEBSITE_LEN, nullptr, ScreenHandler.DGUSLCD_SendAboutFirmwareWebsite),
|
||||
VPHELPER_STR(VP_MARLIN_VERSION, nullptr, VP_MARLIN_VERSION_LEN, nullptr, ScreenHandler.DGUSLCD_SendAboutFirmwareVersion),
|
||||
VPHELPER_STR(VP_PRINTER_BEDSIZE, nullptr, VP_PRINTER_BEDSIZE_LEN, nullptr, ScreenHandler.DGUSLCD_SendAboutPrintSize),
|
||||
|
||||
// Position Data
|
||||
VPHELPER(VP_X_POSITION, ¤t_position.x, ScreenHandler.HandlePositionChange, ScreenHandler.DGUSLCD_SendFloatAsIntValueToDisplay<1>),
|
||||
VPHELPER(VP_Y_POSITION, ¤t_position.y, ScreenHandler.HandlePositionChange, ScreenHandler.DGUSLCD_SendFloatAsIntValueToDisplay<1>),
|
||||
VPHELPER(VP_Z_POSITION, ¤t_position.z, ScreenHandler.HandlePositionChange, ScreenHandler.DGUSLCD_SendFloatAsIntValueToDisplay<1>),
|
||||
VPHELPER(VP_Z_POSITION_PRECISION, ¤t_position.z, nullptr, ScreenHandler.DGUSLCD_SendFloatAsLongValueToDisplay<2>),
|
||||
|
||||
VPHELPER(SP_X_POSITION, nullptr, nullptr, ScreenHandler.SendAxisTrustValue<X_AXIS>),
|
||||
VPHELPER(SP_Y_POSITION, nullptr, nullptr, ScreenHandler.SendAxisTrustValue<Y_AXIS>),
|
||||
VPHELPER(SP_Z_POSITION, nullptr, nullptr, ScreenHandler.SendAxisTrustValue<Z_AXIS>),
|
||||
|
||||
#if HAS_BED_PROBE
|
||||
VPHELPER(VP_Z_OFFSET, &probe.offset.z, ScreenHandler.HandleZoffsetChange, ScreenHandler.DGUSLCD_SendFloatAsIntValueToDisplay<2>),
|
||||
#elif ENABLED(BABYSTEP_DISPLAY_TOTAL)
|
||||
VPHELPER(VP_Z_OFFSET, nullptr, ScreenHandler.HandleZoffsetChange, nullptr),
|
||||
#endif
|
||||
|
||||
|
||||
VPHELPER(VP_FAN_TOGGLE, &thermalManager.fan_speed[0], nullptr, ScreenHandler.DGUSLCD_SendFanStatusToDisplay),
|
||||
VPHELPER(VP_Fan0_Percentage, &thermalManager.fan_speed[0], ScreenHandler.HandleFanSpeedChanged, ScreenHandler.DGUSLCD_SendFanSpeedToDisplay),
|
||||
|
||||
#if ENABLED(POWER_LOSS_RECOVERY)
|
||||
VPHELPER(VP_POWER_LOSS_RECOVERY, nullptr, &ScreenHandler.HandlePowerLossRecovery, nullptr),
|
||||
#endif
|
||||
|
||||
VPHELPER_STR(VP_PrintTime, nullptr, VP_PrintTime_LEN, nullptr, ScreenHandler.DGUSLCD_SendPrintTimeToDisplay),
|
||||
VPHELPER_STR(VP_PrintTimeWithRemainingVisible, nullptr, VP_PrintTime_LEN, nullptr, ScreenHandler.DGUSLCD_SendPrintTimeWithRemainingToDisplay),
|
||||
VPHELPER_STR(VP_PrintTimeRemaining, nullptr, VP_PrintTimeRemaining_LEN, nullptr, ScreenHandler.DGUSLCD_SendPrintTimeRemainingToDisplay),
|
||||
VPHELPER(VP_SCREENCHANGE, nullptr, ScreenHandler.ScreenChangeHook, nullptr),
|
||||
VPHELPER(VP_CONFIRMED, nullptr, ScreenHandler.ScreenConfirmedOK, nullptr),
|
||||
|
||||
#if HAS_PROBE_SETTINGS
|
||||
VPHELPER(VP_TOGGLE_PROBING_HEATERS_OFF_ONOFF_BUTTON, nullptr, ScreenHandler.HandleToggleProbeHeaters, nullptr),
|
||||
VPHELPER(VP_TOGGLE_PROBING_HEATERS_OFF_ONOFF_ICON, &probe.settings.turn_heaters_off, nullptr, (ScreenHandler.DGUSLCD_SendIconValue<ICON_ACCURACY_TOGGLE_ON, ICON_ACCURACY_TOGGLE_OFF>)),
|
||||
|
||||
VPHELPER(VP_TOGGLE_POST_PROBING_TEMPERATURE_STABILIZATION_BUTTON, nullptr, ScreenHandler.HandleToggleProbeTemperatureStabilization, nullptr),
|
||||
VPHELPER(VP_TOGGLE_POST_PROBING_TEMPERATURE_STABILIZATION_ICON, &probe.settings.stabilize_temperatures_after_probing, nullptr, (ScreenHandler.DGUSLCD_SendIconValue<ICON_POST_PROBE_TEMP_STABILIZATION_TOGGLE_ON, ICON_POST_PROBE_TEMP_STABILIZATION_TOGGLE_OFF>)),
|
||||
|
||||
VPHELPER(VP_TOGGLE_PROBE_PREHEAT_HOTEND_TEMP, &probe.settings.preheat_hotend_temp, ScreenHandler.HandleToggleProbePreheatTemp, ScreenHandler.DGUSLCD_SendWordValueToDisplay),
|
||||
VPHELPER(VP_TOGGLE_PROBE_PREHEAT_BED_TEMP, &probe.settings.preheat_bed_temp, ScreenHandler.HandleToggleProbePreheatTemp, ScreenHandler.DGUSLCD_SendWordValueToDisplay),
|
||||
#endif
|
||||
|
||||
#if HAS_MESH
|
||||
VPHELPER(VP_LEVELING_FADE_HEIGHT, &planner.z_fade_height, ScreenHandler.HandleFadeHeight, ScreenHandler.DGUSLCD_SendFloatAsIntValueToDisplay<1>),
|
||||
#endif
|
||||
|
||||
VPHELPER(VP_LEVELING_NAV_BUTTON, nullptr, (ScreenHandler.DGUSLCD_NavigateToPage<DGUSLCD_SCREEN_ZOFFSET_LEVEL>), nullptr),
|
||||
VPHELPER(VP_LEVELING_EDIT_NAV_BUTTON, nullptr, (ScreenHandler.DGUSLCD_NavigateToPage<DGUSLCD_SCREEN_LEVELING>), nullptr),
|
||||
VPHELPER(VP_TOGGLE_PROBE_SETTINGS_NAV_BUTTON, nullptr, (ScreenHandler.DGUSLCD_NavigateToPage<DGUSLCD_SCREEN_LEVELING_SETTINGS>), nullptr),
|
||||
|
||||
|
||||
// Creality has the same button ID mapped all over the place, so let the generic handler figure it out
|
||||
VPHELPER(VP_BUTTON_MAINENTERKEY, nullptr, DGUSCrealityDisplay_HandleReturnKeyEvent, nullptr),
|
||||
VPHELPER(VP_BUTTON_ADJUSTENTERKEY, nullptr, DGUSCrealityDisplay_HandleReturnKeyEvent, nullptr),
|
||||
VPHELPER(VP_BUTTON_PREPAREENTERKEY, nullptr, DGUSCrealityDisplay_HandleReturnKeyEvent, nullptr),
|
||||
VPHELPER(VP_BUTTON_RESUMEPRINTKEY, nullptr, DGUSCrealityDisplay_HandleReturnKeyEvent, nullptr),
|
||||
VPHELPER(VP_BUTTON_SELECTFILEKEY, nullptr, DGUSCrealityDisplay_HandleReturnKeyEvent, nullptr),
|
||||
VPHELPER(VP_BUTTON_STARTPRINTKEY, nullptr, DGUSCrealityDisplay_HandleReturnKeyEvent, nullptr),
|
||||
VPHELPER(VP_BUTTON_STOPPRINTKEY, nullptr, DGUSCrealityDisplay_HandleReturnKeyEvent, nullptr),
|
||||
VPHELPER(VP_BUTTON_PAUSEPRINTKEY, nullptr, DGUSCrealityDisplay_HandleReturnKeyEvent, nullptr),
|
||||
VPHELPER(VP_BUTTON_COOLDOWN, nullptr, DGUSCrealityDisplay_HandleReturnKeyEvent, nullptr),
|
||||
VPHELPER(VP_BUTTON_TEMPCONTROL, nullptr, DGUSCrealityDisplay_HandleReturnKeyEvent, nullptr),
|
||||
VPHELPER(VP_BUTTON_BEDLEVELKEY, nullptr, DGUSCrealityDisplay_HandleReturnKeyEvent, nullptr),
|
||||
VPHELPER(VP_BUTTON_HEATLOADSTARTKEY, nullptr, DGUSCrealityDisplay_HandleReturnKeyEvent, nullptr),
|
||||
VPHELPER(VP_BUTTON_MOVEKEY, nullptr, DGUSCrealityDisplay_HandleReturnKeyEvent, nullptr),
|
||||
|
||||
// File listing
|
||||
VPHELPER(VP_SD_ScrollEvent, nullptr, ScreenHandler.DGUSLCD_SD_ScrollFilelist, nullptr),
|
||||
VPHELPER(VP_SD_FileSelected, nullptr, ScreenHandler.DGUSLCD_SD_FileSelected, nullptr),
|
||||
VPHELPER(VP_SD_FileSelectConfirm, nullptr, ScreenHandler.DGUSLCD_SD_StartPrint, nullptr),
|
||||
VPHELPER_STR(VP_SD_FileName0, nullptr, VP_SD_FileName_LEN, nullptr, ScreenHandler.DGUSLCD_SD_SendFilename),
|
||||
VPHELPER_STR(VP_SD_FileName1, nullptr, VP_SD_FileName_LEN, nullptr, ScreenHandler.DGUSLCD_SD_SendFilename),
|
||||
VPHELPER_STR(VP_SD_FileName2, nullptr, VP_SD_FileName_LEN, nullptr, ScreenHandler.DGUSLCD_SD_SendFilename),
|
||||
VPHELPER_STR(VP_SD_FileName3, nullptr, VP_SD_FileName_LEN, nullptr, ScreenHandler.DGUSLCD_SD_SendFilename),
|
||||
VPHELPER_STR(VP_SD_FileName4, nullptr, VP_SD_FileName_LEN, nullptr, ScreenHandler.DGUSLCD_SD_SendFilename),
|
||||
VPHELPER_STR(VP_SD_FileName5, nullptr, VP_SD_FileName_LEN, nullptr, ScreenHandler.DGUSLCD_SD_SendFilename),
|
||||
|
||||
// Firmware retract
|
||||
VPHELPER(VP_FWRETRACT_NAV_BUTTON, nullptr, ScreenHandler.DGUSLCD_NavigateToPage<DGUSLCD_SCREEN_TUNEFWRETRACT>, nullptr),
|
||||
|
||||
VPHELPER(VP_FWRETRACT_RETRACT_LENGTH, &fwretract.settings.retract_length, ScreenHandler.DGUSLCD_SetFloatAsIntFromDisplay<1>, ScreenHandler.DGUSLCD_SendFloatAsIntValueToDisplay<1>),
|
||||
VPHELPER(VP_FWRETRACT_RETRACT_FEEDRATE, &fwretract.settings.retract_feedrate_mm_s, ScreenHandler.DGUSLCD_SetFloatAsIntFromDisplay<1>, ScreenHandler.DGUSLCD_SendFloatAsIntValueToDisplay<1>),
|
||||
VPHELPER(VP_FWRETRACT_RETRACT_ZHOP, &fwretract.settings.retract_zraise, ScreenHandler.DGUSLCD_SetFloatAsIntFromDisplay<1>, ScreenHandler.DGUSLCD_SendFloatAsIntValueToDisplay<1>),
|
||||
|
||||
VPHELPER(VP_FWRETRACT_RESTART_LENGTH, &fwretract.settings.retract_recover_extra, ScreenHandler.DGUSLCD_SetFloatAsIntFromDisplay<1>, ScreenHandler.DGUSLCD_SendFloatAsIntValueToDisplay<1>),
|
||||
VPHELPER(VP_FWRETRACT_RESTART_FEEDRATE, &fwretract.settings.retract_recover_feedrate_mm_s, ScreenHandler.DGUSLCD_SetFloatAsIntFromDisplay<1>, ScreenHandler.DGUSLCD_SendFloatAsIntValueToDisplay<1>),
|
||||
|
||||
VPHELPER(VP_FWRETRACT_INDICATOR_ICON, &fwretract.autoretract_enabled, nullptr, (ScreenHandler.DGUSLCD_SendIconValue<ICON_FWRETRACT_AUTO_ENGAGED, ICON_FWRETRACT_AUTO_DISENGAGED>)),
|
||||
VPHELPER(VP_FWRETRACT_TOGGLE_BUTTON_ICON, &fwretract.autoretract_enabled, nullptr, (ScreenHandler.DGUSLCD_SendIconValue<ICON_FWRETRACT_AUTO_TOGGLE_ON, ICON_FWRETRACT_AUTO_TOGGLE_OFF>)),
|
||||
VPHELPER(VP_FWRETRACT_TOGGLE_BUTTON, &fwretract.autoretract_enabled, ScreenHandler.DGUSLCD_ToggleBoolean, nullptr),
|
||||
|
||||
// Other tuning
|
||||
#if ENABLED(LIN_ADVANCE)
|
||||
VPHELPER(VP_LINEAR_ADVANCE_FACTOR, &planner.extruder_advance_K[0], ScreenHandler.DGUSLCD_SetFloatAsIntFromDisplay<2>, ScreenHandler.DGUSLCD_SendFloatAsIntValueToDisplay<2>),
|
||||
#endif
|
||||
|
||||
VPHELPER(VP_OTHER_TUNE_NAV_BUTTON, nullptr, (ScreenHandler.DGUSLCD_NavigateToPage<DGUSLCD_SCREEN_TUNING_EXTRA>), nullptr),
|
||||
|
||||
|
||||
// Additional buttons
|
||||
VPHELPER(VP_MUTE_TOGGLE, nullptr, ScreenHandler.HandleToggleTouchScreenMute, nullptr),
|
||||
VPHELPER(VP_STANDBY_BACKLIGHT_TOGGLE, nullptr, ScreenHandler.HandleToggleTouchScreenStandbySetting, nullptr),
|
||||
|
||||
// Additional settings
|
||||
VPHELPER(VP_SCREEN_BACKLIGHT_STANDBY, &ScreenHandler.Settings.standby_screen_brightness, ScreenHandler.HandleTouchScreenStandbyBrightnessSetting, ScreenHandler.DGUSLCD_SendWordValueToDisplay),
|
||||
VPHELPER(VP_SCREEN_BACKLIGHT, &ScreenHandler.Settings.screen_brightness, ScreenHandler.HandleTouchScreenBrightnessSetting, ScreenHandler.DGUSLCD_SendWordValueToDisplay),
|
||||
VPHELPER(VP_SCREEN_STANDBY_TIME, &ScreenHandler.Settings.standby_time_seconds, ScreenHandler.HandleTouchScreenStandbyTimeSetting, ScreenHandler.DGUSLCD_SendWordValueToDisplay),
|
||||
|
||||
// RGB
|
||||
VPHELPER(VP_RGB_NAV_BUTTON_ICON, &ScreenHandler.HasRGBSettings, nullptr, (ScreenHandler.DGUSLCD_SendIconValue<ICON_RGB_SETTINGS_AVAILABLE, ICON_RGB_SETTINGS_UNAVAILABLE>)),
|
||||
|
||||
#if HAS_COLOR_LEDS
|
||||
VPHELPER(VP_RGB_NAV_BUTTON, nullptr, ScreenHandler.DGUSLCD_NavigateToPage<DGUSLCD_SCREEN_RGB>, nullptr),
|
||||
|
||||
VPHELPER(VP_RGB_CONTROL_R, &leds.color.r, ScreenHandler.HandleLED, ScreenHandler.SendLEDToDisplay),
|
||||
VPHELPER(VP_RGB_CONTROL_G, &leds.color.g, ScreenHandler.HandleLED, ScreenHandler.SendLEDToDisplay),
|
||||
VPHELPER(VP_RGB_CONTROL_B, &leds.color.b, ScreenHandler.HandleLED, ScreenHandler.SendLEDToDisplay),
|
||||
|
||||
#if EITHER(RGBW_LED, NEOPIXEL_LED)
|
||||
VPHELPER(VP_RGB_CONTROL_W, &leds.color.w, ScreenHandler.HandleLED, ScreenHandler.SendLEDToDisplay),
|
||||
|
||||
#if ENABLED(NEOPIXEL_LED)
|
||||
VPHELPER(VP_RGB_CONTROL_I, &leds.color.i, ScreenHandler.HandleLED, ScreenHandler.SendLEDToDisplay),
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// Filament load/unload
|
||||
VPHELPER(VP_FILCHANGE_NAV_BUTTON, nullptr, (ScreenHandler.DGUSLCD_NavigateToPage<DGUSLCD_SCREEN_FEED, FilamentLoadUnloadHandler>), nullptr),
|
||||
|
||||
VPHELPER(VP_FILCHANGE_LENGTH, &FilamentLoadUnloadHandler::length, ScreenHandler.DGUSLCD_SetFloatAsIntFromDisplay<1>, ScreenHandler.DGUSLCD_SendFloatAsIntValueToDisplay<1>),
|
||||
VPHELPER(VP_FILCHANGE_NOZZLE_TEMP, &FilamentLoadUnloadHandler::nozzle_temperature, FilamentLoadUnloadHandler::HandleTemperature, ScreenHandler.DGUSLCD_SendWordValueToDisplay),
|
||||
VPHELPER(VP_FILCHANGE_ACTION_BUTTON, nullptr, FilamentLoadUnloadHandler::HandleLoadUnloadButton, nullptr),
|
||||
|
||||
// Icons
|
||||
#if ENABLED(CASE_LIGHT_ENABLE)
|
||||
VPHELPER(VP_LED_TOGGLE, &caselight.on, nullptr, (ScreenHandler.DGUSLCD_SendIconValue<ICON_LED_TOGGLE_ON, ICON_LED_TOGGLE_OFF>)),
|
||||
#endif
|
||||
VPHELPER(VP_STANDBY_BACKLIGHT_ICON, &ScreenHandler.Settings.display_standby, nullptr, (ScreenHandler.DGUSLCD_SendIconValue<ICON_TOGGLE_ON, ICON_TOGGLE_OFF>)),
|
||||
VPHELPER(VP_MUTE_ICON, &ScreenHandler.Settings.display_sound, nullptr, (ScreenHandler.DGUSLCD_SendIconValue<ICON_SOUND_TOGGLE_ON, ICON_SOUND_TOGGLE_OFF>)),
|
||||
|
||||
// Development test button
|
||||
VPHELPER(VP_DEVELOPMENT_HELPER_BUTTON, nullptr, ScreenHandler.HandleDevelopmentTestButton, nullptr),
|
||||
|
||||
// Mesh override input
|
||||
#if MESH_INPUT_SUPPORTED_SIZE == GRID_MAX_POINTS && HAS_MESH
|
||||
//#define _VPHELPER_GP(N) VPHELPER((VP_MESH_INPUT_X0_Y0 + ( ##N## * MESH_INPUT_DATA_SIZE)), nullptr, ScreenHandler.HandleMeshPoint, nullptr),
|
||||
//REPEAT(MESH_INPUT_SUPPORTED_SIZE, _VPHELPER_GP)
|
||||
|
||||
VPHELPER((VP_MESH_INPUT_X0_Y0 + ( 0 * MESH_INPUT_DATA_SIZE)), nullptr, ScreenHandler.HandleMeshPoint, nullptr),
|
||||
VPHELPER((VP_MESH_INPUT_X0_Y0 + ( 1 * MESH_INPUT_DATA_SIZE)), nullptr, ScreenHandler.HandleMeshPoint, nullptr),
|
||||
VPHELPER((VP_MESH_INPUT_X0_Y0 + ( 2 * MESH_INPUT_DATA_SIZE)), nullptr, ScreenHandler.HandleMeshPoint, nullptr),
|
||||
VPHELPER((VP_MESH_INPUT_X0_Y0 + ( 3 * MESH_INPUT_DATA_SIZE)), nullptr, ScreenHandler.HandleMeshPoint, nullptr),
|
||||
VPHELPER((VP_MESH_INPUT_X0_Y0 + ( 4 * MESH_INPUT_DATA_SIZE)), nullptr, ScreenHandler.HandleMeshPoint, nullptr),
|
||||
VPHELPER((VP_MESH_INPUT_X0_Y0 + ( 5 * MESH_INPUT_DATA_SIZE)), nullptr, ScreenHandler.HandleMeshPoint, nullptr),
|
||||
VPHELPER((VP_MESH_INPUT_X0_Y0 + ( 6 * MESH_INPUT_DATA_SIZE)), nullptr, ScreenHandler.HandleMeshPoint, nullptr),
|
||||
VPHELPER((VP_MESH_INPUT_X0_Y0 + ( 7 * MESH_INPUT_DATA_SIZE)), nullptr, ScreenHandler.HandleMeshPoint, nullptr),
|
||||
VPHELPER((VP_MESH_INPUT_X0_Y0 + ( 8 * MESH_INPUT_DATA_SIZE)), nullptr, ScreenHandler.HandleMeshPoint, nullptr),
|
||||
VPHELPER((VP_MESH_INPUT_X0_Y0 + ( 9 * MESH_INPUT_DATA_SIZE)), nullptr, ScreenHandler.HandleMeshPoint, nullptr),
|
||||
VPHELPER((VP_MESH_INPUT_X0_Y0 + ( 10 * MESH_INPUT_DATA_SIZE)), nullptr, ScreenHandler.HandleMeshPoint, nullptr),
|
||||
VPHELPER((VP_MESH_INPUT_X0_Y0 + ( 11 * MESH_INPUT_DATA_SIZE)), nullptr, ScreenHandler.HandleMeshPoint, nullptr),
|
||||
VPHELPER((VP_MESH_INPUT_X0_Y0 + ( 12 * MESH_INPUT_DATA_SIZE)), nullptr, ScreenHandler.HandleMeshPoint, nullptr),
|
||||
VPHELPER((VP_MESH_INPUT_X0_Y0 + ( 13 * MESH_INPUT_DATA_SIZE)), nullptr, ScreenHandler.HandleMeshPoint, nullptr),
|
||||
VPHELPER((VP_MESH_INPUT_X0_Y0 + ( 14 * MESH_INPUT_DATA_SIZE)), nullptr, ScreenHandler.HandleMeshPoint, nullptr),
|
||||
VPHELPER((VP_MESH_INPUT_X0_Y0 + ( 15 * MESH_INPUT_DATA_SIZE)), nullptr, ScreenHandler.HandleMeshPoint, nullptr),
|
||||
#endif
|
||||
|
||||
// M117 LCD String (We don't need the string in memory but "just" push it to the display on demand, hence the nullptr
|
||||
{ .VP = VP_M117, .memadr = nullptr, .size = VP_M117_LEN, .set_by_display_handler = nullptr, .send_to_display_handler =&ScreenHandler.DGUSLCD_SendStringToDisplay },
|
||||
{ .VP = VP_M117_STATIC, .memadr = nullptr, .size = VP_M117_STATIC_LEN, .set_by_display_handler = nullptr, .send_to_display_handler =&ScreenHandler.DGUSLCD_SendStringToDisplay },
|
||||
|
||||
// Messages for the User, shared by the popup and the kill screen. They cant be autouploaded as we do not buffer content.
|
||||
{ .VP = VP_MSGSTR1, .memadr = nullptr, .size = VP_MSGSTR1_LEN, .set_by_display_handler = nullptr, .send_to_display_handler = &ScreenHandler.DGUSLCD_SendStringToDisplayPGM },
|
||||
{ .VP = VP_MSGSTR2, .memadr = nullptr, .size = VP_MSGSTR2_LEN, .set_by_display_handler = nullptr, .send_to_display_handler = &ScreenHandler.DGUSLCD_SendStringToDisplayPGM },
|
||||
{ .VP = VP_MSGSTR3, .memadr = nullptr, .size = VP_MSGSTR3_LEN, .set_by_display_handler = nullptr, .send_to_display_handler = &ScreenHandler.DGUSLCD_SendStringToDisplayPGM },
|
||||
//{ .VP = VP_MSGSTR4, .memadr = nullptr, .size = VP_MSGSTR4_LEN, .set_by_display_handler = nullptr, .send_to_display_handler = &ScreenHandler.DGUSLCD_SendStringToDisplayPGM },
|
||||
|
||||
VPHELPER(0, 0, 0, 0) // must be last entry.
|
||||
};
|
||||
|
||||
#endif // DGUS_LCD_UI_ORIGIN
|
||||
@@ -0,0 +1,562 @@
|
||||
/**
|
||||
* 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
|
||||
|
||||
enum DGUSLCD_Screens : uint8_t {
|
||||
DGUSLCD_SCREEN_BOOT = 0,
|
||||
|
||||
DGUSLCD_SCREEN_MAIN = 28,
|
||||
|
||||
DGUSLCD_SCREEN_CONFIRM = 66,
|
||||
DGUSLCD_SCREEN_SDPRINTMANIPULATION = 37 ,
|
||||
DGUSLCD_SCREEN_SDPRINTTUNE = 41,
|
||||
DGUSLCD_SCREEN_SDFILELIST = 67,
|
||||
|
||||
DGUSLCD_SCREEN_FILAMENTRUNOUT1 = 34, // DWINTouchPage::ERR_FILAMENTRUNOUT_HOTEND_COLD
|
||||
DGUSLCD_SCREEN_FILAMENTRUNOUT2 = 35, // DWINTouchPage::ERR_FILAMENTRUNOUT_FILAMENT_LOADED
|
||||
|
||||
DGUSLCD_SCREEN_PRINT_FINISH = 36, // DWINTouchPage::PRINT_FINISHED
|
||||
DGUSLCD_SCREEN_PRINT_RUNNING = 37, // DWINTouchPage::PRINT_PROGRESS_RUNNING
|
||||
DGUSLCD_SCREEN_PRINT_PAUSED = 39, // DWINTouchPage::PRINT_PROGRESS_PAUSED
|
||||
|
||||
DGUSLCD_SCREEN_DIALOG_PAUSE = 38, // DWINTouchPage::DIALOG_PAUSE_PRINTING
|
||||
DGUSLCD_SCREEN_DIALOG_STOP = 40, // DWINTouchPage::DIALOG_STOP_PRINTING
|
||||
|
||||
DGUSLCD_SCREEN_TUNING = 41, // DWINTouchPage::MENU_TUNING
|
||||
DGUSLCD_SCREEN_TUNING_EXTRA = 79, // (this is a new page)
|
||||
DGUSLCD_SCREEN_PREPARE = 42, // DWINTouchPage::MENU_PREPARE
|
||||
|
||||
DGUSLCD_SCREEN_MOVE10MM = 43, // DWINTouchPage::MOVE_1MM
|
||||
DGUSLCD_SCREEN_MOVE1MM = 44, // DWINTouchPage::MOVE_10MM
|
||||
DGUSLCD_SCREEN_MOVE01MM = 45, // DWINTouchPage::MOVE_01MM
|
||||
|
||||
DGUSLCD_SCREEN_FEED = 46, // DWINTouchPage::FEED
|
||||
DGUSLCD_SCREEN_SETUP = 47, // DWINTouchPage::MENU_CONTROL
|
||||
|
||||
DGUSLCD_SCREEN_TEMP = 48, // DWINTouchPage::MENU_TEMP
|
||||
DGUSLCD_SCREEN_TEMP_PLA = 49, // DWINTouchPage::MENU_PLA_TEMP
|
||||
DGUSLCD_SCREEN_TEMP_ABS = 50, // DWINTouchPage::MENU_ABS_TEMP
|
||||
|
||||
DGUSLCD_SCREEN_INFO = 51, // DWINTouchPage::MENU_ABOUT
|
||||
|
||||
DGUSLCD_SCREEN_ZOFFSET_LEVEL = 52, // DWINTouchPage::MENU_ZOFFSET_LEVELING
|
||||
DGUSLCD_SCREEN_LEVELING = 53, // DWINTouchPage::LEVELING
|
||||
|
||||
DGUSLCD_SCREEN_POWER_LOSS = 54, // DWINTouchPage::DIALOG_POWER_FAILURE
|
||||
DGUSLCD_SCREEN_THERMAL_RUNAWAY = 57, // DWINTouchPage::ERR_THERMAL_RUNAWAY
|
||||
DGUSLCD_SCREEN_HEATING_FAILED = 58, // DWINTouchPage::ERR_HEATING_FAILED
|
||||
DGUSLCD_SCREEN_THERMISTOR_ERROR = 59, // DWINTouchPage::ERR_THERMISTOR
|
||||
|
||||
DGUSLCD_SCREEN_AUTOHOME = 61, // DWINTouchPage::AUTOHOME_IN_PROGRESS
|
||||
|
||||
DGUSLCD_SCREEN_POPUP = 63, // NEW - does not exist in original display
|
||||
DGUSLCD_SCREEN_KILL = 64, // NEW - does not exist in original display
|
||||
|
||||
DGUSLCD_SCREEN_PIDTUNE_CALIBRATION = 68,
|
||||
DGUSLCD_SCREEN_ESTEPS_CALIBRATION = 69,
|
||||
|
||||
DGUSLCD_SCREEN_TUNEFWRETRACT = 70,
|
||||
|
||||
DGUSLCD_SCREEN_ESTEPS_CALIBRATION_RESULTS = 71,
|
||||
DGUSLCD_SCREEN_LEVELING_SETTINGS = 72,
|
||||
|
||||
DGUSLCD_SCREEN_AXIS_SETTINGS_NAV = 73,
|
||||
DGUSLCD_SCREEN_AXIS_SETTINGS_AXIS = 74,
|
||||
DGUSLCD_SCREEN_AXIS_SETTINGS_TMC = 75,
|
||||
|
||||
DGUSLCD_SCREEN_ADV_MOV_SETTINGS = 76,
|
||||
DGUSLCD_SCREEN_MISC_SETTINGS = 77,
|
||||
DGUSLCD_SCREEN_MESH_VALIDATION = 78,
|
||||
|
||||
DGUSLCD_SCREEN_CALIBRATE = 80,
|
||||
DGUSLCD_SCREEN_RGB = 81
|
||||
};
|
||||
|
||||
// Version checks
|
||||
constexpr uint16_t VP_UI_VERSION_MAJOR = 0xFFFA;
|
||||
constexpr uint16_t EXPECTED_UI_VERSION_MAJOR = 61;
|
||||
constexpr uint16_t VERSION_MISMATCH_BUZZ_AMOUNT = 5;
|
||||
constexpr uint16_t VERSION_MISMATCH_LED_FLASH_DELAY = 1000;
|
||||
|
||||
#define VP_STARTPROGRESSBAR 0x1000
|
||||
|
||||
// // Storage space for the Killscreen messages. Reused for the popup.
|
||||
constexpr uint16_t VP_MSGSTR1 = 0x2010;
|
||||
constexpr uint8_t VP_MSGSTR1_LEN = 0x20; // might be more place for it...
|
||||
constexpr uint16_t VP_MSGSTR2 = 0x2030;
|
||||
constexpr uint8_t VP_MSGSTR2_LEN = 0x40;
|
||||
constexpr uint16_t VP_MSGSTR3 = 0x2070;
|
||||
constexpr uint8_t VP_MSGSTR3_LEN = 0x40;
|
||||
constexpr uint16_t VP_MSGSTR4 = 0x2080;
|
||||
constexpr uint8_t VP_MSGSTR4_LEN = 0x20;
|
||||
|
||||
// // Screenchange request for screens that only make sense when printer is idle.
|
||||
// // e.g movement is only allowed if printer is not printing.
|
||||
// // Marlin must confirm by setting the screen manually.
|
||||
// constexpr uint16_t VP_SCREENCHANGE_ASK = 0x2000;
|
||||
constexpr uint16_t VP_SCREENCHANGE = 0x219f; // Key-Return button to new menu pressed. Data contains target screen in low byte and info in high byte.
|
||||
// constexpr uint16_t VP_TEMP_ALL_OFF = 0x2002; // Turn all heaters off. Value arbitrary ;)=
|
||||
// constexpr uint16_t VP_SCREENCHANGE_WHENSD = 0x2003; // "Print" Button touched -- go only there if there is an SD Card.
|
||||
|
||||
constexpr uint16_t VP_CONFIRMED = 0x219E; // OK on confirm screen.
|
||||
|
||||
// // Buttons on the SD-Card File listing.
|
||||
// constexpr uint16_t VP_SD_ScrollEvent = 0x2020; // Data: 0 for "up a directory", numbers are the amount to scroll, e.g -1 one up, 1 one down
|
||||
// constexpr uint16_t VP_SD_FileSelected = 0x2022; // Number of file field selected.
|
||||
constexpr uint16_t VP_SD_FileSelectConfirm = 0x2024; // (This is a virtual VP and emulated by the Confirm Screen when a file has been confirmed)
|
||||
|
||||
// constexpr uint16_t VP_SD_ResumePauseAbort = 0x2026; // Resume(Data=0), Pause(Data=1), Abort(Data=2) SD Card prints
|
||||
constexpr uint16_t VP_SD_AbortPrintConfirmed = 0x2028; // Abort print confirmation (virtual, will be injected by the confirm dialog)
|
||||
// constexpr uint16_t VP_SD_Print_Setting = 0x2040;
|
||||
// constexpr uint16_t VP_SD_Print_LiveAdjustZ = 0x2050; // Data: 0 down, 1 up
|
||||
|
||||
// // Controls for movement (we can't use the incremental / decremental feature of the display at this feature works only with 16 bit values
|
||||
// // (which would limit us to 655.35mm, which is likely not a problem for common setups, but i don't want to rule out hangprinters support)
|
||||
// // A word about the coding: The VP will be per axis and the return code will be an signed 16 bit value in 0.01 mm resolution, telling us
|
||||
// // the relative travel amount t he user wants to do. So eg. if the display sends us VP=2100 with value 100, the user wants us to move X by +1 mm.
|
||||
constexpr uint16_t VP_MOVE_X = 0x2100;
|
||||
constexpr uint16_t VP_MOVE_Y = 0x2102;
|
||||
constexpr uint16_t VP_MOVE_Z = 0x2104;
|
||||
constexpr uint16_t VP_MOVE_E0 = 0x2110;
|
||||
// constexpr uint16_t VP_MOVE_E1 = 0x2112;
|
||||
// //constexpr uint16_t VP_MOVE_E2 = 0x2114;
|
||||
// //constexpr uint16_t VP_MOVE_E3 = 0x2116;
|
||||
// //constexpr uint16_t VP_MOVE_E4 = 0x2118;
|
||||
// //constexpr uint16_t VP_MOVE_E5 = 0x211A;
|
||||
constexpr uint16_t VP_HOME_ALL = 0x2120;
|
||||
// constexpr uint16_t VP_MOTOR_LOCK_UNLOK = 0x2130;
|
||||
|
||||
// // Power loss recovery
|
||||
// constexpr uint16_t VP_POWER_LOSS_RECOVERY = 0x2180;
|
||||
|
||||
// // Fan Control Buttons , switch between "off" and "on"
|
||||
// constexpr uint16_t VP_FAN0_CONTROL = 0x2200;
|
||||
// constexpr uint16_t VP_FAN1_CONTROL = 0x2202;
|
||||
// //constexpr uint16_t VP_FAN2_CONTROL = 0x2204;
|
||||
// //constexpr uint16_t VP_FAN3_CONTROL = 0x2206;
|
||||
|
||||
// // Heater Control Buttons , triged between "cool down" and "heat PLA" state
|
||||
constexpr uint16_t VP_E0_CONTROL = 0x2210;
|
||||
// constexpr uint16_t VP_E1_CONTROL = 0x2212;
|
||||
// //constexpr uint16_t VP_E2_CONTROL = 0x2214;
|
||||
// //constexpr uint16_t VP_E3_CONTROL = 0x2216;
|
||||
// //constexpr uint16_t VP_E4_CONTROL = 0x2218;
|
||||
// //constexpr uint16_t VP_E5_CONTROL = 0x221A;
|
||||
constexpr uint16_t VP_BED_CONTROL = 0x221C;
|
||||
|
||||
// // Preheat
|
||||
// constexpr uint16_t VP_E0_BED_PREHEAT = 0x2220;
|
||||
// constexpr uint16_t VP_E1_BED_CONTROL = 0x2222;
|
||||
// //constexpr uint16_t VP_E2_BED_CONTROL = 0x2224;
|
||||
// //constexpr uint16_t VP_E3_BED_CONTROL = 0x2226;
|
||||
// //constexpr uint16_t VP_E4_BED_CONTROL = 0x2228;
|
||||
// //constexpr uint16_t VP_E5_BED_CONTROL = 0x222A;
|
||||
|
||||
// // Filament load and unload
|
||||
// constexpr uint16_t VP_E0_FILAMENT_LOAD_UNLOAD = 0x2300;
|
||||
// constexpr uint16_t VP_E1_FILAMENT_LOAD_UNLOAD = 0x2302;
|
||||
|
||||
// // Settings store , reset
|
||||
// constexpr uint16_t VP_SETTINGS = 0x2400;
|
||||
|
||||
// // PID autotune
|
||||
constexpr uint16_t VP_PID_AUTOTUNE_E0 = 0x2410;
|
||||
// //constexpr uint16_t VP_PID_AUTOTUNE_E1 = 0x2412;
|
||||
// //constexpr uint16_t VP_PID_AUTOTUNE_E2 = 0x2414;
|
||||
// //constexpr uint16_t VP_PID_AUTOTUNE_E3 = 0x2416;
|
||||
// //constexpr uint16_t VP_PID_AUTOTUNE_E4 = 0x2418;
|
||||
// //constexpr uint16_t VP_PID_AUTOTUNE_E5 = 0x241A;
|
||||
constexpr uint16_t VP_PID_AUTOTUNE_BED = 0x2420;
|
||||
|
||||
// // Firmware version on the boot screen.
|
||||
constexpr uint16_t VP_PRINTER_BEDSIZE = 0x1074;
|
||||
constexpr uint16_t VP_PRINTER_BEDSIZE_LEN = 12;
|
||||
constexpr uint16_t VP_MARLIN_VERSION = 0x2222;
|
||||
constexpr uint8_t VP_MARLIN_VERSION_LEN = 32;
|
||||
|
||||
constexpr uint16_t VP_MARLIN_WEBSITE = 0x2242;
|
||||
constexpr uint8_t VP_MARLIN_WEBSITE_LEN = 32;
|
||||
|
||||
constexpr uint16_t VP_STANDBY_BACKLIGHT_ICON = 0x2280;
|
||||
constexpr uint16_t VP_STANDBY_BACKLIGHT_TOGGLE = 0x2282;
|
||||
|
||||
constexpr uint16_t VP_MUTE_ICON = 0x2284;
|
||||
constexpr uint16_t VP_MUTE_TOGGLE = 0x2286;
|
||||
|
||||
constexpr uint16_t VP_SCREEN_BACKLIGHT_STANDBY = 0x228D;
|
||||
constexpr uint16_t VP_SCREEN_BACKLIGHT = 0x2384;
|
||||
|
||||
constexpr uint16_t VP_SCREEN_STANDBY_TIME = 0x2386;
|
||||
|
||||
// Material preheat settings
|
||||
constexpr uint16_t VP_PREHEAT_PLA_HOTEND_TEMP = 0x1102;
|
||||
constexpr uint16_t VP_PREHEAT_PLA_BED_TEMP = 0x1104;
|
||||
|
||||
constexpr uint16_t VP_PREHEAT_ABS_HOTEND_TEMP = 0x1108;
|
||||
constexpr uint16_t VP_PREHEAT_ABS_BED_TEMP = 0x110a;
|
||||
|
||||
// Place for status messages.
|
||||
|
||||
// ... We have memory space for scrolling messages
|
||||
constexpr uint16_t VP_M117 = 0x3000 + (3 * 1); // Text Variable Pointer. First three VP must be reserved [a VP is two bytes red.]. Text is saved after the 3rd VP and ended with 0x00 or 0x0F.
|
||||
constexpr uint8_t VP_M117_LEN = 100;
|
||||
|
||||
// ... And memory space for static (short) messages. Note this VPAddr is also the VP of the 5 beta and alpha 4 touch screens.
|
||||
constexpr uint8_t M117_STATIC_DISPLAY_LEN = 28; // Fits "TFT flashed incorrectly v0" exactly
|
||||
constexpr uint16_t VP_M117_STATIC = 0x21B3;
|
||||
constexpr uint8_t VP_M117_STATIC_LEN = 70;
|
||||
|
||||
// // Temperatures.
|
||||
constexpr uint16_t VP_T_E0_Is = 0x1036; // 4 Byte Integer - HEAD_CURRENT_TEMP_VP
|
||||
constexpr uint16_t VP_T_E0_Set = 0x1034; // 2 Byte Integer - HEAD_SET_TEMP_VP
|
||||
|
||||
constexpr uint16_t VP_T_Bed_Is = 0x103c; // 4 Byte Integer - BED_SET_TEMP_VP
|
||||
constexpr uint16_t VP_T_Bed_Set = 0x103A; // 2 Byte Integer - BED_CURRENT_TEMP_VP
|
||||
|
||||
constexpr uint16_t VP_Flowrate_E0 = 0x228A; // 2 Byte Integer
|
||||
|
||||
constexpr uint16_t VP_Fan0_Percentage = 0x228F; // 2 Byte Integer (0..100)
|
||||
|
||||
constexpr uint16_t VP_Feedrate_Percentage = 0x1006; // 2 Byte Integer (0..100) - PRINT_SPEED_RATE_VP
|
||||
constexpr uint16_t VP_PrintProgress_Percentage = 0x1016; // 2 Byte Integer (0..100)
|
||||
|
||||
constexpr uint16_t VP_PrintTimeProgressBar = 0x100E;
|
||||
|
||||
constexpr uint16_t VP_PrintTime = 0x21a0;
|
||||
constexpr uint16_t VP_PrintTimeWithRemainingVisible = 0x2335;
|
||||
constexpr uint16_t VP_PrintTime_LEN = 19;
|
||||
|
||||
constexpr uint16_t VP_PrintTimeRemaining = 0x231f;
|
||||
constexpr uint16_t VP_PrintTimeRemaining_LEN = 21;
|
||||
|
||||
constexpr uint16_t VP_HideRemainingTime_Ico = 0x2380;
|
||||
constexpr uint16_t ICON_REMAINING_VISIBLE = 26;
|
||||
constexpr uint16_t ICON_REMAINING_HIDDEN = 27;
|
||||
|
||||
constexpr uint16_t VP_Z_OFFSET = 0x1026;
|
||||
|
||||
// // SDCard File Listing
|
||||
constexpr uint16_t VP_SD_ScrollEvent = 0x20D4; // Data: 0 for "up a directory", numbers are the amount to scroll, e.g -1 one up, 1 one down
|
||||
constexpr uint16_t VP_SD_FileSelected = 0x2200; // Number of file field selected.
|
||||
constexpr uint16_t VP_SD_FileName_LEN = 21; // LEN is shared for all entries.
|
||||
constexpr uint16_t VP_SD_FileName_CNT = 5; // LEN is shared for all entries.
|
||||
constexpr uint16_t DGUS_SD_FILESPERSCREEN = VP_SD_FileName_CNT; // FIXME move that info to the display and read it from there.
|
||||
constexpr uint16_t VP_SD_FileName0 = 0x20D5;
|
||||
constexpr uint16_t VP_SD_FileName1 = VP_SD_FileName0 + VP_SD_FileName_LEN;
|
||||
constexpr uint16_t VP_SD_FileName2 = VP_SD_FileName1 + VP_SD_FileName_LEN;
|
||||
constexpr uint16_t VP_SD_FileName3 = VP_SD_FileName2 + VP_SD_FileName_LEN;
|
||||
constexpr uint16_t VP_SD_FileName4 = VP_SD_FileName3 + VP_SD_FileName_LEN;
|
||||
constexpr uint16_t VP_SD_FileName5 = VP_SD_FileName4 + VP_SD_FileName_LEN;
|
||||
|
||||
constexpr uint16_t VP_SD_Print_ProbeOffsetZ = 0x32A0; //
|
||||
constexpr uint16_t VP_SD_Print_Filename = 0x2000; //
|
||||
|
||||
constexpr uint16_t VP_ICON_OVERLAY_CLEAR = 10;
|
||||
constexpr uint16_t VP_ICON_OVERLAY_SELECTED = 6;
|
||||
|
||||
// // Step per mm
|
||||
constexpr uint16_t VP_X_STEP_PER_MM = 0x3600;
|
||||
constexpr uint16_t VP_Y_STEP_PER_MM = 0x3604;
|
||||
constexpr uint16_t VP_Z_STEP_PER_MM = 0x3608;
|
||||
constexpr uint16_t VP_E0_STEP_PER_MM = 0x3610;
|
||||
// // PIDs
|
||||
constexpr uint16_t VP_E0_PID_P = 0x3700;
|
||||
constexpr uint16_t VP_E0_PID_I = 0x3702;
|
||||
constexpr uint16_t VP_E0_PID_D = 0x3704;
|
||||
constexpr uint16_t VP_BED_PID_P = 0x3710;
|
||||
constexpr uint16_t VP_BED_PID_I = 0x3712;
|
||||
constexpr uint16_t VP_BED_PID_D = 0x3714;
|
||||
|
||||
// Power loss recovery
|
||||
constexpr uint16_t VP_POWER_LOSS_RECOVERY = 0x105F;
|
||||
|
||||
// Buttons defined by Creality - Don't worry if you're confused by the naming, so am I
|
||||
constexpr uint16_t VP_BUTTON_MAINENTERKEY = 0x1002;
|
||||
constexpr uint16_t VP_BUTTON_ADJUSTENTERKEY = 0x1004;
|
||||
constexpr uint16_t VP_BUTTON_PAUSEPRINTKEY = 0x100A;
|
||||
constexpr uint16_t VP_BUTTON_TEMPCONTROL = 0x1030;
|
||||
constexpr uint16_t VP_BUTTON_COOLDOWN = 0x1032;
|
||||
constexpr uint16_t VP_BUTTON_PREPAREENTERKEY = 0x103E;
|
||||
|
||||
constexpr uint16_t VP_BUTTON_SELECTFILEKEY = 0x20D3;
|
||||
constexpr uint16_t VP_BUTTON_STARTPRINTKEY = 0x20D2;
|
||||
constexpr uint16_t VP_BUTTON_STOPPRINTKEY = 0x1008;
|
||||
constexpr uint16_t VP_BUTTON_RESUMEPRINTKEY = 0x100C;
|
||||
constexpr uint16_t VP_BUTTON_BEDLEVELKEY = 0x1044;
|
||||
|
||||
constexpr uint16_t VP_BUTTON_HEATLOADSTARTKEY = 0x1056;
|
||||
|
||||
// Additional stuff defined by Creality
|
||||
constexpr uint16_t VP_FAN_TOGGLE = 0x101E;
|
||||
constexpr uint16_t VP_LED_TOGGLE = 0x101F;
|
||||
|
||||
// Axis settings
|
||||
constexpr uint16_t VP_AXIS_SETTINGS_NAV_BUTTON = 0x22D9;
|
||||
constexpr uint16_t AXIS_SETTINGS_NAV_BUTTON_VAL_X = 1;
|
||||
constexpr uint16_t AXIS_SETTINGS_NAV_BUTTON_VAL_Y = 2;
|
||||
constexpr uint16_t AXIS_SETTINGS_NAV_BUTTON_VAL_Z = 3;
|
||||
constexpr uint16_t AXIS_SETTINGS_NAV_BUTTON_VAL_E = 4;
|
||||
|
||||
constexpr uint16_t VP_AXIS_SETTINGS_TITLE_ICON = 0x22DB;
|
||||
constexpr uint16_t ICON_AXIS_SETTINGS_TITLE_X = 20;
|
||||
constexpr uint16_t ICON_AXIS_SETTINGS_TITLE_Y = 21;
|
||||
constexpr uint16_t ICON_AXIS_SETTINGS_TITLE_Z = 22;
|
||||
constexpr uint16_t ICON_AXIS_SETTINGS_TITLE_E = 23;
|
||||
|
||||
constexpr uint16_t VP_AXIS_SETTINGS_NAV_BACKBUTTON = 0x22DD;
|
||||
|
||||
constexpr uint16_t VP_AXIS_SETTINGS_AXIS_STEPSMM = 0x22DF; // 2-byte
|
||||
constexpr uint16_t VP_AXIS_SETTINGS_AXIS_MAX_ACCEL = 0x22E1; // 4-byte (!)
|
||||
constexpr uint16_t VP_AXIS_SETTINGS_AXIS_JERK = 0x22E5; // 2-byte
|
||||
constexpr uint16_t VP_AXIS_SETTINGS_AXIS_FEEDRATE = 0x22E7; // 2-byte
|
||||
|
||||
constexpr uint16_t VP_AXIS_SETTINGS_AXIS_TMCCURRENT = 0x22E9; // 2-byte
|
||||
|
||||
constexpr uint16_t VP_AXIS_SETTINGS_AXIS_TMCSTEALTHCHOP_BUTTON = 0x22EB; // 2-byte
|
||||
constexpr uint16_t VP_AXIS_SETTINGS_AXIS_TMCSTEALTHCHOP_ICON = 0x22ED; // 2-byte
|
||||
constexpr uint16_t VP_AXIS_SETTINGS_AXIS_TMCHYBRIDTHRESHOLD = 0x22EF; // 4-byte (!)
|
||||
|
||||
constexpr uint16_t VP_AXIS_TUNING_NAV_BUTTON = 0x22F5;
|
||||
constexpr uint16_t VP_AXIS_TMC_NAV_BUTTON = 0x22F7;
|
||||
|
||||
constexpr uint16_t VP_AXIS_TMC_NAV_ICON = 0x22F3; // 2-byte
|
||||
constexpr uint16_t AXIS_TMC_NAV_ICON_SHOWING = 10;
|
||||
constexpr uint16_t AXIS_TMC_NAV_ICON_HIDING = 11;
|
||||
|
||||
// ... Advanced movement settings
|
||||
constexpr uint16_t VP_MOV_NAV_BUTTON = 0x2305;
|
||||
|
||||
constexpr uint16_t VP_MOV_MINIMUM_SEGMENT_TIME = 0x22F9; // uint 2-byte
|
||||
constexpr uint16_t VP_MOV_MINIMUM_FEEDRATE = 0x22FB; // float 2-byte
|
||||
constexpr uint16_t VP_MOV_NORMAL_ACCELERATION = 0x22FD; // float 2-byte
|
||||
|
||||
constexpr uint16_t VP_MOV_MINIMUM_TRAVEL_FEEDRATE = 0x2301; // float 2-byte
|
||||
constexpr uint16_t VP_MOV_MINIMUM_TRAVEL_ACCELERATION = 0x2303; // float 2-byte
|
||||
|
||||
constexpr uint16_t VP_MOV_RETRACT_ACCELERATION = 0x2307; // float 4-byte
|
||||
|
||||
// Misc settings
|
||||
constexpr uint16_t VP_MISCSETTINGS_NAV_BUTTON = 0x2311;
|
||||
|
||||
constexpr uint16_t VP_FILAMENTRUNOUT_SENSOR_TOGGLE_BUTTON = 0x2309;
|
||||
constexpr uint16_t VP_FILAMENTRUNOUT_SENSOR_TOGGLE_ICON = 0x230b;
|
||||
|
||||
constexpr uint16_t VP_PLR_TOGGLE_BUTTON = 0x230d;
|
||||
constexpr uint16_t VP_PLR_TOGGLE_ICON = 0x230F;
|
||||
|
||||
// Mesh leveling
|
||||
constexpr uint16_t VP_LEVELING_NAV_BUTTON = 0x238a;
|
||||
constexpr uint16_t VP_LEVELING_EDIT_NAV_BUTTON = 0x23A8;
|
||||
|
||||
constexpr uint16_t VP_MESH_SCREEN_MESSAGE_ICON = 0x22cb;
|
||||
constexpr uint16_t MESH_SCREEN_MESSAGE_ICON_LEVELING = 5;
|
||||
constexpr uint16_t MESH_SCREEN_MESSAGE_ICON_VIEWING = 6;
|
||||
|
||||
constexpr uint16_t VP_MESH_LEVEL_TEMP = 0x108A;
|
||||
constexpr uint16_t VP_MESH_LEVEL_STATUS = 0x108D;
|
||||
|
||||
constexpr uint8_t DGUS_GRID_VISUALIZATION_START_ID = GRID_MAX_POINTS > (4*4) ? 30 : 1;
|
||||
|
||||
static_assert(
|
||||
(GRID_MAX_POINTS == 16 && DGUS_GRID_VISUALIZATION_START_ID == 1)|| // CR-6 SE
|
||||
(GRID_MAX_POINTS == 49 && DGUS_GRID_VISUALIZATION_START_ID == 30) || // CR-6 MAX
|
||||
(GRID_MAX_POINTS != 16 && GRID_MAX_POINTS != 49), // Custom Leveling
|
||||
"Incorrect offset selected for leveling config"
|
||||
);
|
||||
static_assert(GRID_MAX_POINTS_X == GRID_MAX_POINTS_Y, "Assuming bed leveling points is square");
|
||||
|
||||
|
||||
constexpr uint16_t VP_MESH_LEVEL_X0_Y0 = 0x1350;
|
||||
constexpr uint16_t SP_MESH_LEVEL_X0_Y0 = 0x5000;
|
||||
|
||||
constexpr uint16_t MESH_LEVEL_EDGE_MAX_POINTS = 4;
|
||||
|
||||
constexpr uint16_t MESH_LEVEL_VP_SIZE = 0x4; // 4-byte native float
|
||||
constexpr uint16_t MESH_LEVEL_SP_SIZE = 0x10; // 0x10 distance
|
||||
|
||||
constexpr uint16_t MESH_LEVEL_VP_EDGE_SIZE = MESH_LEVEL_VP_SIZE * MESH_LEVEL_EDGE_MAX_POINTS;
|
||||
constexpr uint16_t MESH_LEVEL_SP_EDGE_SIZE = MESH_LEVEL_SP_SIZE * MESH_LEVEL_EDGE_MAX_POINTS;
|
||||
|
||||
constexpr uint16_t MESH_LEVEL_MAX_POINTS = MESH_LEVEL_EDGE_MAX_POINTS * MESH_LEVEL_EDGE_MAX_POINTS;
|
||||
|
||||
// Mesh inputs
|
||||
constexpr uint16_t VP_MESH_INPUT_X0_Y0 = 0x2360;
|
||||
|
||||
#define MESH_INPUT_SUPPORTED_X_SIZE 4
|
||||
#define MESH_INPUT_SUPPORTED_Y_SIZE 4
|
||||
#define MESH_INPUT_SUPPORTED_SIZE 16
|
||||
#define MESH_INPUT_DATA_SIZE 2 // 2 byte integer
|
||||
|
||||
// Color table: https://stackoverflow.com/q/13720937/646215
|
||||
// Color picker: https://ee-programming-notepad.blogspot.com/2016/10/16-bit-color-generator-picker.html
|
||||
// Colors below were picked on bed leveling visualizer defaults
|
||||
|
||||
constexpr uint16_t MESH_COLOR_BELOW_ZERO = 0x899B; // Blue
|
||||
constexpr uint16_t MESH_COLOR_NEAR_ZERO = 0x1C80; // Green
|
||||
constexpr uint16_t MESH_COLOR_ABOVE_ZERO = 0xB800; // Purple
|
||||
constexpr uint16_t MESH_COLOR_NOT_MEASURED = 0xFFFF; // White (becomes invisible on white background)
|
||||
|
||||
constexpr float MESH_NEAR_ZERO = 0.020;
|
||||
constexpr float MESH_UNSET_EPSILON = 0.001;
|
||||
|
||||
// Mesh validation pattern
|
||||
constexpr uint16_t VP_MESHPATTERN_NOZZLE_TEMP = 0x2313;
|
||||
constexpr uint16_t VP_MESHPATTERN_BED_TEMP = 0x2315;
|
||||
|
||||
constexpr uint16_t VP_MESHPATTERN_START_BUTTON = 0x2317;
|
||||
constexpr uint16_t VP_MESHPATTERN_BUTTON_ICON = 0x2319;
|
||||
|
||||
constexpr uint16_t VP_MESHPATTERN_NAV_BUTTON = 0x231B;
|
||||
|
||||
constexpr uint16_t MESHPATTERN_BUTTON_START = 24; // This icon does not exist, and will therefore not show
|
||||
constexpr uint16_t MESHPATTERN_BUTTON_CANCEL = 25;
|
||||
|
||||
|
||||
// Movement screen
|
||||
constexpr uint16_t VP_X_POSITION = 0x1048;
|
||||
constexpr uint16_t SP_X_POSITION = 0x4000;
|
||||
constexpr uint16_t VP_Y_POSITION = 0x104A;
|
||||
constexpr uint16_t SP_Y_POSITION = 0x4030;
|
||||
constexpr uint16_t VP_Z_POSITION = 0x104C;
|
||||
constexpr uint16_t VP_Z_POSITION_PRECISION = 0x108F;
|
||||
constexpr uint16_t SP_Z_POSITION = 0x4060;
|
||||
constexpr uint16_t VP_BUTTON_MOVEKEY = 0x1046;
|
||||
|
||||
// Buttons
|
||||
constexpr uint16_t VP_ESTEP_NAV_BUTTON = 0x2291;
|
||||
constexpr uint16_t VP_PIDTUNE_NAV_BUTTON = 0x2293;
|
||||
constexpr uint16_t VP_GENERIC_BACK_BUTTON = 0x2295; // Generic button for popping back to the old display
|
||||
|
||||
constexpr uint16_t GENERIC_BACK_BUTTON_NEED_SAVE = 0x1;
|
||||
|
||||
// PID tuning
|
||||
constexpr uint16_t VP_PIDTUNE_TARGET_TEMP = 0x2297;
|
||||
constexpr uint16_t VP_PIDTUNE_CYCLES = 0x2299;
|
||||
constexpr uint16_t VP_PIDTUNE_FAN_TOGGLE = 0x238C;
|
||||
constexpr uint16_t VP_PIDTUNE_FAN_TOGGLE_ICON = 0x238E;
|
||||
constexpr uint16_t VP_PIDTUNE_START_BUTTON = 0x229B;
|
||||
|
||||
// FWRetract
|
||||
constexpr uint16_t VP_FWRETRACT_NAV_BUTTON = 0x22AD;
|
||||
|
||||
constexpr uint16_t VP_FWRETRACT_RETRACT_LENGTH = 0x22B1;
|
||||
constexpr uint16_t VP_FWRETRACT_RETRACT_FEEDRATE = 0x22B3;
|
||||
constexpr uint16_t VP_FWRETRACT_RETRACT_ZHOP = 0x22B5;
|
||||
|
||||
constexpr uint16_t VP_FWRETRACT_RESTART_LENGTH = 0x22B7;
|
||||
constexpr uint16_t VP_FWRETRACT_RESTART_FEEDRATE = 0x22B9;
|
||||
|
||||
constexpr uint16_t VP_FWRETRACT_TOGGLE_BUTTON = 0x22BB;
|
||||
constexpr uint16_t VP_FWRETRACT_TOGGLE_BUTTON_ICON = 0x22BD;
|
||||
constexpr uint16_t VP_FWRETRACT_INDICATOR_ICON = 0x22BF;
|
||||
|
||||
// Other tuning
|
||||
constexpr uint16_t VP_LINEAR_ADVANCE_FACTOR = 0x22AF;
|
||||
|
||||
constexpr uint16_t VP_OTHER_TUNE_NAV_BUTTON = 0x2382;
|
||||
|
||||
// Leveling settings
|
||||
constexpr uint16_t VP_TOGGLE_PROBING_HEATERS_OFF_ONOFF_BUTTON = 0x22C1;
|
||||
constexpr uint16_t VP_TOGGLE_PROBING_HEATERS_OFF_ONOFF_ICON = 0x22C3;
|
||||
|
||||
constexpr uint16_t VP_TOGGLE_PROBE_PREHEAT_HOTEND_TEMP = 0x22C5;
|
||||
constexpr uint16_t VP_TOGGLE_PROBE_PREHEAT_BED_TEMP = 0x22C7;
|
||||
|
||||
constexpr uint16_t VP_TOGGLE_PROBE_SETTINGS_NAV_BUTTON = 0x22C9;
|
||||
|
||||
constexpr uint16_t VP_TOGGLE_POST_PROBING_TEMPERATURE_STABILIZATION_ICON = 0x22CD;
|
||||
constexpr uint16_t VP_TOGGLE_POST_PROBING_TEMPERATURE_STABILIZATION_BUTTON = 0x22CF;
|
||||
|
||||
constexpr uint16_t VP_LEVELING_FADE_HEIGHT = 0x231D;
|
||||
|
||||
// E-steps calibration
|
||||
constexpr uint16_t VP_ESTEPS_CURRENT = 0x229d;
|
||||
constexpr uint16_t VP_ESTEPS_CALIBRATION_TEMP = 0x229f;
|
||||
constexpr uint16_t VP_ESTEPS_CALIBRATION_LENGTH = 0x22a1;
|
||||
constexpr uint16_t VP_ESTEPS_CALIBRATION_MARK_LENGTH = 0x22ab;
|
||||
constexpr uint16_t VP_ESTEPS_CALIBRATION_LEFTOVER_LENGTH = 0x22a3;
|
||||
constexpr uint16_t VP_ESTEPS_CALCULATED_ESTEPS = 0x22a5;
|
||||
constexpr uint16_t VP_ESTEPS_CALIBRATESTART_BUTTON = 0x22a7;
|
||||
constexpr uint16_t VP_ESTEPS_APPLY_BUTTON = 0x22a9;
|
||||
constexpr uint16_t VP_ESTEPS_BACK_BUTTON = 0x22D7;
|
||||
|
||||
// RGB
|
||||
constexpr uint16_t VP_RGB_NAV_BUTTON = 0x2390;
|
||||
|
||||
constexpr uint16_t VP_RGB_CONTROL_R = 0x2392;
|
||||
constexpr uint16_t VP_RGB_CONTROL_G = 0x2394;
|
||||
constexpr uint16_t VP_RGB_CONTROL_B = 0x2396;
|
||||
constexpr uint16_t VP_RGB_CONTROL_W = 0x2398;
|
||||
constexpr uint16_t VP_RGB_CONTROL_I = 0x239A; // brightness
|
||||
|
||||
constexpr uint16_t VP_RGB_NAV_BUTTON_ICON = 0x239E;
|
||||
constexpr uint16_t ICON_RGB_SETTINGS_AVAILABLE = 28;
|
||||
constexpr uint16_t ICON_RGB_SETTINGS_UNAVAILABLE = 29;
|
||||
|
||||
// Filament load/unload
|
||||
constexpr uint16_t VP_FILCHANGE_NAV_BUTTON = 0x23a6;
|
||||
|
||||
constexpr uint16_t VP_FILCHANGE_NOZZLE_TEMP = 0x23a0;
|
||||
constexpr uint16_t VP_FILCHANGE_LENGTH = 0x23a2;
|
||||
|
||||
constexpr uint16_t VP_FILCHANGE_ACTION_BUTTON = 0x23a4;
|
||||
constexpr uint16_t FILCHANGE_ACTION_UNLOAD_BUTTON = 1;
|
||||
constexpr uint16_t FILCHANGE_ACTION_LOAD_BUTTON = 2;
|
||||
|
||||
// Icons
|
||||
constexpr uint16_t ICON_TOGGLE_ON = 1;
|
||||
constexpr uint16_t ICON_TOGGLE_OFF = 2;
|
||||
|
||||
constexpr uint16_t ICON_BACK_BUTTON_ENABLED = 7;
|
||||
constexpr uint16_t ICON_BACK_BUTTON_DISABLED = 8;
|
||||
|
||||
constexpr uint16_t ICON_THROBBER_ANIM_OFF = 0;
|
||||
constexpr uint16_t ICON_THROBBER_ANIM_ON = 1;
|
||||
|
||||
// Allow to visually disable/enable the back button
|
||||
constexpr uint16_t VP_BACK_BUTTON_STATE = 0x22D1;
|
||||
|
||||
// Throbber animation
|
||||
constexpr uint16_t VP_BUSY_ANIM_STATE = 0x22D3;
|
||||
|
||||
// Toggles
|
||||
constexpr uint16_t ICON_FAN_TOGGLE_ON = 1;
|
||||
constexpr uint16_t ICON_FAN_TOGGLE_OFF = 2;
|
||||
constexpr uint16_t ICON_LED_TOGGLE_ON = 3;
|
||||
constexpr uint16_t ICON_LED_TOGGLE_OFF = 4;
|
||||
constexpr uint16_t ICON_SOUND_TOGGLE_ON = 5;
|
||||
constexpr uint16_t ICON_SOUND_TOGGLE_OFF = 6;
|
||||
constexpr uint16_t ICON_FWRETRACT_AUTO_TOGGLE_ON = 9;
|
||||
constexpr uint16_t ICON_FWRETRACT_AUTO_TOGGLE_OFF = 10;
|
||||
constexpr uint16_t ICON_ACCURACY_TOGGLE_ON = 11;
|
||||
constexpr uint16_t ICON_ACCURACY_TOGGLE_OFF = 12;
|
||||
constexpr uint16_t ICON_POST_PROBE_TEMP_STABILIZATION_TOGGLE_ON = 13;
|
||||
constexpr uint16_t ICON_POST_PROBE_TEMP_STABILIZATION_TOGGLE_OFF = 14;
|
||||
|
||||
constexpr uint16_t ICON_FWRETRACT_AUTO_DISENGAGED = 4; // This icon deliberately does not exist
|
||||
constexpr uint16_t ICON_FWRETRACT_AUTO_ENGAGED = 3;
|
||||
|
||||
// Development helper
|
||||
constexpr uint16_t VP_DEVELOPMENT_HELPER_BUTTON = 0x22D5;
|
||||
constexpr uint16_t VP_DEVELOPMENT_HELPER_BUTTON_ACTION_FIRMWARE_UPDATE = 2;
|
||||
constexpr uint16_t VP_DEVELOPMENT_HELPER_BUTTON_ACTION_TO_MAIN_MENU = 4;
|
||||
constexpr uint16_t VP_DEVELOPMENT_HELPER_BUTTON_ACTION_RESET_DISPLAY = 8;
|
||||
@@ -0,0 +1,188 @@
|
||||
|
||||
#include "../../../../inc/MarlinConfigPre.h"
|
||||
|
||||
#if ENABLED(DGUS_LCD_UI_CREALITY_TOUCH)
|
||||
|
||||
#include "../DGUSDisplayDef.h"
|
||||
#include "../DGUSDisplay.h"
|
||||
#include "../DGUSScreenHandler.h"
|
||||
|
||||
#include "EstepsHandler.h"
|
||||
|
||||
#include "../../ui_api.h"
|
||||
#include "../../../marlinui.h"
|
||||
|
||||
#include "../../../../module/temperature.h"
|
||||
#include "../../../../module/settings.h"
|
||||
#include "../../../../module/planner.h"
|
||||
#include "../../../../gcode/gcode.h"
|
||||
|
||||
// Storage init
|
||||
float EstepsHandler::set_esteps = 0;
|
||||
float EstepsHandler::calculated_esteps = 0;
|
||||
float EstepsHandler::remaining_filament = 0;
|
||||
float EstepsHandler::mark_filament_mm = 0;
|
||||
float EstepsHandler::filament_to_extrude = 0;
|
||||
celsius_t EstepsHandler::calibration_temperature = 0;
|
||||
|
||||
void EstepsHandler::Init() {
|
||||
// Use steps
|
||||
set_esteps = ExtUI::getAxisSteps_per_mm(ExtUI::E0);
|
||||
calculated_esteps = 0;
|
||||
|
||||
// Reset
|
||||
filament_to_extrude = 100;
|
||||
mark_filament_mm = 120;
|
||||
remaining_filament = 0;
|
||||
|
||||
// Use configured PLA temps + 10 degrees
|
||||
calibration_temperature = ui.material_preset[0].hotend_temp + 10;
|
||||
|
||||
// Welcome message
|
||||
SetStatusMessage(PSTR("Ready"));
|
||||
}
|
||||
|
||||
|
||||
void EstepsHandler::HandleStartButton(DGUS_VP_Variable &var, void *val_ptr) {
|
||||
//static_assert(ADVANCED_PAUSE_PURGE_LENGTH == 0, "Assuming PURGE_LENGTH is 0 so we can use M701");
|
||||
|
||||
// Validate
|
||||
if (calibration_temperature < EXTRUDE_MINTEMP) {
|
||||
SetStatusMessage(PSTR("Invalid temperature set"));
|
||||
return;
|
||||
}
|
||||
|
||||
if (filament_to_extrude < 10) {
|
||||
SetStatusMessage(PSTR("Invalid extrusion length set"));
|
||||
return;
|
||||
}
|
||||
|
||||
if (mark_filament_mm < filament_to_extrude) {
|
||||
SetStatusMessage(PSTR("Invalid mark length set"));
|
||||
return;
|
||||
}
|
||||
|
||||
// Synchronous operation - disable back button
|
||||
DGUSSynchronousOperation syncOperation;
|
||||
syncOperation.start();
|
||||
|
||||
// Prepare
|
||||
bool zAxisWasRelative = GcodeSuite::axis_is_relative(Z_AXIS);
|
||||
bool eAxisWasRelative = GcodeSuite::axis_is_relative(E_AXIS);
|
||||
#if ENABLED(LIN_ADVANCE)
|
||||
float kFactor = planner.extruder_advance_K[0];
|
||||
#endif
|
||||
|
||||
GcodeSuite::set_e_relative();
|
||||
GcodeSuite::set_relative_mode(true);
|
||||
#if ENABLED(LIN_ADVANCE)
|
||||
planner.extruder_advance_K[0] = 0;
|
||||
#endif
|
||||
|
||||
ExtUI::injectCommands_P("G0 Z5 F150");
|
||||
queue.advance();
|
||||
|
||||
// Heat up if necessary
|
||||
if (abs(ExtUI::getActualTemp_celsius(ExtUI::E0) - calibration_temperature) > 2) {
|
||||
thermalManager.setTargetHotend(calibration_temperature, ExtUI::H0);
|
||||
|
||||
SetStatusMessage(PSTR("Heating up..."));
|
||||
thermalManager.wait_for_hotend(ExtUI::H0, false);
|
||||
}
|
||||
|
||||
planner.synchronize();
|
||||
|
||||
// Set-up command
|
||||
SetStatusMessage(PSTR("Extruding..."));
|
||||
|
||||
char cmd[64];
|
||||
sprintf_P(cmd, PSTR("G1 E%f F50"), filament_to_extrude);
|
||||
|
||||
ExtUI::injectCommands(cmd);
|
||||
queue.advance();
|
||||
planner.synchronize();
|
||||
|
||||
// Restore position
|
||||
ExtUI::injectCommands_P("G0 Z-5 F150");
|
||||
queue.advance();
|
||||
planner.synchronize();
|
||||
|
||||
// Restore defaults
|
||||
if (!zAxisWasRelative) GcodeSuite::set_relative_mode(false);
|
||||
if (!eAxisWasRelative) GcodeSuite::set_e_absolute();
|
||||
#if ENABLED(LIN_ADVANCE)
|
||||
planner.extruder_advance_K[0] = kFactor;
|
||||
#endif
|
||||
|
||||
// Done
|
||||
ScreenHandler.GotoScreen(DGUSLCD_SCREEN_ESTEPS_CALIBRATION_RESULTS, false);
|
||||
ScreenHandler.Buzzer(0, 250);
|
||||
syncOperation.done();
|
||||
SetStatusMessage(PSTR("Measure remaining filament"));
|
||||
}
|
||||
|
||||
void EstepsHandler::HandleApplyButton(DGUS_VP_Variable &var, void *val_ptr) {
|
||||
if (abs(calculated_esteps) < 1) {
|
||||
// User intented to set e-steps directly
|
||||
ExtUI::setAxisSteps_per_mm(set_esteps, ExtUI::E0);
|
||||
} else {
|
||||
ExtUI::setAxisSteps_per_mm(calculated_esteps, ExtUI::E0);
|
||||
}
|
||||
|
||||
SaveSettingsAndReturn(true);
|
||||
}
|
||||
|
||||
void EstepsHandler::HandleBackButton(DGUS_VP_Variable &var, void *val_ptr) {
|
||||
// User intented to set e-steps directly
|
||||
ExtUI::setAxisSteps_per_mm(set_esteps, ExtUI::E0);
|
||||
|
||||
SaveSettingsAndReturn(false);
|
||||
}
|
||||
|
||||
void EstepsHandler::SaveSettingsAndReturn(bool fullConfirm) {
|
||||
// Save & reset
|
||||
settings.save();
|
||||
|
||||
if (fullConfirm) ScreenHandler.Buzzer(0, 250);
|
||||
|
||||
ScreenHandler.PopToOldScreen();
|
||||
if (fullConfirm) ScreenHandler.GotoScreen(DGUSLCD_SCREEN_MAIN, false);
|
||||
|
||||
SetStatusMessage(PSTR("New e-steps value saved"));
|
||||
}
|
||||
|
||||
void EstepsHandler::HandleRemainingFilament(DGUS_VP_Variable &var, void *val_ptr) {
|
||||
ScreenHandler.DGUSLCD_SetFloatAsIntFromDisplay<1>(var, val_ptr);
|
||||
|
||||
// Calculate
|
||||
constexpr float precision = 0.01;
|
||||
float actualExtrusion = mark_filament_mm - remaining_filament;
|
||||
if (actualExtrusion < (-precision)) {
|
||||
SetStatusMessage(PSTR("Mark filament further"));
|
||||
return;
|
||||
}
|
||||
|
||||
if (actualExtrusion < precision) {
|
||||
SetStatusMessage(PSTR("E-steps are correct"));
|
||||
calculated_esteps = set_esteps;
|
||||
return;
|
||||
}
|
||||
|
||||
float current_steps = ExtUI::getAxisSteps_per_mm(ExtUI::E0);
|
||||
SERIAL_ECHOLNPGM("Current steps: ", current_steps);
|
||||
SERIAL_ECHOLNPGM("Actual extrusion: ", actualExtrusion);
|
||||
|
||||
float new_steps = (current_steps * filament_to_extrude) / actualExtrusion;
|
||||
SERIAL_ECHOLNPGM("New steps: ", new_steps);
|
||||
|
||||
calculated_esteps = new_steps;
|
||||
|
||||
// Status update
|
||||
SetStatusMessage(PSTR("Calculated new e-steps"));
|
||||
}
|
||||
|
||||
void EstepsHandler::SetStatusMessage(PGM_P statusMessage) {
|
||||
ScreenHandler.setstatusmessagePGM(statusMessage);
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,29 @@
|
||||
#pragma once
|
||||
|
||||
#include <cstdint>
|
||||
|
||||
class EstepsHandler {
|
||||
public:
|
||||
static void Init();
|
||||
|
||||
static void HandleStartButton(DGUS_VP_Variable &var, void *val_ptr);
|
||||
static void HandleApplyButton(DGUS_VP_Variable &var, void *val_ptr);
|
||||
static void HandleBackButton(DGUS_VP_Variable &var, void *val_ptr);
|
||||
|
||||
static void HandleRemainingFilament(DGUS_VP_Variable &var, void *val_ptr);
|
||||
|
||||
public:
|
||||
static float set_esteps;
|
||||
static float calculated_esteps;
|
||||
|
||||
static float mark_filament_mm;
|
||||
static float remaining_filament;
|
||||
|
||||
static float filament_to_extrude;
|
||||
static celsius_t calibration_temperature;
|
||||
|
||||
private:
|
||||
static void SaveSettingsAndReturn(bool fullConfirm);
|
||||
static void SetStatusMessage(PGM_P statusMessage);
|
||||
};
|
||||
|
||||
@@ -0,0 +1,106 @@
|
||||
#include "../../../../inc/MarlinConfigPre.h"
|
||||
|
||||
#if ENABLED(DGUS_LCD_UI_CREALITY_TOUCH)
|
||||
|
||||
#include "../DGUSDisplayDef.h"
|
||||
#include "../DGUSDisplay.h"
|
||||
#include "../DGUSScreenHandler.h"
|
||||
|
||||
#include "FilamentLoadUnloadHandler.h"
|
||||
|
||||
#include "../../ui_api.h"
|
||||
#include "../../../marlinui.h"
|
||||
|
||||
#include "../../../../module/temperature.h"
|
||||
#include "../../../../module/settings.h"
|
||||
#include "../../../../module/planner.h"
|
||||
#include "../../../../gcode/gcode.h"
|
||||
|
||||
celsius_t FilamentLoadUnloadHandler::nozzle_temperature = 0;
|
||||
float FilamentLoadUnloadHandler::length = 0;
|
||||
|
||||
void FilamentLoadUnloadHandler::Init() {
|
||||
nozzle_temperature = ui.material_preset[0].hotend_temp;
|
||||
length = 150;
|
||||
|
||||
if (ExtUI::isPrinting()) {
|
||||
nozzle_temperature = ExtUI::getTargetTemp_celsius(ExtUI::extruder_t::E0);
|
||||
}
|
||||
}
|
||||
|
||||
void FilamentLoadUnloadHandler::HandleTemperature(DGUS_VP_Variable &var, void *val_ptr) {
|
||||
ScreenHandler.DGUSLCD_SetValueDirectly<uint16_t>(var, val_ptr);
|
||||
|
||||
ValidateTemperatures();
|
||||
}
|
||||
|
||||
void FilamentLoadUnloadHandler::HandleLoadUnloadButton(DGUS_VP_Variable &var, void *val_ptr) {
|
||||
// Common for load/unload -> determine minimum temperature
|
||||
if (length < 0.1) {
|
||||
SetStatusMessage("Invalid feed length");
|
||||
return;
|
||||
}
|
||||
|
||||
if (ExtUI::isPrinting() && !ExtUI::isPrintingPaused()) {
|
||||
SetStatusMessage(PSTR("Finish Printing First"));
|
||||
return;
|
||||
}
|
||||
|
||||
DGUSSynchronousOperation syncOperation;
|
||||
uint16_t button_value = uInt16Value(val_ptr);
|
||||
switch (button_value) {
|
||||
case FILCHANGE_ACTION_LOAD_BUTTON:
|
||||
syncOperation.start();
|
||||
|
||||
ChangeFilamentWithTemperature(PSTR("M701 L%f P0"));
|
||||
|
||||
syncOperation.done();
|
||||
break;
|
||||
|
||||
case FILCHANGE_ACTION_UNLOAD_BUTTON:
|
||||
syncOperation.start();
|
||||
|
||||
ChangeFilamentWithTemperature(PSTR("M702 U%f"));
|
||||
|
||||
syncOperation.done();
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void FilamentLoadUnloadHandler::ValidateTemperatures() {
|
||||
LIMIT(nozzle_temperature, EXTRUDE_MINTEMP, HEATER_0_MAXTEMP - HOTEND_OVERSHOOT);
|
||||
}
|
||||
|
||||
void FilamentLoadUnloadHandler::ChangeFilamentWithTemperature(PGM_P command) {
|
||||
// Heat if necessary
|
||||
if (ExtUI::getActualTemp_celsius(ExtUI::E0) < nozzle_temperature && abs(ExtUI::getActualTemp_celsius(ExtUI::E0) - nozzle_temperature) > THERMAL_PROTECTION_HYSTERESIS) {
|
||||
SetStatusMessage(PSTR("Heating up..."));
|
||||
|
||||
uint16_t target_celsius = nozzle_temperature;
|
||||
NOMORE(target_celsius, thermalManager.hotend_max_target(0));
|
||||
|
||||
thermalManager.setTargetHotend(target_celsius, ExtUI::H0);
|
||||
thermalManager.wait_for_hotend(ExtUI::H0, false);
|
||||
}
|
||||
|
||||
// Inject load filament command
|
||||
SetStatusMessage(PSTR("Filament load/unload..."));
|
||||
|
||||
char cmd[64];
|
||||
sprintf_P(cmd, command, length);
|
||||
|
||||
// Handle commands
|
||||
SERIAL_ECHOPGM("Injecting command: ", cmd);
|
||||
GcodeSuite::process_subcommands_now(cmd);
|
||||
SERIAL_ECHOPGM_P("- done");
|
||||
|
||||
if (ScreenHandler.Settings.display_sound) ScreenHandler.Buzzer(500, 100);
|
||||
SetStatusMessage(PSTR("Filament load/unload complete"));
|
||||
}
|
||||
|
||||
void FilamentLoadUnloadHandler::SetStatusMessage(PGM_P statusMessage) {
|
||||
ScreenHandler.setstatusmessagePGM(statusMessage);
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,22 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <cstdint>
|
||||
|
||||
class FilamentLoadUnloadHandler {
|
||||
public:
|
||||
static void Init();
|
||||
|
||||
static void HandleTemperature(DGUS_VP_Variable &var, void *val_ptr);
|
||||
static void HandleLoadUnloadButton(DGUS_VP_Variable &var, void *val_ptr);
|
||||
|
||||
public:
|
||||
static celsius_t nozzle_temperature;
|
||||
static float length;
|
||||
|
||||
private:
|
||||
static void ValidateTemperatures();
|
||||
static void ChangeFilamentWithTemperature(PGM_P command);
|
||||
static void SetStatusMessage(PGM_P statusMessage);
|
||||
};
|
||||
|
||||
@@ -0,0 +1,150 @@
|
||||
|
||||
#include "../../../../inc/MarlinConfigPre.h"
|
||||
|
||||
#if ENABLED(DGUS_LCD_UI_CREALITY_TOUCH) && HAS_MESH
|
||||
|
||||
#include "../DGUSDisplayDef.h"
|
||||
#include "../DGUSDisplay.h"
|
||||
#include "../DGUSScreenHandler.h"
|
||||
|
||||
#include "MeshValidationHandler.h"
|
||||
|
||||
#include "../../ui_api.h"
|
||||
#include "../../../marlinui.h"
|
||||
|
||||
#include "../../../../module/temperature.h"
|
||||
#include "../../../../module/settings.h"
|
||||
#include "../../../../module/planner.h"
|
||||
#include "../../../../gcode/gcode.h"
|
||||
|
||||
celsius_t MeshValidationHandler::nozzle_temperature;
|
||||
celsius_t MeshValidationHandler::bed_temperature;
|
||||
bool MeshValidationHandler::is_running;
|
||||
bool MeshValidationHandler::started_from_screen;
|
||||
bool MeshValidationHandler::is_cancelling;
|
||||
feedRate_t MeshValidationHandler::prev_feedrate;
|
||||
|
||||
void MeshValidationHandler::Init() {
|
||||
// Set to PLA pre-heat temps by default
|
||||
nozzle_temperature = ui.material_preset[0].hotend_temp;
|
||||
bed_temperature = ui.material_preset[0].bed_temp;
|
||||
|
||||
ValidateTemperatures();
|
||||
}
|
||||
|
||||
void MeshValidationHandler::HandleTemperature(DGUS_VP_Variable &var, void *val_ptr) {
|
||||
ScreenHandler.DGUSLCD_SetValueDirectly<uint16_t>(var, val_ptr);
|
||||
|
||||
ValidateTemperatures();
|
||||
}
|
||||
|
||||
void MeshValidationHandler::HandleStartOrCancelButton(DGUS_VP_Variable &var, void *val_ptr) {
|
||||
if (!is_running) {
|
||||
Start();
|
||||
} else {
|
||||
Cancel();
|
||||
}
|
||||
}
|
||||
|
||||
void MeshValidationHandler::Start() {
|
||||
if (is_running) return;
|
||||
|
||||
// Validate
|
||||
if (!ExtUI::getMeshValid()) {
|
||||
SetStatusMessage("Please level bed first");
|
||||
return;
|
||||
}
|
||||
|
||||
// Block
|
||||
ScreenHandler.SetSynchronousOperationStart();
|
||||
is_running = true;
|
||||
started_from_screen = true;
|
||||
|
||||
// Home if necessary - do this synchronously
|
||||
if (!all_axes_trusted()) {
|
||||
queue.inject_P("G28 U0");
|
||||
queue.advance();
|
||||
}
|
||||
|
||||
// Home X and Y so we droop at the side of the bed.
|
||||
// G26 with temperature and set for full bed, full pattern, retract 4mm, prime 5mm
|
||||
char gcodeBuffer[128] = {0};
|
||||
sprintf_P(gcodeBuffer, PSTR("G90\nG0 X0\nG26 B%d H%d R Q4 P2 X0 Y0"), bed_temperature, nozzle_temperature);
|
||||
queue.inject(gcodeBuffer);
|
||||
queue.advance();
|
||||
|
||||
// Set feedrate
|
||||
prev_feedrate = ExtUI::getFeedrate_mm_s();
|
||||
ExtUI::setFeedrate_mm_s(MESH_VALIDATION_PATTERN_FEEDRATE);
|
||||
|
||||
SetStatusMessage("Starting...");
|
||||
}
|
||||
|
||||
void MeshValidationHandler::Cancel() {
|
||||
if (is_cancelling) return;
|
||||
|
||||
is_cancelling = true;
|
||||
ExtUI::simulateUserClick();
|
||||
|
||||
SetStatusMessage("Cancelling...");
|
||||
}
|
||||
|
||||
void MeshValidationHandler::OnMeshValidationStart() {
|
||||
// Note: can also be called when manually invoking G26
|
||||
if (ScreenHandler.getCurrentScreen() != DGUSLCD_SCREEN_MESH_VALIDATION) {
|
||||
ScreenHandler.GotoScreen(DGUSLCD_SCREEN_MESH_VALIDATION);
|
||||
}
|
||||
|
||||
// Set state
|
||||
ScreenHandler.SetSynchronousOperationStart();
|
||||
is_running = true;
|
||||
}
|
||||
|
||||
void MeshValidationHandler::OnMeshValidationFinish() {
|
||||
// If invoked externally, pop back
|
||||
if (!started_from_screen) {
|
||||
ScreenHandler.PopToOldScreen();
|
||||
}
|
||||
|
||||
if (started_from_screen) {
|
||||
ExtUI::setFeedrate_mm_s(prev_feedrate);
|
||||
|
||||
char gcodeBuffer[128] = {0};
|
||||
if (!is_cancelling) {
|
||||
// Present
|
||||
// - Set absolute mode
|
||||
// - Present bed, high Z
|
||||
// - Disable stepper
|
||||
strcpy_P(gcodeBuffer, PSTR("M84"));
|
||||
|
||||
SetStatusMessage("Mesh validation pattern printed");
|
||||
} else {
|
||||
// Park and disable steppers
|
||||
strcpy_P(gcodeBuffer, PSTR("G0 X5 F2000\nG27\nM84"));
|
||||
|
||||
SetStatusMessage("Canceled mesh validation pattern");
|
||||
}
|
||||
|
||||
// Enqueue
|
||||
gcode.process_subcommands_now(gcodeBuffer);
|
||||
}
|
||||
|
||||
// Reset state
|
||||
is_running = false;
|
||||
started_from_screen = false;
|
||||
is_cancelling = false;
|
||||
|
||||
ScreenHandler.SetSynchronousOperationFinish();
|
||||
ExtUI::simulateUserClick();
|
||||
}
|
||||
|
||||
void MeshValidationHandler::ValidateTemperatures() {
|
||||
LIMIT(nozzle_temperature, EXTRUDE_MINTEMP, HEATER_0_MAXTEMP - HOTEND_OVERSHOOT);
|
||||
LIMIT(bed_temperature, 40 /*Hardcoded minimum for G26, apparently*/, BED_MAXTEMP - BED_OVERSHOOT);
|
||||
}
|
||||
|
||||
void MeshValidationHandler::SetStatusMessage(PGM_P statusMessage) {
|
||||
ScreenHandler.setstatusmessagePGM(statusMessage);
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,33 @@
|
||||
#include <cstdint>
|
||||
#if HAS_MESH
|
||||
class MeshValidationHandler {
|
||||
public:
|
||||
static void Init();
|
||||
|
||||
static void HandleTemperature(DGUS_VP_Variable &var, void *val_ptr);
|
||||
|
||||
static void HandleStartOrCancelButton(DGUS_VP_Variable &var, void *val_ptr);
|
||||
|
||||
static void OnMeshValidationStart();
|
||||
static void OnMeshValidationFinish();
|
||||
|
||||
public:
|
||||
static celsius_t nozzle_temperature;
|
||||
static celsius_t bed_temperature;
|
||||
|
||||
static feedRate_t prev_feedrate;
|
||||
|
||||
static bool is_cancelling;
|
||||
static bool is_running;
|
||||
static bool started_from_screen;
|
||||
|
||||
private:
|
||||
static void Start();
|
||||
static void Cancel();
|
||||
|
||||
static void ValidateTemperatures();
|
||||
static void SetStatusMessage(PGM_P statusMessage);
|
||||
};
|
||||
|
||||
constexpr feedRate_t MESH_VALIDATION_PATTERN_FEEDRATE = G26_XY_FEEDRATE;
|
||||
#endif
|
||||
@@ -0,0 +1,91 @@
|
||||
|
||||
#include "../../../../inc/MarlinConfigPre.h"
|
||||
|
||||
#if ENABLED(DGUS_LCD_UI_CREALITY_TOUCH)
|
||||
|
||||
#include "../DGUSDisplayDef.h"
|
||||
#include "../DGUSDisplay.h"
|
||||
#include "../DGUSScreenHandler.h"
|
||||
|
||||
#include "PIDHandler.h"
|
||||
|
||||
#include "../../ui_api.h"
|
||||
#include "../../../marlinui.h"
|
||||
|
||||
#include "../../../../module/temperature.h"
|
||||
#include "../../../../module/settings.h"
|
||||
#include "../../../../module/planner.h"
|
||||
#include "../../../../gcode/gcode.h"
|
||||
|
||||
// Storage init
|
||||
uint16_t PIDHandler::cycles = 0;
|
||||
celsius_t PIDHandler::calibration_temperature = 0;
|
||||
bool PIDHandler::fan_on = false;
|
||||
PGM_P PIDHandler::result_message = nullptr;
|
||||
|
||||
void PIDHandler::Init() {
|
||||
// Reset
|
||||
cycles = 3;
|
||||
|
||||
fan_on = ExtUI::getTargetFan_percent(ExtUI::fan_t::FAN0) > 10;
|
||||
|
||||
// Use configured PLA temps + 10 degrees
|
||||
calibration_temperature = ui.material_preset[0].hotend_temp + 15;
|
||||
|
||||
// Welcome message
|
||||
SetStatusMessage(PSTR("Ready"));
|
||||
}
|
||||
|
||||
|
||||
void PIDHandler::HandleStartButton(DGUS_VP_Variable &var, void *val_ptr) {
|
||||
//static_assert(ADVANCED_PAUSE_PURGE_LENGTH == 0, "Assuming PURGE_LENGTH is 0 so we can use M701");
|
||||
|
||||
// Validate
|
||||
if (calibration_temperature < EXTRUDE_MINTEMP) {
|
||||
SetStatusMessage(PSTR("Invalid temperature set"));
|
||||
return;
|
||||
}
|
||||
|
||||
if (calibration_temperature > HEATER_0_MAXTEMP) {
|
||||
SetStatusMessage(PSTR("Invalid temperature set"));
|
||||
return;
|
||||
}
|
||||
|
||||
if (cycles < 1) {
|
||||
SetStatusMessage(PSTR("Invalid number of cycles"));
|
||||
return;
|
||||
}
|
||||
|
||||
// Synchronous operation - disable back button
|
||||
DGUSSynchronousOperation syncOperation;
|
||||
syncOperation.start();
|
||||
|
||||
// Fan
|
||||
const auto prev_fan_percentage = ExtUI::getActualFan_percent(ExtUI::fan_t::FAN0);
|
||||
const uint8_t fan_speed = fan_on ? 255 : 0;
|
||||
|
||||
// Set-up command
|
||||
SetStatusMessage(PSTR("PID tuning. Please wait..."));
|
||||
|
||||
char cmd[64]; // Add a G4 to allow the fan speed to take effect
|
||||
sprintf_P(cmd, PSTR("M106 S%d\nG4 S2\nM303 S%d C%d U1"), fan_speed, calibration_temperature, cycles);
|
||||
SERIAL_ECHOLNPGM("Executing: ", cmd);
|
||||
|
||||
ExtUI::injectCommands(cmd);
|
||||
while (queue.has_commands_queued()) queue.advance();
|
||||
|
||||
// Done
|
||||
ExtUI::setTargetFan_percent(prev_fan_percentage, ExtUI::fan_t::FAN0);
|
||||
|
||||
ScreenHandler.Buzzer(0, 250);
|
||||
settings.save();
|
||||
syncOperation.done();
|
||||
|
||||
SetStatusMessage(result_message);
|
||||
}
|
||||
|
||||
void PIDHandler::SetStatusMessage(PGM_P statusMessage) {
|
||||
ScreenHandler.setstatusmessagePGM(statusMessage);
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,21 @@
|
||||
#pragma once
|
||||
|
||||
#include <cstdint>
|
||||
|
||||
class PIDHandler {
|
||||
public:
|
||||
static void Init();
|
||||
|
||||
static void HandleStartButton(DGUS_VP_Variable &var, void *val_ptr);
|
||||
|
||||
public:
|
||||
static uint16_t cycles;
|
||||
static celsius_t calibration_temperature;
|
||||
static bool fan_on;
|
||||
static PGM_P result_message;
|
||||
|
||||
private:
|
||||
|
||||
static void SetStatusMessage(PGM_P statusMessage);
|
||||
};
|
||||
|
||||
@@ -0,0 +1,470 @@
|
||||
#include "../../../../inc/MarlinConfigPre.h"
|
||||
|
||||
#if ENABLED(DGUS_LCD_UI_CREALITY_TOUCH)
|
||||
|
||||
#include "../DGUSDisplayDef.h"
|
||||
#include "../DGUSDisplay.h"
|
||||
#include "../DGUSScreenHandler.h"
|
||||
|
||||
#include "../../../../module/temperature.h"
|
||||
#include "../../../../module/motion.h"
|
||||
#include "../../../../module/planner.h"
|
||||
#include "../../../../feature/pause.h"
|
||||
#include "../../../../gcode/gcode.h"
|
||||
|
||||
#if ENABLED(FILAMENT_RUNOUT_SENSOR)
|
||||
#include "../../../../feature/runout.h"
|
||||
#endif
|
||||
|
||||
#include "../../../../module/settings.h"
|
||||
|
||||
#include "../../ui_api.h"
|
||||
#include "../../../marlinui.h"
|
||||
|
||||
#include "PageHandlers.h"
|
||||
|
||||
|
||||
// Definitions of page handlers
|
||||
|
||||
void MainMenuHandler(DGUS_VP_Variable &var, unsigned short buttonValue) {
|
||||
switch (var.VP) {
|
||||
case VP_BUTTON_MAINENTERKEY:
|
||||
switch (buttonValue) {
|
||||
case 1:
|
||||
// Try to mount an unmounted card (BTT SKR board has especially some trouble sometimes)
|
||||
card.mount();
|
||||
ScreenHandler.SDCardInserted();
|
||||
break;
|
||||
|
||||
case 2:
|
||||
ScreenHandler.GotoScreen(DGUSLCD_SCREEN_PREPARE);
|
||||
break;
|
||||
|
||||
case 3:
|
||||
ScreenHandler.GotoScreen(DGUSLCD_SCREEN_SETUP);
|
||||
break;
|
||||
|
||||
case 4:
|
||||
ScreenHandler.GotoScreen(DGUSLCD_SCREEN_CALIBRATE);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void SetupMenuHandler(DGUS_VP_Variable &var, unsigned short buttonValue) {
|
||||
switch (var.VP) {
|
||||
case VP_BUTTON_PREPAREENTERKEY:
|
||||
switch(buttonValue) {
|
||||
case 5: // About
|
||||
ScreenHandler.GotoScreen(DGUSLCD_SCREEN_INFO);
|
||||
break;
|
||||
|
||||
case 7: // Reset to factory settings
|
||||
settings.reset();
|
||||
settings.save();
|
||||
|
||||
ExtUI::injectCommands_P(PSTR("M300"));
|
||||
|
||||
ScreenHandler.GotoScreen(DGUSLCD_SCREEN_MAIN, false);
|
||||
ScreenHandler.setstatusmessagePGM(PSTR("Restored default settings. Please turn your printer off and then on to complete the reset"));
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
case VP_BUTTON_TEMPCONTROL:
|
||||
if (buttonValue == 2) ScreenHandler.GotoScreen(DGUSLCD_SCREEN_TEMP);
|
||||
break;
|
||||
|
||||
case VP_BUTTON_ADJUSTENTERKEY:
|
||||
ScreenHandler.HandleLEDToggle();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
#if HAS_MESH
|
||||
void LevelingModeHandler(DGUS_VP_Variable &var, unsigned short buttonValue) {
|
||||
switch (var.VP) {
|
||||
case VP_BUTTON_BEDLEVELKEY:
|
||||
switch (buttonValue) {
|
||||
case 1:
|
||||
queue.enqueue_one("G28 U0");
|
||||
queue.enqueue_one("G0 Z0");
|
||||
break;
|
||||
|
||||
case 2:
|
||||
// Increase Z-offset
|
||||
ExtUI::smartAdjustAxis_steps(ExtUI::mmToWholeSteps(0.01, ExtUI::axis_t::Z), ExtUI::axis_t::Z, true);;
|
||||
ScreenHandler.ForceCompleteUpdate();
|
||||
ScreenHandler.RequestSaveSettings();
|
||||
break;
|
||||
|
||||
case 3:
|
||||
// Decrease Z-offset
|
||||
ExtUI::smartAdjustAxis_steps(ExtUI::mmToWholeSteps(-0.01, ExtUI::axis_t::Z), ExtUI::axis_t::Z, true);;
|
||||
ScreenHandler.ForceCompleteUpdate();
|
||||
ScreenHandler.RequestSaveSettings();
|
||||
break;
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case VP_BUTTON_PREPAREENTERKEY:
|
||||
if (buttonValue == 9) {
|
||||
#if DISABLED(HOTEND_IDLE_TIMEOUT)
|
||||
thermalManager.disable_all_heaters();
|
||||
#endif
|
||||
|
||||
ScreenHandler.GotoScreen(DGUSLCD_SCREEN_MAIN, false);
|
||||
}
|
||||
|
||||
if (buttonValue == 1) {
|
||||
// TODO: set state for "view leveling mesh"
|
||||
ScreenHandler.SetViewMeshLevelState();
|
||||
ScreenHandler.InitMeshValues();
|
||||
|
||||
ScreenHandler.GotoScreen(DGUSLCD_SCREEN_LEVELING);
|
||||
}
|
||||
break;
|
||||
|
||||
case VP_BUTTON_MAINENTERKEY:
|
||||
// Go to leveling screen
|
||||
ExtUI::injectCommands_P("G28 U0\nG29 U0");
|
||||
|
||||
ScreenHandler.ResetMeshValues();
|
||||
|
||||
dgusdisplay.WriteVariable(VP_MESH_SCREEN_MESSAGE_ICON, static_cast<uint16_t>(MESH_SCREEN_MESSAGE_ICON_LEVELING));
|
||||
ScreenHandler.GotoScreen(DGUSLCD_SCREEN_LEVELING);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void LevelingHandler(DGUS_VP_Variable &var, unsigned short buttonValue) {
|
||||
switch (var.VP) {
|
||||
case VP_BUTTON_BEDLEVELKEY:
|
||||
const bool busy = TERN0(HOST_KEEPALIVE_FEATURE, ((ExtUI::getHostKeepaliveState() == GcodeSuite::MarlinBusyState::IN_PROCESS) || (ExtUI::getHostKeepaliveState() == GcodeSuite::MarlinBusyState::IN_HANDLER)));
|
||||
if (!busy) {
|
||||
ScreenHandler.PopToOldScreen();
|
||||
} else {
|
||||
ScreenHandler.setstatusmessagePGM("Wait for leveling completion...");
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
void TempMenuHandler(DGUS_VP_Variable &var, unsigned short buttonValue) {
|
||||
switch (var.VP) {
|
||||
case VP_BUTTON_ADJUSTENTERKEY:
|
||||
switch (buttonValue) {
|
||||
case 3:
|
||||
ScreenHandler.HandleFanToggle();
|
||||
break;
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case VP_BUTTON_TEMPCONTROL:
|
||||
switch (buttonValue){
|
||||
case 3:
|
||||
ScreenHandler.GotoScreen(DGUSLCD_SCREEN_TEMP_PLA);
|
||||
break;
|
||||
|
||||
case 4:
|
||||
ScreenHandler.GotoScreen(DGUSLCD_SCREEN_TEMP_ABS);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void PrepareMenuHandler(DGUS_VP_Variable &var, unsigned short buttonValue) {
|
||||
switch (var.VP) {
|
||||
case VP_BUTTON_PREPAREENTERKEY:
|
||||
switch (buttonValue){
|
||||
case 3:
|
||||
ScreenHandler.GotoScreen(DGUSLCD_SCREEN_MOVE10MM);
|
||||
break;
|
||||
|
||||
case 6:
|
||||
// Disable steppers
|
||||
ScreenHandler.HandleMotorLockUnlock(var, &buttonValue);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
case VP_BUTTON_HEATLOADSTARTKEY:
|
||||
ScreenHandler.GotoScreen(DGUSLCD_SCREEN_FEED);
|
||||
break;
|
||||
|
||||
case VP_BUTTON_COOLDOWN:
|
||||
ScreenHandler.HandleAllHeatersOff(var, &buttonValue);
|
||||
break;
|
||||
|
||||
case VP_BUTTON_TEMPCONTROL:
|
||||
switch (buttonValue) {
|
||||
case 5:
|
||||
thermalManager.setTargetHotend(ui.material_preset[0].hotend_temp, 0);
|
||||
thermalManager.setTargetBed(ui.material_preset[0].bed_temp);
|
||||
|
||||
break;
|
||||
|
||||
case 6:
|
||||
thermalManager.setTargetHotend(ui.material_preset[1].hotend_temp, 0);
|
||||
thermalManager.setTargetBed(ui.material_preset[1].bed_temp);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
ScreenHandler.ForceCompleteUpdate();
|
||||
}
|
||||
|
||||
void TuneMenuHandler(DGUS_VP_Variable &var, unsigned short buttonValue) {
|
||||
switch (var.VP) {
|
||||
case VP_BUTTON_BEDLEVELKEY:
|
||||
switch (buttonValue) {
|
||||
case 2:
|
||||
// Increase Z-offset
|
||||
ExtUI::smartAdjustAxis_steps(ExtUI::mmToWholeSteps(0.01, ExtUI::axis_t::Z), ExtUI::axis_t::Z, true);;
|
||||
ScreenHandler.ForceCompleteUpdate();
|
||||
ScreenHandler.RequestSaveSettings();
|
||||
break;
|
||||
|
||||
case 3:
|
||||
// Decrease Z-offset
|
||||
ExtUI::smartAdjustAxis_steps(ExtUI::mmToWholeSteps(-0.01, ExtUI::axis_t::Z), ExtUI::axis_t::Z, true);;
|
||||
ScreenHandler.ForceCompleteUpdate();
|
||||
ScreenHandler.RequestSaveSettings();
|
||||
break;
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case VP_BUTTON_ADJUSTENTERKEY:
|
||||
switch (buttonValue) {
|
||||
case 2:
|
||||
ScreenHandler.GotoScreen(ExtUI::isPrintingPaused() ? DGUSLCD_SCREEN_PRINT_PAUSED : DGUSLCD_SCREEN_PRINT_RUNNING, false);
|
||||
break;
|
||||
|
||||
case 3:
|
||||
ScreenHandler.HandleFanToggle();
|
||||
break;
|
||||
|
||||
case 4:
|
||||
ScreenHandler.HandleLEDToggle();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void PrintRunningMenuHandler(DGUS_VP_Variable &var, unsigned short buttonValue) {
|
||||
switch (var.VP) {
|
||||
case VP_BUTTON_ADJUSTENTERKEY:
|
||||
ScreenHandler.GotoScreen(DGUSLCD_SCREEN_TUNING);
|
||||
break;
|
||||
|
||||
case VP_BUTTON_PAUSEPRINTKEY:
|
||||
if (!ScreenHandler.HandlePendingUserConfirmation() && ExtUI::isPrintingPaused()) {
|
||||
ExtUI::resumePrint();
|
||||
ScreenHandler.GotoScreen(DGUSLCD_SCREEN_PRINT_RUNNING);
|
||||
} else
|
||||
ScreenHandler.GotoScreen(DGUSLCD_SCREEN_DIALOG_PAUSE);
|
||||
break;
|
||||
|
||||
case VP_BUTTON_STOPPRINTKEY:
|
||||
ScreenHandler.GotoScreen(DGUSLCD_SCREEN_DIALOG_STOP);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void PrintPausedMenuHandler(DGUS_VP_Variable &var, unsigned short buttonValue) {
|
||||
switch (var.VP) {
|
||||
case VP_BUTTON_RESUMEPRINTKEY:
|
||||
#if ENABLED(FILAMENT_RUNOUT_SENSOR)
|
||||
runout.reset();
|
||||
#endif
|
||||
|
||||
if (!ScreenHandler.HandlePendingUserConfirmation()) {
|
||||
ExtUI::resumePrint();
|
||||
ScreenHandler.GotoScreen(DGUSLCD_SCREEN_PRINT_RUNNING);
|
||||
}
|
||||
break;
|
||||
|
||||
case VP_BUTTON_ADJUSTENTERKEY:
|
||||
ScreenHandler.GotoScreen(DGUSLCD_SCREEN_TUNING);
|
||||
break;
|
||||
|
||||
case VP_BUTTON_STOPPRINTKEY:
|
||||
ScreenHandler.GotoScreen(DGUSLCD_SCREEN_DIALOG_STOP);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void PrintPauseDialogHandler(DGUS_VP_Variable &var, unsigned short buttonValue) {
|
||||
switch (var.VP){
|
||||
case VP_BUTTON_PAUSEPRINTKEY:
|
||||
switch (buttonValue) {
|
||||
case 2:
|
||||
ScreenHandler.GotoScreen(DGUSLCD_SCREEN_PRINT_RUNNING);
|
||||
ScreenHandler.setstatusmessagePGM(PSTR("Pausing print - please wait..."));
|
||||
ExtUI::pausePrint();
|
||||
break;
|
||||
|
||||
case 3:
|
||||
ScreenHandler.GotoScreen(DGUSLCD_SCREEN_PRINT_RUNNING);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void PrintFinishMenuHandler(DGUS_VP_Variable &var, unsigned short buttonValue) {
|
||||
switch (var.VP){
|
||||
case VP_BUTTON_MAINENTERKEY:
|
||||
switch (buttonValue) {
|
||||
case 5:
|
||||
ScreenHandler.GotoScreen(DGUSLCD_SCREEN_MAIN);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void FilamentRunoutHandler(DGUS_VP_Variable &var, unsigned short buttonValue) {
|
||||
switch (var.VP){
|
||||
case VP_BUTTON_RESUMEPRINTKEY:
|
||||
ExtUI::resumePrint();
|
||||
ScreenHandler.GotoScreen(DGUSLCD_SCREEN_PRINT_RUNNING);
|
||||
break;
|
||||
|
||||
case VP_BUTTON_STOPPRINTKEY:
|
||||
ExtUI::stopPrint();
|
||||
ScreenHandler.GotoScreen(DGUSLCD_SCREEN_MAIN);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void StopConfirmScreenHandler(DGUS_VP_Variable &var, unsigned short buttonValue) {
|
||||
switch (var.VP){
|
||||
case VP_BUTTON_STOPPRINTKEY:
|
||||
switch (buttonValue) {
|
||||
case 2:
|
||||
ExtUI::stopPrint();
|
||||
ScreenHandler.GotoScreen(DGUSLCD_SCREEN_MAIN);
|
||||
break;
|
||||
|
||||
case 3:
|
||||
ScreenHandler.GotoScreen(ExtUI::isPrintingPaused() ? DGUSLCD_SCREEN_PRINT_PAUSED : DGUSLCD_SCREEN_PRINT_RUNNING);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void PreheatSettingsScreenHandler(DGUS_VP_Variable &var, unsigned short buttonValue) {
|
||||
switch (var.VP){
|
||||
case VP_BUTTON_PREPAREENTERKEY:
|
||||
// Save button, save settings and go back
|
||||
ScreenHandler.RequestSaveSettings();
|
||||
ScreenHandler.PopToOldScreen();
|
||||
break;
|
||||
|
||||
case VP_BUTTON_COOLDOWN: // You can't make this up
|
||||
// Back button, discard settings
|
||||
settings.load();
|
||||
ScreenHandler.PopToOldScreen();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void MoveHandler(DGUS_VP_Variable &var, unsigned short buttonValue) {
|
||||
if (var.VP == VP_BUTTON_MOVEKEY) {
|
||||
switch (buttonValue) {
|
||||
case 1:
|
||||
ScreenHandler.GotoScreen(DGUSLCD_SCREEN_MOVE10MM, false);
|
||||
break;
|
||||
case 2:
|
||||
ScreenHandler.GotoScreen(DGUSLCD_SCREEN_MOVE1MM, false);
|
||||
break;
|
||||
case 3:
|
||||
ScreenHandler.GotoScreen(DGUSLCD_SCREEN_MOVE01MM, false);
|
||||
break;
|
||||
case 4:
|
||||
// Temporary copy probe settings so we home without preheating, then restore setings afterward
|
||||
//This machine should never home Z cold...
|
||||
//auto prev_probe_settings = probe.settings;
|
||||
|
||||
//probe.settings.preheat_bed_temp = 0;
|
||||
//probe.settings.preheat_hotend_temp = 0;
|
||||
//probe.settings.stabilize_temperatures_after_probing = false;
|
||||
|
||||
ExtUI::injectCommands_P("G28");
|
||||
while (queue.has_commands_queued()) queue.advance();
|
||||
|
||||
// ... Restore settings
|
||||
//probe.settings = prev_probe_settings;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Register the page handlers
|
||||
#define PAGE_HANDLER(SCRID, HDLRPTR) { .ScreenID=SCRID, .Handler=HDLRPTR },
|
||||
const struct PageHandler PageHandlers[] PROGMEM = {
|
||||
PAGE_HANDLER(DGUSLCD_Screens::DGUSLCD_SCREEN_MAIN, MainMenuHandler)
|
||||
|
||||
PAGE_HANDLER(DGUSLCD_Screens::DGUSLCD_SCREEN_SETUP, SetupMenuHandler)
|
||||
|
||||
#if HAS_MESH
|
||||
PAGE_HANDLER(DGUSLCD_Screens::DGUSLCD_SCREEN_ZOFFSET_LEVEL, LevelingModeHandler)
|
||||
PAGE_HANDLER(DGUSLCD_Screens::DGUSLCD_SCREEN_LEVELING, LevelingHandler)
|
||||
#endif
|
||||
|
||||
PAGE_HANDLER(DGUSLCD_Screens::DGUSLCD_SCREEN_TEMP, TempMenuHandler)
|
||||
PAGE_HANDLER(DGUSLCD_Screens::DGUSLCD_SCREEN_TEMP_PLA, PreheatSettingsScreenHandler)
|
||||
PAGE_HANDLER(DGUSLCD_Screens::DGUSLCD_SCREEN_TEMP_ABS, PreheatSettingsScreenHandler)
|
||||
|
||||
PAGE_HANDLER(DGUSLCD_Screens::DGUSLCD_SCREEN_TUNING, TuneMenuHandler)
|
||||
PAGE_HANDLER(DGUSLCD_Screens::DGUSLCD_SCREEN_MOVE01MM, MoveHandler)
|
||||
PAGE_HANDLER(DGUSLCD_Screens::DGUSLCD_SCREEN_MOVE1MM, MoveHandler)
|
||||
PAGE_HANDLER(DGUSLCD_Screens::DGUSLCD_SCREEN_MOVE10MM, MoveHandler)
|
||||
|
||||
PAGE_HANDLER(DGUSLCD_Screens::DGUSLCD_SCREEN_FILAMENTRUNOUT1, FilamentRunoutHandler)
|
||||
PAGE_HANDLER(DGUSLCD_Screens::DGUSLCD_SCREEN_FILAMENTRUNOUT2, FilamentRunoutHandler)
|
||||
|
||||
PAGE_HANDLER(DGUSLCD_Screens::DGUSLCD_SCREEN_DIALOG_STOP, StopConfirmScreenHandler)
|
||||
|
||||
PAGE_HANDLER(DGUSLCD_Screens::DGUSLCD_SCREEN_PRINT_RUNNING, PrintRunningMenuHandler)
|
||||
PAGE_HANDLER(DGUSLCD_Screens::DGUSLCD_SCREEN_PRINT_PAUSED, PrintPausedMenuHandler)
|
||||
PAGE_HANDLER(DGUSLCD_Screens::DGUSLCD_SCREEN_PRINT_FINISH, PrintFinishMenuHandler)
|
||||
|
||||
PAGE_HANDLER(DGUSLCD_Screens::DGUSLCD_SCREEN_DIALOG_PAUSE, PrintPauseDialogHandler)
|
||||
|
||||
PAGE_HANDLER(DGUSLCD_Screens::DGUSLCD_SCREEN_PREPARE, PrepareMenuHandler)
|
||||
|
||||
// Terminating
|
||||
PAGE_HANDLER(static_cast<DGUSLCD_Screens>(0) ,0)
|
||||
};
|
||||
|
||||
void DGUSCrealityDisplay_HandleReturnKeyEvent(DGUS_VP_Variable &var, void *val_ptr) {
|
||||
const struct PageHandler *map = PageHandlers;
|
||||
const uint16_t *ret;
|
||||
const DGUSLCD_Screens current_screen = DGUSScreenHandler::getCurrentScreen();
|
||||
|
||||
while ((ret = (uint16_t*) pgm_read_ptr(&(map->Handler)))) {
|
||||
if ((map->ScreenID) == current_screen) {
|
||||
uint16_t button_value = uInt16Value(val_ptr);
|
||||
|
||||
SERIAL_ECHOLNPGM("Invoking handler for screen ", current_screen);
|
||||
SERIAL_ECHOLNPGM("with VP=", var.VP, " value=", button_value);
|
||||
|
||||
map->Handler(var, button_value);
|
||||
return;
|
||||
}
|
||||
|
||||
map++;
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,11 @@
|
||||
#pragma once
|
||||
|
||||
// Mapping of handlers per page. This construction is necessary because the CR-6 touch screen re-uses the same button IDs all over the place.
|
||||
typedef void (*DGUS_CREALITY_SCREEN_BUTTON_HANDLER)(DGUS_VP_Variable &var, unsigned short buttonValue);
|
||||
|
||||
struct PageHandler {
|
||||
DGUSLCD_Screens ScreenID;
|
||||
DGUS_CREALITY_SCREEN_BUTTON_HANDLER Handler;
|
||||
};
|
||||
|
||||
void DGUSCrealityDisplay_HandleReturnKeyEvent(DGUS_VP_Variable &var, void *val_ptr);
|
||||
@@ -0,0 +1,267 @@
|
||||
/**
|
||||
* 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/>.
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* dgus_creality_lcd.cpp
|
||||
*
|
||||
* DGUS implementation written by coldtobi in 2019 for Marlin
|
||||
*/
|
||||
|
||||
#include "../../inc/MarlinConfigPre.h"
|
||||
|
||||
#if ENABLED(DGUS_LCD_UI_CREALITY_TOUCH)
|
||||
|
||||
#include "ui_api.h"
|
||||
#include "../marlinui.h"
|
||||
#include "./dgus_creality/DGUSDisplay.h"
|
||||
#include "./dgus_creality/DGUSDisplayDef.h"
|
||||
#include "./dgus_creality/DGUSScreenHandler.h"
|
||||
#include "./dgus_creality/creality_touch/PIDHandler.h"
|
||||
#include "./dgus_creality/creality_touch/MeshValidationHandler.h"
|
||||
|
||||
#if ENABLED(POWER_LOSS_RECOVERY)
|
||||
#include "../../feature/powerloss.h"
|
||||
#endif
|
||||
|
||||
extern const char NUL_STR[];
|
||||
|
||||
namespace ExtUI {
|
||||
|
||||
void onStartup() {
|
||||
ScreenHandler.Init();
|
||||
ScreenHandler.UpdateScreenVPData();
|
||||
}
|
||||
|
||||
void onIdle() { ScreenHandler.loop(); }
|
||||
|
||||
void onPrinterKilled(FSTR_P const error, FSTR_P const component) {
|
||||
ScreenHandler.sendinfoscreen(GET_TEXT_F(MSG_HALTED), error, GET_TEXT_F(MSG_PLEASE_RESET), GET_TEXT_F(MSG_PLEASE_RESET), true, true, true, true);
|
||||
|
||||
if (error == GET_TEXT_F(MSG_ERR_MAXTEMP) || error == GET_TEXT_F(MSG_THERMAL_RUNAWAY)) {
|
||||
ScreenHandler.GotoScreen(DGUSLCD_SCREEN_THERMAL_RUNAWAY);
|
||||
} else if ( error == GET_TEXT_F(MSG_HEATING_FAILED_LCD)) {
|
||||
ScreenHandler.GotoScreen(DGUSLCD_SCREEN_HEATING_FAILED);
|
||||
}else if (error == GET_TEXT_F(MSG_ERR_MINTEMP)) {
|
||||
ScreenHandler.GotoScreen(DGUSLCD_SCREEN_THERMISTOR_ERROR);
|
||||
} else {
|
||||
ScreenHandler.GotoScreen(DGUSLCD_SCREEN_KILL);
|
||||
}
|
||||
|
||||
ScreenHandler.KillScreenCalled();
|
||||
while (!ScreenHandler.loop()); // Wait while anything is left to be sent
|
||||
}
|
||||
|
||||
void onMediaInserted() { TERN_(SDSUPPORT, ScreenHandler.SDCardInserted()); }
|
||||
void onMediaError() { TERN_(SDSUPPORT, ScreenHandler.SDCardError()); }
|
||||
void onMediaRemoved() { TERN_(SDSUPPORT, ScreenHandler.SDCardRemoved()); }
|
||||
|
||||
void onPlayTone(const uint16_t frequency, const uint16_t duration) {
|
||||
if (ScreenHandler.getCurrentScreen() == DGUSLCD_SCREEN_FEED) {
|
||||
// We're in the feed (load filament) workflow - no beep - there is no confirmation
|
||||
return;
|
||||
}
|
||||
|
||||
ScreenHandler.Buzzer(frequency, duration);
|
||||
}
|
||||
|
||||
bool hasPrintTimer = false;
|
||||
|
||||
void onPrintTimerStarted() {
|
||||
hasPrintTimer = true;
|
||||
|
||||
if (!IS_SD_FILE_OPEN() && !(PrintJobRecovery::valid() && PrintJobRecovery::exists())) {
|
||||
ScreenHandler.SetPrintingFromHost();
|
||||
}
|
||||
|
||||
#if ENABLED(LCD_SET_PROGRESS_MANUALLY)
|
||||
ui.progress_reset();
|
||||
#endif
|
||||
|
||||
ScreenHandler.GotoScreen(DGUSLCD_SCREEN_PRINT_RUNNING);
|
||||
}
|
||||
|
||||
void onPrintTimerPaused() {
|
||||
// Handle M28 Pause SD print - But only if we're not waiting on a user
|
||||
if (ExtUI::isPrintingFromMediaPaused() && ScreenHandler.getCurrentScreen() == DGUSLCD_SCREEN_PRINT_RUNNING && !ExtUI::awaitingUserConfirm()) {
|
||||
ScreenHandler.GotoScreen(DGUSLCD_SCREEN_PRINT_PAUSED);
|
||||
}
|
||||
}
|
||||
|
||||
void onPrintTimerStopped() {
|
||||
hasPrintTimer = false;
|
||||
|
||||
ScreenHandler.GotoScreen(DGUSLCD_SCREEN_PRINT_FINISH);
|
||||
}
|
||||
|
||||
void onFilamentRunout(const extruder_t extruder) {
|
||||
// Only navigate to filament runout screen when we don't use M600 for changing the filament - otherwise it gets confusing for the user
|
||||
#ifndef FILAMENT_RUNOUT_SCRIPT
|
||||
#define FILAMENT_RUNOUT_SCRIPT "M25"
|
||||
#endif
|
||||
if (strcmp_P(FILAMENT_RUNOUT_SCRIPT, PSTR("M600")) != 0) {
|
||||
ScreenHandler.FilamentRunout();
|
||||
}
|
||||
}
|
||||
|
||||
void onUserConfirmed() {
|
||||
SERIAL_ECHOLN("User confirmation invoked");
|
||||
setPauseMenuResponse(PAUSE_RESPONSE_RESUME_PRINT);
|
||||
ExtUI::setUserConfirmed();
|
||||
}
|
||||
|
||||
void onUserConfirmRequired(const char * const msg) {
|
||||
//if (msg) {
|
||||
SERIAL_ECHOLNPGM("User confirmation requested: ", msg);
|
||||
|
||||
if (ScreenHandler.getCurrentScreen() == DGUSLCD_SCREEN_FEED) {
|
||||
// We're in the feed (load filament) workflow - immediately assume confirmed
|
||||
onUserConfirmed();
|
||||
return;
|
||||
}
|
||||
|
||||
ScreenHandler.setstatusmessagePGM(msg);
|
||||
ScreenHandler.sendinfoscreen("Confirmation required", msg, NUL_STR, "Ok", true, true, false, true);
|
||||
|
||||
if (ExtUI::isPrinting()) {
|
||||
ScreenHandler.GotoScreen(DGUSLCD_SCREEN_PRINT_PAUSED);
|
||||
} else {
|
||||
ScreenHandler.GotoScreen(DGUSLCD_SCREEN_POPUP);
|
||||
}
|
||||
//}
|
||||
//else if (ScreenHandler.getCurrentScreen() == DGUSLCD_SCREEN_POPUP) {
|
||||
// DEBUG_ECHOLNPAIR("User confirmation canceled");
|
||||
|
||||
// ScreenHandler.setstatusmessagePGM(nullptr);
|
||||
// ScreenHandler.PopToOldScreen();
|
||||
//}
|
||||
}
|
||||
|
||||
void onStatusChanged(const char * const msg) { ScreenHandler.setstatusmessage(msg); }
|
||||
|
||||
void onFactoryReset() {
|
||||
ScreenHandler.OnFactoryReset();
|
||||
}
|
||||
|
||||
void onHomingStart() {
|
||||
ScreenHandler.OnHomingStart();
|
||||
}
|
||||
|
||||
void onHomingDone() {
|
||||
ScreenHandler.OnHomingComplete();
|
||||
}
|
||||
|
||||
void onPrintDone() {
|
||||
ScreenHandler.OnPrintFinished();
|
||||
}
|
||||
|
||||
void onStoreSettings(char *buff) {
|
||||
ScreenHandler.StoreSettings(buff);
|
||||
}
|
||||
|
||||
void onLoadSettings(const char *buff) {
|
||||
ScreenHandler.LoadSettings(buff);
|
||||
}
|
||||
|
||||
void onPostprocessSettings() {
|
||||
// Called after loading or resetting stored settings
|
||||
}
|
||||
|
||||
void onSettingsStored(bool success) {
|
||||
// Called after the entire EEPROM has been written,
|
||||
// whether successful or not.
|
||||
}
|
||||
|
||||
void onSettingsLoaded(bool success) {
|
||||
// Called after the entire EEPROM has been read,
|
||||
// whether successful or not.
|
||||
}
|
||||
|
||||
#if HAS_MESH
|
||||
void onLevelingStart() {
|
||||
#if HAS_BED_PROBE
|
||||
ScreenHandler.OnMeshLevelingStart();
|
||||
#endif
|
||||
}
|
||||
|
||||
void onMeshUpdate(const int8_t xpos, const int8_t ypos, const float zval) {
|
||||
ScreenHandler.OnMeshLevelingUpdate(xpos, ypos, zval);
|
||||
}
|
||||
|
||||
void onMeshUpdate(const int8_t xpos, const int8_t ypos, const ExtUI::probe_state_t state) {
|
||||
ScreenHandler.OnMeshLevelingUpdate(xpos, ypos, 0);
|
||||
}
|
||||
void onLevelingDone() {
|
||||
|
||||
}
|
||||
#endif
|
||||
|
||||
#if ENABLED(POWER_LOSS_RECOVERY)
|
||||
void onPowerLossResume() {
|
||||
// Called on resume from power-loss
|
||||
ScreenHandler.OnPowerlossResume();
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#if HAS_PID_HEATING
|
||||
void onPidTuning(const result_t rst) {
|
||||
// Called for temperature PID tuning result
|
||||
switch (rst) {
|
||||
case PID_BAD_HEATER_ID:
|
||||
PIDHandler::result_message = GET_TEXT(MSG_PID_BAD_HEATER_ID);
|
||||
ScreenHandler.setstatusmessagePGM(PIDHandler::result_message);
|
||||
break;
|
||||
case PID_TEMP_TOO_HIGH:
|
||||
PIDHandler::result_message = GET_TEXT(MSG_PID_TEMP_TOO_HIGH);
|
||||
ScreenHandler.setstatusmessagePGM(PIDHandler::result_message);
|
||||
break;
|
||||
case PID_TUNING_TIMEOUT:
|
||||
PIDHandler::result_message = GET_TEXT(MSG_PID_TIMEOUT);
|
||||
ScreenHandler.setstatusmessagePGM(PIDHandler::result_message);
|
||||
break;
|
||||
case PID_DONE:
|
||||
PIDHandler::result_message = GET_TEXT(MSG_PID_AUTOTUNE_DONE);
|
||||
ScreenHandler.setstatusmessagePGM(PIDHandler::result_message);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
void onSteppersDisabled() {
|
||||
}
|
||||
|
||||
void onSteppersEnabled() {
|
||||
}
|
||||
|
||||
#if HAS_MESH
|
||||
void onMeshValidationStarting() {
|
||||
MeshValidationHandler::OnMeshValidationStart();
|
||||
}
|
||||
|
||||
void onMeshValidationFinished() {
|
||||
MeshValidationHandler::OnMeshValidationFinish();
|
||||
}
|
||||
#endif
|
||||
}
|
||||
#endif // HAS_DGUS_LCD
|
||||
@@ -395,7 +395,12 @@ void DGUSReturnKeyCodeHandler::Command_SettingsMenu(DGUS_VP &vp, void *data) {
|
||||
}
|
||||
|
||||
static void _gotoTrammingPoint(unsigned char point) {
|
||||
constexpr float lfrb[4] = BED_TRAMMING_INSET_LFRB;
|
||||
#if ENABLED(BED_TRAMMING_USE_PROBE)
|
||||
float lfrb[4] = {X_MIN_BED + probe.min_x(), Y_MIN_BED + probe.min_y(),
|
||||
X_MAX_BED - probe.max_x(), Y_MAX_BED - probe.max_y() };
|
||||
#else
|
||||
constexpr float lfrb[4] = BED_TRAMMING_INSET_LFRB;
|
||||
#endif
|
||||
float x, y;
|
||||
|
||||
switch (point) {
|
||||
|
||||
@@ -38,6 +38,9 @@
|
||||
#if ENABLED(ADVANCED_PAUSE_FEATURE)
|
||||
#include "../../../feature/pause.h"
|
||||
#endif
|
||||
#if ENABLED(BED_TRAMMING_USE_PROBE)
|
||||
#include "../../../module/probe.h"
|
||||
#endif
|
||||
#if ENABLED(POWER_LOSS_RECOVERY)
|
||||
#include "../../../feature/powerloss.h"
|
||||
#endif
|
||||
@@ -464,7 +467,14 @@ void DGUSRxHandler::moveToPoint(DGUS_VP &vp, void *data_ptr) {
|
||||
}
|
||||
|
||||
const uint8_t point = ((uint8_t*)data_ptr)[1];
|
||||
constexpr float lfrb[4] = BED_TRAMMING_INSET_LFRB;
|
||||
|
||||
#if ENABLED(BED_TRAMMING_USE_PROBE)
|
||||
float lfrb[4] = {X_MIN_BED + probe.min_x(), Y_MIN_BED + probe.min_y(),
|
||||
X_MAX_BED - probe.max_x(), Y_MAX_BED - probe.max_y() };
|
||||
#else
|
||||
constexpr float lfrb[4] = BED_TRAMMING_INSET_LFRB;
|
||||
#endif
|
||||
|
||||
float x, y;
|
||||
|
||||
switch (point) {
|
||||
|
||||
@@ -34,14 +34,13 @@ void FilamentRunoutScreen::onRedraw(draw_mode_t what) {
|
||||
w.heading( GET_TEXT_F(MSG_FILAMENT));
|
||||
w.toggle( 2, GET_TEXT_F(MSG_RUNOUT_SENSOR), getFilamentRunoutEnabled());
|
||||
|
||||
#if HAS_FILAMENT_RUNOUT_DISTANCE
|
||||
w.heading(GET_TEXT_F(MSG_RUNOUT_DISTANCE_MM));
|
||||
w.units(GET_TEXT_F(MSG_UNITS_MM));
|
||||
w.precision(0);
|
||||
w.color(e_axis);
|
||||
w.adjuster( 10, FPSTR(NUL_STR), getFilamentRunoutDistance_mm(), getFilamentRunoutEnabled());
|
||||
w.increments();
|
||||
#endif
|
||||
w.heading(GET_TEXT_F(MSG_RUNOUT_DISTANCE_MM));
|
||||
w.units(GET_TEXT_F(MSG_UNITS_MM));
|
||||
w.precision(0);
|
||||
w.color(e_axis);
|
||||
w.adjuster( 10, FPSTR(NUL_STR), getFilamentRunoutDistance_mm(), getFilamentRunoutEnabled());
|
||||
w.increments();
|
||||
|
||||
}
|
||||
|
||||
bool FilamentRunoutScreen::onTouchHeld(uint8_t tag) {
|
||||
@@ -51,10 +50,8 @@ bool FilamentRunoutScreen::onTouchHeld(uint8_t tag) {
|
||||
#endif
|
||||
switch (tag) {
|
||||
case 2: setFilamentRunoutEnabled(!getFilamentRunoutEnabled()); break;
|
||||
#if HAS_FILAMENT_RUNOUT_DISTANCE
|
||||
case 10: UI_DECREMENT(FilamentRunoutDistance_mm); break;
|
||||
case 11: UI_INCREMENT(FilamentRunoutDistance_mm); break;
|
||||
#endif
|
||||
case 10: UI_DECREMENT(FilamentRunoutDistance_mm); break;
|
||||
case 11: UI_INCREMENT(FilamentRunoutDistance_mm); break;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,304 @@
|
||||
/**
|
||||
* Marlin 3D Printer Firmware
|
||||
* Copyright (c) 2021 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/>.
|
||||
*
|
||||
*/
|
||||
|
||||
/* ****************************************
|
||||
* lcd/extui/lib/Creality/Creality_DWIN.h
|
||||
* ****************************************
|
||||
* Extensible_UI implementation for Creality DWIN
|
||||
* 10SPro, Max, CRX, and others
|
||||
* Based original Creality release, ported to ExtUI for Marlin 2.0
|
||||
* Written by Insanity Automation, sponsored by Tiny Machines 3D
|
||||
*
|
||||
* ***************************************/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "string.h"
|
||||
#include <Arduino.h>
|
||||
#include "../ui_api.h"
|
||||
#if ENABLED(EXTENSIBLE_UI)
|
||||
namespace ExtUI {
|
||||
/*********************************/
|
||||
#define FHONE (0x5A)
|
||||
#define FHTWO (0xA5)
|
||||
#define FHLENG (0x06)
|
||||
|
||||
#define TEXTBYTELEN 18
|
||||
#define MaxFileNumber 20// 16
|
||||
|
||||
#define CEIconGrap 12
|
||||
#define FileNum MaxFileNumber
|
||||
#define FileNameLen TEXTBYTELEN
|
||||
|
||||
#define SizeofDatabuf 46
|
||||
|
||||
/*************Register and Variable addr*****************/
|
||||
#define RegAddr_W 0x80
|
||||
#define RegAddr_R 0x81
|
||||
#define VarAddr_W 0x82
|
||||
#define VarAddr_R 0x83
|
||||
#define ExchangePageBase (unsigned long)0x5A010000 //the first page ID. other page = first page ID + relevant num;
|
||||
#define StartSoundSet ((unsigned long)0x060480A0) // 06,start-music; 04, 4 musics; 80, the volume value; 04, return value about music number.
|
||||
#define FONT_EEPROM 90
|
||||
#define AutoLeve_EEPROM 100
|
||||
#define FanOn 255
|
||||
#define FanOff 0
|
||||
|
||||
/*variable addr*/
|
||||
#define ExchangepageAddr 0x0084
|
||||
#define SoundAddr 0x00A0
|
||||
#define StartIcon 0x1000
|
||||
#define FeedrateDisplay 0x1006 // Speed
|
||||
#define Stopprint 0x1008
|
||||
#define Pauseprint 0x100A
|
||||
#define Resumeprint 0x100C
|
||||
#define PrintscheduleIcon 0x100E
|
||||
#define Timehour 0x1010
|
||||
#define Timemin 0x1012
|
||||
#define IconPrintstatus 0x1014
|
||||
#define Percentage 0x1016
|
||||
#define FanKeyIcon 0x101E
|
||||
#define Flowrate 0x1300
|
||||
|
||||
#define RunoutToggle 0x1018
|
||||
#define PowerLossToggle 0x101A
|
||||
#define LedToggle 0x101C
|
||||
|
||||
#define StepMM_X 0x1242
|
||||
#define StepMM_Y 0x1246
|
||||
#define StepMM_Z 0x124A
|
||||
#define StepMM_E 0x124E
|
||||
|
||||
#define ProbeOffset_X 0x1236
|
||||
#define ProbeOffset_Y 0x123A
|
||||
#define ProbeOffset_Z 0x1026
|
||||
|
||||
#define T2Offset_X 0x1090
|
||||
#define T2Offset_Y 0x1094
|
||||
#define T2Offset_Z 0x1098
|
||||
#define T2StepMM_E 0x109C
|
||||
|
||||
#define ActiveToolVP 0x1014
|
||||
|
||||
#define HotendPID_AutoTmp 0x1252
|
||||
#define BedPID_AutoTmp 0x1254
|
||||
|
||||
#define HotendPID_P 0x1256
|
||||
#define HotendPID_I 0x125A
|
||||
#define HotendPID_D 0x125E
|
||||
|
||||
#define BedPID_P 0x1262
|
||||
#define BedPID_I 0x1266
|
||||
#define BedPID_D 0x126A
|
||||
|
||||
#define Jerk_X 0x1270
|
||||
#define Jerk_Y 0x1272
|
||||
#define Jerk_Z 0x1274
|
||||
#define Jerk_E 0x1276
|
||||
|
||||
#define Feed_X 0x1278
|
||||
#define Feed_Y 0x127A
|
||||
#define Feed_Z 0x127C
|
||||
#define Feed_E 0x127E
|
||||
|
||||
#define Accel_X 0x1280
|
||||
#define Accel_Y 0x1282
|
||||
#define Accel_Z 0x1284
|
||||
#define Accel_E 0x1286
|
||||
|
||||
#define ShapingZetaX 0x10A0
|
||||
#define ShapingZetaY 0x10A2
|
||||
#define ShapingFreqX 0x10A4
|
||||
#define ShapingFreqY 0x10A8
|
||||
|
||||
#define LinAdvKFactor 0x10AA
|
||||
|
||||
#define RunoutMode 0x10AC
|
||||
|
||||
#define BabystepIncrement 0x10AE
|
||||
|
||||
#define HeatPercentIcon 0x1024
|
||||
|
||||
#define NzBdSet 0x1032 // cooldown Hotend and Bed
|
||||
#define NozzlePreheat 0x1034 // setpoint
|
||||
#define NozzleTemp 0x1036 // Actual
|
||||
#define BedPreheat 0x103A // Setpoint
|
||||
#define Bedtemp 0x103C // Actual
|
||||
|
||||
#define e2Temp 0x1050
|
||||
#define e2Preheat 0x104E
|
||||
|
||||
#define AutoZeroIcon 0x1042
|
||||
#define AutoLevelIcon 0x1045
|
||||
#define AutoZero 0x1046
|
||||
#define DisplayXaxis 0x1048
|
||||
#define DisplayYaxis 0x104A
|
||||
#define DisplayZaxis 0x104C
|
||||
|
||||
#define FilementUnit1 0x1054
|
||||
#define Exchfilement 0x1056
|
||||
#define FilementUnit2 0x1058
|
||||
|
||||
#define MacVersion 0x1060
|
||||
#define SoftVersion 0x106A
|
||||
#define PrinterSize 0x1074
|
||||
#define CorpWebsite 0x107E
|
||||
#define VolumeIcon 0x108A
|
||||
#define SoundIcon 0x108C
|
||||
#define AutolevelIcon 0x108D
|
||||
#define ExchFlmntIcon 0x108E
|
||||
#define AutolevelVal 0x1100
|
||||
|
||||
#define FilenameIcon 0x1200
|
||||
#define FilenameIcon1 0x1220
|
||||
#define Printfilename 0x2000
|
||||
#define FilesCurentPage 0x1310
|
||||
#define FilesMaxPage 0x1312
|
||||
#define SDFILE_ADDR 0x200A
|
||||
#define FilenamePlay 0x20D2
|
||||
#define FilenameChs 0x20D3
|
||||
#define Choosefilename 0x20D4
|
||||
#define FilenameCount 0x20DE
|
||||
#define FilenameNature 0x6003
|
||||
|
||||
#define VolumeDisplay 0x1140
|
||||
#define DisplayBrightness 0x1142
|
||||
#define DisplayStandbyBrightness 0x1144
|
||||
#define DisplayStandbyEnableIndicator 0x1146
|
||||
#define DisplayStandbySeconds 0x1148
|
||||
|
||||
#define StatusMessageString 0x2064
|
||||
|
||||
#if defined(TARGET_STM32F4)
|
||||
#define DWIN_SERIAL Serial1
|
||||
#else
|
||||
#define DWIN_SERIAL LCD_SERIAL
|
||||
#endif
|
||||
|
||||
/************struct**************/
|
||||
|
||||
typedef enum : uint8_t {
|
||||
DGUS_IDLE, //< waiting for DGUS_HEADER1.
|
||||
DGUS_HEADER1_SEEN, //< DGUS_HEADER1 received
|
||||
DGUS_HEADER2_SEEN, //< DGUS_HEADER2 received
|
||||
DGUS_WAIT_TELEGRAM, //< LEN received, Waiting for to receive all bytes.
|
||||
} rx_datagram_state_t;
|
||||
|
||||
|
||||
typedef struct DataBuf
|
||||
{
|
||||
unsigned char len;
|
||||
unsigned char head[2];
|
||||
unsigned char command;
|
||||
unsigned long addr;
|
||||
unsigned long bytelen;
|
||||
unsigned short data[32];
|
||||
unsigned char reserv[4];
|
||||
} DB;
|
||||
|
||||
struct creality_dwin_settings_t {
|
||||
size_t settings_size;
|
||||
uint8_t settings_version;
|
||||
|
||||
bool display_standby;
|
||||
bool display_sound;
|
||||
int8_t screen_rotation;
|
||||
int16_t display_volume;
|
||||
uint8_t standby_screen_brightness;
|
||||
uint8_t screen_brightness;
|
||||
int16_t standby_time_seconds;
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
void SetTouchScreenConfiguration();
|
||||
|
||||
class RTSSHOW {
|
||||
public:
|
||||
RTSSHOW();
|
||||
int RTS_RecData();
|
||||
void RTS_SDCardInit(void);
|
||||
void RTS_SDCardUpate(bool, bool);
|
||||
int RTS_CheckFilement(int);
|
||||
void RTS_SndData(void);
|
||||
void RTS_SndData(const String &, unsigned long, unsigned char = VarAddr_W);
|
||||
void RTS_SndData(const char[], unsigned long, unsigned char = VarAddr_W);
|
||||
void RTS_SndData(char, unsigned long, unsigned char = VarAddr_W);
|
||||
void RTS_SndData(unsigned char*, unsigned long, unsigned char = VarAddr_W);
|
||||
void RTS_SndData(int, unsigned long, unsigned char = VarAddr_W);
|
||||
void RTS_SndData(float, unsigned long, unsigned char = VarAddr_W);
|
||||
void RTS_SndData(unsigned int,unsigned long, unsigned char = VarAddr_W);
|
||||
void RTS_SndData(long,unsigned long, unsigned char = VarAddr_W);
|
||||
void RTS_SndData(unsigned long,unsigned long, unsigned char = VarAddr_W);
|
||||
void WriteVariable(uint16_t adr, const void* values, uint8_t valueslen, bool isstr=false, char fillChar = ' ');
|
||||
void WriteVariable(uint16_t adr, long);
|
||||
void RTS_SDcard_Stop();
|
||||
void RTS_HandleData();
|
||||
void RTS_Init();
|
||||
|
||||
DB recdat;
|
||||
DB snddat;
|
||||
unsigned char databuf[SizeofDatabuf];
|
||||
|
||||
static rx_datagram_state_t rx_datagram_state;
|
||||
static uint8_t rx_datagram_len;
|
||||
static bool Initialized;
|
||||
};
|
||||
|
||||
static RTSSHOW rtscheck;
|
||||
|
||||
#define Addvalue 3
|
||||
#define PrintChoice_Value (0+Addvalue)
|
||||
#define Zoffset_Value (3+Addvalue)
|
||||
#define Setting_Value (8+Addvalue)
|
||||
#define XYZEaxis_Value (12+Addvalue)
|
||||
#define Filement_Value (15+Addvalue)
|
||||
#define Language_Value (18+Addvalue)
|
||||
#define Filename_Value (22+Addvalue)
|
||||
#define Idex_Settings_Value (26+Addvalue)
|
||||
|
||||
enum PROC_COM {Printfile=0,Ajust,Feedrate,PrintChoice=PrintChoice_Value,Zoffset=Zoffset_Value,TempControl,ManualSetTemp,Setting=Setting_Value,
|
||||
ReturnBack,Bedlevel,Autohome,XYZEaxis=XYZEaxis_Value,Filement=Filement_Value,LanguageChoice=Language_Value,No_Filement,PwrOffNoF,Volume,Filename=Filename_Value,Idex_Settings=Idex_Settings_Value};
|
||||
|
||||
const unsigned long Addrbuf[] = {0x1002, 0x1004, 0x1006, 0x1008, 0x100A, 0x100C, 0x1026, 0x1030, 0x1032, 0x1034, 0x103A,
|
||||
0x103E, 0x1040, 0x1044, 0x1046, 0x1048, 0x104A, 0x104C, 0x1054, 0x1056, 0x1058,
|
||||
0x105C, 0x105E, 0x105F, 0x1088, 0};
|
||||
|
||||
void RTSUpdate();
|
||||
void RTSInit();
|
||||
|
||||
}
|
||||
#ifndef MAIN_MENU_ITEM_1_GCODE
|
||||
#if ENABLED(AUTO_BED_LEVELING_BILINEAR)
|
||||
#define MEASURING_GCODE "M190S55\nG28O\nG34\nG29\nM400\nM104S215\nG28\nM109S215\nM420S1\nG1X100Y100F5000\nG1Z0\nM500\nM117 Set Z Offset"
|
||||
#elif ENABLED(AUTO_BED_LEVELING_UBL)
|
||||
#define MEASURING_GCODE "M190S55\nG28O\nG34\nG29P1\nG29P3\nG29S1\nG29S0\nG29F0.0\nG29A\nM104S215\nG28\nM109S215\nG1X150Y150F5000\nG1Z0\nM500\nM400\nM117 Set Z Offset"
|
||||
#else
|
||||
#define MEASURING_GCODE "G28"
|
||||
#endif
|
||||
#else
|
||||
#define MEASURING_GCODE MAIN_MENU_ITEM_1_GCODE
|
||||
#endif
|
||||
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,189 @@
|
||||
/**
|
||||
* Marlin 3D Printer Firmware
|
||||
* Copyright (c) 2021 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/>.
|
||||
*
|
||||
*/
|
||||
|
||||
/* ****************************************
|
||||
* lcd/extui/lib/Creality/FileNavigator.cpp
|
||||
* ****************************************
|
||||
* Extensible_UI implementation for Creality DWIN
|
||||
* 10SPro, Max, CR10V2
|
||||
* Based on implementations for Anycubic Chiron and Nextion by Nick Wells and Skorpi08
|
||||
* Written by Insanity Automation
|
||||
* ***************************************/
|
||||
|
||||
#include "../../../inc/MarlinConfigPre.h"
|
||||
#if ENABLED(EXTENSIBLE_UI)
|
||||
|
||||
|
||||
#include "FileNavigator.h"
|
||||
|
||||
using namespace ExtUI;
|
||||
|
||||
#define DEBUG_OUT NEXDEBUGLEVEL
|
||||
#include "../../../core/debug_out.h"
|
||||
|
||||
FileList FileNavigator::filelist; // Instance of the Marlin file API
|
||||
char FileNavigator::currentfoldername[MAX_PATH_LEN]; // Current folder path
|
||||
uint16_t FileNavigator::lastindex;
|
||||
uint8_t FileNavigator::folderdepth;
|
||||
uint16_t FileNavigator::currentindex; // override the panel request
|
||||
|
||||
FileNavigator filenavigator;
|
||||
|
||||
FileNavigator::FileNavigator() { reset(); }
|
||||
|
||||
void FileNavigator::reset() {
|
||||
currentfoldername[0] = '\0';
|
||||
folderdepth = 0;
|
||||
currentindex = 0;
|
||||
lastindex = 0;
|
||||
// Start at root folder
|
||||
while (!filelist.isAtRootDir()) filelist.upDir();
|
||||
refresh();
|
||||
}
|
||||
|
||||
void FileNavigator::refresh() { filelist.refresh(); }
|
||||
|
||||
|
||||
bool FileNavigator::getIndexisDir(uint16_t index){
|
||||
filelist.seek(index);
|
||||
return filelist.isDir();
|
||||
}
|
||||
|
||||
const char *FileNavigator::getIndexName(uint16_t index){
|
||||
filelist.seek(index);
|
||||
return filelist.shortFilename();
|
||||
}
|
||||
|
||||
uint16_t FileNavigator::maxFiles() {
|
||||
return filelist.count();
|
||||
}
|
||||
|
||||
void FileNavigator::getFiles(uint16_t index) {
|
||||
uint16_t files = DISPLAY_FILES, fcnt = 0;
|
||||
if (index == 0)
|
||||
currentindex = 0;
|
||||
else {
|
||||
// Each time we change folder we reset the file index to 0 and keep track
|
||||
// of the current position as the TFT panel isn't aware of folder trees.
|
||||
--currentindex; // go back a file to take account of the .. added to the root.
|
||||
if (index > lastindex)
|
||||
currentindex += files + 1;
|
||||
else if (currentindex >= files)
|
||||
currentindex -= files - 1;
|
||||
else
|
||||
currentindex = 0;
|
||||
}
|
||||
lastindex = index;
|
||||
|
||||
|
||||
// Clear currently drawn screen
|
||||
for (int i = 0; i < DISPLAY_FILES; i++)
|
||||
{
|
||||
for (int j = 0; j < 20; j++)
|
||||
rtscheck.RTS_SndData(0, SDFILE_ADDR + (i * 20) + j);
|
||||
}
|
||||
|
||||
for (int j = 0; j < 10; j++)
|
||||
{
|
||||
rtscheck.RTS_SndData(0, Printfilename + j); //clean screen.
|
||||
rtscheck.RTS_SndData(0, Choosefilename + j); //clean filename
|
||||
}
|
||||
for (int j = 0; j < 8; j++)
|
||||
rtscheck.RTS_SndData(0, FilenameCount + j);
|
||||
for (int j = 1; j <= DISPLAY_FILES; j++)
|
||||
{
|
||||
rtscheck.RTS_SndData(10, FilenameIcon + j);
|
||||
rtscheck.RTS_SndData(10, FilenameIcon1 + j);
|
||||
}
|
||||
|
||||
DEBUG_ECHOLNPGM("index=", index, " currentindex=", currentindex, "folderdepth=", folderdepth);
|
||||
|
||||
if (currentindex == 0 && folderdepth > 0) { // Add a link to go up a folder
|
||||
files--;
|
||||
rtscheck.RTS_SndData("Up Directory", SDFILE_ADDR);
|
||||
fcnt++;
|
||||
}
|
||||
else if(currentindex == DISPLAY_FILES && folderdepth > 0)
|
||||
currentindex--;
|
||||
|
||||
for (uint16_t seek = currentindex; seek < currentindex + files; seek++) {
|
||||
if (filelist.seek(seek)) {
|
||||
const int filelen = strlen(filelist.filename());
|
||||
if(filelen > 20)
|
||||
{
|
||||
char *buf = (char *)filelist.filename();
|
||||
//char buf[filelen];
|
||||
//strcpy(&buf[filelen], filelist.filename());
|
||||
buf[18] = '\0'; // cutoff at screen edge
|
||||
rtscheck.RTS_SndData(buf, (SDFILE_ADDR + (fcnt * 20)));
|
||||
}
|
||||
else
|
||||
rtscheck.RTS_SndData(filelist.filename(), (SDFILE_ADDR + (fcnt * 20)));
|
||||
|
||||
if (filelist.isDir())
|
||||
{
|
||||
rtscheck.RTS_SndData((uint8_t)4, FilenameIcon + (fcnt+1));
|
||||
rtscheck.RTS_SndData((unsigned long)0x041F, (FilenameNature + ((1+fcnt) * 16))); // Change BG of selected line to Blue
|
||||
}
|
||||
else
|
||||
{
|
||||
rtscheck.RTS_SndData((uint8_t)0, FilenameIcon + (fcnt+1));
|
||||
rtscheck.RTS_SndData((unsigned long)0xFFFF, (FilenameNature + ((1+fcnt) * 16))); // white
|
||||
}
|
||||
SERIAL_ECHOLNPGM("-", seek, " '", filelist.filename(), "' '", currentfoldername, "", filelist.shortFilename(), "'\n");
|
||||
fcnt++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void FileNavigator::changeDIR(char *folder) {
|
||||
DEBUG_ECHOLNPGM("currentfolder: ", currentfoldername, " New: ", folder);
|
||||
if (folderdepth >= MAX_FOLDER_DEPTH) return; // limit the folder depth
|
||||
strcat(currentfoldername, folder);
|
||||
strcat(currentfoldername, "/");
|
||||
filelist.changeDir(folder);
|
||||
refresh();
|
||||
folderdepth++;
|
||||
currentindex = 0;
|
||||
}
|
||||
|
||||
void FileNavigator::upDIR() {
|
||||
filelist.upDir();
|
||||
refresh();
|
||||
folderdepth--;
|
||||
currentindex = 0;
|
||||
// Remove the last child folder from the stored path
|
||||
if (folderdepth == 0) {
|
||||
currentfoldername[0] = '\0';
|
||||
reset();
|
||||
}
|
||||
else {
|
||||
char *pos = nullptr;
|
||||
for (uint8_t f = 0; f < folderdepth; f++)
|
||||
pos = strchr(currentfoldername, '/');
|
||||
pos[1] = '\0';
|
||||
}
|
||||
DEBUG_ECHOLNPGM("depth: ", folderdepth, " currentfoldername: ", currentfoldername);
|
||||
}
|
||||
|
||||
char* FileNavigator::getCurrentFolderName() { return currentfoldername; }
|
||||
#endif
|
||||
@@ -0,0 +1,63 @@
|
||||
/**
|
||||
* Marlin 3D Printer Firmware
|
||||
* Copyright (c) 2021 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
|
||||
|
||||
/* ****************************************
|
||||
* lcd/extui/lib/Creality/FileNavigator.h
|
||||
* ****************************************
|
||||
* Extensible_UI implementation for Creality DWIN
|
||||
* 10SPro, Max, CRX and others
|
||||
* Based on implementations for Anycubic Chiron and Nextion by Nick Wells and Skorpi08
|
||||
* Written by Insanity Automation
|
||||
* ***************************************/
|
||||
|
||||
#include "../ui_api.h"
|
||||
#include "Creality_DWIN.h"
|
||||
|
||||
#define MAX_FOLDER_DEPTH 4 // Limit folder depth TFT has a limit for the file path
|
||||
#define MAX_CMND_LEN 16 * MAX_FOLDER_DEPTH // Maximum Length for a Panel command
|
||||
#define MAX_PATH_LEN 16 * MAX_FOLDER_DEPTH // Maximum number of characters in a SD file path
|
||||
#define DISPLAY_FILES 4
|
||||
|
||||
using namespace ExtUI;
|
||||
|
||||
class FileNavigator {
|
||||
public:
|
||||
FileNavigator();
|
||||
static void reset();
|
||||
static void getFiles(uint16_t);
|
||||
static void upDIR();
|
||||
static void changeDIR(char *);
|
||||
static void refresh();
|
||||
static char* getCurrentFolderName();
|
||||
static uint8_t folderdepth;
|
||||
static uint16_t currentindex;
|
||||
static bool getIndexisDir(uint16_t);
|
||||
const char *getIndexName(uint16_t);
|
||||
static uint16_t maxFiles();
|
||||
private:
|
||||
static FileList filelist;
|
||||
static char currentfoldername[MAX_PATH_LEN];
|
||||
static uint16_t lastindex;
|
||||
};
|
||||
|
||||
extern FileNavigator filenavigator;
|
||||
@@ -722,15 +722,23 @@ namespace ExtUI {
|
||||
}
|
||||
|
||||
#if HAS_FILAMENT_SENSOR
|
||||
bool getFilamentRunoutEnabled() { return runout.enabled; }
|
||||
void setFilamentRunoutEnabled(const bool value) { runout.enabled = value; }
|
||||
bool getFilamentRunoutEnabled(const extruder_t extruder/*=E0*/) { return (runout.enabled[extruder] && (runout.mode[extruder]!=0)); }
|
||||
void setFilamentRunoutEnabled(const bool value, const extruder_t extruder/*=E0*/) { runout.enabled[extruder] = value; }
|
||||
bool getFilamentRunoutState() { return runout.filament_ran_out; }
|
||||
void setFilamentRunoutState(const bool value) { runout.filament_ran_out = value; }
|
||||
float getFilamentRunoutDistance_mm() { return runout.runout_distance(); }
|
||||
void setFilamentRunoutDistance_mm(const_float_t value) { runout.set_runout_distance(constrain(value, 0, 999)); }
|
||||
int getRunoutMode(const extruder_t extruder/*=E0*/){
|
||||
return (int)runout.mode[extruder];
|
||||
}
|
||||
void setRunoutMode(const int mode, const extruder_t extruder/*=E0*/){
|
||||
if((mode >= 0 && mode <=2) || mode==7) {
|
||||
runout.mode[extruder] = (RunoutMode)mode;
|
||||
runout.setup();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#if HAS_FILAMENT_RUNOUT_DISTANCE
|
||||
float getFilamentRunoutDistance_mm() { return runout.runout_distance(); }
|
||||
void setFilamentRunoutDistance_mm(const_float_t value) { runout.set_runout_distance(constrain(value, 0, 999)); }
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if ENABLED(CASE_LIGHT_ENABLE)
|
||||
@@ -765,6 +773,26 @@ namespace ExtUI {
|
||||
}
|
||||
#endif
|
||||
|
||||
#if HAS_SHAPING
|
||||
float getShapingZeta(const axis_t axis) {
|
||||
return stepper.get_shaping_damping_ratio(AxisEnum(axis));
|
||||
}
|
||||
void setShapingZeta(const float zeta, const axis_t axis) {
|
||||
if (WITHIN(zeta, 0, 1)) {
|
||||
stepper.set_shaping_damping_ratio(AxisEnum(axis), zeta);
|
||||
}
|
||||
}
|
||||
float getShapingFrequency(const axis_t axis) {
|
||||
return stepper.get_shaping_frequency(AxisEnum(axis));
|
||||
}
|
||||
void setShapingFrequency(const float freq, const axis_t axis) {
|
||||
constexpr float min_freq = float(uint32_t(STEPPER_TIMER_RATE) / 2) / shaping_time_t(-2);
|
||||
if (freq == 0.0f || freq > min_freq) {
|
||||
stepper.set_shaping_frequency(AxisEnum(axis), freq);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#if HAS_JUNCTION_DEVIATION
|
||||
|
||||
float getJunctionDeviation_mm() { return planner.junction_deviation_mm; }
|
||||
@@ -933,6 +961,7 @@ namespace ExtUI {
|
||||
#if HAS_BED_PROBE
|
||||
float getProbeOffset_mm(const axis_t axis) { return probe.offset.pos[axis]; }
|
||||
void setProbeOffset_mm(const_float_t val, const axis_t axis) { probe.offset.pos[axis] = val; }
|
||||
probe_limits getBedProbeLimits() {return (probe_limits){probe.min_x(), probe.min_y(), probe.max_x(), probe.max_y()};}
|
||||
#endif
|
||||
|
||||
#if ENABLED(BACKLASH_GCODE)
|
||||
@@ -1169,7 +1198,7 @@ namespace ExtUI {
|
||||
return isPrinting() && (isPrintingFromMediaPaused() || print_job_timer.isPaused());
|
||||
}
|
||||
|
||||
bool isMediaInserted() { return TERN0(HAS_MEDIA, IS_SD_INSERTED()); }
|
||||
bool isMediaInserted() { return TERN0(HAS_MEDIA, IS_SD_INSERTED() || card.isMounted()); }
|
||||
|
||||
// Pause/Resume/Stop are implemented in MarlinUI
|
||||
void pausePrint() { ui.pause_print(); }
|
||||
|
||||
@@ -68,6 +68,7 @@ namespace ExtUI {
|
||||
enum extruder_t : uint8_t { E0, E1, E2, E3, E4, E5, E6, E7 };
|
||||
enum heater_t : uint8_t { H0, H1, H2, H3, H4, H5, BED, CHAMBER, COOLER };
|
||||
enum fan_t : uint8_t { FAN0, FAN1, FAN2, FAN3, FAN4, FAN5, FAN6, FAN7 };
|
||||
struct probe_limits { float pos[4];};
|
||||
#if HAS_PID_HEATING
|
||||
enum pidresult_t : uint8_t { PID_STARTED, PID_BED_STARTED, PID_CHAMBER_STARTED, PID_BAD_HEATER_ID, PID_TEMP_TOO_HIGH, PID_TUNING_TIMEOUT, PID_DONE };
|
||||
#endif
|
||||
@@ -327,6 +328,13 @@ namespace ExtUI {
|
||||
void setLinearAdvance_mm_mm_s(const_float_t, const extruder_t);
|
||||
#endif
|
||||
|
||||
#if HAS_SHAPING
|
||||
float getShapingZeta(const axis_t);
|
||||
void setShapingZeta(const float, const axis_t);
|
||||
float getShapingFrequency(const axis_t);
|
||||
void setShapingFrequency(const float, const axis_t);
|
||||
#endif
|
||||
|
||||
// JD or Jerk Control
|
||||
#if HAS_JUNCTION_DEVIATION
|
||||
float getJunctionDeviation_mm();
|
||||
@@ -367,6 +375,7 @@ namespace ExtUI {
|
||||
#if HAS_BED_PROBE
|
||||
float getProbeOffset_mm(const axis_t);
|
||||
void setProbeOffset_mm(const_float_t, const axis_t);
|
||||
probe_limits getBedProbeLimits();
|
||||
#endif
|
||||
|
||||
// Backlash Control
|
||||
@@ -385,15 +394,14 @@ namespace ExtUI {
|
||||
|
||||
// Filament Runout Sensor
|
||||
#if HAS_FILAMENT_SENSOR
|
||||
bool getFilamentRunoutEnabled();
|
||||
void setFilamentRunoutEnabled(const bool);
|
||||
bool getFilamentRunoutEnabled(const extruder_t extruder=E0);
|
||||
void setFilamentRunoutEnabled(const bool, const extruder_t extruder=E0);
|
||||
bool getFilamentRunoutState();
|
||||
void setFilamentRunoutState(const bool);
|
||||
|
||||
#if HAS_FILAMENT_RUNOUT_DISTANCE
|
||||
float getFilamentRunoutDistance_mm();
|
||||
void setFilamentRunoutDistance_mm(const_float_t);
|
||||
#endif
|
||||
float getFilamentRunoutDistance_mm();
|
||||
void setFilamentRunoutDistance_mm(const_float_t);
|
||||
int getRunoutMode(const extruder_t extruder=E0);
|
||||
void setRunoutMode(const int, const extruder_t extruder=E0);
|
||||
#endif
|
||||
|
||||
// Case Light Control
|
||||
|
||||
@@ -719,6 +719,11 @@ namespace LanguageNarrow_en {
|
||||
LSTR MSG_FILAMENT_CHANGE_NOZZLE = _UxGT(" Nozzle: ");
|
||||
LSTR MSG_RUNOUT_SENSOR = _UxGT("Runout Sensor");
|
||||
LSTR MSG_RUNOUT_DISTANCE_MM = _UxGT("Runout Dist mm");
|
||||
LSTR MSG_RUNOUT_MODE = _UxGT("Runout Mode");
|
||||
LSTR MSG_RUNOUT_MODE_HIGH = _UxGT("Sensor High");
|
||||
LSTR MSG_RUNOUT_MODE_LOW = _UxGT("Sensor Low");
|
||||
LSTR MSG_RUNOUT_MODE_MOTION = _UxGT("Motion Encoder");
|
||||
LSTR MSG_RUNOUT_MODE_NONE = _UxGT("No Sensor");
|
||||
LSTR MSG_RUNOUT_ENABLE = _UxGT("Enable Runout");
|
||||
LSTR MSG_RUNOUT_ACTIVE = _UxGT("Runout Active");
|
||||
LSTR MSG_INVERT_EXTRUDER = _UxGT("Invert Extruder");
|
||||
|
||||
@@ -1668,7 +1668,7 @@ void MarlinUI::host_notify(const char * const cstr) {
|
||||
card.abortFilePrintSoon();
|
||||
else if (card.isMounted())
|
||||
card.closefile();
|
||||
#endif
|
||||
#endif
|
||||
#ifdef ACTION_ON_CANCEL
|
||||
hostui.cancel();
|
||||
#endif
|
||||
|
||||
@@ -45,7 +45,7 @@
|
||||
#include "../../module/temperature.h"
|
||||
#endif
|
||||
|
||||
#if HAS_FILAMENT_RUNOUT_DISTANCE
|
||||
#if HAS_FILAMENT_SENSOR
|
||||
#include "../../feature/runout.h"
|
||||
#endif
|
||||
|
||||
@@ -99,6 +99,54 @@ void menu_backlash();
|
||||
|
||||
#endif
|
||||
|
||||
#if HAS_FILAMENT_SENSOR
|
||||
|
||||
void set_runout_mode_none(const uint8_t e) { runout.mode[e] = RM_NONE; runout.setup(); }
|
||||
void set_runout_mode_high(const uint8_t e) { runout.mode[e] = RM_OUT_ON_HIGH; runout.setup(); }
|
||||
void set_runout_mode_low(const uint8_t e) { runout.mode[e] = RM_OUT_ON_LOW; runout.setup(); }
|
||||
void set_runout_mode_motion(const uint8_t e) { runout.mode[e] = RM_MOTION_SENSOR; runout.setup(); }
|
||||
|
||||
#define RUNOUT_EDIT_ITEMS(F) do{ \
|
||||
EDIT_ITEM(bool, MSG_RUNOUT_SENSOR, &runout.enabled[F]); \
|
||||
ACTION_ITEM(MSG_RUNOUT_MODE_NONE, []{ set_runout_mode_none(F); }); \
|
||||
ACTION_ITEM(MSG_RUNOUT_MODE_HIGH, []{ set_runout_mode_high(F); }); \
|
||||
ACTION_ITEM(MSG_RUNOUT_MODE_LOW, []{ set_runout_mode_low(F); }); \
|
||||
ACTION_ITEM(MSG_RUNOUT_MODE_MOTION, []{ set_runout_mode_motion(F); }); \
|
||||
editable.decimal = runout.runout_distance(F); \
|
||||
EDIT_ITEM_FAST(float3, MSG_RUNOUT_DISTANCE_MM, &editable.decimal, 1, 999, \
|
||||
[]{ runout.set_runout_distance(editable.decimal, F); }, true \
|
||||
); \
|
||||
}while(0)
|
||||
|
||||
void menu_runout_config() {
|
||||
START_MENU();
|
||||
BACK_ITEM(MSG_CONFIGURATION);
|
||||
RUNOUT_EDIT_ITEMS(0);
|
||||
#if NUM_RUNOUT_SENSORS > 1
|
||||
RUNOUT_EDIT_ITEMS(1);
|
||||
#endif
|
||||
#if NUM_RUNOUT_SENSORS > 2
|
||||
RUNOUT_EDIT_ITEMS(2);
|
||||
#endif
|
||||
#if NUM_RUNOUT_SENSORS > 3
|
||||
RUNOUT_EDIT_ITEMS(3);
|
||||
#endif
|
||||
#if NUM_RUNOUT_SENSORS > 4
|
||||
RUNOUT_EDIT_ITEMS(4);
|
||||
#endif
|
||||
#if NUM_RUNOUT_SENSORS > 5
|
||||
RUNOUT_EDIT_ITEMS(5);
|
||||
#endif
|
||||
#if NUM_RUNOUT_SENSORS > 6
|
||||
RUNOUT_EDIT_ITEMS(6);
|
||||
#endif
|
||||
#if NUM_RUNOUT_SENSORS > 7
|
||||
RUNOUT_EDIT_ITEMS(7);
|
||||
#endif
|
||||
END_MENU();
|
||||
}
|
||||
#endif
|
||||
|
||||
#if DISABLED(NO_VOLUMETRICS) || ENABLED(ADVANCED_PAUSE_FEATURE)
|
||||
//
|
||||
// Advanced Settings > Filament
|
||||
@@ -152,11 +200,8 @@ void menu_backlash();
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if HAS_FILAMENT_RUNOUT_DISTANCE
|
||||
editable.decimal = runout.runout_distance();
|
||||
EDIT_ITEM_FAST(float3, MSG_RUNOUT_DISTANCE_MM, &editable.decimal, 1, 999,
|
||||
[]{ runout.set_runout_distance(editable.decimal); }, true
|
||||
);
|
||||
#if HAS_FILAMENT_SENSOR
|
||||
SUBMENU(MSG_RUNOUT_MODE, menu_runout_config);
|
||||
#endif
|
||||
|
||||
END_MENU();
|
||||
|
||||
@@ -94,16 +94,22 @@ static_assert(COUNT(lco) == 4 || lcodiff == 1 || lcodiff == 3, "The first two BE
|
||||
constexpr int nr_edge_points = tramming_3_points ? 3 : 4;
|
||||
constexpr int available_points = nr_edge_points + ENABLED(BED_TRAMMING_INCLUDE_CENTER);
|
||||
constexpr int center_index = TERN(BED_TRAMMING_INCLUDE_CENTER, available_points - 1, -1);
|
||||
constexpr float inset_lfrb[4] = BED_TRAMMING_INSET_LFRB;
|
||||
constexpr xy_pos_t lf { (X_MIN_BED) + inset_lfrb[0], (Y_MIN_BED) + inset_lfrb[1] },
|
||||
#if DISABLED(BED_TRAMMING_USE_PROBE)
|
||||
constexpr float inset_lfrb[4] = BED_TRAMMING_INSET_LFRB;
|
||||
constexpr xy_pos_t lf { (X_MIN_BED) + inset_lfrb[0], (Y_MIN_BED) + inset_lfrb[1] },
|
||||
rb { (X_MAX_BED) - inset_lfrb[2], (Y_MAX_BED) - inset_lfrb[3] };
|
||||
|
||||
#endif
|
||||
static int8_t bed_corner;
|
||||
|
||||
/**
|
||||
* Move to the next corner coordinates
|
||||
*/
|
||||
static void _lcd_goto_next_corner() {
|
||||
#if ENABLED(BED_TRAMMING_USE_PROBE)
|
||||
xy_pos_t lf = {X_MIN_BED + probe.min_x() + 0.01f, Y_MIN_BED + probe.min_y() + 0.01f },
|
||||
rb = {X_MAX_BED - probe.max_x() - 0.01f, Y_MAX_BED - probe.max_y() - 0.01f };
|
||||
#endif
|
||||
|
||||
xy_pos_t corner_point = lf; // Left front
|
||||
|
||||
if (tramming_3_points) {
|
||||
@@ -165,11 +171,6 @@ static void _lcd_goto_next_corner() {
|
||||
|
||||
#if ENABLED(BED_TRAMMING_USE_PROBE)
|
||||
|
||||
#define VALIDATE_POINT(X, Y, STR) static_assert(Probe::build_time::can_reach((X), (Y)), \
|
||||
"BED_TRAMMING_INSET_LFRB " STR " inset is not reachable with the default NOZZLE_TO_PROBE offset and PROBING_MARGIN.")
|
||||
VALIDATE_POINT(lf.x, Y_CENTER, "left"); VALIDATE_POINT(X_CENTER, lf.y, "front");
|
||||
VALIDATE_POINT(rb.x, Y_CENTER, "right"); VALIDATE_POINT(X_CENTER, rb.y, "back");
|
||||
|
||||
#ifndef PAGE_CONTAINS
|
||||
#define PAGE_CONTAINS(...) true
|
||||
#endif
|
||||
|
||||
@@ -634,7 +634,7 @@ void menu_configuration() {
|
||||
#endif
|
||||
|
||||
#if HAS_FILAMENT_SENSOR
|
||||
EDIT_ITEM(bool, MSG_RUNOUT_SENSOR, &runout.enabled, runout.reset);
|
||||
EDIT_ITEM(bool, MSG_RUNOUT_SENSOR, &runout.enabled[active_extruder], runout.reset);
|
||||
#endif
|
||||
|
||||
#if HAS_FANCHECK
|
||||
|
||||
@@ -264,7 +264,7 @@ void menu_pause_option() {
|
||||
|
||||
#if HAS_FILAMENT_SENSOR
|
||||
if (still_out)
|
||||
EDIT_ITEM(bool, MSG_RUNOUT_SENSOR, &runout.enabled, runout.reset);
|
||||
EDIT_ITEM(bool, MSG_RUNOUT_SENSOR, &runout.enabled[active_extruder], runout.reset);
|
||||
#endif
|
||||
|
||||
if (!still_out)
|
||||
|
||||
@@ -50,6 +50,10 @@
|
||||
#include "../feature/joystick.h"
|
||||
#endif
|
||||
|
||||
#if HAS_FILAMENT_SENSOR
|
||||
#include "../feature/runout.h"
|
||||
#endif
|
||||
|
||||
#if HAS_BED_PROBE
|
||||
#include "probe.h"
|
||||
#endif
|
||||
@@ -481,22 +485,35 @@ void __O2 Endstops::report_states() {
|
||||
#if USE_Z_MIN_PROBE
|
||||
print_es_state(PROBE_TRIGGERED(), F(STR_Z_PROBE));
|
||||
#endif
|
||||
#if MULTI_FILAMENT_SENSOR
|
||||
#define _CASE_RUNOUT(N) case N: pin = FIL_RUNOUT##N##_PIN; state = FIL_RUNOUT##N##_STATE; break;
|
||||
#if HAS_FILAMENT_SENSOR
|
||||
for (uint8_t i = 1; i <= NUM_RUNOUT_SENSORS; ++i) {
|
||||
pin_t pin;
|
||||
uint8_t state;
|
||||
switch (i) {
|
||||
default: continue;
|
||||
#define _CASE_RUNOUT(N) case N: pin = FIL_RUNOUT##N##_PIN; break;
|
||||
REPEAT_1(NUM_RUNOUT_SENSORS, _CASE_RUNOUT)
|
||||
#undef _CASE_RUNOUT
|
||||
}
|
||||
SERIAL_ECHOPGM(STR_FILAMENT);
|
||||
if (i > 1) SERIAL_CHAR(' ', '0' + i);
|
||||
print_es_state(extDigitalRead(pin) != state);
|
||||
const RunoutMode rm = runout.mode[i - 1];
|
||||
const uint8_t outval = runout.out_state(i - 1);
|
||||
|
||||
#if DISABLED(SLIM_LCD_MENUS)
|
||||
SERIAL_ECHOPGM(STR_FILAMENT);
|
||||
if (i > 1) SERIAL_CHAR(' ', '0' + i);
|
||||
SERIAL_ECHOPGM(": ");
|
||||
if (rm == RM_NONE)
|
||||
SERIAL_ECHOLNPGM(STR_OFF);
|
||||
else if (rm == RM_MOTION_SENSOR) {
|
||||
SERIAL_ECHOPGM("MOTION : ");
|
||||
print_es_state(extDigitalRead(pin) == outval);
|
||||
}
|
||||
else
|
||||
SERIAL_ECHOLNPGM_P(extDigitalRead(pin) == outval ? PSTR("OUT") : PSTR("PRESENT"));
|
||||
#else
|
||||
print_es_state(extDigitalRead(pin) == outval, F(STR_FILAMENT));
|
||||
#endif
|
||||
}
|
||||
#undef _CASE_RUNOUT
|
||||
#elif HAS_FILAMENT_SENSOR
|
||||
print_es_state(READ(FIL_RUNOUT1_PIN) != FIL_RUNOUT1_STATE, F(STR_FILAMENT));
|
||||
|
||||
#endif
|
||||
|
||||
TERN_(BLTOUCH, bltouch._reset_SW_mode());
|
||||
|
||||
@@ -41,8 +41,8 @@
|
||||
|
||||
// Check the integrity of data offsets.
|
||||
// Can be disabled for production build.
|
||||
//#define DEBUG_EEPROM_READWRITE
|
||||
//#define DEBUG_EEPROM_OBSERVE
|
||||
#define DEBUG_EEPROM_READWRITE
|
||||
#define DEBUG_EEPROM_OBSERVE
|
||||
|
||||
#include "settings.h"
|
||||
|
||||
@@ -116,9 +116,6 @@
|
||||
|
||||
#if HAS_FILAMENT_SENSOR
|
||||
#include "../feature/runout.h"
|
||||
#ifndef FIL_RUNOUT_ENABLED_DEFAULT
|
||||
#define FIL_RUNOUT_ENABLED_DEFAULT true
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if ENABLED(ADVANCE_K_EXTRA)
|
||||
@@ -249,8 +246,11 @@ typedef struct SettingsDataStruct {
|
||||
//
|
||||
// FILAMENT_RUNOUT_SENSOR
|
||||
//
|
||||
bool runout_sensor_enabled; // M412 S
|
||||
float runout_distance_mm; // M412 D
|
||||
#if HAS_FILAMENT_SENSOR
|
||||
bool runout_enabled[NUM_RUNOUT_SENSORS]; // M591 S
|
||||
float runout_distance_mm[NUM_RUNOUT_SENSORS]; // M591 D
|
||||
uint8_t runout_mode[NUM_RUNOUT_SENSORS]; // M591 P
|
||||
#endif
|
||||
|
||||
//
|
||||
// ENABLE_LEVELING_FADE_HEIGHT
|
||||
@@ -904,22 +904,14 @@ void MarlinSettings::postprocess() {
|
||||
//
|
||||
// Filament Runout Sensor
|
||||
//
|
||||
#if HAS_FILAMENT_SENSOR
|
||||
{
|
||||
#if HAS_FILAMENT_SENSOR
|
||||
const bool &runout_sensor_enabled = runout.enabled;
|
||||
#else
|
||||
constexpr int8_t runout_sensor_enabled = -1;
|
||||
#endif
|
||||
_FIELD_TEST(runout_sensor_enabled);
|
||||
EEPROM_WRITE(runout_sensor_enabled);
|
||||
|
||||
#if HAS_FILAMENT_RUNOUT_DISTANCE
|
||||
const float &runout_distance_mm = runout.runout_distance();
|
||||
#else
|
||||
constexpr float runout_distance_mm = 0;
|
||||
#endif
|
||||
EEPROM_WRITE(runout_distance_mm);
|
||||
_FIELD_TEST(runout_enabled);
|
||||
for(uint8_t e=0; e<NUM_RUNOUT_SENSORS; ++e) EEPROM_WRITE(runout.enabled[e]);
|
||||
for(uint8_t e=0; e<NUM_RUNOUT_SENSORS; ++e) EEPROM_WRITE(runout.runout_distance(e));
|
||||
for(uint8_t e=0; e<NUM_RUNOUT_SENSORS; ++e) EEPROM_WRITE(runout.mode[e]);
|
||||
}
|
||||
#endif
|
||||
|
||||
//
|
||||
// Global Leveling
|
||||
@@ -1935,22 +1927,26 @@ void MarlinSettings::postprocess() {
|
||||
//
|
||||
// Filament Runout Sensor
|
||||
//
|
||||
#if HAS_FILAMENT_SENSOR
|
||||
{
|
||||
int8_t runout_sensor_enabled;
|
||||
_FIELD_TEST(runout_sensor_enabled);
|
||||
EEPROM_READ(runout_sensor_enabled);
|
||||
#if HAS_FILAMENT_SENSOR
|
||||
if (!validating) runout.enabled = runout_sensor_enabled < 0 ? FIL_RUNOUT_ENABLED_DEFAULT : runout_sensor_enabled;
|
||||
#endif
|
||||
bool runout_enabled[NUM_RUNOUT_SENSORS];
|
||||
float runout_distance_mm[NUM_RUNOUT_SENSORS];
|
||||
RunoutMode runout_mode[NUM_RUNOUT_SENSORS];
|
||||
|
||||
TERN_(HAS_FILAMENT_SENSOR, if (runout.enabled) runout.reset());
|
||||
|
||||
float runout_distance_mm;
|
||||
EEPROM_READ(runout_enabled);
|
||||
EEPROM_READ(runout_distance_mm);
|
||||
#if HAS_FILAMENT_RUNOUT_DISTANCE
|
||||
if (!validating) runout.set_runout_distance(runout_distance_mm);
|
||||
#endif
|
||||
EEPROM_READ(runout_mode);
|
||||
|
||||
if (!validating) {
|
||||
for(uint8_t e=0; e < NUM_RUNOUT_SENSORS; ++e) {
|
||||
runout.enabled[e] = runout_enabled[e];
|
||||
runout.set_runout_distance(runout_distance_mm[e], e);
|
||||
runout.mode[e] = runout_mode[e];
|
||||
}
|
||||
runout.reset();
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
//
|
||||
// Global Leveling
|
||||
@@ -3166,9 +3162,16 @@ void MarlinSettings::reset() {
|
||||
//
|
||||
|
||||
#if HAS_FILAMENT_SENSOR
|
||||
runout.enabled = FIL_RUNOUT_ENABLED_DEFAULT;
|
||||
constexpr bool fred[] = FIL_RUNOUT_ENABLED;
|
||||
constexpr uint8_t frm[] = FIL_RUNOUT_MODE;
|
||||
constexpr float frd[] = FIL_RUNOUT_DISTANCE_MM;
|
||||
static_assert(COUNT(fred) == NUM_RUNOUT_SENSORS, "FIL_RUNOUT_ENABLED must have NUM_RUNOUT_SENSORS values.");
|
||||
static_assert(COUNT(frm) == NUM_RUNOUT_SENSORS, "FIL_RUNOUT_MODE must have NUM_RUNOUT_SENSORS values.");
|
||||
static_assert(COUNT(frd) == NUM_RUNOUT_SENSORS, "FIL_RUNOUT_DISTANCE_MM must have NUM_RUNOUT_SENSORS values.");
|
||||
COPY(runout.enabled, fred);
|
||||
COPY(runout.mode, frm);
|
||||
for(uint8_t e = 0; e < NUM_RUNOUT_SENSORS; ++e) runout.set_runout_distance(frd[e], e);
|
||||
runout.reset();
|
||||
TERN_(HAS_FILAMENT_RUNOUT_DISTANCE, runout.set_runout_distance(FILAMENT_RUNOUT_DISTANCE_MM));
|
||||
#endif
|
||||
|
||||
//
|
||||
@@ -3969,7 +3972,7 @@ void MarlinSettings::reset() {
|
||||
//
|
||||
// Filament Runout Sensor
|
||||
//
|
||||
TERN_(HAS_FILAMENT_SENSOR, gcode.M412_report(forReplay));
|
||||
TERN_(HAS_FILAMENT_SENSOR, gcode.M591_report(forReplay));
|
||||
|
||||
#if HAS_ETHERNET
|
||||
CONFIG_ECHO_HEADING("Ethernet");
|
||||
|
||||
@@ -122,7 +122,7 @@ Stepper stepper; // Singleton
|
||||
#include "../feature/mixing.h"
|
||||
#endif
|
||||
|
||||
#if HAS_FILAMENT_RUNOUT_DISTANCE
|
||||
#if HAS_FILAMENT_SENSOR
|
||||
#include "../feature/runout.h"
|
||||
#endif
|
||||
|
||||
@@ -2292,7 +2292,7 @@ hal_timer_t Stepper::block_phase_isr() {
|
||||
PAGE_SEGMENT_UPDATE_POS(E);
|
||||
}
|
||||
#endif
|
||||
TERN_(HAS_FILAMENT_RUNOUT_DISTANCE, runout.block_completed(current_block));
|
||||
TERN_(HAS_FILAMENT_SENSOR, runout.block_completed(current_block));
|
||||
discard_current_block();
|
||||
}
|
||||
else {
|
||||
|
||||
@@ -224,6 +224,8 @@
|
||||
#include "ramps/pins_RAMPS_CREALITY.h" // ATmega2560 env:mega2560
|
||||
#elif MB(DAGOMA_F5)
|
||||
#include "ramps/pins_DAGOMA_F5.h" // ATmega2560 env:mega2560
|
||||
#elif MB(DAGOMA_D6)
|
||||
#include "ramps/pins_DAGOMA_D6.h" // ATmega2560 env:mega2560ext
|
||||
#elif MB(FYSETC_F6_13)
|
||||
#include "ramps/pins_FYSETC_F6_13.h" // ATmega2560 env:FYSETC_F6
|
||||
#elif MB(FYSETC_F6_14)
|
||||
|
||||
@@ -0,0 +1,119 @@
|
||||
/**
|
||||
* Marlin 3D Printer Firmware
|
||||
* Copyright (c) 2024 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
|
||||
|
||||
#if HOTENDS > 2 || E_STEPPERS > 2
|
||||
#error "Dagoma3D D6 supports up to 2 hotends / E-steppers."
|
||||
#endif
|
||||
|
||||
#define BOARD_INFO_NAME "Dagoma3D D6"
|
||||
|
||||
//
|
||||
// Trinamic Stallguard pins
|
||||
//
|
||||
#define X_DIAG_PIN 43
|
||||
#define Y_DIAG_PIN 41
|
||||
#define Z_DIAG_PIN 47
|
||||
#define E0_DIAG_PIN 21
|
||||
#define E1_DIAG_PIN 20
|
||||
|
||||
//
|
||||
// Endstops
|
||||
//
|
||||
#define X_STOP_PIN 2
|
||||
#define Y_STOP_PIN 3
|
||||
#define Z_STOP_PIN 15
|
||||
|
||||
//
|
||||
// Filament Runout Sensor
|
||||
//
|
||||
#ifndef FIL_RUNOUT_PIN
|
||||
#define FIL_RUNOUT_PIN 39
|
||||
#endif
|
||||
#if EXTRUDERS > 1 && !defined(FIL_RUNOUT2_PIN)
|
||||
#define FIL_RUNOUT2_PIN 14
|
||||
#endif
|
||||
|
||||
// Alter timing for graphical display
|
||||
#if IS_U8GLIB_ST7920
|
||||
#ifndef BOARD_ST7920_DELAY_1
|
||||
#define BOARD_ST7920_DELAY_1 0
|
||||
#endif
|
||||
#ifndef BOARD_ST7920_DELAY_2
|
||||
#define BOARD_ST7920_DELAY_2 250
|
||||
#endif
|
||||
#ifndef BOARD_ST7920_DELAY_3
|
||||
#define BOARD_ST7920_DELAY_3 250
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#define KILL_PIN -1 // NC
|
||||
|
||||
#define LCD_CONTRAST_DEFAULT 255
|
||||
|
||||
//
|
||||
// Sensorless homing DIAG pin is not directly connected to the MCU. Close
|
||||
// the jumper next to the limit switch socket when using sensorless homing.
|
||||
//
|
||||
#if HAS_TMC_UART
|
||||
/**
|
||||
* TMC2208/TMC2209 stepper drivers
|
||||
*/
|
||||
#define X_SERIAL_RX_PIN 73
|
||||
#define X_SERIAL_TX_PIN 73
|
||||
#define Y_SERIAL_RX_PIN 73
|
||||
#define Y_SERIAL_TX_PIN 73
|
||||
#define Z_SERIAL_RX_PIN 73
|
||||
#define Z_SERIAL_TX_PIN 73
|
||||
#define E0_SERIAL_RX_PIN 73
|
||||
#define E0_SERIAL_TX_PIN 73
|
||||
#define E1_SERIAL_RX_PIN 12
|
||||
#define E1_SERIAL_TX_PIN 12
|
||||
|
||||
// Default TMC slave addresses
|
||||
#ifndef X_SLAVE_ADDRESS
|
||||
#define X_SLAVE_ADDRESS 0
|
||||
#endif
|
||||
#ifndef Y_SLAVE_ADDRESS
|
||||
#define Y_SLAVE_ADDRESS 1
|
||||
#endif
|
||||
#ifndef Z_SLAVE_ADDRESS
|
||||
#define Z_SLAVE_ADDRESS 2
|
||||
#endif
|
||||
#ifndef E0_SLAVE_ADDRESS
|
||||
#define E0_SLAVE_ADDRESS 3
|
||||
#endif
|
||||
#ifndef E1_SLAVE_ADDRESS
|
||||
#define E1_SLAVE_ADDRESS 3
|
||||
#endif
|
||||
static_assert(X_SLAVE_ADDRESS == 0, "X_SLAVE_ADDRESS must be 0 for BOARD_DAGOMA_D6.");
|
||||
static_assert(Y_SLAVE_ADDRESS == 1, "Y_SLAVE_ADDRESS must be 1 for BOARD_DAGOMA_D6.");
|
||||
static_assert(Z_SLAVE_ADDRESS == 2, "Z_SLAVE_ADDRESS must be 2 for BOARD_DAGOMA_D6.");
|
||||
static_assert(E0_SLAVE_ADDRESS == 3, "E0_SLAVE_ADDRESS must be 3 for BOARD_DAGOMA_D6.");
|
||||
static_assert(E1_SLAVE_ADDRESS == 3, "E1_SLAVE_ADDRESS must be 3 for BOARD_DAGOMA_D6.");
|
||||
|
||||
#endif
|
||||
|
||||
//
|
||||
// Import default RAMPS 1.4 pins
|
||||
//
|
||||
#include "pins_RAMPS.h"
|
||||
@@ -36,14 +36,6 @@
|
||||
#define BOARD_INFO_NAME "Tenlog D3 Hero"
|
||||
#define DEFAULT_MACHINE_NAME BOARD_INFO_NAME
|
||||
|
||||
//
|
||||
// Servos
|
||||
//
|
||||
#define SERVO0_PIN 11
|
||||
#define SERVO1_PIN 6
|
||||
#define SERVO2_PIN -1 // Original pin 5 used for hotend fans
|
||||
#define SERVO3_PIN 4
|
||||
|
||||
//
|
||||
// Limit Switches
|
||||
//
|
||||
@@ -52,15 +44,13 @@
|
||||
#define Y_MIN_PIN 14
|
||||
//#define Y_MAX_PIN 15 // Connected to "DJ" plug on extruder heads
|
||||
#define Z_MIN_PIN 18
|
||||
#define Z_MAX_PIN 19
|
||||
|
||||
//
|
||||
// Z Probe (when not Z_MIN_PIN)
|
||||
//
|
||||
#ifndef Z_MIN_PROBE_PIN
|
||||
#define Z_MIN_PROBE_PIN 15 // Ramps is normally 32
|
||||
#if ENABLED(BLTOUCH)
|
||||
#define SERVO0_PIN 19
|
||||
#else
|
||||
#define Z_MAX_PIN 19
|
||||
#endif
|
||||
|
||||
|
||||
//
|
||||
// Steppers
|
||||
//
|
||||
@@ -99,16 +89,17 @@
|
||||
//#define Z2_CS_PIN 40
|
||||
//#endif
|
||||
|
||||
#define E0_STEP_PIN 26
|
||||
#define E0_DIR_PIN 28
|
||||
#define E0_ENABLE_PIN 24
|
||||
|
||||
#define E0_STEP_PIN 57
|
||||
#define E0_DIR_PIN 58
|
||||
#define E0_ENABLE_PIN 59
|
||||
//#ifndef E0_CS_PIN
|
||||
//define E0_CS_PIN 42
|
||||
//#endif
|
||||
|
||||
#define E1_STEP_PIN 57
|
||||
#define E1_DIR_PIN 58
|
||||
#define E1_ENABLE_PIN 59
|
||||
#define E1_STEP_PIN 26
|
||||
#define E1_DIR_PIN 28
|
||||
#define E1_ENABLE_PIN 24
|
||||
//#ifndef E1_CS_PIN
|
||||
//define E1_CS_PIN 44
|
||||
//#endif
|
||||
@@ -120,8 +111,8 @@
|
||||
//
|
||||
// Temperature Sensors
|
||||
//
|
||||
#define TEMP_0_PIN 13 // Analog Input
|
||||
#define TEMP_1_PIN 15 // Analog Input
|
||||
#define TEMP_0_PIN 15 // Analog Input
|
||||
#define TEMP_1_PIN 13 // Analog Input
|
||||
#define TEMP_BED_PIN 14 // Analog Input
|
||||
|
||||
// SPI for MAX Thermocouple
|
||||
@@ -134,8 +125,8 @@
|
||||
//
|
||||
// Heaters / Fans
|
||||
//
|
||||
#define HEATER_0_PIN 10
|
||||
#define HEATER_1_PIN 11
|
||||
#define HEATER_0_PIN 11
|
||||
#define HEATER_1_PIN 10
|
||||
#define HEATER_BED_PIN 8
|
||||
|
||||
#define FAN0_PIN 9
|
||||
@@ -143,9 +134,16 @@
|
||||
|
||||
// XXX Runout support unknown?
|
||||
//#define NUM_RUNOUT_SENSORS 0
|
||||
//#define FIL_RUNOUT_PIN 22
|
||||
#define FIL_RUNOUT_PIN 15
|
||||
//#define FIL_RUNOUT2_PIN 21
|
||||
|
||||
//
|
||||
// PSU and Powerloss Recovery
|
||||
//
|
||||
#ifdef PSU_CONTROL
|
||||
#define PS_ON_PIN 40
|
||||
#endif
|
||||
|
||||
//
|
||||
// Misc. Functions
|
||||
//
|
||||
|
||||
@@ -105,6 +105,11 @@
|
||||
#define BEEPER_PIN -1
|
||||
#endif
|
||||
|
||||
#if ENABLED(MINIPANEL)
|
||||
#undef DOGLCD_CS
|
||||
#define DOGLCD_CS 28
|
||||
#endif
|
||||
|
||||
/**
|
||||
PIN: 0 Port: B0 E0_DIR_PIN protected
|
||||
PIN: 1 Port: B1 E0_STEP_PIN protected
|
||||
|
||||
@@ -64,8 +64,14 @@
|
||||
//
|
||||
// Probe
|
||||
//
|
||||
#ifndef PROBE_TARE_PIN
|
||||
#define PROBE_TARE_PIN PA5
|
||||
#if ENABLED(NOZZLE_AS_PROBE)
|
||||
#ifndef PROBE_TARE_PIN
|
||||
#define PROBE_TARE_PIN PA5
|
||||
#endif
|
||||
#else
|
||||
#ifndef SERVO0_PIN
|
||||
#define SERVO0_PIN PA5
|
||||
#endif
|
||||
#endif
|
||||
|
||||
//
|
||||
@@ -112,3 +118,5 @@
|
||||
// Misc. Functions
|
||||
//
|
||||
#define CASE_LIGHT_PIN PA6
|
||||
|
||||
#define LED_PIN PA6
|
||||
|
||||
@@ -36,6 +36,10 @@
|
||||
#include "../lcd/e3v2/creality/dwin.h"
|
||||
#endif
|
||||
|
||||
#if ENABLED(EXTENSIBLE_UI)
|
||||
#include "../lcd/extui/ui_api.h"
|
||||
#endif
|
||||
|
||||
#include "../module/planner.h" // for synchronize
|
||||
#include "../module/printcounter.h"
|
||||
#include "../gcode/queue.h"
|
||||
@@ -491,6 +495,7 @@ void CardReader::mount() {
|
||||
else {
|
||||
flag.mounted = true;
|
||||
SERIAL_ECHO_MSG(STR_SD_CARD_OK);
|
||||
TERN_(EXTENSIBLE_UI, ExtUI::isMediaInserted()); // ExtUI response
|
||||
}
|
||||
|
||||
if (flag.mounted)
|
||||
|
||||
@@ -37,41 +37,6 @@
|
||||
// Startup tests are run at the end of setup()
|
||||
void runStartupTests() {
|
||||
// Call post-setup tests here to validate behaviors.
|
||||
|
||||
// String with cutoff at 20 chars:
|
||||
// "F-string, 1234.50, 2"
|
||||
SString<20> str20;
|
||||
str20 = F("F-string, ");
|
||||
str20.append(1234.5f).append(',').append(' ')
|
||||
.append(2345.67).append(',').append(' ')
|
||||
.echoln();
|
||||
|
||||
// Truncate to "F-string"
|
||||
str20.trunc(8).echoln();
|
||||
|
||||
// 100 dashes, but chopped down to DEFAULT_MSTRING_SIZE (20)
|
||||
TSS(repchr_t('-', 100)).echoln();
|
||||
|
||||
// Hello World!-123456------ <spaces!33
|
||||
// ^ eol! ... 1234.50*2345.602 = 2895645.67
|
||||
SString<100> str(F("Hello"));
|
||||
str.append(F(" World!"));
|
||||
str += '-';
|
||||
str += uint8_t(123);
|
||||
str += F("456");
|
||||
str += repchr_t('-', 6);
|
||||
str += Spaces(3);
|
||||
str += "< spaces!";
|
||||
str += int8_t(33);
|
||||
str.eol();
|
||||
str += "^ eol!";
|
||||
|
||||
str.append("...", 1234.5f, '*', p_float_t(2345.602, 3), F(" = "), 1234.5 * 2345.602).echoln();
|
||||
|
||||
// Print it again with SERIAL_ECHOLN
|
||||
auto print_char_ptr = [](char * const str) { SERIAL_ECHOLN(str); };
|
||||
print_char_ptr(str);
|
||||
|
||||
}
|
||||
|
||||
// Periodic tests are run from within loop()
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user