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.

bbl.h 2.9KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. /**
  2. * Marlin 3D Printer Firmware
  3. * Copyright (c) 2020 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 <https://www.gnu.org/licenses/>.
  20. *
  21. */
  22. #pragma once
  23. #include "../../../inc/MarlinConfigPre.h"
  24. class LevelingBilinear {
  25. static xy_pos_t grid_spacing, grid_start;
  26. static xy_float_t grid_factor;
  27. static bed_mesh_t z_values;
  28. static xy_pos_t cached_rel;
  29. static xy_int8_t cached_g;
  30. static void extrapolate_one_point(const uint8_t x, const uint8_t y, const int8_t xdir, const int8_t ydir);
  31. #if ENABLED(ABL_BILINEAR_SUBDIVISION)
  32. #define ABL_GRID_POINTS_VIRT_X (GRID_MAX_CELLS_X * (BILINEAR_SUBDIVISIONS) + 1)
  33. #define ABL_GRID_POINTS_VIRT_Y (GRID_MAX_CELLS_Y * (BILINEAR_SUBDIVISIONS) + 1)
  34. static float z_values_virt[ABL_GRID_POINTS_VIRT_X][ABL_GRID_POINTS_VIRT_Y];
  35. static xy_pos_t grid_spacing_virt;
  36. static xy_float_t grid_factor_virt;
  37. static float bed_level_virt_coord(const uint8_t x, const uint8_t y);
  38. static float bed_level_virt_cmr(const float p[4], const uint8_t i, const float t);
  39. static float bed_level_virt_2cmr(const uint8_t x, const uint8_t y, const_float_t tx, const_float_t ty);
  40. static void bed_level_virt_interpolate();
  41. #endif
  42. public:
  43. static void reset();
  44. static void set_grid(const xy_pos_t& _grid_spacing, const xy_pos_t& _grid_start);
  45. static void extrapolate_unprobed_bed_level();
  46. static void print_leveling_grid(const bed_mesh_t* _z_values = NULL);
  47. static void refresh_bed_level();
  48. static bool has_mesh() { return !!grid_spacing.x; }
  49. static bed_mesh_t& get_z_values() { return z_values; }
  50. static const xy_pos_t& get_grid_spacing() { return grid_spacing; }
  51. static const xy_pos_t& get_grid_start() { return grid_start; }
  52. static float get_mesh_x(int16_t i) { return grid_start.x + i * grid_spacing.x; }
  53. static float get_mesh_y(int16_t j) { return grid_start.y + j * grid_spacing.y; }
  54. static float get_z_correction(const xy_pos_t &raw);
  55. #if IS_CARTESIAN && DISABLED(SEGMENT_LEVELED_MOVES)
  56. static void line_to_destination(const_feedRate_t scaled_fr_mm_s, uint16_t x_splits=0xFFFF, uint16_t y_splits=0xFFFF);
  57. #endif
  58. };
  59. extern LevelingBilinear bbl;
  60. #define _GET_MESH_X(I) bbl.get_mesh_x(I)
  61. #define _GET_MESH_Y(J) bbl.get_mesh_y(J)
  62. #define Z_VALUES_ARR bbl.get_z_values()