|
@@ -28,12 +28,13 @@
|
28
|
28
|
#include "../../../feature/tmc_util.h"
|
29
|
29
|
#include "../../../module/stepper_indirection.h"
|
30
|
30
|
#include "../../../module/planner.h"
|
|
31
|
+#include "../../queue.h"
|
31
|
32
|
|
32
|
33
|
/**
|
33
|
34
|
* M911: Report TMC stepper driver overtemperature pre-warn flag
|
34
|
35
|
* The flag is held by the library and persist until manually cleared by M912
|
35
|
36
|
*/
|
36
|
|
-inline void GcodeSuite::M911() {
|
|
37
|
+void GcodeSuite::M911() {
|
37
|
38
|
#if ENABLED(X_IS_TMC2130) || (ENABLED(X_IS_TMC2208) && PIN_EXISTS(X_SERIAL_RX)) || ENABLED(IS_TRAMS)
|
38
|
39
|
tmc_report_otpw(stepperX, extended_axis_codes[TMC_X]);
|
39
|
40
|
#endif
|
|
@@ -51,7 +52,7 @@ inline void GcodeSuite::M911() {
|
51
|
52
|
/**
|
52
|
53
|
* M912: Clear TMC stepper driver overtemperature pre-warn flag held by the library
|
53
|
54
|
*/
|
54
|
|
-inline void GcodeSuite::M912() {
|
|
55
|
+void GcodeSuite::M912() {
|
55
|
56
|
const bool clearX = parser.seen(axis_codes[X_AXIS]), clearY = parser.seen(axis_codes[Y_AXIS]), clearZ = parser.seen(axis_codes[Z_AXIS]), clearE = parser.seen(axis_codes[E_AXIS]),
|
56
|
57
|
clearAll = (!clearX && !clearY && !clearZ && !clearE) || (clearX && clearY && clearZ && clearE);
|
57
|
58
|
#if ENABLED(X_IS_TMC2130) || ENABLED(IS_TRAMS) || (ENABLED(X_IS_TMC2208) && PIN_EXISTS(X_SERIAL_RX))
|
|
@@ -78,7 +79,7 @@ inline void GcodeSuite::M912() {
|
78
|
79
|
* M913: Set HYBRID_THRESHOLD speed.
|
79
|
80
|
*/
|
80
|
81
|
#if ENABLED(HYBRID_THRESHOLD)
|
81
|
|
- inline void GcodeSuite::M913() {
|
|
82
|
+ void GcodeSuite::M913() {
|
82
|
83
|
uint16_t values[XYZE];
|
83
|
84
|
LOOP_XYZE(i)
|
84
|
85
|
values[i] = parser.intval(axis_codes[i]);
|
|
@@ -137,7 +138,7 @@ inline void GcodeSuite::M912() {
|
137
|
138
|
* M914: Set SENSORLESS_HOMING sensitivity.
|
138
|
139
|
*/
|
139
|
140
|
#if ENABLED(SENSORLESS_HOMING)
|
140
|
|
- inline void GcodeSuite::M914() {
|
|
141
|
+ void GcodeSuite::M914() {
|
141
|
142
|
#if ENABLED(X_IS_TMC2130) || ENABLED(IS_TRAMS)
|
142
|
143
|
if (parser.seen(axis_codes[X_AXIS])) tmc_set_sgt(stepperX, extended_axis_codes[TMC_X], parser.value_int());
|
143
|
144
|
else tmc_get_sgt(stepperX, extended_axis_codes[TMC_X]);
|
|
@@ -160,8 +161,8 @@ inline void GcodeSuite::M912() {
|
160
|
161
|
/**
|
161
|
162
|
* TMC Z axis calibration routine
|
162
|
163
|
*/
|
163
|
|
-#if ENABLED(TMC_Z_CALIBRATION) && (Z_IS_TRINAMIC || Z2_IS_TRINAMIC)
|
164
|
|
- inline void GcodeSuite::M915() {
|
|
164
|
+#if ENABLED(TMC_Z_CALIBRATION)
|
|
165
|
+ void GcodeSuite::M915() {
|
165
|
166
|
uint16_t _rms = parser.seenval('S') ? parser.value_int() : CALIBRATION_CURRENT;
|
166
|
167
|
uint16_t _z = parser.seenval('Z') ? parser.value_int() : CALIBRATION_EXTRA_HEIGHT;
|
167
|
168
|
|
|
@@ -170,25 +171,33 @@ inline void GcodeSuite::M912() {
|
170
|
171
|
return;
|
171
|
172
|
}
|
172
|
173
|
|
173
|
|
- uint16_t Z_current_1 = stepperZ.getCurrent();
|
174
|
|
- uint16_t Z2_current_1 = stepperZ.getCurrent();
|
|
174
|
+ #if Z_IS_TRINAMIC
|
|
175
|
+ uint16_t Z_current_1 = stepperZ.getCurrent();
|
|
176
|
+ stepperZ.setCurrent(_rms, R_SENSE, HOLD_MULTIPLIER);
|
|
177
|
+ #endif
|
|
178
|
+ #if Z2_IS_TRINAMIC
|
|
179
|
+ uint16_t Z2_current_1 = stepperZ2.getCurrent();
|
|
180
|
+ stepperZ2.setCurrent(_rms, R_SENSE, HOLD_MULTIPLIER);
|
|
181
|
+ #endif
|
175
|
182
|
|
176
|
|
- stepperZ.setCurrent(_rms, R_SENSE, HOLD_MULTIPLIER);
|
177
|
|
- stepperZ2.setCurrent(_rms, R_SENSE, HOLD_MULTIPLIER);
|
178
|
183
|
SERIAL_ECHOPAIR("\nCalibration current: Z", _rms);
|
179
|
184
|
|
180
|
185
|
soft_endstops_enabled = false;
|
181
|
186
|
|
182
|
187
|
do_blocking_move_to_z(Z_MAX_POS+_z);
|
183
|
188
|
|
184
|
|
- stepperZ.setCurrent(Z_current_1, R_SENSE, HOLD_MULTIPLIER);
|
185
|
|
- stepperZ2.setCurrent(Z2_current_1, R_SENSE, HOLD_MULTIPLIER);
|
|
189
|
+ #if Z_IS_TRINAMIC
|
|
190
|
+ stepperZ.setCurrent(Z_current_1, R_SENSE, HOLD_MULTIPLIER);
|
|
191
|
+ #endif
|
|
192
|
+ #if Z2_IS_TRINAMIC
|
|
193
|
+ stepperZ2.setCurrent(Z2_current_1, R_SENSE, HOLD_MULTIPLIER);
|
|
194
|
+ #endif
|
186
|
195
|
|
187
|
196
|
do_blocking_move_to_z(Z_MAX_POS);
|
188
|
197
|
soft_endstops_enabled = true;
|
189
|
198
|
|
190
|
199
|
SERIAL_ECHOLNPGM("\nHoming Z because we lost steps");
|
191
|
|
- home_z_safely();
|
|
200
|
+ enqueue_and_echo_commands_P(PSTR("G28 Z"));
|
192
|
201
|
}
|
193
|
202
|
#endif
|
194
|
203
|
|