Browse Source

Clear up HAS_WORKSPACE_OFFSET meaning

Scott Lahteine 6 years ago
parent
commit
2c9586be0c
3 changed files with 20 additions and 26 deletions
  1. 5
    5
      Marlin/src/inc/Conditionals_post.h
  2. 13
    15
      Marlin/src/module/motion.cpp
  3. 2
    6
      Marlin/src/module/motion.h

+ 5
- 5
Marlin/src/inc/Conditionals_post.h View File

1527
 // Updated G92 behavior shifts the workspace
1527
 // Updated G92 behavior shifts the workspace
1528
 #define HAS_POSITION_SHIFT DISABLED(NO_WORKSPACE_OFFSETS)
1528
 #define HAS_POSITION_SHIFT DISABLED(NO_WORKSPACE_OFFSETS)
1529
 // The home offset also shifts the coordinate space
1529
 // The home offset also shifts the coordinate space
1530
-#define HAS_HOME_OFFSET (DISABLED(NO_WORKSPACE_OFFSETS) && DISABLED(DELTA))
1531
-// Either offset yields extra calculations on all moves
1532
-#define HAS_WORKSPACE_OFFSET (HAS_POSITION_SHIFT || HAS_HOME_OFFSET)
1533
-// M206 doesn't apply to DELTA
1534
-#define HAS_M206_COMMAND (HAS_HOME_OFFSET && DISABLED(DELTA))
1530
+#define HAS_HOME_OFFSET (DISABLED(NO_WORKSPACE_OFFSETS) && (IS_SCARA || IS_CARTESIAN))
1531
+// Cumulative offset to workspace to save some calculation
1532
+#define HAS_WORKSPACE_OFFSET (HAS_POSITION_SHIFT && HAS_HOME_OFFSET)
1533
+// M206 sets the home offset for Cartesian machines
1534
+#define HAS_M206_COMMAND (HAS_HOME_OFFSET && !IS_SCARA)
1535
 
1535
 
1536
 // LCD timeout to status screen default is 15s
1536
 // LCD timeout to status screen default is 15s
1537
 #ifndef LCD_TIMEOUT_TO_STATUS
1537
 #ifndef LCD_TIMEOUT_TO_STATUS

+ 13
- 15
Marlin/src/module/motion.cpp View File

138
  * The workspace can be offset by some commands, or
138
  * The workspace can be offset by some commands, or
139
  * these offsets may be omitted to save on computation.
139
  * these offsets may be omitted to save on computation.
140
  */
140
  */
141
-#if HAS_WORKSPACE_OFFSET
142
-  #if HAS_POSITION_SHIFT
143
-    // The distance that XYZ has been offset by G92. Reset by G28.
144
-    float position_shift[XYZ] = { 0 };
145
-  #endif
146
-  #if HAS_HOME_OFFSET
147
-    // This offset is added to the configured home position.
148
-    // Set by M206, M428, or menu item. Saved to EEPROM.
149
-    float home_offset[XYZ] = { 0 };
150
-  #endif
151
-  #if HAS_HOME_OFFSET && HAS_POSITION_SHIFT
152
-    // The above two are combined to save on computes
153
-    float workspace_offset[XYZ] = { 0 };
154
-  #endif
141
+#if HAS_POSITION_SHIFT
142
+  // The distance that XYZ has been offset by G92. Reset by G28.
143
+  float position_shift[XYZ] = { 0 };
144
+#endif
145
+#if HAS_HOME_OFFSET
146
+  // This offset is added to the configured home position.
147
+  // Set by M206, M428, or menu item. Saved to EEPROM.
148
+  float home_offset[XYZ] = { 0 };
149
+#endif
150
+#if HAS_HOME_OFFSET && HAS_POSITION_SHIFT
151
+  // The above two are combined to save on computes
152
+  float workspace_offset[XYZ] = { 0 };
155
 #endif
153
 #endif
156
 
154
 
157
 #if OLDSCHOOL_ABL
155
 #if OLDSCHOOL_ABL
1518
    * at the same positions relative to the machine.
1516
    * at the same positions relative to the machine.
1519
    */
1517
    */
1520
   void update_software_endstops(const AxisEnum axis) {
1518
   void update_software_endstops(const AxisEnum axis) {
1521
-    #if HAS_HOME_OFFSET && HAS_POSITION_SHIFT
1519
+    #if HAS_HOME_OFFSET
1522
       workspace_offset[axis] = home_offset[axis] + position_shift[axis];
1520
       workspace_offset[axis] = home_offset[axis] + position_shift[axis];
1523
     #endif
1521
     #endif
1524
 
1522
 

+ 2
- 6
Marlin/src/module/motion.h View File

211
   void sensorless_homing_per_axis(const AxisEnum axis, const bool enable=true);
211
   void sensorless_homing_per_axis(const AxisEnum axis, const bool enable=true);
212
 #endif
212
 #endif
213
 
213
 
214
-//
215
-// Macros
216
-//
217
-
218
 /**
214
 /**
219
  * Workspace offsets
215
  * Workspace offsets
220
  */
216
  */
221
-#if HAS_WORKSPACE_OFFSET
217
+#if HAS_HOME_OFFSET || HAS_POSITION_SHIFT
222
   #if HAS_HOME_OFFSET
218
   #if HAS_HOME_OFFSET
223
     extern float home_offset[XYZ];
219
     extern float home_offset[XYZ];
224
   #endif
220
   #endif
230
     #define WORKSPACE_OFFSET(AXIS) workspace_offset[AXIS]
226
     #define WORKSPACE_OFFSET(AXIS) workspace_offset[AXIS]
231
   #elif HAS_HOME_OFFSET
227
   #elif HAS_HOME_OFFSET
232
     #define WORKSPACE_OFFSET(AXIS) home_offset[AXIS]
228
     #define WORKSPACE_OFFSET(AXIS) home_offset[AXIS]
233
-  #elif HAS_POSITION_SHIFT
229
+  #else
234
     #define WORKSPACE_OFFSET(AXIS) position_shift[AXIS]
230
     #define WORKSPACE_OFFSET(AXIS) position_shift[AXIS]
235
   #endif
231
   #endif
236
   #define NATIVE_TO_LOGICAL(POS, AXIS) ((POS) + WORKSPACE_OFFSET(AXIS))
232
   #define NATIVE_TO_LOGICAL(POS, AXIS) ((POS) + WORKSPACE_OFFSET(AXIS))

Loading…
Cancel
Save