Merge upstream changes from Marlin 2.1.1
This commit is contained in:
@@ -33,17 +33,12 @@
|
||||
#include "../gcode/gcode.h"
|
||||
|
||||
#if ENABLED(TMC_DEBUG)
|
||||
#include "../module/planner.h"
|
||||
#include "../libs/hex_print.h"
|
||||
#if ENABLED(MONITOR_DRIVER_STATUS)
|
||||
static uint16_t report_tmc_status_interval; // = 0
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if HAS_LCD_MENU
|
||||
#include "../module/stepper.h"
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Check for over temperature or short to ground error flags.
|
||||
* Report and log warning of overtemperature condition.
|
||||
@@ -212,7 +207,7 @@
|
||||
if (data.is_ot) SERIAL_ECHOLNPGM("overtemperature");
|
||||
if (data.is_s2g) SERIAL_ECHOLNPGM("coil short circuit");
|
||||
TERN_(TMC_DEBUG, tmc_report_all());
|
||||
kill(PSTR("Driver error"));
|
||||
kill(F("Driver error"));
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -421,16 +416,26 @@
|
||||
if (monitor_tmc_driver(stepperI, need_update_error_counters, need_debug_reporting))
|
||||
step_current_down(stepperI);
|
||||
#endif
|
||||
|
||||
#if AXIS_IS_TMC(J)
|
||||
if (monitor_tmc_driver(stepperJ, need_update_error_counters, need_debug_reporting))
|
||||
step_current_down(stepperJ);
|
||||
#endif
|
||||
|
||||
#if AXIS_IS_TMC(K)
|
||||
if (monitor_tmc_driver(stepperK, need_update_error_counters, need_debug_reporting))
|
||||
step_current_down(stepperK);
|
||||
#endif
|
||||
#if AXIS_IS_TMC(U)
|
||||
if (monitor_tmc_driver(stepperU, need_update_error_counters, need_debug_reporting))
|
||||
step_current_down(stepperU);
|
||||
#endif
|
||||
#if AXIS_IS_TMC(V)
|
||||
if (monitor_tmc_driver(stepperV, need_update_error_counters, need_debug_reporting))
|
||||
step_current_down(stepperV);
|
||||
#endif
|
||||
#if AXIS_IS_TMC(W)
|
||||
if (monitor_tmc_driver(stepperW, need_update_error_counters, need_debug_reporting))
|
||||
step_current_down(stepperW);
|
||||
#endif
|
||||
|
||||
#if AXIS_IS_TMC(E0)
|
||||
(void)monitor_tmc_driver(stepperE0, need_update_error_counters, need_debug_reporting);
|
||||
@@ -472,12 +477,8 @@
|
||||
void tmc_set_report_interval(const uint16_t update_interval) {
|
||||
if ((report_tmc_status_interval = update_interval))
|
||||
SERIAL_ECHOLNPGM("axis:pwm_scale"
|
||||
#if HAS_STEALTHCHOP
|
||||
"/curr_scale"
|
||||
#endif
|
||||
#if HAS_STALLGUARD
|
||||
"/mech_load"
|
||||
#endif
|
||||
TERN_(HAS_STEALTHCHOP, "/curr_scale")
|
||||
TERN_(HAS_STALLGUARD, "/mech_load")
|
||||
"|flags|warncount"
|
||||
);
|
||||
}
|
||||
@@ -561,7 +562,7 @@
|
||||
};
|
||||
|
||||
template<class TMC>
|
||||
static void print_vsense(TMC &st) { SERIAL_ECHOPGM_P(st.vsense() ? PSTR("1=.18") : PSTR("0=.325")); }
|
||||
static void print_vsense(TMC &st) { SERIAL_ECHOF(st.vsense() ? F("1=.18") : F("0=.325")); }
|
||||
|
||||
#if HAS_DRIVER(TMC2130) || HAS_DRIVER(TMC5130)
|
||||
static void _tmc_status(TMC2130Stepper &st, const TMC_debug_enum i) {
|
||||
@@ -732,7 +733,7 @@
|
||||
SERIAL_ECHO(st.cs());
|
||||
SERIAL_ECHOPGM("/31");
|
||||
break;
|
||||
case TMC_VSENSE: SERIAL_ECHOPGM_P(st.vsense() ? PSTR("1=.165") : PSTR("0=.310")); break;
|
||||
case TMC_VSENSE: SERIAL_ECHOF(st.vsense() ? F("1=.165") : F("0=.310")); break;
|
||||
case TMC_MICROSTEPS: SERIAL_ECHO(st.microsteps()); break;
|
||||
//case TMC_OTPW: serialprint_truefalse(st.otpw()); break;
|
||||
//case TMC_OTPW_TRIGGERED: serialprint_truefalse(st.getOTPW()); break;
|
||||
@@ -815,6 +816,15 @@
|
||||
#if AXIS_IS_TMC(K)
|
||||
if (k) tmc_status(stepperK, n);
|
||||
#endif
|
||||
#if AXIS_IS_TMC(U)
|
||||
if (u) tmc_status(stepperU, n);
|
||||
#endif
|
||||
#if AXIS_IS_TMC(V)
|
||||
if (v) tmc_status(stepperV, n);
|
||||
#endif
|
||||
#if AXIS_IS_TMC(W)
|
||||
if (w) tmc_status(stepperW, n);
|
||||
#endif
|
||||
|
||||
if (TERN0(HAS_EXTRUDERS, e)) {
|
||||
#if AXIS_IS_TMC(E0)
|
||||
@@ -889,6 +899,15 @@
|
||||
#if AXIS_IS_TMC(K)
|
||||
if (k) tmc_parse_drv_status(stepperK, n);
|
||||
#endif
|
||||
#if AXIS_IS_TMC(U)
|
||||
if (u) tmc_parse_drv_status(stepperU, n);
|
||||
#endif
|
||||
#if AXIS_IS_TMC(V)
|
||||
if (v) tmc_parse_drv_status(stepperV, n);
|
||||
#endif
|
||||
#if AXIS_IS_TMC(W)
|
||||
if (w) tmc_parse_drv_status(stepperW, n);
|
||||
#endif
|
||||
|
||||
if (TERN0(HAS_EXTRUDERS, e)) {
|
||||
#if AXIS_IS_TMC(E0)
|
||||
@@ -1094,6 +1113,15 @@
|
||||
#if AXIS_IS_TMC(K)
|
||||
if (k) tmc_get_registers(stepperK, n);
|
||||
#endif
|
||||
#if AXIS_IS_TMC(U)
|
||||
if (u) tmc_get_registers(stepperU, n);
|
||||
#endif
|
||||
#if AXIS_IS_TMC(V)
|
||||
if (v) tmc_get_registers(stepperV, n);
|
||||
#endif
|
||||
#if AXIS_IS_TMC(W)
|
||||
if (w) tmc_get_registers(stepperW, n);
|
||||
#endif
|
||||
|
||||
if (TERN0(HAS_EXTRUDERS, e)) {
|
||||
#if AXIS_IS_TMC(E0)
|
||||
@@ -1184,69 +1212,6 @@
|
||||
|
||||
#endif // USE_SENSORLESS
|
||||
|
||||
#if HAS_TMC_SPI
|
||||
#define SET_CS_PIN(st) OUT_WRITE(st##_CS_PIN, HIGH)
|
||||
void tmc_init_cs_pins() {
|
||||
#if AXIS_HAS_SPI(X)
|
||||
SET_CS_PIN(X);
|
||||
#endif
|
||||
#if AXIS_HAS_SPI(Y)
|
||||
SET_CS_PIN(Y);
|
||||
#endif
|
||||
#if AXIS_HAS_SPI(Z)
|
||||
SET_CS_PIN(Z);
|
||||
#endif
|
||||
#if AXIS_HAS_SPI(X2)
|
||||
SET_CS_PIN(X2);
|
||||
#endif
|
||||
#if AXIS_HAS_SPI(Y2)
|
||||
SET_CS_PIN(Y2);
|
||||
#endif
|
||||
#if AXIS_HAS_SPI(Z2)
|
||||
SET_CS_PIN(Z2);
|
||||
#endif
|
||||
#if AXIS_HAS_SPI(Z3)
|
||||
SET_CS_PIN(Z3);
|
||||
#endif
|
||||
#if AXIS_HAS_SPI(Z4)
|
||||
SET_CS_PIN(Z4);
|
||||
#endif
|
||||
#if AXIS_HAS_SPI(I)
|
||||
SET_CS_PIN(I);
|
||||
#endif
|
||||
#if AXIS_HAS_SPI(J)
|
||||
SET_CS_PIN(J);
|
||||
#endif
|
||||
#if AXIS_HAS_SPI(K)
|
||||
SET_CS_PIN(K);
|
||||
#endif
|
||||
#if AXIS_HAS_SPI(E0)
|
||||
SET_CS_PIN(E0);
|
||||
#endif
|
||||
#if AXIS_HAS_SPI(E1)
|
||||
SET_CS_PIN(E1);
|
||||
#endif
|
||||
#if AXIS_HAS_SPI(E2)
|
||||
SET_CS_PIN(E2);
|
||||
#endif
|
||||
#if AXIS_HAS_SPI(E3)
|
||||
SET_CS_PIN(E3);
|
||||
#endif
|
||||
#if AXIS_HAS_SPI(E4)
|
||||
SET_CS_PIN(E4);
|
||||
#endif
|
||||
#if AXIS_HAS_SPI(E5)
|
||||
SET_CS_PIN(E5);
|
||||
#endif
|
||||
#if AXIS_HAS_SPI(E6)
|
||||
SET_CS_PIN(E6);
|
||||
#endif
|
||||
#if AXIS_HAS_SPI(E7)
|
||||
SET_CS_PIN(E7);
|
||||
#endif
|
||||
}
|
||||
#endif // HAS_TMC_SPI
|
||||
|
||||
template<typename TMC>
|
||||
static bool test_connection(TMC &st) {
|
||||
SERIAL_ECHOPGM("Testing ");
|
||||
@@ -1256,15 +1221,14 @@ static bool test_connection(TMC &st) {
|
||||
|
||||
if (test_result > 0) SERIAL_ECHOPGM("Error: All ");
|
||||
|
||||
const char *stat;
|
||||
FSTR_P stat;
|
||||
switch (test_result) {
|
||||
default:
|
||||
case 0: stat = PSTR("OK"); break;
|
||||
case 1: stat = PSTR("HIGH"); break;
|
||||
case 2: stat = PSTR("LOW"); break;
|
||||
case 0: stat = F("OK"); break;
|
||||
case 1: stat = F("HIGH"); break;
|
||||
case 2: stat = F("LOW"); break;
|
||||
}
|
||||
SERIAL_ECHOPGM_P(stat);
|
||||
SERIAL_EOL();
|
||||
SERIAL_ECHOLNF(stat);
|
||||
|
||||
return test_result;
|
||||
}
|
||||
@@ -1314,6 +1278,15 @@ void test_tmc_connection(LOGICAL_AXIS_ARGS(const bool)) {
|
||||
#if AXIS_IS_TMC(K)
|
||||
if (k) axis_connection += test_connection(stepperK);
|
||||
#endif
|
||||
#if AXIS_IS_TMC(U)
|
||||
if (u) axis_connection += test_connection(stepperU);
|
||||
#endif
|
||||
#if AXIS_IS_TMC(V)
|
||||
if (v) axis_connection += test_connection(stepperV);
|
||||
#endif
|
||||
#if AXIS_IS_TMC(W)
|
||||
if (w) axis_connection += test_connection(stepperW);
|
||||
#endif
|
||||
|
||||
if (TERN0(HAS_EXTRUDERS, e)) {
|
||||
#if AXIS_IS_TMC(E0)
|
||||
@@ -1342,7 +1315,79 @@ void test_tmc_connection(LOGICAL_AXIS_ARGS(const bool)) {
|
||||
#endif
|
||||
}
|
||||
|
||||
if (axis_connection) LCD_MESSAGEPGM(MSG_ERROR_TMC);
|
||||
if (axis_connection) LCD_MESSAGE(MSG_ERROR_TMC);
|
||||
}
|
||||
|
||||
#endif // HAS_TRINAMIC_CONFIG
|
||||
|
||||
#if HAS_TMC_SPI
|
||||
#define SET_CS_PIN(st) OUT_WRITE(st##_CS_PIN, HIGH)
|
||||
void tmc_init_cs_pins() {
|
||||
#if AXIS_HAS_SPI(X)
|
||||
SET_CS_PIN(X);
|
||||
#endif
|
||||
#if AXIS_HAS_SPI(Y)
|
||||
SET_CS_PIN(Y);
|
||||
#endif
|
||||
#if AXIS_HAS_SPI(Z)
|
||||
SET_CS_PIN(Z);
|
||||
#endif
|
||||
#if AXIS_HAS_SPI(X2)
|
||||
SET_CS_PIN(X2);
|
||||
#endif
|
||||
#if AXIS_HAS_SPI(Y2)
|
||||
SET_CS_PIN(Y2);
|
||||
#endif
|
||||
#if AXIS_HAS_SPI(Z2)
|
||||
SET_CS_PIN(Z2);
|
||||
#endif
|
||||
#if AXIS_HAS_SPI(Z3)
|
||||
SET_CS_PIN(Z3);
|
||||
#endif
|
||||
#if AXIS_HAS_SPI(Z4)
|
||||
SET_CS_PIN(Z4);
|
||||
#endif
|
||||
#if AXIS_HAS_SPI(I)
|
||||
SET_CS_PIN(I);
|
||||
#endif
|
||||
#if AXIS_HAS_SPI(J)
|
||||
SET_CS_PIN(J);
|
||||
#endif
|
||||
#if AXIS_HAS_SPI(K)
|
||||
SET_CS_PIN(K);
|
||||
#endif
|
||||
#if AXIS_HAS_SPI(U)
|
||||
SET_CS_PIN(U);
|
||||
#endif
|
||||
#if AXIS_HAS_SPI(V)
|
||||
SET_CS_PIN(V);
|
||||
#endif
|
||||
#if AXIS_HAS_SPI(W)
|
||||
SET_CS_PIN(W);
|
||||
#endif
|
||||
#if AXIS_HAS_SPI(E0)
|
||||
SET_CS_PIN(E0);
|
||||
#endif
|
||||
#if AXIS_HAS_SPI(E1)
|
||||
SET_CS_PIN(E1);
|
||||
#endif
|
||||
#if AXIS_HAS_SPI(E2)
|
||||
SET_CS_PIN(E2);
|
||||
#endif
|
||||
#if AXIS_HAS_SPI(E3)
|
||||
SET_CS_PIN(E3);
|
||||
#endif
|
||||
#if AXIS_HAS_SPI(E4)
|
||||
SET_CS_PIN(E4);
|
||||
#endif
|
||||
#if AXIS_HAS_SPI(E5)
|
||||
SET_CS_PIN(E5);
|
||||
#endif
|
||||
#if AXIS_HAS_SPI(E6)
|
||||
SET_CS_PIN(E6);
|
||||
#endif
|
||||
#if AXIS_HAS_SPI(E7)
|
||||
SET_CS_PIN(E7);
|
||||
#endif
|
||||
}
|
||||
#endif // HAS_TMC_SPI
|
||||
|
Reference in New Issue
Block a user