3.0.10 sync
This commit is contained in:
parent
99ae9707de
commit
3faef75a0d
27 changed files with 4026 additions and 811 deletions
Firmware
|
@ -1,5 +1,6 @@
|
|||
#include "Marlin.h"
|
||||
#include "Configuration.h"
|
||||
#include "ConfigurationStore.h"
|
||||
#include "language_all.h"
|
||||
#include "mesh_bed_calibration.h"
|
||||
#include "mesh_bed_leveling.h"
|
||||
|
@ -411,18 +412,55 @@ BedSkewOffsetDetectionResultType calculate_machine_skew_and_offset_LS(
|
|||
cntr[1] = 0.f;
|
||||
float wx = 0.f;
|
||||
float wy = 0.f;
|
||||
for (int8_t i = 0; i < 9; ++ i) {
|
||||
for (int8_t i = 0; i < npts; ++ i) {
|
||||
float x = vec_x[0] * measured_pts[i * 2] + vec_y[0] * measured_pts[i * 2 + 1];
|
||||
float y = vec_x[1] * measured_pts[i * 2] + vec_y[1] * measured_pts[i * 2 + 1];
|
||||
float w = point_weight_x(i, y);
|
||||
cntr[0] += w * (pgm_read_float(true_pts + i * 2) - x);
|
||||
wx += w;
|
||||
cntr[0] += w * (pgm_read_float(true_pts + i * 2) - x);
|
||||
wx += w;
|
||||
if (verbosity_level >= 20) {
|
||||
MYSERIAL.print(i);
|
||||
SERIAL_ECHOLNPGM("");
|
||||
SERIAL_ECHOLNPGM("Weight_x:");
|
||||
MYSERIAL.print(w);
|
||||
SERIAL_ECHOLNPGM("");
|
||||
SERIAL_ECHOLNPGM("cntr[0]:");
|
||||
MYSERIAL.print(cntr[0]);
|
||||
SERIAL_ECHOLNPGM("");
|
||||
SERIAL_ECHOLNPGM("wx:");
|
||||
MYSERIAL.print(wx);
|
||||
}
|
||||
w = point_weight_y(i, y);
|
||||
cntr[1] += w * (pgm_read_float(true_pts + i * 2 + 1) - y);
|
||||
wy += w;
|
||||
}
|
||||
cntr[1] += w * (pgm_read_float(true_pts + i * 2 + 1) - y);
|
||||
wy += w;
|
||||
|
||||
if (verbosity_level >= 20) {
|
||||
SERIAL_ECHOLNPGM("");
|
||||
SERIAL_ECHOLNPGM("Weight_y:");
|
||||
MYSERIAL.print(w);
|
||||
SERIAL_ECHOLNPGM("");
|
||||
SERIAL_ECHOLNPGM("cntr[1]:");
|
||||
MYSERIAL.print(cntr[1]);
|
||||
SERIAL_ECHOLNPGM("");
|
||||
SERIAL_ECHOLNPGM("wy:");
|
||||
MYSERIAL.print(wy);
|
||||
SERIAL_ECHOLNPGM("");
|
||||
SERIAL_ECHOLNPGM("");
|
||||
}
|
||||
}
|
||||
cntr[0] /= wx;
|
||||
cntr[1] /= wy;
|
||||
if (verbosity_level >= 20) {
|
||||
SERIAL_ECHOLNPGM("");
|
||||
SERIAL_ECHOLNPGM("Final cntr values:");
|
||||
SERIAL_ECHOLNPGM("cntr[0]:");
|
||||
MYSERIAL.print(cntr[0]);
|
||||
SERIAL_ECHOLNPGM("");
|
||||
SERIAL_ECHOLNPGM("cntr[1]:");
|
||||
MYSERIAL.print(cntr[1]);
|
||||
SERIAL_ECHOLNPGM("");
|
||||
}
|
||||
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -511,6 +549,7 @@ void reset_bed_offset_and_skew()
|
|||
}
|
||||
|
||||
bool is_bed_z_jitter_data_valid()
|
||||
// offsets of the Z heiths of the calibration points from the first point are saved as 16bit signed int, scaled to tenths of microns
|
||||
{
|
||||
for (int8_t i = 0; i < 8; ++ i)
|
||||
if (eeprom_read_word((uint16_t*)(EEPROM_BED_CALIBRATION_Z_JITTER+i*2)) == 0x0FFFF)
|
||||
|
@ -603,18 +642,24 @@ void world2machine_initialize()
|
|||
// Length of the vec_x shall be close to unity.
|
||||
float l = sqrt(vec_x[0] * vec_x[0] + vec_x[1] * vec_x[1]);
|
||||
if (l < 0.9 || l > 1.1) {
|
||||
SERIAL_ECHOLNPGM("X vector length:");
|
||||
MYSERIAL.println(l);
|
||||
SERIAL_ECHOLNPGM("Invalid bed correction matrix. Length of the X vector out of range.");
|
||||
reset = true;
|
||||
}
|
||||
// Length of the vec_y shall be close to unity.
|
||||
l = sqrt(vec_y[0] * vec_y[0] + vec_y[1] * vec_y[1]);
|
||||
if (l < 0.9 || l > 1.1) {
|
||||
SERIAL_ECHOLNPGM("Invalid bed correction matrix. Length of the X vector out of range.");
|
||||
SERIAL_ECHOLNPGM("Y vector length:");
|
||||
MYSERIAL.println(l);
|
||||
SERIAL_ECHOLNPGM("Invalid bed correction matrix. Length of the Y vector out of range.");
|
||||
reset = true;
|
||||
}
|
||||
// Correction of the zero point shall be reasonably small.
|
||||
l = sqrt(cntr[0] * cntr[0] + cntr[1] * cntr[1]);
|
||||
if (l > 15.f) {
|
||||
SERIAL_ECHOLNPGM("Zero point correction:");
|
||||
MYSERIAL.println(l);
|
||||
SERIAL_ECHOLNPGM("Invalid bed correction matrix. Shift out of range.");
|
||||
reset = true;
|
||||
}
|
||||
|
@ -1652,7 +1697,27 @@ BedSkewOffsetDetectionResultType find_bed_offset_and_skew(int8_t verbosity_level
|
|||
eeprom_update_float((float*)(EEPROM_BED_CALIBRATION_VEC_Y +0), vec_y[0]);
|
||||
eeprom_update_float((float*)(EEPROM_BED_CALIBRATION_VEC_Y +4), vec_y[1]);
|
||||
#endif
|
||||
if (verbosity_level >= 10) {
|
||||
// Length of the vec_x
|
||||
float l = sqrt(vec_x[0] * vec_x[0] + vec_x[1] * vec_x[1]);
|
||||
SERIAL_ECHOLNPGM("X vector length:");
|
||||
MYSERIAL.println(l);
|
||||
|
||||
// Length of the vec_y
|
||||
l = sqrt(vec_y[0] * vec_y[0] + vec_y[1] * vec_y[1]);
|
||||
SERIAL_ECHOLNPGM("Y vector length:");
|
||||
MYSERIAL.println(l);
|
||||
// Zero point correction
|
||||
l = sqrt(cntr[0] * cntr[0] + cntr[1] * cntr[1]);
|
||||
SERIAL_ECHOLNPGM("Zero point correction:");
|
||||
MYSERIAL.println(l);
|
||||
|
||||
// vec_x and vec_y shall be nearly perpendicular.
|
||||
l = vec_x[0] * vec_y[0] + vec_x[1] * vec_y[1];
|
||||
SERIAL_ECHOLNPGM("Perpendicularity");
|
||||
MYSERIAL.println(fabs(l));
|
||||
SERIAL_ECHOLNPGM("Saving bed calibration vectors to EEPROM");
|
||||
}
|
||||
// Correct the current_position to match the transformed coordinate system after world2machine_rotation_and_skew and world2machine_shift were set.
|
||||
world2machine_update_current();
|
||||
|
||||
|
@ -2151,11 +2216,14 @@ static int babystepLoadZ = 0;
|
|||
|
||||
void babystep_apply()
|
||||
{
|
||||
// Apply Z height correction aka baby stepping before mesh bed leveing gets activated.
|
||||
if(eeprom_read_byte((unsigned char*)EEPROM_BABYSTEP_Z_SET) == 0x01)
|
||||
// Apply Z height correction aka baby stepping before mesh bed leveling gets activated.
|
||||
if(calibration_status() == CALIBRATION_STATUS_CALIBRATED)
|
||||
{
|
||||
// End of G80: Apply the baby stepping value.
|
||||
check_babystep(); //checking if babystep is in allowed range, otherwise setting babystep to 0
|
||||
|
||||
// End of G80: Apply the baby stepping value.
|
||||
EEPROM_read_B(EEPROM_BABYSTEP_Z,&babystepLoadZ);
|
||||
|
||||
#if 0
|
||||
SERIAL_ECHO("Z baby step: ");
|
||||
SERIAL_ECHO(babystepLoadZ);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue