New feature: BED_SKEW_CORRECTION
This commit is contained in:
@ -888,6 +888,49 @@
|
||||
#define Z_PROBE_OFFSET_FROM_EXTRUDER 0
|
||||
#endif
|
||||
|
||||
/**
|
||||
* XYZ Bed Skew Correction
|
||||
*/
|
||||
#if ENABLED(SKEW_CORRECTION)
|
||||
#define SKEW_FACTOR_MIN -1
|
||||
#define SKEW_FACTOR_MAX 1
|
||||
|
||||
#define _GET_SIDE(a,b,c) (SQRT(2*sq(a)+2*sq(b)-4*sq(c))*0.5)
|
||||
#define _SKEW_SIDE(a,b,c) tan(M_PI*0.5-acos((sq(a)-sq(b)-sq(c))/(2*c*b)))
|
||||
#define _SKEW_FACTOR(a,b,c) _SKEW_SIDE(a,_GET_SIDE(a,b,c),c)
|
||||
|
||||
#ifndef XY_SKEW_FACTOR
|
||||
constexpr float XY_SKEW_FACTOR = (
|
||||
#if defined(XY_DIAG_AC) && defined(XY_DIAG_BD) && defined(XY_SIDE_AD)
|
||||
_SKEW_FACTOR(XY_DIAG_AC, XY_DIAG_BD, XY_SIDE_AD)
|
||||
#else
|
||||
0.0
|
||||
#endif
|
||||
);
|
||||
#endif
|
||||
#ifndef XZ_SKEW_FACTOR
|
||||
#if defined(XY_SIDE_AD) && !defined(XZ_SIDE_AD)
|
||||
#define XZ_SIDE_AD XY_SIDE_AD
|
||||
#endif
|
||||
constexpr float XZ_SKEW_FACTOR = (
|
||||
#if defined(XZ_DIAG_AC) && defined(XZ_DIAG_BD) && defined(XZ_SIDE_AD)
|
||||
_SKEW_FACTOR(XZ_DIAG_AC, XZ_DIAG_BD, XZ_SIDE_AD)
|
||||
#else
|
||||
0.0
|
||||
#endif
|
||||
);
|
||||
#endif
|
||||
#ifndef YZ_SKEW_FACTOR
|
||||
constexpr float YZ_SKEW_FACTOR = (
|
||||
#if defined(YZ_DIAG_AC) && defined(YZ_DIAG_BD) && defined(YZ_SIDE_AD)
|
||||
_SKEW_FACTOR(YZ_DIAG_AC, YZ_DIAG_BD, YZ_SIDE_AD)
|
||||
#else
|
||||
0.0
|
||||
#endif
|
||||
);
|
||||
#endif
|
||||
#endif // SKEW_CORRECTION
|
||||
|
||||
/**
|
||||
* Heater & Fan Pausing
|
||||
*/
|
||||
|
@ -1483,4 +1483,18 @@ static_assert(COUNT(sanity_arr_3) <= XYZE_N, "DEFAULT_MAX_ACCELERATION has too m
|
||||
#error "LED_CONTROL_MENU requires an LCD controller."
|
||||
#endif
|
||||
|
||||
#if ENABLED(SKEW_CORRECTION)
|
||||
#if !defined(XY_SKEW_FACTOR) && !(defined(XY_DIAG_AC) && defined(XY_DIAG_BD) && defined(XY_SIDE_AD))
|
||||
#error "SKEW_CORRECTION requires XY_SKEW_FACTOR or XY_DIAG_AC, XY_DIAG_BD, XY_SIDE_AD."
|
||||
#endif
|
||||
#if ENABLED(SKEW_CORRECTION_FOR_Z)
|
||||
#if !defined(XZ_SKEW_FACTOR) && !(defined(XZ_DIAG_AC) && defined(XZ_DIAG_BD) && defined(XZ_SIDE_AD))
|
||||
#error "SKEW_CORRECTION requires XZ_SKEW_FACTOR or XZ_DIAG_AC, XZ_DIAG_BD, XZ_SIDE_AD."
|
||||
#endif
|
||||
#if !defined(YZ_SKEW_FACTOR) && !(defined(YZ_DIAG_AC) && defined(YZ_DIAG_BD) && defined(YZ_SIDE_AD))
|
||||
#error "SKEW_CORRECTION requires YZ_SKEW_FACTOR or YZ_DIAG_AC, YZ_DIAG_BD, YZ_SIDE_AD."
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#endif // _SANITYCHECK_H_
|
||||
|
Reference in New Issue
Block a user