Browse Source

Fix M503 output for M907 motor current (#19777)

Co-authored-by: Scott Lahteine <github@thinkyhead.com>
Sten Uusvali 4 years ago
parent
commit
6fed11896b
No account linked to committer's email address

+ 15
- 9
Marlin/src/module/settings.cpp View File

@@ -3719,19 +3719,25 @@ void MarlinSettings::reset() {
3719 3719
       CONFIG_ECHO_HEADING("Stepper motor currents:");
3720 3720
       CONFIG_ECHO_START();
3721 3721
       #if HAS_MOTOR_CURRENT_PWM
3722
-        SERIAL_ECHOLNPAIR_P(
3723
-            PSTR("  M907 X"), stepper.motor_current_setting[0]
3724
-          , SP_Z_STR, stepper.motor_current_setting[1]
3725
-          , SP_E_STR, stepper.motor_current_setting[2]
3722
+        SERIAL_ECHOLNPAIR_P(                                   // PWM-based has 3 values:
3723
+            PSTR("  M907 X"), stepper.motor_current_setting[0] // X and Y
3724
+                  , SP_Z_STR, stepper.motor_current_setting[1] // Z
3725
+                  , SP_E_STR, stepper.motor_current_setting[2] // E
3726 3726
         );
3727 3727
       #elif HAS_MOTOR_CURRENT_SPI
3728
-        SERIAL_ECHOPGM("  M907");
3729
-        LOOP_L_N(q, MOTOR_CURRENT_COUNT) {
3730
-          SERIAL_CHAR(' ');
3731
-          SERIAL_CHAR(axis_codes[q]);
3728
+        SERIAL_ECHOPGM("  M907");                              // SPI-based has 5 values:
3729
+        LOOP_XYZE(q) {                                         // X Y Z E (map to X Y Z E0 by default)
3730
+          SERIAL_CHAR(' ', axis_codes[q]);
3732 3731
           SERIAL_ECHO(stepper.motor_current_setting[q]);
3733 3732
         }
3734
-      #endif
3733
+        SERIAL_CHAR(' ', 'B');                                 // B (maps to E1 by default)
3734
+        SERIAL_ECHOLN(stepper.motor_current_setting[4]);
3735
+      #endif
3736
+    #elif HAS_MOTOR_CURRENT_I2C                                // i2c-based has any number of values
3737
+      // Values sent over i2c are not stored.
3738
+      // Indexes map directly to drivers, not axes.
3739
+    #elif HAS_MOTOR_CURRENT_DAC                                // DAC-based has 4 values, for X Y Z E
3740
+      // Values sent over i2c are not stored. Uses indirect mapping.
3735 3741
     #endif
3736 3742
 
3737 3743
     /**

+ 1
- 1
Marlin/src/module/stepper.cpp View File

@@ -2962,7 +2962,7 @@ void Stepper::report_positions() {
2962 2962
   #if HAS_MOTOR_CURRENT_SPI || HAS_MOTOR_CURRENT_PWM
2963 2963
 
2964 2964
     void Stepper::set_digipot_current(const uint8_t driver, const int16_t current) {
2965
-      if (WITHIN(driver, 0, COUNT(motor_current_setting) - 1))
2965
+      if (WITHIN(driver, 0, MOTOR_CURRENT_COUNT - 1))
2966 2966
         motor_current_setting[driver] = current; // update motor_current_setting
2967 2967
 
2968 2968
       if (!initialized) return;

+ 1
- 1
Marlin/src/pins/rambo/pins_RAMBO.h View File

@@ -112,7 +112,7 @@
112 112
 #define E1_MS2_PIN                            64
113 113
 
114 114
 #define DIGIPOTSS_PIN                         38
115
-#define DIGIPOT_CHANNELS  { 4,5,3,0,1 }           // X Y Z E0 E1 digipot channels to stepper driver mapping
115
+#define DIGIPOT_CHANNELS { 4, 5, 3, 0, 1 }        // X Y Z E0 E1 digipot channels to stepper driver mapping
116 116
 #ifndef DIGIPOT_MOTOR_CURRENT
117 117
   #define DIGIPOT_MOTOR_CURRENT { 135,135,135,135,135 }   // Values 0-255 (RAMBO 135 = ~0.75A, 185 = ~1A)
118 118
 #endif

+ 1
- 1
Marlin/src/pins/rambo/pins_SCOOVO_X9H.h View File

@@ -92,7 +92,7 @@
92 92
 #define E1_MS2_PIN                            64
93 93
 
94 94
 #define DIGIPOTSS_PIN                         38
95
-#define DIGIPOT_CHANNELS {4,5,3,0,1}              // X Y Z E0 E1 digipot channels to stepper driver mapping
95
+#define DIGIPOT_CHANNELS { 4, 5, 3, 0, 1 }        // X Y Z E0 E1 digipot channels to stepper driver mapping
96 96
 
97 97
 //
98 98
 // Temperature Sensors

+ 1
- 1
Marlin/src/pins/ramps/pins_BQ_ZUM_MEGA_3D.h View File

@@ -85,7 +85,7 @@
85 85
 // Steppers
86 86
 //
87 87
 #define DIGIPOTSS_PIN                         22
88
-#define DIGIPOT_CHANNELS   { 4, 5, 3, 0, 1 }
88
+#define DIGIPOT_CHANNELS { 4, 5, 3, 0, 1 }
89 89
 
90 90
 //
91 91
 // Temperature Sensors

Loading…
Cancel
Save