Various cleanups ahead of digipot save

This commit is contained in:
Scott Lahteine
2017-06-24 22:23:45 -05:00
parent ece89bcf7a
commit 3c7bfe798d
5 changed files with 36 additions and 27 deletions

View File

@ -9677,10 +9677,13 @@ inline void gcode_M503() {
*/
inline void gcode_M907() {
#if HAS_DIGIPOTSS
LOOP_XYZE(i) if (parser.seen(axis_codes[i])) stepper.digipot_current(i, parser.value_int());
if (parser.seen('B')) stepper.digipot_current(4, parser.value_int());
if (parser.seen('S')) for (uint8_t i = 0; i <= 4; i++) stepper.digipot_current(i, parser.value_int());
#elif HAS_MOTOR_CURRENT_PWM
#if PIN_EXISTS(MOTOR_CURRENT_PWM_XY)
if (parser.seen('X')) stepper.digipot_current(0, parser.value_int());
#endif
@ -9690,13 +9693,16 @@ inline void gcode_M907() {
#if PIN_EXISTS(MOTOR_CURRENT_PWM_E)
if (parser.seen('E')) stepper.digipot_current(2, parser.value_int());
#endif
#endif
#if ENABLED(DIGIPOT_I2C)
// this one uses actual amps in floating point
LOOP_XYZE(i) if (parser.seen(axis_codes[i])) digipot_i2c_set_current(i, parser.value_float());
// for each additional extruder (named B,C,D,E..., channels 4,5,6,7...)
for (uint8_t i = NUM_AXIS; i < DIGIPOT_I2C_NUM_CHANNELS; i++) if (parser.seen('B' + i - (NUM_AXIS))) digipot_i2c_set_current(i, parser.value_float());
#endif
#if ENABLED(DAC_STEPPER_CURRENT)
if (parser.seen('S')) {
const float dac_percent = parser.value_float();