Skip to content

Commit

Permalink
Bugfix 2.0.x update (#2)
Browse files Browse the repository at this point in the history
* Set up DIAG endstops for BTT SKR 1.4 / 1.4 Turbo (MarlinFirmware#16727)

* Extend RX/TX pins for up to 8 extruders

* Fix up, improve endstop pin auto-assignment

Followup for MarlinFirmware#16723

* (21) PT100 for MCUs with 3.3v logic (MarlinFirmware#16731)

* [cron] Bump distribution date (2020-01-31)

* Add sanity-check for new Advanced Pause option

Followup to MarlinFirmware#16372

* Include macros for delta ABC

* Update Russian language (MarlinFirmware#16745)

* Fix BTT SKR 1.4 extra endstop pins (MarlinFirmware#16738)

* Option for Trigorilla 1.4 with add-on endstops board (MarlinFirmware#16737)

* Consistent M112 with Emergency Parser (MarlinFirmware#16747)

* Improve mfadd helper script

- Use the original branch name if none is supplied
- Set the remote tracking to the source
- Accept User/Branch or User:Branch syntax

* Clean up i2c encoder, sanitize serial

* Misc cleanup, whitespace

* Encapsulate probe as singleton class (MarlinFirmware#16751)

* G34 automatic point assignment (MarlinFirmware#16473)

* Fix Temperature::over_autostart_threshold (MarlinFirmware#16749)

* Update Russian language (MarlinFirmware#16750)

* Fix CURRENT_STEP_DOWN compile error

* Drop obsolete SD special char handling

See MarlinFirmware#14035

* Probe singleton patch

Followup to MarlinFirmware#16751

* Fix RGB / Neopixel white color bug

See MarlinFirmware#16752

Co-authored-by: Robert Stein <stonecoldcrazy@stoneathome.de>
Co-authored-by: Scott Lahteine <thinkyhead@users.noreply.github.com>
Co-authored-by: Artur Petrzak <petrzmax@gmail.com>
Co-authored-by: Acenotass <44540957+Acenotass@users.noreply.github.com>
Co-authored-by: rebel1 <453277+rebel1@users.noreply.github.com>
Co-authored-by: Jason Smith <jason.inet@gmail.com>
Co-authored-by: InsanityAutomation <38436470+InsanityAutomation@users.noreply.github.com>
  • Loading branch information
8 people authored Feb 1, 2020
1 parent 17bcee2 commit 1c02806
Show file tree
Hide file tree
Showing 65 changed files with 976 additions and 540 deletions.
3 changes: 2 additions & 1 deletion Marlin/Configuration.h
Original file line number Diff line number Diff line change
Expand Up @@ -379,7 +379,8 @@
* 13 : 100k Hisens 3950 1% up to 300°C for hotend "Simple ONE " & "Hotend "All In ONE"
* 15 : 100k thermistor calibration for JGAurora A5 hotend
* 18 : ATC Semitec 204GT-2 (4.7k pullup) Dagoma.Fr - MKS_Base_DKU001327
* 20 : Pt100 with circuit in the Ultimainboard V2.x
* 20 : Pt100 with circuit in the Ultimainboard V2.x with 5v excitation (AVR)
* 21 : Pt100 with circuit in the Ultimainboard V2.x with 3.3v excitation (STM32 \ LPC176x....)
* 201 : Pt100 with circuit in Overlord, similar to Ultimainboard V2.x
* 60 : 100k Maker's Tool Works Kapton Bed Thermistor beta=3950
* 61 : 100k Formbot / Vivedino 3950 350C thermistor 4.7k pullup
Expand Down
53 changes: 36 additions & 17 deletions Marlin/Configuration_adv.h
Original file line number Diff line number Diff line change
Expand Up @@ -668,35 +668,54 @@
*/
//#define Z_STEPPER_AUTO_ALIGN
#if ENABLED(Z_STEPPER_AUTO_ALIGN)
// Define probe X and Y positions for Z1, Z2 [, Z3]
#define Z_STEPPER_ALIGN_XY { { 10, 190 }, { 100, 10 }, { 190, 190 } }
// Define probe X and Y positions for Z1, Z2 [, Z3 [, Z4]]
// If not defined, probe limits will be used.
// Override with 'M422 S<index> X<pos> Y<pos>'
//#define Z_STEPPER_ALIGN_XY { { 10, 190 }, { 100, 10 }, { 190, 190 } }

/**
* Orientation for the automatically-calculated probe positions.
* Override Z stepper align points with 'M422 S<index> X<pos> Y<pos>'
*
* 2 Steppers: (0) (1)
* | | 2 |
* | 1 2 | |
* | | 1 |
*
* 3 Steppers: (0) (1) (2) (3)
* | 3 | 1 | 2 1 | 2 |
* | | 3 | | 3 |
* | 1 2 | 2 | 3 | 1 |
*
* 4 Steppers: (0) (1) (2) (3)
* | 4 3 | 1 4 | 2 1 | 3 2 |
* | | | | |
* | 1 2 | 2 3 | 3 4 | 4 1 |
*
*/
#ifndef Z_STEPPER_ALIGN_XY
//#define Z_STEPPERS_ORIENTATION 0
#endif

// Provide Z stepper positions for more rapid convergence in bed alignment.
// Currently requires triple stepper drivers.
// Requires triple stepper drivers (i.e., set NUM_Z_STEPPER_DRIVERS to 3)
//#define Z_STEPPER_ALIGN_KNOWN_STEPPER_POSITIONS
#if ENABLED(Z_STEPPER_ALIGN_KNOWN_STEPPER_POSITIONS)
// Define Stepper XY positions for Z1, Z2, Z3 corresponding to
// the Z screw positions in the bed carriage.
// Define one position per Z stepper in stepper driver order.
#define Z_STEPPER_ALIGN_STEPPER_XY { { 210.7, 102.5 }, { 152.6, 220.0 }, { 94.5, 102.5 } }
#else
// Amplification factor. Used to scale the correction step up or down.
// In case the stepper (spindle) position is further out than the test point.
// Use a value > 1. NOTE: This may cause instability
#define Z_STEPPER_ALIGN_AMP 1.0
// Amplification factor. Used to scale the correction step up or down in case
// the stepper (spindle) position is farther out than the test point.
#define Z_STEPPER_ALIGN_AMP 1.0 // Use a value > 1.0 NOTE: This may cause instability!
#endif

// Set number of iterations to align
#define Z_STEPPER_ALIGN_ITERATIONS 3

// Enable to restore leveling setup after operation
#define RESTORE_LEVELING_AFTER_G34
// On a 300mm bed a 5% grade would give a misalignment of ~1.5cm
#define G34_MAX_GRADE 5 // (%) Maximum incline G34 will handle

// Stop criterion. If the accuracy is better than this stop iterating early
#define Z_STEPPER_ALIGN_ACC 0.02
#define G34_MAX_GRADE 5 // (%) Maximum incline that G34 will handle
#define Z_STEPPER_ALIGN_ITERATIONS 5 // Number of iterations to apply during alignment
#define Z_STEPPER_ALIGN_ACC 0.02 // Stop iterating early if the accuracy is better than this
#define RESTORE_LEVELING_AFTER_G34 // Restore leveling after G34 is done?
#endif

// @section motion
Expand Down
2 changes: 1 addition & 1 deletion Marlin/src/MarlinCore.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -977,7 +977,7 @@ void setup() {
#endif

#if HAS_Z_SERVO_PROBE
servo_probe_init();
probe.servo_probe_init();
#endif

#if HAS_PHOTOGRAPH
Expand Down
20 changes: 10 additions & 10 deletions Marlin/src/core/utility.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -83,42 +83,42 @@ void safe_delay(millis_t ms) {
#if HAS_BED_PROBE

#if !HAS_PROBE_XY_OFFSET
SERIAL_ECHOPAIR("Probe Offset X0 Y0 Z", probe_offset.z, " (");
SERIAL_ECHOPAIR("Probe Offset X0 Y0 Z", probe.offset.z, " (");
#else
SERIAL_ECHOPAIR_P(PSTR("Probe Offset X"), probe_offset.x, SP_Y_STR, probe_offset.y, SP_Z_STR, probe_offset.z);
if (probe_offset.x > 0)
SERIAL_ECHOPAIR_P(PSTR("Probe Offset X"), probe.offset_xy.x, SP_Y_STR, probe.offset_xy.y, SP_Z_STR, probe.offset.z);
if (probe.offset_xy.x > 0)
SERIAL_ECHOPGM(" (Right");
else if (probe_offset.x < 0)
else if (probe.offset_xy.x < 0)
SERIAL_ECHOPGM(" (Left");
else if (probe_offset.y != 0)
else if (probe.offset_xy.y != 0)
SERIAL_ECHOPGM(" (Middle");
else
SERIAL_ECHOPGM(" (Aligned With");

if (probe_offset.y > 0) {
if (probe.offset_xy.y > 0) {
#if IS_SCARA
SERIAL_ECHOPGM("-Distal");
#else
SERIAL_ECHOPGM("-Back");
#endif
}
else if (probe_offset.y < 0) {
else if (probe.offset_xy.y < 0) {
#if IS_SCARA
SERIAL_ECHOPGM("-Proximal");
#else
SERIAL_ECHOPGM("-Front");
#endif
}
else if (probe_offset.x != 0)
else if (probe.offset_xy.x != 0)
SERIAL_ECHOPGM("-Center");

SERIAL_ECHOPGM(" & ");

#endif

if (probe_offset.z < 0)
if (probe.offset.z < 0)
SERIAL_ECHOPGM("Below");
else if (probe_offset.z > 0)
else if (probe.offset.z > 0)
SERIAL_ECHOPGM("Above");
else
SERIAL_ECHOPGM("Same Z as");
Expand Down
40 changes: 22 additions & 18 deletions Marlin/src/feature/I2CPositionEncoder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -162,15 +162,17 @@ void I2CPositionEncoder::update() {
if (errIdx == 0) {
// In order to correct for "error" but avoid correcting for noise and non-skips
// it must be > threshold and have a difference average of < 10 and be < 2000 steps
if (ABS(error) > threshold * planner.settings.axis_steps_per_mm[encoderAxis] &&
diffSum < 10 * (I2CPE_ERR_ARRAY_SIZE - 1) && ABS(error) < 2000) { // Check for persistent error (skip)
if (ABS(error) > threshold * planner.settings.axis_steps_per_mm[encoderAxis]
&& diffSum < 10 * (I2CPE_ERR_ARRAY_SIZE - 1)
&& ABS(error) < 2000
) { // Check for persistent error (skip)
errPrst[errPrstIdx++] = error; // Error must persist for I2CPE_ERR_PRST_ARRAY_SIZE error cycles. This also serves to improve the average accuracy
if (errPrstIdx >= I2CPE_ERR_PRST_ARRAY_SIZE) {
float sumP = 0;
LOOP_L_N(i, I2CPE_ERR_PRST_ARRAY_SIZE) sumP += errPrst[i];
const int32_t errorP = int32_t(sumP * RECIPROCAL(I2CPE_ERR_PRST_ARRAY_SIZE));
SERIAL_ECHO(axis_codes[encoderAxis]);
SERIAL_ECHOLNPAIR(" - err detected: ", errorP * planner.steps_to_mm[encoderAxis], "mm; correcting!");
SERIAL_ECHOLNPAIR(" : CORRECT ERR ", errorP * planner.steps_to_mm[encoderAxis], "mm");
babystep.add_steps(encoderAxis, -LROUND(errorP));
errPrstIdx = 0;
}
Expand All @@ -189,7 +191,8 @@ void I2CPositionEncoder::update() {
if (ABS(error) > I2CPE_ERR_CNT_THRESH * planner.settings.axis_steps_per_mm[encoderAxis]) {
const millis_t ms = millis();
if (ELAPSED(ms, nextErrorCountTime)) {
SERIAL_ECHOLNPAIR("Large error on ", axis_codes[encoderAxis], " axis. error: ", (int)error, "; diffSum: ", diffSum);
SERIAL_ECHO(axis_codes[encoderAxis]);
SERIAL_ECHOLNPAIR(" : LARGE ERR ", int(error), "; diffSum=", diffSum);
errorCount++;
nextErrorCountTime = ms + I2CPE_ERR_CNT_DEBOUNCE_MS;
}
Expand Down Expand Up @@ -243,17 +246,14 @@ bool I2CPositionEncoder::passes_test(const bool report) {
}

float I2CPositionEncoder::get_axis_error_mm(const bool report) {
float target, actual, error;

target = planner.get_axis_position_mm(encoderAxis);
actual = mm_from_count(position);
error = actual - target;

if (ABS(error) > 10000) error = 0; // ?
const float target = planner.get_axis_position_mm(encoderAxis),
actual = mm_from_count(position),
diff = actual - target,
error = ABS(diff) > 10000 ? 0 : diff; // Huge error is a bad reading

if (report) {
SERIAL_ECHO(axis_codes[encoderAxis]);
SERIAL_ECHOLNPAIR(" axis target: ", target, ", actual: ", actual, ", error : ",error);
SERIAL_ECHOLNPAIR(" axis target=", target, "mm; actual=", actual, "mm; err=", error, "mm");
}

return error;
Expand All @@ -278,21 +278,25 @@ int32_t I2CPositionEncoder::get_axis_error_steps(const bool report) {
//convert both 'ticks' into same units / base
encoderCountInStepperTicksScaled = LROUND((stepperTicksPerUnit * encoderTicks) / encoderTicksPerUnit);

int32_t target = stepper.position(encoderAxis),
error = (encoderCountInStepperTicksScaled - target);
const int32_t target = stepper.position(encoderAxis);
int32_t error = encoderCountInStepperTicksScaled - target;

//suppress discontinuities (might be caused by bad I2C readings...?)
const bool suppressOutput = (ABS(error - errorPrev) > 100);

errorPrev = error;

if (report) {
SERIAL_ECHO(axis_codes[encoderAxis]);
SERIAL_ECHOLNPAIR(" axis target: ", target, ", actual: ", encoderCountInStepperTicksScaled, ", error : ", error);
if (suppressOutput) SERIAL_ECHOLNPGM("Discontinuity detected, suppressing error.");
SERIAL_ECHOLNPAIR(" axis target=", target, "; actual=", encoderCountInStepperTicksScaled, "; err=", error);
}

errorPrev = error;
if (suppressOutput) {
if (report) SERIAL_ECHOLNPGM("!Discontinuity. Suppressing error.");
error = 0;
}

return (suppressOutput ? 0 : error);
return error;
}

int32_t I2CPositionEncoder::get_raw_count() {
Expand Down
2 changes: 1 addition & 1 deletion Marlin/src/feature/baricuda.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
*
*/

#include "../inc/MarlinConfig.h"
#include "../inc/MarlinConfigPre.h"

#if ENABLED(BARICUDA)

Expand Down
4 changes: 2 additions & 2 deletions Marlin/src/feature/bedlevel/ubl/ubl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -173,10 +173,10 @@
serialprintPGM(csv ? PSTR("CSV:\n") : PSTR("LCD:\n"));
}

// Add XY probe offset from extruder because probe_at_point() subtracts them when
// Add XY probe offset from extruder because probe.probe_at_point() subtracts them when
// moving to the XY position to be measured. This ensures better agreement between
// the current Z position after G28 and the mesh values.
const xy_int8_t curr = closest_indexes(xy_pos_t(current_position) + probe_offset_xy);
const xy_int8_t curr = closest_indexes(xy_pos_t(current_position) + probe.offset_xy);

if (!lcd) SERIAL_EOL();
for (int8_t j = GRID_MAX_POINTS_Y - 1; j >= 0; j--) {
Expand Down
Loading

0 comments on commit 1c02806

Please sign in to comment.