|
@ -74,8 +74,9 @@ |
|
|
#define IFSD(A,B) (B) |
|
|
#define IFSD(A,B) (B) |
|
|
#endif |
|
|
#endif |
|
|
|
|
|
|
|
|
#if HAS_TRINAMIC && HAS_LCD_MENU |
|
|
#if HAS_TRINAMIC |
|
|
#include "../../feature/tmc_util.h" |
|
|
#include "../../feature/tmc_util.h" |
|
|
|
|
|
#include "../../module/stepper_indirection.h" |
|
|
#endif |
|
|
#endif |
|
|
|
|
|
|
|
|
#include "ui_api.h" |
|
|
#include "ui_api.h" |
|
@ -339,6 +340,122 @@ namespace ExtUI { |
|
|
return !thermalManager.tooColdToExtrude(extruder - E0); |
|
|
return !thermalManager.tooColdToExtrude(extruder - E0); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
#if HAS_SOFTWARE_ENDSTOPS |
|
|
|
|
|
bool getSoftEndstopState() { |
|
|
|
|
|
return soft_endstops_enabled; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void setSoftEndstopState(const bool value) { |
|
|
|
|
|
soft_endstops_enabled = value; |
|
|
|
|
|
} |
|
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
|
|
#if HAS_TRINAMIC |
|
|
|
|
|
float getAxisCurrent_mA(const axis_t axis) { |
|
|
|
|
|
switch (axis) { |
|
|
|
|
|
#if AXIS_IS_TMC(X) |
|
|
|
|
|
case X: return stepperX.getMilliamps(); |
|
|
|
|
|
#endif |
|
|
|
|
|
#if AXIS_IS_TMC(Y) |
|
|
|
|
|
case Y: return stepperY.getMilliamps(); |
|
|
|
|
|
#endif |
|
|
|
|
|
#if AXIS_IS_TMC(Z) |
|
|
|
|
|
case Z: return stepperZ.getMilliamps(); |
|
|
|
|
|
#endif |
|
|
|
|
|
default: return NAN; |
|
|
|
|
|
}; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
float getAxisCurrent_mA(const extruder_t extruder) { |
|
|
|
|
|
switch (extruder) { |
|
|
|
|
|
#if AXIS_IS_TMC(E0) |
|
|
|
|
|
case E0: return stepperE0.getMilliamps(); |
|
|
|
|
|
#endif |
|
|
|
|
|
#if AXIS_IS_TMC(E1) |
|
|
|
|
|
case E1: return stepperE1.getMilliamps(); |
|
|
|
|
|
#endif |
|
|
|
|
|
#if AXIS_IS_TMC(E2) |
|
|
|
|
|
case E2: return stepperE2.getMilliamps(); |
|
|
|
|
|
#endif |
|
|
|
|
|
#if AXIS_IS_TMC(E3) |
|
|
|
|
|
case E3: return stepperE3.getMilliamps(); |
|
|
|
|
|
#endif |
|
|
|
|
|
#if AXIS_IS_TMC(E4) |
|
|
|
|
|
case E4: return stepperE4.getMilliamps(); |
|
|
|
|
|
#endif |
|
|
|
|
|
#if AXIS_IS_TMC(E5) |
|
|
|
|
|
case E5: return stepperE5.getMilliamps(); |
|
|
|
|
|
#endif |
|
|
|
|
|
default: return NAN; |
|
|
|
|
|
}; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void setAxisCurrent_mA(const float mA, const axis_t axis) { |
|
|
|
|
|
switch (axis) { |
|
|
|
|
|
#if AXIS_IS_TMC(X) |
|
|
|
|
|
case X: stepperX.rms_current(clamp(mA, 500, 1500)); break; |
|
|
|
|
|
#endif |
|
|
|
|
|
#if AXIS_IS_TMC(Y) |
|
|
|
|
|
case Y: stepperY.rms_current(clamp(mA, 500, 1500)); break; |
|
|
|
|
|
#endif |
|
|
|
|
|
#if AXIS_IS_TMC(Z) |
|
|
|
|
|
case Z: stepperZ.rms_current(clamp(mA, 500, 1500)); break; |
|
|
|
|
|
#endif |
|
|
|
|
|
}; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void setAxisCurrent_mA(const float mA, const extruder_t extruder) { |
|
|
|
|
|
switch (extruder) { |
|
|
|
|
|
#if AXIS_IS_TMC(E0) |
|
|
|
|
|
case E0: stepperE0.rms_current(clamp(mA, 500, 1500)); break; |
|
|
|
|
|
#endif |
|
|
|
|
|
#if AXIS_IS_TMC(E1) |
|
|
|
|
|
case E1: stepperE1.rms_current(clamp(mA, 500, 1500)); break; |
|
|
|
|
|
#endif |
|
|
|
|
|
#if AXIS_IS_TMC(E2) |
|
|
|
|
|
case E2: stepperE2.rms_current(clamp(mA, 500, 1500)); break; |
|
|
|
|
|
#endif |
|
|
|
|
|
#if AXIS_IS_TMC(E3) |
|
|
|
|
|
case E3: stepperE3.rms_current(clamp(mA, 500, 1500)); break; |
|
|
|
|
|
#endif |
|
|
|
|
|
#if AXIS_IS_TMC(E4) |
|
|
|
|
|
case E4: stepperE4.rms_current(clamp(mA, 500, 1500)); break; |
|
|
|
|
|
#endif |
|
|
|
|
|
#if AXIS_IS_TMC(E5) |
|
|
|
|
|
case E5: stepperE5.rms_current(clamp(mA, 500, 1500)); break; |
|
|
|
|
|
#endif |
|
|
|
|
|
}; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
int getTMCBumpSensitivity(const axis_t axis) { |
|
|
|
|
|
switch (axis) { |
|
|
|
|
|
#if X_SENSORLESS && AXIS_HAS_STALLGUARD(X) |
|
|
|
|
|
case X: return stepperX.sgt(); |
|
|
|
|
|
#endif |
|
|
|
|
|
#if Y_SENSORLESS && AXIS_HAS_STALLGUARD(Y) |
|
|
|
|
|
case Y: return stepperY.sgt(); |
|
|
|
|
|
#endif |
|
|
|
|
|
#if Z_SENSORLESS && AXIS_HAS_STALLGUARD(Z) |
|
|
|
|
|
case Z: return stepperZ.sgt(); |
|
|
|
|
|
#endif |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void setTMCBumpSensitivity(const float value, const axis_t axis) { |
|
|
|
|
|
switch (axis) { |
|
|
|
|
|
#if X_SENSORLESS && AXIS_HAS_STALLGUARD(X) |
|
|
|
|
|
case X: stepperX.sgt(clamp(value, -64, 63)); break; |
|
|
|
|
|
#endif |
|
|
|
|
|
#if Y_SENSORLESS && AXIS_HAS_STALLGUARD(Y) |
|
|
|
|
|
case Y: stepperY.sgt(clamp(value, -64, 63)); break; |
|
|
|
|
|
#endif |
|
|
|
|
|
#if Z_SENSORLESS && AXIS_HAS_STALLGUARD(Z) |
|
|
|
|
|
case Z: stepperZ.sgt(clamp(value, -64, 63)); break; |
|
|
|
|
|
#endif |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
float getAxisSteps_per_mm(const axis_t axis) { |
|
|
float getAxisSteps_per_mm(const axis_t axis) { |
|
|
return planner.settings.axis_steps_per_mm[axis]; |
|
|
return planner.settings.axis_steps_per_mm[axis]; |
|
|
} |
|
|
} |
|
@ -787,10 +904,6 @@ void MarlinUI::init() { |
|
|
SET_INPUT_PULLUP(SD_DETECT_PIN); |
|
|
SET_INPUT_PULLUP(SD_DETECT_PIN); |
|
|
#endif |
|
|
#endif |
|
|
|
|
|
|
|
|
#if HAS_TRINAMIC && HAS_LCD_MENU |
|
|
|
|
|
init_tmc_section(); |
|
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
|
|
ExtUI::onStartup(); |
|
|
ExtUI::onStartup(); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|