Use COPY_XYZE macro to copy exactly 4 elements (#6758)

Fix undefined DELTA_PROBEABLE_RADIUS for UBL_DELTA
This commit is contained in:
oldmcg 2017-05-16 11:47:51 -05:00 committed by Roxy-3D
parent 8606644343
commit 5a9e52a3e0
2 changed files with 17 additions and 6 deletions

View File

@ -818,7 +818,7 @@
#endif #endif
/** /**
* DELTA_SEGMENT_MIN_LENGTH for UBL_DELTA * DELTA_SEGMENT_MIN_LENGTH and DELTA_PROBEABLE_RADIUS for UBL_DELTA
*/ */
#if UBL_DELTA #if UBL_DELTA
#ifndef DELTA_SEGMENT_MIN_LENGTH #ifndef DELTA_SEGMENT_MIN_LENGTH
@ -830,6 +830,9 @@
#define DELTA_SEGMENT_MIN_LENGTH 1.00 // mm (similar to G2/G3 arc segmentation) #define DELTA_SEGMENT_MIN_LENGTH 1.00 // mm (similar to G2/G3 arc segmentation)
#endif #endif
#endif #endif
#ifndef DELTA_PROBEABLE_RADIUS
#define DELTA_PROBEABLE_RADIUS DELTA_PRINTABLE_RADIUS
#endif
#endif #endif
// Shorthand // Shorthand

View File

@ -457,6 +457,14 @@
#if UBL_DELTA #if UBL_DELTA
// macro to inline copy exactly 4 floats, don't rely on sizeof operator
#define COPY_XYZE( target, source ) { \
target[X_AXIS] = source[X_AXIS]; \
target[Y_AXIS] = source[Y_AXIS]; \
target[Z_AXIS] = source[Z_AXIS]; \
target[E_AXIS] = source[E_AXIS]; \
}
#if IS_SCARA // scale the feed rate from mm/s to degrees/s #if IS_SCARA // scale the feed rate from mm/s to degrees/s
static float scara_feed_factor, scara_oldA, scara_oldB; static float scara_feed_factor, scara_oldA, scara_oldB;
#endif #endif
@ -550,8 +558,8 @@
const float z_offset = ubl.state.active ? ubl.state.z_offset : 0.0; const float z_offset = ubl.state.active ? ubl.state.z_offset : 0.0;
float seg_dest[XYZE]; // per-segment destination, float seg_dest[XYZE]; // per-segment destination,
COPY(seg_dest, current_position); // starting from current position COPY_XYZE(seg_dest, current_position); // starting from current position
while (--segments) { while (--segments) {
LOOP_XYZE(i) seg_dest[i] += segment_distance[i]; LOOP_XYZE(i) seg_dest[i] += segment_distance[i];
@ -562,7 +570,7 @@
} }
// Since repeated adding segment_distance accumulates small errors, final move to exact destination. // Since repeated adding segment_distance accumulates small errors, final move to exact destination.
COPY(seg_dest, ltarget); COPY_XYZE(seg_dest, ltarget);
seg_dest[Z_AXIS] += z_offset; seg_dest[Z_AXIS] += z_offset;
ubl_buffer_line_segment(seg_dest, feedrate, active_extruder); ubl_buffer_line_segment(seg_dest, feedrate, active_extruder);
return false; // moved but did not set_current_to_destination(); return false; // moved but did not set_current_to_destination();
@ -645,7 +653,7 @@
z_cxcy += ubl.state.z_offset; // add fixed mesh offset from G29 Z z_cxcy += ubl.state.z_offset; // add fixed mesh offset from G29 Z
if (--segments == 0) { // if this is last segment, use ltarget for exact if (--segments == 0) { // if this is last segment, use ltarget for exact
COPY(seg_dest, ltarget); COPY_XYZE(seg_dest, ltarget);
seg_dest[Z_AXIS] += z_cxcy; seg_dest[Z_AXIS] += z_cxcy;
ubl_buffer_line_segment(seg_dest, feedrate, active_extruder); ubl_buffer_line_segment(seg_dest, feedrate, active_extruder);
return false; // did not set_current_to_destination() return false; // did not set_current_to_destination()