-
-
Notifications
You must be signed in to change notification settings - Fork 19.6k
BTT SKR V2.0 (STM32F407VGT6) & Stepper Driver Anti-SNAFU Protection #21503
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
thinkyhead
merged 38 commits into
MarlinFirmware:bugfix-2.0.x
from
thisiskeithb:pr/btt_skr_v2
Apr 27, 2021
Merged
Changes from 33 commits
Commits
Show all changes
38 commits
Select commit
Hold shift + click to select a range
3f0d219
Driver Anti-Reverse Protection
thisiskeithb dc277d2
SKR V2.0 Support
thisiskeithb 8df14d3
Merge remote-tracking branch 'MarlinFirmware/bugfix-2.0.x' into pr/bt…
thisiskeithb 9a710a8
Merge remote-tracking branch 'MarlinFirmware/bugfix-2.0.x' into pr/bt…
thisiskeithb f0117e7
Mass production of pin. Avoid sharing TMC SPI with SD SPI
Msq001 d7f816a
Enable anti-reverse protection in default if SAFE_POWER_PIN is defined
Msq001 bc62981
Merge pull request #5 from bigtreetech/pr/btt_skr_v2_pin
thisiskeithb fac7451
Fix merge
thisiskeithb 16bcc2c
Temporarily add generic SKR V2 variant
thisiskeithb 1a55086
Merge remote-tracking branch 'MarlinFirmware/bugfix-2.0.x' into pr/bt…
thisiskeithb 3ee454c
Merge remote-tracking branch 'MarlinFirmware/bugfix-2.0.x' into pr/bt…
thisiskeithb f932ed3
Merge remote-tracking branch 'MarlinFirmware/bugfix-2.0.x' into pr/bt…
thisiskeithb 7d146f8
Update generic SKR V2 usb env
thisiskeithb 7055c1b
Remove generic SKR V2 env
thisiskeithb a9ec119
Merge remote-tracking branch 'MarlinFirmware/bugfix-2.0.x' into pr/bt…
thisiskeithb 2d83294
Merge remote-tracking branch 'MarlinFirmware/bugfix-2.0.x' into pr/bt…
thisiskeithb 1261428
fix flash drive env
rhapsodyv 8c3c936
Check pin_exists after pins include
thinkyhead 2e7c870
fix SanityCheck
Msq001 b2fa246
Merge pull request #6 from bigtreetech/pr/btt_skr_v2
thisiskeithb 1445098
adjustments
thinkyhead 13738b0
Merge remote-tracking branch 'MarlinFirmware/bugfix-2.0.x' into pr/bt…
thisiskeithb e030030
Merge remote-tracking branch 'MarlinFirmware/bugfix-2.0.x' into pr/bt…
thisiskeithb db70fb8
variants
Msq001 339173f
Merge pull request #7 from bigtreetech/pr/btt_skr_v2
thisiskeithb 8126432
Merge remote-tracking branch 'MarlinFirmware/bugfix-2.0.x' into pr/bt…
thisiskeithb cb7d2c3
Remove SKR_2 variant
thisiskeithb 1c0005e
Some cleanup
thisiskeithb 890f741
Translatable on-screen error message
thisiskeithb ddfa4e1
Merge remote-tracking branch 'MarlinFirmware/bugfix-2.0.x' into pr/bt…
thisiskeithb 6c3027d
delete onboard sd detect pin
Msq001 e58af41
Remove onboard sd detect pin
thisiskeithb d7d8496
Merge remote-tracking branch 'MarlinFirmware/bugfix-2.0.x' into pr/bt…
thisiskeithb 6286e9d
no enabled()
thisiskeithb 422fb20
Merge remote-tracking branch 'MarlinFirmware/bugfix-2.0.x' into pr/bt…
thisiskeithb 2d1dc8f
Merge remote-tracking branch 'MarlinFirmware/bugfix-2.0.x' into pr/bt…
thisiskeithb 2647594
Merge remote-tracking branch 'MarlinFirmware/bugfix-2.0.x' into pr/bt…
thisiskeithb 88b7791
Merge remote-tracking branch 'MarlinFirmware/bugfix-2.0.x' into pr/bt…
thisiskeithb File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,171 @@ | ||
| /** | ||
| * 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/>. | ||
| * | ||
| */ | ||
| #include "../inc/MarlinConfig.h" | ||
| #include "../lcd/marlinui.h" | ||
|
|
||
| #if HAS_DRIVER_SAFE_POWER_PROTECT | ||
|
|
||
| #include "stepper_driver_safety.h" | ||
|
|
||
| static uint32_t axis_plug_backward = 0; | ||
|
|
||
| void stepper_driver_backward_error(PGM_P str) { | ||
| SERIAL_ERROR_START(); | ||
| SERIAL_ECHOPGM_P(str); | ||
| SERIAL_ECHOLNPGM(" driver is backward!"); | ||
| ui.status_printf_P(2, PSTR(S_FMT S_FMT), str, GET_TEXT(MSG_DRIVER_BACKWARD)); | ||
| } | ||
|
|
||
| void stepper_driver_backward_check() { | ||
|
|
||
| OUT_WRITE(SAFE_POWER_PIN, LOW); | ||
|
|
||
| #define TEST_BACKWARD(AXIS, BIT) do { \ | ||
| SET_INPUT(AXIS##_ENABLE_PIN); \ | ||
| OUT_WRITE(AXIS##_STEP_PIN, false); \ | ||
| delay(20); \ | ||
| if (READ(AXIS##_ENABLE_PIN) == false) { \ | ||
| SBI(axis_plug_backward, BIT); \ | ||
| stepper_driver_backward_error(PSTR(STRINGIFY(AXIS))); \ | ||
| } \ | ||
| }while(0) | ||
|
|
||
| #if HAS_X_ENABLE | ||
| TEST_BACKWARD(X, 0); | ||
| #endif | ||
| #if HAS_X2_ENABLE | ||
| TEST_BACKWARD(X2, 1); | ||
| #endif | ||
|
|
||
| #if HAS_Y_ENABLE | ||
| TEST_BACKWARD(Y, 2); | ||
| #endif | ||
| #if HAS_Y2_ENABLE | ||
| TEST_BACKWARD(Y2, 3); | ||
| #endif | ||
|
|
||
| #if HAS_Z_ENABLE | ||
| TEST_BACKWARD(Z, 4); | ||
| #endif | ||
| #if HAS_Z2_ENABLE | ||
| TEST_BACKWARD(Z2, 5); | ||
| #endif | ||
| #if HAS_Z3_ENABLE | ||
| TEST_BACKWARD(Z3, 6); | ||
| #endif | ||
| #if HAS_Z4_ENABLE | ||
| TEST_BACKWARD(Z4, 7); | ||
| #endif | ||
|
|
||
| #if HAS_E0_ENABLE | ||
| TEST_BACKWARD(E0, 8); | ||
| #endif | ||
| #if HAS_E1_ENABLE | ||
| TEST_BACKWARD(E1, 9); | ||
| #endif | ||
| #if HAS_E2_ENABLE | ||
| TEST_BACKWARD(E2, 10); | ||
| #endif | ||
| #if HAS_E3_ENABLE | ||
| TEST_BACKWARD(E3, 11); | ||
| #endif | ||
| #if HAS_E4_ENABLE | ||
| TEST_BACKWARD(E4, 12); | ||
| #endif | ||
| #if HAS_E5_ENABLE | ||
| TEST_BACKWARD(E5, 13); | ||
| #endif | ||
| #if HAS_E6_ENABLE | ||
| TEST_BACKWARD(E6, 14); | ||
| #endif | ||
| #if HAS_E7_ENABLE | ||
| TEST_BACKWARD(E7, 15); | ||
| #endif | ||
|
|
||
| if (!axis_plug_backward) | ||
| WRITE(SAFE_POWER_PIN, HIGH); | ||
| } | ||
|
|
||
| void stepper_driver_backward_report() { | ||
| if (!axis_plug_backward) return; | ||
|
|
||
| auto _report_if_backward = [](PGM_P axis, uint8_t bit) { | ||
| if (TEST(axis_plug_backward, bit)) | ||
| stepper_driver_backward_error(axis); | ||
| }; | ||
|
|
||
| #define REPORT_BACKWARD(axis, bit) _report_if_backward(PSTR(STRINGIFY(axis)), bit) | ||
|
|
||
| #if HAS_X_ENABLE | ||
| REPORT_BACKWARD(X, 0); | ||
| #endif | ||
| #if HAS_X2_ENABLE | ||
| REPORT_BACKWARD(X2, 1); | ||
| #endif | ||
|
|
||
| #if HAS_Y_ENABLE | ||
| REPORT_BACKWARD(Y, 2); | ||
| #endif | ||
| #if HAS_Y2_ENABLE | ||
| REPORT_BACKWARD(Y2, 3); | ||
| #endif | ||
|
|
||
| #if HAS_Z_ENABLE | ||
| REPORT_BACKWARD(Z, 4); | ||
| #endif | ||
| #if HAS_Z2_ENABLE | ||
| REPORT_BACKWARD(Z2, 5); | ||
| #endif | ||
| #if HAS_Z3_ENABLE | ||
| REPORT_BACKWARD(Z3, 6); | ||
| #endif | ||
| #if HAS_Z4_ENABLE | ||
| REPORT_BACKWARD(Z4, 7); | ||
| #endif | ||
|
|
||
| #if HAS_E0_ENABLE | ||
| REPORT_BACKWARD(E0, 8); | ||
| #endif | ||
| #if HAS_E1_ENABLE | ||
| REPORT_BACKWARD(E1, 9); | ||
| #endif | ||
| #if HAS_E2_ENABLE | ||
| REPORT_BACKWARD(E2, 10); | ||
| #endif | ||
| #if HAS_E3_ENABLE | ||
| REPORT_BACKWARD(E3, 11); | ||
| #endif | ||
| #if HAS_E4_ENABLE | ||
| REPORT_BACKWARD(E4, 12); | ||
| #endif | ||
| #if HAS_E5_ENABLE | ||
| REPORT_BACKWARD(E5, 13); | ||
| #endif | ||
| #if HAS_E6_ENABLE | ||
| REPORT_BACKWARD(E6, 14); | ||
| #endif | ||
| #if HAS_E7_ENABLE | ||
| REPORT_BACKWARD(E7, 15); | ||
| #endif | ||
| } | ||
|
|
||
| #endif // HAS_DRIVER_SAFE_POWER_PROTECT |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,28 @@ | ||
| /** | ||
| * 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 | ||
|
|
||
|
|
||
| #include "../inc/MarlinConfigPre.h" | ||
|
|
||
| void stepper_driver_backward_check(); | ||
| void stepper_driver_backward_report(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.