Browse Source

Improve retract() for G10/G11/autoretract

Scott Lahteine 8 years ago
parent
commit
fee696db5d
3 changed files with 185 additions and 127 deletions
  1. 9
    4
      Marlin/Marlin.h
  2. 112
    49
      Marlin/Marlin_main.cpp
  3. 64
    74
      Marlin/configuration_store.cpp

+ 9
- 4
Marlin/Marlin.h View File

383
 #endif
383
 #endif
384
 
384
 
385
 #if ENABLED(FWRETRACT)
385
 #if ENABLED(FWRETRACT)
386
-  extern bool autoretract_enabled;
387
-  extern bool retracted[EXTRUDERS]; // extruder[n].retracted
388
-  extern float retract_length, retract_length_swap, retract_feedrate_mm_s, retract_zlift;
389
-  extern float retract_recover_length, retract_recover_length_swap, retract_recover_feedrate_mm_s;
386
+  extern bool autoretract_enabled;                 // M209 S - Autoretract switch
387
+  extern float retract_length,                     // M207 S - G10 Retract length
388
+               retract_feedrate_mm_s,              // M207 F - G10 Retract feedrate
389
+               retract_zlift,                      // M207 Z - G10 Retract hop size
390
+               retract_recover_length,             // M208 S - G11 Recover length
391
+               retract_recover_feedrate_mm_s,      // M208 F - G11 Recover feedrate
392
+               retract_length_swap,                // M207 W - G10 Swap Retract length
393
+               retract_recover_length_swap,        // M208 W - G11 Swap Recover length
394
+               swap_retract_recover_feedrate_mm_s; // M208 R - G11 Swap Recover feedrate
390
 #endif
395
 #endif
391
 
396
 
392
 // Print job timer
397
 // Print job timer

+ 112
- 49
Marlin/Marlin_main.cpp View File

557
           baricuda_e_to_p_pressure = 0;
557
           baricuda_e_to_p_pressure = 0;
558
 #endif
558
 #endif
559
 
559
 
560
-#if ENABLED(FWRETRACT)
561
-
562
-  bool autoretract_enabled = false;
563
-  bool retracted[EXTRUDERS] = { false };
564
-  bool retracted_swap[EXTRUDERS] = { false };
565
-
566
-  float retract_length = RETRACT_LENGTH;
567
-  float retract_length_swap = RETRACT_LENGTH_SWAP;
568
-  float retract_feedrate_mm_s = RETRACT_FEEDRATE;
569
-  float retract_zlift = RETRACT_ZLIFT;
570
-  float retract_recover_length = RETRACT_RECOVER_LENGTH;
571
-  float retract_recover_length_swap = RETRACT_RECOVER_LENGTH_SWAP;
572
-  float retract_recover_feedrate_mm_s = RETRACT_RECOVER_FEEDRATE;
573
-
560
+#if ENABLED(FWRETRACT)                      // Initialized by settings.load()...
561
+  bool  autoretract_enabled,                // M209 S - Autoretract switch
562
+        retracted[EXTRUDERS] = { false };   // Which extruders are currently retracted
563
+  float retract_length,                     // M207 S - G10 Retract length
564
+        retract_feedrate_mm_s,              // M207 F - G10 Retract feedrate
565
+        retract_zlift,                      // M207 Z - G10 Retract hop size
566
+        retract_recover_length,             // M208 S - G11 Recover length
567
+        retract_recover_feedrate_mm_s,      // M208 F - G11 Recover feedrate
568
+        retract_length_swap,                // M207 W - G10 Swap Retract length
569
+        retract_recover_length_swap,        // M208 W - G11 Swap Recover length
570
+        swap_retract_recover_feedrate_mm_s; // M208 R - G11 Swap Recover feedrate
571
+  #if EXTRUDERS > 1
572
+    bool retracted_swap[EXTRUDERS] = { false }; // Which extruders are swap-retracted
573
+  #else
574
+    constexpr bool retracted_swap[1] = { false };
575
+  #endif
574
 #endif // FWRETRACT
576
 #endif // FWRETRACT
575
 
577
 
576
 #if HAS_POWER_SWITCH
578
 #if HAS_POWER_SWITCH
3100
 
3102
 
3101
 #if ENABLED(FWRETRACT)
3103
 #if ENABLED(FWRETRACT)
3102
 
3104
 
3103
-  void retract(const bool retracting, const bool swapping = false) {
3105
+  /**
3106
+   * Retract or recover according to firmware settings
3107
+   *
3108
+   * This function handles retract/recover moves for G10 and G11,
3109
+   * plus auto-retract moves sent from G0/G1 when E-only moves are done.
3110
+   *
3111
+   * To simplify the logic, doubled retract/recover moves are ignored.
3112
+   *
3113
+   * Note: Z lift is done transparently to the planner. Aborting
3114
+   *       a print between G10 and G11 may corrupt the Z position.
3115
+   *
3116
+   * Note: Auto-retract will apply the set Z hop in addition to any Z hop
3117
+   *       included in the G-code. Use M207 Z0 to to prevent double hop.
3118
+   */
3119
+  void retract(const bool retracting
3120
+    #if EXTRUDERS > 1
3121
+      , bool swapping = false
3122
+    #endif
3123
+  ) {
3124
+
3125
+    static float hop_height,        // Remember where the Z height started
3126
+                 hop_amount = 0.0;  // Total amount lifted, for use in recover
3104
 
3127
 
3105
-    static float hop_height;
3128
+    // Simply never allow two retracts or recovers in a row
3129
+    if (retracted[active_extruder] == retracting) return;
3130
+
3131
+    #if EXTRUDERS < 2
3132
+      bool swapping = false;
3133
+    #endif
3134
+    if (!retracting) swapping = retracted_swap[active_extruder];
3135
+
3136
+    /* // debugging
3137
+      SERIAL_ECHOLNPAIR("retracting ", retracting);
3138
+      SERIAL_ECHOLNPAIR("swapping ", swapping);
3139
+      SERIAL_ECHOLNPAIR("active extruder ", active_extruder);
3140
+      for (uint8_t i = 0; i < EXTRUDERS; ++i) {
3141
+        SERIAL_ECHOPAIR("retracted[", i);
3142
+        SERIAL_ECHOLNPAIR("] ", retracted[i]);
3143
+        SERIAL_ECHOPAIR("retracted_swap[", i);
3144
+        SERIAL_ECHOLNPAIR("] ", retracted_swap[i]);
3145
+      }
3146
+      SERIAL_ECHOLNPAIR("current_position[z] ", current_position[Z_AXIS]);
3147
+      SERIAL_ECHOLNPAIR("hop_amount ", hop_amount);
3148
+    //*/
3106
 
3149
 
3107
-    if (retracting == retracted[active_extruder]) return;
3150
+    const bool has_zhop = retract_zlift > 0.01;     // Is there a hop set?
3108
 
3151
 
3109
     const float old_feedrate_mm_s = feedrate_mm_s;
3152
     const float old_feedrate_mm_s = feedrate_mm_s;
3110
 
3153
 
3154
+    // The current position will be the destination for E and Z moves
3111
     set_destination_to_current();
3155
     set_destination_to_current();
3112
 
3156
 
3113
     if (retracting) {
3157
     if (retracting) {
3158
+      // Remember the Z height since G-code may include its own Z-hop
3159
+      // For best results turn off Z hop if G-code already includes it
3160
+      hop_height = destination[Z_AXIS];
3114
 
3161
 
3162
+      // Retract by moving from a faux E position back to the current E position
3115
       feedrate_mm_s = retract_feedrate_mm_s;
3163
       feedrate_mm_s = retract_feedrate_mm_s;
3116
       current_position[E_AXIS] += (swapping ? retract_length_swap : retract_length) / volumetric_multiplier[active_extruder];
3164
       current_position[E_AXIS] += (swapping ? retract_length_swap : retract_length) / volumetric_multiplier[active_extruder];
3117
       sync_plan_position_e();
3165
       sync_plan_position_e();
3118
       prepare_move_to_destination();
3166
       prepare_move_to_destination();
3119
 
3167
 
3120
-      if (retract_zlift > 0.01) {
3121
-        hop_height = current_position[Z_AXIS];
3122
-        // Pretend current position is lower
3123
-        current_position[Z_AXIS] -= retract_zlift;
3124
-        SYNC_PLAN_POSITION_KINEMATIC();
3125
-        // Raise up to the old current_position
3126
-        prepare_move_to_destination();
3168
+      // Is a Z hop set, and has the hop not yet been done?
3169
+      if (has_zhop) {
3170
+        hop_amount += retract_zlift;                // Carriage is raised for retraction hop
3171
+        current_position[Z_AXIS] -= retract_zlift;  // Pretend current pos is lower. Next move raises Z.
3172
+        SYNC_PLAN_POSITION_KINEMATIC();             // Set the planner to the new position
3173
+        prepare_move_to_destination();              // Raise up to the old current pos
3127
       }
3174
       }
3128
     }
3175
     }
3129
     else {
3176
     else {
3130
-
3131
-      // If the height hasn't been lowered, undo the Z hop
3132
-      if (retract_zlift > 0.01 && hop_height <= current_position[Z_AXIS]) {
3133
-        // Pretend current position is higher. Z will lower on the next move
3134
-        current_position[Z_AXIS] += retract_zlift;
3135
-        SYNC_PLAN_POSITION_KINEMATIC();
3136
-        // Lower Z
3137
-        prepare_move_to_destination();
3177
+      // If a hop was done and Z hasn't changed, undo the Z hop
3178
+      if (hop_amount && NEAR(hop_height, destination[Z_AXIS])) {
3179
+        current_position[Z_AXIS] += hop_amount;     // Pretend current pos is higher. Next move lowers Z.
3180
+        SYNC_PLAN_POSITION_KINEMATIC();             // Set the planner to the new position
3181
+        prepare_move_to_destination();              // Lower to the old current pos
3182
+        hop_amount = 0.0;
3138
       }
3183
       }
3139
 
3184
 
3140
-      feedrate_mm_s = retract_recover_feedrate_mm_s;
3185
+      // A retract multiplier has been added here to get faster swap recovery
3186
+      feedrate_mm_s = swapping ? swap_retract_recover_feedrate_mm_s : retract_recover_feedrate_mm_s;
3187
+
3141
       const float move_e = swapping ? retract_length_swap + retract_recover_length_swap : retract_length + retract_recover_length;
3188
       const float move_e = swapping ? retract_length_swap + retract_recover_length_swap : retract_length + retract_recover_length;
3142
       current_position[E_AXIS] -= move_e / volumetric_multiplier[active_extruder];
3189
       current_position[E_AXIS] -= move_e / volumetric_multiplier[active_extruder];
3143
       sync_plan_position_e();
3190
       sync_plan_position_e();
3144
 
3191
 
3145
-      // Recover E
3146
-      prepare_move_to_destination();
3192
+      prepare_move_to_destination();  // Recover E
3147
     }
3193
     }
3148
 
3194
 
3149
     feedrate_mm_s = old_feedrate_mm_s;
3195
     feedrate_mm_s = old_feedrate_mm_s;
3196
+
3197
+    // The active extruder is now retracted or recovered
3150
     retracted[active_extruder] = retracting;
3198
     retracted[active_extruder] = retracting;
3151
 
3199
 
3200
+    // If swap retract/recover then update the retracted_swap flag too
3201
+    #if EXTRUDERS > 1
3202
+      if (swapping) retracted_swap[active_extruder] = retracting;
3203
+    #endif
3204
+
3205
+    /* // debugging
3206
+      SERIAL_ECHOLNPAIR("retracting ", retracting);
3207
+      SERIAL_ECHOLNPAIR("swapping ", swapping);
3208
+      SERIAL_ECHOLNPAIR("active_extruder ", active_extruder);
3209
+      for (uint8_t i = 0; i < EXTRUDERS; ++i) {
3210
+        SERIAL_ECHOPAIR("retracted[", i);
3211
+        SERIAL_ECHOLNPAIR("] ", retracted[i]);
3212
+        SERIAL_ECHOPAIR("retracted_swap[", i);
3213
+        SERIAL_ECHOLNPAIR("] ", retracted_swap[i]);
3214
+      }
3215
+      SERIAL_ECHOLNPAIR("current_position[z] ", current_position[Z_AXIS]);
3216
+      SERIAL_ECHOLNPAIR("hop_amount ", hop_amount);
3217
+    //*/
3218
+
3152
   } // retract()
3219
   } // retract()
3153
 
3220
 
3154
 #endif // FWRETRACT
3221
 #endif // FWRETRACT
3277
     gcode_get_destination(); // For X Y Z E F
3344
     gcode_get_destination(); // For X Y Z E F
3278
 
3345
 
3279
     #if ENABLED(FWRETRACT)
3346
     #if ENABLED(FWRETRACT)
3280
-
3281
-      if (autoretract_enabled && !(parser.seen('X') || parser.seen('Y') || parser.seen('Z')) && parser.seen('E')) {
3347
+      // When M209 Autoretract is enabled, convert E-only moves to firmware retract/recover moves
3348
+      if (autoretract_enabled && parser.seen('E') && !(parser.seen('X') || parser.seen('Y') || parser.seen('Z'))) {
3282
         const float echange = destination[E_AXIS] - current_position[E_AXIS];
3349
         const float echange = destination[E_AXIS] - current_position[E_AXIS];
3283
-        // Is this move an attempt to retract or recover?
3350
+        // Is this a retract or recover move?
3284
         if (WITHIN(FABS(echange), MIN_AUTORETRACT, MAX_AUTORETRACT) && retracted[active_extruder] == (echange > 0.0)) {
3351
         if (WITHIN(FABS(echange), MIN_AUTORETRACT, MAX_AUTORETRACT) && retracted[active_extruder] == (echange > 0.0)) {
3285
-          current_position[E_AXIS] = destination[E_AXIS]; // hide the slicer-generated retract/recover from calculations
3286
-          sync_plan_position_e();  // AND from the planner
3287
-          retract(!retracted[active_extruder]);
3288
-          return;
3352
+          current_position[E_AXIS] = destination[E_AXIS]; // Hide a G1-based retract/recover from calculations
3353
+          sync_plan_position_e();                         // AND from the planner
3354
+          return retract(echange < 0.0);                  // Firmware-based retract/recover (double-retract ignored)
3289
         }
3355
         }
3290
       }
3356
       }
3291
-
3292
     #endif // FWRETRACT
3357
     #endif // FWRETRACT
3293
 
3358
 
3294
     #if IS_SCARA
3359
     #if IS_SCARA
8489
     if (parser.seen('S')) retract_length = parser.value_axis_units(E_AXIS);
8554
     if (parser.seen('S')) retract_length = parser.value_axis_units(E_AXIS);
8490
     if (parser.seen('F')) retract_feedrate_mm_s = MMM_TO_MMS(parser.value_axis_units(E_AXIS));
8555
     if (parser.seen('F')) retract_feedrate_mm_s = MMM_TO_MMS(parser.value_axis_units(E_AXIS));
8491
     if (parser.seen('Z')) retract_zlift = parser.value_linear_units();
8556
     if (parser.seen('Z')) retract_zlift = parser.value_linear_units();
8492
-    #if EXTRUDERS > 1
8493
-      if (parser.seen('W')) retract_length_swap = parser.value_axis_units(E_AXIS);
8494
-    #endif
8557
+    if (parser.seen('W')) retract_length_swap = parser.value_axis_units(E_AXIS);
8495
   }
8558
   }
8496
 
8559
 
8497
   /**
8560
   /**
8500
    *   S[+units]    retract_recover_length (in addition to M207 S*)
8563
    *   S[+units]    retract_recover_length (in addition to M207 S*)
8501
    *   W[+units]    retract_recover_length_swap (multi-extruder)
8564
    *   W[+units]    retract_recover_length_swap (multi-extruder)
8502
    *   F[units/min] retract_recover_feedrate_mm_s
8565
    *   F[units/min] retract_recover_feedrate_mm_s
8566
+   *   R[units/min] swap_retract_recover_feedrate_mm_s
8503
    */
8567
    */
8504
   inline void gcode_M208() {
8568
   inline void gcode_M208() {
8505
     if (parser.seen('S')) retract_recover_length = parser.value_axis_units(E_AXIS);
8569
     if (parser.seen('S')) retract_recover_length = parser.value_axis_units(E_AXIS);
8506
     if (parser.seen('F')) retract_recover_feedrate_mm_s = MMM_TO_MMS(parser.value_axis_units(E_AXIS));
8570
     if (parser.seen('F')) retract_recover_feedrate_mm_s = MMM_TO_MMS(parser.value_axis_units(E_AXIS));
8507
-    #if EXTRUDERS > 1
8508
-      if (parser.seen('W')) retract_recover_length_swap = parser.value_axis_units(E_AXIS);
8509
-    #endif
8571
+    if (parser.seen('R')) swap_retract_recover_feedrate_mm_s = MMM_TO_MMS(parser.value_axis_units(E_AXIS));
8572
+    if (parser.seen('W')) retract_recover_length_swap = parser.value_axis_units(E_AXIS);
8510
   }
8573
   }
8511
 
8574
 
8512
   /**
8575
   /**

+ 64
- 74
Marlin/configuration_store.cpp View File

36
  *
36
  *
37
  */
37
  */
38
 
38
 
39
-#define EEPROM_VERSION "V39"
39
+#define EEPROM_VERSION "V40"
40
 
40
 
41
 // Change EEPROM version if these are changed:
41
 // Change EEPROM version if these are changed:
42
 #define EEPROM_OFFSET 100
42
 #define EEPROM_OFFSET 100
125
  * DOGLCD:                                          2 bytes
125
  * DOGLCD:                                          2 bytes
126
  *  502  M250 C    lcd_contrast                     (uint16_t)
126
  *  502  M250 C    lcd_contrast                     (uint16_t)
127
  *
127
  *
128
- * FWRETRACT:                                       29 bytes
128
+ * FWRETRACT:                                       33 bytes
129
  *  504  M209 S    autoretract_enabled              (bool)
129
  *  504  M209 S    autoretract_enabled              (bool)
130
  *  505  M207 S    retract_length                   (float)
130
  *  505  M207 S    retract_length                   (float)
131
- *  509  M207 W    retract_length_swap              (float)
132
- *  513  M207 F    retract_feedrate_mm_s            (float)
133
- *  517  M207 Z    retract_zlift                    (float)
134
- *  521  M208 S    retract_recover_length           (float)
135
- *  525  M208 W    retract_recover_length_swap      (float)
136
- *  529  M208 F    retract_recover_feedrate_mm_s    (float)
131
+ *  509  M207 F    retract_feedrate_mm_s            (float)
132
+ *  513  M207 Z    retract_zlift                    (float)
133
+ *  517  M208 S    retract_recover_length           (float)
134
+ *  521  M208 F    retract_recover_feedrate_mm_s    (float)
135
+ *  525  M207 W    retract_length_swap              (float)
136
+ *  529  M208 W    retract_recover_length_swap      (float)
137
+ *  533  M208 R    swap_retract_recover_feedrate_mm_s (float)
137
  *
138
  *
138
  * Volumetric Extrusion:                            21 bytes
139
  * Volumetric Extrusion:                            21 bytes
139
- *  533  M200 D    volumetric_enabled               (bool)
140
- *  534  M200 T D  filament_size                    (float x5) (T0..3)
140
+ *  537  M200 D    volumetric_enabled               (bool)
141
+ *  538  M200 T D  filament_size                    (float x5) (T0..3)
141
  *
142
  *
142
  * HAVE_TMC2130:                                    20 bytes
143
  * HAVE_TMC2130:                                    20 bytes
143
- *  554  M906 X    Stepper X current                (uint16_t)
144
- *  556  M906 Y    Stepper Y current                (uint16_t)
145
- *  558  M906 Z    Stepper Z current                (uint16_t)
146
- *  560  M906 X2   Stepper X2 current               (uint16_t)
147
- *  562  M906 Y2   Stepper Y2 current               (uint16_t)
148
- *  564  M906 Z2   Stepper Z2 current               (uint16_t)
149
- *  566  M906 E0   Stepper E0 current               (uint16_t)
150
- *  568  M906 E1   Stepper E1 current               (uint16_t)
151
- *  570  M906 E2   Stepper E2 current               (uint16_t)
152
- *  572  M906 E3   Stepper E3 current               (uint16_t)
153
- *  576  M906 E4   Stepper E4 current               (uint16_t)
144
+ *  558  M906 X    Stepper X current                (uint16_t)
145
+ *  560  M906 Y    Stepper Y current                (uint16_t)
146
+ *  562  M906 Z    Stepper Z current                (uint16_t)
147
+ *  564  M906 X2   Stepper X2 current               (uint16_t)
148
+ *  566  M906 Y2   Stepper Y2 current               (uint16_t)
149
+ *  568  M906 Z2   Stepper Z2 current               (uint16_t)
150
+ *  570  M906 E0   Stepper E0 current               (uint16_t)
151
+ *  572  M906 E1   Stepper E1 current               (uint16_t)
152
+ *  574  M906 E2   Stepper E2 current               (uint16_t)
153
+ *  576  M906 E3   Stepper E3 current               (uint16_t)
154
+ *  580  M906 E4   Stepper E4 current               (uint16_t)
154
  *
155
  *
155
  * LIN_ADVANCE:                                     8 bytes
156
  * LIN_ADVANCE:                                     8 bytes
156
- *  580  M900 K    extruder_advance_k               (float)
157
- *  584  M900 WHD  advance_ed_ratio                 (float)
157
+ *  584  M900 K    extruder_advance_k               (float)
158
+ *  588  M900 WHD  advance_ed_ratio                 (float)
158
  *
159
  *
159
  * HAS_MOTOR_CURRENT_PWM:
160
  * HAS_MOTOR_CURRENT_PWM:
160
- *  588  M907 X    Stepper XY current               (uint32_t)
161
- *  592  M907 Z    Stepper Z current                (uint32_t)
162
- *  596  M907 E    Stepper E current                (uint32_t)
161
+ *  592  M907 X    Stepper XY current               (uint32_t)
162
+ *  596  M907 Z    Stepper Z current                (uint32_t)
163
+ *  600  M907 E    Stepper E current                (uint32_t)
163
  *
164
  *
164
- *  600                                Minimum end-point
165
- * 1921 (600 + 36 + 9 + 288 + 988)     Maximum end-point
165
+ *  604                                Minimum end-point
166
+ * 1925 (604 + 36 + 9 + 288 + 988)     Maximum end-point
166
  *
167
  *
167
  * ========================================================================
168
  * ========================================================================
168
  * meshes_begin (between max and min end-point, directly above)
169
  * meshes_begin (between max and min end-point, directly above)
520
     #endif
521
     #endif
521
     EEPROM_WRITE(lcd_contrast);
522
     EEPROM_WRITE(lcd_contrast);
522
 
523
 
523
-    #if ENABLED(FWRETRACT)
524
-      EEPROM_WRITE(autoretract_enabled);
525
-      EEPROM_WRITE(retract_length);
526
-      #if EXTRUDERS > 1
527
-        EEPROM_WRITE(retract_length_swap);
528
-      #else
529
-        dummy = 0.0f;
530
-        EEPROM_WRITE(dummy);
531
-      #endif
532
-      EEPROM_WRITE(retract_feedrate_mm_s);
533
-      EEPROM_WRITE(retract_zlift);
534
-      EEPROM_WRITE(retract_recover_length);
535
-      #if EXTRUDERS > 1
536
-        EEPROM_WRITE(retract_recover_length_swap);
537
-      #else
538
-        dummy = 0.0f;
539
-        EEPROM_WRITE(dummy);
540
-      #endif
541
-      EEPROM_WRITE(retract_recover_feedrate_mm_s);
542
-    #endif // FWRETRACT
524
+    #if DISABLED(FWRETRACT)
525
+      const bool autoretract_enabled = false;
526
+      const float retract_length = 3,
527
+                  retract_feedrate_mm_s = 45,
528
+                  retract_zlift = 0,
529
+                  retract_recover_length = 0,
530
+                  retract_recover_feedrate_mm_s = 0,
531
+                  retract_length_swap = 13,
532
+                  retract_recover_length_swap = 0,
533
+                  swap_retract_recover_feedrate_mm_s = 8;
534
+    #endif
535
+    EEPROM_WRITE(autoretract_enabled);
536
+    EEPROM_WRITE(retract_length);
537
+    EEPROM_WRITE(retract_feedrate_mm_s);
538
+    EEPROM_WRITE(retract_zlift);
539
+    EEPROM_WRITE(retract_recover_length);
540
+    EEPROM_WRITE(retract_recover_feedrate_mm_s);
541
+    EEPROM_WRITE(retract_length_swap);
542
+    EEPROM_WRITE(retract_recover_length_swap);
543
+    EEPROM_WRITE(swap_retract_recover_feedrate_mm_s);
543
 
544
 
544
     EEPROM_WRITE(volumetric_enabled);
545
     EEPROM_WRITE(volumetric_enabled);
545
 
546
 
620
       EEPROM_WRITE(val);
621
       EEPROM_WRITE(val);
621
     #else
622
     #else
622
       val = 0;
623
       val = 0;
623
-      for (uint8_t q = 0; q < 11; ++q) EEPROM_WRITE(val);
624
+      for (uint8_t q = 11; q--;) EEPROM_WRITE(val);
624
     #endif
625
     #endif
625
 
626
 
626
     //
627
     //
701
     }
702
     }
702
     else {
703
     else {
703
       float dummy = 0;
704
       float dummy = 0;
705
+      bool dummyb;
704
 
706
 
705
       working_crc = 0; //clear before reading first "real data"
707
       working_crc = 0; //clear before reading first "real data"
706
 
708
 
830
         EEPROM_READ(ubl.state.z_offset);
832
         EEPROM_READ(ubl.state.z_offset);
831
         EEPROM_READ(ubl.state.storage_slot);
833
         EEPROM_READ(ubl.state.storage_slot);
832
       #else
834
       #else
833
-        bool dummyb;
834
         uint8_t dummyui8;
835
         uint8_t dummyui8;
835
         EEPROM_READ(dummyb);
836
         EEPROM_READ(dummyb);
836
         EEPROM_READ(dummy);
837
         EEPROM_READ(dummy);
915
       #if ENABLED(FWRETRACT)
916
       #if ENABLED(FWRETRACT)
916
         EEPROM_READ(autoretract_enabled);
917
         EEPROM_READ(autoretract_enabled);
917
         EEPROM_READ(retract_length);
918
         EEPROM_READ(retract_length);
918
-        #if EXTRUDERS > 1
919
-          EEPROM_READ(retract_length_swap);
920
-        #else
921
-          EEPROM_READ(dummy);
922
-        #endif
923
         EEPROM_READ(retract_feedrate_mm_s);
919
         EEPROM_READ(retract_feedrate_mm_s);
924
         EEPROM_READ(retract_zlift);
920
         EEPROM_READ(retract_zlift);
925
         EEPROM_READ(retract_recover_length);
921
         EEPROM_READ(retract_recover_length);
926
-        #if EXTRUDERS > 1
927
-          EEPROM_READ(retract_recover_length_swap);
928
-        #else
929
-          EEPROM_READ(dummy);
930
-        #endif
931
         EEPROM_READ(retract_recover_feedrate_mm_s);
922
         EEPROM_READ(retract_recover_feedrate_mm_s);
932
-      #endif // FWRETRACT
923
+        EEPROM_READ(retract_length_swap);
924
+        EEPROM_READ(retract_recover_length_swap);
925
+        EEPROM_READ(swap_retract_recover_feedrate_mm_s);
926
+      #else
927
+        EEPROM_READ(dummyb);
928
+        for (uint8_t q=8; q--;) EEPROM_READ(dummy);
929
+      #endif
933
 
930
 
934
       EEPROM_READ(volumetric_enabled);
931
       EEPROM_READ(volumetric_enabled);
935
 
932
 
1291
   #if ENABLED(FWRETRACT)
1288
   #if ENABLED(FWRETRACT)
1292
     autoretract_enabled = false;
1289
     autoretract_enabled = false;
1293
     retract_length = RETRACT_LENGTH;
1290
     retract_length = RETRACT_LENGTH;
1294
-    #if EXTRUDERS > 1
1295
-      retract_length_swap = RETRACT_LENGTH_SWAP;
1296
-    #endif
1297
     retract_feedrate_mm_s = RETRACT_FEEDRATE;
1291
     retract_feedrate_mm_s = RETRACT_FEEDRATE;
1298
     retract_zlift = RETRACT_ZLIFT;
1292
     retract_zlift = RETRACT_ZLIFT;
1299
     retract_recover_length = RETRACT_RECOVER_LENGTH;
1293
     retract_recover_length = RETRACT_RECOVER_LENGTH;
1300
-    #if EXTRUDERS > 1
1301
-      retract_recover_length_swap = RETRACT_RECOVER_LENGTH_SWAP;
1302
-    #endif
1303
     retract_recover_feedrate_mm_s = RETRACT_RECOVER_FEEDRATE;
1294
     retract_recover_feedrate_mm_s = RETRACT_RECOVER_FEEDRATE;
1304
-  #endif
1295
+    retract_length_swap = RETRACT_LENGTH_SWAP;
1296
+    retract_recover_length_swap = RETRACT_RECOVER_LENGTH_SWAP;
1297
+    swap_retract_recover_feedrate_mm_s = RETRACT_RECOVER_FEEDRATE_SWAP;
1298
+  #endif // FWRETRACT
1305
 
1299
 
1306
   volumetric_enabled =
1300
   volumetric_enabled =
1307
     #if ENABLED(VOLUMETRIC_DEFAULT_ON)
1301
     #if ENABLED(VOLUMETRIC_DEFAULT_ON)
1753
       }
1747
       }
1754
       CONFIG_ECHO_START;
1748
       CONFIG_ECHO_START;
1755
       SERIAL_ECHOPAIR("  M207 S", LINEAR_UNIT(retract_length));
1749
       SERIAL_ECHOPAIR("  M207 S", LINEAR_UNIT(retract_length));
1756
-      #if EXTRUDERS > 1
1757
-        SERIAL_ECHOPAIR(" W", LINEAR_UNIT(retract_length_swap));
1758
-      #endif
1750
+      SERIAL_ECHOPAIR(" W", LINEAR_UNIT(retract_length_swap));
1759
       SERIAL_ECHOPAIR(" F", MMS_TO_MMM(LINEAR_UNIT(retract_feedrate_mm_s)));
1751
       SERIAL_ECHOPAIR(" F", MMS_TO_MMM(LINEAR_UNIT(retract_feedrate_mm_s)));
1760
       SERIAL_ECHOLNPAIR(" Z", LINEAR_UNIT(retract_zlift));
1752
       SERIAL_ECHOLNPAIR(" Z", LINEAR_UNIT(retract_zlift));
1761
 
1753
 
1765
       }
1757
       }
1766
       CONFIG_ECHO_START;
1758
       CONFIG_ECHO_START;
1767
       SERIAL_ECHOPAIR("  M208 S", LINEAR_UNIT(retract_recover_length));
1759
       SERIAL_ECHOPAIR("  M208 S", LINEAR_UNIT(retract_recover_length));
1768
-      #if EXTRUDERS > 1
1769
-        SERIAL_ECHOPAIR(" W", LINEAR_UNIT(retract_recover_length_swap));
1770
-      #endif
1760
+      SERIAL_ECHOPAIR(" W", LINEAR_UNIT(retract_recover_length_swap));
1771
       SERIAL_ECHOLNPAIR(" F", MMS_TO_MMM(LINEAR_UNIT(retract_recover_feedrate_mm_s)));
1761
       SERIAL_ECHOLNPAIR(" F", MMS_TO_MMM(LINEAR_UNIT(retract_recover_feedrate_mm_s)));
1772
 
1762
 
1773
       if (!forReplay) {
1763
       if (!forReplay) {

Loading…
Cancel
Save