|
@@ -206,18 +206,19 @@ void process_lcd_eb_command(const char* command) {
|
206
|
206
|
* {J:E}{J:X+200}{J:E}
|
207
|
207
|
* X, Y, Z, A (extruder)
|
208
|
208
|
*/
|
209
|
|
-void process_lcd_j_command(const char* command) {
|
210
|
|
- auto move_axis = [command](const auto axis) {
|
211
|
|
- const float dist = atof(command + 1) / 10.0;
|
212
|
|
- ExtUI::setAxisPosition_mm(ExtUI::getAxisPosition_mm(axis) + dist, axis);
|
213
|
|
- };
|
|
209
|
+template<typename T>
|
|
210
|
+void j_move_axis(const char* command, const T axis) {
|
|
211
|
+ const float dist = atof(command + 1) / 10.0;
|
|
212
|
+ ExtUI::setAxisPosition_mm(ExtUI::getAxisPosition_mm(axis) + dist, axis);
|
|
213
|
+};
|
214
|
214
|
|
|
215
|
+void process_lcd_j_command(const char* command) {
|
215
|
216
|
switch (command[0]) {
|
216
|
217
|
case 'E': break;
|
217
|
|
- case 'A': move_axis(ExtUI::extruder_t::E0); break;
|
218
|
|
- case 'Y': move_axis(ExtUI::axis_t::Y); break;
|
219
|
|
- case 'Z': move_axis(ExtUI::axis_t::Z); break;
|
220
|
|
- case 'X': move_axis(ExtUI::axis_t::X); break;
|
|
218
|
+ case 'A': j_move_axis<ExtUI::extruder_t>(command, ExtUI::extruder_t::E0); break;
|
|
219
|
+ case 'Y': j_move_axis<ExtUI::axis_t>(command, ExtUI::axis_t::Y); break;
|
|
220
|
+ case 'Z': j_move_axis<ExtUI::axis_t>(command, ExtUI::axis_t::Z); break;
|
|
221
|
+ case 'X': j_move_axis<ExtUI::axis_t>(command, ExtUI::axis_t::X); break;
|
221
|
222
|
default: DEBUG_ECHOLNPAIR("UNKNOWN J COMMAND ", command);
|
222
|
223
|
}
|
223
|
224
|
}
|