Additional follow-up the PR #3631(Encapsulate S...
Additional follow-up the PR #3631(Encapsulate Stepper, Planner, Endstops in singleton classes) ・Change from abort_on_endstop_hit to stepper.abort_on_endstop_hit in endstop.cpp, Marlin_main.cpp, and ultralcd.cpp ・Add include path to cardreader.h and temperature.h in endstop.cpp(for CardReader class and disable_all_heaters()) It fix compilation error when ABORT_ON_ENDSTOP_HIT_FEATURE_ENABLED and SDSUPPORT are enabled. ・Change from digipot_current() to stepper.digipot_current() in Marlin_main.cpp ・Change from digitalPotWrite() to stepper.digitalPotWrite() in Marlin_main.cpp It fix compilation errors when HAS_DIGIPOTSS is enabled. ・Change from microstep_mode() to stepper.microstep_mode() in Marlin_main.cpp ・Change attribute of microstep_mode() from private to public in stepper.h ・Change from microstep_readings() to stepper.microstep_readings() in Marlin_main.cpp ・Change from microstep_ms() to stepper.microstep_ms() in Marlin_main. It fix compilation errors when HAS_MICROSTEPS is enabled.
This commit is contained in:
parent
6bb664c690
commit
605808fe37
4 changed files with 22 additions and 20 deletions
|
@ -5933,7 +5933,7 @@ inline void gcode_M503() {
|
||||||
* M540: Set whether SD card print should abort on endstop hit (M540 S<0|1>)
|
* M540: Set whether SD card print should abort on endstop hit (M540 S<0|1>)
|
||||||
*/
|
*/
|
||||||
inline void gcode_M540() {
|
inline void gcode_M540() {
|
||||||
if (code_seen('S')) abort_on_endstop_hit = (code_value() > 0);
|
if (code_seen('S')) stepper.abort_on_endstop_hit = (code_value() > 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // ABORT_ON_ENDSTOP_HIT_FEATURE_ENABLED
|
#endif // ABORT_ON_ENDSTOP_HIT_FEATURE_ENABLED
|
||||||
|
@ -6166,18 +6166,18 @@ inline void gcode_M503() {
|
||||||
inline void gcode_M907() {
|
inline void gcode_M907() {
|
||||||
#if HAS_DIGIPOTSS
|
#if HAS_DIGIPOTSS
|
||||||
for (int i = 0; i < NUM_AXIS; i++)
|
for (int i = 0; i < NUM_AXIS; i++)
|
||||||
if (code_seen(axis_codes[i])) digipot_current(i, code_value());
|
if (code_seen(axis_codes[i])) stepper.digipot_current(i, code_value());
|
||||||
if (code_seen('B')) digipot_current(4, code_value());
|
if (code_seen('B')) stepper.digipot_current(4, code_value());
|
||||||
if (code_seen('S')) for (int i = 0; i <= 4; i++) digipot_current(i, code_value());
|
if (code_seen('S')) for (int i = 0; i <= 4; i++) stepper.digipot_current(i, code_value());
|
||||||
#endif
|
#endif
|
||||||
#if PIN_EXISTS(MOTOR_CURRENT_PWM_XY)
|
#if PIN_EXISTS(MOTOR_CURRENT_PWM_XY)
|
||||||
if (code_seen('X')) digipot_current(0, code_value());
|
if (code_seen('X')) stepper.digipot_current(0, code_value());
|
||||||
#endif
|
#endif
|
||||||
#if PIN_EXISTS(MOTOR_CURRENT_PWM_Z)
|
#if PIN_EXISTS(MOTOR_CURRENT_PWM_Z)
|
||||||
if (code_seen('Z')) digipot_current(1, code_value());
|
if (code_seen('Z')) stepper.digipot_current(1, code_value());
|
||||||
#endif
|
#endif
|
||||||
#if PIN_EXISTS(MOTOR_CURRENT_PWM_E)
|
#if PIN_EXISTS(MOTOR_CURRENT_PWM_E)
|
||||||
if (code_seen('E')) digipot_current(2, code_value());
|
if (code_seen('E')) stepper.digipot_current(2, code_value());
|
||||||
#endif
|
#endif
|
||||||
#if ENABLED(DIGIPOT_I2C)
|
#if ENABLED(DIGIPOT_I2C)
|
||||||
// this one uses actual amps in floating point
|
// this one uses actual amps in floating point
|
||||||
|
@ -6201,7 +6201,7 @@ inline void gcode_M907() {
|
||||||
*/
|
*/
|
||||||
inline void gcode_M908() {
|
inline void gcode_M908() {
|
||||||
#if HAS_DIGIPOTSS
|
#if HAS_DIGIPOTSS
|
||||||
digitalPotWrite(
|
stepper.digitalPotWrite(
|
||||||
code_seen('P') ? code_value() : 0,
|
code_seen('P') ? code_value() : 0,
|
||||||
code_seen('S') ? code_value() : 0
|
code_seen('S') ? code_value() : 0
|
||||||
);
|
);
|
||||||
|
@ -6228,10 +6228,10 @@ inline void gcode_M907() {
|
||||||
|
|
||||||
// M350 Set microstepping mode. Warning: Steps per unit remains unchanged. S code sets stepping mode for all drivers.
|
// M350 Set microstepping mode. Warning: Steps per unit remains unchanged. S code sets stepping mode for all drivers.
|
||||||
inline void gcode_M350() {
|
inline void gcode_M350() {
|
||||||
if (code_seen('S')) for (int i = 0; i <= 4; i++) microstep_mode(i, code_value());
|
if (code_seen('S')) for (int i = 0; i <= 4; i++) stepper.microstep_mode(i, code_value());
|
||||||
for (int i = 0; i < NUM_AXIS; i++) if (code_seen(axis_codes[i])) microstep_mode(i, (uint8_t)code_value());
|
for (int i = 0; i < NUM_AXIS; i++) if (code_seen(axis_codes[i])) stepper.microstep_mode(i, (uint8_t)code_value());
|
||||||
if (code_seen('B')) microstep_mode(4, code_value());
|
if (code_seen('B')) stepper.microstep_mode(4, code_value());
|
||||||
microstep_readings();
|
stepper.microstep_readings();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -6241,15 +6241,15 @@ inline void gcode_M907() {
|
||||||
inline void gcode_M351() {
|
inline void gcode_M351() {
|
||||||
if (code_seen('S')) switch (code_value_short()) {
|
if (code_seen('S')) switch (code_value_short()) {
|
||||||
case 1:
|
case 1:
|
||||||
for (int i = 0; i < NUM_AXIS; i++) if (code_seen(axis_codes[i])) microstep_ms(i, code_value(), -1);
|
for (int i = 0; i < NUM_AXIS; i++) if (code_seen(axis_codes[i])) stepper.microstep_ms(i, code_value(), -1);
|
||||||
if (code_seen('B')) microstep_ms(4, code_value(), -1);
|
if (code_seen('B')) stepper.microstep_ms(4, code_value(), -1);
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
for (int i = 0; i < NUM_AXIS; i++) if (code_seen(axis_codes[i])) microstep_ms(i, -1, code_value());
|
for (int i = 0; i < NUM_AXIS; i++) if (code_seen(axis_codes[i])) stepper.microstep_ms(i, -1, code_value());
|
||||||
if (code_seen('B')) microstep_ms(4, -1, code_value());
|
if (code_seen('B')) stepper.microstep_ms(4, -1, code_value());
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
microstep_readings();
|
stepper.microstep_readings();
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // HAS_MICROSTEPS
|
#endif // HAS_MICROSTEPS
|
||||||
|
|
|
@ -25,7 +25,9 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "Marlin.h"
|
#include "Marlin.h"
|
||||||
|
#include "cardreader.h"
|
||||||
#include "endstops.h"
|
#include "endstops.h"
|
||||||
|
#include "temperature.h"
|
||||||
#include "stepper.h"
|
#include "stepper.h"
|
||||||
#include "ultralcd.h"
|
#include "ultralcd.h"
|
||||||
|
|
||||||
|
@ -147,7 +149,7 @@ void Endstops::report_state() {
|
||||||
hit_on_purpose();
|
hit_on_purpose();
|
||||||
|
|
||||||
#if ENABLED(ABORT_ON_ENDSTOP_HIT_FEATURE_ENABLED) && ENABLED(SDSUPPORT)
|
#if ENABLED(ABORT_ON_ENDSTOP_HIT_FEATURE_ENABLED) && ENABLED(SDSUPPORT)
|
||||||
if (abort_on_endstop_hit) {
|
if (stepper.abort_on_endstop_hit) {
|
||||||
card.sdprinting = false;
|
card.sdprinting = false;
|
||||||
card.closefile();
|
card.closefile();
|
||||||
stepper.quick_stop();
|
stepper.quick_stop();
|
||||||
|
|
|
@ -220,6 +220,7 @@ class Stepper {
|
||||||
#endif
|
#endif
|
||||||
void microstep_ms(uint8_t driver, int8_t ms1, int8_t ms2);
|
void microstep_ms(uint8_t driver, int8_t ms1, int8_t ms2);
|
||||||
void digipot_current(uint8_t driver, int current);
|
void digipot_current(uint8_t driver, int current);
|
||||||
|
void microstep_mode(uint8_t driver, uint8_t stepping);
|
||||||
void microstep_readings();
|
void microstep_readings();
|
||||||
|
|
||||||
#if ENABLED(Z_DUAL_ENDSTOPS)
|
#if ENABLED(Z_DUAL_ENDSTOPS)
|
||||||
|
@ -324,7 +325,6 @@ class Stepper {
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void microstep_mode(uint8_t driver, uint8_t stepping);
|
|
||||||
void digipot_init();
|
void digipot_init();
|
||||||
void microstep_init();
|
void microstep_init();
|
||||||
|
|
||||||
|
|
|
@ -1674,7 +1674,7 @@ static void lcd_control_motion_menu() {
|
||||||
#endif
|
#endif
|
||||||
MENU_ITEM_EDIT(float51, MSG_ESTEPS, &planner.axis_steps_per_unit[E_AXIS], 5, 9999);
|
MENU_ITEM_EDIT(float51, MSG_ESTEPS, &planner.axis_steps_per_unit[E_AXIS], 5, 9999);
|
||||||
#if ENABLED(ABORT_ON_ENDSTOP_HIT_FEATURE_ENABLED)
|
#if ENABLED(ABORT_ON_ENDSTOP_HIT_FEATURE_ENABLED)
|
||||||
MENU_ITEM_EDIT(bool, MSG_ENDSTOP_ABORT, &abort_on_endstop_hit);
|
MENU_ITEM_EDIT(bool, MSG_ENDSTOP_ABORT, &stepper.abort_on_endstop_hit);
|
||||||
#endif
|
#endif
|
||||||
#if ENABLED(SCARA)
|
#if ENABLED(SCARA)
|
||||||
MENU_ITEM_EDIT(float74, MSG_XSCALE, &axis_scaling[X_AXIS], 0.5, 2);
|
MENU_ITEM_EDIT(float74, MSG_XSCALE, &axis_scaling[X_AXIS], 0.5, 2);
|
||||||
|
|
Reference in a new issue