Skip to content

Commit 66dadce

Browse files
committed
Merge branch 'bugfix-2.0.x' into 2.0.x-Sapphire-Pro
2 parents a3963ed + 201c991 commit 66dadce

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

75 files changed

+1809
-1275
lines changed

Marlin/Configuration.h

+8
Original file line numberDiff line numberDiff line change
@@ -944,6 +944,14 @@
944944
#define SMART_EFFECTOR_MOD_PIN -1 // Connect a GPIO pin to the Smart Effector MOD pin
945945
#endif
946946

947+
/**
948+
* Use StallGuard2 to probe the bed with the nozzle.
949+
* Requires stallGuard-capable Trinamic stepper drivers.
950+
* CAUTION: This can damage machines with Z lead screws.
951+
* Take extreme care when setting up this feature.
952+
*/
953+
//#define SENSORLESS_PROBING
954+
947955
//
948956
// For Z_PROBE_ALLEN_KEY see the Delta example configurations.
949957
//

Marlin/Configuration_adv.h

+17-22
Original file line numberDiff line numberDiff line change
@@ -718,6 +718,9 @@
718718
#define Z_STEPPER_ALIGN_ITERATIONS 5 // Number of iterations to apply during alignment
719719
#define Z_STEPPER_ALIGN_ACC 0.02 // Stop iterating early if the accuracy is better than this
720720
#define RESTORE_LEVELING_AFTER_G34 // Restore leveling after G34 is done?
721+
// After G34, re-home Z (G28 Z) or just calculate it from the last probe heights?
722+
// Re-homing might be more precise in reproducing the actual 'G28 Z' homing height, especially on an uneven bed.
723+
#define HOME_AFTER_G34
721724
#endif
722725

723726
// @section motion
@@ -992,6 +995,10 @@
992995
// Show the E position (filament used) during printing
993996
//#define LCD_SHOW_E_TOTAL
994997

998+
#if ENABLED(SHOW_BOOTSCREEN)
999+
#define BOOTSCREEN_TIMEOUT 4000 // (ms) Total Duration to display the boot screen(s)
1000+
#endif
1001+
9951002
#if HAS_GRAPHICAL_LCD && HAS_PRINT_PROGRESS
9961003
//#define PRINT_PROGRESS_SHOW_DECIMALS // Show progress with decimal digits
9971004
//#define SHOW_REMAINING_TIME // Display estimated time to completion
@@ -1014,12 +1021,9 @@
10141021

10151022
#if ENABLED(SDSUPPORT)
10161023

1017-
// Some RAMPS and other boards don't detect when an SD card is inserted. You can work
1018-
// around this by connecting a push button or single throw switch to the pin defined
1019-
// as SD_DETECT_PIN in your board's pins definitions.
1020-
// This setting should be disabled unless you are using a push button, pulling the pin to ground.
1021-
// Note: This is always disabled for ULTIPANEL (except ELB_FULL_GRAPHIC_CONTROLLER).
1022-
#define SD_DETECT_INVERTED
1024+
// The standard SD detect circuit reads LOW when media is inserted and HIGH when empty.
1025+
// Enable this option and set to HIGH if your SD cards are incorrectly detected.
1026+
//#define SD_DETECT_STATE HIGH
10231027

10241028
#define SD_FINISHED_STEPPERRELEASE true // Disable steppers when SD Print is finished
10251029
#define SD_FINISHED_RELEASECOMMAND "M84 X Y Z E" // You might want to keep the Z enabled so your bed stays in place.
@@ -1047,7 +1051,7 @@
10471051
*/
10481052
//#define POWER_LOSS_RECOVERY
10491053
#if ENABLED(POWER_LOSS_RECOVERY)
1050-
//#define PLR_ENABLED_DEFAULT true // Power Loss Recovery enabled by default. (Set with 'M413 Sn' & M500)
1054+
#define PLR_ENABLED_DEFAULT false // Power Loss Recovery enabled by default. (Set with 'M413 Sn' & M500)
10511055
//#define BACKUP_POWER_SUPPLY // Backup power / UPS to move the steppers on power loss
10521056
//#define POWER_LOSS_ZRAISE 2 // (mm) Z axis raise on resume (on power loss with UPS)
10531057
//#define POWER_LOSS_PIN 44 // Pin to detect power loss. Set to -1 to disable default pin on boards without module.
@@ -1227,10 +1231,6 @@
12271231
// Western only. Not available for Cyrillic, Kana, Turkish, Greek, or Chinese.
12281232
//#define USE_SMALL_INFOFONT
12291233

1230-
// Enable this option and reduce the value to optimize screen updates.
1231-
// The normal delay is 10µs. Use the lowest value that still gives a reliable display.
1232-
//#define DOGM_SPI_DELAY_US 5
1233-
12341234
// Swap the CW/CCW indicators in the graphics overlay
12351235
//#define OVERLAY_GFX_REVERSE
12361236

@@ -1247,6 +1247,10 @@
12471247
* This will prevent position updates from being displayed.
12481248
*/
12491249
#if ENABLED(U8GLIB_ST7920)
1250+
// Enable this option and reduce the value to optimize screen updates.
1251+
// The normal delay is 10µs. Use the lowest value that still gives a reliable display.
1252+
//#define DOGM_SPI_DELAY_US 5
1253+
12501254
//#define LIGHTWEIGHT_UI
12511255
#if ENABLED(LIGHTWEIGHT_UI)
12521256
#define STATUS_EXPIRE_SECONDS 20
@@ -1284,15 +1288,14 @@
12841288
// Additional options for DGUS / DWIN displays
12851289
//
12861290
#if HAS_DGUS_LCD
1287-
#define DGUS_SERIAL_PORT 2
1291+
#define DGUS_SERIAL_PORT 3
12881292
#define DGUS_BAUDRATE 115200
12891293

12901294
#define DGUS_RX_BUFFER_SIZE 128
12911295
#define DGUS_TX_BUFFER_SIZE 48
12921296
//#define DGUS_SERIAL_STATS_RX_BUFFER_OVERRUNS // Fix Rx overrun situation (Currently only for AVR)
12931297

12941298
#define DGUS_UPDATE_INTERVAL_MS 500 // (ms) Interval between automatic screen updates
1295-
#define BOOTSCREEN_TIMEOUT 3000 // (ms) Duration to display the boot screen
12961299

12971300
#if EITHER(DGUS_LCD_UI_FYSETC, DGUS_LCD_UI_HIPRECY)
12981301
#define DGUS_PRINT_FILENAME // Display the filename during printing
@@ -2308,14 +2311,6 @@
23082311
*/
23092312
//#define SENSORLESS_HOMING // StallGuard capable drivers only
23102313

2311-
/**
2312-
* Use StallGuard2 to probe the bed with the nozzle.
2313-
*
2314-
* CAUTION: This could cause damage to machines that use a lead screw or threaded rod
2315-
* to move the Z axis. Take extreme care when attempting to enable this feature.
2316-
*/
2317-
//#define SENSORLESS_PROBING // StallGuard capable drivers only
2318-
23192314
#if EITHER(SENSORLESS_HOMING, SENSORLESS_PROBING)
23202315
// TMC2209: 0...255. TMC2130: -64...63
23212316
#define X_STALL_SENSITIVITY 8
@@ -2997,7 +2992,7 @@
29972992
#define MAX7219_LOAD_PIN 44
29982993

29992994
//#define MAX7219_GCODE // Add the M7219 G-code to control the LED matrix
3000-
#define MAX7219_INIT_TEST 2 // Do a test pattern at initialization (Set to 2 for spiral)
2995+
#define MAX7219_INIT_TEST 2 // Test pattern at startup: 0=none, 1=sweep, 2=spiral
30012996
#define MAX7219_NUMBER_UNITS 1 // Number of Max7219 units in chain.
30022997
#define MAX7219_ROTATE 0 // Rotate the display clockwise (in multiples of +/- 90°)
30032998
// connector at: right=0 bottom=-90 top=90 left=180

Marlin/src/HAL/HAL_AVR/MarlinSerial.h

+9-9
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,10 @@
3131
* Templatized 01 October 2018 by Eduardo José Tagle to allow multiple instances
3232
*/
3333

34-
#include "../shared/MarlinSerial.h"
35-
3634
#include <WString.h>
3735

36+
#include "../../inc/MarlinConfigPre.h"
37+
3838
#ifndef SERIAL_PORT
3939
#define SERIAL_PORT 0
4040
#endif
@@ -261,12 +261,12 @@
261261
static constexpr int PORT = serial;
262262
static constexpr unsigned int RX_SIZE = RX_BUFFER_SIZE;
263263
static constexpr unsigned int TX_SIZE = TX_BUFFER_SIZE;
264-
static constexpr bool XONOFF = bSERIAL_XON_XOFF;
265-
static constexpr bool EMERGENCYPARSER = bEMERGENCY_PARSER;
266-
static constexpr bool DROPPED_RX = bSERIAL_STATS_DROPPED_RX;
267-
static constexpr bool RX_OVERRUNS = bSERIAL_STATS_RX_BUFFER_OVERRUNS;
268-
static constexpr bool RX_FRAMING_ERRORS = bSERIAL_STATS_RX_FRAMING_ERRORS;
269-
static constexpr bool MAX_RX_QUEUED = bSERIAL_STATS_MAX_RX_QUEUED;
264+
static constexpr bool XONOFF = ENABLED(SERIAL_XON_XOFF);
265+
static constexpr bool EMERGENCYPARSER = ENABLED(EMERGENCY_PARSER);
266+
static constexpr bool DROPPED_RX = ENABLED(SERIAL_STATS_DROPPED_RX);
267+
static constexpr bool RX_OVERRUNS = ENABLED(SERIAL_STATS_RX_BUFFER_OVERRUNS);
268+
static constexpr bool RX_FRAMING_ERRORS = ENABLED(SERIAL_STATS_RX_FRAMING_ERRORS);
269+
static constexpr bool MAX_RX_QUEUED = ENABLED(SERIAL_STATS_MAX_RX_QUEUED);
270270
};
271271
extern MarlinSerial<MarlinSerialCfg<SERIAL_PORT>> customizedSerial1;
272272

@@ -304,7 +304,7 @@
304304
static constexpr bool XONOFF = false;
305305
static constexpr bool EMERGENCYPARSER = false;
306306
static constexpr bool DROPPED_RX = false;
307-
static constexpr bool RX_OVERRUNS = bDGUS_SERIAL_STATS_RX_BUFFER_OVERRUNS;
307+
static constexpr bool RX_OVERRUNS = HAS_DGUS_LCD && ENABLED(DGUS_SERIAL_STATS_RX_BUFFER_OVERRUNS);
308308
static constexpr bool RX_FRAMING_ERRORS = false;
309309
static constexpr bool MAX_RX_QUEUED = false;
310310
};

Marlin/src/HAL/HAL_DUE/MarlinSerial.h

+8-8
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,10 @@
2727
* Based on MarlinSerial for AVR, copyright (c) 2006 Nicholas Zambetti. All right reserved.
2828
*/
2929

30-
#include "../shared/MarlinSerial.h"
31-
3230
#include <WString.h>
3331

32+
#include "../../inc/MarlinConfigPre.h"
33+
3434
#define DEC 10
3535
#define HEX 16
3636
#define OCT 8
@@ -163,12 +163,12 @@ struct MarlinSerialCfg {
163163
static constexpr int PORT = serial;
164164
static constexpr unsigned int RX_SIZE = RX_BUFFER_SIZE;
165165
static constexpr unsigned int TX_SIZE = TX_BUFFER_SIZE;
166-
static constexpr bool XONOFF = bSERIAL_XON_XOFF;
167-
static constexpr bool EMERGENCYPARSER = bEMERGENCY_PARSER;
168-
static constexpr bool DROPPED_RX = bSERIAL_STATS_DROPPED_RX;
169-
static constexpr bool RX_OVERRUNS = bSERIAL_STATS_RX_BUFFER_OVERRUNS;
170-
static constexpr bool RX_FRAMING_ERRORS = bSERIAL_STATS_RX_FRAMING_ERRORS;
171-
static constexpr bool MAX_RX_QUEUED = bSERIAL_STATS_MAX_RX_QUEUED;
166+
static constexpr bool XONOFF = ENABLED(SERIAL_XON_XOFF);
167+
static constexpr bool EMERGENCYPARSER = ENABLED(EMERGENCY_PARSER);
168+
static constexpr bool DROPPED_RX = ENABLED(SERIAL_STATS_DROPPED_RX);
169+
static constexpr bool RX_OVERRUNS = ENABLED(SERIAL_STATS_RX_BUFFER_OVERRUNS);
170+
static constexpr bool RX_FRAMING_ERRORS = ENABLED(SERIAL_STATS_RX_FRAMING_ERRORS);
171+
static constexpr bool MAX_RX_QUEUED = ENABLED(SERIAL_STATS_MAX_RX_QUEUED);
172172
};
173173

174174
#if SERIAL_PORT >= 0

Marlin/src/HAL/HAL_LPC1768/inc/SanityCheck.h

+6-8
Original file line numberDiff line numberDiff line change
@@ -57,9 +57,7 @@
5757
* Because PWM hardware channels all share the same frequency, along with the
5858
* fallback software channels, FAST_PWM_FAN is incompatible with Servos.
5959
*/
60-
#if NUM_SERVOS > 0 && ENABLED(FAST_PWM_FAN)
61-
#error "BLTOUCH and Servos are incompatible with FAST_PWM_FAN on LPC176x boards."
62-
#endif
60+
static_assert(!(NUM_SERVOS && ENABLED(FAST_PWM_FAN)), "BLTOUCH and Servos are incompatible with FAST_PWM_FAN on LPC176x boards.");
6361

6462
/**
6563
* Test LPC176x-specific configuration values for errors at compile-time.
@@ -69,13 +67,13 @@
6967
// #error "SPINDLE_LASER_PWM_PIN must use SERVO0, SERVO1 or SERVO3 connector"
7068
//#endif
7169

72-
#if IS_RE_ARM_BOARD && ENABLED(REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER) && HAS_DRIVER(TMC2130) && DISABLED(TMC_USE_SW_SPI)
73-
#error "Re-ARM with REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER and TMC2130 require TMC_USE_SW_SPI"
70+
#if MB(RAMPS_14_RE_ARM_EFB, RAMPS_14_RE_ARM_EEB, RAMPS_14_RE_ARM_EFF, RAMPS_14_RE_ARM_EEF, RAMPS_14_RE_ARM_SF)
71+
#if ENABLED(REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER) && HAS_DRIVER(TMC2130) && DISABLED(TMC_USE_SW_SPI)
72+
#error "Re-ARM with REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER and TMC2130 requires TMC_USE_SW_SPI."
73+
#endif
7474
#endif
7575

76-
#if ENABLED(BAUD_RATE_GCODE)
77-
#error "BAUD_RATE_GCODE is not yet supported on LPC176x."
78-
#endif
76+
static_assert(DISABLED(BAUD_RATE_GCODE), "BAUD_RATE_GCODE is not yet supported on LPC176x.");
7977

8078
/**
8179
* Flag any serial port conflicts

Marlin/src/HAL/HAL_SAMD51/fastio.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
/**
3838
* Magic I/O routines
3939
*
40-
* Now you can simply SET_OUTPUT(STEP); WRITE(STEP, HIGH); WRITE(STEP, LOW);
40+
* Now you can simply SET_OUTPUT(IO); WRITE(IO, HIGH); WRITE(IO, LOW);
4141
*/
4242

4343
// Read a pin

Marlin/src/HAL/HAL_SAMD51/inc/SanityCheck.h

+4-8
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,10 @@
2323
* Test SAMD51 specific configuration values for errors at compile-time.
2424
*/
2525

26+
#if ENABLED(EEPROM_SETTINGS) && NONE(SPI_EEPROM, I2C_EEPROM)
27+
#warning "Did you activate the SmartEEPROM? See https://github.com/GMagician/SAMD51-SmartEEprom-Manager/releases"
28+
#endif
29+
2630
#if defined(ADAFRUIT_GRAND_CENTRAL_M4) && SD_CONNECTION_IS(CUSTOM_CABLE)
2731
#error "No custom SD drive cable defined for this board."
2832
#endif
@@ -42,11 +46,3 @@
4246
#if ENABLED(FAST_PWM_FAN)
4347
#error "FAST_PWM_FAN is not yet implemented for this platform."
4448
#endif
45-
46-
#if ENABLED(EEPROM_SETTINGS) && NONE(SPI_EEPROM, I2C_EEPROM)
47-
#warning "Did you activate the SmartEEPROM? See https://github.com/GMagician/SAMD51-SmartEEprom-Manager/releases"
48-
#endif
49-
50-
#if HAS_TMC_SW_SERIAL
51-
#error "TMC220x Software Serial is not supported on this platform."
52-
#endif

Marlin/src/HAL/HAL_SAMD51/timers.cpp

+4-4
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ const tTimerConfig TimerConfig[NUM_HARDWARE_TIMERS+1] = {
4242
{ {.pTc=TC1}, TC1_IRQn, TC_PRIORITY(1) }, // 1 - stepper (needed by 32 bit timers)
4343
{ {.pTc=TC2}, TC2_IRQn, TC_PRIORITY(2) }, // 2 - tone (framework)
4444
{ {.pTc=TC3}, TC3_IRQn, TC_PRIORITY(3) }, // 3 - servo
45-
{ {.pTc=TC4}, TC4_IRQn, TC_PRIORITY(4) },
45+
{ {.pTc=TC4}, TC4_IRQn, TC_PRIORITY(4) }, // 4 - software serial
4646
{ {.pTc=TC5}, TC5_IRQn, TC_PRIORITY(5) },
4747
{ {.pTc=TC6}, TC6_IRQn, TC_PRIORITY(6) },
4848
{ {.pTc=TC7}, TC7_IRQn, TC_PRIORITY(7) },
@@ -145,12 +145,12 @@ void HAL_timer_start(const uint8_t timer_num, const uint32_t frequency) {
145145
}
146146

147147
void HAL_timer_enable_interrupt(const uint8_t timer_num) {
148-
IRQn_Type irq = TimerConfig[timer_num].IRQ_Id;
148+
const IRQn_Type irq = TimerConfig[timer_num].IRQ_Id;
149149
NVIC_EnableIRQ(irq);
150150
}
151151

152152
void HAL_timer_disable_interrupt(const uint8_t timer_num) {
153-
IRQn_Type irq = TimerConfig[timer_num].IRQ_Id;
153+
const IRQn_Type irq = TimerConfig[timer_num].IRQ_Id;
154154
Disable_Irq(irq);
155155
}
156156

@@ -160,7 +160,7 @@ static bool NVIC_GetEnabledIRQ(IRQn_Type IRQn) {
160160
}
161161

162162
bool HAL_timer_interrupt_enabled(const uint8_t timer_num) {
163-
IRQn_Type irq = TimerConfig[timer_num].IRQ_Id;
163+
const IRQn_Type irq = TimerConfig[timer_num].IRQ_Id;
164164
return NVIC_GetEnabledIRQ(irq);
165165
}
166166

Marlin/src/HAL/HAL_SAMD51/timers.h

+6-6
Original file line numberDiff line numberDiff line change
@@ -57,16 +57,16 @@ typedef uint32_t hal_timer_t;
5757
: (t == TEMP_TIMER_NUM) ? 6 \
5858
: 7
5959

60-
#define _TC_HANDLER(t) void TC##t##_Handler()
61-
#define TC_HANDLER(t) _TC_HANDLER(t)
62-
#define HAL_STEP_TIMER_ISR() TC_HANDLER(STEP_TIMER_NUM)
60+
#define _TC_HANDLER(t) void TC##t##_Handler()
61+
#define TC_HANDLER(t) _TC_HANDLER(t)
62+
#define HAL_STEP_TIMER_ISR() TC_HANDLER(STEP_TIMER_NUM)
6363
#if STEP_TIMER_NUM != PULSE_TIMER_NUM
64-
#define HAL_PULSE_TIMER_ISR() TC_HANDLER(PULSE_TIMER_NUM)
64+
#define HAL_PULSE_TIMER_ISR() TC_HANDLER(PULSE_TIMER_NUM)
6565
#endif
6666
#if TEMP_TIMER_NUM == RTC_TIMER_NUM
67-
#define HAL_TEMP_TIMER_ISR() void RTC_Handler()
67+
#define HAL_TEMP_TIMER_ISR() void RTC_Handler()
6868
#else
69-
#define HAL_TEMP_TIMER_ISR() TC_HANDLER(TEMP_TIMER_NUM)
69+
#define HAL_TEMP_TIMER_ISR() TC_HANDLER(TEMP_TIMER_NUM)
7070
#endif
7171

7272
// --------------------------------------------------------------------------

Marlin/src/HAL/shared/MarlinSerial.h

-67
This file was deleted.

0 commit comments

Comments
 (0)