update code base to Marlin 2.0.9.2

This commit is contained in:
Stefan Kalscheuer
2021-10-03 18:57:12 +02:00
parent b9d7ba838e
commit 7077da3591
2617 changed files with 332093 additions and 103438 deletions

217
Marlin/src/gcode/feature/trinamic/M906.cpp Executable file → Normal file
View File

@@ -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 <http://www.gnu.org/licenses/>.
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
*/
@@ -48,11 +48,11 @@ void GcodeSuite::M906() {
bool report = true;
#if AXIS_IS_TMC(X) || AXIS_IS_TMC(X2) || AXIS_IS_TMC(Y) || AXIS_IS_TMC(Y2) || AXIS_IS_TMC(Z) || AXIS_IS_TMC(Z2) || AXIS_IS_TMC(Z3) || AXIS_IS_TMC(Z4)
#if AXIS_IS_TMC(X) || AXIS_IS_TMC(X2) || AXIS_IS_TMC(Y) || AXIS_IS_TMC(Y2) || AXIS_IS_TMC(Z) || AXIS_IS_TMC(Z2) || AXIS_IS_TMC(Z3) || AXIS_IS_TMC(Z4) || AXIS_IS_TMC(I) || AXIS_IS_TMC(J) || AXIS_IS_TMC(K)
const uint8_t index = parser.byteval('I');
#endif
LOOP_XYZE(i) if (uint16_t value = parser.intval(axis_codes[i])) {
LOOP_LOGICAL_AXES(i) if (uint16_t value = parser.intval(axis_codes[i])) {
report = false;
switch (i) {
case X_AXIS:
@@ -63,58 +63,77 @@ void GcodeSuite::M906() {
if (index == 1) TMC_SET_CURRENT(X2);
#endif
break;
case Y_AXIS:
#if AXIS_IS_TMC(Y)
if (index == 0) TMC_SET_CURRENT(Y);
#endif
#if AXIS_IS_TMC(Y2)
if (index == 1) TMC_SET_CURRENT(Y2);
#endif
break;
case Z_AXIS:
#if AXIS_IS_TMC(Z)
if (index == 0) TMC_SET_CURRENT(Z);
#endif
#if AXIS_IS_TMC(Z2)
if (index == 1) TMC_SET_CURRENT(Z2);
#endif
#if AXIS_IS_TMC(Z3)
if (index == 2) TMC_SET_CURRENT(Z3);
#endif
#if AXIS_IS_TMC(Z4)
if (index == 3) TMC_SET_CURRENT(Z4);
#endif
break;
case E_AXIS: {
const int8_t target_extruder = get_target_extruder_from_command();
if (target_extruder < 0) return;
switch (target_extruder) {
#if AXIS_IS_TMC(E0)
case 0: TMC_SET_CURRENT(E0); break;
#if HAS_Y_AXIS
case Y_AXIS:
#if AXIS_IS_TMC(Y)
if (index == 0) TMC_SET_CURRENT(Y);
#endif
#if AXIS_IS_TMC(E1)
case 1: TMC_SET_CURRENT(E1); break;
#if AXIS_IS_TMC(Y2)
if (index == 1) TMC_SET_CURRENT(Y2);
#endif
#if AXIS_IS_TMC(E2)
case 2: TMC_SET_CURRENT(E2); break;
break;
#endif
#if HAS_Z_AXIS
case Z_AXIS:
#if AXIS_IS_TMC(Z)
if (index == 0) TMC_SET_CURRENT(Z);
#endif
#if AXIS_IS_TMC(E3)
case 3: TMC_SET_CURRENT(E3); break;
#if AXIS_IS_TMC(Z2)
if (index == 1) TMC_SET_CURRENT(Z2);
#endif
#if AXIS_IS_TMC(E4)
case 4: TMC_SET_CURRENT(E4); break;
#if AXIS_IS_TMC(Z3)
if (index == 2) TMC_SET_CURRENT(Z3);
#endif
#if AXIS_IS_TMC(E5)
case 5: TMC_SET_CURRENT(E5); break;
#if AXIS_IS_TMC(Z4)
if (index == 3) TMC_SET_CURRENT(Z4);
#endif
#if AXIS_IS_TMC(E6)
case 6: TMC_SET_CURRENT(E6); break;
#endif
#if AXIS_IS_TMC(E7)
case 7: TMC_SET_CURRENT(E7); break;
#endif
}
} break;
break;
#endif
#if AXIS_IS_TMC(I)
case I_AXIS: TMC_SET_CURRENT(I); break;
#endif
#if AXIS_IS_TMC(J)
case J_AXIS: TMC_SET_CURRENT(J); break;
#endif
#if AXIS_IS_TMC(K)
case K_AXIS: TMC_SET_CURRENT(K); break;
#endif
#if E_STEPPERS
case E_AXIS: {
const int8_t target_e_stepper = get_target_e_stepper_from_command();
if (target_e_stepper < 0) return;
switch (target_e_stepper) {
#if AXIS_IS_TMC(E0)
case 0: TMC_SET_CURRENT(E0); break;
#endif
#if AXIS_IS_TMC(E1)
case 1: TMC_SET_CURRENT(E1); break;
#endif
#if AXIS_IS_TMC(E2)
case 2: TMC_SET_CURRENT(E2); break;
#endif
#if AXIS_IS_TMC(E3)
case 3: TMC_SET_CURRENT(E3); break;
#endif
#if AXIS_IS_TMC(E4)
case 4: TMC_SET_CURRENT(E4); break;
#endif
#if AXIS_IS_TMC(E5)
case 5: TMC_SET_CURRENT(E5); break;
#endif
#if AXIS_IS_TMC(E6)
case 6: TMC_SET_CURRENT(E6); break;
#endif
#if AXIS_IS_TMC(E7)
case 7: TMC_SET_CURRENT(E7); break;
#endif
}
} break;
#endif
}
}
@@ -143,6 +162,15 @@ void GcodeSuite::M906() {
#if AXIS_IS_TMC(Z4)
TMC_SAY_CURRENT(Z4);
#endif
#if AXIS_IS_TMC(I)
TMC_SAY_CURRENT(I);
#endif
#if AXIS_IS_TMC(J)
TMC_SAY_CURRENT(J);
#endif
#if AXIS_IS_TMC(K)
TMC_SAY_CURRENT(K);
#endif
#if AXIS_IS_TMC(E0)
TMC_SAY_CURRENT(E0);
#endif
@@ -170,4 +198,95 @@ void GcodeSuite::M906() {
}
}
void GcodeSuite::M906_report(const bool forReplay/*=true*/) {
report_heading(forReplay, PSTR(STR_STEPPER_DRIVER_CURRENT));
auto say_M906 = [](const bool forReplay) {
report_echo_start(forReplay);
SERIAL_ECHOPGM(" M906");
};
#if AXIS_IS_TMC(X) || AXIS_IS_TMC(Y) || AXIS_IS_TMC(Z) \
|| AXIS_IS_TMC(I) || AXIS_IS_TMC(J) || AXIS_IS_TMC(K)
say_M906(forReplay);
#if AXIS_IS_TMC(X)
SERIAL_ECHOPGM_P(SP_X_STR, stepperX.getMilliamps());
#endif
#if AXIS_IS_TMC(Y)
SERIAL_ECHOPGM_P(SP_Y_STR, stepperY.getMilliamps());
#endif
#if AXIS_IS_TMC(Z)
SERIAL_ECHOPGM_P(SP_Z_STR, stepperZ.getMilliamps());
#endif
#if AXIS_IS_TMC(I)
SERIAL_ECHOPGM_P(SP_I_STR, stepperI.getMilliamps());
#endif
#if AXIS_IS_TMC(J)
SERIAL_ECHOPGM_P(SP_J_STR, stepperJ.getMilliamps());
#endif
#if AXIS_IS_TMC(K)
SERIAL_ECHOPGM_P(SP_K_STR, stepperK.getMilliamps());
#endif
SERIAL_EOL();
#endif
#if AXIS_IS_TMC(X2) || AXIS_IS_TMC(Y2) || AXIS_IS_TMC(Z2)
say_M906(forReplay);
SERIAL_ECHOPGM(" I1");
#if AXIS_IS_TMC(X2)
SERIAL_ECHOPGM_P(SP_X_STR, stepperX2.getMilliamps());
#endif
#if AXIS_IS_TMC(Y2)
SERIAL_ECHOPGM_P(SP_Y_STR, stepperY2.getMilliamps());
#endif
#if AXIS_IS_TMC(Z2)
SERIAL_ECHOPGM_P(SP_Z_STR, stepperZ2.getMilliamps());
#endif
SERIAL_EOL();
#endif
#if AXIS_IS_TMC(Z3)
say_M906(forReplay);
SERIAL_ECHOLNPGM(" I2 Z", stepperZ3.getMilliamps());
#endif
#if AXIS_IS_TMC(Z4)
say_M906(forReplay);
SERIAL_ECHOLNPGM(" I3 Z", stepperZ4.getMilliamps());
#endif
#if AXIS_IS_TMC(E0)
say_M906(forReplay);
SERIAL_ECHOLNPGM(" T0 E", stepperE0.getMilliamps());
#endif
#if AXIS_IS_TMC(E1)
say_M906(forReplay);
SERIAL_ECHOLNPGM(" T1 E", stepperE1.getMilliamps());
#endif
#if AXIS_IS_TMC(E2)
say_M906(forReplay);
SERIAL_ECHOLNPGM(" T2 E", stepperE2.getMilliamps());
#endif
#if AXIS_IS_TMC(E3)
say_M906(forReplay);
SERIAL_ECHOLNPGM(" T3 E", stepperE3.getMilliamps());
#endif
#if AXIS_IS_TMC(E4)
say_M906(forReplay);
SERIAL_ECHOLNPGM(" T4 E", stepperE4.getMilliamps());
#endif
#if AXIS_IS_TMC(E5)
say_M906(forReplay);
SERIAL_ECHOLNPGM(" T5 E", stepperE5.getMilliamps());
#endif
#if AXIS_IS_TMC(E6)
say_M906(forReplay);
SERIAL_ECHOLNPGM(" T6 E", stepperE6.getMilliamps());
#endif
#if AXIS_IS_TMC(E7)
say_M906(forReplay);
SERIAL_ECHOLNPGM(" T7 E", stepperE7.getMilliamps());
#endif
SERIAL_EOL();
}
#endif // HAS_TRINAMIC_CONFIG