Option to use raw digipot values (#17536)

This commit is contained in:
grauerfuchs 2020-04-18 23:56:23 -04:00 committed by GitHub
parent 8e8ba46cb6
commit 4a5a3d27ed
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
13 changed files with 89 additions and 84 deletions

View file

@ -926,9 +926,20 @@
//#define DIGIPOT_MOTOR_CURRENT { 135,135,135,135,135 } // Values 0-255 (RAMBO 135 = ~0.75A, 185 = ~1A) //#define DIGIPOT_MOTOR_CURRENT { 135,135,135,135,135 } // Values 0-255 (RAMBO 135 = ~0.75A, 185 = ~1A)
//#define DAC_MOTOR_CURRENT_DEFAULT { 70, 80, 90, 80 } // Default drive percent - X, Y, Z, E axis //#define DAC_MOTOR_CURRENT_DEFAULT { 70, 80, 90, 80 } // Default drive percent - X, Y, Z, E axis
// Use an I2C based DIGIPOT (e.g., Azteeg X3 Pro) /**
//#define DIGIPOT_I2C * I2C-based DIGIPOTs (e.g., Azteeg X3 Pro)
#if ENABLED(DIGIPOT_I2C) && !defined(DIGIPOT_I2C_ADDRESS_A) */
//#define DIGIPOT_MCP4018 // Requires https://github.com/stawel/SlowSoftI2CMaster
//#define DIGIPOT_MCP4451
#if EITHER(DIGIPOT_MCP4018, DIGIPOT_MCP4451)
#define DIGIPOT_I2C_NUM_CHANNELS 8 // 5DPRINT:4 AZTEEG_X3_PRO:8 MKS_SBASE:5 MIGHTYBOARD_REVE:5
// Actual motor currents in Amps. The number of entries must match DIGIPOT_I2C_NUM_CHANNELS.
// These correspond to the physical drivers, so be mindful if the order is changed.
#define DIGIPOT_I2C_MOTOR_CURRENTS { 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0 } // AZTEEG_X3_PRO
//#define DIGIPOT_USE_RAW_VALUES // Use DIGIPOT_MOTOR_CURRENT raw wiper values (instead of A4988 motor currents)
/** /**
* Common slave addresses: * Common slave addresses:
* *
@ -943,12 +954,6 @@
#define DIGIPOT_I2C_ADDRESS_B 0x2D // unshifted slave address for second DIGIPOT #define DIGIPOT_I2C_ADDRESS_B 0x2D // unshifted slave address for second DIGIPOT
#endif #endif
//#define DIGIPOT_MCP4018 // Requires library from https://github.com/stawel/SlowSoftI2CMaster
#define DIGIPOT_I2C_NUM_CHANNELS 8 // 5DPRINT: 4 AZTEEG_X3_PRO: 8 MKS SBASE: 5
// Actual motor currents in Amps. The number of entries must match DIGIPOT_I2C_NUM_CHANNELS.
// These correspond to the physical drivers, so be mindful if the order is changed.
#define DIGIPOT_I2C_MOTOR_CURRENTS { 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0 } // AZTEEG_X3_PRO
//=========================================================================== //===========================================================================
//=============================Additional Features=========================== //=============================Additional Features===========================
//=========================================================================== //===========================================================================

View file

@ -25,16 +25,6 @@
* Test AVR-specific configuration values for errors at compile-time. * Test AVR-specific configuration values for errors at compile-time.
*/ */
/**
* Digipot requirement
*/
#if ENABLED(DIGIPOT_MCP4018)
#if !defined(DIGIPOTS_I2C_SDA_X) || !defined(DIGIPOTS_I2C_SDA_Y) || !defined(DIGIPOTS_I2C_SDA_Z) \
|| !defined(DIGIPOTS_I2C_SDA_E0) || !defined(DIGIPOTS_I2C_SDA_E1)
#error "DIGIPOT_MCP4018 requires DIGIPOTS_I2C_SDA_* pins to be defined."
#endif
#endif
/** /**
* Checks for FAST PWM * Checks for FAST PWM
*/ */

View file

@ -174,7 +174,7 @@ static_assert(DISABLED(BAUD_RATE_GCODE), "BAUD_RATE_GCODE is not yet supported o
// //
// Flag any i2c pin conflicts // Flag any i2c pin conflicts
// //
#if ANY(DIGIPOT_I2C, DIGIPOT_MCP4018, DAC_STEPPER_CURRENT, EXPERIMENTAL_I2CBUS, I2C_POSITION_ENCODERS, PCA9632, I2C_EEPROM) #if ANY(HAS_I2C_DIGIPOT, DAC_STEPPER_CURRENT, EXPERIMENTAL_I2CBUS, I2C_POSITION_ENCODERS, PCA9632, I2C_EEPROM)
#define USEDI2CDEV_M 1 // <Arduino>/Wire.cpp #define USEDI2CDEV_M 1 // <Arduino>/Wire.cpp
#if USEDI2CDEV_M == 0 // P0_27 [D57] (AUX-1) .......... P0_28 [D58] (AUX-1) #if USEDI2CDEV_M == 0 // P0_27 [D57] (AUX-1) .......... P0_28 [D58] (AUX-1)

View file

@ -70,7 +70,7 @@
#include "libs/buzzer.h" #include "libs/buzzer.h"
#endif #endif
#if ENABLED(DIGIPOT_I2C) #if HAS_I2C_DIGIPOT
#include "feature/digipot/digipot.h" #include "feature/digipot/digipot.h"
#endif #endif
@ -1070,7 +1070,7 @@ void setup() {
SETUP_RUN(enableStepperDrivers()); SETUP_RUN(enableStepperDrivers());
#endif #endif
#if ENABLED(DIGIPOT_I2C) #if HAS_I2C_DIGIPOT
SETUP_RUN(digipot_i2c_init()); SETUP_RUN(digipot_i2c_init());
#endif #endif

View file

@ -22,53 +22,46 @@
#include "../../inc/MarlinConfig.h" #include "../../inc/MarlinConfig.h"
#if BOTH(DIGIPOT_I2C, DIGIPOT_MCP4018) #if ENABLED(DIGIPOT_MCP4018)
#include <Stream.h> #include <Stream.h>
#include <SlowSoftI2CMaster.h> //https://github.com/stawel/SlowSoftI2CMaster #include <SlowSoftI2CMaster.h> // https://github.com/stawel/SlowSoftI2CMaster
// Settings for the I2C based DIGIPOT (MCP4018) based on WT150 // Settings for the I2C based DIGIPOT (MCP4018) based on WT150
#define DIGIPOT_A4988_Rsx 0.250 #define DIGIPOT_A4988_Rsx 0.250
#define DIGIPOT_A4988_Vrefmax 1.666 #define DIGIPOT_A4988_Vrefmax 1.666
#define DIGIPOT_A4988_MAX_VALUE 127 #define DIGIPOT_MCP4018_MAX_VALUE 127
#define DIGIPOT_A4988_Itripmax(Vref) ((Vref)/(8.0*DIGIPOT_A4988_Rsx)) #define DIGIPOT_A4988_Itripmax(Vref) ((Vref) / (8.0 * DIGIPOT_A4988_Rsx))
#define DIGIPOT_A4988_FACTOR ((DIGIPOT_A4988_MAX_VALUE)/DIGIPOT_A4988_Itripmax(DIGIPOT_A4988_Vrefmax)) #define DIGIPOT_A4988_FACTOR ((DIGIPOT_MCP4018_MAX_VALUE) / DIGIPOT_A4988_Itripmax(DIGIPOT_A4988_Vrefmax))
#define DIGIPOT_A4988_MAX_CURRENT 2.0 #define DIGIPOT_A4988_MAX_CURRENT 2.0
static byte current_to_wiper(const float current) { static byte current_to_wiper(const float current) {
const int16_t value = ceil(float(DIGIPOT_A4988_FACTOR) * current); const int16_t value = TERN(DIGIPOT_USE_RAW_VALUES, current, CEIL(current * DIGIPOT_A4988_FACTOR));
return byte(constrain(value, 0, DIGIPOT_A4988_MAX_VALUE)); return byte(constrain(value, 0, DIGIPOT_MCP4018_MAX_VALUE));
} }
const uint8_t sda_pins[DIGIPOT_I2C_NUM_CHANNELS] = {
DIGIPOTS_I2C_SDA_X
#if DIGIPOT_I2C_NUM_CHANNELS > 1
, DIGIPOTS_I2C_SDA_Y
#if DIGIPOT_I2C_NUM_CHANNELS > 2
, DIGIPOTS_I2C_SDA_Z
#if DIGIPOT_I2C_NUM_CHANNELS > 3
, DIGIPOTS_I2C_SDA_E0
#if DIGIPOT_I2C_NUM_CHANNELS > 4
, DIGIPOTS_I2C_SDA_E1
#endif
#endif
#endif
#endif
};
static SlowSoftI2CMaster pots[DIGIPOT_I2C_NUM_CHANNELS] = { static SlowSoftI2CMaster pots[DIGIPOT_I2C_NUM_CHANNELS] = {
SlowSoftI2CMaster { sda_pins[X_AXIS], DIGIPOTS_I2C_SCL } SlowSoftI2CMaster(DIGIPOTS_I2C_SDA_X, DIGIPOTS_I2C_SCL)
#if DIGIPOT_I2C_NUM_CHANNELS > 1 #if DIGIPOT_I2C_NUM_CHANNELS > 1
, SlowSoftI2CMaster { sda_pins[Y_AXIS], DIGIPOTS_I2C_SCL } , SlowSoftI2CMaster(DIGIPOTS_I2C_SDA_Y, DIGIPOTS_I2C_SCL)
#if DIGIPOT_I2C_NUM_CHANNELS > 2 #if DIGIPOT_I2C_NUM_CHANNELS > 2
, SlowSoftI2CMaster { sda_pins[Z_AXIS], DIGIPOTS_I2C_SCL } , SlowSoftI2CMaster(DIGIPOTS_I2C_SDA_Z, DIGIPOTS_I2C_SCL)
#if DIGIPOT_I2C_NUM_CHANNELS > 3 #if DIGIPOT_I2C_NUM_CHANNELS > 3
, SlowSoftI2CMaster { sda_pins[E_AXIS], DIGIPOTS_I2C_SCL } , SlowSoftI2CMaster(DIGIPOTS_I2C_SDA_E0, DIGIPOTS_I2C_SCL)
#if DIGIPOT_I2C_NUM_CHANNELS > 4 #if DIGIPOT_I2C_NUM_CHANNELS > 4
, SlowSoftI2CMaster { sda_pins[E_AXIS + 1], DIGIPOTS_I2C_SCL } , SlowSoftI2CMaster(DIGIPOTS_I2C_SDA_E1, DIGIPOTS_I2C_SCL)
#if DIGIPOT_I2C_NUM_CHANNELS > 5
, SlowSoftI2CMaster(DIGIPOTS_I2C_SDA_E2, DIGIPOTS_I2C_SCL)
#if DIGIPOT_I2C_NUM_CHANNELS > 6
, SlowSoftI2CMaster(DIGIPOTS_I2C_SDA_E3, DIGIPOTS_I2C_SCL)
#if DIGIPOT_I2C_NUM_CHANNELS > 7
, SlowSoftI2CMaster(DIGIPOTS_I2C_SDA_E4, DIGIPOTS_I2C_SCL)
#endif
#endif
#endif
#endif #endif
#endif #endif
#endif #endif
@ -85,18 +78,23 @@ static void i2c_send(const uint8_t channel, const byte v) {
// This is for the MCP4018 I2C based digipot // This is for the MCP4018 I2C based digipot
void digipot_i2c_set_current(const uint8_t channel, const float current) { void digipot_i2c_set_current(const uint8_t channel, const float current) {
i2c_send(channel, current_to_wiper(_MIN(_MAX(current, 0), float(DIGIPOT_A4988_MAX_CURRENT)))); const float ival = _MIN(_MAX(current, 0), float(DIGIPOT_MCP4018_MAX_VALUE));
i2c_send(channel, current_to_wiper(ival));
} }
void digipot_i2c_init() { void digipot_i2c_init() {
static const float digipot_motor_current[] PROGMEM = DIGIPOT_I2C_MOTOR_CURRENTS; LOOP_L_N(i, DIGIPOT_I2C_NUM_CHANNELS) pots[i].i2c_init();
LOOP_L_N(i, DIGIPOT_I2C_NUM_CHANNELS) // Init currents according to Configuration_adv.h
pots[i].i2c_init(); static const float digipot_motor_current[] PROGMEM =
#if ENABLED(DIGIPOT_USE_RAW_VALUES)
// setup initial currents as defined in Configuration_adv.h DIGIPOT_MOTOR_CURRENT
#else
DIGIPOT_I2C_MOTOR_CURRENTS
#endif
;
LOOP_L_N(i, COUNT(digipot_motor_current)) LOOP_L_N(i, COUNT(digipot_motor_current))
digipot_i2c_set_current(i, pgm_read_float(&digipot_motor_current[i])); digipot_i2c_set_current(i, pgm_read_float(&digipot_motor_current[i]));
} }
#endif // DIGIPOT_I2C && DIGIPOT_MCP4018 #endif // DIGIPOT_MCP4018

View file

@ -22,7 +22,7 @@
#include "../../inc/MarlinConfig.h" #include "../../inc/MarlinConfig.h"
#if ENABLED(DIGIPOT_I2C) && DISABLED(DIGIPOT_MCP4018) #if ENABLED(DIGIPOT_MCP4451)
#include <Stream.h> #include <Stream.h>
#include <Wire.h> #include <Wire.h>
@ -33,18 +33,18 @@
// Settings for the I2C based DIGIPOT (MCP4451) on Azteeg X3 Pro // Settings for the I2C based DIGIPOT (MCP4451) on Azteeg X3 Pro
#if MB(5DPRINT) #if MB(5DPRINT)
#define DIGIPOT_I2C_FACTOR 117.96 #define DIGIPOT_I2C_FACTOR 117.96f
#define DIGIPOT_I2C_MAX_CURRENT 1.736 #define DIGIPOT_I2C_MAX_CURRENT 1.736f
#elif MB(AZTEEG_X5_MINI, AZTEEG_X5_MINI_WIFI) #elif MB(AZTEEG_X5_MINI, AZTEEG_X5_MINI_WIFI)
#define DIGIPOT_I2C_FACTOR 113.5 #define DIGIPOT_I2C_FACTOR 113.5f
#define DIGIPOT_I2C_MAX_CURRENT 2.0 #define DIGIPOT_I2C_MAX_CURRENT 2.0f
#else #else
#define DIGIPOT_I2C_FACTOR 106.7 #define DIGIPOT_I2C_FACTOR 106.7f
#define DIGIPOT_I2C_MAX_CURRENT 2.5 #define DIGIPOT_I2C_MAX_CURRENT 2.5f
#endif #endif
static byte current_to_wiper(const float current) { static byte current_to_wiper(const float current) {
return byte(CEIL(float((DIGIPOT_I2C_FACTOR * current)))); return byte(TERN(DIGIPOT_USE_RAW_VALUES, current, CEIL(DIGIPOT_I2C_FACTOR * current)));
} }
static void digipot_i2c_send(const byte addr, const byte a, const byte b) { static void digipot_i2c_send(const byte addr, const byte a, const byte b) {
@ -62,8 +62,8 @@ static void digipot_i2c_send(const byte addr, const byte a, const byte b) {
// This is for the MCP4451 I2C based digipot // This is for the MCP4451 I2C based digipot
void digipot_i2c_set_current(const uint8_t channel, const float current) { void digipot_i2c_set_current(const uint8_t channel, const float current) {
// these addresses are specific to Azteeg X3 Pro, can be set to others, // These addresses are specific to Azteeg X3 Pro, can be set to others.
// In this case first digipot is at address A0=0, A1= 0, second one is at A0=0, A1= 1 // In this case first digipot is at address A0=0, A1=0, second one is at A0=0, A1=1
const byte addr = channel < 4 ? DIGIPOT_I2C_ADDRESS_A : DIGIPOT_I2C_ADDRESS_B; // channel 0-3 vs 4-7 const byte addr = channel < 4 ? DIGIPOT_I2C_ADDRESS_A : DIGIPOT_I2C_ADDRESS_B; // channel 0-3 vs 4-7
// Initial setup // Initial setup
@ -77,14 +77,14 @@ void digipot_i2c_set_current(const uint8_t channel, const float current) {
void digipot_i2c_init() { void digipot_i2c_init() {
#if MB(MKS_SBASE) #if MB(MKS_SBASE)
configure_i2c(16); // Setting clock_option to 16 ensure the I2C bus is initialized at 400kHz configure_i2c(16); // Set clock_option to 16 ensure I2C is initialized at 400kHz
#else #else
Wire.begin(); Wire.begin();
#endif #endif
// setup initial currents as defined in Configuration_adv.h // Set up initial currents as defined in Configuration_adv.h
static const float digipot_motor_current[] PROGMEM = DIGIPOT_I2C_MOTOR_CURRENTS; static const float digipot_motor_current[] PROGMEM = TERN(DIGIPOT_USE_RAW_VALUES, DIGIPOT_MOTOR_CURRENT, DIGIPOT_I2C_MOTOR_CURRENTS);
LOOP_L_N(i, COUNT(digipot_motor_current)) LOOP_L_N(i, COUNT(digipot_motor_current))
digipot_i2c_set_current(i, pgm_read_float(&digipot_motor_current[i])); digipot_i2c_set_current(i, pgm_read_float(&digipot_motor_current[i]));
} }
#endif // DIGIPOT_I2C #endif // DIGIPOT_MCP4451

View file

@ -22,7 +22,7 @@
#include "../../../inc/MarlinConfig.h" #include "../../../inc/MarlinConfig.h"
#if HAS_DIGIPOTSS || HAS_MOTOR_CURRENT_PWM || EITHER(DIGIPOT_I2C, DAC_STEPPER_CURRENT) #if HAS_DIGIPOTSS || HAS_MOTOR_CURRENT_PWM || HAS_I2C_DIGIPOT || ENABLED(DAC_STEPPER_CURRENT)
#include "../../gcode.h" #include "../../gcode.h"
@ -30,7 +30,7 @@
#include "../../../module/stepper.h" #include "../../../module/stepper.h"
#endif #endif
#if ENABLED(DIGIPOT_I2C) #if HAS_I2C_DIGIPOT
#include "../../../feature/digipot/digipot.h" #include "../../../feature/digipot/digipot.h"
#endif #endif
@ -62,7 +62,7 @@ void GcodeSuite::M907() {
#endif #endif
#if ENABLED(DIGIPOT_I2C) #if HAS_I2C_DIGIPOT
// this one uses actual amps in floating point // this one uses actual amps in floating point
LOOP_XYZE(i) if (parser.seenval(axis_codes[i])) digipot_i2c_set_current(i, parser.value_float()); LOOP_XYZE(i) if (parser.seenval(axis_codes[i])) digipot_i2c_set_current(i, parser.value_float());
// Additional extruders use B,C,D for channels 4,5,6. // Additional extruders use B,C,D for channels 4,5,6.
@ -103,4 +103,4 @@ void GcodeSuite::M907() {
#endif // DAC_STEPPER_CURRENT #endif // DAC_STEPPER_CURRENT
#endif // HAS_DIGIPOTSS || DAC_STEPPER_CURRENT || HAS_MOTOR_CURRENT_PWM || DIGIPOT_I2C #endif // HAS_DIGIPOTSS || HAS_MOTOR_CURRENT_PWM || HAS_I2C_DIGIPOT || DAC_STEPPER_CURRENT

View file

@ -794,7 +794,7 @@ void GcodeSuite::process_parsed_command(const bool no_ok/*=false*/) {
case 900: M900(); break; // M900: Set advance K factor. case 900: M900(); break; // M900: Set advance K factor.
#endif #endif
#if HAS_DIGIPOTSS || HAS_MOTOR_CURRENT_PWM || EITHER(DIGIPOT_I2C, DAC_STEPPER_CURRENT) #if HAS_DIGIPOTSS || HAS_MOTOR_CURRENT_PWM || HAS_I2C_DIGIPOT || ENABLED(DAC_STEPPER_CURRENT)
case 907: M907(); break; // M907: Set digital trimpot motor current using axis codes. case 907: M907(); break; // M907: Set digital trimpot motor current using axis codes.
#if HAS_DIGIPOTSS || ENABLED(DAC_STEPPER_CURRENT) #if HAS_DIGIPOTSS || ENABLED(DAC_STEPPER_CURRENT)
case 908: M908(); break; // M908: Control digital trimpot directly. case 908: M908(); break; // M908: Control digital trimpot directly.

View file

@ -938,7 +938,7 @@ private:
static void M918(); static void M918();
#endif #endif
#if HAS_DIGIPOTSS || HAS_MOTOR_CURRENT_PWM || EITHER(DIGIPOT_I2C, DAC_STEPPER_CURRENT) #if HAS_DIGIPOTSS || HAS_MOTOR_CURRENT_PWM || HAS_I2C_DIGIPOT || ENABLED(DAC_STEPPER_CURRENT)
static void M907(); static void M907();
#if HAS_DIGIPOTSS || ENABLED(DAC_STEPPER_CURRENT) #if HAS_DIGIPOTSS || ENABLED(DAC_STEPPER_CURRENT)
static void M908(); static void M908();

View file

@ -113,6 +113,10 @@
#define HAS_LEDS_OFF_FLAG 1 #define HAS_LEDS_OFF_FLAG 1
#endif #endif
#if EITHER(DIGIPOT_MCP4018, DIGIPOT_MCP4451)
#define HAS_I2C_DIGIPOT 1
#endif
// Multiple Z steppers // Multiple Z steppers
#ifndef NUM_Z_STEPPER_DRIVERS #ifndef NUM_Z_STEPPER_DRIVERS
#define NUM_Z_STEPPER_DRIVERS 1 #define NUM_Z_STEPPER_DRIVERS 1

View file

@ -497,6 +497,8 @@
#error "HOMING_BACKOFF_MM is now HOMING_BACKOFF_POST_MM. Please update Configuration_adv.h." #error "HOMING_BACKOFF_MM is now HOMING_BACKOFF_POST_MM. Please update Configuration_adv.h."
#elif defined(X_HOME_BUMP_MM) || defined(Y_HOME_BUMP_MM) || defined(Z_HOME_BUMP_MM) #elif defined(X_HOME_BUMP_MM) || defined(Y_HOME_BUMP_MM) || defined(Z_HOME_BUMP_MM)
#error "[XYZ]_HOME_BUMP_MM is now HOMING_BUMP_MM. Please update Configuration_adv.h." #error "[XYZ]_HOME_BUMP_MM is now HOMING_BUMP_MM. Please update Configuration_adv.h."
#elif defined(DIGIPOT_I2C)
#error "DIGIPOT_I2C is now DIGIPOT_MCP4451 (or DIGIPOT_MCP4018). Please update Configuration_adv.h."
#endif #endif
/** /**
@ -1587,6 +1589,8 @@ static_assert(Y_MAX_LENGTH >= Y_BED_SIZE, "Movement bounds (Y_MIN_POS, Y_MAX_POS
// Pins are required for heaters // Pins are required for heaters
#if ENABLED(HEATER_0_USES_MAX6675) && !PIN_EXISTS(MAX6675_SS) #if ENABLED(HEATER_0_USES_MAX6675) && !PIN_EXISTS(MAX6675_SS)
#error "MAX6675_SS_PIN (required for TEMP_SENSOR_0) not defined for this board." #error "MAX6675_SS_PIN (required for TEMP_SENSOR_0) not defined for this board."
#elif HOTENDS && !HAS_TEMP_HOTEND
#error "TEMP_0_PIN (required for TEMP_SENSOR_0) not defined for this board."
#elif (HOTENDS > 1 || ENABLED(HEATERS_PARALLEL)) && !HAS_HEATER_1 #elif (HOTENDS > 1 || ENABLED(HEATERS_PARALLEL)) && !HAS_HEATER_1
#error "HEATER_1_PIN not defined for this board." #error "HEATER_1_PIN not defined for this board."
#endif #endif
@ -2443,10 +2447,12 @@ static_assert(Y_MAX_LENGTH >= Y_BED_SIZE, "Movement bounds (Y_MIN_POS, Y_MAX_POS
/** /**
* Digipot requirement * Digipot requirement
*/ */
#if ENABLED(DIGIPOT_MCP4018) #if HAS_I2C_DIGIPOT
#if !defined(DIGIPOTS_I2C_SDA_X) || !defined(DIGIPOTS_I2C_SDA_Y) || !defined(DIGIPOTS_I2C_SDA_Z) \ #if BOTH(DIGIPOT_MCP4018, DIGIPOT_MCP4451)
#error "Enable only one of DIGIPOT_MCP4018 or DIGIPOT_MCP4451."
#elif !defined(DIGIPOTS_I2C_SDA_X) || !defined(DIGIPOTS_I2C_SDA_Y) || !defined(DIGIPOTS_I2C_SDA_Z) \
|| !defined(DIGIPOTS_I2C_SDA_E0) || !defined(DIGIPOTS_I2C_SDA_E1) || !defined(DIGIPOTS_I2C_SDA_E0) || !defined(DIGIPOTS_I2C_SDA_E1)
#error "DIGIPOT_MCP4018 requires DIGIPOTS_I2C_SDA_* pins to be defined." #error "DIGIPOT_MCP4018/4451 requires DIGIPOTS_I2C_SDA_* pins to be defined."
#endif #endif
#endif #endif

View file

@ -780,7 +780,7 @@ namespace ExtUI {
*/ */
int16_t mmToWholeSteps(const float mm, const axis_t axis) { int16_t mmToWholeSteps(const float mm, const axis_t axis) {
const float steps = mm / planner.steps_to_mm[axis]; const float steps = mm / planner.steps_to_mm[axis];
return steps > 0 ? ceil(steps) : floor(steps); return steps > 0 ? CEIL(steps) : FLOOR(steps);
} }
#endif #endif

View file

@ -127,13 +127,15 @@ exec_test $1 $2 "Azteeg X3 | Mixing Extruder (x5) | Gradient Mix | Cyrillic"
# Test many less common options # Test many less common options
# #
restore_configs restore_configs
opt_set MOTHERBOARD BOARD_MEGATRONICS_32 opt_set MOTHERBOARD BOARD_MIGHTYBOARD_REVE
opt_set TEMP_SENSOR_0 -2
opt_set DIGIPOT_I2C_NUM_CHANNELS 5
opt_set LCD_LANGUAGE it opt_set LCD_LANGUAGE it
opt_set MIXING_STEPPERS 2 opt_set MIXING_STEPPERS 2
opt_set SERVO_DELAY "{ 300, 300, 300 }" opt_set SERVO_DELAY "{ 300, 300, 300 }"
opt_enable COREYX USE_XMAX_PLUG MIXING_EXTRUDER GRADIENT_MIX \ opt_enable COREYX USE_XMAX_PLUG MIXING_EXTRUDER GRADIENT_MIX \
BABYSTEPPING BABYSTEP_DISPLAY_TOTAL FILAMENT_LCD_DISPLAY \ BABYSTEPPING BABYSTEP_DISPLAY_TOTAL FILAMENT_LCD_DISPLAY \
REPRAP_DISCOUNT_SMART_CONTROLLER MENU_ADDAUTOSTART SDSUPPORT SDCARD_SORT_ALPHA \ REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER MENU_ADDAUTOSTART SDSUPPORT SDCARD_SORT_ALPHA \
ENDSTOP_NOISE_THRESHOLD FAN_SOFT_PWM \ ENDSTOP_NOISE_THRESHOLD FAN_SOFT_PWM \
FIX_MOUNTED_PROBE AUTO_BED_LEVELING_LINEAR DEBUG_LEVELING_FEATURE FILAMENT_WIDTH_SENSOR \ FIX_MOUNTED_PROBE AUTO_BED_LEVELING_LINEAR DEBUG_LEVELING_FEATURE FILAMENT_WIDTH_SENSOR \
Z_SAFE_HOMING SHOW_TEMP_ADC_VALUES HOME_Y_BEFORE_X EMERGENCY_PARSER \ Z_SAFE_HOMING SHOW_TEMP_ADC_VALUES HOME_Y_BEFORE_X EMERGENCY_PARSER \
@ -143,7 +145,7 @@ opt_set FAN_MIN_PWM 50
opt_set FAN_KICKSTART_TIME 100 opt_set FAN_KICKSTART_TIME 100
opt_set XY_FREQUENCY_LIMIT 15 opt_set XY_FREQUENCY_LIMIT 15
opt_add FILWIDTH_PIN 5 opt_add FILWIDTH_PIN 5
exec_test $1 $2 "Megatronics 3.2 | Gradient Mix | Endstop Int. | Home Y > X | FW Retract ..." exec_test $1 $2 "Mightyboard Rev. E | CoreXY, Gradient Mix | Endstop Int. | Home Y > X | FW Retract ..."
######## Other Standard LCD/Panels ############## ######## Other Standard LCD/Panels ##############
# #