Rename delta_grid spacing for general nonlinear

This commit is contained in:
Scott Lahteine 2016-09-11 20:56:16 -05:00
parent c5fa70809b
commit acd1b6e9c0
2 changed files with 16 additions and 14 deletions

View File

@ -313,10 +313,6 @@ float code_value_temp_diff();
extern float delta_diagonal_rod_trim_tower_3;
void inverse_kinematics(const float cartesian[XYZ]);
void recalc_delta_settings(float radius, float diagonal_rod);
#if ENABLED(AUTO_BED_LEVELING_FEATURE)
extern int delta_grid_spacing[2];
void adjust_delta(float cartesian[XYZ]);
#endif
#elif IS_SCARA
extern float delta[ABC];
extern float axis_scaling[ABC]; // Build size scaling
@ -324,6 +320,11 @@ float code_value_temp_diff();
void forward_kinematics_SCARA(float f_scara[ABC]);
#endif
#if ENABLED(AUTO_BED_LEVELING_NONLINEAR)
extern int nonlinear_grid_spacing[2];
void adjust_delta(float cartesian[XYZ]);
#endif
#if ENABLED(Z_DUAL_ENDSTOPS)
extern float z_endstop_adj;
#endif

View File

@ -486,11 +486,6 @@ static uint8_t target_extruder;
delta_segments_per_second = DELTA_SEGMENTS_PER_SECOND,
delta_clip_start_height = Z_MAX_POS;
#if ENABLED(AUTO_BED_LEVELING_FEATURE)
int delta_grid_spacing[2] = { 0, 0 };
float bed_level[AUTO_BED_LEVELING_GRID_POINTS][AUTO_BED_LEVELING_GRID_POINTS];
#endif
float delta_safe_distance_from_top();
void set_cartesian_from_steppers();
@ -500,6 +495,11 @@ static uint8_t target_extruder;
#endif
#if ENABLED(AUTO_BED_LEVELING_NONLINEAR)
int nonlinear_grid_spacing[2] = { 0 };
float bed_level[AUTO_BED_LEVELING_GRID_POINTS][AUTO_BED_LEVELING_GRID_POINTS];
#endif
#if IS_SCARA
// Float constants for SCARA calculations
const float L1 = SCARA_LINKAGE_1, L2 = SCARA_LINKAGE_2,
@ -3442,8 +3442,9 @@ inline void gcode_G28() {
yGridSpacing = (back_probe_bed_position - front_probe_bed_position) / (auto_bed_leveling_grid_points - 1);
#if ENABLED(AUTO_BED_LEVELING_NONLINEAR)
delta_grid_spacing[X_AXIS] = xGridSpacing;
delta_grid_spacing[Y_AXIS] = yGridSpacing;
nonlinear_grid_spacing[X_AXIS] = xGridSpacing;
nonlinear_grid_spacing[Y_AXIS] = yGridSpacing;
float zoffset = zprobe_zoffset;
if (code_seen('Z')) zoffset += code_value_axis_units(Z_AXIS);
@ -7803,12 +7804,12 @@ void ok_to_send() {
// Adjust print surface height by linear interpolation over the bed_level array.
void adjust_delta(float cartesian[XYZ]) {
if (delta_grid_spacing[X_AXIS] == 0 || delta_grid_spacing[Y_AXIS] == 0) return; // G29 not done!
if (nonlinear_grid_spacing[X_AXIS] == 0 || nonlinear_grid_spacing[Y_AXIS] == 0) return; // G29 not done!
int half = (AUTO_BED_LEVELING_GRID_POINTS - 1) / 2;
float h1 = 0.001 - half, h2 = half - 0.001,
grid_x = max(h1, min(h2, RAW_X_POSITION(cartesian[X_AXIS]) / delta_grid_spacing[X_AXIS])),
grid_y = max(h1, min(h2, RAW_Y_POSITION(cartesian[Y_AXIS]) / delta_grid_spacing[Y_AXIS]));
grid_x = max(h1, min(h2, RAW_X_POSITION(cartesian[X_AXIS]) / nonlinear_grid_spacing[X_AXIS])),
grid_y = max(h1, min(h2, RAW_Y_POSITION(cartesian[Y_AXIS]) / nonlinear_grid_spacing[Y_AXIS]));
int floor_x = floor(grid_x), floor_y = floor(grid_y);
float ratio_x = grid_x - floor_x, ratio_y = grid_y - floor_y,
z1 = bed_level[floor_x + half][floor_y + half],