2019-01-17 19:17:16 +00:00
|
|
|
/**
|
|
|
|
* Marlin 3D Printer Firmware
|
2020-02-03 14:00:57 +00:00
|
|
|
* Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
|
2019-01-17 19:17:16 +00:00
|
|
|
*
|
|
|
|
* Based on Sprinter and grbl.
|
2019-06-28 04:57:50 +00:00
|
|
|
* Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
|
2019-01-17 19:17:16 +00:00
|
|
|
*
|
|
|
|
* This program is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation, either version 3 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
2020-07-23 03:20:14 +00:00
|
|
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
2019-01-17 19:17:16 +00:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
//
|
|
|
|
// TMC Menu
|
|
|
|
//
|
|
|
|
|
|
|
|
#include "../../inc/MarlinConfigPre.h"
|
|
|
|
|
2020-08-06 05:49:15 +00:00
|
|
|
#if HAS_LCD_MENU && HAS_TRINAMIC_CONFIG
|
2019-01-17 19:17:16 +00:00
|
|
|
|
2020-08-21 10:21:34 +00:00
|
|
|
#include "menu_item.h"
|
2019-09-01 00:44:45 +00:00
|
|
|
#include "../../module/stepper/indirection.h"
|
2019-01-17 19:17:16 +00:00
|
|
|
#include "../../feature/tmc_util.h"
|
|
|
|
|
2020-02-26 11:38:25 +00:00
|
|
|
#define TMC_EDIT_STORED_I_RMS(ST,STR) EDIT_ITEM_P(uint16_4, PSTR(STR), &stepper##ST.val_mA, 100, 3000, []{ stepper##ST.refresh_stepper_current(); })
|
2019-01-17 19:17:16 +00:00
|
|
|
|
|
|
|
void menu_tmc_current() {
|
|
|
|
START_MENU();
|
2019-10-03 10:38:30 +00:00
|
|
|
BACK_ITEM(MSG_TMC_DRIVERS);
|
2019-01-17 19:17:16 +00:00
|
|
|
#if AXIS_IS_TMC(X)
|
2020-02-26 09:02:03 +00:00
|
|
|
TMC_EDIT_STORED_I_RMS(X, STR_X);
|
2019-01-17 19:17:16 +00:00
|
|
|
#endif
|
|
|
|
#if AXIS_IS_TMC(Y)
|
2020-02-26 09:02:03 +00:00
|
|
|
TMC_EDIT_STORED_I_RMS(Y, STR_Y);
|
2019-01-17 19:17:16 +00:00
|
|
|
#endif
|
|
|
|
#if AXIS_IS_TMC(Z)
|
2020-02-26 09:02:03 +00:00
|
|
|
TMC_EDIT_STORED_I_RMS(Z, STR_Z);
|
2019-01-17 19:17:16 +00:00
|
|
|
#endif
|
|
|
|
#if AXIS_IS_TMC(X2)
|
2020-02-26 09:02:03 +00:00
|
|
|
TMC_EDIT_STORED_I_RMS(X2, STR_X2);
|
2019-01-17 19:17:16 +00:00
|
|
|
#endif
|
|
|
|
#if AXIS_IS_TMC(Y2)
|
2020-02-26 09:02:03 +00:00
|
|
|
TMC_EDIT_STORED_I_RMS(Y2, STR_Y2);
|
2019-01-17 19:17:16 +00:00
|
|
|
#endif
|
|
|
|
#if AXIS_IS_TMC(Z2)
|
2020-02-26 09:02:03 +00:00
|
|
|
TMC_EDIT_STORED_I_RMS(Z2, STR_Z2);
|
2019-01-17 19:17:16 +00:00
|
|
|
#endif
|
|
|
|
#if AXIS_IS_TMC(Z3)
|
2020-02-26 09:02:03 +00:00
|
|
|
TMC_EDIT_STORED_I_RMS(Z3, STR_Z3);
|
2019-01-17 19:17:16 +00:00
|
|
|
#endif
|
2020-01-20 05:35:07 +00:00
|
|
|
#if AXIS_IS_TMC(Z4)
|
2020-02-26 09:02:03 +00:00
|
|
|
TMC_EDIT_STORED_I_RMS(Z4, STR_Z4);
|
2020-01-20 05:35:07 +00:00
|
|
|
#endif
|
2019-01-17 19:17:16 +00:00
|
|
|
#if AXIS_IS_TMC(E0)
|
2019-10-08 00:44:33 +00:00
|
|
|
TMC_EDIT_STORED_I_RMS(E0, LCD_STR_E0);
|
2019-01-17 19:17:16 +00:00
|
|
|
#endif
|
|
|
|
#if AXIS_IS_TMC(E1)
|
2019-10-08 00:44:33 +00:00
|
|
|
TMC_EDIT_STORED_I_RMS(E1, LCD_STR_E1);
|
2019-01-17 19:17:16 +00:00
|
|
|
#endif
|
|
|
|
#if AXIS_IS_TMC(E2)
|
2019-10-08 00:44:33 +00:00
|
|
|
TMC_EDIT_STORED_I_RMS(E2, LCD_STR_E2);
|
2019-01-17 19:17:16 +00:00
|
|
|
#endif
|
|
|
|
#if AXIS_IS_TMC(E3)
|
2019-10-08 00:44:33 +00:00
|
|
|
TMC_EDIT_STORED_I_RMS(E3, LCD_STR_E3);
|
2019-01-17 19:17:16 +00:00
|
|
|
#endif
|
|
|
|
#if AXIS_IS_TMC(E4)
|
2019-10-08 00:44:33 +00:00
|
|
|
TMC_EDIT_STORED_I_RMS(E4, LCD_STR_E4);
|
2019-01-17 19:17:16 +00:00
|
|
|
#endif
|
|
|
|
#if AXIS_IS_TMC(E5)
|
2019-10-08 00:44:33 +00:00
|
|
|
TMC_EDIT_STORED_I_RMS(E5, LCD_STR_E5);
|
2019-01-17 19:17:16 +00:00
|
|
|
#endif
|
2020-01-25 08:13:39 +00:00
|
|
|
#if AXIS_IS_TMC(E6)
|
|
|
|
TMC_EDIT_STORED_I_RMS(E6, LCD_STR_E6);
|
|
|
|
#endif
|
|
|
|
#if AXIS_IS_TMC(E7)
|
|
|
|
TMC_EDIT_STORED_I_RMS(E7, LCD_STR_E7);
|
|
|
|
#endif
|
2019-01-17 19:17:16 +00:00
|
|
|
END_MENU();
|
|
|
|
}
|
|
|
|
|
|
|
|
#if ENABLED(HYBRID_THRESHOLD)
|
|
|
|
|
2020-02-26 11:38:25 +00:00
|
|
|
#define TMC_EDIT_STORED_HYBRID_THRS(ST, STR) EDIT_ITEM_P(uint8, PSTR(STR), &stepper##ST.stored.hybrid_thrs, 0, 255, []{ stepper##ST.refresh_hybrid_thrs(); });
|
2019-01-17 19:17:16 +00:00
|
|
|
|
|
|
|
void menu_tmc_hybrid_thrs() {
|
|
|
|
START_MENU();
|
2019-10-03 10:38:30 +00:00
|
|
|
BACK_ITEM(MSG_TMC_DRIVERS);
|
2019-01-17 19:17:16 +00:00
|
|
|
#if AXIS_HAS_STEALTHCHOP(X)
|
2020-02-26 09:02:03 +00:00
|
|
|
TMC_EDIT_STORED_HYBRID_THRS(X, STR_X);
|
2019-01-17 19:17:16 +00:00
|
|
|
#endif
|
|
|
|
#if AXIS_HAS_STEALTHCHOP(Y)
|
2020-02-26 09:02:03 +00:00
|
|
|
TMC_EDIT_STORED_HYBRID_THRS(Y, STR_Y);
|
2019-01-17 19:17:16 +00:00
|
|
|
#endif
|
|
|
|
#if AXIS_HAS_STEALTHCHOP(Z)
|
2020-02-26 09:02:03 +00:00
|
|
|
TMC_EDIT_STORED_HYBRID_THRS(Z, STR_Z);
|
2019-01-17 19:17:16 +00:00
|
|
|
#endif
|
|
|
|
#if AXIS_HAS_STEALTHCHOP(X2)
|
2020-02-26 09:02:03 +00:00
|
|
|
TMC_EDIT_STORED_HYBRID_THRS(X2, STR_X2);
|
2019-01-17 19:17:16 +00:00
|
|
|
#endif
|
|
|
|
#if AXIS_HAS_STEALTHCHOP(Y2)
|
2020-02-26 09:02:03 +00:00
|
|
|
TMC_EDIT_STORED_HYBRID_THRS(Y2, STR_Y2);
|
2019-01-17 19:17:16 +00:00
|
|
|
#endif
|
|
|
|
#if AXIS_HAS_STEALTHCHOP(Z2)
|
2020-02-26 09:02:03 +00:00
|
|
|
TMC_EDIT_STORED_HYBRID_THRS(Z2, STR_Z2);
|
2019-01-17 19:17:16 +00:00
|
|
|
#endif
|
|
|
|
#if AXIS_HAS_STEALTHCHOP(Z3)
|
2020-02-26 09:02:03 +00:00
|
|
|
TMC_EDIT_STORED_HYBRID_THRS(Z3, STR_Z3);
|
2019-01-17 19:17:16 +00:00
|
|
|
#endif
|
2020-01-20 05:35:07 +00:00
|
|
|
#if AXIS_HAS_STEALTHCHOP(Z4)
|
2020-02-26 09:02:03 +00:00
|
|
|
TMC_EDIT_STORED_HYBRID_THRS(Z4, STR_Z4);
|
2020-01-20 05:35:07 +00:00
|
|
|
#endif
|
2019-01-17 19:17:16 +00:00
|
|
|
#if AXIS_HAS_STEALTHCHOP(E0)
|
2019-10-08 00:44:33 +00:00
|
|
|
TMC_EDIT_STORED_HYBRID_THRS(E0, LCD_STR_E0);
|
2019-01-17 19:17:16 +00:00
|
|
|
#endif
|
|
|
|
#if AXIS_HAS_STEALTHCHOP(E1)
|
2019-10-08 00:44:33 +00:00
|
|
|
TMC_EDIT_STORED_HYBRID_THRS(E1, LCD_STR_E1);
|
2019-01-17 19:17:16 +00:00
|
|
|
#endif
|
|
|
|
#if AXIS_HAS_STEALTHCHOP(E2)
|
2019-10-08 00:44:33 +00:00
|
|
|
TMC_EDIT_STORED_HYBRID_THRS(E2, LCD_STR_E2);
|
2019-01-17 19:17:16 +00:00
|
|
|
#endif
|
|
|
|
#if AXIS_HAS_STEALTHCHOP(E3)
|
2019-10-08 00:44:33 +00:00
|
|
|
TMC_EDIT_STORED_HYBRID_THRS(E3, LCD_STR_E3);
|
2019-01-17 19:17:16 +00:00
|
|
|
#endif
|
|
|
|
#if AXIS_HAS_STEALTHCHOP(E4)
|
2019-10-08 00:44:33 +00:00
|
|
|
TMC_EDIT_STORED_HYBRID_THRS(E4, LCD_STR_E4);
|
2019-01-17 19:17:16 +00:00
|
|
|
#endif
|
|
|
|
#if AXIS_HAS_STEALTHCHOP(E5)
|
2019-10-08 00:44:33 +00:00
|
|
|
TMC_EDIT_STORED_HYBRID_THRS(E5, LCD_STR_E5);
|
2019-01-17 19:17:16 +00:00
|
|
|
#endif
|
2020-01-25 08:13:39 +00:00
|
|
|
#if AXIS_HAS_STEALTHCHOP(E6)
|
|
|
|
TMC_EDIT_STORED_HYBRID_THRS(E6, LCD_STR_E6);
|
|
|
|
#endif
|
|
|
|
#if AXIS_HAS_STEALTHCHOP(E7)
|
|
|
|
TMC_EDIT_STORED_HYBRID_THRS(E7, LCD_STR_E7);
|
|
|
|
#endif
|
2019-01-17 19:17:16 +00:00
|
|
|
END_MENU();
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#if ENABLED(SENSORLESS_HOMING)
|
|
|
|
|
2020-02-26 11:38:25 +00:00
|
|
|
#define TMC_EDIT_STORED_SGT(ST) EDIT_ITEM_P(int4, PSTR(STR_##ST), &stepper##ST.stored.homing_thrs, stepper##ST.sgt_min, stepper##ST.sgt_max, []{ stepper##ST.refresh_homing_thrs(); });
|
2019-01-17 19:17:16 +00:00
|
|
|
|
|
|
|
void menu_tmc_homing_thrs() {
|
|
|
|
START_MENU();
|
2019-10-03 10:38:30 +00:00
|
|
|
BACK_ITEM(MSG_TMC_DRIVERS);
|
2019-01-17 19:17:16 +00:00
|
|
|
#if X_SENSORLESS
|
|
|
|
TMC_EDIT_STORED_SGT(X);
|
2020-05-01 03:52:33 +00:00
|
|
|
#if X2_SENSORLESS
|
|
|
|
TMC_EDIT_STORED_SGT(X2);
|
|
|
|
#endif
|
2019-08-29 05:15:31 +00:00
|
|
|
#endif
|
2019-01-17 19:17:16 +00:00
|
|
|
#if Y_SENSORLESS
|
|
|
|
TMC_EDIT_STORED_SGT(Y);
|
2020-05-01 03:52:33 +00:00
|
|
|
#if Y2_SENSORLESS
|
|
|
|
TMC_EDIT_STORED_SGT(Y2);
|
|
|
|
#endif
|
2019-01-17 19:17:16 +00:00
|
|
|
#endif
|
|
|
|
#if Z_SENSORLESS
|
|
|
|
TMC_EDIT_STORED_SGT(Z);
|
2020-05-01 03:52:33 +00:00
|
|
|
#if Z2_SENSORLESS
|
|
|
|
TMC_EDIT_STORED_SGT(Z2);
|
|
|
|
#endif
|
|
|
|
#if Z3_SENSORLESS
|
|
|
|
TMC_EDIT_STORED_SGT(Z3);
|
|
|
|
#endif
|
|
|
|
#if Z4_SENSORLESS
|
|
|
|
TMC_EDIT_STORED_SGT(Z4);
|
|
|
|
#endif
|
2019-01-17 19:17:16 +00:00
|
|
|
#endif
|
|
|
|
END_MENU();
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
2019-01-21 05:54:57 +00:00
|
|
|
#if HAS_STEALTHCHOP
|
2019-01-17 19:17:16 +00:00
|
|
|
|
2020-02-26 11:38:25 +00:00
|
|
|
#define TMC_EDIT_STEP_MODE(ST, STR) EDIT_ITEM_P(bool, PSTR(STR), &stepper##ST.stored.stealthChop_enabled, []{ stepper##ST.refresh_stepping_mode(); })
|
2019-01-17 19:17:16 +00:00
|
|
|
|
|
|
|
void menu_tmc_step_mode() {
|
|
|
|
START_MENU();
|
|
|
|
STATIC_ITEM(MSG_TMC_STEALTH_ENABLED);
|
2019-10-03 10:38:30 +00:00
|
|
|
BACK_ITEM(MSG_TMC_DRIVERS);
|
2019-01-17 19:17:16 +00:00
|
|
|
#if AXIS_HAS_STEALTHCHOP(X)
|
2020-02-26 09:02:03 +00:00
|
|
|
TMC_EDIT_STEP_MODE(X, STR_X);
|
2019-01-17 19:17:16 +00:00
|
|
|
#endif
|
|
|
|
#if AXIS_HAS_STEALTHCHOP(Y)
|
2020-02-26 09:02:03 +00:00
|
|
|
TMC_EDIT_STEP_MODE(Y, STR_Y);
|
2019-01-17 19:17:16 +00:00
|
|
|
#endif
|
|
|
|
#if AXIS_HAS_STEALTHCHOP(Z)
|
2020-02-26 09:02:03 +00:00
|
|
|
TMC_EDIT_STEP_MODE(Z, STR_Z);
|
2019-01-17 19:17:16 +00:00
|
|
|
#endif
|
|
|
|
#if AXIS_HAS_STEALTHCHOP(X2)
|
2020-02-26 09:02:03 +00:00
|
|
|
TMC_EDIT_STEP_MODE(X2, STR_X2);
|
2019-01-17 19:17:16 +00:00
|
|
|
#endif
|
|
|
|
#if AXIS_HAS_STEALTHCHOP(Y2)
|
2020-02-26 09:02:03 +00:00
|
|
|
TMC_EDIT_STEP_MODE(Y2, STR_Y2);
|
2019-01-17 19:17:16 +00:00
|
|
|
#endif
|
|
|
|
#if AXIS_HAS_STEALTHCHOP(Z2)
|
2020-02-26 09:02:03 +00:00
|
|
|
TMC_EDIT_STEP_MODE(Z2, STR_Z2);
|
2019-01-17 19:17:16 +00:00
|
|
|
#endif
|
|
|
|
#if AXIS_HAS_STEALTHCHOP(Z3)
|
2020-02-26 09:02:03 +00:00
|
|
|
TMC_EDIT_STEP_MODE(Z3, STR_Z3);
|
2019-01-17 19:17:16 +00:00
|
|
|
#endif
|
2020-01-20 05:35:07 +00:00
|
|
|
#if AXIS_HAS_STEALTHCHOP(Z4)
|
2020-02-26 09:02:03 +00:00
|
|
|
TMC_EDIT_STEP_MODE(Z4, STR_Z4);
|
2020-01-20 05:35:07 +00:00
|
|
|
#endif
|
2019-01-17 19:17:16 +00:00
|
|
|
#if AXIS_HAS_STEALTHCHOP(E0)
|
2019-10-08 00:44:33 +00:00
|
|
|
TMC_EDIT_STEP_MODE(E0, LCD_STR_E0);
|
2019-01-17 19:17:16 +00:00
|
|
|
#endif
|
|
|
|
#if AXIS_HAS_STEALTHCHOP(E1)
|
2019-10-08 00:44:33 +00:00
|
|
|
TMC_EDIT_STEP_MODE(E1, LCD_STR_E1);
|
2019-01-17 19:17:16 +00:00
|
|
|
#endif
|
|
|
|
#if AXIS_HAS_STEALTHCHOP(E2)
|
2019-10-08 00:44:33 +00:00
|
|
|
TMC_EDIT_STEP_MODE(E2, LCD_STR_E2);
|
2019-01-17 19:17:16 +00:00
|
|
|
#endif
|
|
|
|
#if AXIS_HAS_STEALTHCHOP(E3)
|
2019-10-08 00:44:33 +00:00
|
|
|
TMC_EDIT_STEP_MODE(E3, LCD_STR_E3);
|
2019-01-17 19:17:16 +00:00
|
|
|
#endif
|
|
|
|
#if AXIS_HAS_STEALTHCHOP(E4)
|
2019-10-08 00:44:33 +00:00
|
|
|
TMC_EDIT_STEP_MODE(E4, LCD_STR_E4);
|
2019-01-17 19:17:16 +00:00
|
|
|
#endif
|
|
|
|
#if AXIS_HAS_STEALTHCHOP(E5)
|
2019-10-08 00:44:33 +00:00
|
|
|
TMC_EDIT_STEP_MODE(E5, LCD_STR_E5);
|
2019-01-17 19:17:16 +00:00
|
|
|
#endif
|
2020-01-25 08:13:39 +00:00
|
|
|
#if AXIS_HAS_STEALTHCHOP(E6)
|
|
|
|
TMC_EDIT_STEP_MODE(E6, LCD_STR_E6);
|
|
|
|
#endif
|
|
|
|
#if AXIS_HAS_STEALTHCHOP(E7)
|
|
|
|
TMC_EDIT_STEP_MODE(E7, LCD_STR_E7);
|
|
|
|
#endif
|
2019-01-17 19:17:16 +00:00
|
|
|
END_MENU();
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
void menu_tmc() {
|
|
|
|
START_MENU();
|
2020-11-27 03:25:18 +00:00
|
|
|
BACK_ITEM(MSG_ADVANCED_SETTINGS);
|
2019-10-03 10:38:30 +00:00
|
|
|
SUBMENU(MSG_TMC_CURRENT, menu_tmc_current);
|
2019-01-17 19:17:16 +00:00
|
|
|
#if ENABLED(HYBRID_THRESHOLD)
|
2019-10-03 10:38:30 +00:00
|
|
|
SUBMENU(MSG_TMC_HYBRID_THRS, menu_tmc_hybrid_thrs);
|
2019-01-17 19:17:16 +00:00
|
|
|
#endif
|
|
|
|
#if ENABLED(SENSORLESS_HOMING)
|
2019-10-03 10:38:30 +00:00
|
|
|
SUBMENU(MSG_TMC_HOMING_THRS, menu_tmc_homing_thrs);
|
2019-01-17 19:17:16 +00:00
|
|
|
#endif
|
2019-01-21 05:54:57 +00:00
|
|
|
#if HAS_STEALTHCHOP
|
2019-10-03 10:38:30 +00:00
|
|
|
SUBMENU(MSG_TMC_STEPPING_MODE, menu_tmc_step_mode);
|
2019-01-17 19:17:16 +00:00
|
|
|
#endif
|
|
|
|
END_MENU();
|
|
|
|
}
|
|
|
|
|
2020-03-02 18:03:43 +00:00
|
|
|
#endif // HAS_TRINAMIC_CONFIG
|