My Marlin configs for Fabrikator Mini and CTC i3 Pro B
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

UBL_line_to_destination.cpp 21KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532
  1. /**
  2. * Marlin 3D Printer Firmware
  3. * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
  4. *
  5. * Based on Sprinter and grbl.
  6. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm
  7. *
  8. * This program is free software: you can redistribute it and/or modify
  9. * it under the terms of the GNU General Public License as published by
  10. * the Free Software Foundation, either version 3 of the License, or
  11. * (at your option) any later version.
  12. *
  13. * This program is distributed in the hope that it will be useful,
  14. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. * GNU General Public License for more details.
  17. *
  18. * You should have received a copy of the GNU General Public License
  19. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  20. *
  21. */
  22. #include "MarlinConfig.h"
  23. #if ENABLED(AUTO_BED_LEVELING_UBL)
  24. #include "Marlin.h"
  25. #include "UBL.h"
  26. #include "planner.h"
  27. #include <avr/io.h>
  28. #include <math.h>
  29. extern void set_current_to_destination();
  30. extern void debug_current_and_destination(char *title);
  31. void ubl_line_to_destination(const float &x_end, const float &y_end, const float &z_end, const float &e_end, const float &feed_rate, uint8_t extruder) {
  32. int cell_start_xi, cell_start_yi, cell_dest_xi, cell_dest_yi,
  33. current_xi, current_yi,
  34. dxi, dyi, xi_cnt, yi_cnt;
  35. float x_start, y_start,
  36. x, y, z1, z2, z0 /*, z_optimized */,
  37. next_mesh_line_x, next_mesh_line_y, a0ma1diva2ma1,
  38. on_axis_distance, e_normalized_dist, e_position, e_start, z_normalized_dist, z_position, z_start,
  39. dx, dy, adx, ady, m, c;
  40. /**
  41. * Much of the nozzle movement will be within the same cell. So we will do as little computation
  42. * as possible to determine if this is the case. If this move is within the same cell, we will
  43. * just do the required Z-Height correction, call the Planner's buffer_line() routine, and leave
  44. */
  45. x_start = current_position[X_AXIS];
  46. y_start = current_position[Y_AXIS];
  47. z_start = current_position[Z_AXIS];
  48. e_start = current_position[E_AXIS];
  49. cell_start_xi = ubl.get_cell_index_x(x_start);
  50. cell_start_yi = ubl.get_cell_index_y(y_start);
  51. cell_dest_xi = ubl.get_cell_index_x(x_end);
  52. cell_dest_yi = ubl.get_cell_index_y(y_end);
  53. if (g26_debug_flag) {
  54. SERIAL_ECHOPGM(" ubl_line_to_destination(xe=");
  55. SERIAL_ECHO(x_end);
  56. SERIAL_ECHOPGM(", ye=");
  57. SERIAL_ECHO(y_end);
  58. SERIAL_ECHOPGM(", ze=");
  59. SERIAL_ECHO(z_end);
  60. SERIAL_ECHOPGM(", ee=");
  61. SERIAL_ECHO(e_end);
  62. SERIAL_ECHOPGM(")\n");
  63. debug_current_and_destination((char*)"Start of ubl_line_to_destination()");
  64. }
  65. if (cell_start_xi == cell_dest_xi && cell_start_yi == cell_dest_yi) { // if the whole move is within the same cell,
  66. /**
  67. * we don't need to break up the move
  68. *
  69. * If we are moving off the print bed, we are going to allow the move at this level.
  70. * But we detect it and isolate it. For now, we just pass along the request.
  71. */
  72. if (cell_dest_xi < 0 || cell_dest_yi < 0 || cell_dest_xi >= UBL_MESH_NUM_X_POINTS || cell_dest_yi >= UBL_MESH_NUM_Y_POINTS) {
  73. // Note: There is no Z Correction in this case. We are off the grid and don't know what
  74. // a reasonable correction would be.
  75. planner.buffer_line(x_end, y_end, z_end + ubl.state.z_offset, e_end, feed_rate, extruder);
  76. set_current_to_destination();
  77. if (g26_debug_flag)
  78. debug_current_and_destination((char*)"out of bounds in ubl_line_to_destination()");
  79. return;
  80. }
  81. FINAL_MOVE:
  82. /**
  83. * Optimize some floating point operations here. We could call float get_z_correction(float x0, float y0) to
  84. * generate the correction for us. But we can lighten the load on the CPU by doing a modified version of the function.
  85. * We are going to only calculate the amount we are from the first mesh line towards the second mesh line once.
  86. * We will use this fraction in both of the original two Z Height calculations for the bi-linear interpolation. And,
  87. * instead of doing a generic divide of the distance, we know the distance is MESH_X_DIST so we can use the preprocessor
  88. * to create a 1-over number for us. That will allow us to do a floating point multiply instead of a floating point divide.
  89. */
  90. a0ma1diva2ma1 = (x_end - mesh_index_to_x_location[cell_dest_xi]) * 0.1 * (MESH_X_DIST);
  91. z1 = z_values[cell_dest_xi ][cell_dest_yi ] + a0ma1diva2ma1 *
  92. (z_values[cell_dest_xi + 1][cell_dest_yi ] - z_values[cell_dest_xi][cell_dest_yi ]);
  93. z2 = z_values[cell_dest_xi ][cell_dest_yi + 1] + a0ma1diva2ma1 *
  94. (z_values[cell_dest_xi + 1][cell_dest_yi + 1] - z_values[cell_dest_xi][cell_dest_yi + 1]);
  95. // we are done with the fractional X distance into the cell. Now with the two Z-Heights we have calculated, we
  96. // are going to apply the Y-Distance into the cell to interpolate the final Z correction.
  97. a0ma1diva2ma1 = (y_end - mesh_index_to_y_location[cell_dest_yi]) * 0.1 * (MESH_Y_DIST);
  98. z0 = z1 + (z2 - z1) * a0ma1diva2ma1;
  99. /**
  100. * Debug code to use non-optimized get_z_correction() and to do a sanity check
  101. * that the correct value is being passed to planner.buffer_line()
  102. */
  103. /*
  104. z_optimized = z0;
  105. z0 = ubl.get_z_correction( x_end, y_end);
  106. if (fabs(z_optimized - z0) > .01 || isnan(z0) || isnan(z_optimized)) {
  107. debug_current_and_destination((char*)"FINAL_MOVE: z_correction()");
  108. if (isnan(z0)) SERIAL_ECHO(" z0==NAN ");
  109. if (isnan(z_optimized)) SERIAL_ECHO(" z_optimized==NAN ");
  110. SERIAL_ECHOPAIR(" x_end=", x_end);
  111. SERIAL_ECHOPAIR(" y_end=", y_end);
  112. SERIAL_ECHOPAIR(" z0=", z0);
  113. SERIAL_ECHOPAIR(" z_optimized=", z_optimized);
  114. SERIAL_ECHOPAIR(" err=",fabs(z_optimized - z0));
  115. SERIAL_EOL;
  116. }
  117. //*/
  118. z0 = z0 * ubl.fade_scaling_factor_for_z(z_end);
  119. /**
  120. * If part of the Mesh is undefined, it will show up as NAN
  121. * in z_values[][] and propagate through the
  122. * calculations. If our correction is NAN, we throw it out
  123. * because part of the Mesh is undefined and we don't have the
  124. * information we need to complete the height correction.
  125. */
  126. if (isnan(z0)) z0 = 0.0;
  127. planner.buffer_line(x_end, y_end, z_end + z0 + ubl.state.z_offset, e_end, feed_rate, extruder);
  128. if (g26_debug_flag)
  129. debug_current_and_destination((char*)"FINAL_MOVE in ubl_line_to_destination()");
  130. set_current_to_destination();
  131. return;
  132. }
  133. /**
  134. * If we get here, we are processing a move that crosses at least one Mesh Line. We will check
  135. * for the simple case of just crossing X or just crossing Y Mesh Lines after we get all the details
  136. * of the move figured out. We can process the easy case of just crossing an X or Y Mesh Line with less
  137. * computation and in fact most lines are of this nature. We will check for that in the following
  138. * blocks of code:
  139. */
  140. dx = x_end - x_start;
  141. dy = y_end - y_start;
  142. const int left_flag = dx < 0.0 ? 1 : 0,
  143. down_flag = dy < 0.0 ? 1 : 0;
  144. if (left_flag) { // figure out which way we need to move to get to the next cell
  145. dxi = -1;
  146. adx = -dx; // absolute value of dx. We already need to check if dx and dy are negative.
  147. }
  148. else { // We may as well generate the appropriate values for adx and ady right now
  149. dxi = 1; // to save setting up the abs() function call and actually doing the call.
  150. adx = dx;
  151. }
  152. if (dy < 0.0) {
  153. dyi = -1;
  154. ady = -dy; // absolute value of dy
  155. }
  156. else {
  157. dyi = 1;
  158. ady = dy;
  159. }
  160. if (cell_start_xi == cell_dest_xi) dxi = 0;
  161. if (cell_start_yi == cell_dest_yi) dyi = 0;
  162. /**
  163. * Compute the scaling factor for the extruder for each partial move.
  164. * We need to watch out for zero length moves because it will cause us to
  165. * have an infinate scaling factor. We are stuck doing a floating point
  166. * divide to get our scaling factor, but after that, we just multiply by this
  167. * number. We also pick our scaling factor based on whether the X or Y
  168. * component is larger. We use the biggest of the two to preserve precision.
  169. */
  170. const bool use_x_dist = adx > ady;
  171. on_axis_distance = use_x_dist ? x_end - x_start : y_end - y_start;
  172. e_position = e_end - e_start;
  173. e_normalized_dist = e_position / on_axis_distance;
  174. z_position = z_end - z_start;
  175. z_normalized_dist = z_position / on_axis_distance;
  176. const bool inf_normalized_flag = e_normalized_dist == INFINITY || e_normalized_dist == -INFINITY;
  177. current_xi = cell_start_xi;
  178. current_yi = cell_start_yi;
  179. m = dy / dx;
  180. c = y_start - m * x_start;
  181. const bool inf_m_flag = (m == INFINITY || m == -INFINITY);
  182. /**
  183. * This block handles vertical lines. These are lines that stay within the same
  184. * X Cell column. They do not need to be perfectly vertical. They just can
  185. * not cross into another X Cell column.
  186. */
  187. if (dxi == 0) { // Check for a vertical line
  188. current_yi += down_flag; // Line is heading down, we just want to go to the bottom
  189. while (current_yi != cell_dest_yi + down_flag) {
  190. current_yi += dyi;
  191. next_mesh_line_y = mesh_index_to_y_location[current_yi];
  192. /**
  193. * inf_m_flag? the slope of the line is infinite, we won't do the calculations
  194. * else, we know the next X is the same so we can recover and continue!
  195. * Calculate X at the next Y mesh line
  196. */
  197. x = inf_m_flag ? x_start : (next_mesh_line_y - c) / m;
  198. z0 = ubl.get_z_correction_along_horizontal_mesh_line_at_specific_X(x, current_xi, current_yi);
  199. /**
  200. * Debug code to use non-optimized get_z_correction() and to do a sanity check
  201. * that the correct value is being passed to planner.buffer_line()
  202. */
  203. /*
  204. z_optimized = z0;
  205. z0 = ubl.get_z_correction( x, next_mesh_line_y);
  206. if (fabs(z_optimized - z0) > .01 || isnan(z0) || isnan(z_optimized)) {
  207. debug_current_and_destination((char*)"VERTICAL z_correction()");
  208. if (isnan(z0)) SERIAL_ECHO(" z0==NAN ");
  209. if (isnan(z_optimized)) SERIAL_ECHO(" z_optimized==NAN ");
  210. SERIAL_ECHOPAIR(" x=", x);
  211. SERIAL_ECHOPAIR(" next_mesh_line_y=", next_mesh_line_y);
  212. SERIAL_ECHOPAIR(" z0=", z0);
  213. SERIAL_ECHOPAIR(" z_optimized=", z_optimized);
  214. SERIAL_ECHOPAIR(" err=",fabs(z_optimized-z0));
  215. SERIAL_ECHO("\n");
  216. }
  217. //*/
  218. z0 = z0 * ubl.fade_scaling_factor_for_z(z_end);
  219. /**
  220. * If part of the Mesh is undefined, it will show up as NAN
  221. * in z_values[][] and propagate through the
  222. * calculations. If our correction is NAN, we throw it out
  223. * because part of the Mesh is undefined and we don't have the
  224. * information we need to complete the height correction.
  225. */
  226. if (isnan(z0)) z0 = 0.0;
  227. y = mesh_index_to_y_location[current_yi];
  228. /**
  229. * Without this check, it is possible for the algorithm to generate a zero length move in the case
  230. * where the line is heading down and it is starting right on a Mesh Line boundary. For how often that
  231. * happens, it might be best to remove the check and always 'schedule' the move because
  232. * the planner.buffer_line() routine will filter it if that happens.
  233. */
  234. if (y != y_start) {
  235. if (!inf_normalized_flag) {
  236. on_axis_distance = y - y_start; // we don't need to check if the extruder position
  237. e_position = e_start + on_axis_distance * e_normalized_dist; // is based on X or Y because this is a vertical move
  238. z_position = z_start + on_axis_distance * z_normalized_dist;
  239. }
  240. else {
  241. e_position = e_start;
  242. z_position = z_start;
  243. }
  244. planner.buffer_line(x, y, z_position + z0 + ubl.state.z_offset, e_position, feed_rate, extruder);
  245. } //else printf("FIRST MOVE PRUNED ");
  246. }
  247. if (g26_debug_flag)
  248. debug_current_and_destination((char*)"vertical move done in ubl_line_to_destination()");
  249. //
  250. // Check if we are at the final destination. Usually, we won't be, but if it is on a Y Mesh Line, we are done.
  251. //
  252. if (current_position[X_AXIS] != x_end || current_position[Y_AXIS] != y_end)
  253. goto FINAL_MOVE;
  254. set_current_to_destination();
  255. return;
  256. }
  257. /**
  258. *
  259. * This block handles horizontal lines. These are lines that stay within the same
  260. * Y Cell row. They do not need to be perfectly horizontal. They just can
  261. * not cross into another Y Cell row.
  262. *
  263. */
  264. if (dyi == 0) { // Check for a horizontal line
  265. current_xi += left_flag; // Line is heading left, we just want to go to the left
  266. // edge of this cell for the first move.
  267. while (current_xi != cell_dest_xi + left_flag) {
  268. current_xi += dxi;
  269. next_mesh_line_x = mesh_index_to_x_location[current_xi];
  270. y = m * next_mesh_line_x + c; // Calculate X at the next Y mesh line
  271. z0 = ubl.get_z_correction_along_vertical_mesh_line_at_specific_Y(y, current_xi, current_yi);
  272. /**
  273. * Debug code to use non-optimized get_z_correction() and to do a sanity check
  274. * that the correct value is being passed to planner.buffer_line()
  275. */
  276. /*
  277. z_optimized = z0;
  278. z0 = ubl.get_z_correction( next_mesh_line_x, y);
  279. if (fabs(z_optimized - z0) > .01 || isnan(z0) || isnan(z_optimized)) {
  280. debug_current_and_destination((char*)"HORIZONTAL z_correction()");
  281. if (isnan(z0)) SERIAL_ECHO(" z0==NAN ");
  282. if (isnan(z_optimized)) SERIAL_ECHO(" z_optimized==NAN ");
  283. SERIAL_ECHOPAIR(" next_mesh_line_x=", next_mesh_line_x);
  284. SERIAL_ECHOPAIR(" y=", y);
  285. SERIAL_ECHOPAIR(" z0=", z0);
  286. SERIAL_ECHOPAIR(" z_optimized=", z_optimized);
  287. SERIAL_ECHOPAIR(" err=",fabs(z_optimized-z0));
  288. SERIAL_ECHO("\n");
  289. }
  290. //*/
  291. z0 = z0 * ubl.fade_scaling_factor_for_z(z_end);
  292. /**
  293. * If part of the Mesh is undefined, it will show up as NAN
  294. * in z_values[][] and propagate through the
  295. * calculations. If our correction is NAN, we throw it out
  296. * because part of the Mesh is undefined and we don't have the
  297. * information we need to complete the height correction.
  298. */
  299. if (isnan(z0)) z0 = 0.0;
  300. x = mesh_index_to_x_location[current_xi];
  301. /**
  302. * Without this check, it is possible for the algorithm to generate a zero length move in the case
  303. * where the line is heading left and it is starting right on a Mesh Line boundary. For how often
  304. * that happens, it might be best to remove the check and always 'schedule' the move because
  305. * the planner.buffer_line() routine will filter it if that happens.
  306. */
  307. if (x != x_start) {
  308. if (!inf_normalized_flag) {
  309. on_axis_distance = x - x_start; // we don't need to check if the extruder position
  310. e_position = e_start + on_axis_distance * e_normalized_dist; // is based on X or Y because this is a horizontal move
  311. z_position = z_start + on_axis_distance * z_normalized_dist;
  312. }
  313. else {
  314. e_position = e_start;
  315. z_position = z_start;
  316. }
  317. planner.buffer_line(x, y, z_position + z0 + ubl.state.z_offset, e_position, feed_rate, extruder);
  318. } //else printf("FIRST MOVE PRUNED ");
  319. }
  320. if (g26_debug_flag)
  321. debug_current_and_destination((char*)"horizontal move done in ubl_line_to_destination()");
  322. if (current_position[X_AXIS] != x_end || current_position[Y_AXIS] != y_end)
  323. goto FINAL_MOVE;
  324. set_current_to_destination();
  325. return;
  326. }
  327. /**
  328. *
  329. * This block handles the generic case of a line crossing both X and Y Mesh lines.
  330. *
  331. */
  332. xi_cnt = cell_start_xi - cell_dest_xi;
  333. if (xi_cnt < 0) xi_cnt = -xi_cnt;
  334. yi_cnt = cell_start_yi - cell_dest_yi;
  335. if (yi_cnt < 0) yi_cnt = -yi_cnt;
  336. current_xi += left_flag;
  337. current_yi += down_flag;
  338. while (xi_cnt > 0 || yi_cnt > 0) {
  339. next_mesh_line_x = mesh_index_to_x_location[current_xi + dxi];
  340. next_mesh_line_y = mesh_index_to_y_location[current_yi + dyi];
  341. y = m * next_mesh_line_x + c; // Calculate Y at the next X mesh line
  342. x = (next_mesh_line_y - c) / m; // Calculate X at the next Y mesh line (we don't have to worry
  343. // about m being equal to 0.0 If this was the case, we would have
  344. // detected this as a vertical line move up above and we wouldn't
  345. // be down here doing a generic type of move.
  346. if (left_flag == (x > next_mesh_line_x)) { // Check if we hit the Y line first
  347. //
  348. // Yes! Crossing a Y Mesh Line next
  349. //
  350. z0 = ubl.get_z_correction_along_horizontal_mesh_line_at_specific_X(x, current_xi - left_flag, current_yi + dyi);
  351. /**
  352. * Debug code to use non-optimized get_z_correction() and to do a sanity check
  353. * that the correct value is being passed to planner.buffer_line()
  354. */
  355. /*
  356. z_optimized = z0;
  357. z0 = ubl.get_z_correction( x, next_mesh_line_y);
  358. if (fabs(z_optimized - z0) > .01 || isnan(z0) || isnan(z_optimized)) {
  359. debug_current_and_destination((char*)"General_1: z_correction()");
  360. if (isnan(z0)) SERIAL_ECHO(" z0==NAN ");
  361. if (isnan(z_optimized)) SERIAL_ECHO(" z_optimized==NAN "); {
  362. SERIAL_ECHOPAIR(" x=", x);
  363. }
  364. SERIAL_ECHOPAIR(" next_mesh_line_y=", next_mesh_line_y);
  365. SERIAL_ECHOPAIR(" z0=", z0);
  366. SERIAL_ECHOPAIR(" z_optimized=", z_optimized);
  367. SERIAL_ECHOPAIR(" err=",fabs(z_optimized-z0));
  368. SERIAL_ECHO("\n");
  369. }
  370. //*/
  371. z0 *= ubl.fade_scaling_factor_for_z(z_end);
  372. /**
  373. * If part of the Mesh is undefined, it will show up as NAN
  374. * in z_values[][] and propagate through the
  375. * calculations. If our correction is NAN, we throw it out
  376. * because part of the Mesh is undefined and we don't have the
  377. * information we need to complete the height correction.
  378. */
  379. if (isnan(z0)) z0 = 0.0;
  380. if (!inf_normalized_flag) {
  381. on_axis_distance = use_x_dist ? x - x_start : next_mesh_line_y - y_start;
  382. e_position = e_start + on_axis_distance * e_normalized_dist;
  383. z_position = z_start + on_axis_distance * z_normalized_dist;
  384. }
  385. else {
  386. e_position = e_start;
  387. z_position = z_start;
  388. }
  389. planner.buffer_line(x, next_mesh_line_y, z_position + z0 + ubl.state.z_offset, e_position, feed_rate, extruder);
  390. current_yi += dyi;
  391. yi_cnt--;
  392. }
  393. else {
  394. //
  395. // Yes! Crossing a X Mesh Line next
  396. //
  397. z0 = ubl.get_z_correction_along_vertical_mesh_line_at_specific_Y(y, current_xi + dxi, current_yi - down_flag);
  398. /**
  399. * Debug code to use non-optimized get_z_correction() and to do a sanity check
  400. * that the correct value is being passed to planner.buffer_line()
  401. */
  402. /*
  403. z_optimized = z0;
  404. z0 = ubl.get_z_correction( next_mesh_line_x, y);
  405. if (fabs(z_optimized - z0) > .01 || isnan(z0) || isnan(z_optimized)) {
  406. debug_current_and_destination((char*)"General_2: z_correction()");
  407. if (isnan(z0)) SERIAL_ECHO(" z0==NAN ");
  408. if (isnan(z_optimized)) SERIAL_ECHO(" z_optimized==NAN ");
  409. SERIAL_ECHOPAIR(" next_mesh_line_x=", next_mesh_line_x);
  410. SERIAL_ECHOPAIR(" y=", y);
  411. SERIAL_ECHOPAIR(" z0=", z0);
  412. SERIAL_ECHOPAIR(" z_optimized=", z_optimized);
  413. SERIAL_ECHOPAIR(" err=",fabs(z_optimized-z0));
  414. SERIAL_ECHO("\n");
  415. }
  416. //*/
  417. z0 = z0 * ubl.fade_scaling_factor_for_z(z_end);
  418. /**
  419. * If part of the Mesh is undefined, it will show up as NAN
  420. * in z_values[][] and propagate through the
  421. * calculations. If our correction is NAN, we throw it out
  422. * because part of the Mesh is undefined and we don't have the
  423. * information we need to complete the height correction.
  424. */
  425. if (isnan(z0)) z0 = 0.0;
  426. if (!inf_normalized_flag) {
  427. on_axis_distance = use_x_dist ? next_mesh_line_x - x_start : y - y_start;
  428. e_position = e_start + on_axis_distance * e_normalized_dist;
  429. z_position = z_start + on_axis_distance * z_normalized_dist;
  430. }
  431. else {
  432. e_position = e_start;
  433. z_position = z_start;
  434. }
  435. planner.buffer_line(next_mesh_line_x, y, z_position + z0 + ubl.state.z_offset, e_position, feed_rate, extruder);
  436. current_xi += dxi;
  437. xi_cnt--;
  438. }
  439. }
  440. if (g26_debug_flag)
  441. debug_current_and_destination((char*)"generic move done in ubl_line_to_destination()");
  442. if (current_position[0] != x_end || current_position[1] != y_end)
  443. goto FINAL_MOVE;
  444. set_current_to_destination();
  445. }
  446. #endif