Merge pull request #6491 from thinkyhead/rc_cleanup_wednesday
Various cleanups for recent merges
This commit is contained in:
commit
f169c04604
@ -2060,65 +2060,66 @@ static void clean_up_after_endstop_or_probe_move() {
|
||||
#endif
|
||||
|
||||
#if ENABLED(BLTOUCH)
|
||||
|
||||
void bltouch_command(int angle) {
|
||||
servo[Z_ENDSTOP_SERVO_NR].move(angle); // Give the BL-Touch the command and wait
|
||||
safe_delay(BLTOUCH_DELAY);
|
||||
}
|
||||
|
||||
//
|
||||
// The BL-Touch probes have a HAL effect sensor. The high currents switching
|
||||
// on and off cause big magnetic fields that can affect the repeatability of the
|
||||
// sensor. So, for BL-Touch probes, we turn off the heaters during the actual probe.
|
||||
// And then we quickly turn them back on after we have sampled the point
|
||||
//
|
||||
/**
|
||||
* BLTouch probes have a Hall effect sensor. The high currents switching
|
||||
* on and off cause a magnetic field that can affect the repeatability of the
|
||||
* sensor. So for BLTouch probes, heaters are turned off during the probe,
|
||||
* then quickly turned back on after the point is sampled.
|
||||
*/
|
||||
#if ENABLED(BLTOUCH_HEATERS_OFF)
|
||||
void turn_heaters_on_or_off_for_bltouch(const bool deploy) {
|
||||
static int8_t bltouch_recursion_cnt=0;
|
||||
static millis_t last_emi_protection=0;
|
||||
|
||||
bool set_heaters_for_bltouch(const bool deploy) {
|
||||
static bool heaters_were_disabled = false;
|
||||
static millis_t next_emi_protection;
|
||||
static float temps_at_entry[HOTENDS];
|
||||
|
||||
#if HAS_TEMP_BED
|
||||
static float bed_temp_at_entry;
|
||||
#endif
|
||||
|
||||
if (deploy && bltouch_recursion_cnt>0) // if already in the correct state, we don't need to do anything
|
||||
return; // with the heaters.
|
||||
if (!deploy && bltouch_recursion_cnt<1) // if already in the correct state, we don't need to do anything
|
||||
return; // with the heaters.
|
||||
// If called out of order or far apart something is seriously wrong
|
||||
if (deploy == heaters_were_disabled
|
||||
|| (next_emi_protection && ELAPSED(millis(), next_emi_protection)))
|
||||
kill(PSTR(MSG_KILLED));
|
||||
|
||||
if (deploy) {
|
||||
bltouch_recursion_cnt++;
|
||||
last_emi_protection = millis();
|
||||
HOTEND_LOOP() temps_at_entry[e] = thermalManager.degTargetHotend(e); // save the current target temperatures
|
||||
HOTEND_LOOP() thermalManager.setTargetHotend(0, e); // so we know what to restore them to.
|
||||
|
||||
next_emi_protection = millis() + 20 * 1000UL;
|
||||
HOTEND_LOOP() {
|
||||
temps_at_entry[e] = thermalManager.degTargetHotend(e);
|
||||
thermalManager.setTargetHotend(0, e);
|
||||
}
|
||||
#if HAS_TEMP_BED
|
||||
bed_temp_at_entry = thermalManager.degTargetBed();
|
||||
thermalManager.setTargetBed(0.0);
|
||||
thermalManager.setTargetBed(0);
|
||||
#endif
|
||||
}
|
||||
else {
|
||||
bltouch_recursion_cnt--; // the heaters are only turned back on
|
||||
if (bltouch_recursion_cnt==0 && ((last_emi_protection+20000L)>millis())) { // if everything is perfect. It is expected
|
||||
HOTEND_LOOP() thermalManager.setTargetHotend(temps_at_entry[e], e); // that the bltouch_recursion_cnt is zero and
|
||||
#if HAS_TEMP_BED // that the heaters were shut off less than
|
||||
thermalManager.setTargetBed(bed_temp_at_entry); // 20 seconds ago
|
||||
HOTEND_LOOP() thermalManager.setTargetHotend(temps_at_entry[e], e);
|
||||
#if HAS_TEMP_BED
|
||||
thermalManager.setTargetBed(bed_temp_at_entry);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // BLTOUCH_HEATERS_OFF
|
||||
|
||||
void set_bltouch_deployed(const bool deploy) {
|
||||
#if ENABLED(BLTOUCH_HEATERS_OFF)
|
||||
turn_heaters_on_or_off_for_bltouch(deploy);
|
||||
set_heaters_for_bltouch(deploy);
|
||||
#endif
|
||||
if (deploy && TEST_BLTOUCH()) { // If BL-Touch says it's triggered
|
||||
bltouch_command(BLTOUCH_RESET); // try to reset it.
|
||||
bltouch_command(BLTOUCH_DEPLOY); // Also needs to deploy and stow to
|
||||
bltouch_command(BLTOUCH_STOW); // clear the triggered condition.
|
||||
safe_delay(1500); // wait for internal self test to complete
|
||||
// measured completion time was 0.65 seconds
|
||||
// after reset, deploy & stow sequence
|
||||
safe_delay(1500); // Wait for internal self-test to complete.
|
||||
// (Measured completion time was 0.65 seconds
|
||||
// after reset, deploy, and stow sequence)
|
||||
if (TEST_BLTOUCH()) { // If it still claims to be triggered...
|
||||
SERIAL_ERROR_START;
|
||||
SERIAL_ERRORLNPGM(MSG_STOP_BLTOUCH);
|
||||
@ -2134,7 +2135,8 @@ static void clean_up_after_endstop_or_probe_move() {
|
||||
}
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // BLTOUCH
|
||||
|
||||
// returns false for ok and true for failure
|
||||
bool set_probe_deployed(bool deploy) {
|
||||
@ -2146,10 +2148,8 @@ static void clean_up_after_endstop_or_probe_move() {
|
||||
}
|
||||
#endif
|
||||
|
||||
#if ENABLED(BLTOUCH)
|
||||
#if ENABLED(BLTOUCH_HEATERS_OFF)
|
||||
turn_heaters_on_or_off_for_bltouch(deploy);
|
||||
#endif
|
||||
#if ENABLED(BLTOUCH) && ENABLED(BLTOUCH_HEATERS_OFF)
|
||||
set_heaters_for_bltouch(deploy);
|
||||
#endif
|
||||
|
||||
if (endstops.z_probe_enabled == deploy) return false;
|
||||
@ -2330,15 +2330,15 @@ static void clean_up_after_endstop_or_probe_move() {
|
||||
return current_position[Z_AXIS] + zprobe_zoffset;
|
||||
}
|
||||
|
||||
//
|
||||
// - Move to the given XY
|
||||
// - Deploy the probe, if not already deployed
|
||||
// - Probe the bed, get the Z position
|
||||
// - Depending on the 'stow' flag
|
||||
// - Stow the probe, or
|
||||
// - Raise to the BETWEEN height
|
||||
// - Return the probed Z position
|
||||
//
|
||||
/**
|
||||
* - Move to the given XY
|
||||
* - Deploy the probe, if not already deployed
|
||||
* - Probe the bed, get the Z position
|
||||
* - Depending on the 'stow' flag
|
||||
* - Stow the probe, or
|
||||
* - Raise to the BETWEEN height
|
||||
* - Return the probed Z position
|
||||
*/
|
||||
float probe_pt(const float x, const float y, const bool stow/*=true*/, const int verbose_level/*=1*/) {
|
||||
#if ENABLED(DEBUG_LEVELING_FEATURE)
|
||||
if (DEBUGGING(LEVELING)) {
|
||||
@ -2507,14 +2507,14 @@ static void clean_up_after_endstop_or_probe_move() {
|
||||
|
||||
#if ENABLED(AUTO_BED_LEVELING_BILINEAR) || ENABLED(MESH_BED_LEVELING)
|
||||
|
||||
//
|
||||
// Enable if you prefer your output in JSON format
|
||||
// suitable for SCAD or JavaScript mesh visualizers.
|
||||
//
|
||||
// Visualize meshes in OpenSCAD using the included script.
|
||||
//
|
||||
// buildroot/shared/scripts/MarlinMesh.scad
|
||||
//
|
||||
/**
|
||||
* Enable to produce output in JSON format suitable
|
||||
* for SCAD or JavaScript mesh visualizers.
|
||||
*
|
||||
* Visualize meshes in OpenSCAD using the included script.
|
||||
*
|
||||
* buildroot/shared/scripts/MarlinMesh.scad
|
||||
*/
|
||||
//#define SCAD_MESH_OUTPUT
|
||||
|
||||
/**
|
||||
|
@ -293,6 +293,7 @@
|
||||
#define HEATER_1_MAXTEMP 245
|
||||
#define HEATER_2_MAXTEMP 245
|
||||
#define HEATER_3_MAXTEMP 245
|
||||
#define HEATER_4_MAXTEMP 245
|
||||
#define BED_MAXTEMP 115
|
||||
|
||||
//===========================================================================
|
||||
@ -317,12 +318,16 @@
|
||||
|
||||
// If you are using a pre-configured hotend then you can use one of the value sets by uncommenting it
|
||||
|
||||
|
||||
// FolgerTech i3-2020
|
||||
#define DEFAULT_Kp 11.50
|
||||
#define DEFAULT_Ki 0.50
|
||||
#define DEFAULT_Kd 60.00
|
||||
|
||||
// Ultimaker
|
||||
//#define DEFAULT_Kp 22.2
|
||||
//#define DEFAULT_Ki 1.08
|
||||
//#define DEFAULT_Kd 114
|
||||
|
||||
// MakerGear
|
||||
//#define DEFAULT_Kp 7.0
|
||||
//#define DEFAULT_Ki 0.1
|
||||
@ -563,7 +568,6 @@
|
||||
*/
|
||||
//#define FIX_MOUNTED_PROBE
|
||||
|
||||
|
||||
/**
|
||||
* Z Servo Probe, such as an endstop switch on a rotating arm.
|
||||
* NUM_SERVOS also needs to be set. This is found later in this file. Set it to
|
||||
@ -631,8 +635,10 @@
|
||||
#define XY_PROBE_SPEED 7500
|
||||
// Speed for the first approach when double-probing (with PROBE_DOUBLE_TOUCH)
|
||||
#define Z_PROBE_SPEED_FAST HOMING_FEEDRATE_Z
|
||||
|
||||
// Speed for the "accurate" probe of each point
|
||||
#define Z_PROBE_SPEED_SLOW (Z_PROBE_SPEED_FAST / 2)
|
||||
|
||||
// Use double touch for probing
|
||||
//#define PROBE_DOUBLE_TOUCH
|
||||
|
||||
@ -694,7 +700,6 @@
|
||||
*/
|
||||
|
||||
//#define Z_MIN_PROBE_ENDSTOP
|
||||
|
||||
#define Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN
|
||||
|
||||
// Enable Z Probe Repeatability test to see how accurate your probe is
|
||||
@ -771,7 +776,6 @@
|
||||
#define Y_HOME_DIR -1
|
||||
#define Z_HOME_DIR -1
|
||||
|
||||
|
||||
// @section machine
|
||||
|
||||
// Travel limits after homing (units are in mm)
|
||||
@ -804,7 +808,6 @@
|
||||
//===========================================================================
|
||||
//=============================== Bed Leveling ==============================
|
||||
//===========================================================================
|
||||
|
||||
// @section bedlevel
|
||||
|
||||
/**
|
||||
@ -851,7 +854,6 @@
|
||||
#define AUTO_BED_LEVELING_UBL
|
||||
//#define MESH_BED_LEVELING
|
||||
|
||||
|
||||
/**
|
||||
* Enable detailed logging of G28, G29, M48, etc.
|
||||
* Turn on with the command 'M111 S32'.
|
||||
@ -902,7 +904,6 @@
|
||||
|
||||
// 3 arbitrary points to probe.
|
||||
// A simple cross-product is used to estimate the plane of the bed.
|
||||
|
||||
#define ABL_PROBE_PT_1_X 39
|
||||
#define ABL_PROBE_PT_1_Y 170
|
||||
#define ABL_PROBE_PT_2_X 39
|
||||
@ -928,6 +929,7 @@
|
||||
#define UBL_PROBE_PT_3_X 180
|
||||
#define UBL_PROBE_PT_3_Y 25
|
||||
#define UBL_G26_MESH_EDITING // Enable G26 mesh editing
|
||||
|
||||
#elif ENABLED(MESH_BED_LEVELING)
|
||||
|
||||
//===========================================================================
|
||||
@ -1607,7 +1609,7 @@
|
||||
*/
|
||||
//#define FILAMENT_WIDTH_SENSOR
|
||||
|
||||
#define DEFAULT_NOMINAL_FILAMENT_DIA 1.75 //Enter the diameter (in mm) of the filament generally used (3.0 mm or 1.75 mm) - this is then used in the slicer software. Used for sensor reading validation
|
||||
#define DEFAULT_NOMINAL_FILAMENT_DIA 1.75 // (mm) Diameter of the filament generally used (3.0 or 1.75mm), also used in the slicer. Used to validate sensor reading.
|
||||
|
||||
#if ENABLED(FILAMENT_WIDTH_SENSOR)
|
||||
#define FILAMENT_SENSOR_EXTRUDER_NUM 0 // Index of the extruder that has the filament sensor (0,1,2,3)
|
||||
|
@ -327,7 +327,7 @@
|
||||
// Default x offset in duplication mode (typically set to half print bed width)
|
||||
#define DEFAULT_DUPLICATION_X_OFFSET 100
|
||||
|
||||
#endif //DUAL_X_CARRIAGE
|
||||
#endif // DUAL_X_CARRIAGE
|
||||
|
||||
// Activate a solenoid on the active extruder with M380. Disable all with M381.
|
||||
// Define SOL0_PIN, SOL1_PIN, etc., for each extruder that has a solenoid.
|
||||
@ -419,7 +419,6 @@
|
||||
* M909, M910 & LCD - only PRINTRBOARD_REVF & RIGIDBOARD_V2
|
||||
*/
|
||||
//#define PWM_MOTOR_CURRENT {1300, 1300, 1250} // Values in milliamps
|
||||
|
||||
//#define DIGIPOT_MOTOR_CURRENT {135,135,135,135,135} // Values 0-255 (RAMBO 135 = ~0.75A, 185 = ~1A)
|
||||
//#define DAC_MOTOR_CURRENT_DEFAULT { 70, 80, 90, 80 } // Default drive percent - X, Y, Z, E axis
|
||||
|
||||
@ -587,10 +586,9 @@
|
||||
*/
|
||||
#define BABYSTEPPING
|
||||
#if ENABLED(BABYSTEPPING)
|
||||
#define BABYSTEP_XY //not only z, but also XY in the menu. more clutter, more functions
|
||||
//not implemented for deltabots!
|
||||
#define BABYSTEP_INVERT_Z false //true for inverse movements in Z
|
||||
#define BABYSTEP_MULTIPLICATOR 2 //faster movements
|
||||
#define BABYSTEP_XY // Also enable X/Y Babystepping. Not supported on DELTA!
|
||||
#define BABYSTEP_INVERT_Z false // Change if Z babysteps should go the other way
|
||||
#define BABYSTEP_MULTIPLICATOR 2 // Babysteps are very small. Increase for faster motion.
|
||||
//#define BABYSTEP_ZPROBE_OFFSET // Enable to combine M851 and Babystepping
|
||||
#define DOUBLECLICK_FOR_Z_BABYSTEPPING // Double-click on the Status Screen for Z Babystepping.
|
||||
#define DOUBLECLICK_MAX_INTERVAL 1250 // Maximum interval between clicks, in milliseconds.
|
||||
@ -1034,7 +1032,6 @@
|
||||
* (https://github.com/ameyer/Arduino-L6470)
|
||||
*/
|
||||
|
||||
|
||||
//#define HAVE_L6470DRIVER
|
||||
#if ENABLED(HAVE_L6470DRIVER)
|
||||
|
||||
@ -1155,7 +1152,6 @@
|
||||
*/
|
||||
//#define EXTENDED_CAPABILITIES_REPORT
|
||||
|
||||
|
||||
/**
|
||||
* Volumetric extrusion default state
|
||||
* Activate to make volumetric extrusion the default method,
|
||||
|
@ -130,7 +130,7 @@
|
||||
// The following define selects which electronics board you have.
|
||||
// Please choose the name from boards.h that matches your setup
|
||||
#ifndef MOTHERBOARD
|
||||
//#define MOTHERBOARD BOARD_RAMPS_14_EEF
|
||||
//#define MOTHERBOARD BOARD_RAMPS_14_EEF
|
||||
#define MOTHERBOARD BOARD_RAMPS_14_EFB // gMax users please note: This is a Roxy modification. I print on glass and
|
||||
// I use Marlin to control the bed's temperature. So, if you have a single nozzle
|
||||
// machine, this will work fine for you. You just set the
|
||||
@ -332,9 +332,9 @@
|
||||
#define DEFAULT_Kd 69.45
|
||||
|
||||
// Ultimaker
|
||||
// #define DEFAULT_Kp 22.2
|
||||
// #define DEFAULT_Ki 1.08
|
||||
// #define DEFAULT_Kd 114
|
||||
//#define DEFAULT_Kp 22.2
|
||||
//#define DEFAULT_Ki 1.08
|
||||
//#define DEFAULT_Kd 114
|
||||
|
||||
// MakerGear
|
||||
//#define DEFAULT_Kp 7.0
|
||||
@ -474,7 +474,7 @@
|
||||
#define X_MAX_ENDSTOP_INVERTING false // set to true to invert the logic of the endstop.
|
||||
#define Y_MAX_ENDSTOP_INVERTING true // set to true to invert the logic of the endstop.
|
||||
#define Z_MAX_ENDSTOP_INVERTING false // set to true to invert the logic of the endstop.
|
||||
#define Z_MIN_PROBE_ENDSTOP_INVERTING false // set to true to invert the logic of the endstop.
|
||||
#define Z_MIN_PROBE_ENDSTOP_INVERTING false // set to true to invert the logic of the probe.
|
||||
|
||||
// Enable this feature if all enabled endstop pins are interrupt-capable.
|
||||
// This will remove the need to poll the interrupt pins, saving many CPU cycles.
|
||||
@ -730,8 +730,6 @@
|
||||
#define Z_CLEARANCE_DEPLOY_PROBE 15 // Z Clearance for Deploy/Stow
|
||||
#define Z_CLEARANCE_BETWEEN_PROBES 6 // Z Clearance between probe points
|
||||
|
||||
//
|
||||
|
||||
// For M851 give a range for adjusting the Z probe offset
|
||||
#define Z_PROBE_OFFSET_RANGE_MIN -20
|
||||
#define Z_PROBE_OFFSET_RANGE_MAX 20
|
||||
@ -994,8 +992,8 @@
|
||||
#define Z_SAFE_HOMING
|
||||
|
||||
#if ENABLED(Z_SAFE_HOMING)
|
||||
#define Z_SAFE_HOMING_X_POINT (((X_MIN_POS+X_MAX_POS)/2)-4) // X point for Z homing when homing all axis (G28).
|
||||
#define Z_SAFE_HOMING_Y_POINT (((Y_MIN_POS+Y_MAX_POS)/2)+4) // Y point for Z homing when homing all axis (G28).
|
||||
#define Z_SAFE_HOMING_X_POINT (((X_MIN_POS + X_MAX_POS) / 2) - 4) // X point for Z homing when homing all axis (G28).
|
||||
#define Z_SAFE_HOMING_Y_POINT (((Y_MIN_POS + Y_MAX_POS) / 2) + 4) // Y point for Z homing when homing all axis (G28).
|
||||
#endif
|
||||
|
||||
// Homing speeds (mm/m)
|
||||
@ -1035,7 +1033,7 @@
|
||||
//
|
||||
// M100 Free Memory Watcher
|
||||
//
|
||||
#define M100_FREE_MEMORY_WATCHER // uncomment to add the M100 Free Memory Watcher for debug purpose
|
||||
//#define M100_FREE_MEMORY_WATCHER // uncomment to add the M100 Free Memory Watcher for debug purpose
|
||||
|
||||
//
|
||||
// G20/G21 Inch mode support
|
||||
@ -1619,7 +1617,7 @@
|
||||
*/
|
||||
//#define FILAMENT_WIDTH_SENSOR
|
||||
|
||||
#define DEFAULT_NOMINAL_FILAMENT_DIA 1.75 //Enter the diameter (in mm) of the filament generally used (3.0 mm or 1.75 mm) - this is then used in the slicer software. Used for sensor reading validation
|
||||
#define DEFAULT_NOMINAL_FILAMENT_DIA 1.75 // (mm) Diameter of the filament generally used (3.0 or 1.75mm), also used in the slicer. Used to validate sensor reading.
|
||||
|
||||
#if ENABLED(FILAMENT_WIDTH_SENSOR)
|
||||
#define FILAMENT_SENSOR_EXTRUDER_NUM 0 // Index of the extruder that has the filament sensor (0,1,2,3)
|
||||
@ -1633,6 +1631,6 @@
|
||||
|
||||
// Display filament width on the LCD status line. Status messages will expire after 5 seconds.
|
||||
//#define FILAMENT_LCD_DISPLAY
|
||||
#endif //FILAMENT_WIDTH_SENSOR
|
||||
#endif
|
||||
|
||||
#endif // CONFIGURATION_H
|
||||
|
@ -361,7 +361,7 @@
|
||||
// Default stepper release if idle. Set to 0 to deactivate.
|
||||
// Steppers will shut down DEFAULT_STEPPER_DEACTIVE_TIME seconds after the last move when DISABLE_INACTIVE_? is true.
|
||||
// Time can be set by M18 and M84.
|
||||
#define DEFAULT_STEPPER_DEACTIVE_TIME 0 // usually is set to 120 seconds
|
||||
#define DEFAULT_STEPPER_DEACTIVE_TIME 0 // usually set to 120 seconds
|
||||
#define DISABLE_INACTIVE_X true
|
||||
#define DISABLE_INACTIVE_Y true
|
||||
#define DISABLE_INACTIVE_Z true // set to false if the nozzle will fall down on your printed part when print has finished.
|
||||
|
@ -106,5 +106,3 @@ const unsigned char custom_start_bmp[896] PROGMEM = {
|
||||
0x03, 0x80, 0x00, 0x20, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01,
|
||||
0x01, 0xff, 0xff, 0xff, 0xe0, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
||||
};
|
||||
|
||||
|
||||
|
@ -408,6 +408,9 @@
|
||||
#ifndef MSG_ZPROBE_OUT
|
||||
#define MSG_ZPROBE_OUT _UxGT("Z probe out. bed")
|
||||
#endif
|
||||
#ifndef MSG_BLTOUCH
|
||||
#define MSG_BLTOUCH _UxGT("BLTouch")
|
||||
#endif
|
||||
#ifndef MSG_BLTOUCH_SELFTEST
|
||||
#define MSG_BLTOUCH_SELFTEST _UxGT("BLTouch Self-Test")
|
||||
#endif
|
||||
|
@ -21,7 +21,7 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* Least Squares Best Fit By Roxy and Ed Williams
|
||||
* Least Squares Best Fit by Roxy and Ed Williams
|
||||
*
|
||||
* This algorithm is high speed and has a very small code footprint.
|
||||
* Its results are identical to both the Iterative Least-Squares published
|
||||
@ -41,56 +41,44 @@
|
||||
|
||||
#include "least_squares_fit.h"
|
||||
|
||||
void incremental_LSF_reset(struct linear_fit_data *lsf) {
|
||||
lsf->n = 0;
|
||||
lsf->A = 0.0; // probably a memset() can be done to zero
|
||||
lsf->B = 0.0; // this whole structure
|
||||
lsf->D = 0.0;
|
||||
lsf->xbar = lsf->ybar = lsf->zbar = 0.0;
|
||||
lsf->x2bar = lsf->y2bar = lsf->z2bar = 0.0;
|
||||
lsf->xybar = lsf->xzbar = lsf->yzbar = 0.0;
|
||||
lsf->max_absx = lsf->max_absy = 0.0;
|
||||
}
|
||||
void incremental_LSF_reset(struct linear_fit_data *lsf) { ZERO(lsf); }
|
||||
|
||||
void incremental_LSF(struct linear_fit_data *lsf, float x, float y, float z) {
|
||||
lsf->xbar += x;
|
||||
lsf->ybar += y;
|
||||
lsf->zbar += z;
|
||||
lsf->x2bar += x*x;
|
||||
lsf->y2bar += y*y;
|
||||
lsf->z2bar += z*z;
|
||||
lsf->xybar += x*y;
|
||||
lsf->xzbar += x*z;
|
||||
lsf->yzbar += y*z;
|
||||
lsf->max_absx = (fabs(x) > lsf->max_absx) ? fabs(x) : lsf->max_absx;
|
||||
lsf->max_absy = (fabs(y) > lsf->max_absy) ? fabs(y) : lsf->max_absy;
|
||||
lsf->x2bar += sq(x);
|
||||
lsf->y2bar += sq(y);
|
||||
lsf->z2bar += sq(z);
|
||||
lsf->xybar += sq(x);
|
||||
lsf->xzbar += sq(x);
|
||||
lsf->yzbar += sq(y);
|
||||
lsf->max_absx = max(fabs(x), lsf->max_absx);
|
||||
lsf->max_absy = max(fabs(y), lsf->max_absy);
|
||||
lsf->n++;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
int finish_incremental_LSF(struct linear_fit_data *lsf) {
|
||||
float DD, N;
|
||||
const float N = (float)lsf->n;
|
||||
|
||||
N = (float) lsf->n;
|
||||
lsf->xbar /= N;
|
||||
lsf->ybar /= N;
|
||||
lsf->zbar /= N;
|
||||
lsf->x2bar = lsf->x2bar/N - lsf->xbar*lsf->xbar;
|
||||
lsf->y2bar = lsf->y2bar/N - lsf->ybar*lsf->ybar;
|
||||
lsf->z2bar = lsf->z2bar/N - lsf->zbar*lsf->zbar;
|
||||
lsf->xybar = lsf->xybar/N - lsf->xbar*lsf->ybar;
|
||||
lsf->yzbar = lsf->yzbar/N - lsf->ybar*lsf->zbar;
|
||||
lsf->xzbar = lsf->xzbar/N - lsf->xbar*lsf->zbar;
|
||||
lsf->x2bar = lsf->x2bar / N - lsf->xbar * lsf->xbar;
|
||||
lsf->y2bar = lsf->y2bar / N - lsf->ybar * lsf->ybar;
|
||||
lsf->z2bar = lsf->z2bar / N - lsf->zbar * lsf->zbar;
|
||||
lsf->xybar = lsf->xybar / N - lsf->xbar * lsf->ybar;
|
||||
lsf->yzbar = lsf->yzbar / N - lsf->ybar * lsf->zbar;
|
||||
lsf->xzbar = lsf->xzbar / N - lsf->xbar * lsf->zbar;
|
||||
|
||||
DD = lsf->x2bar*lsf->y2bar - lsf->xybar*lsf->xybar;
|
||||
if (fabs(DD) <= 1e-10*(lsf->max_absx+lsf->max_absy))
|
||||
const float DD = lsf->x2bar * lsf->y2bar - sq(lsf->xybar);
|
||||
if (fabs(DD) <= 1e-10 * (lsf->max_absx + lsf->max_absy))
|
||||
return -1;
|
||||
|
||||
lsf->A = (lsf->yzbar*lsf->xybar - lsf->xzbar*lsf->y2bar) / DD;
|
||||
lsf->B = (lsf->xzbar*lsf->xybar - lsf->yzbar*lsf->x2bar) / DD;
|
||||
lsf->D = -(lsf->zbar + lsf->A*lsf->xbar + lsf->B*lsf->ybar);
|
||||
lsf->A = (lsf->yzbar * lsf->xybar - lsf->xzbar * lsf->y2bar) / DD;
|
||||
lsf->B = (lsf->xzbar * lsf->xybar - lsf->yzbar * lsf->x2bar) / DD;
|
||||
lsf->D = -(lsf->zbar + lsf->A * lsf->xbar + lsf->B * lsf->ybar);
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#endif // AUTO_BED_LEVELING_UBL
|
||||
|
@ -42,11 +42,11 @@
|
||||
|
||||
struct linear_fit_data {
|
||||
int n;
|
||||
float xbar, ybar, zbar;
|
||||
float x2bar, y2bar, z2bar;
|
||||
float xybar, xzbar, yzbar;
|
||||
float max_absx, max_absy;
|
||||
float A, B, D;
|
||||
float xbar, ybar, zbar,
|
||||
x2bar, y2bar, z2bar,
|
||||
xybar, xzbar, yzbar,
|
||||
max_absx, max_absy,
|
||||
A, B, D;
|
||||
};
|
||||
|
||||
void incremental_LSF_reset(struct linear_fit_data *);
|
||||
|
68
Marlin/ubl.h
68
Marlin/ubl.h
@ -91,11 +91,6 @@
|
||||
|
||||
public:
|
||||
|
||||
//
|
||||
// Please do not put STATIC qualifiers in front of ANYTHING in this file. You WILL cause problems by doing that.
|
||||
// The GCC optimizer inlines static functions and this DRAMATICALLY increases the size of the stack frame of
|
||||
// functions that call STATIC functions.
|
||||
//
|
||||
void find_mean_mesh_height();
|
||||
void shift_mesh_height();
|
||||
void probe_entire_mesh(const float &lx, const float &ly, const bool do_ubl_mesh_map, const bool stow_probe, bool do_furthest);
|
||||
@ -105,22 +100,12 @@
|
||||
void save_ubl_active_state_and_disable();
|
||||
void restore_ubl_active_state_and_leave();
|
||||
void g29_what_command();
|
||||
//
|
||||
// Please do not put STATIC qualifiers in front of ANYTHING in this file. You WILL cause problems by doing that.
|
||||
// The GCC optimizer inlines static functions and this DRAMATICALLY increases the size of the stack frame of
|
||||
// functions that call STATIC functions.
|
||||
//
|
||||
void g29_eeprom_dump() ;
|
||||
void g29_compare_current_mesh_to_stored_mesh();
|
||||
void fine_tune_mesh(const float &lx, const float &ly, const bool do_ubl_mesh_map);
|
||||
void smart_fill_mesh();
|
||||
void display_map(const int);
|
||||
void reset();
|
||||
//
|
||||
// Please do not put STATIC qualifiers in front of ANYTHING in this file. You WILL cause problems by doing that.
|
||||
// The GCC optimizer inlines static functions and this DRAMATICALLY increases the size of the stack frame of
|
||||
// functions that call STATIC functions.
|
||||
//
|
||||
void invalidate();
|
||||
void store_state();
|
||||
void load_state();
|
||||
@ -134,25 +119,27 @@
|
||||
|
||||
// 15 is the maximum nubmer of grid points supported + 1 safety margin for now,
|
||||
// until determinism prevails
|
||||
constexpr static float mesh_index_to_xpos[16] PROGMEM = { UBL_MESH_MIN_X+0*(MESH_X_DIST),
|
||||
UBL_MESH_MIN_X+1*(MESH_X_DIST), UBL_MESH_MIN_X+2*(MESH_X_DIST),
|
||||
UBL_MESH_MIN_X+3*(MESH_X_DIST), UBL_MESH_MIN_X+4*(MESH_X_DIST),
|
||||
UBL_MESH_MIN_X+5*(MESH_X_DIST), UBL_MESH_MIN_X+6*(MESH_X_DIST),
|
||||
UBL_MESH_MIN_X+7*(MESH_X_DIST), UBL_MESH_MIN_X+8*(MESH_X_DIST),
|
||||
UBL_MESH_MIN_X+9*(MESH_X_DIST), UBL_MESH_MIN_X+10*(MESH_X_DIST),
|
||||
UBL_MESH_MIN_X+11*(MESH_X_DIST), UBL_MESH_MIN_X+12*(MESH_X_DIST),
|
||||
UBL_MESH_MIN_X+13*(MESH_X_DIST), UBL_MESH_MIN_X+14*(MESH_X_DIST),
|
||||
UBL_MESH_MIN_X+15*(MESH_X_DIST) };
|
||||
constexpr static float mesh_index_to_xpos[16] PROGMEM = {
|
||||
UBL_MESH_MIN_X + 0 * (MESH_X_DIST), UBL_MESH_MIN_X + 1 * (MESH_X_DIST),
|
||||
UBL_MESH_MIN_X + 2 * (MESH_X_DIST), UBL_MESH_MIN_X + 3 * (MESH_X_DIST),
|
||||
UBL_MESH_MIN_X + 4 * (MESH_X_DIST), UBL_MESH_MIN_X + 5 * (MESH_X_DIST),
|
||||
UBL_MESH_MIN_X + 6 * (MESH_X_DIST), UBL_MESH_MIN_X + 7 * (MESH_X_DIST),
|
||||
UBL_MESH_MIN_X + 8 * (MESH_X_DIST), UBL_MESH_MIN_X + 9 * (MESH_X_DIST),
|
||||
UBL_MESH_MIN_X + 10 * (MESH_X_DIST), UBL_MESH_MIN_X + 11 * (MESH_X_DIST),
|
||||
UBL_MESH_MIN_X + 12 * (MESH_X_DIST), UBL_MESH_MIN_X + 13 * (MESH_X_DIST),
|
||||
UBL_MESH_MIN_X + 14 * (MESH_X_DIST), UBL_MESH_MIN_X + 15 * (MESH_X_DIST)
|
||||
};
|
||||
|
||||
constexpr static float mesh_index_to_ypos[16] PROGMEM = { UBL_MESH_MIN_Y+0*(MESH_Y_DIST),
|
||||
UBL_MESH_MIN_Y+1*(MESH_Y_DIST), UBL_MESH_MIN_Y+2*(MESH_Y_DIST),
|
||||
UBL_MESH_MIN_Y+3*(MESH_Y_DIST), UBL_MESH_MIN_Y+4*(MESH_Y_DIST),
|
||||
UBL_MESH_MIN_Y+5*(MESH_Y_DIST), UBL_MESH_MIN_Y+6*(MESH_Y_DIST),
|
||||
UBL_MESH_MIN_Y+7*(MESH_Y_DIST), UBL_MESH_MIN_Y+8*(MESH_Y_DIST),
|
||||
UBL_MESH_MIN_Y+9*(MESH_Y_DIST), UBL_MESH_MIN_Y+10*(MESH_Y_DIST),
|
||||
UBL_MESH_MIN_Y+11*(MESH_Y_DIST), UBL_MESH_MIN_Y+12*(MESH_Y_DIST),
|
||||
UBL_MESH_MIN_Y+13*(MESH_Y_DIST), UBL_MESH_MIN_Y+14*(MESH_Y_DIST),
|
||||
UBL_MESH_MIN_Y+15*(MESH_Y_DIST) };
|
||||
constexpr static float mesh_index_to_ypos[16] PROGMEM = {
|
||||
UBL_MESH_MIN_Y + 0 * (MESH_Y_DIST), UBL_MESH_MIN_Y + 1 * (MESH_Y_DIST),
|
||||
UBL_MESH_MIN_Y + 2 * (MESH_Y_DIST), UBL_MESH_MIN_Y + 3 * (MESH_Y_DIST),
|
||||
UBL_MESH_MIN_Y + 4 * (MESH_Y_DIST), UBL_MESH_MIN_Y + 5 * (MESH_Y_DIST),
|
||||
UBL_MESH_MIN_Y + 6 * (MESH_Y_DIST), UBL_MESH_MIN_Y + 7 * (MESH_Y_DIST),
|
||||
UBL_MESH_MIN_Y + 8 * (MESH_Y_DIST), UBL_MESH_MIN_Y + 9 * (MESH_Y_DIST),
|
||||
UBL_MESH_MIN_Y + 10 * (MESH_Y_DIST), UBL_MESH_MIN_Y + 11 * (MESH_Y_DIST),
|
||||
UBL_MESH_MIN_Y + 12 * (MESH_Y_DIST), UBL_MESH_MIN_Y + 13 * (MESH_Y_DIST),
|
||||
UBL_MESH_MIN_Y + 14 * (MESH_Y_DIST), UBL_MESH_MIN_Y + 15 * (MESH_Y_DIST)
|
||||
};
|
||||
|
||||
static bool g26_debug_flag, has_control_of_lcd_panel;
|
||||
|
||||
@ -163,11 +150,6 @@
|
||||
|
||||
unified_bed_leveling();
|
||||
|
||||
//
|
||||
// Please do not put STATIC qualifiers in front of ANYTHING in this file. You WILL cause problems by doing that.
|
||||
// The GCC optimizer inlines static functions and this DRAMATICALLY increases the size of the stack frame of
|
||||
// functions that call STATIC functions.
|
||||
//
|
||||
FORCE_INLINE void set_z(const int8_t px, const int8_t py, const float &z) { z_values[px][py] = z; }
|
||||
int8_t get_cell_index_x(const float &x) {
|
||||
const int8_t cx = (x - (UBL_MESH_MIN_X)) * (1.0 / (MESH_X_DIST));
|
||||
@ -184,11 +166,6 @@
|
||||
// that is OK because something else should be keeping that from
|
||||
// happening and should not be worried about at this level.
|
||||
|
||||
//
|
||||
// Please do not put STATIC qualifiers in front of ANYTHING in this file. You WILL cause problems by doing that.
|
||||
// The GCC optimizer inlines static functions and this DRAMATICALLY increases the size of the stack frame of
|
||||
// functions that call STATIC functions.
|
||||
//
|
||||
int8_t find_closest_x_index(const float &x) {
|
||||
const int8_t px = (x - (UBL_MESH_MIN_X) + (MESH_X_DIST) * 0.5) * (1.0 / (MESH_X_DIST));
|
||||
return WITHIN(px, 0, GRID_MAX_POINTS_X - 1) ? px : -1;
|
||||
@ -217,11 +194,6 @@
|
||||
FORCE_INLINE float calc_z0(const float &a0, const float &a1, const float &z1, const float &a2, const float &z2) {
|
||||
return z1 + (z2 - z1) * (a0 - a1) / (a2 - a1);
|
||||
}
|
||||
//
|
||||
// Please do not put STATIC qualifiers in front of ANYTHING in this file. You WILL cause problems by doing that.
|
||||
// The GCC optimizer inlines static functions and this DRAMATICALLY increases the size of the stack frame of
|
||||
// functions that call STATIC functions.
|
||||
//
|
||||
|
||||
/**
|
||||
* z_correction_for_x_on_horizontal_mesh_line is an optimization for
|
||||
|
@ -54,7 +54,6 @@
|
||||
|
||||
bool ProbeStay = true;
|
||||
|
||||
|
||||
#define SIZE_OF_LITTLE_RAISE 0
|
||||
#define BIG_RAISE_NOT_NEEDED 0
|
||||
extern void lcd_quick_feedback();
|
||||
|
@ -34,10 +34,6 @@
|
||||
#include "buzzer.h"
|
||||
#endif
|
||||
|
||||
#if ENABLED(BLTOUCH)
|
||||
#include "endstops.h"
|
||||
#endif
|
||||
|
||||
#if ENABLED(PRINTCOUNTER)
|
||||
#include "printcounter.h"
|
||||
#include "duration_t.h"
|
||||
@ -723,6 +719,28 @@ void kill_screen(const char* lcd_msg) {
|
||||
|
||||
#endif // MENU_ITEM_CASE_LIGHT
|
||||
|
||||
#if ENABLED(BLTOUCH)
|
||||
|
||||
/**
|
||||
*
|
||||
* "BLTouch" submenu
|
||||
*
|
||||
*/
|
||||
static void bltouch_menu() {
|
||||
START_MENU();
|
||||
//
|
||||
// ^ Main
|
||||
//
|
||||
MENU_BACK(MSG_MAIN);
|
||||
MENU_ITEM(gcode, MSG_BLTOUCH_RESET, PSTR("M280 P" STRINGIFY(Z_ENDSTOP_SERVO_NR) " S" STRINGIFY(BLTOUCH_RESET)));
|
||||
MENU_ITEM(gcode, MSG_BLTOUCH_SELFTEST, PSTR("M280 P" STRINGIFY(Z_ENDSTOP_SERVO_NR) " S" STRINGIFY(BLTOUCH_SELFTEST)));
|
||||
MENU_ITEM(gcode, MSG_BLTOUCH_DEPLOY, PSTR("M280 P" STRINGIFY(Z_ENDSTOP_SERVO_NR) " S" STRINGIFY(BLTOUCH_DEPLOY)));
|
||||
MENU_ITEM(gcode, MSG_BLTOUCH_STOW, PSTR("M280 P" STRINGIFY(Z_ENDSTOP_SERVO_NR) " S" STRINGIFY(BLTOUCH_STOW)));
|
||||
END_MENU();
|
||||
}
|
||||
|
||||
#endif // BLTOUCH
|
||||
|
||||
#if ENABLED(LCD_PROGRESS_BAR_TEST)
|
||||
|
||||
static void progress_bar_test() {
|
||||
@ -792,8 +810,7 @@ void kill_screen(const char* lcd_msg) {
|
||||
#endif
|
||||
|
||||
#if ENABLED(BLTOUCH)
|
||||
if (!endstops.z_probe_enabled && TEST_BLTOUCH())
|
||||
MENU_ITEM(gcode, MSG_BLTOUCH_RESET, PSTR("M280 P" STRINGIFY(Z_ENDSTOP_SERVO_NR) " S" STRINGIFY(BLTOUCH_RESET)));
|
||||
MENU_ITEM(submenu, MSG_BLTOUCH, bltouch_menu);
|
||||
#endif
|
||||
|
||||
if (planner.movesplanned() || IS_SD_PRINTING) {
|
||||
|
Loading…
Reference in New Issue
Block a user