17
17
#include " ../../../../../module/planner.h"
18
18
#include " ../../../../../gcode/gcode.h"
19
19
20
+ #if HAS_TRINAMIC_CONFIG
21
+ #include " ../../../../../feature/tmc_util.h"
22
+ #include " ../../../../../module/stepper/indirection.h"
23
+ #endif
24
+
20
25
AxisEnum AxisSettingsHandler::current_axis;
21
26
uint16_t AxisSettingsHandler::axis_settings_title_icon = ICON_AXIS_SETTINGS_TITLE_X;
22
27
@@ -25,6 +30,8 @@ uint32_t AxisSettingsHandler::max_acceleration_mm_per_s2;
25
30
float AxisSettingsHandler::jerk;
26
31
feedRate_t AxisSettingsHandler::max_feedrate;
27
32
33
+ uint16_t AxisSettingsHandler::tmc_current;
34
+
28
35
void AxisSettingsHandler::HandleNavigation (DGUS_VP_Variable &var, void *val_ptr) {
29
36
switch (uInt16Value (val_ptr)) {
30
37
case AXIS_SETTINGS_NAV_BUTTON_VAL_X:
@@ -55,6 +62,34 @@ void AxisSettingsHandler::HandleNavigation(DGUS_VP_Variable &var, void *val_ptr)
55
62
max_acceleration_mm_per_s2 = planner.settings .max_acceleration_mm_per_s2 [current_axis];
56
63
IF_ENABLED (CLASSIC_JERK, jerk = planner.max_jerk [current_axis]);
57
64
max_feedrate = planner.settings .max_feedrate_mm_s [current_axis];
65
+
66
+ #if HAS_TRINAMIC_CONFIG
67
+ switch (current_axis){
68
+ #if AXIS_IS_TMC(X)
69
+ case X_AXIS:
70
+ tmc_current = stepperX.getMilliamps ();
71
+ break ;
72
+ #endif
73
+
74
+ #if AXIS_IS_TMC(Y)
75
+ case Y_AXIS:
76
+ tmc_current = stepperY.getMilliamps ();
77
+ break ;
78
+ #endif
79
+
80
+ #if AXIS_IS_TMC(Z)
81
+ case Z_AXIS:
82
+ tmc_current = stepperZ.getMilliamps ();
83
+ break ;
84
+ #endif
85
+
86
+ #if AXIS_IS_TMC(E0)
87
+ case E_AXIS:
88
+ tmc_current = stepperE0.getMilliamps ();
89
+ break ;
90
+ #endif
91
+ }
92
+ #endif
58
93
}
59
94
60
95
void AxisSettingsHandler::HandleBackNavigation (DGUS_VP_Variable &var, void *val_ptr) {
@@ -64,6 +99,34 @@ void AxisSettingsHandler::HandleBackNavigation(DGUS_VP_Variable &var, void *val_
64
99
IF_ENABLED (CLASSIC_JERK, planner.max_jerk [current_axis] = jerk);
65
100
planner.settings .max_feedrate_mm_s [current_axis] = max_feedrate;
66
101
102
+ #if HAS_TRINAMIC_CONFIG
103
+ switch (current_axis){
104
+ #if AXIS_IS_TMC(X)
105
+ case X_AXIS:
106
+ stepperX.rms_current (tmc_current);
107
+ break ;
108
+ #endif
109
+
110
+ #if AXIS_IS_TMC(Y)
111
+ case Y_AXIS:
112
+ stepperY.rms_current (tmc_current);
113
+ break ;
114
+ #endif
115
+
116
+ #if AXIS_IS_TMC(Z)
117
+ case Z_AXIS:
118
+ stepperZ.rms_current (tmc_current);
119
+ break ;
120
+ #endif
121
+
122
+ #if AXIS_IS_TMC(E0)
123
+ case E_AXIS:
124
+ stepperE0.rms_current (tmc_current);
125
+ break ;
126
+ #endif
127
+ }
128
+ #endif
129
+
67
130
// Save and pop
68
131
ScreenHandler.PopToOldScreen ();
69
132
0 commit comments