Browse Source

Merge pull request #3667 from esenapaj/patch-1

Additional follow-up the PR #3631(Encapsulate S...
Scott Lahteine 8 years ago
parent
commit
b959020532
4 changed files with 22 additions and 20 deletions
  1. 17
    17
      Marlin/Marlin_main.cpp
  2. 3
    1
      Marlin/endstops.cpp
  3. 1
    1
      Marlin/stepper.h
  4. 1
    1
      Marlin/ultralcd.cpp

+ 17
- 17
Marlin/Marlin_main.cpp View File

@@ -5933,7 +5933,7 @@ inline void gcode_M503() {
5933 5933
    * M540: Set whether SD card print should abort on endstop hit (M540 S<0|1>)
5934 5934
    */
5935 5935
   inline void gcode_M540() {
5936
-    if (code_seen('S')) abort_on_endstop_hit = (code_value() > 0);
5936
+    if (code_seen('S')) stepper.abort_on_endstop_hit = (code_value() > 0);
5937 5937
   }
5938 5938
 
5939 5939
 #endif // ABORT_ON_ENDSTOP_HIT_FEATURE_ENABLED
@@ -6166,18 +6166,18 @@ inline void gcode_M503() {
6166 6166
 inline void gcode_M907() {
6167 6167
   #if HAS_DIGIPOTSS
6168 6168
     for (int i = 0; i < NUM_AXIS; i++)
6169
-      if (code_seen(axis_codes[i])) digipot_current(i, code_value());
6170
-    if (code_seen('B')) digipot_current(4, code_value());
6171
-    if (code_seen('S')) for (int i = 0; i <= 4; i++) digipot_current(i, code_value());
6169
+      if (code_seen(axis_codes[i])) stepper.digipot_current(i, code_value());
6170
+    if (code_seen('B')) stepper.digipot_current(4, code_value());
6171
+    if (code_seen('S')) for (int i = 0; i <= 4; i++) stepper.digipot_current(i, code_value());
6172 6172
   #endif
6173 6173
   #if PIN_EXISTS(MOTOR_CURRENT_PWM_XY)
6174
-    if (code_seen('X')) digipot_current(0, code_value());
6174
+    if (code_seen('X')) stepper.digipot_current(0, code_value());
6175 6175
   #endif
6176 6176
   #if PIN_EXISTS(MOTOR_CURRENT_PWM_Z)
6177
-    if (code_seen('Z')) digipot_current(1, code_value());
6177
+    if (code_seen('Z')) stepper.digipot_current(1, code_value());
6178 6178
   #endif
6179 6179
   #if PIN_EXISTS(MOTOR_CURRENT_PWM_E)
6180
-    if (code_seen('E')) digipot_current(2, code_value());
6180
+    if (code_seen('E')) stepper.digipot_current(2, code_value());
6181 6181
   #endif
6182 6182
   #if ENABLED(DIGIPOT_I2C)
6183 6183
     // this one uses actual amps in floating point
@@ -6201,7 +6201,7 @@ inline void gcode_M907() {
6201 6201
    */
6202 6202
   inline void gcode_M908() {
6203 6203
     #if HAS_DIGIPOTSS
6204
-      digitalPotWrite(
6204
+      stepper.digitalPotWrite(
6205 6205
         code_seen('P') ? code_value() : 0,
6206 6206
         code_seen('S') ? code_value() : 0
6207 6207
       );
@@ -6228,10 +6228,10 @@ inline void gcode_M907() {
6228 6228
 
6229 6229
   // M350 Set microstepping mode. Warning: Steps per unit remains unchanged. S code sets stepping mode for all drivers.
6230 6230
   inline void gcode_M350() {
6231
-    if (code_seen('S')) for (int i = 0; i <= 4; i++) microstep_mode(i, code_value());
6232
-    for (int i = 0; i < NUM_AXIS; i++) if (code_seen(axis_codes[i])) microstep_mode(i, (uint8_t)code_value());
6233
-    if (code_seen('B')) microstep_mode(4, code_value());
6234
-    microstep_readings();
6231
+    if (code_seen('S')) for (int i = 0; i <= 4; i++) stepper.microstep_mode(i, code_value());
6232
+    for (int i = 0; i < NUM_AXIS; i++) if (code_seen(axis_codes[i])) stepper.microstep_mode(i, (uint8_t)code_value());
6233
+    if (code_seen('B')) stepper.microstep_mode(4, code_value());
6234
+    stepper.microstep_readings();
6235 6235
   }
6236 6236
 
6237 6237
   /**
@@ -6241,15 +6241,15 @@ inline void gcode_M907() {
6241 6241
   inline void gcode_M351() {
6242 6242
     if (code_seen('S')) switch (code_value_short()) {
6243 6243
       case 1:
6244
-        for (int i = 0; i < NUM_AXIS; i++) if (code_seen(axis_codes[i])) microstep_ms(i, code_value(), -1);
6245
-        if (code_seen('B')) microstep_ms(4, code_value(), -1);
6244
+        for (int i = 0; i < NUM_AXIS; i++) if (code_seen(axis_codes[i])) stepper.microstep_ms(i, code_value(), -1);
6245
+        if (code_seen('B')) stepper.microstep_ms(4, code_value(), -1);
6246 6246
         break;
6247 6247
       case 2:
6248
-        for (int i = 0; i < NUM_AXIS; i++) if (code_seen(axis_codes[i])) microstep_ms(i, -1, code_value());
6249
-        if (code_seen('B')) microstep_ms(4, -1, code_value());
6248
+        for (int i = 0; i < NUM_AXIS; i++) if (code_seen(axis_codes[i])) stepper.microstep_ms(i, -1, code_value());
6249
+        if (code_seen('B')) stepper.microstep_ms(4, -1, code_value());
6250 6250
         break;
6251 6251
     }
6252
-    microstep_readings();
6252
+    stepper.microstep_readings();
6253 6253
   }
6254 6254
 
6255 6255
 #endif // HAS_MICROSTEPS

+ 3
- 1
Marlin/endstops.cpp View File

@@ -25,7 +25,9 @@
25 25
  */
26 26
 
27 27
 #include "Marlin.h"
28
+#include "cardreader.h"
28 29
 #include "endstops.h"
30
+#include "temperature.h"
29 31
 #include "stepper.h"
30 32
 #include "ultralcd.h"
31 33
 
@@ -147,7 +149,7 @@ void Endstops::report_state() {
147 149
     hit_on_purpose();
148 150
 
149 151
     #if ENABLED(ABORT_ON_ENDSTOP_HIT_FEATURE_ENABLED) && ENABLED(SDSUPPORT)
150
-      if (abort_on_endstop_hit) {
152
+      if (stepper.abort_on_endstop_hit) {
151 153
         card.sdprinting = false;
152 154
         card.closefile();
153 155
         stepper.quick_stop();

+ 1
- 1
Marlin/stepper.h View File

@@ -220,6 +220,7 @@ class Stepper {
220 220
     #endif
221 221
     void microstep_ms(uint8_t driver, int8_t ms1, int8_t ms2);
222 222
     void digipot_current(uint8_t driver, int current);
223
+    void microstep_mode(uint8_t driver, uint8_t stepping);
223 224
     void microstep_readings();
224 225
 
225 226
     #if ENABLED(Z_DUAL_ENDSTOPS)
@@ -324,7 +325,6 @@ class Stepper {
324 325
     }
325 326
 
326 327
   private:
327
-    void microstep_mode(uint8_t driver, uint8_t stepping);
328 328
     void digipot_init();
329 329
     void microstep_init();
330 330
 

+ 1
- 1
Marlin/ultralcd.cpp View File

@@ -1674,7 +1674,7 @@ static void lcd_control_motion_menu() {
1674 1674
   #endif
1675 1675
   MENU_ITEM_EDIT(float51, MSG_ESTEPS, &planner.axis_steps_per_unit[E_AXIS], 5, 9999);
1676 1676
   #if ENABLED(ABORT_ON_ENDSTOP_HIT_FEATURE_ENABLED)
1677
-    MENU_ITEM_EDIT(bool, MSG_ENDSTOP_ABORT, &abort_on_endstop_hit);
1677
+    MENU_ITEM_EDIT(bool, MSG_ENDSTOP_ABORT, &stepper.abort_on_endstop_hit);
1678 1678
   #endif
1679 1679
   #if ENABLED(SCARA)
1680 1680
     MENU_ITEM_EDIT(float74, MSG_XSCALE, &axis_scaling[X_AXIS], 0.5, 2);

Loading…
Cancel
Save