Followup to BLTouch (#13422)

This commit is contained in:
InsanityAutomation 2019-03-18 17:31:11 -04:00 committed by Scott Lahteine
parent 3fb8489ae3
commit 5b2c37d6c1
10 changed files with 56 additions and 49 deletions

View File

@ -40,4 +40,6 @@ void refresh_bed_level();
void bilinear_line_to_destination(const float fr_mm_s, uint16_t x_splits=0xFFFF, uint16_t y_splits=0xFFFF);
#endif
#define Z_VALUES(X,Y) z_values[X][Y]
#define _GET_MESH_X(I) (bilinear_start[X_AXIS] + (I) * bilinear_grid_spacing[X_AXIS])
#define _GET_MESH_Y(J) (bilinear_start[Y_AXIS] + (J) * bilinear_grid_spacing[Y_AXIS])
#define Z_VALUES_ARR z_values

View File

@ -48,38 +48,35 @@ void reset_bed_level();
void set_z_fade_height(const float zfh, const bool do_report=true);
#endif
#if EITHER(AUTO_BED_LEVELING_BILINEAR, MESH_BED_LEVELING)
#include <stdint.h>
typedef float (*element_2d_fn)(const uint8_t, const uint8_t);
/**
* Print calibration results for plotting or manual frame adjustment.
*/
void print_2d_array(const uint8_t sx, const uint8_t sy, const uint8_t precision, element_2d_fn fn);
#endif
#if EITHER(MESH_BED_LEVELING, PROBE_MANUALLY)
void _manual_goto_xy(const float &x, const float &y);
#endif
#if ENABLED(AUTO_BED_LEVELING_BILINEAR)
#define _GET_MESH_X(I) (bilinear_start[X_AXIS] + (I) * bilinear_grid_spacing[X_AXIS])
#define _GET_MESH_Y(J) (bilinear_start[Y_AXIS] + (J) * bilinear_grid_spacing[Y_AXIS])
#elif ENABLED(AUTO_BED_LEVELING_UBL)
#define _GET_MESH_X(I) ubl.mesh_index_to_xpos(I)
#define _GET_MESH_Y(J) ubl.mesh_index_to_ypos(J)
#elif ENABLED(MESH_BED_LEVELING)
#define _GET_MESH_X(I) mbl.index_to_xpos[I]
#define _GET_MESH_Y(J) mbl.index_to_ypos[J]
#endif
#if HAS_MESH
typedef float (&bed_mesh_t)[GRID_MAX_POINTS_X][GRID_MAX_POINTS_Y];
#if ENABLED(AUTO_BED_LEVELING_BILINEAR)
#include "abl/abl.h"
#elif ENABLED(AUTO_BED_LEVELING_UBL)
#include "ubl/ubl.h"
#elif ENABLED(MESH_BED_LEVELING)
#include "mbl/mesh_bed_leveling.h"
#endif
#define Z_VALUES(X,Y) Z_VALUES_ARR[X][Y]
#if EITHER(AUTO_BED_LEVELING_BILINEAR, MESH_BED_LEVELING)
#include <stdint.h>
typedef float (*element_2d_fn)(const uint8_t, const uint8_t);
/**
* Print calibration results for plotting or manual frame adjustment.
*/
void print_2d_array(const uint8_t sx, const uint8_t sy, const uint8_t precision, element_2d_fn fn);
#endif
#if ENABLED(MESH_BED_LEVELING)
#include "mbl/mesh_bed_leveling.h"
#elif ENABLED(AUTO_BED_LEVELING_UBL)
#include "ubl/ubl.h"
#elif ENABLED(AUTO_BED_LEVELING_BILINEAR)
#include "abl/abl.h"
#endif

View File

@ -34,6 +34,9 @@ enum MeshLevelingState : char {
#define MESH_X_DIST ((MESH_MAX_X - (MESH_MIN_X)) / (GRID_MAX_POINTS_X - 1))
#define MESH_Y_DIST ((MESH_MAX_Y - (MESH_MIN_Y)) / (GRID_MAX_POINTS_Y - 1))
#define _GET_MESH_X(I) mbl.index_to_xpos[I]
#define _GET_MESH_Y(J) mbl.index_to_ypos[J]
#define Z_VALUES_ARR mbl.z_values
class mesh_bed_leveling {
public:
@ -118,5 +121,3 @@ public:
};
extern mesh_bed_leveling mbl;
#define Z_VALUES(X,Y) mbl.z_values[X][Y]

View File

@ -335,7 +335,9 @@ class unified_bed_leveling {
extern unified_bed_leveling ubl;
#define Z_VALUES(X,Y) ubl.z_values[X][Y]
#define _GET_MESH_X(I) ubl.mesh_index_to_xpos(I)
#define _GET_MESH_Y(J) ubl.mesh_index_to_ypos(J)
#define Z_VALUES_ARR ubl.z_values
// Prevent debugging propagating to other files
#include "../../../core/debug_out.h"

View File

@ -69,19 +69,19 @@ bool BLTouch::set_deployed(const bool in_deploy) {
}
}
#if ENABLED(BLTOUCH_V3)
#if ENABLED(BLTOUCH_FORCE_5V_MODE)
set_5V_mode(); // Assume 5V DC logic level if endstop pullup resistors are enabled
#else
set_OD_mode();
#endif
#if ENABLED(BLTOUCH_FORCE_5V_MODE)
set_5V_mode();
#elif ENABLED(BLTOUCH_FORCE_OPEN_DRAIN_MODE)
set_OD_mode();
#elif ENABLED(ENDSTOPPULLUPS) || ALL(Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN, ENDSTOPPULLUP_ZMIN) || (USES_Z_MIN_PROBE_ENDSTOP && ENABLED(ENDSTOPPULLUP_ZMIN_PROBE))
set_5V_mode(); // Assume 5V DC logic level if endstop pullup resistors are enabled
#else
set_OD_mode();
#endif
if (in_deploy) {
_deploy();
#if ENABLED(BLTOUCH_V3)
set_SW_mode(); // Ensure Switch mode is activated for BLTouch V3. Ignored on V2.
#endif
set_SW_mode(); // Ensure Switch mode is activated for BLTouch V3. Ignored on V2.
}
else _stow();

View File

@ -38,6 +38,10 @@
#include "../../module/probe.h"
#endif
#if ENABLED(BLTOUCH)
#include "../../feature/bltouch.h"
#endif
#if HAS_LEVELING
#include "../../feature/bedlevel/bedlevel.h"
#endif

View File

@ -588,7 +588,7 @@ namespace ExtUI {
void setLevelingActive(const bool state) { set_bed_leveling_enabled(state); }
#if HAS_MESH
bool getMeshValid() { return leveling_is_valid(); }
bed_mesh_t getMeshArray() { return Z_VALUES; }
bed_mesh_t getMeshArray() { return Z_VALUES_ARR; }
void setMeshPoint(const uint8_t xpos, const uint8_t ypos, const float zoff) {
if (WITHIN(xpos, 0, GRID_MAX_POINTS_X) && WITHIN(ypos, 0, GRID_MAX_POINTS_Y)) {
Z_VALUES(xpos, ypos) = zoff;

View File

@ -95,7 +95,6 @@ namespace ExtUI {
bool getLevelingActive();
void setLevelingActive(const bool);
#if HAS_MESH
typedef float (&bed_mesh_t)[GRID_MAX_POINTS_X][GRID_MAX_POINTS_Y];
bool getMeshValid();
bed_mesh_t getMeshArray();
void setMeshPoint(const uint8_t xpos, const uint8_t ypos, const float zval);

View File

@ -63,10 +63,12 @@
//
// Servos
//
#ifdef IS_RAMPS_13
#define SERVO0_PIN 7 // RAMPS_13 // Will conflict with BTN_EN2 on LCD_I2C_VIKI
#else
#define SERVO0_PIN 11
#ifndef SERVO0_PIN
#ifdef IS_RAMPS_13
#define SERVO0_PIN 7 // RAMPS_13 // Will conflict with BTN_EN2 on LCD_I2C_VIKI
#else
#define SERVO0_PIN 11
#endif
#endif
#define SERVO1_PIN 6
#define SERVO2_PIN 5

View File

@ -15,7 +15,7 @@ exec_test $1 $2 "RAMPS4DUE_EFB S_CURVE_ACCELERATION EEPROM_SETTINGS"
restore_configs
opt_set MOTHERBOARD BOARD_RADDS
opt_enable USE_XMAX_PLUG USE_YMAX_PLUG FIX_MOUNTED_PROBE AUTO_BED_LEVELING_BILINEAR \
opt_enable USE_XMAX_PLUG USE_YMAX_PLUG BLTOUCH AUTO_BED_LEVELING_BILINEAR \
Z_TRIPLE_STEPPER_DRIVERS Z_TRIPLE_ENDSTOPS Z_STEPPER_AUTO_ALIGN
opt_add Z2_MAX_ENDSTOP_INVERTING false
opt_add Z3_MAX_ENDSTOP_INVERTING false