Browse Source

Rename delta_grid spacing for general nonlinear

Scott Lahteine 8 years ago
parent
commit
acd1b6e9c0
2 changed files with 16 additions and 14 deletions
  1. 5
    4
      Marlin/Marlin.h
  2. 11
    10
      Marlin/Marlin_main.cpp

+ 5
- 4
Marlin/Marlin.h View File

313
   extern float delta_diagonal_rod_trim_tower_3;
313
   extern float delta_diagonal_rod_trim_tower_3;
314
   void inverse_kinematics(const float cartesian[XYZ]);
314
   void inverse_kinematics(const float cartesian[XYZ]);
315
   void recalc_delta_settings(float radius, float diagonal_rod);
315
   void recalc_delta_settings(float radius, float diagonal_rod);
316
-  #if ENABLED(AUTO_BED_LEVELING_FEATURE)
317
-    extern int delta_grid_spacing[2];
318
-    void adjust_delta(float cartesian[XYZ]);
319
-  #endif
320
 #elif IS_SCARA
316
 #elif IS_SCARA
321
   extern float delta[ABC];
317
   extern float delta[ABC];
322
   extern float axis_scaling[ABC];  // Build size scaling
318
   extern float axis_scaling[ABC];  // Build size scaling
324
   void forward_kinematics_SCARA(float f_scara[ABC]);
320
   void forward_kinematics_SCARA(float f_scara[ABC]);
325
 #endif
321
 #endif
326
 
322
 
323
+#if ENABLED(AUTO_BED_LEVELING_NONLINEAR)
324
+  extern int nonlinear_grid_spacing[2];
325
+  void adjust_delta(float cartesian[XYZ]);
326
+#endif
327
+
327
 #if ENABLED(Z_DUAL_ENDSTOPS)
328
 #if ENABLED(Z_DUAL_ENDSTOPS)
328
   extern float z_endstop_adj;
329
   extern float z_endstop_adj;
329
 #endif
330
 #endif

+ 11
- 10
Marlin/Marlin_main.cpp View File

486
         delta_segments_per_second = DELTA_SEGMENTS_PER_SECOND,
486
         delta_segments_per_second = DELTA_SEGMENTS_PER_SECOND,
487
         delta_clip_start_height = Z_MAX_POS;
487
         delta_clip_start_height = Z_MAX_POS;
488
 
488
 
489
-  #if ENABLED(AUTO_BED_LEVELING_FEATURE)
490
-    int delta_grid_spacing[2] = { 0, 0 };
491
-    float bed_level[AUTO_BED_LEVELING_GRID_POINTS][AUTO_BED_LEVELING_GRID_POINTS];
492
-  #endif
493
-
494
   float delta_safe_distance_from_top();
489
   float delta_safe_distance_from_top();
495
   void set_cartesian_from_steppers();
490
   void set_cartesian_from_steppers();
496
 
491
 
500
 
495
 
501
 #endif
496
 #endif
502
 
497
 
498
+#if ENABLED(AUTO_BED_LEVELING_NONLINEAR)
499
+  int nonlinear_grid_spacing[2] = { 0 };
500
+  float bed_level[AUTO_BED_LEVELING_GRID_POINTS][AUTO_BED_LEVELING_GRID_POINTS];
501
+#endif
502
+
503
 #if IS_SCARA
503
 #if IS_SCARA
504
   // Float constants for SCARA calculations
504
   // Float constants for SCARA calculations
505
   const float L1 = SCARA_LINKAGE_1, L2 = SCARA_LINKAGE_2,
505
   const float L1 = SCARA_LINKAGE_1, L2 = SCARA_LINKAGE_2,
3442
                   yGridSpacing = (back_probe_bed_position - front_probe_bed_position) / (auto_bed_leveling_grid_points - 1);
3442
                   yGridSpacing = (back_probe_bed_position - front_probe_bed_position) / (auto_bed_leveling_grid_points - 1);
3443
 
3443
 
3444
       #if ENABLED(AUTO_BED_LEVELING_NONLINEAR)
3444
       #if ENABLED(AUTO_BED_LEVELING_NONLINEAR)
3445
-        delta_grid_spacing[X_AXIS] = xGridSpacing;
3446
-        delta_grid_spacing[Y_AXIS] = yGridSpacing;
3445
+
3446
+        nonlinear_grid_spacing[X_AXIS] = xGridSpacing;
3447
+        nonlinear_grid_spacing[Y_AXIS] = yGridSpacing;
3447
         float zoffset = zprobe_zoffset;
3448
         float zoffset = zprobe_zoffset;
3448
         if (code_seen('Z')) zoffset += code_value_axis_units(Z_AXIS);
3449
         if (code_seen('Z')) zoffset += code_value_axis_units(Z_AXIS);
3449
 
3450
 
7803
 
7804
 
7804
     // Adjust print surface height by linear interpolation over the bed_level array.
7805
     // Adjust print surface height by linear interpolation over the bed_level array.
7805
     void adjust_delta(float cartesian[XYZ]) {
7806
     void adjust_delta(float cartesian[XYZ]) {
7806
-      if (delta_grid_spacing[X_AXIS] == 0 || delta_grid_spacing[Y_AXIS] == 0) return; // G29 not done!
7807
+      if (nonlinear_grid_spacing[X_AXIS] == 0 || nonlinear_grid_spacing[Y_AXIS] == 0) return; // G29 not done!
7807
 
7808
 
7808
       int half = (AUTO_BED_LEVELING_GRID_POINTS - 1) / 2;
7809
       int half = (AUTO_BED_LEVELING_GRID_POINTS - 1) / 2;
7809
       float h1 = 0.001 - half, h2 = half - 0.001,
7810
       float h1 = 0.001 - half, h2 = half - 0.001,
7810
-            grid_x = max(h1, min(h2, RAW_X_POSITION(cartesian[X_AXIS]) / delta_grid_spacing[X_AXIS])),
7811
-            grid_y = max(h1, min(h2, RAW_Y_POSITION(cartesian[Y_AXIS]) / delta_grid_spacing[Y_AXIS]));
7811
+            grid_x = max(h1, min(h2, RAW_X_POSITION(cartesian[X_AXIS]) / nonlinear_grid_spacing[X_AXIS])),
7812
+            grid_y = max(h1, min(h2, RAW_Y_POSITION(cartesian[Y_AXIS]) / nonlinear_grid_spacing[Y_AXIS]));
7812
       int floor_x = floor(grid_x), floor_y = floor(grid_y);
7813
       int floor_x = floor(grid_x), floor_y = floor(grid_y);
7813
       float ratio_x = grid_x - floor_x, ratio_y = grid_y - floor_y,
7814
       float ratio_x = grid_x - floor_x, ratio_y = grid_y - floor_y,
7814
             z1 = bed_level[floor_x + half][floor_y + half],
7815
             z1 = bed_level[floor_x + half][floor_y + half],

Loading…
Cancel
Save