Fix TMC gcode commands
This commit is contained in:
@ -35,56 +35,6 @@
|
||||
bool report_tmc_status = false;
|
||||
char extended_axis_codes[11][3] = { "X", "X2", "Y", "Y2", "Z", "Z2", "E0", "E1", "E2", "E3", "E4" };
|
||||
|
||||
template<typename TMC>
|
||||
void tmc_get_current(TMC &st, const char name[]) {
|
||||
SERIAL_ECHO(name);
|
||||
SERIAL_ECHOPGM(" axis driver current: ");
|
||||
SERIAL_ECHOLN(st.getCurrent());
|
||||
}
|
||||
template<typename TMC>
|
||||
void tmc_set_current(TMC &st, const char name[], const int mA) {
|
||||
st.setCurrent(mA, R_SENSE, HOLD_MULTIPLIER);
|
||||
tmc_get_current(st, name);
|
||||
}
|
||||
|
||||
template<typename TMC>
|
||||
void tmc_report_otpw(TMC &st, const char name[]) {
|
||||
SERIAL_ECHO(name);
|
||||
SERIAL_ECHOPGM(" axis temperature prewarn triggered: ");
|
||||
serialprintPGM(st.getOTPW() ? PSTR("true") : PSTR("false"));
|
||||
SERIAL_EOL();
|
||||
}
|
||||
template<typename TMC>
|
||||
void tmc_clear_otpw(TMC &st, const char name[]) {
|
||||
st.clear_otpw();
|
||||
SERIAL_ECHO(name);
|
||||
SERIAL_ECHOLNPGM(" prewarn flag cleared");
|
||||
}
|
||||
|
||||
template<typename TMC>
|
||||
void tmc_get_pwmthrs(TMC &st, const char name[], const uint16_t spmm) {
|
||||
SERIAL_ECHO(name);
|
||||
SERIAL_ECHOPGM(" stealthChop max speed set to ");
|
||||
SERIAL_ECHOLN(12650000UL * st.microsteps() / (256 * st.TPWMTHRS() * spmm));
|
||||
}
|
||||
template<typename TMC>
|
||||
void tmc_set_pwmthrs(TMC &st, const char name[], const int32_t thrs, const uint32_t spmm) {
|
||||
st.TPWMTHRS(12650000UL * st.microsteps() / (256 * thrs * spmm));
|
||||
tmc_get_pwmthrs(st, name, spmm);
|
||||
}
|
||||
|
||||
template<typename TMC>
|
||||
void tmc_get_sgt(TMC &st, const char name[]) {
|
||||
SERIAL_ECHO(name);
|
||||
SERIAL_ECHOPGM(" driver homing sensitivity set to ");
|
||||
MYSERIAL.println(st.sgt(), DEC);
|
||||
}
|
||||
template<typename TMC>
|
||||
void tmc_set_sgt(TMC &st, const char name[], const int8_t sgt_val) {
|
||||
st.sgt(sgt_val);
|
||||
tmc_get_sgt(st, name);
|
||||
}
|
||||
|
||||
/*
|
||||
* Check for over temperature or short to ground error flags.
|
||||
* Report and log warning of overtemperature condition.
|
||||
|
@ -29,27 +29,58 @@
|
||||
|
||||
extern bool report_tmc_status;
|
||||
extern char extended_axis_codes[11][3];
|
||||
|
||||
enum TMC_AxisEnum {
|
||||
TMC_X, TMC_X2, TMC_Y, TMC_Y2, TMC_Z, TMC_Z2,
|
||||
TMC_E0, TMC_E1, TMC_E2, TMC_E3, TMC_E4
|
||||
};
|
||||
|
||||
template<typename TMC>
|
||||
void tmc_get_current(TMC &st, const char name[]);
|
||||
void tmc_get_current(TMC &st, const char name[]) {
|
||||
SERIAL_ECHO(name);
|
||||
SERIAL_ECHOPGM(" axis driver current: ");
|
||||
SERIAL_ECHOLN(st.getCurrent());
|
||||
}
|
||||
template<typename TMC>
|
||||
void tmc_set_current(TMC &st, const char name[], const int mA);
|
||||
void tmc_set_current(TMC &st, const char name[], const int mA) {
|
||||
st.setCurrent(mA, R_SENSE, HOLD_MULTIPLIER);
|
||||
tmc_get_current(st, name);
|
||||
}
|
||||
template<typename TMC>
|
||||
void tmc_report_otpw(TMC &st, const char name[]);
|
||||
void tmc_report_otpw(TMC &st, const char name[]) {
|
||||
SERIAL_ECHO(name);
|
||||
SERIAL_ECHOPGM(" axis temperature prewarn triggered: ");
|
||||
serialprintPGM(st.getOTPW() ? PSTR("true") : PSTR("false"));
|
||||
SERIAL_EOL();
|
||||
}
|
||||
template<typename TMC>
|
||||
void tmc_clear_otpw(TMC &st, const char name[]);
|
||||
void tmc_clear_otpw(TMC &st, const char name[]) {
|
||||
st.clear_otpw();
|
||||
SERIAL_ECHO(name);
|
||||
SERIAL_ECHOLNPGM(" prewarn flag cleared");
|
||||
}
|
||||
template<typename TMC>
|
||||
void tmc_get_pwmthrs(TMC &st, const char name[], const uint16_t spmm);
|
||||
void tmc_get_pwmthrs(TMC &st, const char name[], const uint16_t spmm) {
|
||||
SERIAL_ECHO(name);
|
||||
SERIAL_ECHOPGM(" stealthChop max speed set to ");
|
||||
SERIAL_ECHOLN(12650000UL * st.microsteps() / (256 * st.TPWMTHRS() * spmm));
|
||||
}
|
||||
template<typename TMC>
|
||||
void tmc_set_pwmthrs(TMC &st, const char name[], const int32_t thrs, const uint32_t spmm);
|
||||
void tmc_set_pwmthrs(TMC &st, const char name[], const int32_t thrs, const uint32_t spmm) {
|
||||
st.TPWMTHRS(12650000UL * st.microsteps() / (256 * thrs * spmm));
|
||||
tmc_get_pwmthrs(st, name, spmm);
|
||||
}
|
||||
template<typename TMC>
|
||||
void tmc_get_sgt(TMC &st, const char name[]);
|
||||
void tmc_get_sgt(TMC &st, const char name[]) {
|
||||
SERIAL_ECHO(name);
|
||||
SERIAL_ECHOPGM(" driver homing sensitivity set to ");
|
||||
MYSERIAL.println(st.sgt(), DEC);
|
||||
}
|
||||
template<typename TMC>
|
||||
void tmc_set_sgt(TMC &st, const char name[], const int8_t sgt_val);
|
||||
void tmc_set_sgt(TMC &st, const char name[], const int8_t sgt_val) {
|
||||
st.sgt(sgt_val);
|
||||
tmc_get_sgt(st, name);
|
||||
}
|
||||
|
||||
void _M122();
|
||||
void monitor_tmc_driver();
|
||||
|
Reference in New Issue
Block a user