Преглед на файлове

Option to use raw digipot values (#17536)

grauerfuchs преди 5 години
родител
ревизия
4a5a3d27ed
No account linked to committer's email address

+ 14
- 9
Marlin/Configuration_adv.h Целия файл

926
 //#define DIGIPOT_MOTOR_CURRENT { 135,135,135,135,135 }   // Values 0-255 (RAMBO 135 = ~0.75A, 185 = ~1A)
926
 //#define DIGIPOT_MOTOR_CURRENT { 135,135,135,135,135 }   // Values 0-255 (RAMBO 135 = ~0.75A, 185 = ~1A)
927
 //#define DAC_MOTOR_CURRENT_DEFAULT { 70, 80, 90, 80 }    // Default drive percent - X, Y, Z, E axis
927
 //#define DAC_MOTOR_CURRENT_DEFAULT { 70, 80, 90, 80 }    // Default drive percent - X, Y, Z, E axis
928
 
928
 
929
-// Use an I2C based DIGIPOT (e.g., Azteeg X3 Pro)
930
-//#define DIGIPOT_I2C
931
-#if ENABLED(DIGIPOT_I2C) && !defined(DIGIPOT_I2C_ADDRESS_A)
929
+/**
930
+ * I2C-based DIGIPOTs (e.g., Azteeg X3 Pro)
931
+ */
932
+//#define DIGIPOT_MCP4018             // Requires https://github.com/stawel/SlowSoftI2CMaster
933
+//#define DIGIPOT_MCP4451
934
+#if EITHER(DIGIPOT_MCP4018, DIGIPOT_MCP4451)
935
+  #define DIGIPOT_I2C_NUM_CHANNELS 8  // 5DPRINT:4   AZTEEG_X3_PRO:8   MKS_SBASE:5   MIGHTYBOARD_REVE:5
936
+
937
+  // Actual motor currents in Amps. The number of entries must match DIGIPOT_I2C_NUM_CHANNELS.
938
+  // These correspond to the physical drivers, so be mindful if the order is changed.
939
+  #define DIGIPOT_I2C_MOTOR_CURRENTS { 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0 }  //  AZTEEG_X3_PRO
940
+
941
+  //#define DIGIPOT_USE_RAW_VALUES    // Use DIGIPOT_MOTOR_CURRENT raw wiper values (instead of A4988 motor currents)
942
+
932
   /**
943
   /**
933
    * Common slave addresses:
944
    * Common slave addresses:
934
    *
945
    *
943
   #define DIGIPOT_I2C_ADDRESS_B 0x2D  // unshifted slave address for second DIGIPOT
954
   #define DIGIPOT_I2C_ADDRESS_B 0x2D  // unshifted slave address for second DIGIPOT
944
 #endif
955
 #endif
945
 
956
 
946
-//#define DIGIPOT_MCP4018          // Requires library from https://github.com/stawel/SlowSoftI2CMaster
947
-#define DIGIPOT_I2C_NUM_CHANNELS 8 // 5DPRINT: 4     AZTEEG_X3_PRO: 8     MKS SBASE: 5
948
-// Actual motor currents in Amps. The number of entries must match DIGIPOT_I2C_NUM_CHANNELS.
949
-// These correspond to the physical drivers, so be mindful if the order is changed.
950
-#define DIGIPOT_I2C_MOTOR_CURRENTS { 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0 }  //  AZTEEG_X3_PRO
951
-
952
 //===========================================================================
957
 //===========================================================================
953
 //=============================Additional Features===========================
958
 //=============================Additional Features===========================
954
 //===========================================================================
959
 //===========================================================================

+ 0
- 10
Marlin/src/HAL/AVR/inc/SanityCheck.h Целия файл

26
  */
26
  */
27
 
27
 
28
 /**
28
 /**
29
- * Digipot requirement
30
- */
31
- #if ENABLED(DIGIPOT_MCP4018)
32
-  #if !defined(DIGIPOTS_I2C_SDA_X) || !defined(DIGIPOTS_I2C_SDA_Y) || !defined(DIGIPOTS_I2C_SDA_Z) \
33
-    || !defined(DIGIPOTS_I2C_SDA_E0) || !defined(DIGIPOTS_I2C_SDA_E1)
34
-      #error "DIGIPOT_MCP4018 requires DIGIPOTS_I2C_SDA_* pins to be defined."
35
-  #endif
36
-#endif
37
-
38
-/**
39
  * Checks for FAST PWM
29
  * Checks for FAST PWM
40
  */
30
  */
41
 #if ENABLED(FAST_PWM_FAN) && (ENABLED(USE_OCR2A_AS_TOP) && defined(TCCR2))
31
 #if ENABLED(FAST_PWM_FAN) && (ENABLED(USE_OCR2A_AS_TOP) && defined(TCCR2))

+ 1
- 1
Marlin/src/HAL/LPC1768/inc/SanityCheck.h Целия файл

174
 //
174
 //
175
 // Flag any i2c pin conflicts
175
 // Flag any i2c pin conflicts
176
 //
176
 //
177
-#if ANY(DIGIPOT_I2C, DIGIPOT_MCP4018, DAC_STEPPER_CURRENT, EXPERIMENTAL_I2CBUS, I2C_POSITION_ENCODERS, PCA9632, I2C_EEPROM)
177
+#if ANY(HAS_I2C_DIGIPOT, DAC_STEPPER_CURRENT, EXPERIMENTAL_I2CBUS, I2C_POSITION_ENCODERS, PCA9632, I2C_EEPROM)
178
   #define USEDI2CDEV_M 1  // <Arduino>/Wire.cpp
178
   #define USEDI2CDEV_M 1  // <Arduino>/Wire.cpp
179
 
179
 
180
   #if USEDI2CDEV_M == 0         // P0_27 [D57] (AUX-1) .......... P0_28 [D58] (AUX-1)
180
   #if USEDI2CDEV_M == 0         // P0_27 [D57] (AUX-1) .......... P0_28 [D58] (AUX-1)

+ 2
- 2
Marlin/src/MarlinCore.cpp Целия файл

70
   #include "libs/buzzer.h"
70
   #include "libs/buzzer.h"
71
 #endif
71
 #endif
72
 
72
 
73
-#if ENABLED(DIGIPOT_I2C)
73
+#if HAS_I2C_DIGIPOT
74
   #include "feature/digipot/digipot.h"
74
   #include "feature/digipot/digipot.h"
75
 #endif
75
 #endif
76
 
76
 
1070
     SETUP_RUN(enableStepperDrivers());
1070
     SETUP_RUN(enableStepperDrivers());
1071
   #endif
1071
   #endif
1072
 
1072
 
1073
-  #if ENABLED(DIGIPOT_I2C)
1073
+  #if HAS_I2C_DIGIPOT
1074
     SETUP_RUN(digipot_i2c_init());
1074
     SETUP_RUN(digipot_i2c_init());
1075
   #endif
1075
   #endif
1076
 
1076
 

+ 34
- 36
Marlin/src/feature/digipot/digipot_mcp4018.cpp Целия файл

22
 
22
 
23
 #include "../../inc/MarlinConfig.h"
23
 #include "../../inc/MarlinConfig.h"
24
 
24
 
25
-#if BOTH(DIGIPOT_I2C, DIGIPOT_MCP4018)
25
+#if ENABLED(DIGIPOT_MCP4018)
26
 
26
 
27
 #include <Stream.h>
27
 #include <Stream.h>
28
-#include <SlowSoftI2CMaster.h>  //https://github.com/stawel/SlowSoftI2CMaster
28
+#include <SlowSoftI2CMaster.h>  // https://github.com/stawel/SlowSoftI2CMaster
29
 
29
 
30
 // Settings for the I2C based DIGIPOT (MCP4018) based on WT150
30
 // Settings for the I2C based DIGIPOT (MCP4018) based on WT150
31
 
31
 
32
 #define DIGIPOT_A4988_Rsx               0.250
32
 #define DIGIPOT_A4988_Rsx               0.250
33
 #define DIGIPOT_A4988_Vrefmax           1.666
33
 #define DIGIPOT_A4988_Vrefmax           1.666
34
-#define DIGIPOT_A4988_MAX_VALUE         127
34
+#define DIGIPOT_MCP4018_MAX_VALUE     127
35
 
35
 
36
-#define DIGIPOT_A4988_Itripmax(Vref)    ((Vref)/(8.0*DIGIPOT_A4988_Rsx))
36
+#define DIGIPOT_A4988_Itripmax(Vref)    ((Vref) / (8.0 * DIGIPOT_A4988_Rsx))
37
 
37
 
38
-#define DIGIPOT_A4988_FACTOR            ((DIGIPOT_A4988_MAX_VALUE)/DIGIPOT_A4988_Itripmax(DIGIPOT_A4988_Vrefmax))
38
+#define DIGIPOT_A4988_FACTOR            ((DIGIPOT_MCP4018_MAX_VALUE) / DIGIPOT_A4988_Itripmax(DIGIPOT_A4988_Vrefmax))
39
 #define DIGIPOT_A4988_MAX_CURRENT       2.0
39
 #define DIGIPOT_A4988_MAX_CURRENT       2.0
40
 
40
 
41
 static byte current_to_wiper(const float current) {
41
 static byte current_to_wiper(const float current) {
42
-  const int16_t value = ceil(float(DIGIPOT_A4988_FACTOR) * current);
43
-  return byte(constrain(value, 0, DIGIPOT_A4988_MAX_VALUE));
42
+  const int16_t value = TERN(DIGIPOT_USE_RAW_VALUES, current, CEIL(current * DIGIPOT_A4988_FACTOR));
43
+  return byte(constrain(value, 0, DIGIPOT_MCP4018_MAX_VALUE));
44
 }
44
 }
45
 
45
 
46
-const uint8_t sda_pins[DIGIPOT_I2C_NUM_CHANNELS] = {
47
-  DIGIPOTS_I2C_SDA_X
48
-  #if DIGIPOT_I2C_NUM_CHANNELS > 1
49
-    , DIGIPOTS_I2C_SDA_Y
50
-    #if DIGIPOT_I2C_NUM_CHANNELS > 2
51
-      , DIGIPOTS_I2C_SDA_Z
52
-      #if DIGIPOT_I2C_NUM_CHANNELS > 3
53
-        , DIGIPOTS_I2C_SDA_E0
54
-        #if DIGIPOT_I2C_NUM_CHANNELS > 4
55
-          , DIGIPOTS_I2C_SDA_E1
56
-        #endif
57
-      #endif
58
-    #endif
59
-  #endif
60
-};
61
-
62
 static SlowSoftI2CMaster pots[DIGIPOT_I2C_NUM_CHANNELS] = {
46
 static SlowSoftI2CMaster pots[DIGIPOT_I2C_NUM_CHANNELS] = {
63
-  SlowSoftI2CMaster { sda_pins[X_AXIS], DIGIPOTS_I2C_SCL }
47
+  SlowSoftI2CMaster(DIGIPOTS_I2C_SDA_X, DIGIPOTS_I2C_SCL)
64
   #if DIGIPOT_I2C_NUM_CHANNELS > 1
48
   #if DIGIPOT_I2C_NUM_CHANNELS > 1
65
-    , SlowSoftI2CMaster { sda_pins[Y_AXIS], DIGIPOTS_I2C_SCL }
49
+    , SlowSoftI2CMaster(DIGIPOTS_I2C_SDA_Y, DIGIPOTS_I2C_SCL)
66
     #if DIGIPOT_I2C_NUM_CHANNELS > 2
50
     #if DIGIPOT_I2C_NUM_CHANNELS > 2
67
-      , SlowSoftI2CMaster { sda_pins[Z_AXIS], DIGIPOTS_I2C_SCL }
51
+      , SlowSoftI2CMaster(DIGIPOTS_I2C_SDA_Z, DIGIPOTS_I2C_SCL)
68
       #if DIGIPOT_I2C_NUM_CHANNELS > 3
52
       #if DIGIPOT_I2C_NUM_CHANNELS > 3
69
-        , SlowSoftI2CMaster { sda_pins[E_AXIS], DIGIPOTS_I2C_SCL }
53
+        , SlowSoftI2CMaster(DIGIPOTS_I2C_SDA_E0, DIGIPOTS_I2C_SCL)
70
         #if DIGIPOT_I2C_NUM_CHANNELS > 4
54
         #if DIGIPOT_I2C_NUM_CHANNELS > 4
71
-          , SlowSoftI2CMaster { sda_pins[E_AXIS + 1], DIGIPOTS_I2C_SCL }
55
+          , SlowSoftI2CMaster(DIGIPOTS_I2C_SDA_E1, DIGIPOTS_I2C_SCL)
56
+          #if DIGIPOT_I2C_NUM_CHANNELS > 5
57
+            , SlowSoftI2CMaster(DIGIPOTS_I2C_SDA_E2, DIGIPOTS_I2C_SCL)
58
+            #if DIGIPOT_I2C_NUM_CHANNELS > 6
59
+              , SlowSoftI2CMaster(DIGIPOTS_I2C_SDA_E3, DIGIPOTS_I2C_SCL)
60
+              #if DIGIPOT_I2C_NUM_CHANNELS > 7
61
+                , SlowSoftI2CMaster(DIGIPOTS_I2C_SDA_E4, DIGIPOTS_I2C_SCL)
62
+              #endif
63
+            #endif
64
+          #endif
72
         #endif
65
         #endif
73
       #endif
66
       #endif
74
     #endif
67
     #endif
85
 
78
 
86
 // This is for the MCP4018 I2C based digipot
79
 // This is for the MCP4018 I2C based digipot
87
 void digipot_i2c_set_current(const uint8_t channel, const float current) {
80
 void digipot_i2c_set_current(const uint8_t channel, const float current) {
88
-  i2c_send(channel, current_to_wiper(_MIN(_MAX(current, 0), float(DIGIPOT_A4988_MAX_CURRENT))));
81
+  const float ival = _MIN(_MAX(current, 0), float(DIGIPOT_MCP4018_MAX_VALUE));
82
+  i2c_send(channel, current_to_wiper(ival));
89
 }
83
 }
90
 
84
 
91
 void digipot_i2c_init() {
85
 void digipot_i2c_init() {
92
-  static const float digipot_motor_current[] PROGMEM = DIGIPOT_I2C_MOTOR_CURRENTS;
93
-
94
-  LOOP_L_N(i, DIGIPOT_I2C_NUM_CHANNELS)
95
-    pots[i].i2c_init();
96
-
97
-  // setup initial currents as defined in Configuration_adv.h
86
+  LOOP_L_N(i, DIGIPOT_I2C_NUM_CHANNELS) pots[i].i2c_init();
87
+
88
+  // Init currents according to Configuration_adv.h
89
+  static const float digipot_motor_current[] PROGMEM =
90
+    #if ENABLED(DIGIPOT_USE_RAW_VALUES)
91
+      DIGIPOT_MOTOR_CURRENT
92
+    #else
93
+      DIGIPOT_I2C_MOTOR_CURRENTS
94
+    #endif
95
+  ;
98
   LOOP_L_N(i, COUNT(digipot_motor_current))
96
   LOOP_L_N(i, COUNT(digipot_motor_current))
99
     digipot_i2c_set_current(i, pgm_read_float(&digipot_motor_current[i]));
97
     digipot_i2c_set_current(i, pgm_read_float(&digipot_motor_current[i]));
100
 }
98
 }
101
 
99
 
102
-#endif // DIGIPOT_I2C && DIGIPOT_MCP4018
100
+#endif // DIGIPOT_MCP4018

+ 14
- 14
Marlin/src/feature/digipot/digipot_mcp4451.cpp Целия файл

22
 
22
 
23
 #include "../../inc/MarlinConfig.h"
23
 #include "../../inc/MarlinConfig.h"
24
 
24
 
25
-#if ENABLED(DIGIPOT_I2C) && DISABLED(DIGIPOT_MCP4018)
25
+#if ENABLED(DIGIPOT_MCP4451)
26
 
26
 
27
 #include <Stream.h>
27
 #include <Stream.h>
28
 #include <Wire.h>
28
 #include <Wire.h>
33
 
33
 
34
 // Settings for the I2C based DIGIPOT (MCP4451) on Azteeg X3 Pro
34
 // Settings for the I2C based DIGIPOT (MCP4451) on Azteeg X3 Pro
35
 #if MB(5DPRINT)
35
 #if MB(5DPRINT)
36
-  #define DIGIPOT_I2C_FACTOR 117.96
37
-  #define DIGIPOT_I2C_MAX_CURRENT 1.736
36
+  #define DIGIPOT_I2C_FACTOR      117.96f
37
+  #define DIGIPOT_I2C_MAX_CURRENT   1.736f
38
 #elif MB(AZTEEG_X5_MINI, AZTEEG_X5_MINI_WIFI)
38
 #elif MB(AZTEEG_X5_MINI, AZTEEG_X5_MINI_WIFI)
39
-  #define DIGIPOT_I2C_FACTOR 113.5
40
-  #define DIGIPOT_I2C_MAX_CURRENT 2.0
39
+  #define DIGIPOT_I2C_FACTOR      113.5f
40
+  #define DIGIPOT_I2C_MAX_CURRENT   2.0f
41
 #else
41
 #else
42
-  #define DIGIPOT_I2C_FACTOR 106.7
43
-  #define DIGIPOT_I2C_MAX_CURRENT 2.5
42
+  #define DIGIPOT_I2C_FACTOR      106.7f
43
+  #define DIGIPOT_I2C_MAX_CURRENT   2.5f
44
 #endif
44
 #endif
45
 
45
 
46
 static byte current_to_wiper(const float current) {
46
 static byte current_to_wiper(const float current) {
47
-  return byte(CEIL(float((DIGIPOT_I2C_FACTOR * current))));
47
+  return byte(TERN(DIGIPOT_USE_RAW_VALUES, current, CEIL(DIGIPOT_I2C_FACTOR * current)));
48
 }
48
 }
49
 
49
 
50
 static void digipot_i2c_send(const byte addr, const byte a, const byte b) {
50
 static void digipot_i2c_send(const byte addr, const byte a, const byte b) {
62
 
62
 
63
 // This is for the MCP4451 I2C based digipot
63
 // This is for the MCP4451 I2C based digipot
64
 void digipot_i2c_set_current(const uint8_t channel, const float current) {
64
 void digipot_i2c_set_current(const uint8_t channel, const float current) {
65
-  // these addresses are specific to Azteeg X3 Pro, can be set to others,
66
-  // In this case first digipot is at address A0=0, A1= 0, second one is at A0=0, A1= 1
65
+  // These addresses are specific to Azteeg X3 Pro, can be set to others.
66
+  // In this case first digipot is at address A0=0, A1=0, second one is at A0=0, A1=1
67
   const byte addr = channel < 4 ? DIGIPOT_I2C_ADDRESS_A : DIGIPOT_I2C_ADDRESS_B; // channel 0-3 vs 4-7
67
   const byte addr = channel < 4 ? DIGIPOT_I2C_ADDRESS_A : DIGIPOT_I2C_ADDRESS_B; // channel 0-3 vs 4-7
68
 
68
 
69
   // Initial setup
69
   // Initial setup
77
 
77
 
78
 void digipot_i2c_init() {
78
 void digipot_i2c_init() {
79
   #if MB(MKS_SBASE)
79
   #if MB(MKS_SBASE)
80
-    configure_i2c(16); // Setting clock_option to 16 ensure the I2C bus is initialized at 400kHz
80
+    configure_i2c(16); // Set clock_option to 16 ensure I2C is initialized at 400kHz
81
   #else
81
   #else
82
     Wire.begin();
82
     Wire.begin();
83
   #endif
83
   #endif
84
-  // setup initial currents as defined in Configuration_adv.h
85
-  static const float digipot_motor_current[] PROGMEM = DIGIPOT_I2C_MOTOR_CURRENTS;
84
+  // Set up initial currents as defined in Configuration_adv.h
85
+  static const float digipot_motor_current[] PROGMEM = TERN(DIGIPOT_USE_RAW_VALUES, DIGIPOT_MOTOR_CURRENT, DIGIPOT_I2C_MOTOR_CURRENTS);
86
   LOOP_L_N(i, COUNT(digipot_motor_current))
86
   LOOP_L_N(i, COUNT(digipot_motor_current))
87
     digipot_i2c_set_current(i, pgm_read_float(&digipot_motor_current[i]));
87
     digipot_i2c_set_current(i, pgm_read_float(&digipot_motor_current[i]));
88
 }
88
 }
89
 
89
 
90
-#endif // DIGIPOT_I2C
90
+#endif // DIGIPOT_MCP4451

+ 4
- 4
Marlin/src/gcode/feature/digipot/M907-M910.cpp Целия файл

22
 
22
 
23
 #include "../../../inc/MarlinConfig.h"
23
 #include "../../../inc/MarlinConfig.h"
24
 
24
 
25
-#if HAS_DIGIPOTSS || HAS_MOTOR_CURRENT_PWM || EITHER(DIGIPOT_I2C, DAC_STEPPER_CURRENT)
25
+#if HAS_DIGIPOTSS || HAS_MOTOR_CURRENT_PWM || HAS_I2C_DIGIPOT || ENABLED(DAC_STEPPER_CURRENT)
26
 
26
 
27
 #include "../../gcode.h"
27
 #include "../../gcode.h"
28
 
28
 
30
   #include "../../../module/stepper.h"
30
   #include "../../../module/stepper.h"
31
 #endif
31
 #endif
32
 
32
 
33
-#if ENABLED(DIGIPOT_I2C)
33
+#if HAS_I2C_DIGIPOT
34
   #include "../../../feature/digipot/digipot.h"
34
   #include "../../../feature/digipot/digipot.h"
35
 #endif
35
 #endif
36
 
36
 
62
 
62
 
63
   #endif
63
   #endif
64
 
64
 
65
-  #if ENABLED(DIGIPOT_I2C)
65
+  #if HAS_I2C_DIGIPOT
66
     // this one uses actual amps in floating point
66
     // this one uses actual amps in floating point
67
     LOOP_XYZE(i) if (parser.seenval(axis_codes[i])) digipot_i2c_set_current(i, parser.value_float());
67
     LOOP_XYZE(i) if (parser.seenval(axis_codes[i])) digipot_i2c_set_current(i, parser.value_float());
68
     // Additional extruders use B,C,D for channels 4,5,6.
68
     // Additional extruders use B,C,D for channels 4,5,6.
103
 
103
 
104
 #endif // DAC_STEPPER_CURRENT
104
 #endif // DAC_STEPPER_CURRENT
105
 
105
 
106
-#endif // HAS_DIGIPOTSS || DAC_STEPPER_CURRENT || HAS_MOTOR_CURRENT_PWM || DIGIPOT_I2C
106
+#endif // HAS_DIGIPOTSS || HAS_MOTOR_CURRENT_PWM || HAS_I2C_DIGIPOT || DAC_STEPPER_CURRENT

+ 1
- 1
Marlin/src/gcode/gcode.cpp Целия файл

794
         case 900: M900(); break;                                  // M900: Set advance K factor.
794
         case 900: M900(); break;                                  // M900: Set advance K factor.
795
       #endif
795
       #endif
796
 
796
 
797
-      #if HAS_DIGIPOTSS || HAS_MOTOR_CURRENT_PWM || EITHER(DIGIPOT_I2C, DAC_STEPPER_CURRENT)
797
+      #if HAS_DIGIPOTSS || HAS_MOTOR_CURRENT_PWM || HAS_I2C_DIGIPOT || ENABLED(DAC_STEPPER_CURRENT)
798
         case 907: M907(); break;                                  // M907: Set digital trimpot motor current using axis codes.
798
         case 907: M907(); break;                                  // M907: Set digital trimpot motor current using axis codes.
799
         #if HAS_DIGIPOTSS || ENABLED(DAC_STEPPER_CURRENT)
799
         #if HAS_DIGIPOTSS || ENABLED(DAC_STEPPER_CURRENT)
800
           case 908: M908(); break;                                // M908: Control digital trimpot directly.
800
           case 908: M908(); break;                                // M908: Control digital trimpot directly.

+ 1
- 1
Marlin/src/gcode/gcode.h Целия файл

938
     static void M918();
938
     static void M918();
939
   #endif
939
   #endif
940
 
940
 
941
-  #if HAS_DIGIPOTSS || HAS_MOTOR_CURRENT_PWM || EITHER(DIGIPOT_I2C, DAC_STEPPER_CURRENT)
941
+  #if HAS_DIGIPOTSS || HAS_MOTOR_CURRENT_PWM || HAS_I2C_DIGIPOT || ENABLED(DAC_STEPPER_CURRENT)
942
     static void M907();
942
     static void M907();
943
     #if HAS_DIGIPOTSS || ENABLED(DAC_STEPPER_CURRENT)
943
     #if HAS_DIGIPOTSS || ENABLED(DAC_STEPPER_CURRENT)
944
       static void M908();
944
       static void M908();

+ 4
- 0
Marlin/src/inc/Conditionals_adv.h Целия файл

113
   #define HAS_LEDS_OFF_FLAG 1
113
   #define HAS_LEDS_OFF_FLAG 1
114
 #endif
114
 #endif
115
 
115
 
116
+#if EITHER(DIGIPOT_MCP4018, DIGIPOT_MCP4451)
117
+  #define HAS_I2C_DIGIPOT 1
118
+#endif
119
+
116
 // Multiple Z steppers
120
 // Multiple Z steppers
117
 #ifndef NUM_Z_STEPPER_DRIVERS
121
 #ifndef NUM_Z_STEPPER_DRIVERS
118
   #define NUM_Z_STEPPER_DRIVERS 1
122
   #define NUM_Z_STEPPER_DRIVERS 1

+ 9
- 3
Marlin/src/inc/SanityCheck.h Целия файл

497
   #error "HOMING_BACKOFF_MM is now HOMING_BACKOFF_POST_MM. Please update Configuration_adv.h."
497
   #error "HOMING_BACKOFF_MM is now HOMING_BACKOFF_POST_MM. Please update Configuration_adv.h."
498
 #elif defined(X_HOME_BUMP_MM) || defined(Y_HOME_BUMP_MM) || defined(Z_HOME_BUMP_MM)
498
 #elif defined(X_HOME_BUMP_MM) || defined(Y_HOME_BUMP_MM) || defined(Z_HOME_BUMP_MM)
499
   #error "[XYZ]_HOME_BUMP_MM is now HOMING_BUMP_MM. Please update Configuration_adv.h."
499
   #error "[XYZ]_HOME_BUMP_MM is now HOMING_BUMP_MM. Please update Configuration_adv.h."
500
+#elif defined(DIGIPOT_I2C)
501
+  #error "DIGIPOT_I2C is now DIGIPOT_MCP4451 (or DIGIPOT_MCP4018). Please update Configuration_adv.h."
500
 #endif
502
 #endif
501
 
503
 
502
 /**
504
 /**
1587
 // Pins are required for heaters
1589
 // Pins are required for heaters
1588
 #if ENABLED(HEATER_0_USES_MAX6675) && !PIN_EXISTS(MAX6675_SS)
1590
 #if ENABLED(HEATER_0_USES_MAX6675) && !PIN_EXISTS(MAX6675_SS)
1589
   #error "MAX6675_SS_PIN (required for TEMP_SENSOR_0) not defined for this board."
1591
   #error "MAX6675_SS_PIN (required for TEMP_SENSOR_0) not defined for this board."
1592
+#elif HOTENDS && !HAS_TEMP_HOTEND
1593
+  #error "TEMP_0_PIN (required for TEMP_SENSOR_0) not defined for this board."
1590
 #elif (HOTENDS > 1 || ENABLED(HEATERS_PARALLEL)) && !HAS_HEATER_1
1594
 #elif (HOTENDS > 1 || ENABLED(HEATERS_PARALLEL)) && !HAS_HEATER_1
1591
   #error "HEATER_1_PIN not defined for this board."
1595
   #error "HEATER_1_PIN not defined for this board."
1592
 #endif
1596
 #endif
2443
 /**
2447
 /**
2444
  * Digipot requirement
2448
  * Digipot requirement
2445
  */
2449
  */
2446
-#if ENABLED(DIGIPOT_MCP4018)
2447
-  #if !defined(DIGIPOTS_I2C_SDA_X) || !defined(DIGIPOTS_I2C_SDA_Y) || !defined(DIGIPOTS_I2C_SDA_Z) \
2450
+#if HAS_I2C_DIGIPOT
2451
+  #if BOTH(DIGIPOT_MCP4018, DIGIPOT_MCP4451)
2452
+    #error "Enable only one of DIGIPOT_MCP4018 or DIGIPOT_MCP4451."
2453
+  #elif !defined(DIGIPOTS_I2C_SDA_X) || !defined(DIGIPOTS_I2C_SDA_Y) || !defined(DIGIPOTS_I2C_SDA_Z) \
2448
     || !defined(DIGIPOTS_I2C_SDA_E0) || !defined(DIGIPOTS_I2C_SDA_E1)
2454
     || !defined(DIGIPOTS_I2C_SDA_E0) || !defined(DIGIPOTS_I2C_SDA_E1)
2449
-      #error "DIGIPOT_MCP4018 requires DIGIPOTS_I2C_SDA_* pins to be defined."
2455
+      #error "DIGIPOT_MCP4018/4451 requires DIGIPOTS_I2C_SDA_* pins to be defined."
2450
   #endif
2456
   #endif
2451
 #endif
2457
 #endif
2452
 
2458
 

+ 1
- 1
Marlin/src/lcd/extui/ui_api.cpp Целия файл

780
      */
780
      */
781
     int16_t mmToWholeSteps(const float mm, const axis_t axis) {
781
     int16_t mmToWholeSteps(const float mm, const axis_t axis) {
782
       const float steps = mm / planner.steps_to_mm[axis];
782
       const float steps = mm / planner.steps_to_mm[axis];
783
-      return steps > 0 ? ceil(steps) : floor(steps);
783
+      return steps > 0 ? CEIL(steps) : FLOOR(steps);
784
     }
784
     }
785
   #endif
785
   #endif
786
 
786
 

+ 5
- 3
buildroot/share/tests/mega2560-tests Целия файл

127
 # Test many less common options
127
 # Test many less common options
128
 #
128
 #
129
 restore_configs
129
 restore_configs
130
-opt_set MOTHERBOARD BOARD_MEGATRONICS_32
130
+opt_set MOTHERBOARD BOARD_MIGHTYBOARD_REVE
131
+opt_set TEMP_SENSOR_0 -2
132
+opt_set DIGIPOT_I2C_NUM_CHANNELS 5
131
 opt_set LCD_LANGUAGE it
133
 opt_set LCD_LANGUAGE it
132
 opt_set MIXING_STEPPERS 2
134
 opt_set MIXING_STEPPERS 2
133
 opt_set SERVO_DELAY "{ 300, 300, 300 }"
135
 opt_set SERVO_DELAY "{ 300, 300, 300 }"
134
 opt_enable COREYX USE_XMAX_PLUG MIXING_EXTRUDER GRADIENT_MIX \
136
 opt_enable COREYX USE_XMAX_PLUG MIXING_EXTRUDER GRADIENT_MIX \
135
            BABYSTEPPING BABYSTEP_DISPLAY_TOTAL FILAMENT_LCD_DISPLAY \
137
            BABYSTEPPING BABYSTEP_DISPLAY_TOTAL FILAMENT_LCD_DISPLAY \
136
-           REPRAP_DISCOUNT_SMART_CONTROLLER MENU_ADDAUTOSTART SDSUPPORT SDCARD_SORT_ALPHA \
138
+           REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER MENU_ADDAUTOSTART SDSUPPORT SDCARD_SORT_ALPHA \
137
            ENDSTOP_NOISE_THRESHOLD FAN_SOFT_PWM \
139
            ENDSTOP_NOISE_THRESHOLD FAN_SOFT_PWM \
138
            FIX_MOUNTED_PROBE AUTO_BED_LEVELING_LINEAR DEBUG_LEVELING_FEATURE FILAMENT_WIDTH_SENSOR \
140
            FIX_MOUNTED_PROBE AUTO_BED_LEVELING_LINEAR DEBUG_LEVELING_FEATURE FILAMENT_WIDTH_SENSOR \
139
            Z_SAFE_HOMING SHOW_TEMP_ADC_VALUES HOME_Y_BEFORE_X EMERGENCY_PARSER \
141
            Z_SAFE_HOMING SHOW_TEMP_ADC_VALUES HOME_Y_BEFORE_X EMERGENCY_PARSER \
143
 opt_set FAN_KICKSTART_TIME 100
145
 opt_set FAN_KICKSTART_TIME 100
144
 opt_set XY_FREQUENCY_LIMIT 15
146
 opt_set XY_FREQUENCY_LIMIT 15
145
 opt_add FILWIDTH_PIN 5
147
 opt_add FILWIDTH_PIN 5
146
-exec_test $1 $2 "Megatronics 3.2 | Gradient Mix | Endstop Int. | Home Y > X | FW Retract ..."
148
+exec_test $1 $2 "Mightyboard Rev. E | CoreXY, Gradient Mix | Endstop Int. | Home Y > X | FW Retract ..."
147
 
149
 
148
 ######## Other Standard LCD/Panels ##############
150
 ######## Other Standard LCD/Panels ##############
149
 #
151
 #

Loading…
Отказ
Запис