Browse Source

Don't add home offsets in G29

- Address #1262 by leaving values as set
- Rename `add_homing` to `home_offset`
Scott Lahteine 10 years ago
parent
commit
691e753cc3
4 changed files with 36 additions and 45 deletions
  1. 7
    7
      Marlin/ConfigurationStore.cpp
  2. 1
    1
      Marlin/Marlin.h
  3. 27
    36
      Marlin/Marlin_main.cpp
  4. 1
    1
      Marlin/ultralcd.cpp

+ 7
- 7
Marlin/ConfigurationStore.cpp View File

@@ -18,7 +18,7 @@
18 18
  *  max_xy_jerk
19 19
  *  max_z_jerk
20 20
  *  max_e_jerk
21
- *  add_homing (x3)
21
+ *  home_offset (x3)
22 22
  *
23 23
  * Mesh bed leveling:
24 24
  *  active
@@ -136,7 +136,7 @@ void Config_StoreSettings()  {
136 136
   EEPROM_WRITE_VAR(i, max_xy_jerk);
137 137
   EEPROM_WRITE_VAR(i, max_z_jerk);
138 138
   EEPROM_WRITE_VAR(i, max_e_jerk);
139
-  EEPROM_WRITE_VAR(i, add_homing);
139
+  EEPROM_WRITE_VAR(i, home_offset);
140 140
 
141 141
   uint8_t mesh_num_x = 3;
142 142
   uint8_t mesh_num_y = 3;
@@ -294,7 +294,7 @@ void Config_RetrieveSettings() {
294 294
     EEPROM_READ_VAR(i, max_xy_jerk);
295 295
     EEPROM_READ_VAR(i, max_z_jerk);
296 296
     EEPROM_READ_VAR(i, max_e_jerk);
297
-    EEPROM_READ_VAR(i, add_homing);
297
+    EEPROM_READ_VAR(i, home_offset);
298 298
 
299 299
     uint8_t mesh_num_x = 0;
300 300
     uint8_t mesh_num_y = 0;
@@ -447,7 +447,7 @@ void Config_ResetDefault() {
447 447
   max_xy_jerk = DEFAULT_XYJERK;
448 448
   max_z_jerk = DEFAULT_ZJERK;
449 449
   max_e_jerk = DEFAULT_EJERK;
450
-  add_homing[X_AXIS] = add_homing[Y_AXIS] = add_homing[Z_AXIS] = 0;
450
+  home_offset[X_AXIS] = home_offset[Y_AXIS] = home_offset[Z_AXIS] = 0;
451 451
 
452 452
   #if defined(MESH_BED_LEVELING)
453 453
     mbl.active = 0;
@@ -607,9 +607,9 @@ void Config_PrintSettings(bool forReplay) {
607 607
     SERIAL_ECHOLNPGM("Home offset (mm):");
608 608
     SERIAL_ECHO_START;
609 609
   }
610
-  SERIAL_ECHOPAIR("  M206 X", add_homing[X_AXIS] );
611
-  SERIAL_ECHOPAIR(" Y", add_homing[Y_AXIS] );
612
-  SERIAL_ECHOPAIR(" Z", add_homing[Z_AXIS] );
610
+  SERIAL_ECHOPAIR("  M206 X", home_offset[X_AXIS] );
611
+  SERIAL_ECHOPAIR(" Y", home_offset[Y_AXIS] );
612
+  SERIAL_ECHOPAIR(" Z", home_offset[Z_AXIS] );
613 613
   SERIAL_EOL;
614 614
 
615 615
   #ifdef DELTA

+ 1
- 1
Marlin/Marlin.h View File

@@ -240,7 +240,7 @@ extern int extruder_multiply[EXTRUDERS]; // sets extrude multiply factor (in per
240 240
 extern float filament_size[EXTRUDERS]; // cross-sectional area of filament (in millimeters), typically around 1.75 or 2.85, 0 disables the volumetric calculations for the extruder.
241 241
 extern float volumetric_multiplier[EXTRUDERS]; // reciprocal of cross-sectional area of filament (in square millimeters), stored this way to reduce computational burden in planner
242 242
 extern float current_position[NUM_AXIS] ;
243
-extern float add_homing[3];
243
+extern float home_offset[3];
244 244
 #ifdef DELTA
245 245
 extern float endstop_adj[3];
246 246
 extern float delta_radius;

+ 27
- 36
Marlin/Marlin_main.cpp View File

@@ -248,7 +248,7 @@ float volumetric_multiplier[EXTRUDERS] = {1.0
248 248
   #endif
249 249
 };
250 250
 float current_position[NUM_AXIS] = { 0.0, 0.0, 0.0, 0.0 };
251
-float add_homing[3] = { 0, 0, 0 };
251
+float home_offset[3] = { 0, 0, 0 };
252 252
 #ifdef DELTA
253 253
   float endstop_adj[3] = { 0, 0, 0 };
254 254
 #endif
@@ -984,7 +984,7 @@ static int dual_x_carriage_mode = DEFAULT_DUAL_X_CARRIAGE_MODE;
984 984
 
985 985
 static float x_home_pos(int extruder) {
986 986
   if (extruder == 0)
987
-    return base_home_pos(X_AXIS) + add_homing[X_AXIS];
987
+    return base_home_pos(X_AXIS) + home_offset[X_AXIS];
988 988
   else
989 989
     // In dual carriage mode the extruder offset provides an override of the
990 990
     // second X-carriage offset when homed - otherwise X2_HOME_POS is used.
@@ -1016,9 +1016,9 @@ static void axis_is_at_home(int axis) {
1016 1016
       return;
1017 1017
     }
1018 1018
     else if (dual_x_carriage_mode == DXC_DUPLICATION_MODE && active_extruder == 0) {
1019
-      current_position[X_AXIS] = base_home_pos(X_AXIS) + add_homing[X_AXIS];
1020
-      min_pos[X_AXIS] =          base_min_pos(X_AXIS) + add_homing[X_AXIS];
1021
-      max_pos[X_AXIS] =          min(base_max_pos(X_AXIS) + add_homing[X_AXIS],
1019
+      current_position[X_AXIS] = base_home_pos(X_AXIS) + home_offset[X_AXIS];
1020
+      min_pos[X_AXIS] =          base_min_pos(X_AXIS) + home_offset[X_AXIS];
1021
+      max_pos[X_AXIS] =          min(base_max_pos(X_AXIS) + home_offset[X_AXIS],
1022 1022
                                   max(extruder_offset[X_AXIS][1], X2_MAX_POS) - duplicate_extruder_x_offset);
1023 1023
       return;
1024 1024
     }
@@ -1046,11 +1046,11 @@ static void axis_is_at_home(int axis) {
1046 1046
      
1047 1047
      for (i=0; i<2; i++)
1048 1048
      {
1049
-        delta[i] -= add_homing[i];
1049
+        delta[i] -= home_offset[i];
1050 1050
      } 
1051 1051
      
1052
-    // SERIAL_ECHOPGM("addhome X="); SERIAL_ECHO(add_homing[X_AXIS]);
1053
-  // SERIAL_ECHOPGM(" addhome Y="); SERIAL_ECHO(add_homing[Y_AXIS]);
1052
+    // SERIAL_ECHOPGM("addhome X="); SERIAL_ECHO(home_offset[X_AXIS]);
1053
+  // SERIAL_ECHOPGM(" addhome Y="); SERIAL_ECHO(home_offset[Y_AXIS]);
1054 1054
     // SERIAL_ECHOPGM(" addhome Theta="); SERIAL_ECHO(delta[X_AXIS]);
1055 1055
     // SERIAL_ECHOPGM(" addhome Psi+Theta="); SERIAL_ECHOLN(delta[Y_AXIS]);
1056 1056
       
@@ -1068,14 +1068,14 @@ static void axis_is_at_home(int axis) {
1068 1068
    } 
1069 1069
    else
1070 1070
    {
1071
-      current_position[axis] = base_home_pos(axis) + add_homing[axis];
1072
-      min_pos[axis] =          base_min_pos(axis) + add_homing[axis];
1073
-      max_pos[axis] =          base_max_pos(axis) + add_homing[axis];
1071
+      current_position[axis] = base_home_pos(axis) + home_offset[axis];
1072
+      min_pos[axis] =          base_min_pos(axis) + home_offset[axis];
1073
+      max_pos[axis] =          base_max_pos(axis) + home_offset[axis];
1074 1074
    }
1075 1075
 #else
1076
-  current_position[axis] = base_home_pos(axis) + add_homing[axis];
1077
-  min_pos[axis] =          base_min_pos(axis) + add_homing[axis];
1078
-  max_pos[axis] =          base_max_pos(axis) + add_homing[axis];
1076
+  current_position[axis] = base_home_pos(axis) + home_offset[axis];
1077
+  min_pos[axis] =          base_min_pos(axis) + home_offset[axis];
1078
+  max_pos[axis] =          base_max_pos(axis) + home_offset[axis];
1079 1079
 #endif
1080 1080
 }
1081 1081
 
@@ -1858,7 +1858,7 @@ inline void gcode_G28() {
1858 1858
       if (code_value_long() != 0) {
1859 1859
           current_position[X_AXIS] = code_value()
1860 1860
             #ifndef SCARA
1861
-              + add_homing[X_AXIS]
1861
+              + home_offset[X_AXIS]
1862 1862
             #endif
1863 1863
           ;
1864 1864
       }
@@ -1867,7 +1867,7 @@ inline void gcode_G28() {
1867 1867
     if (code_seen(axis_codes[Y_AXIS]) && code_value_long() != 0) {
1868 1868
       current_position[Y_AXIS] = code_value()
1869 1869
         #ifndef SCARA
1870
-          + add_homing[Y_AXIS]
1870
+          + home_offset[Y_AXIS]
1871 1871
         #endif
1872 1872
       ;
1873 1873
     }
@@ -1941,7 +1941,7 @@ inline void gcode_G28() {
1941 1941
 
1942 1942
 
1943 1943
     if (code_seen(axis_codes[Z_AXIS]) && code_value_long() != 0)
1944
-      current_position[Z_AXIS] = code_value() + add_homing[Z_AXIS];
1944
+      current_position[Z_AXIS] = code_value() + home_offset[Z_AXIS];
1945 1945
 
1946 1946
     #ifdef ENABLE_AUTO_BED_LEVELING
1947 1947
       if (home_all_axis || code_seen(axis_codes[Z_AXIS]))
@@ -2512,22 +2512,13 @@ inline void gcode_G92() {
2512 2512
   if (!code_seen(axis_codes[E_AXIS]))
2513 2513
     st_synchronize();
2514 2514
 
2515
-  for (int i=0;i<NUM_AXIS;i++) {
2515
+  for (int i = 0; i < NUM_AXIS; i++) {
2516 2516
     if (code_seen(axis_codes[i])) {
2517
-      if (i == E_AXIS) {
2518
-        current_position[i] = code_value();
2517
+      current_position[i] = code_value();
2518
+      if (i == E_AXIS)
2519 2519
         plan_set_e_position(current_position[E_AXIS]);
2520
-      }
2521
-      else {
2522
-        current_position[i] = code_value() +
2523
-          #ifdef SCARA
2524
-            ((i != X_AXIS && i != Y_AXIS) ? add_homing[i] : 0)
2525
-          #else
2526
-            add_homing[i]
2527
-          #endif
2528
-        ;
2520
+      else
2529 2521
         plan_set_position(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS]);
2530
-      }
2531 2522
     }
2532 2523
   }
2533 2524
 }
@@ -3464,9 +3455,9 @@ inline void gcode_M114() {
3464 3455
     SERIAL_PROTOCOLLN("");
3465 3456
     
3466 3457
     SERIAL_PROTOCOLPGM("SCARA Cal - Theta:");
3467
-    SERIAL_PROTOCOL(delta[X_AXIS]+add_homing[X_AXIS]);
3458
+    SERIAL_PROTOCOL(delta[X_AXIS]+home_offset[X_AXIS]);
3468 3459
     SERIAL_PROTOCOLPGM("   Psi+Theta (90):");
3469
-    SERIAL_PROTOCOL(delta[Y_AXIS]-delta[X_AXIS]-90+add_homing[Y_AXIS]);
3460
+    SERIAL_PROTOCOL(delta[Y_AXIS]-delta[X_AXIS]-90+home_offset[Y_AXIS]);
3470 3461
     SERIAL_PROTOCOLLN("");
3471 3462
     
3472 3463
     SERIAL_PROTOCOLPGM("SCARA step Cal - Theta:");
@@ -3684,12 +3675,12 @@ inline void gcode_M205() {
3684 3675
 inline void gcode_M206() {
3685 3676
   for (int8_t i=X_AXIS; i <= Z_AXIS; i++) {
3686 3677
     if (code_seen(axis_codes[i])) {
3687
-      add_homing[i] = code_value();
3678
+      home_offset[i] = code_value();
3688 3679
     }
3689 3680
   }
3690 3681
   #ifdef SCARA
3691
-    if (code_seen('T')) add_homing[X_AXIS] = code_value(); // Theta
3692
-    if (code_seen('P')) add_homing[Y_AXIS] = code_value(); // Psi
3682
+    if (code_seen('T')) home_offset[X_AXIS] = code_value(); // Theta
3683
+    if (code_seen('P')) home_offset[Y_AXIS] = code_value(); // Psi
3693 3684
   #endif
3694 3685
 }
3695 3686
 
@@ -5287,7 +5278,7 @@ void clamp_to_software_endstops(float target[3])
5287 5278
     float negative_z_offset = 0;
5288 5279
     #ifdef ENABLE_AUTO_BED_LEVELING
5289 5280
       if (Z_PROBE_OFFSET_FROM_EXTRUDER < 0) negative_z_offset = negative_z_offset + Z_PROBE_OFFSET_FROM_EXTRUDER;
5290
-      if (add_homing[Z_AXIS] < 0) negative_z_offset = negative_z_offset + add_homing[Z_AXIS];
5281
+      if (home_offset[Z_AXIS] < 0) negative_z_offset = negative_z_offset + home_offset[Z_AXIS];
5291 5282
     #endif
5292 5283
     
5293 5284
     if (target[Z_AXIS] < min_pos[Z_AXIS]+negative_z_offset) target[Z_AXIS] = min_pos[Z_AXIS]+negative_z_offset;

+ 1
- 1
Marlin/ultralcd.cpp View File

@@ -437,7 +437,7 @@ static void lcd_main_menu() {
437 437
 void lcd_set_home_offsets() {
438 438
   for(int8_t i=0; i < NUM_AXIS; i++) {
439 439
     if (i != E_AXIS) {
440
-      add_homing[i] -= current_position[i];
440
+      home_offset[i] -= current_position[i];
441 441
       current_position[i] = 0.0;
442 442
     }
443 443
   }

Loading…
Cancel
Save