Browse Source

Use homing_feedrate function

Scott Lahteine 3 years ago
parent
commit
20b3af1cc2

+ 0
- 1
Marlin/src/core/types.h View File

75
 // Conversion macros
75
 // Conversion macros
76
 #define MMM_TO_MMS(MM_M) feedRate_t(float(MM_M) / 60.0f)
76
 #define MMM_TO_MMS(MM_M) feedRate_t(float(MM_M) / 60.0f)
77
 #define MMS_TO_MMM(MM_S) (float(MM_S) * 60.0f)
77
 #define MMS_TO_MMM(MM_S) (float(MM_S) * 60.0f)
78
-#define MMS_SCALED(V)    ((V) * 0.01f * feedrate_percentage)
79
 
78
 
80
 //
79
 //
81
 // Coordinates structures for XY, XYZ, XYZE...
80
 // Coordinates structures for XY, XYZ, XYZE...

+ 2
- 2
Marlin/src/feature/encoder_i2c.cpp View File

332
 
332
 
333
   const float startPosition = soft_endstop.min[encoderAxis] + 10,
333
   const float startPosition = soft_endstop.min[encoderAxis] + 10,
334
               endPosition = soft_endstop.max[encoderAxis] - 10;
334
               endPosition = soft_endstop.max[encoderAxis] - 10;
335
-  const feedRate_t fr_mm_s = FLOOR(MMM_TO_MMS((encoderAxis == Z_AXIS) ? HOMING_FEEDRATE_Z : HOMING_FEEDRATE_XY));
335
+  const feedRate_t fr_mm_s = FLOOR(homing_feedrate(encoderAxis));
336
 
336
 
337
   ec = false;
337
   ec = false;
338
 
338
 
382
 
382
 
383
   int32_t startCount, stopCount;
383
   int32_t startCount, stopCount;
384
 
384
 
385
-  const feedRate_t fr_mm_s = MMM_TO_MMS((encoderAxis == Z_AXIS) ? HOMING_FEEDRATE_Z : HOMING_FEEDRATE_XY);
385
+  const feedRate_t fr_mm_s = homing_feedrate(encoderAxis);
386
 
386
 
387
   bool oldec = ec;
387
   bool oldec = ec;
388
   ec = false;
388
   ec = false;

+ 1
- 1
Marlin/src/feature/powerloss.cpp View File

180
 
180
 
181
     // Machine state
181
     // Machine state
182
     info.current_position = current_position;
182
     info.current_position = current_position;
183
-    info.feedrate = uint16_t(feedrate_mm_s * 60.0f);
183
+    info.feedrate = uint16_t(MMS_TO_MMM(feedrate_mm_s));
184
     info.zraise = zraise;
184
     info.zraise = zraise;
185
 
185
 
186
     TERN_(GCODE_REPEAT_MARKERS, info.stored_repeat = repeat);
186
     TERN_(GCODE_REPEAT_MARKERS, info.stored_repeat = repeat);

+ 1
- 1
Marlin/src/gcode/calibrate/G34.cpp View File

63
 
63
 
64
   // Move Z to pounce position
64
   // Move Z to pounce position
65
   if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPGM("Setting Z Pounce");
65
   if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPGM("Setting Z Pounce");
66
-  do_blocking_move_to_z(zpounce, MMM_TO_MMS(HOMING_FEEDRATE_Z));
66
+  do_blocking_move_to_z(zpounce, homing_feedrate(Z_AXIS));
67
 
67
 
68
   // Store current motor settings, then apply reduced value
68
   // Store current motor settings, then apply reduced value
69
 
69
 

+ 7
- 4
Marlin/src/gcode/feature/pause/G61.cpp View File

49
   // No saved position? No axes being restored?
49
   // No saved position? No axes being restored?
50
   if (!TEST(saved_slots[slot >> 3], slot & 0x07) || !parser.seen("XYZ")) return;
50
   if (!TEST(saved_slots[slot >> 3], slot & 0x07) || !parser.seen("XYZ")) return;
51
 
51
 
52
-  // Apply any given feedrate over 0.0
53
-  const float fr = parser.linearval('F');
54
-  if (fr > 0.0) feedrate_mm_s = MMM_TO_MMS(fr);
55
-
56
   SERIAL_ECHOPAIR(STR_RESTORING_POS " S", int(slot));
52
   SERIAL_ECHOPAIR(STR_RESTORING_POS " S", int(slot));
57
   LOOP_XYZ(i) {
53
   LOOP_XYZ(i) {
58
     destination[i] = parser.seen(XYZ_CHAR(i))
54
     destination[i] = parser.seen(XYZ_CHAR(i))
63
   }
59
   }
64
   SERIAL_EOL();
60
   SERIAL_EOL();
65
 
61
 
62
+  // Apply any given feedrate over 0.0
63
+  feedRate_t saved_feedrate = feedrate_mm_s;
64
+  const float fr = parser.linearval('F');
65
+  if (fr > 0.0) feedrate_mm_s = MMM_TO_MMS(fr);
66
+
66
   // Move to the saved position
67
   // Move to the saved position
67
   prepare_line_to_destination();
68
   prepare_line_to_destination();
69
+
70
+  feedrate_mm_s = saved_feedrate;
68
 }
71
 }
69
 
72
 
70
 #endif // SAVED_POSITIONS
73
 #endif // SAVED_POSITIONS

+ 3
- 3
Marlin/src/lcd/dwin/e3v2/dwin.cpp View File

1166
       if (!planner.is_full()) {
1166
       if (!planner.is_full()) {
1167
         // Wait for planner moves to finish!
1167
         // Wait for planner moves to finish!
1168
         planner.synchronize();
1168
         planner.synchronize();
1169
-        planner.buffer_line(current_position, MMM_TO_MMS(HOMING_FEEDRATE_XY), active_extruder);
1169
+        planner.buffer_line(current_position, homing_feedrate(X_AXIS), active_extruder);
1170
       }
1170
       }
1171
       DWIN_UpdateLCD();
1171
       DWIN_UpdateLCD();
1172
       return;
1172
       return;
1189
       if (!planner.is_full()) {
1189
       if (!planner.is_full()) {
1190
         // Wait for planner moves to finish!
1190
         // Wait for planner moves to finish!
1191
         planner.synchronize();
1191
         planner.synchronize();
1192
-        planner.buffer_line(current_position, MMM_TO_MMS(HOMING_FEEDRATE_XY), active_extruder);
1192
+        planner.buffer_line(current_position, homing_feedrate(Y_AXIS), active_extruder);
1193
       }
1193
       }
1194
       DWIN_UpdateLCD();
1194
       DWIN_UpdateLCD();
1195
       return;
1195
       return;
1212
       if (!planner.is_full()) {
1212
       if (!planner.is_full()) {
1213
         // Wait for planner moves to finish!
1213
         // Wait for planner moves to finish!
1214
         planner.synchronize();
1214
         planner.synchronize();
1215
-        planner.buffer_line(current_position, MMM_TO_MMS(HOMING_FEEDRATE_Z), active_extruder);
1215
+        planner.buffer_line(current_position, homing_feedrate(Z_AXIS), active_extruder);
1216
       }
1216
       }
1217
       DWIN_UpdateLCD();
1217
       DWIN_UpdateLCD();
1218
       return;
1218
       return;

+ 0
- 2
Marlin/src/lcd/extui/lib/mks_ui/draw_filament_change.cpp View File

45
   ID_FILAMNT_RETURN
45
   ID_FILAMNT_RETURN
46
 };
46
 };
47
 
47
 
48
-extern feedRate_t feedrate_mm_s;
49
-
50
 static void event_handler(lv_obj_t *obj, lv_event_t event) {
48
 static void event_handler(lv_obj_t *obj, lv_event_t event) {
51
   if (event != LV_EVENT_RELEASED) return;
49
   if (event != LV_EVENT_RELEASED) return;
52
   switch (obj->mks_obj_id) {
50
   switch (obj->mks_obj_id) {

+ 0
- 2
Marlin/src/lcd/extui/lib/mks_ui/draw_operation.cpp View File

53
 static lv_obj_t *label_PowerOff;
53
 static lv_obj_t *label_PowerOff;
54
 static lv_obj_t *buttonPowerOff;
54
 static lv_obj_t *buttonPowerOff;
55
 
55
 
56
-extern feedRate_t feedrate_mm_s;
57
-
58
 static void event_handler(lv_obj_t *obj, lv_event_t event) {
56
 static void event_handler(lv_obj_t *obj, lv_event_t event) {
59
   if (event != LV_EVENT_RELEASED) return;
57
   if (event != LV_EVENT_RELEASED) return;
60
   switch (obj->mks_obj_id) {
58
   switch (obj->mks_obj_id) {

+ 1
- 1
Marlin/src/lcd/menu/menu_probe_offset.cpp View File

146
   // Move Nozzle to Probing/Homing Position
146
   // Move Nozzle to Probing/Homing Position
147
   ui.wait_for_move = true;
147
   ui.wait_for_move = true;
148
   current_position += probe.offset_xy;
148
   current_position += probe.offset_xy;
149
-  line_to_current_position(MMM_TO_MMS(HOMING_FEEDRATE_XY));
149
+  line_to_current_position(MMM_TO_MMS(XY_PROBE_SPEED));
150
   ui.synchronize(GET_TEXT(MSG_PROBE_WIZARD_MOVING));
150
   ui.synchronize(GET_TEXT(MSG_PROBE_WIZARD_MOVING));
151
   ui.wait_for_move = false;
151
   ui.wait_for_move = false;
152
 
152
 

+ 1
- 1
Marlin/src/module/motion.cpp View File

510
   const bool rel = raise_on_untrusted && !z_trusted;
510
   const bool rel = raise_on_untrusted && !z_trusted;
511
   float zdest = zclear + (rel ? current_position.z : 0.0f);
511
   float zdest = zclear + (rel ? current_position.z : 0.0f);
512
   if (!lower_allowed) NOLESS(zdest, current_position.z);
512
   if (!lower_allowed) NOLESS(zdest, current_position.z);
513
-  do_blocking_move_to_z(_MIN(zdest, Z_MAX_POS), MMM_TO_MMS(TERN(HAS_BED_PROBE, Z_PROBE_SPEED_FAST, HOMING_FEEDRATE_Z)));
513
+  do_blocking_move_to_z(_MIN(zdest, Z_MAX_POS), TERN(HAS_BED_PROBE, MMM_TO_MMS(Z_PROBE_SPEED_FAST), homing_feedrate(Z_AXIS)));
514
 }
514
 }
515
 
515
 
516
 //
516
 //

+ 5
- 1
Marlin/src/module/motion.h View File

73
 FORCE_INLINE feedRate_t homing_feedrate(const AxisEnum a) { return pgm_read_float(&homing_feedrate_mm_s[a]); }
73
 FORCE_INLINE feedRate_t homing_feedrate(const AxisEnum a) { return pgm_read_float(&homing_feedrate_mm_s[a]); }
74
 feedRate_t get_homing_bump_feedrate(const AxisEnum axis);
74
 feedRate_t get_homing_bump_feedrate(const AxisEnum axis);
75
 
75
 
76
+/**
77
+ * The default feedrate for many moves, set by the most recent move
78
+ */
76
 extern feedRate_t feedrate_mm_s;
79
 extern feedRate_t feedrate_mm_s;
77
 
80
 
78
 /**
81
 /**
79
- * Feedrate scaling
82
+ * Feedrate scaling is applied to all G0/G1, G2/G3, and G5 moves
80
  */
83
  */
81
 extern int16_t feedrate_percentage;
84
 extern int16_t feedrate_percentage;
85
+#define MMS_SCALED(V) ((V) * 0.01f * feedrate_percentage)
82
 
86
 
83
 // The active extruder (tool). Set with T<extruder> command.
87
 // The active extruder (tool). Set with T<extruder> command.
84
 #if HAS_MULTI_EXTRUDER
88
 #if HAS_MULTI_EXTRUDER

+ 1
- 1
Marlin/src/module/planner.h View File

978
     #endif // !CLASSIC_JERK
978
     #endif // !CLASSIC_JERK
979
 };
979
 };
980
 
980
 
981
-#define PLANNER_XY_FEEDRATE() (_MIN(planner.settings.max_feedrate_mm_s[X_AXIS], planner.settings.max_feedrate_mm_s[Y_AXIS]))
981
+#define PLANNER_XY_FEEDRATE() _MIN(planner.settings.max_feedrate_mm_s[X_AXIS], planner.settings.max_feedrate_mm_s[Y_AXIS])
982
 
982
 
983
 extern Planner planner;
983
 extern Planner planner;

+ 3
- 8
Marlin/src/module/probe.cpp View File

152
   inline void run_stow_moves_script() {
152
   inline void run_stow_moves_script() {
153
     const xyz_pos_t oldpos = current_position;
153
     const xyz_pos_t oldpos = current_position;
154
     endstops.enable_z_probe(false);
154
     endstops.enable_z_probe(false);
155
-    do_blocking_move_to_z(TOUCH_MI_RETRACT_Z, MMM_TO_MMS(HOMING_FEEDRATE_Z));
156
-    do_blocking_move_to(oldpos, MMM_TO_MMS(HOMING_FEEDRATE_Z));
155
+    do_blocking_move_to_z(TOUCH_MI_RETRACT_Z, homing_feedrate(Z_AXIS));
156
+    do_blocking_move_to(oldpos, homing_feedrate(Z_AXIS));
157
   }
157
   }
158
 
158
 
159
 #elif ENABLED(Z_PROBE_ALLEN_KEY)
159
 #elif ENABLED(Z_PROBE_ALLEN_KEY)
664
   }
664
   }
665
   else if (!position_is_reachable(npos)) return NAN;        // The given position is in terms of the nozzle
665
   else if (!position_is_reachable(npos)) return NAN;        // The given position is in terms of the nozzle
666
 
666
 
667
-  const float old_feedrate_mm_s = feedrate_mm_s;
668
-  feedrate_mm_s = XY_PROBE_FEEDRATE_MM_S;
669
-
670
   // Move the probe to the starting XYZ
667
   // Move the probe to the starting XYZ
671
-  do_blocking_move_to(npos);
668
+  do_blocking_move_to(npos, feedRate_t(XY_PROBE_FEEDRATE_MM_S));
672
 
669
 
673
   float measured_z = NAN;
670
   float measured_z = NAN;
674
   if (!deploy()) measured_z = run_z_probe(sanity_check) + offset.z;
671
   if (!deploy()) measured_z = run_z_probe(sanity_check) + offset.z;
683
       SERIAL_ECHOLNPAIR("Bed X: ", LOGICAL_X_POSITION(rx), " Y: ", LOGICAL_Y_POSITION(ry), " Z: ", measured_z);
680
       SERIAL_ECHOLNPAIR("Bed X: ", LOGICAL_X_POSITION(rx), " Y: ", LOGICAL_Y_POSITION(ry), " Z: ", measured_z);
684
   }
681
   }
685
 
682
 
686
-  feedrate_mm_s = old_feedrate_mm_s;
687
-
688
   if (isnan(measured_z)) {
683
   if (isnan(measured_z)) {
689
     stow();
684
     stow();
690
     LCD_MESSAGEPGM(MSG_LCD_PROBING_FAILED);
685
     LCD_MESSAGEPGM(MSG_LCD_PROBING_FAILED);

Loading…
Cancel
Save