✨ EDITABLE_HOMING_CURRENT (#27760)
This commit is contained in:
parent
7bd74fecbb
commit
460bf112d8
14 changed files with 291 additions and 56 deletions
|
|
@ -2995,6 +2995,8 @@
|
|||
|
||||
#define HOLD_MULTIPLIER 0.5 // Scales down the holding current from run current
|
||||
|
||||
//#define EDITABLE_HOMING_CURRENT // Add a G-code and menu to modify the Homing Current
|
||||
|
||||
/**
|
||||
* Interpolate microsteps to 256
|
||||
* Override for each driver with <driver>_INTERPOLATE settings below
|
||||
|
|
|
|||
|
|
@ -312,8 +312,9 @@
|
|||
#define STR_FILAMENT_RUNOUT_SENSOR "Filament runout sensor"
|
||||
#define STR_DRIVER_STEPPING_MODE "Driver stepping mode"
|
||||
#define STR_STEPPER_DRIVER_CURRENT "Stepper driver current"
|
||||
#define STR_HOMING_CURRENT "Homing Current (mA)"
|
||||
#define STR_HYBRID_THRESHOLD "Hybrid Threshold"
|
||||
#define STR_STALLGUARD_THRESHOLD "StallGuard threshold"
|
||||
#define STR_STALLGUARD_THRESHOLD "StallGuard Threshold"
|
||||
#define STR_HOME_OFFSET "Home offset"
|
||||
#define STR_SOFT_ENDSTOPS "Soft endstops"
|
||||
#define STR_MATERIAL_HEATUP "Material heatup parameters"
|
||||
|
|
|
|||
|
|
@ -43,6 +43,10 @@
|
|||
#endif
|
||||
#endif
|
||||
|
||||
#if ENABLED(EDITABLE_HOMING_CURRENT)
|
||||
homing_current_t homing_current_mA;
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Check for over temperature or short to ground error flags.
|
||||
* Report and log warning of overtemperature condition.
|
||||
|
|
|
|||
|
|
@ -375,6 +375,32 @@ void test_tmc_connection(LOGICAL_AXIS_DECL_LC(const bool, true));
|
|||
|
||||
#endif // USE_SENSORLESS
|
||||
|
||||
#if HAS_HOMING_CURRENT
|
||||
|
||||
// Axes that have a distinct homing current
|
||||
struct homing_current_t {
|
||||
OPTCODE(X_HAS_HOME_CURRENT, uint16_t X)
|
||||
OPTCODE(Y_HAS_HOME_CURRENT, uint16_t Y)
|
||||
OPTCODE(Z_HAS_HOME_CURRENT, uint16_t Z)
|
||||
OPTCODE(X2_HAS_HOME_CURRENT, uint16_t X2)
|
||||
OPTCODE(Y2_HAS_HOME_CURRENT, uint16_t Y2)
|
||||
OPTCODE(Z2_HAS_HOME_CURRENT, uint16_t Z2)
|
||||
OPTCODE(Z3_HAS_HOME_CURRENT, uint16_t Z3)
|
||||
OPTCODE(Z4_HAS_HOME_CURRENT, uint16_t Z4)
|
||||
OPTCODE(I_HAS_HOME_CURRENT, uint16_t I)
|
||||
OPTCODE(J_HAS_HOME_CURRENT, uint16_t J)
|
||||
OPTCODE(K_HAS_HOME_CURRENT, uint16_t K)
|
||||
OPTCODE(U_HAS_HOME_CURRENT, uint16_t U)
|
||||
OPTCODE(V_HAS_HOME_CURRENT, uint16_t V)
|
||||
OPTCODE(W_HAS_HOME_CURRENT, uint16_t W)
|
||||
};
|
||||
|
||||
#if ENABLED(EDITABLE_HOMING_CURRENT)
|
||||
extern homing_current_t homing_current_mA;
|
||||
#endif
|
||||
|
||||
#endif // HAS_HOMING_CURRENT
|
||||
|
||||
#endif // HAS_TRINAMIC_CONFIG
|
||||
|
||||
#if HAS_TMC_SPI
|
||||
|
|
|
|||
|
|
@ -37,6 +37,8 @@ static void tmc_print_current(TMC &st) {
|
|||
/**
|
||||
* M906: Set motor current in milliamps.
|
||||
*
|
||||
* With no parameters report driver currents.
|
||||
*
|
||||
* Parameters:
|
||||
* X[current] - Set mA current for X driver(s)
|
||||
* Y[current] - Set mA current for Y driver(s)
|
||||
|
|
@ -52,9 +54,14 @@ static void tmc_print_current(TMC &st) {
|
|||
* I[index] - Axis sub-index (Omit or 0 for X, Y, Z; 1 for X2, Y2, Z2; 2 for Z3; 3 for Z4.)
|
||||
* T[index] - Extruder index (Zero-based. Omit for E0 only.)
|
||||
*
|
||||
* With no parameters report driver currents.
|
||||
* With EDITABLE_HOMING_CURRENT:
|
||||
* H - Set / Report Homing Current. Alias for M920.
|
||||
*/
|
||||
void GcodeSuite::M906() {
|
||||
#if ENABLED(EDITABLE_HOMING_CURRENT)
|
||||
if (parser.seen_test('H')) return M920();
|
||||
#endif
|
||||
|
||||
#define TMC_SAY_CURRENT(Q) tmc_print_current(stepper##Q)
|
||||
#define TMC_SET_CURRENT(Q) stepper##Q.rms_current(value)
|
||||
|
||||
|
|
|
|||
144
Marlin/src/gcode/feature/trinamic/M920.cpp
Normal file
144
Marlin/src/gcode/feature/trinamic/M920.cpp
Normal file
|
|
@ -0,0 +1,144 @@
|
|||
/**
|
||||
* Marlin 3D Printer Firmware
|
||||
* Copyright (c) 2025 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
|
||||
*
|
||||
* Based on Sprinter and grbl.
|
||||
* Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
|
||||
*
|
||||
* 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
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "../../../inc/MarlinConfigPre.h"
|
||||
|
||||
#if ENABLED(EDITABLE_HOMING_CURRENT)
|
||||
|
||||
#include "../../gcode.h"
|
||||
#include "../../../feature/tmc_util.h"
|
||||
|
||||
#if AXIS_COLLISION('I')
|
||||
#define I_PARAM 'S'
|
||||
#define I_PARAM_STR "S"
|
||||
#warning "Use 'M920 S' instead of 'M920 I' for the stepper number."
|
||||
#else
|
||||
#define I_PARAM 'I'
|
||||
#define I_PARAM_STR "I"
|
||||
#endif
|
||||
|
||||
/**
|
||||
* M920: Set Homing Current for one or more axes
|
||||
*
|
||||
* Parameters:
|
||||
* X[current] - Homing Current to use for X axis stepper(s)
|
||||
* Y[current] - Homing Current to use for Y axis stepper(s)
|
||||
* Z[current] - Homing Current to use for Z axis stepper(s)
|
||||
* A[current] - Homing Current to use for A axis stepper(s)
|
||||
* B[current] - Homing Current to use for B axis stepper(s)
|
||||
* C[current] - Homing Current to use for C axis stepper(s)
|
||||
* U[current] - Homing Current to use for U axis stepper(s)
|
||||
* V[current] - Homing Current to use for V axis stepper(s)
|
||||
* W[current] - Homing Current to use for W axis stepper(s)
|
||||
*
|
||||
* I<index> - For multi-stepper axes, the zero-based index of the stepper to modify in each axis.
|
||||
* If omitted all steppers of each axis will be set to the given axis current.
|
||||
*/
|
||||
void GcodeSuite::M920() {
|
||||
bool report = true;
|
||||
const uint8_t index = parser.byteval(I_PARAM);
|
||||
LOOP_NUM_AXES(i) if (parser.seen(AXIS_CHAR(i))) {
|
||||
const int16_t value = parser.value_int();
|
||||
report = false;
|
||||
switch (i) {
|
||||
#if X_HAS_HOME_CURRENT
|
||||
case X_AXIS:
|
||||
if (index < 1) homing_current_mA.X = value;
|
||||
TERN_(X2_HAS_HOME_CURRENT, if (!index || index == 1) homing_current_mA.X2 = value);
|
||||
break;
|
||||
#endif
|
||||
#if Y_HAS_HOME_CURRENT
|
||||
case Y_AXIS:
|
||||
if (index < 1) homing_current_mA.Y = value;
|
||||
TERN_(Y2_HAS_HOME_CURRENT, if (!index || index == 1) homing_current_mA.Y2 = value);
|
||||
break;
|
||||
#endif
|
||||
#if Z_HAS_HOME_CURRENT
|
||||
case Z_AXIS:
|
||||
if (index < 1) homing_current_mA.Z = value;
|
||||
TERN_(Z2_HAS_HOME_CURRENT, if (!index || index == 1) homing_current_mA.Z2 = value);
|
||||
TERN_(Z3_HAS_HOME_CURRENT, if (!index || index == 2) homing_current_mA.Z3 = value);
|
||||
TERN_(Z4_HAS_HOME_CURRENT, if (!index || index == 3) homing_current_mA.Z4 = value);
|
||||
break;
|
||||
#endif
|
||||
OPTCODE(I_HAS_HOME_CURRENT, case I_AXIS: homing_current_mA.I = value; break)
|
||||
OPTCODE(J_HAS_HOME_CURRENT, case J_AXIS: homing_current_mA.J = value; break)
|
||||
OPTCODE(K_HAS_HOME_CURRENT, case K_AXIS: homing_current_mA.K = value; break)
|
||||
OPTCODE(U_HAS_HOME_CURRENT, case U_AXIS: homing_current_mA.U = value; break)
|
||||
OPTCODE(V_HAS_HOME_CURRENT, case V_AXIS: homing_current_mA.V = value; break)
|
||||
OPTCODE(W_HAS_HOME_CURRENT, case W_AXIS: homing_current_mA.W = value; break)
|
||||
}
|
||||
}
|
||||
|
||||
if (report) M920_report();
|
||||
}
|
||||
|
||||
void GcodeSuite::M920_report(const bool forReplay/*=true*/) {
|
||||
TERN_(MARLIN_SMALL_BUILD, return);
|
||||
|
||||
report_heading(forReplay, F(STR_HOMING_CURRENT));
|
||||
|
||||
auto say_M920 = [](const bool forReplay, int16_t index=-1) {
|
||||
report_echo_start(forReplay);
|
||||
SERIAL_ECHOPGM(" M920");
|
||||
if (index >= 0) SERIAL_ECHOPGM(" " I_PARAM_STR, index);
|
||||
};
|
||||
|
||||
#if X_SENSORLESS || Y_SENSORLESS || Z_SENSORLESS
|
||||
#if X2_SENSORLESS || Y2_SENSORLESS || Z2_SENSORLESS || Z3_SENSORLESS || Z4_SENSORLESS
|
||||
say_M920(forReplay, 0);
|
||||
#else
|
||||
say_M920(forReplay);
|
||||
#endif
|
||||
TERN_(X_SENSORLESS, SERIAL_ECHOPGM_P(SP_X_STR, homing_current_mA.X));
|
||||
TERN_(Y_SENSORLESS, SERIAL_ECHOPGM_P(SP_Y_STR, homing_current_mA.Y));
|
||||
TERN_(Z_SENSORLESS, SERIAL_ECHOPGM_P(SP_Z_STR, homing_current_mA.Z));
|
||||
#if X2_SENSORLESS || Y2_SENSORLESS || Z2_SENSORLESS || Z3_SENSORLESS || Z4_SENSORLESS
|
||||
say_M920(forReplay);
|
||||
#endif
|
||||
TERN_(I_SENSORLESS, SERIAL_ECHOPGM_P(SP_I_STR, homing_current_mA.I));
|
||||
TERN_(J_SENSORLESS, SERIAL_ECHOPGM_P(SP_J_STR, homing_current_mA.J));
|
||||
TERN_(K_SENSORLESS, SERIAL_ECHOPGM_P(SP_K_STR, homing_current_mA.K));
|
||||
TERN_(U_SENSORLESS, SERIAL_ECHOPGM_P(SP_U_STR, homing_current_mA.U));
|
||||
TERN_(V_SENSORLESS, SERIAL_ECHOPGM_P(SP_V_STR, homing_current_mA.V));
|
||||
TERN_(W_SENSORLESS, SERIAL_ECHOPGM_P(SP_W_STR, homing_current_mA.W));
|
||||
SERIAL_EOL();
|
||||
#endif
|
||||
|
||||
#if X2_SENSORLESS || Y2_SENSORLESS || Z2_SENSORLESS
|
||||
say_M920(forReplay, 1);
|
||||
TERN_(X2_SENSORLESS, SERIAL_ECHOPGM_P(SP_X_STR, homing_current_mA.X2));
|
||||
TERN_(Y2_SENSORLESS, SERIAL_ECHOPGM_P(SP_Y_STR, homing_current_mA.Y2));
|
||||
TERN_(Z2_SENSORLESS, SERIAL_ECHOPGM_P(SP_Z_STR, homing_current_mA.Z2));
|
||||
SERIAL_EOL();
|
||||
#endif
|
||||
#if Z3_SENSORLESS
|
||||
say_M920(forReplay, 2);
|
||||
SERIAL_ECHOLNPGM(" Z", homing_current_mA.Z3);
|
||||
#endif
|
||||
#if Z4_SENSORLESS
|
||||
say_M920(forReplay, 3);
|
||||
SERIAL_ECHOLNPGM(" Z", homing_current_mA.Z4);
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif // EDITABLE_HOMING_CURRENT
|
||||
|
|
@ -1056,12 +1056,15 @@ void GcodeSuite::process_parsed_command(const bool no_ok/*=false*/) {
|
|||
case 912: M912(); break; // M912: Clear TMC2130 prewarn triggered flags
|
||||
#endif
|
||||
#if ENABLED(HYBRID_THRESHOLD)
|
||||
case 913: M913(); break; // M913: Set HYBRID_THRESHOLD speed.
|
||||
case 913: M913(); break; // M913: Set HYBRID_THRESHOLD speed
|
||||
#endif
|
||||
#if USE_SENSORLESS
|
||||
case 914: M914(); break; // M914: Set StallGuard sensitivity.
|
||||
case 914: M914(); break; // M914: Set StallGuard sensitivity
|
||||
#endif
|
||||
case 919: M919(); break; // M919: Set stepper Chopper Times
|
||||
#if ENABLED(EDITABLE_HOMING_CURRENT)
|
||||
case 920: M920(); break; // M920: Set Homing Current
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if HAS_MICROSTEPS
|
||||
|
|
|
|||
|
|
@ -320,6 +320,7 @@
|
|||
* M914 - Set StallGuard sensitivity. (Requires SENSORLESS_HOMING or SENSORLESS_PROBING)
|
||||
* M919 - Set or Report motor Chopper Times (time_off, hysteresis_end, hysteresis_start) using axis codes XYZE, etc.
|
||||
* If no parameters are given, report. (Requires *_DRIVER_TYPE TMC(2130|2160|5130|5160|2208|2209|2660))
|
||||
* M920 - Set Homing Current. (Requires distinct *_CURRENT_HOME settings)
|
||||
* M936 - OTA update firmware. (Requires OTA_FIRMWARE_UPDATE)
|
||||
* M951 - Set Magnetic Parking Extruder parameters. (Requires MAGNETIC_PARKING_EXTRUDER)
|
||||
* M3426 - Read MCP3426 ADC over I2C. (Requires HAS_MCP3426_ADC)
|
||||
|
|
@ -1259,6 +1260,10 @@ private:
|
|||
static void M914_report(const bool forReplay=true);
|
||||
#endif
|
||||
static void M919();
|
||||
#if ENABLED(EDITABLE_HOMING_CURRENT)
|
||||
static void M920();
|
||||
static void M920_report(const bool forReplay=true);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if HAS_MOTOR_CURRENT_SPI || HAS_MOTOR_CURRENT_PWM || HAS_MOTOR_CURRENT_I2C || HAS_MOTOR_CURRENT_DAC
|
||||
|
|
|
|||
|
|
@ -883,6 +883,7 @@ namespace LanguageNarrow_en {
|
|||
LSTR MSG_TMC_HOMING_THRS = _UxGT("Sensorless Homing");
|
||||
LSTR MSG_TMC_STEPPING_MODE = _UxGT("Stepping Mode");
|
||||
LSTR MSG_TMC_STEALTHCHOP = _UxGT("StealthChop");
|
||||
LSTR MSG_TMC_HOMING_CURRENT = _UxGT("Homing Current");
|
||||
|
||||
LSTR MSG_SERVICE_RESET = _UxGT("Reset");
|
||||
LSTR MSG_SERVICE_IN = _UxGT(" in:");
|
||||
|
|
|
|||
|
|
@ -110,6 +110,33 @@ void menu_tmc_current() {
|
|||
|
||||
#endif // SENSORLESS_HOMING
|
||||
|
||||
#if ENABLED(EDITABLE_HOMING_CURRENT)
|
||||
|
||||
#define TMC_EDIT_HOMING_CURRENT(ST, STR) EDIT_ITEM_FAST_F(uint16_4, F(STR), &homing_current_mA.ST, ST##_CURRENT / 3, ST##_CURRENT)
|
||||
|
||||
void menu_tmc_homing_current() {
|
||||
START_MENU();
|
||||
STATIC_ITEM(MSG_TMC_HOMING_CURRENT);
|
||||
BACK_ITEM(MSG_TMC_DRIVERS);
|
||||
TERN_( X_HAS_HOME_CURRENT, TMC_EDIT_HOMING_CURRENT(X, STR_X));
|
||||
TERN_(X2_HAS_HOME_CURRENT, TMC_EDIT_HOMING_CURRENT(X2, STR_X2));
|
||||
TERN_( Y_HAS_HOME_CURRENT, TMC_EDIT_HOMING_CURRENT(Y, STR_Y));
|
||||
TERN_(Y2_HAS_HOME_CURRENT, TMC_EDIT_HOMING_CURRENT(Y2, STR_Y2));
|
||||
TERN_( Z_HAS_HOME_CURRENT, TMC_EDIT_HOMING_CURRENT(Z, STR_Z));
|
||||
TERN_(Z2_HAS_HOME_CURRENT, TMC_EDIT_HOMING_CURRENT(Z2, STR_Z2));
|
||||
TERN_(Z3_HAS_HOME_CURRENT, TMC_EDIT_HOMING_CURRENT(Z3, STR_Z3));
|
||||
TERN_(Z4_HAS_HOME_CURRENT, TMC_EDIT_HOMING_CURRENT(Z4, STR_Z4));
|
||||
TERN_( I_HAS_HOME_CURRENT, TMC_EDIT_HOMING_CURRENT(I, STR_I));
|
||||
TERN_( J_HAS_HOME_CURRENT, TMC_EDIT_HOMING_CURRENT(J, STR_J));
|
||||
TERN_( K_HAS_HOME_CURRENT, TMC_EDIT_HOMING_CURRENT(K, STR_K));
|
||||
TERN_( U_HAS_HOME_CURRENT, TMC_EDIT_HOMING_CURRENT(U, STR_U));
|
||||
TERN_( V_HAS_HOME_CURRENT, TMC_EDIT_HOMING_CURRENT(V, STR_V));
|
||||
TERN_( W_HAS_HOME_CURRENT, TMC_EDIT_HOMING_CURRENT(W, STR_W));
|
||||
END_MENU();
|
||||
}
|
||||
|
||||
#endif // EDITABLE_HOMING_CURRENT
|
||||
|
||||
#if HAS_STEALTHCHOP
|
||||
|
||||
#define TMC_EDIT_STEP_MODE(ST, STR) EDIT_ITEM_F(bool, F(STR), &stepper##ST.stored.stealthChop_enabled, []{ stepper##ST.refresh_stepping_mode(); })
|
||||
|
|
@ -143,9 +170,10 @@ void menu_tmc() {
|
|||
START_MENU();
|
||||
BACK_ITEM(MSG_ADVANCED_SETTINGS);
|
||||
SUBMENU(MSG_TMC_CURRENT, menu_tmc_current);
|
||||
TERN_(HYBRID_THRESHOLD, SUBMENU(MSG_TMC_HYBRID_THRS, menu_tmc_hybrid_thrs));
|
||||
TERN_(SENSORLESS_HOMING, SUBMENU(MSG_TMC_HOMING_THRS, menu_tmc_homing_thrs));
|
||||
TERN_(HAS_STEALTHCHOP, SUBMENU(MSG_TMC_STEPPING_MODE, menu_tmc_step_mode));
|
||||
TERN_(HYBRID_THRESHOLD, SUBMENU(MSG_TMC_HYBRID_THRS, menu_tmc_hybrid_thrs));
|
||||
TERN_(SENSORLESS_HOMING, SUBMENU(MSG_TMC_HOMING_THRS, menu_tmc_homing_thrs));
|
||||
TERN_(EDITABLE_HOMING_CURRENT, SUBMENU(MSG_TMC_HOMING_CURRENT, menu_tmc_homing_current));
|
||||
TERN_(HAS_STEALTHCHOP, SUBMENU(MSG_TMC_STEALTHCHOP, menu_tmc_step_mode));
|
||||
END_MENU();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -271,48 +271,7 @@ void report_current_position_projected() {
|
|||
#define debug_current(...)
|
||||
#endif
|
||||
|
||||
#if HAS_CURRENT_HOME_X
|
||||
int16_t saved_current_X;
|
||||
#endif
|
||||
#if HAS_CURRENT_HOME_Y
|
||||
int16_t saved_current_Y;
|
||||
#endif
|
||||
#if HAS_CURRENT_HOME_Z
|
||||
int16_t saved_current_Z;
|
||||
#endif
|
||||
#if HAS_CURRENT_HOME_X2
|
||||
int16_t saved_current_X2;
|
||||
#endif
|
||||
#if HAS_CURRENT_HOME_Y2
|
||||
int16_t saved_current_Y2;
|
||||
#endif
|
||||
#if HAS_CURRENT_HOME_Z2
|
||||
int16_t saved_current_Z2;
|
||||
#endif
|
||||
#if HAS_CURRENT_HOME_Z3
|
||||
int16_t saved_current_Z3;
|
||||
#endif
|
||||
#if HAS_CURRENT_HOME_Z4
|
||||
int16_t saved_current_Z4;
|
||||
#endif
|
||||
#if HAS_CURRENT_HOME_I
|
||||
int16_t saved_current_I;
|
||||
#endif
|
||||
#if HAS_CURRENT_HOME_J
|
||||
int16_t saved_current_J;
|
||||
#endif
|
||||
#if HAS_CURRENT_HOME_K
|
||||
int16_t saved_current_K;
|
||||
#endif
|
||||
#if HAS_CURRENT_HOME_U
|
||||
int16_t saved_current_U;
|
||||
#endif
|
||||
#if HAS_CURRENT_HOME_V
|
||||
int16_t saved_current_V;
|
||||
#endif
|
||||
#if HAS_CURRENT_HOME_W
|
||||
int16_t saved_current_W;
|
||||
#endif
|
||||
homing_current_t saved_current_mA;
|
||||
|
||||
/**
|
||||
* Set motors to their homing / probing currents.
|
||||
|
|
@ -320,11 +279,13 @@ void report_current_position_projected() {
|
|||
*/
|
||||
void set_homing_current(const AxisEnum axis) {
|
||||
|
||||
#define HOMING_CURRENT(A) TERN(EDITABLE_HOMING_CURRENT, homing_current_mA.A, A##_CURRENT_HOME)
|
||||
|
||||
// Saves the running current of the motor at the moment the function is called and sets current to CURRENT_HOME
|
||||
#define _SAVE_SET_CURRENT(A) \
|
||||
saved_current_##A = stepper##A.getMilliamps(); \
|
||||
stepper##A.rms_current(A##_CURRENT_HOME); \
|
||||
debug_current(F(STR_##A), saved_current_##A, A##_CURRENT_HOME)
|
||||
saved_current_mA.A = stepper##A.getMilliamps(); \
|
||||
stepper##A.rms_current(HOMING_CURRENT(A)); \
|
||||
debug_current(F(STR_##A), saved_current_mA.A, HOMING_CURRENT(A))
|
||||
|
||||
#define _MAP_SAVE_SET(A) OPTCODE(A##_HAS_HOME_CURRENT, _SAVE_SET_CURRENT(A))
|
||||
|
||||
|
|
@ -478,8 +439,8 @@ void report_current_position_projected() {
|
|||
|
||||
// Restore the saved current
|
||||
#define _RESTORE_CURRENT(A) \
|
||||
stepper##A.rms_current(saved_current_##A); \
|
||||
debug_current(F(STR_##A), A##_CURRENT_HOME, saved_current_##A)
|
||||
stepper##A.rms_current(saved_current_mA.A); \
|
||||
debug_current(F(STR_##A), HOMING_CURRENT(A), saved_current_mA.A)
|
||||
|
||||
#define _MAP_RESTORE(A) OPTCODE(A##_HAS_HOME_CURRENT, _RESTORE_CURRENT(A))
|
||||
|
||||
|
|
|
|||
|
|
@ -469,6 +469,13 @@ typedef struct SettingsDataStruct {
|
|||
xyz_feedrate_t homing_feedrate_mm_m; // M210 X Y Z I J K U V W
|
||||
#endif
|
||||
|
||||
//
|
||||
// TMC Homing Current
|
||||
//
|
||||
#if ENABLED(EDITABLE_HOMING_CURRENT)
|
||||
homing_current_t homing_current_mA; // M920 X Y Z...
|
||||
#endif
|
||||
|
||||
//
|
||||
// !NO_VOLUMETRIC
|
||||
//
|
||||
|
|
@ -1355,6 +1362,14 @@ void MarlinSettings::postprocess() {
|
|||
EEPROM_WRITE(homing_feedrate_mm_m);
|
||||
#endif
|
||||
|
||||
//
|
||||
// TMC Homing Current
|
||||
//
|
||||
#if ENABLED(EDITABLE_HOMING_CURRENT)
|
||||
_FIELD_TEST(homing_current_mA);
|
||||
EEPROM_WRITE(homing_current_mA);
|
||||
#endif
|
||||
|
||||
//
|
||||
// Volumetric & Filament Size
|
||||
//
|
||||
|
|
@ -2414,6 +2429,14 @@ void MarlinSettings::postprocess() {
|
|||
EEPROM_READ(homing_feedrate_mm_m);
|
||||
#endif
|
||||
|
||||
//
|
||||
// TMC Homing Current
|
||||
//
|
||||
#if ENABLED(EDITABLE_HOMING_CURRENT)
|
||||
_FIELD_TEST(homing_current_mA);
|
||||
EEPROM_READ(homing_current_mA);
|
||||
#endif
|
||||
|
||||
//
|
||||
// Volumetric & Filament Size
|
||||
//
|
||||
|
|
@ -3626,6 +3649,29 @@ void MarlinSettings::reset() {
|
|||
//
|
||||
TERN_(EDITABLE_HOMING_FEEDRATE, homing_feedrate_mm_m = xyz_feedrate_t(HOMING_FEEDRATE_MM_M));
|
||||
|
||||
//
|
||||
// TMC Homing Current
|
||||
//
|
||||
#if ENABLED(EDITABLE_HOMING_CURRENT)
|
||||
homing_current_t base_homing_current_mA = {
|
||||
OPTITEM(X_HAS_HOME_CURRENT, X_CURRENT_HOME)
|
||||
OPTITEM(Y_HAS_HOME_CURRENT, Y_CURRENT_HOME)
|
||||
OPTITEM(Z_HAS_HOME_CURRENT, Z_CURRENT_HOME)
|
||||
OPTITEM(X2_HAS_HOME_CURRENT, X2_CURRENT_HOME)
|
||||
OPTITEM(Y2_HAS_HOME_CURRENT, Y2_CURRENT_HOME)
|
||||
OPTITEM(Z2_HAS_HOME_CURRENT, Z2_CURRENT_HOME)
|
||||
OPTITEM(Z3_HAS_HOME_CURRENT, Z3_CURRENT_HOME)
|
||||
OPTITEM(Z4_HAS_HOME_CURRENT, Z4_CURRENT_HOME)
|
||||
OPTITEM(I_HAS_HOME_CURRENT, I_CURRENT_HOME)
|
||||
OPTITEM(J_HAS_HOME_CURRENT, J_CURRENT_HOME)
|
||||
OPTITEM(K_HAS_HOME_CURRENT, K_CURRENT_HOME)
|
||||
OPTITEM(U_HAS_HOME_CURRENT, U_CURRENT_HOME)
|
||||
OPTITEM(V_HAS_HOME_CURRENT, V_CURRENT_HOME)
|
||||
OPTITEM(W_HAS_HOME_CURRENT, W_CURRENT_HOME)
|
||||
};
|
||||
homing_current_mA = base_homing_current_mA;
|
||||
#endif
|
||||
|
||||
//
|
||||
// Volumetric & Filament Size
|
||||
//
|
||||
|
|
@ -4058,6 +4104,11 @@ void MarlinSettings::reset() {
|
|||
TERN_(USE_SENSORLESS, gcode.M914_report(forReplay));
|
||||
#endif
|
||||
|
||||
//
|
||||
// TMC Homing Current
|
||||
//
|
||||
TERN_(EDITABLE_HOMING_CURRENT, gcode.M920_report(forReplay));
|
||||
|
||||
//
|
||||
// TMC stepping mode
|
||||
//
|
||||
|
|
|
|||
|
|
@ -11,8 +11,9 @@ set -e
|
|||
#
|
||||
restore_configs
|
||||
opt_set MOTHERBOARD BOARD_BTT_SKR_MINI_E3_V1_0 SERIAL_PORT 1 SERIAL_PORT_2 -1 \
|
||||
X_DRIVER_TYPE TMC2209 Y_DRIVER_TYPE TMC2209 Z_DRIVER_TYPE TMC2209 E0_DRIVER_TYPE TMC2209
|
||||
opt_enable CR10_STOCKDISPLAY PINS_DEBUGGING Z_IDLE_HEIGHT \
|
||||
X_DRIVER_TYPE TMC2209 Y_DRIVER_TYPE TMC2209 Z_DRIVER_TYPE TMC2209 E0_DRIVER_TYPE TMC2209 \
|
||||
X_CURRENT_HOME X_CURRENT/2 Y_CURRENT_HOME Y_CURRENT/2 Z_CURRENT_HOME Y_CURRENT/2
|
||||
opt_enable CR10_STOCKDISPLAY PINS_DEBUGGING Z_IDLE_HEIGHT EDITABLE_HOMING_CURRENT \
|
||||
FT_MOTION FT_MOTION_MENU BIQU_MICROPROBE_V1 PROBE_ENABLE_DISABLE Z_SAFE_HOMING AUTO_BED_LEVELING_BILINEAR \
|
||||
ADAPTIVE_STEP_SMOOTHING NONLINEAR_EXTRUSION
|
||||
exec_test $1 $2 "BigTreeTech SKR Mini E3 1.0 - TMC2209 HW Serial, FT_MOTION" "$3"
|
||||
|
|
|
|||
|
|
@ -23,6 +23,7 @@ MKS_WIFI_MODULE = QRCode=https://github.com/makerbase-mks
|
|||
HAS_TRINAMIC_CONFIG = TMCStepper=https://github.com/MarlinFirmware/TMCStepper/archive/marlin-2.1.3.x.zip
|
||||
build_src_filter=+<src/module/stepper/trinamic.cpp> +<src/gcode/feature/trinamic/M122.cpp> +<src/gcode/feature/trinamic/M906.cpp> +<src/gcode/feature/trinamic/M911-M914.cpp> +<src/gcode/feature/trinamic/M919.cpp>
|
||||
HAS_T(RINAMIC_CONFIG|MC_SPI) = build_src_filter=+<src/feature/tmc_util.cpp>
|
||||
EDITABLE_HOMING_CURRENT = build_src_filter=+<src/gcode/feature/trinamic/M920.cpp>
|
||||
SR_LCD_3W_NL = SailfishLCD=https://github.com/mikeshub/SailfishLCD/archive/6f53c19a8a.zip
|
||||
HAS_MOTOR_CURRENT_(I2C|DAC|SPI|PWM) = build_src_filter=+<src/gcode/feature/digipot>
|
||||
HAS_MOTOR_CURRENT_I2C = SlowSoftI2CMaster
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue