Skip to content

Commit

Permalink
M906 with UVW axes
Browse files Browse the repository at this point in the history
  • Loading branch information
DerAndere1 committed Apr 2, 2022
1 parent 0556069 commit 4185c93
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 6 deletions.
3 changes: 3 additions & 0 deletions Marlin/Configuration_adv.h
Original file line number Diff line number Diff line change
Expand Up @@ -2866,6 +2866,7 @@
#define U_RSENSE 0.11
#define U_CHAIN_POS -1
//#define U_INTERPOLATE true
//#define U_HOLD_MULTIPLIER 0.5
#endif

#if AXIS_IS_TMC(V)
Expand All @@ -2875,6 +2876,7 @@
#define V_RSENSE 0.11
#define V_CHAIN_POS -1
//#define V_INTERPOLATE true
//#define V_HOLD_MULTIPLIER 0.5
#endif

#if AXIS_IS_TMC(W)
Expand All @@ -2884,6 +2886,7 @@
#define W_RSENSE 0.11
#define W_CHAIN_POS -1
//#define W_INTERPOLATE true
//#define W_HOLD_MULTIPLIER 0.5
#endif

#if AXIS_IS_TMC(E0)
Expand Down
49 changes: 44 additions & 5 deletions Marlin/src/gcode/feature/L6470/M906.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,6 @@

#if HAS_L64XX

#if AXIS_COLLISION('I')
#error "M906 parameter collision with axis name."
#endif

#include "../../gcode.h"
#include "../../../libs/L64XX/L64XX_Marlin.h"
#include "../../../module/stepper/indirection.h"
Expand Down Expand Up @@ -211,7 +207,7 @@ void L64XX_report_current(L64XX &motor, const L64XX_axis_t axis) {
* 1 - monitor only X2, Y2, Z2
* 2 - monitor only Z3
* 3 - monitor only Z4
* Xxxx, Yxxx, Zxxx, Exxx - axis to change (optional)
* Xxxx, Yxxx, Zxxx, Axxx, Bxxx, Cxxx, Uxxx, Vxxx, Wxxx, Exxx - axis to change (optional)
* L6474 - current in mA (4A max)
* All others - 0-255
*
Expand Down Expand Up @@ -285,6 +281,31 @@ void GcodeSuite::M906() {
break;
#endif

#if AXIS_IS_L64XX(I)
case I_AXIS:
L6470_SET_KVAL_HOLD(I);
#endif
#if AXIS_IS_L64XX(J)
case J_AXIS:
L6470_SET_KVAL_HOLD(J);
#endif
#if AXIS_IS_L64XX(K)
case K_AXIS:
L6470_SET_KVAL_HOLD(K);
#endif
#if AXIS_IS_L64XX(U)
case U_AXIS:
L6470_SET_KVAL_HOLD(U);
#endif
#if AXIS_IS_L64XX(V)
case V_AXIS:
L6470_SET_KVAL_HOLD(V);
#endif
#if AXIS_IS_L64XX(W)
case W_AXIS:
L6470_SET_KVAL_HOLD(W);
#endif

#if AXIS_IS_L64XX(E0) || AXIS_IS_L64XX(E1) || AXIS_IS_L64XX(E2) || AXIS_IS_L64XX(E3) || AXIS_IS_L64XX(E4) || AXIS_IS_L64XX(E5) || AXIS_IS_L64XX(E6) || AXIS_IS_L64XX(E7)
case E_AXIS: {
const int8_t eindex = get_target_e_stepper_from_command(-2);
Expand Down Expand Up @@ -346,6 +367,24 @@ void GcodeSuite::M906() {
#if AXIS_IS_L64XX(Z4)
L64XX_REPORT_CURRENT(Z4);
#endif
#if AXIS_IS_L64XX(I)
L64XX_REPORT_CURRENT(I);
#endif
#if AXIS_IS_L64XX(J)
L64XX_REPORT_CURRENT(J);
#endif
#if AXIS_IS_L64XX(K)
L64XX_REPORT_CURRENT(K);
#endif
#if AXIS_IS_L64XX(U)
L64XX_REPORT_CURRENT(U);
#endif
#if AXIS_IS_L64XX(V)
L64XX_REPORT_CURRENT(V);
#endif
#if AXIS_IS_L64XX(W)
L64XX_REPORT_CURRENT(W);
#endif
#if AXIS_IS_L64XX(E0)
L64XX_REPORT_CURRENT(E0);
#endif
Expand Down
2 changes: 1 addition & 1 deletion Marlin/src/libs/L64XX/L64XX_Marlin.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
#define HAS_L64XX_EXTRUDER (AXIS_IS_L64XX(E0) || AXIS_IS_L64XX(E1) || AXIS_IS_L64XX(E2) || AXIS_IS_L64XX(E3) || AXIS_IS_L64XX(E4) || AXIS_IS_L64XX(E5) || AXIS_IS_L64XX(E6) || AXIS_IS_L64XX(E7))

#define _EN_ITEM(N) , E##N
enum L64XX_axis_t : uint8_t { NUM_AXIS_LIST(X, Y, Z, I, J, K), X2, Y2, Z2, Z3, Z4 REPEAT(E_STEPPERS, _EN_ITEM), MAX_L64XX };
enum L64XX_axis_t : uint8_t { NUM_AXIS_LIST(X, Y, Z, I, J, K, U, V, W), X2, Y2, Z2, Z3, Z4 REPEAT(E_STEPPERS, _EN_ITEM), MAX_L64XX };
#undef _EN_ITEM

class L64XX_Marlin : public L64XXHelper {
Expand Down

0 comments on commit 4185c93

Please sign in to comment.