Merge pull request #7136 from thinkyhead/bf_digipot_save

Edit digipot currents via LCD, save to EEPROM
2.0.x
Scott Lahteine 8 years ago committed by GitHub
commit efc6a9c1b8

@ -202,9 +202,9 @@ script:
# #
# Enable COREYX (swapped) # Enable COREYX (swapped)
# #
- restore_configs #- restore_configs
- opt_enable COREYX #- opt_enable COREYX
- build_marlin #- build_marlin
# #
# #
######## Other Standard LCD/Panels ############## ######## Other Standard LCD/Panels ##############

@ -9677,10 +9677,13 @@ inline void gcode_M503() {
*/ */
inline void gcode_M907() { inline void gcode_M907() {
#if HAS_DIGIPOTSS #if HAS_DIGIPOTSS
LOOP_XYZE(i) if (parser.seen(axis_codes[i])) stepper.digipot_current(i, parser.value_int()); 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('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()); if (parser.seen('S')) for (uint8_t i = 0; i <= 4; i++) stepper.digipot_current(i, parser.value_int());
#elif HAS_MOTOR_CURRENT_PWM #elif HAS_MOTOR_CURRENT_PWM
#if PIN_EXISTS(MOTOR_CURRENT_PWM_XY) #if PIN_EXISTS(MOTOR_CURRENT_PWM_XY)
if (parser.seen('X')) stepper.digipot_current(0, parser.value_int()); if (parser.seen('X')) stepper.digipot_current(0, parser.value_int());
#endif #endif
@ -9690,13 +9693,16 @@ inline void gcode_M907() {
#if PIN_EXISTS(MOTOR_CURRENT_PWM_E) #if PIN_EXISTS(MOTOR_CURRENT_PWM_E)
if (parser.seen('E')) stepper.digipot_current(2, parser.value_int()); if (parser.seen('E')) stepper.digipot_current(2, parser.value_int());
#endif #endif
#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
LOOP_XYZE(i) if (parser.seen(axis_codes[i])) digipot_i2c_set_current(i, parser.value_float()); 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 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()); 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 #endif
#if ENABLED(DAC_STEPPER_CURRENT) #if ENABLED(DAC_STEPPER_CURRENT)
if (parser.seen('S')) { if (parser.seen('S')) {
const float dac_percent = parser.value_float(); const float dac_percent = parser.value_float();

@ -36,13 +36,13 @@
* *
*/ */
#define EEPROM_VERSION "V38" #define EEPROM_VERSION "V39"
// Change EEPROM version if these are changed: // Change EEPROM version if these are changed:
#define EEPROM_OFFSET 100 #define EEPROM_OFFSET 100
/** /**
* V38 EEPROM Layout: * V39 EEPROM Layout:
* *
* 100 Version (char x4) * 100 Version (char x4)
* 104 EEPROM CRC16 (uint16_t) * 104 EEPROM CRC16 (uint16_t)
@ -140,24 +140,29 @@
* 534 M200 T D filament_size (float x5) (T0..3) * 534 M200 T D filament_size (float x5) (T0..3)
* *
* HAVE_TMC2130: 20 bytes * HAVE_TMC2130: 20 bytes
* 554 M906 X stepperX current (uint16_t) * 554 M906 X Stepper X current (uint16_t)
* 556 M906 Y stepperY current (uint16_t) * 556 M906 Y Stepper Y current (uint16_t)
* 558 M906 Z stepperZ current (uint16_t) * 558 M906 Z Stepper Z current (uint16_t)
* 560 M906 X2 stepperX2 current (uint16_t) * 560 M906 X2 Stepper X2 current (uint16_t)
* 562 M906 Y2 stepperY2 current (uint16_t) * 562 M906 Y2 Stepper Y2 current (uint16_t)
* 564 M906 Z2 stepperZ2 current (uint16_t) * 564 M906 Z2 Stepper Z2 current (uint16_t)
* 566 M906 E0 stepperE0 current (uint16_t) * 566 M906 E0 Stepper E0 current (uint16_t)
* 568 M906 E1 stepperE1 current (uint16_t) * 568 M906 E1 Stepper E1 current (uint16_t)
* 570 M906 E2 stepperE2 current (uint16_t) * 570 M906 E2 Stepper E2 current (uint16_t)
* 572 M906 E3 stepperE3 current (uint16_t) * 572 M906 E3 Stepper E3 current (uint16_t)
* 576 M906 E4 stepperE4 current (uint16_t) * 576 M906 E4 Stepper E4 current (uint16_t)
* *
* LIN_ADVANCE: 8 bytes * LIN_ADVANCE: 8 bytes
* 580 M900 K extruder_advance_k (float) * 580 M900 K extruder_advance_k (float)
* 584 M900 WHD advance_ed_ratio (float) * 584 M900 WHD advance_ed_ratio (float)
* *
* 588 Minimum end-point * HAS_MOTOR_CURRENT_PWM:
* 1909 (588 + 36 + 9 + 288 + 988) Maximum end-point * 588 M907 X Stepper XY current (uint32_t)
* 592 M907 Z Stepper Z current (uint32_t)
* 596 M907 E Stepper E current (uint32_t)
*
* 600 Minimum end-point
* 1921 (600 + 36 + 9 + 288 + 988) Maximum end-point
* *
* ======================================================================== * ========================================================================
* meshes_begin (between max and min end-point, directly above) * meshes_begin (between max and min end-point, directly above)
@ -177,6 +182,7 @@ MarlinSettings settings;
#include "planner.h" #include "planner.h"
#include "temperature.h" #include "temperature.h"
#include "ultralcd.h" #include "ultralcd.h"
#include "stepper.h"
#if ENABLED(INCH_MODE_SUPPORT) || (ENABLED(ULTIPANEL) && ENABLED(TEMPERATURE_UNITS_SUPPORT)) #if ENABLED(INCH_MODE_SUPPORT) || (ENABLED(ULTIPANEL) && ENABLED(TEMPERATURE_UNITS_SUPPORT))
#include "gcode.h" #include "gcode.h"
@ -238,6 +244,10 @@ void MarlinSettings::postprocess() {
refresh_bed_level(); refresh_bed_level();
//set_bed_leveling_enabled(leveling_is_on); //set_bed_leveling_enabled(leveling_is_on);
#endif #endif
#if HAS_MOTOR_CURRENT_PWM
stepper.refresh_motor_power();
#endif
} }
#if ENABLED(EEPROM_SETTINGS) #if ENABLED(EEPROM_SETTINGS)
@ -626,6 +636,13 @@ void MarlinSettings::postprocess() {
EEPROM_WRITE(dummy); EEPROM_WRITE(dummy);
#endif #endif
#if HAS_MOTOR_CURRENT_PWM
for (uint8_t q = 3; q--;) EEPROM_WRITE(stepper.motor_current_setting[q]);
#else
const uint32_t dummyui32 = 0;
for (uint8_t q = 3; q--;) EEPROM_WRITE(dummyui32);
#endif
if (!eeprom_error) { if (!eeprom_error) {
const int eeprom_size = eeprom_index; const int eeprom_size = eeprom_index;
@ -979,6 +996,13 @@ void MarlinSettings::postprocess() {
EEPROM_READ(dummy); EEPROM_READ(dummy);
#endif #endif
#if HAS_MOTOR_CURRENT_PWM
for (uint8_t q = 3; q--;) EEPROM_READ(stepper.motor_current_setting[q]);
#else
uint32_t dummyui32;
for (uint8_t q = 3; q--;) EEPROM_READ(dummyui32);
#endif
if (working_crc == stored_crc) { if (working_crc == stored_crc) {
postprocess(); postprocess();
SERIAL_ECHO_START(); SERIAL_ECHO_START();
@ -1309,6 +1333,12 @@ void MarlinSettings::reset() {
planner.advance_ed_ratio = LIN_ADVANCE_E_D_RATIO; planner.advance_ed_ratio = LIN_ADVANCE_E_D_RATIO;
#endif #endif
#if HAS_MOTOR_CURRENT_PWM
uint32_t tmp_motor_current_setting[3] = PWM_MOTOR_CURRENT;
for (uint8_t q = 3; q--;)
stepper.digipot_current(q, (stepper.motor_current_setting[q] = tmp_motor_current_setting[q]));
#endif
#if ENABLED(AUTO_BED_LEVELING_UBL) #if ENABLED(AUTO_BED_LEVELING_UBL)
ubl.reset(); ubl.reset();
#endif #endif
@ -1788,6 +1818,18 @@ void MarlinSettings::reset() {
SERIAL_ECHOPAIR(" M900 K", planner.extruder_advance_k); SERIAL_ECHOPAIR(" M900 K", planner.extruder_advance_k);
SERIAL_ECHOLNPAIR(" R", planner.advance_ed_ratio); SERIAL_ECHOLNPAIR(" R", planner.advance_ed_ratio);
#endif #endif
#if HAS_MOTOR_CURRENT_PWM
CONFIG_ECHO_START;
if (!forReplay) {
SERIAL_ECHOLNPGM("Stepper motor currents:");
CONFIG_ECHO_START;
}
SERIAL_ECHOPAIR(" M907 X", stepper.motor_current_setting[0]);
SERIAL_ECHOPAIR(" Z", stepper.motor_current_setting[1]);
SERIAL_ECHOPAIR(" E", stepper.motor_current_setting[2]);
SERIAL_EOL();
#endif
} }
#endif // !DISABLE_M503 #endif // !DISABLE_M503

@ -85,7 +85,9 @@
#define MOTOR_CURRENT_PWM_Z_PIN 45 #define MOTOR_CURRENT_PWM_Z_PIN 45
#define MOTOR_CURRENT_PWM_E_PIN 44 #define MOTOR_CURRENT_PWM_E_PIN 44
// Motor current PWM conversion, PWM value = MotorCurrentSetting * 255 / range // Motor current PWM conversion, PWM value = MotorCurrentSetting * 255 / range
#define MOTOR_CURRENT_PWM_RANGE 2000 #ifndef MOTOR_CURRENT_PWM_RANGE
#define MOTOR_CURRENT_PWM_RANGE 2000
#endif
#define DEFAULT_PWM_MOTOR_CURRENT {1300, 1300, 1250} #define DEFAULT_PWM_MOTOR_CURRENT {1300, 1300, 1250}
// //

@ -74,7 +74,9 @@
#define MOTOR_CURRENT_PWM_Z_PIN 45 #define MOTOR_CURRENT_PWM_Z_PIN 45
#define MOTOR_CURRENT_PWM_E_PIN 46 #define MOTOR_CURRENT_PWM_E_PIN 46
// Motor current PWM conversion, PWM value = MotorCurrentSetting * 255 / range // Motor current PWM conversion, PWM value = MotorCurrentSetting * 255 / range
#define MOTOR_CURRENT_PWM_RANGE 2000 #ifndef MOTOR_CURRENT_PWM_RANGE
#define MOTOR_CURRENT_PWM_RANGE 2000
#endif
#define DEFAULT_PWM_MOTOR_CURRENT {1300, 1300, 1250} #define DEFAULT_PWM_MOTOR_CURRENT {1300, 1300, 1250}
// //

@ -72,10 +72,14 @@ block_t* Stepper::current_block = NULL; // A pointer to the block currently bei
bool Stepper::performing_homing = false; bool Stepper::performing_homing = false;
#endif #endif
#if HAS_MOTOR_CURRENT_PWM
uint32_t Stepper::motor_current_setting[3] = PWM_MOTOR_CURRENT;
#endif
// private: // private:
unsigned char Stepper::last_direction_bits = 0; // The next stepping-bits to be output uint8_t Stepper::last_direction_bits = 0; // The next stepping-bits to be output
unsigned int Stepper::cleaning_buffer_counter = 0; uint16_t Stepper::cleaning_buffer_counter = 0;
#if ENABLED(Z_DUAL_ENDSTOPS) #if ENABLED(Z_DUAL_ENDSTOPS)
bool Stepper::locked_z_motor = false; bool Stepper::locked_z_motor = false;
@ -1447,62 +1451,98 @@ void Stepper::report_positions() {
#if HAS_DIGIPOTSS #if HAS_DIGIPOTSS
// From Arduino DigitalPotControl example // From Arduino DigitalPotControl example
void Stepper::digitalPotWrite(int address, int value) { void Stepper::digitalPotWrite(const int16_t address, const int16_t value) {
WRITE(DIGIPOTSS_PIN, LOW); // take the SS pin low to select the chip WRITE(DIGIPOTSS_PIN, LOW); // Take the SS pin low to select the chip
SPI.transfer(address); // send in the address and value via SPI: SPI.transfer(address); // Send the address and value via SPI
SPI.transfer(value); SPI.transfer(value);
WRITE(DIGIPOTSS_PIN, HIGH); // take the SS pin high to de-select the chip: WRITE(DIGIPOTSS_PIN, HIGH); // Take the SS pin high to de-select the chip
//delay(10); //delay(10);
} }
#endif // HAS_DIGIPOTSS #endif // HAS_DIGIPOTSS
#if HAS_MOTOR_CURRENT_PWM
void Stepper::refresh_motor_power() {
for (uint8_t i = 0; i < COUNT(motor_current_setting); ++i) {
switch (i) {
#if PIN_EXISTS(MOTOR_CURRENT_PWM_XY)
case 0:
#endif
#if PIN_EXISTS(MOTOR_CURRENT_PWM_Z)
case 1:
#endif
#if PIN_EXISTS(MOTOR_CURRENT_PWM_E)
case 2:
#endif
digipot_current(i, motor_current_setting[i]);
default: break;
}
}
}
#endif // HAS_MOTOR_CURRENT_PWM
#if HAS_DIGIPOTSS || HAS_MOTOR_CURRENT_PWM #if HAS_DIGIPOTSS || HAS_MOTOR_CURRENT_PWM
void Stepper::digipot_current(const uint8_t driver, const int current) {
#if HAS_DIGIPOTSS
const uint8_t digipot_ch[] = DIGIPOT_CHANNELS;
digitalPotWrite(digipot_ch[driver], current);
#elif HAS_MOTOR_CURRENT_PWM
if (WITHIN(driver, 0, 2))
motor_current_setting[driver] = current; // update motor_current_setting
#define _WRITE_CURRENT_PWM(P) analogWrite(MOTOR_CURRENT_PWM_## P ##_PIN, 255L * current / (MOTOR_CURRENT_PWM_RANGE))
switch (driver) {
#if PIN_EXISTS(MOTOR_CURRENT_PWM_XY)
case 0: _WRITE_CURRENT_PWM(XY); break;
#endif
#if PIN_EXISTS(MOTOR_CURRENT_PWM_Z)
case 1: _WRITE_CURRENT_PWM(Z); break;
#endif
#if PIN_EXISTS(MOTOR_CURRENT_PWM_E)
case 2: _WRITE_CURRENT_PWM(E); break;
#endif
}
#endif
}
void Stepper::digipot_init() { void Stepper::digipot_init() {
#if HAS_DIGIPOTSS #if HAS_DIGIPOTSS
static const uint8_t digipot_motor_current[] = DIGIPOT_MOTOR_CURRENT; static const uint8_t digipot_motor_current[] = DIGIPOT_MOTOR_CURRENT;
SPI.begin(); SPI.begin();
SET_OUTPUT(DIGIPOTSS_PIN); SET_OUTPUT(DIGIPOTSS_PIN);
for (uint8_t i = 0; i < COUNT(digipot_motor_current); i++) { for (uint8_t i = 0; i < COUNT(digipot_motor_current); i++) {
//digitalPotWrite(digipot_ch[i], digipot_motor_current[i]); //digitalPotWrite(digipot_ch[i], digipot_motor_current[i]);
digipot_current(i, digipot_motor_current[i]); digipot_current(i, digipot_motor_current[i]);
} }
#elif HAS_MOTOR_CURRENT_PWM #elif HAS_MOTOR_CURRENT_PWM
#if PIN_EXISTS(MOTOR_CURRENT_PWM_XY) #if PIN_EXISTS(MOTOR_CURRENT_PWM_XY)
SET_OUTPUT(MOTOR_CURRENT_PWM_XY_PIN); SET_OUTPUT(MOTOR_CURRENT_PWM_XY_PIN);
digipot_current(0, motor_current_setting[0]);
#endif #endif
#if PIN_EXISTS(MOTOR_CURRENT_PWM_Z) #if PIN_EXISTS(MOTOR_CURRENT_PWM_Z)
SET_OUTPUT(MOTOR_CURRENT_PWM_Z_PIN); SET_OUTPUT(MOTOR_CURRENT_PWM_Z_PIN);
digipot_current(1, motor_current_setting[1]);
#endif #endif
#if PIN_EXISTS(MOTOR_CURRENT_PWM_E) #if PIN_EXISTS(MOTOR_CURRENT_PWM_E)
SET_OUTPUT(MOTOR_CURRENT_PWM_E_PIN); SET_OUTPUT(MOTOR_CURRENT_PWM_E_PIN);
digipot_current(2, motor_current_setting[2]);
#endif
//Set timer5 to 31khz so the PWM of the motor power is as constant as possible. (removes a buzzing noise)
TCCR5B = (TCCR5B & ~(_BV(CS50) | _BV(CS51) | _BV(CS52))) | _BV(CS50);
#endif #endif
}
void Stepper::digipot_current(uint8_t driver, int current) { refresh_motor_power();
#if HAS_DIGIPOTSS
const uint8_t digipot_ch[] = DIGIPOT_CHANNELS; // Set Timer5 to 31khz so the PWM of the motor power is as constant as possible. (removes a buzzing noise)
digitalPotWrite(digipot_ch[driver], current); SET_CS5(PRESCALER_1);
#elif HAS_MOTOR_CURRENT_PWM
#define _WRITE_CURRENT_PWM(P) analogWrite(P, 255L * current / (MOTOR_CURRENT_PWM_RANGE))
switch (driver) {
#if PIN_EXISTS(MOTOR_CURRENT_PWM_XY)
case 0: _WRITE_CURRENT_PWM(MOTOR_CURRENT_PWM_XY_PIN); break;
#endif
#if PIN_EXISTS(MOTOR_CURRENT_PWM_Z)
case 1: _WRITE_CURRENT_PWM(MOTOR_CURRENT_PWM_Z_PIN); break;
#endif
#if PIN_EXISTS(MOTOR_CURRENT_PWM_E)
case 2: _WRITE_CURRENT_PWM(MOTOR_CURRENT_PWM_E_PIN); break;
#endif
}
#endif #endif
} }
@ -1550,7 +1590,7 @@ void Stepper::report_positions() {
microstep_mode(i, microstep_modes[i]); microstep_mode(i, microstep_modes[i]);
} }
void Stepper::microstep_ms(uint8_t driver, int8_t ms1, int8_t ms2) { void Stepper::microstep_ms(const uint8_t driver, const int8_t ms1, const int8_t ms2) {
if (ms1 >= 0) switch (driver) { if (ms1 >= 0) switch (driver) {
case 0: WRITE(X_MS1_PIN, ms1); break; case 0: WRITE(X_MS1_PIN, ms1); break;
#if HAS_Y_MICROSTEPS #if HAS_Y_MICROSTEPS
@ -1601,7 +1641,7 @@ void Stepper::report_positions() {
} }
} }
void Stepper::microstep_mode(uint8_t driver, uint8_t stepping_mode) { void Stepper::microstep_mode(const uint8_t driver, const uint8_t stepping_mode) {
switch (stepping_mode) { switch (stepping_mode) {
case 1: microstep_ms(driver, MICROSTEP1); break; case 1: microstep_ms(driver, MICROSTEP1); break;
case 2: microstep_ms(driver, MICROSTEP2); break; case 2: microstep_ms(driver, MICROSTEP2); break;

@ -91,10 +91,17 @@ class Stepper {
static bool performing_homing; static bool performing_homing;
#endif #endif
#if HAS_MOTOR_CURRENT_PWM
#ifndef PWM_MOTOR_CURRENT
#define PWM_MOTOR_CURRENT DEFAULT_PWM_MOTOR_CURRENT
#endif
static uint32_t motor_current_setting[3];
#endif
private: private:
static unsigned char last_direction_bits; // The next stepping-bits to be output static uint8_t last_direction_bits; // The next stepping-bits to be output
static unsigned int cleaning_buffer_counter; static uint16_t cleaning_buffer_counter;
#if ENABLED(Z_DUAL_ENDSTOPS) #if ENABLED(Z_DUAL_ENDSTOPS)
static bool locked_z_motor, locked_z2_motor; static bool locked_z_motor, locked_z2_motor;
@ -132,13 +139,6 @@ class Stepper {
static volatile long endstops_trigsteps[XYZ]; static volatile long endstops_trigsteps[XYZ];
static volatile long endstops_stepsTotal, endstops_stepsDone; static volatile long endstops_stepsTotal, endstops_stepsDone;
#if HAS_MOTOR_CURRENT_PWM
#ifndef PWM_MOTOR_CURRENT
#define PWM_MOTOR_CURRENT DEFAULT_PWM_MOTOR_CURRENT
#endif
static constexpr int motor_current_setting[3] = PWM_MOTOR_CURRENT;
#endif
// //
// Positions of stepper motors, in step units // Positions of stepper motors, in step units
// //
@ -243,20 +243,20 @@ class Stepper {
static FORCE_INLINE bool motor_direction(AxisEnum axis) { return TEST(last_direction_bits, axis); } static FORCE_INLINE bool motor_direction(AxisEnum axis) { return TEST(last_direction_bits, axis); }
#if HAS_DIGIPOTSS || HAS_MOTOR_CURRENT_PWM #if HAS_DIGIPOTSS || HAS_MOTOR_CURRENT_PWM
static void digitalPotWrite(int address, int value); static void digitalPotWrite(const int16_t address, const int16_t value);
static void digipot_current(uint8_t driver, int current); static void digipot_current(const uint8_t driver, const int16_t current);
#endif #endif
#if HAS_MICROSTEPS #if HAS_MICROSTEPS
static void microstep_ms(uint8_t driver, int8_t ms1, int8_t ms2); static void microstep_ms(const uint8_t driver, const int8_t ms1, const int8_t ms2);
static void microstep_mode(uint8_t driver, uint8_t stepping); static void microstep_mode(const uint8_t driver, const uint8_t stepping);
static void microstep_readings(); static void microstep_readings();
#endif #endif
#if ENABLED(Z_DUAL_ENDSTOPS) #if ENABLED(Z_DUAL_ENDSTOPS)
static FORCE_INLINE void set_homing_flag(bool state) { performing_homing = state; } static FORCE_INLINE void set_homing_flag(const bool state) { performing_homing = state; }
static FORCE_INLINE void set_z_lock(bool state) { locked_z_motor = state; } static FORCE_INLINE void set_z_lock(const bool state) { locked_z_motor = state; }
static FORCE_INLINE void set_z2_lock(bool state) { locked_z2_motor = state; } static FORCE_INLINE void set_z2_lock(const bool state) { locked_z2_motor = state; }
#endif #endif
#if ENABLED(BABYSTEPPING) #if ENABLED(BABYSTEPPING)
@ -279,6 +279,10 @@ class Stepper {
return endstops_trigsteps[axis] * planner.steps_to_mm[axis]; return endstops_trigsteps[axis] * planner.steps_to_mm[axis];
} }
#if HAS_MOTOR_CURRENT_PWM
static void refresh_motor_power();
#endif
private: private:
static FORCE_INLINE unsigned short calc_timer(unsigned short step_rate) { static FORCE_INLINE unsigned short calc_timer(unsigned short step_rate) {
@ -380,7 +384,9 @@ class Stepper {
// SERIAL_ECHOLN(current_block->final_advance/256.0); // SERIAL_ECHOLN(current_block->final_advance/256.0);
} }
#if HAS_DIGIPOTSS || HAS_MOTOR_CURRENT_PWM
static void digipot_init(); static void digipot_init();
#endif
#if HAS_MICROSTEPS #if HAS_MICROSTEPS
static void microstep_init(); static void microstep_init();

@ -1249,6 +1249,7 @@ void kill_screen(const char* lcd_msg) {
* *
*/ */
#if ENABLED(DAC_STEPPER_CURRENT) #if ENABLED(DAC_STEPPER_CURRENT)
void dac_driver_getValues() { LOOP_XYZE(i) driverPercent[i] = dac_current_get_percent((AxisEnum)i); } void dac_driver_getValues() { LOOP_XYZE(i) driverPercent[i] = dac_current_get_percent((AxisEnum)i); }
void dac_driver_commit() { dac_current_set_percents(driverPercent); } void dac_driver_commit() { dac_current_set_percents(driverPercent); }
@ -1266,7 +1267,27 @@ void kill_screen(const char* lcd_msg) {
MENU_ITEM(function, MSG_DAC_EEPROM_WRITE, dac_driver_eeprom_write); MENU_ITEM(function, MSG_DAC_EEPROM_WRITE, dac_driver_eeprom_write);
END_MENU(); END_MENU();
} }
#endif // DAC_STEPPER_CURRENT
#if HAS_MOTOR_CURRENT_PWM
void lcd_pwm_menu() {
START_MENU();
MENU_BACK(MSG_CONTROL);
#if PIN_EXISTS(MOTOR_CURRENT_PWM_XY)
MENU_ITEM_EDIT_CALLBACK(long5, MSG_X MSG_Y, &stepper.motor_current_setting[0], 100, 2000, Stepper::refresh_motor_power);
#endif #endif
#if PIN_EXISTS(MOTOR_CURRENT_PWM_Z)
MENU_ITEM_EDIT_CALLBACK(long5, MSG_Z, &stepper.motor_current_setting[1], 100, 2000, Stepper::refresh_motor_power);
#endif
#if PIN_EXISTS(MOTOR_CURRENT_PWM_E)
MENU_ITEM_EDIT_CALLBACK(long5, MSG_E, &stepper.motor_current_setting[2], 100, 2000, Stepper::refresh_motor_power);
#endif
END_MENU();
}
#endif // HAS_MOTOR_CURRENT_PWM
constexpr int16_t heater_maxtemp[HOTENDS] = ARRAY_BY_HOTENDS(HEATER_0_MAXTEMP, HEATER_1_MAXTEMP, HEATER_2_MAXTEMP, HEATER_3_MAXTEMP, HEATER_4_MAXTEMP); constexpr int16_t heater_maxtemp[HOTENDS] = ARRAY_BY_HOTENDS(HEATER_0_MAXTEMP, HEATER_1_MAXTEMP, HEATER_2_MAXTEMP, HEATER_3_MAXTEMP, HEATER_4_MAXTEMP);
@ -2894,6 +2915,9 @@ void kill_screen(const char* lcd_msg) {
#if ENABLED(DAC_STEPPER_CURRENT) #if ENABLED(DAC_STEPPER_CURRENT)
MENU_ITEM(submenu, MSG_DRIVE_STRENGTH, lcd_dac_menu); MENU_ITEM(submenu, MSG_DRIVE_STRENGTH, lcd_dac_menu);
#endif #endif
#if HAS_MOTOR_CURRENT_PWM
MENU_ITEM(submenu, MSG_DRIVE_STRENGTH, lcd_pwm_menu);
#endif
#if ENABLED(BLTOUCH) #if ENABLED(BLTOUCH)
MENU_ITEM(submenu, MSG_BLTOUCH, bltouch_menu); MENU_ITEM(submenu, MSG_BLTOUCH, bltouch_menu);

Loading…
Cancel
Save