Skip to content

Commit 6444761

Browse files
committed
Merge branch 'bugfix-2.1.x' into HEVO-BTT-SKR-1.3
2 parents 542cc52 + 202114c commit 6444761

File tree

91 files changed

+2244
-2396
lines changed

Some content is hidden

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

91 files changed

+2244
-2396
lines changed

Marlin/Configuration.h

+12-5
Original file line numberDiff line numberDiff line change
@@ -1867,11 +1867,18 @@
18671867
//#define RGB_LED
18681868
//#define RGBW_LED
18691869

1870-
#if ENABLED(RGB_LED) || ENABLED(RGBW_LED)
1871-
#define RGB_LED_R_PIN 34
1872-
#define RGB_LED_G_PIN 43
1873-
#define RGB_LED_B_PIN 35
1874-
#define RGB_LED_W_PIN -1
1870+
#if EITHER(RGB_LED, RGBW_LED)
1871+
//#define RGB_LED_R_PIN 34
1872+
//#define RGB_LED_G_PIN 43
1873+
//#define RGB_LED_B_PIN 35
1874+
//#define RGB_LED_W_PIN -1
1875+
#endif
1876+
1877+
#if ANY(RGB_LED, RGBW_LED, PCA9632)
1878+
//#define RGB_STARTUP_TEST // For PWM pins, fade between all colors
1879+
#if ENABLED(RGB_STARTUP_TEST)
1880+
#define RGB_STARTUP_TEST_INNER_MS 10 // (ms) Reduce or increase fading speed
1881+
#endif
18751882
#endif
18761883

18771884
// Support for Adafruit Neopixel LED driver

Marlin/Configuration_adv.h

+3-3
Original file line numberDiff line numberDiff line change
@@ -146,18 +146,18 @@
146146
* Thermistors able to support high temperature tend to have a hard time getting
147147
* good readings at room and lower temperatures. This means HEATER_X_RAW_LO_TEMP
148148
* will probably be caught when the heating element first turns on during the
149-
* preheating process, which will trigger a min_temp_error as a safety measure
149+
* preheating process, which will trigger a MINTEMP error as a safety measure
150150
* and force stop everything.
151151
* To circumvent this limitation, we allow for a preheat time (during which,
152-
* min_temp_error won't be triggered) and add a min_temp buffer to handle
152+
* MINTEMP error won't be triggered) and add a min_temp buffer to handle
153153
* aberrant readings.
154154
*
155155
* If you want to enable this feature for your hotend thermistor(s)
156156
* uncomment and set values > 0 in the constants below
157157
*/
158158

159159
// The number of consecutive low temperature errors that can occur
160-
// before a min_temp_error is triggered. (Shouldn't be more than 10.)
160+
// before a MINTEMP error is triggered. (Shouldn't be more than 10.)
161161
//#define MAX_CONSECUTIVE_LOW_TEMPERATURE_ERROR_ALLOWED 0
162162

163163
// The number of milliseconds a hotend will preheat before starting to check

Marlin/Version.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
* here we define this default string as the date where the latest release
4242
* version was tagged.
4343
*/
44-
//#define STRING_DISTRIBUTION_DATE "2023-01-02"
44+
//#define STRING_DISTRIBUTION_DATE "2023-01-09"
4545

4646
/**
4747
* Defines a generic printer name to be output to the LCD after booting Marlin.

Marlin/src/HAL/SAMD21/timers.cpp

+5-5
Original file line numberDiff line numberDiff line change
@@ -47,11 +47,11 @@ const tTimerConfig timer_config[NUM_HARDWARE_TIMERS] = {
4747
{ {.pTcc=TCC0}, TimerType::tcc, TCC0_IRQn, TC_PRIORITY(0) }, // 0 - stepper (assigned priority 2)
4848
{ {.pTcc=TCC1}, TimerType::tcc, TCC1_IRQn, TC_PRIORITY(1) }, // 1 - stepper (needed by 32 bit timers)
4949
{ {.pTcc=TCC2}, TimerType::tcc, TCC2_IRQn, 5 }, // 2 - tone (reserved by framework and fixed assigned priority 5)
50-
{ {.pTc=TC3}, TimerType::tc, TC3_IRQn, TC_PRIORITY(3) }, // 3 - servo (assigned priority 1)
51-
{ {.pTc=TC4}, TimerType::tc, TC4_IRQn, TC_PRIORITY(4) }, // 4 - software serial (no interrupts used)
52-
{ {.pTc=TC5}, TimerType::tc, TC5_IRQn, TC_PRIORITY(5) },
53-
{ {.pTc=TC6}, TimerType::tc, TC6_IRQn, TC_PRIORITY(6) },
54-
{ {.pTc=TC7}, TimerType::tc, TC7_IRQn, TC_PRIORITY(7) },
50+
{ {.pTc=TC3}, TimerType::tc, TC3_IRQn, TC_PRIORITY(3) }, // 3 - servo (assigned priority 1)
51+
{ {.pTc=TC4}, TimerType::tc, TC4_IRQn, TC_PRIORITY(4) }, // 4 - software serial (no interrupts used)
52+
{ {.pTc=TC5}, TimerType::tc, TC5_IRQn, TC_PRIORITY(5) },
53+
{ {.pTc=TC6}, TimerType::tc, TC6_IRQn, TC_PRIORITY(6) },
54+
{ {.pTc=TC7}, TimerType::tc, TC7_IRQn, TC_PRIORITY(7) },
5555
{ {.pRtc=RTC}, TimerType::rtc, RTC_IRQn, TC_PRIORITY(8) } // 8 - temperature (assigned priority 6)
5656
};
5757

Marlin/src/MarlinCore.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,7 @@
232232
#include "feature/password/password.h"
233233
#endif
234234

235-
#if ENABLED(DGUS_LCD_UI_MKS)
235+
#if DGUS_LCD_UI_MKS
236236
#include "lcd/extui/dgus/DGUSScreenHandler.h"
237237
#endif
238238

Marlin/src/feature/leds/leds.cpp

+56-1
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,62 @@ void LEDLights::setup() {
9595
delay(500);
9696
}
9797
#endif // RGB_STARTUP_TEST
98-
#endif
98+
99+
#elif BOTH(PCA9632, RGB_STARTUP_TEST) // PCA9632 RGB_STARTUP_TEST
100+
101+
constexpr int8_t led_pin_count = TERN(HAS_WHITE_LED, 4, 3);
102+
103+
// Startup animation
104+
LEDColor curColor = LEDColorOff();
105+
PCA9632_set_led_color(curColor); // blackout
106+
delay(200);
107+
108+
/*
109+
* LED Pin Counter steps -> events
110+
* | 0-100 | 100-200 | 200-300 | 300-400 |
111+
* fade in steady | fade out
112+
* start next pin fade in
113+
*/
114+
115+
uint16_t led_pin_counters[led_pin_count] = { 1, 0, 0 };
116+
117+
bool canEnd = false;
118+
while (led_pin_counters[0] != 99 || !canEnd) {
119+
if (led_pin_counters[0] == 99) // End loop next time pin0 counter is 99
120+
canEnd = true;
121+
LOOP_L_N(i, led_pin_count) {
122+
if (led_pin_counters[i] > 0) {
123+
if (++led_pin_counters[i] == 400) // turn off current pin counter in led_pin_counters
124+
led_pin_counters[i] = 0;
125+
else if (led_pin_counters[i] == 201) { // start next pin pwm
126+
led_pin_counters[i + 1 == led_pin_count ? 0 : i + 1] = 1;
127+
i++; // skip next pin in this loop so it doesn't increment twice
128+
}
129+
}
130+
}
131+
uint16_t r, g, b;
132+
r = led_pin_counters[0]; curColor.r = r <= 100 ? r : r <= 300 ? 100 : 400 - r;
133+
g = led_pin_counters[1]; curColor.g = g <= 100 ? g : g <= 300 ? 100 : 400 - g;
134+
b = led_pin_counters[2]; curColor.b = b <= 100 ? b : b <= 300 ? 100 : 400 - b;
135+
#if HAS_WHITE_LED
136+
const uint16_t w = led_pin_counters[3]; curColor.w = w <= 100 ? w : w <= 300 ? 100 : 400 - w;
137+
#endif
138+
PCA9632_set_led_color(curColor);
139+
delay(RGB_STARTUP_TEST_INNER_MS);
140+
}
141+
142+
// Fade to white
143+
LOOP_LE_N(led_pwm, 100) {
144+
NOLESS(curColor.r, led_pwm);
145+
NOLESS(curColor.g, led_pwm);
146+
NOLESS(curColor.b, led_pwm);
147+
TERN_(HAS_WHITE_LED, NOLESS(curColor.w, led_pwm));
148+
PCA9632_set_led_color(curColor);
149+
delay(RGB_STARTUP_TEST_INNER_MS);
150+
}
151+
152+
#endif // PCA9632 && RGB_STARTUP_TEST
153+
99154
TERN_(NEOPIXEL_LED, neo.init());
100155
TERN_(PCA9533, PCA9533_init());
101156
TERN_(LED_USER_PRESET_STARTUP, set_default());

Marlin/src/feature/leds/neopixel.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ void Marlin_NeoPixel::init() {
108108
set_color(adaneo1.Color
109109
TERN(LED_USER_PRESET_STARTUP,
110110
(LED_USER_PRESET_RED, LED_USER_PRESET_GREEN, LED_USER_PRESET_BLUE, LED_USER_PRESET_WHITE),
111-
(255, 255, 255, 255))
111+
(0, 0, 0, 0))
112112
);
113113
}
114114

Marlin/src/feature/pause.cpp

+4-9
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@ bool load_filament(const_float_t slow_load_length/*=0*/, const_float_t fast_load
211211
while (wait_for_user) {
212212
impatient_beep(max_beep_count);
213213
#if BOTH(FILAMENT_CHANGE_RESUME_ON_INSERT, FILAMENT_RUNOUT_SENSOR)
214-
#if ENABLED(MULTI_FILAMENT_SENSOR)
214+
#if MULTI_FILAMENT_SENSOR
215215
#define _CASE_INSERTED(N) case N-1: if (READ(FIL_RUNOUT##N##_PIN) != FIL_RUNOUT##N##_STATE) wait_for_user = false; break;
216216
switch (active_extruder) {
217217
REPEAT_1(NUM_RUNOUT_SENSORS, _CASE_INSERTED)
@@ -410,7 +410,6 @@ bool pause_print(const_float_t retract, const xyz_pos_t &park_point, const bool
410410
#endif
411411

412412
TERN_(HOST_PROMPT_SUPPORT, hostui.prompt_open(PROMPT_INFO, F("Pause"), FPSTR(DISMISS_STR)));
413-
TERN_(DWIN_LCD_PROUI, DWIN_Print_Pause());
414413

415414
// Indicate that the printer is paused
416415
++did_pause_print;
@@ -461,6 +460,7 @@ bool pause_print(const_float_t retract, const xyz_pos_t &park_point, const bool
461460

462461
// If axes don't need to home then the nozzle can park
463462
if (do_park) nozzle.park(0, park_point); // Park the nozzle by doing a Minimum Z Raise followed by an XY Move
463+
TERN_(DWIN_LCD_PROUI, if (!do_park) ui.set_status(GET_TEXT_F(MSG_PARK_FAILED)));
464464

465465
#if ENABLED(DUAL_X_CARRIAGE)
466466
const int8_t saved_ext = active_extruder;
@@ -710,13 +710,8 @@ void resume_print(const_float_t slow_load_length/*=0*/, const_float_t fast_load_
710710

711711
TERN_(HAS_FILAMENT_SENSOR, runout.reset());
712712

713-
#if ENABLED(DWIN_LCD_PROUI)
714-
DWIN_Print_Resume();
715-
HMI_ReturnScreen();
716-
#else
717-
ui.reset_status();
718-
ui.return_to_status();
719-
#endif
713+
ui.reset_status();
714+
ui.return_to_status();
720715
}
721716

722717
#endif // ADVANCED_PAUSE_FEATURE

Marlin/src/gcode/config/M302.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
#include "../../module/temperature.h"
2929

3030
#if ENABLED(DWIN_LCD_PROUI)
31-
#include "../../lcd/e3v2/proui/dwin_defines.h"
31+
#include "../../lcd/e3v2/proui/dwin.h"
3232
#endif
3333

3434
/**

Marlin/src/gcode/control/M605.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@
169169
if (parser.seen("EPS")) {
170170
planner.synchronize();
171171
if (parser.seenval('P')) duplication_e_mask = parser.value_int(); // Set the mask directly
172-
else if (parser.seenval('E')) duplication_e_mask = pow(2, parser.value_int() + 1) - 1; // Set the mask by E index
172+
else if (parser.seenval('E')) duplication_e_mask = _BV(parser.value_int() + 1) - 1; // Set the mask by E index
173173
ena = (2 == parser.intval('S', extruder_duplication_enabled ? 2 : 0));
174174
set_duplication_enabled(ena && (duplication_e_mask >= 3));
175175
}

Marlin/src/gcode/feature/input_shaping/M593.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,8 @@ void GcodeSuite::M593_report(const bool forReplay/*=true*/) {
4949
* D<factor> Set the zeta/damping factor. If axes (X, Y, etc.) are not specified, set for all axes.
5050
* F<frequency> Set the frequency. If axes (X, Y, etc.) are not specified, set for all axes.
5151
* T[map] Input Shaping type, 0:ZV, 1:EI, 2:2H EI (not implemented yet)
52-
* X<1> Set the given parameters only for the X axis.
53-
* Y<1> Set the given parameters only for the Y axis.
52+
* X Set the given parameters only for the X axis.
53+
* Y Set the given parameters only for the Y axis.
5454
*/
5555
void GcodeSuite::M593() {
5656
if (!parser.seen_any()) return M593_report();

Marlin/src/gcode/gcode.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -1081,7 +1081,7 @@ void GcodeSuite::process_parsed_command(const bool no_ok/*=false*/) {
10811081
case 1001: M1001(); break; // M1001: [INTERNAL] Handle SD completion
10821082
#endif
10831083

1084-
#if ENABLED(DGUS_LCD_UI_MKS)
1084+
#if DGUS_LCD_UI_MKS
10851085
case 1002: M1002(); break; // M1002: [INTERNAL] Tool-change and Relative E Move
10861086
#endif
10871087

Marlin/src/gcode/gcode.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -1226,7 +1226,7 @@ class GcodeSuite {
12261226
static void M1001();
12271227
#endif
12281228

1229-
#if ENABLED(DGUS_LCD_UI_MKS)
1229+
#if DGUS_LCD_UI_MKS
12301230
static void M1002();
12311231
#endif
12321232

Marlin/src/gcode/lcd/M145.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ void GcodeSuite::M145() {
4747
preheat_t &mat = ui.material_preset[material];
4848
#if HAS_HOTEND
4949
if (parser.seenval('H'))
50-
mat.hotend_temp = constrain(parser.value_int(), EXTRUDE_MINTEMP, thermalManager.hotend_max_target(0));
50+
mat.hotend_temp = constrain(parser.value_int(), thermalManager.extrude_min_temp, thermalManager.hotend_max_target(0));
5151
#endif
5252
#if HAS_HEATED_BED
5353
if (parser.seenval('B'))

Marlin/src/gcode/sd/M1001.cpp

-1
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,6 @@ void GcodeSuite::M1001() {
109109
#endif
110110

111111
TERN_(EXTENSIBLE_UI, ExtUI::onPrintDone());
112-
TERN_(DWIN_LCD_PROUI, DWIN_Print_Finished());
113112

114113
// Re-select the last printed file in the UI
115114
TERN_(SD_REPRINT_LAST_SELECTED_FILE, ui.reselect_last_file());

Marlin/src/gcode/sd/M24_M25.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
#include "../../feature/powerloss.h"
4242
#endif
4343

44-
#if ENABLED(DGUS_LCD_UI_MKS)
44+
#if DGUS_LCD_UI_MKS
4545
#include "../../lcd/extui/dgus/DGUSDisplayDef.h"
4646
#endif
4747

@@ -52,7 +52,7 @@
5252
*/
5353
void GcodeSuite::M24() {
5454

55-
#if ENABLED(DGUS_LCD_UI_MKS)
55+
#if DGUS_LCD_UI_MKS
5656
if ((print_job_timer.isPaused() || print_job_timer.isRunning()) && !parser.seen("ST"))
5757
MKS_resume_print_move();
5858
#endif

Marlin/src/gcode/sd/M524.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
#include "../../sd/cardreader.h"
2929

3030
#if ENABLED(DWIN_LCD_PROUI)
31-
#include "../../lcd/e3v2/proui/dwin.h"
31+
#include "../../lcd/marlinui.h"
3232
#endif
3333

3434
/**
@@ -38,7 +38,7 @@ void GcodeSuite::M524() {
3838

3939
#if ENABLED(DWIN_LCD_PROUI)
4040

41-
HMI_flag.abort_flag = true; // The LCD will handle it
41+
ui.abort_print();
4242

4343
#else
4444

Marlin/src/gcode/stats/M75-M78.cpp

+1-4
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@
3939
void GcodeSuite::M75() {
4040
startOrResumeJob();
4141
#if ENABLED(DWIN_LCD_PROUI)
42-
DWIN_Print_Started(false);
4342
if (!IS_SD_PRINTING()) DWIN_Print_Header(parser.string_arg && parser.string_arg[0] ? parser.string_arg : GET_TEXT(MSG_HOST_START_PRINT));
4443
#endif
4544
}
@@ -48,17 +47,15 @@ void GcodeSuite::M75() {
4847
* M76: Pause print timer
4948
*/
5049
void GcodeSuite::M76() {
51-
print_job_timer.pause();
50+
TERN(DWIN_LCD_PROUI, ui.pause_print(), print_job_timer.pause());
5251
TERN_(HOST_PAUSE_M76, hostui.pause());
53-
TERN_(DWIN_LCD_PROUI, DWIN_Print_Pause());
5452
}
5553

5654
/**
5755
* M77: Stop print timer
5856
*/
5957
void GcodeSuite::M77() {
6058
print_job_timer.stop();
61-
TERN_(DWIN_LCD_PROUI, DWIN_Print_Finished());
6259
}
6360

6461
#if ENABLED(PRINTCOUNTER)

Marlin/src/gcode/temp/M303.cpp

+11-11
Original file line numberDiff line numberDiff line change
@@ -61,15 +61,9 @@ void GcodeSuite::M303() {
6161
const heater_id_t hid = (heater_id_t)parser.intval('E');
6262
celsius_t default_temp;
6363
switch (hid) {
64-
#if ENABLED(PIDTEMP)
65-
case 0 ... HOTENDS - 1: default_temp = PREHEAT_1_TEMP_HOTEND; break;
66-
#endif
67-
#if ENABLED(PIDTEMPBED)
68-
case H_BED: default_temp = PREHEAT_1_TEMP_BED; break;
69-
#endif
70-
#if ENABLED(PIDTEMPCHAMBER)
71-
case H_CHAMBER: default_temp = PREHEAT_1_TEMP_CHAMBER; break;
72-
#endif
64+
OPTCODE(PIDTEMP, case 0 ... HOTENDS - 1: default_temp = PREHEAT_1_TEMP_HOTEND; break)
65+
OPTCODE(PIDTEMPBED, case H_BED: default_temp = PREHEAT_1_TEMP_BED; break)
66+
OPTCODE(PIDTEMPCHAMBER, case H_CHAMBER: default_temp = PREHEAT_1_TEMP_CHAMBER; break)
7367
default:
7468
SERIAL_ECHOPGM(STR_PID_AUTOTUNE);
7569
SERIAL_ECHOLNPGM(STR_PID_BAD_HEATER_ID);
@@ -84,9 +78,15 @@ void GcodeSuite::M303() {
8478
const celsius_t temp = seenS ? parser.value_celsius() : default_temp;
8579
const bool u = parser.boolval('U');
8680

87-
#if ENABLED(DWIN_LCD_PROUI)
81+
#if ENABLED(DWIN_LCD_PROUI) && EITHER(PIDTEMP, PIDTEMPBED)
8882
if (seenC) HMI_data.PidCycles = c;
89-
if (seenS) { if (hid == H_BED) HMI_data.BedPidT = temp; else HMI_data.HotendPidT = temp; }
83+
if (seenS) {
84+
switch (hid) {
85+
OPTCODE(PIDTEMP, case 0 ... HOTENDS - 1: HMI_data.HotendPidT = temp; break)
86+
OPTCODE(PIDTEMPBED, case H_BED: HMI_data.BedPidT = temp; break)
87+
default: break;
88+
}
89+
}
9090
#endif
9191

9292
#if DISABLED(BUSY_WHILE_HEATING)

Marlin/src/inc/Conditionals_LCD.h

+7-7
Original file line numberDiff line numberDiff line change
@@ -36,19 +36,19 @@
3636
#define FYSETC_MINI_12864_2_1
3737
#endif
3838

39-
// Updated DGUS_UI shorthand single option can be used, or old settings, for now
39+
// Old settings are now conditional on DGUS_LCD_UI
4040
#if DGUS_UI_IS(ORIGIN)
41-
#define DGUS_LCD_UI_ORIGIN
41+
#define DGUS_LCD_UI_ORIGIN 1
4242
#elif DGUS_UI_IS(FYSETC)
43-
#define DGUS_LCD_UI_FYSETC
43+
#define DGUS_LCD_UI_FYSETC 1
4444
#elif DGUS_UI_IS(HIPRECY)
45-
#define DGUS_LCD_UI_HIPRECY
45+
#define DGUS_LCD_UI_HIPRECY 1
4646
#elif DGUS_UI_IS(MKS)
47-
#define DGUS_LCD_UI_MKS
47+
#define DGUS_LCD_UI_MKS 1
4848
#elif DGUS_UI_IS(RELOADED)
49-
#define DGUS_LCD_UI_RELOADED
49+
#define DGUS_LCD_UI_RELOADED 1
5050
#elif DGUS_UI_IS(IA_CREALITY)
51-
#define DGUS_LCD_UI_IA_CREALITY
51+
#define DGUS_LCD_UI_IA_CREALITY 1
5252
#endif
5353

5454
/**

Marlin/src/inc/Conditionals_post.h

+1
Original file line numberDiff line numberDiff line change
@@ -2472,6 +2472,7 @@
24722472
#define BED_MAX_TARGET (BED_MAXTEMP - (BED_OVERSHOOT))
24732473
#else
24742474
#undef PIDTEMPBED
2475+
#undef PREHEAT_BEFORE_LEVELING
24752476
#endif
24762477

24772478
#if HAS_TEMP_COOLER && PIN_EXISTS(COOLER)

0 commit comments

Comments
 (0)