Browse Source

Add more parameters to M240

Co-Authored-By: shitcreek <45380455+shitcreek@users.noreply.github.com>
Scott Lahteine 5 years ago
parent
commit
80359c9937
1 changed files with 13 additions and 3 deletions
  1. 13
    3
      Marlin/src/gcode/feature/camera/M240.cpp

+ 13
- 3
Marlin/src/gcode/feature/camera/M240.cpp View File

@@ -76,6 +76,9 @@
76 76
  *                            configured position, delay, and retract length.
77 77
  *
78 78
  * PHOTO_POSITION parameters:
79
+ *    A - X offset to the return position
80
+ *    B - Y offset to the return position
81
+ *    F - Override the XY movement feedrate
79 82
  *    R - Retract/recover length (current units)
80 83
  *    S - Retract/recover feedrate (mm/m)
81 84
  *    X - Move to X before triggering the shutter
@@ -94,7 +97,11 @@ void GcodeSuite::M240() {
94 97
 
95 98
     if (axis_unhomed_error()) return;
96 99
 
97
-    const float old_pos[XYZ] = { current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS] };
100
+    const float old_pos[XYZ] = {
101
+      current_position[X_AXIS] + parser.linearval('A'),
102
+      current_position[Y_AXIS] + parser.linearval('B'),
103
+      current_position[Z_AXIS]
104
+    };
98 105
 
99 106
     #ifdef PHOTO_RETRACT_MM
100 107
       constexpr float rfr = (MMS_TO_MMM(
@@ -111,6 +118,9 @@ void GcodeSuite::M240() {
111 118
       e_move_m240(-rval, sval);
112 119
     #endif
113 120
 
121
+    float fr_mm_s = MMM_TO_MMS(parser.linearval('F'));
122
+    if (fr_mm_s) NOLESS(fr_mm_s, 10.0f);
123
+
114 124
     constexpr float photo_position[XYZ] = PHOTO_POSITION;
115 125
     float raw[XYZ] = {
116 126
        parser.seenval('X') ? RAW_X_POSITION(parser.value_linear_units()) : photo_position[X_AXIS],
@@ -118,7 +128,7 @@ void GcodeSuite::M240() {
118 128
       (parser.seenval('Z') ? parser.value_linear_units() : photo_position[Z_AXIS]) + current_position[Z_AXIS]
119 129
     };
120 130
     clamp_to_software_endstops(raw);
121
-    do_blocking_move_to(raw);
131
+    do_blocking_move_to(raw, fr_mm_s);
122 132
 
123 133
     #ifdef PHOTO_SWITCH_POSITION
124 134
       constexpr float photo_switch_position[2] = PHOTO_SWITCH_POSITION;
@@ -152,7 +162,7 @@ void GcodeSuite::M240() {
152 162
     #if PHOTO_DELAY_MS > 0
153 163
       safe_delay(parser.intval('P', PHOTO_DELAY_MS));
154 164
     #endif
155
-    do_blocking_move_to(old_pos);
165
+    do_blocking_move_to(old_pos, fr_mm_s);
156 166
     #ifdef PHOTO_RETRACT_MM
157 167
       e_move_m240(rval, sval);
158 168
     #endif

Loading…
Cancel
Save