ソースを参照

Merge pull request #3577 from thinkyhead/rc_fix_G92_set_e_twice

Fix G92 setting E twice
Scott Lahteine 9年前
コミット
cfd10fcba1
1個のファイルの変更13行の追加11行の削除
  1. 13
    11
      Marlin/Marlin_main.cpp

+ 13
- 11
Marlin/Marlin_main.cpp ファイルの表示

1427
   #endif
1427
   #endif
1428
   plan_set_position(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS]);
1428
   plan_set_position(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS]);
1429
 }
1429
 }
1430
+inline void sync_plan_position_e() { plan_set_e_position(current_position[E_AXIS]); }
1430
 inline void set_current_to_destination() { memcpy(current_position, destination, sizeof(current_position)); }
1431
 inline void set_current_to_destination() { memcpy(current_position, destination, sizeof(current_position)); }
1431
 inline void set_destination_to_current() { memcpy(destination, current_position, sizeof(destination)); }
1432
 inline void set_destination_to_current() { memcpy(destination, current_position, sizeof(destination)); }
1432
 
1433
 
2320
 
2321
 
2321
       feedrate = retract_feedrate * 60;
2322
       feedrate = retract_feedrate * 60;
2322
       current_position[E_AXIS] += (swapping ? retract_length_swap : retract_length) / volumetric_multiplier[active_extruder];
2323
       current_position[E_AXIS] += (swapping ? retract_length_swap : retract_length) / volumetric_multiplier[active_extruder];
2323
-      plan_set_e_position(current_position[E_AXIS]);
2324
+      sync_plan_position_e();
2324
       prepare_move();
2325
       prepare_move();
2325
 
2326
 
2326
       if (retract_zlift > 0.01) {
2327
       if (retract_zlift > 0.01) {
2348
       feedrate = retract_recover_feedrate * 60;
2349
       feedrate = retract_recover_feedrate * 60;
2349
       float move_e = swapping ? retract_length_swap + retract_recover_length_swap : retract_length + retract_recover_length;
2350
       float move_e = swapping ? retract_length_swap + retract_recover_length_swap : retract_length + retract_recover_length;
2350
       current_position[E_AXIS] -= move_e / volumetric_multiplier[active_extruder];
2351
       current_position[E_AXIS] -= move_e / volumetric_multiplier[active_extruder];
2351
-      plan_set_e_position(current_position[E_AXIS]);
2352
+      sync_plan_position_e();
2352
       prepare_move();
2353
       prepare_move();
2353
     }
2354
     }
2354
 
2355
 
2439
         // Is this move an attempt to retract or recover?
2440
         // Is this move an attempt to retract or recover?
2440
         if ((echange < -MIN_RETRACT && !retracted[active_extruder]) || (echange > MIN_RETRACT && retracted[active_extruder])) {
2441
         if ((echange < -MIN_RETRACT && !retracted[active_extruder]) || (echange > MIN_RETRACT && retracted[active_extruder])) {
2441
           current_position[E_AXIS] = destination[E_AXIS]; // hide the slicer-generated retract/recover from calculations
2442
           current_position[E_AXIS] = destination[E_AXIS]; // hide the slicer-generated retract/recover from calculations
2442
-          plan_set_e_position(current_position[E_AXIS]);  // AND from the planner
2443
+          sync_plan_position_e();  // AND from the planner
2443
           retract(!retracted[active_extruder]);
2444
           retract(!retracted[active_extruder]);
2444
           return;
2445
           return;
2445
         }
2446
         }
3642
  * G92: Set current position to given X Y Z E
3643
  * G92: Set current position to given X Y Z E
3643
  */
3644
  */
3644
 inline void gcode_G92() {
3645
 inline void gcode_G92() {
3645
-  if (!code_seen(axis_codes[E_AXIS]))
3646
-    st_synchronize();
3646
+  bool didE = code_seen(axis_codes[E_AXIS]);
3647
+
3648
+  if (!didE) st_synchronize();
3647
 
3649
 
3648
   bool didXYZ = false;
3650
   bool didXYZ = false;
3649
   for (int i = 0; i < NUM_AXIS; i++) {
3651
   for (int i = 0; i < NUM_AXIS; i++) {
3653
 
3655
 
3654
       current_position[i] = v;
3656
       current_position[i] = v;
3655
 
3657
 
3656
-      if (i == E_AXIS)
3657
-        plan_set_e_position(v);
3658
-      else {
3658
+      if (i != E_AXIS) {
3659
         position_shift[i] += v - p; // Offset the coordinate space
3659
         position_shift[i] += v - p; // Offset the coordinate space
3660
         update_software_endstops((AxisEnum)i);
3660
         update_software_endstops((AxisEnum)i);
3661
-		  
3662
         didXYZ = true;
3661
         didXYZ = true;
3663
-	  }
3662
+      }
3664
     }
3663
     }
3665
   }
3664
   }
3666
   if (didXYZ) {
3665
   if (didXYZ) {
3670
       sync_plan_position();
3669
       sync_plan_position();
3671
     #endif
3670
     #endif
3672
   }
3671
   }
3672
+  else if (didE) {
3673
+    sync_plan_position_e();
3674
+  }
3673
 }
3675
 }
3674
 
3676
 
3675
 #if ENABLED(ULTIPANEL)
3677
 #if ENABLED(ULTIPANEL)
6106
     #endif
6108
     #endif
6107
 
6109
 
6108
     current_position[E_AXIS] = destination[E_AXIS]; //the long retract of L is compensated by manual filament feeding
6110
     current_position[E_AXIS] = destination[E_AXIS]; //the long retract of L is compensated by manual filament feeding
6109
-    plan_set_e_position(current_position[E_AXIS]);
6111
+    sync_plan_position_e();
6110
 
6112
 
6111
     RUNPLAN; //should do nothing
6113
     RUNPLAN; //should do nothing
6112
 
6114
 

読み込み中…
キャンセル
保存