Browse Source

Pending refactor tweaks

Scott Lahteine 5 years ago
parent
commit
d63e0f6d98

+ 1
- 4
Marlin/src/core/serial.cpp View File

@@ -70,10 +70,7 @@ void print_bin(const uint16_t val) {
70 70
 
71 71
 void print_xyz(PGM_P const prefix, PGM_P const suffix, const float &x, const float &y, const float &z) {
72 72
   serialprintPGM(prefix);
73
-  SERIAL_CHAR('(');
74
-  SERIAL_ECHO(x);
75
-  SERIAL_ECHOPAIR(", ", y, ", ", z);
76
-  SERIAL_CHAR(')');
73
+  SERIAL_ECHOPAIR(" " MSG_X, x, " " MSG_Y, y, " " MSG_Z, z);
77 74
   if (suffix) serialprintPGM(suffix); else SERIAL_EOL();
78 75
 }
79 76
 

+ 12
- 12
Marlin/src/feature/babystep.cpp View File

@@ -35,7 +35,7 @@
35 35
 
36 36
 Babystep babystep;
37 37
 
38
-volatile int16_t Babystep::todo[BS_TODO_AXIS(Z_AXIS) + 1];
38
+volatile int16_t Babystep::steps[BS_TODO_AXIS(Z_AXIS) + 1];
39 39
 
40 40
 #if HAS_LCD_MENU || ENABLED(EXTENSIBLE_UI)
41 41
   int16_t Babystep::accum;
@@ -45,10 +45,10 @@ volatile int16_t Babystep::todo[BS_TODO_AXIS(Z_AXIS) + 1];
45 45
 #endif
46 46
 
47 47
 void Babystep::step_axis(const AxisEnum axis) {
48
-  const int16_t curTodo = todo[BS_TODO_AXIS(axis)]; // get rid of volatile for performance
48
+  const int16_t curTodo = steps[BS_TODO_AXIS(axis)]; // get rid of volatile for performance
49 49
   if (curTodo) {
50 50
     stepper.babystep((AxisEnum)axis, curTodo > 0);
51
-    if (curTodo > 0) todo[BS_TODO_AXIS(axis)]--; else todo[BS_TODO_AXIS(axis)]++;
51
+    if (curTodo > 0) steps[BS_TODO_AXIS(axis)]--; else steps[BS_TODO_AXIS(axis)]++;
52 52
   }
53 53
 }
54 54
 
@@ -94,30 +94,30 @@ void Babystep::add_steps(const AxisEnum axis, const int16_t distance) {
94 94
         case CORE_AXIS_1: // X on CoreXY and CoreXZ, Y on CoreYZ
95 95
           BSA_ENABLE(CORE_AXIS_1);
96 96
           BSA_ENABLE(CORE_AXIS_2);
97
-          todo[CORE_AXIS_1] += distance * 2;
98
-          todo[CORE_AXIS_2] += distance * 2;
97
+          steps[CORE_AXIS_1] += distance * 2;
98
+          steps[CORE_AXIS_2] += distance * 2;
99 99
           break;
100 100
         case CORE_AXIS_2: // Y on CoreXY, Z on CoreXZ and CoreYZ
101 101
           BSA_ENABLE(CORE_AXIS_1);
102 102
           BSA_ENABLE(CORE_AXIS_2);
103
-          todo[CORE_AXIS_1] += CORESIGN(distance * 2);
104
-          todo[CORE_AXIS_2] -= CORESIGN(distance * 2);
103
+          steps[CORE_AXIS_1] += CORESIGN(distance * 2);
104
+          steps[CORE_AXIS_2] -= CORESIGN(distance * 2);
105 105
           break;
106 106
         case NORMAL_AXIS: // Z on CoreXY, Y on CoreXZ, X on CoreYZ
107 107
         default:
108 108
           BSA_ENABLE(NORMAL_AXIS);
109
-          todo[NORMAL_AXIS] += distance;
109
+          steps[NORMAL_AXIS] += distance;
110 110
           break;
111 111
       }
112 112
     #elif CORE_IS_XZ || CORE_IS_YZ
113 113
       // Only Z stepping needs to be handled here
114 114
       BSA_ENABLE(CORE_AXIS_1);
115 115
       BSA_ENABLE(CORE_AXIS_2);
116
-      todo[CORE_AXIS_1] += CORESIGN(distance * 2);
117
-      todo[CORE_AXIS_2] -= CORESIGN(distance * 2);
116
+      steps[CORE_AXIS_1] += CORESIGN(distance * 2);
117
+      steps[CORE_AXIS_2] -= CORESIGN(distance * 2);
118 118
     #else
119 119
       BSA_ENABLE(Z_AXIS);
120
-      todo[Z_AXIS] += distance;
120
+      steps[Z_AXIS] += distance;
121 121
     #endif
122 122
   #else
123 123
     #if ENABLED(BABYSTEP_XY)
@@ -125,7 +125,7 @@ void Babystep::add_steps(const AxisEnum axis, const int16_t distance) {
125 125
     #else
126 126
       BSA_ENABLE(Z_AXIS);
127 127
     #endif
128
-    todo[BS_TODO_AXIS(axis)] += distance;
128
+    steps[BS_TODO_AXIS(axis)] += distance;
129 129
   #endif
130 130
   #if ENABLED(BABYSTEP_ALWAYS_AVAILABLE)
131 131
     gcode.reset_stepper_timeout();

+ 11
- 5
Marlin/src/feature/babystep.h View File

@@ -40,19 +40,25 @@
40 40
 
41 41
 class Babystep {
42 42
 public:
43
-  static volatile int16_t todo[BS_TODO_AXIS(Z_AXIS) + 1];
43
+  static volatile int16_t steps[BS_TODO_AXIS(Z_AXIS) + 1];
44
+
44 45
   #if HAS_LCD_MENU || ENABLED(EXTENSIBLE_UI)
46
+
45 47
     static int16_t accum;                                     // Total babysteps in current edit
48
+
46 49
     #if ENABLED(BABYSTEP_DISPLAY_TOTAL)
47 50
       static int16_t axis_total[BS_TOTAL_AXIS(Z_AXIS) + 1];   // Total babysteps since G28
48 51
       static inline void reset_total(const AxisEnum axis) {
49
-        #if ENABLED(BABYSTEP_XY)
50
-          if (axis == Z_AXIS)
51
-        #endif
52
-            axis_total[BS_TOTAL_AXIS(axis)] = 0;
52
+        if (true
53
+          #if ENABLED(BABYSTEP_XY)
54
+            && axis == Z_AXIS
55
+          #endif
56
+        ) axis_total[BS_TOTAL_AXIS(axis)] = 0;
53 57
       }
54 58
     #endif
59
+
55 60
   #endif
61
+
56 62
   static void add_steps(const AxisEnum axis, const int16_t distance);
57 63
   static void add_mm(const AxisEnum axis, const float &mm);
58 64
   static void task();

+ 6
- 10
Marlin/src/module/stepper.h View File

@@ -43,6 +43,12 @@
43 43
 
44 44
 #include "../inc/MarlinConfig.h"
45 45
 
46
+#include "planner.h"
47
+#include "stepper/indirection.h"
48
+#ifdef __AVR__
49
+  #include "speed_lookuptable.h"
50
+#endif
51
+
46 52
 // Disable multiple steps per ISR
47 53
 //#define DISABLE_MULTI_STEPPING
48 54
 
@@ -217,16 +223,6 @@
217 223
 //
218 224
 // Stepper class definition
219 225
 //
220
-
221
-#include "stepper/indirection.h"
222
-
223
-#ifdef __AVR__
224
-  #include "speed_lookuptable.h"
225
-#endif
226
-
227
-#include "planner.h"
228
-#include "../core/language.h"
229
-
230 226
 class Stepper {
231 227
 
232 228
   public:

+ 3
- 1
buildroot/share/tests/megaatmega1280-tests View File

@@ -16,7 +16,9 @@ set -e
16 16
 # Test MESH_BED_LEVELING feature, with LCD
17 17
 #
18 18
 restore_configs
19
-opt_enable SPINDLE_FEATURE MESH_BED_LEVELING G26_MESH_VALIDATION MESH_G28_REST_ORIGIN LCD_BED_LEVELING MESH_EDIT_MENU ULTIMAKERCONTROLLER
19
+opt_enable SPINDLE_FEATURE ULTIMAKERCONTROLLER LCD_BED_LEVELING \
20
+           MESH_BED_LEVELING ENABLE_LEVELING_FADE_HEIGHT MESH_G28_REST_ORIGIN \
21
+           G26_MESH_VALIDATION MESH_EDIT_MENU
20 22
 exec_test $1 $2 "Spindle, MESH_BED_LEVELING, and LCD"
21 23
 
22 24
 

Loading…
Cancel
Save