Cleanups for leveling-related code

This commit is contained in:
Scott Lahteine 2018-11-03 02:13:10 -05:00
parent cc2bc67440
commit 44fa7fb18c
9 changed files with 30 additions and 40 deletions

View file

@ -25,6 +25,7 @@
#if ENABLED(AUTO_BED_LEVELING_BILINEAR) #if ENABLED(AUTO_BED_LEVELING_BILINEAR)
#include "abl.h" #include "abl.h"
#include "../bedlevel.h"
#include "../../../module/motion.h" #include "../../../module/motion.h"

View file

@ -21,27 +21,23 @@
*/ */
#pragma once #pragma once
#include "../../../inc/MarlinConfig.h" #include "../../../inc/MarlinConfigPre.h"
#if ENABLED(AUTO_BED_LEVELING_BILINEAR) extern int bilinear_grid_spacing[2], bilinear_start[2];
extern float bilinear_grid_factor[2],
z_values[GRID_MAX_POINTS_X][GRID_MAX_POINTS_Y];
float bilinear_z_offset(const float raw[XYZ]);
#include "../bedlevel.h" void extrapolate_unprobed_bed_level();
void print_bilinear_leveling_grid();
void refresh_bed_level();
#if ENABLED(ABL_BILINEAR_SUBDIVISION)
void print_bilinear_leveling_grid_virt();
void bed_level_virt_interpolate();
#endif
extern int bilinear_grid_spacing[2], bilinear_start[2]; #if IS_CARTESIAN && DISABLED(SEGMENT_LEVELED_MOVES)
extern float bilinear_grid_factor[2], void bilinear_line_to_destination(const float fr_mm_s, uint16_t x_splits=0xFFFF, uint16_t y_splits=0xFFFF);
z_values[GRID_MAX_POINTS_X][GRID_MAX_POINTS_Y]; #endif
float bilinear_z_offset(const float raw[XYZ]);
void extrapolate_unprobed_bed_level(); #define Z_VALUES(X,Y) z_values[X][Y]
void print_bilinear_leveling_grid();
void refresh_bed_level();
#if ENABLED(ABL_BILINEAR_SUBDIVISION)
void print_bilinear_leveling_grid_virt();
void bed_level_virt_interpolate();
#endif
#if IS_CARTESIAN && DISABLED(SEGMENT_LEVELED_MOVES)
void bilinear_line_to_destination(const float fr_mm_s, uint16_t x_splits=0xFFFF, uint16_t y_splits=0xFFFF);
#endif
#endif // AUTO_BED_LEVELING_BILINEAR

View file

@ -80,6 +80,6 @@ void reset_bed_level();
#include "mbl/mesh_bed_leveling.h" #include "mbl/mesh_bed_leveling.h"
#elif ENABLED(AUTO_BED_LEVELING_UBL) #elif ENABLED(AUTO_BED_LEVELING_UBL)
#include "ubl/ubl.h" #include "ubl/ubl.h"
#elif HAS_ABL #elif ENABLED(AUTO_BED_LEVELING_BILINEAR)
#include "abl/abl.h" #include "abl/abl.h"
#endif #endif

View file

@ -118,3 +118,5 @@ public:
}; };
extern mesh_bed_leveling mbl; extern mesh_bed_leveling mbl;
#define Z_VALUES(X,Y) mbl.z_values[X][Y]

View file

@ -370,3 +370,5 @@ class unified_bed_leveling {
}; // class unified_bed_leveling }; // class unified_bed_leveling
extern unified_bed_leveling ubl; extern unified_bed_leveling ubl;
#define Z_VALUES(X,Y) ubl.z_values[X][Y]

View file

@ -105,12 +105,6 @@ void GcodeSuite::M420() {
#if HAS_MESH #if HAS_MESH
#if ENABLED(MESH_BED_LEVELING)
#define Z_VALUES(X,Y) mbl.z_values[X][Y]
#else
#define Z_VALUES(X,Y) z_values[X][Y]
#endif
// Subtract the given value or the mean from all mesh values // Subtract the given value or the mean from all mesh values
if (leveling_is_valid() && parser.seen('C')) { if (leveling_is_valid() && parser.seen('C')) {
const float cval = parser.value_float(); const float cval = parser.value_float();

View file

@ -19,15 +19,13 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
* *
*/ */
#pragma once
/** /**
* Conditionals_LCD.h * Conditionals_LCD.h
* Conditionals that need to be set before Configuration_adv.h or pins.h * Conditionals that need to be set before Configuration_adv.h or pins.h
*/ */
#ifndef CONDITIONALS_LCD_H // Get the LCD defines which are needed first
#define CONDITIONALS_LCD_H
#define LCD_HAS_DIRECTIONAL_BUTTONS (BUTTON_EXISTS(UP) || BUTTON_EXISTS(DWN) || BUTTON_EXISTS(LFT) || BUTTON_EXISTS(RT)) #define LCD_HAS_DIRECTIONAL_BUTTONS (BUTTON_EXISTS(UP) || BUTTON_EXISTS(DWN) || BUTTON_EXISTS(LFT) || BUTTON_EXISTS(RT))
#if ENABLED(CARTESIO_UI) #if ENABLED(CARTESIO_UI)
@ -557,6 +555,10 @@
#define HOMING_Z_WITH_PROBE (HAS_BED_PROBE && Z_HOME_DIR < 0 && ENABLED(Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN)) #define HOMING_Z_WITH_PROBE (HAS_BED_PROBE && Z_HOME_DIR < 0 && ENABLED(Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN))
#ifdef GRID_MAX_POINTS_X
#define GRID_MAX_POINTS ((GRID_MAX_POINTS_X) * (GRID_MAX_POINTS_Y))
#endif
#define HAS_SOFTWARE_ENDSTOPS (ENABLED(MIN_SOFTWARE_ENDSTOPS) || ENABLED(MAX_SOFTWARE_ENDSTOPS)) #define HAS_SOFTWARE_ENDSTOPS (ENABLED(MIN_SOFTWARE_ENDSTOPS) || ENABLED(MAX_SOFTWARE_ENDSTOPS))
#define HAS_RESUME_CONTINUE (ENABLED(EXTENSIBLE_UI) || ENABLED(NEWPANEL) || ENABLED(EMERGENCY_PARSER)) #define HAS_RESUME_CONTINUE (ENABLED(EXTENSIBLE_UI) || ENABLED(NEWPANEL) || ENABLED(EMERGENCY_PARSER))
#define HAS_COLOR_LEDS (ENABLED(BLINKM) || ENABLED(RGB_LED) || ENABLED(RGBW_LED) || ENABLED(PCA9632) || ENABLED(NEOPIXEL_LED)) #define HAS_COLOR_LEDS (ENABLED(BLINKM) || ENABLED(RGB_LED) || ENABLED(RGBW_LED) || ENABLED(PCA9632) || ENABLED(NEOPIXEL_LED))
@ -566,4 +568,6 @@
#define Z_MULTI_STEPPER_DRIVERS (ENABLED(Z_DUAL_STEPPER_DRIVERS) || ENABLED(Z_TRIPLE_STEPPER_DRIVERS)) #define Z_MULTI_STEPPER_DRIVERS (ENABLED(Z_DUAL_STEPPER_DRIVERS) || ENABLED(Z_TRIPLE_STEPPER_DRIVERS))
#define Z_MULTI_ENDSTOPS (ENABLED(Z_DUAL_ENDSTOPS) || ENABLED(Z_TRIPLE_ENDSTOPS)) #define Z_MULTI_ENDSTOPS (ENABLED(Z_DUAL_ENDSTOPS) || ENABLED(Z_TRIPLE_ENDSTOPS))
#endif // CONDITIONALS_LCD_H #define IS_SCARA (ENABLED(MORGAN_SCARA) || ENABLED(MAKERARM_SCARA))
#define IS_KINEMATIC (ENABLED(DELTA) || IS_SCARA)
#define IS_CARTESIAN !IS_KINEMATIC

View file

@ -43,10 +43,6 @@
#define NOT_A_PIN 0 // For PINS_DEBUGGING #define NOT_A_PIN 0 // For PINS_DEBUGGING
#endif #endif
#define IS_SCARA (ENABLED(MORGAN_SCARA) || ENABLED(MAKERARM_SCARA))
#define IS_KINEMATIC (ENABLED(DELTA) || IS_SCARA)
#define IS_CARTESIAN !IS_KINEMATIC
#define HAS_CLASSIC_JERK (IS_KINEMATIC || DISABLED(JUNCTION_DEVIATION)) #define HAS_CLASSIC_JERK (IS_KINEMATIC || DISABLED(JUNCTION_DEVIATION))
/** /**
@ -1538,9 +1534,6 @@
#define LCD_TIMEOUT_TO_STATUS 15000 #define LCD_TIMEOUT_TO_STATUS 15000
#endif #endif
// Shorthand
#define GRID_MAX_POINTS ((GRID_MAX_POINTS_X) * (GRID_MAX_POINTS_Y))
// Add commands that need sub-codes to this list // Add commands that need sub-codes to this list
#define USE_GCODE_SUBCODES ENABLED(G38_PROBE_TARGET) || ENABLED(CNC_COORDINATE_SYSTEMS) || ENABLED(POWER_LOSS_RECOVERY) #define USE_GCODE_SUBCODES ENABLED(G38_PROBE_TARGET) || ENABLED(CNC_COORDINATE_SYSTEMS) || ENABLED(POWER_LOSS_RECOVERY)

View file

@ -320,8 +320,6 @@
#if ENABLED(AUTO_BED_LEVELING_UBL) #if ENABLED(AUTO_BED_LEVELING_UBL)
void lcd_mesh_edit_setup(const float &initial); void lcd_mesh_edit_setup(const float &initial);
float lcd_mesh_edit(); float lcd_mesh_edit();
void lcd_z_offset_edit_setup(const float &initial);
float lcd_z_offset_edit();
#endif #endif
#if ENABLED(SCROLL_LONG_FILENAMES) #if ENABLED(SCROLL_LONG_FILENAMES)