Skip to content

Commit

Permalink
Merge branch 'bugfix-2.1.x' into HEVO-BTT-SKR-1.3
Browse files Browse the repository at this point in the history
  • Loading branch information
uBaHoFF committed Jan 9, 2023
2 parents 542cc52 + 202114c commit 6444761
Show file tree
Hide file tree
Showing 91 changed files with 2,244 additions and 2,396 deletions.
17 changes: 12 additions & 5 deletions Marlin/Configuration.h
Original file line number Diff line number Diff line change
Expand Up @@ -1867,11 +1867,18 @@
//#define RGB_LED
//#define RGBW_LED

#if ENABLED(RGB_LED) || ENABLED(RGBW_LED)
#define RGB_LED_R_PIN 34
#define RGB_LED_G_PIN 43
#define RGB_LED_B_PIN 35
#define RGB_LED_W_PIN -1
#if EITHER(RGB_LED, RGBW_LED)
//#define RGB_LED_R_PIN 34
//#define RGB_LED_G_PIN 43
//#define RGB_LED_B_PIN 35
//#define RGB_LED_W_PIN -1
#endif

#if ANY(RGB_LED, RGBW_LED, PCA9632)
//#define RGB_STARTUP_TEST // For PWM pins, fade between all colors
#if ENABLED(RGB_STARTUP_TEST)
#define RGB_STARTUP_TEST_INNER_MS 10 // (ms) Reduce or increase fading speed
#endif
#endif

// Support for Adafruit Neopixel LED driver
Expand Down
6 changes: 3 additions & 3 deletions Marlin/Configuration_adv.h
Original file line number Diff line number Diff line change
Expand Up @@ -146,18 +146,18 @@
* Thermistors able to support high temperature tend to have a hard time getting
* good readings at room and lower temperatures. This means HEATER_X_RAW_LO_TEMP
* will probably be caught when the heating element first turns on during the
* preheating process, which will trigger a min_temp_error as a safety measure
* preheating process, which will trigger a MINTEMP error as a safety measure
* and force stop everything.
* To circumvent this limitation, we allow for a preheat time (during which,
* min_temp_error won't be triggered) and add a min_temp buffer to handle
* MINTEMP error won't be triggered) and add a min_temp buffer to handle
* aberrant readings.
*
* If you want to enable this feature for your hotend thermistor(s)
* uncomment and set values > 0 in the constants below
*/

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

// The number of milliseconds a hotend will preheat before starting to check
Expand Down
2 changes: 1 addition & 1 deletion Marlin/Version.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
* here we define this default string as the date where the latest release
* version was tagged.
*/
//#define STRING_DISTRIBUTION_DATE "2023-01-02"
//#define STRING_DISTRIBUTION_DATE "2023-01-09"

/**
* Defines a generic printer name to be output to the LCD after booting Marlin.
Expand Down
10 changes: 5 additions & 5 deletions Marlin/src/HAL/SAMD21/timers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,11 @@ const tTimerConfig timer_config[NUM_HARDWARE_TIMERS] = {
{ {.pTcc=TCC0}, TimerType::tcc, TCC0_IRQn, TC_PRIORITY(0) }, // 0 - stepper (assigned priority 2)
{ {.pTcc=TCC1}, TimerType::tcc, TCC1_IRQn, TC_PRIORITY(1) }, // 1 - stepper (needed by 32 bit timers)
{ {.pTcc=TCC2}, TimerType::tcc, TCC2_IRQn, 5 }, // 2 - tone (reserved by framework and fixed assigned priority 5)
{ {.pTc=TC3}, TimerType::tc, TC3_IRQn, TC_PRIORITY(3) }, // 3 - servo (assigned priority 1)
{ {.pTc=TC4}, TimerType::tc, TC4_IRQn, TC_PRIORITY(4) }, // 4 - software serial (no interrupts used)
{ {.pTc=TC5}, TimerType::tc, TC5_IRQn, TC_PRIORITY(5) },
{ {.pTc=TC6}, TimerType::tc, TC6_IRQn, TC_PRIORITY(6) },
{ {.pTc=TC7}, TimerType::tc, TC7_IRQn, TC_PRIORITY(7) },
{ {.pTc=TC3}, TimerType::tc, TC3_IRQn, TC_PRIORITY(3) }, // 3 - servo (assigned priority 1)
{ {.pTc=TC4}, TimerType::tc, TC4_IRQn, TC_PRIORITY(4) }, // 4 - software serial (no interrupts used)
{ {.pTc=TC5}, TimerType::tc, TC5_IRQn, TC_PRIORITY(5) },
{ {.pTc=TC6}, TimerType::tc, TC6_IRQn, TC_PRIORITY(6) },
{ {.pTc=TC7}, TimerType::tc, TC7_IRQn, TC_PRIORITY(7) },
{ {.pRtc=RTC}, TimerType::rtc, RTC_IRQn, TC_PRIORITY(8) } // 8 - temperature (assigned priority 6)
};

Expand Down
2 changes: 1 addition & 1 deletion Marlin/src/MarlinCore.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@
#include "feature/password/password.h"
#endif

#if ENABLED(DGUS_LCD_UI_MKS)
#if DGUS_LCD_UI_MKS
#include "lcd/extui/dgus/DGUSScreenHandler.h"
#endif

Expand Down
57 changes: 56 additions & 1 deletion Marlin/src/feature/leds/leds.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,62 @@ void LEDLights::setup() {
delay(500);
}
#endif // RGB_STARTUP_TEST
#endif

#elif BOTH(PCA9632, RGB_STARTUP_TEST) // PCA9632 RGB_STARTUP_TEST

constexpr int8_t led_pin_count = TERN(HAS_WHITE_LED, 4, 3);

// Startup animation
LEDColor curColor = LEDColorOff();
PCA9632_set_led_color(curColor); // blackout
delay(200);

/*
* LED Pin Counter steps -> events
* | 0-100 | 100-200 | 200-300 | 300-400 |
* fade in steady | fade out
* start next pin fade in
*/

uint16_t led_pin_counters[led_pin_count] = { 1, 0, 0 };

bool canEnd = false;
while (led_pin_counters[0] != 99 || !canEnd) {
if (led_pin_counters[0] == 99) // End loop next time pin0 counter is 99
canEnd = true;
LOOP_L_N(i, led_pin_count) {
if (led_pin_counters[i] > 0) {
if (++led_pin_counters[i] == 400) // turn off current pin counter in led_pin_counters
led_pin_counters[i] = 0;
else if (led_pin_counters[i] == 201) { // start next pin pwm
led_pin_counters[i + 1 == led_pin_count ? 0 : i + 1] = 1;
i++; // skip next pin in this loop so it doesn't increment twice
}
}
}
uint16_t r, g, b;
r = led_pin_counters[0]; curColor.r = r <= 100 ? r : r <= 300 ? 100 : 400 - r;
g = led_pin_counters[1]; curColor.g = g <= 100 ? g : g <= 300 ? 100 : 400 - g;
b = led_pin_counters[2]; curColor.b = b <= 100 ? b : b <= 300 ? 100 : 400 - b;
#if HAS_WHITE_LED
const uint16_t w = led_pin_counters[3]; curColor.w = w <= 100 ? w : w <= 300 ? 100 : 400 - w;
#endif
PCA9632_set_led_color(curColor);
delay(RGB_STARTUP_TEST_INNER_MS);
}

// Fade to white
LOOP_LE_N(led_pwm, 100) {
NOLESS(curColor.r, led_pwm);
NOLESS(curColor.g, led_pwm);
NOLESS(curColor.b, led_pwm);
TERN_(HAS_WHITE_LED, NOLESS(curColor.w, led_pwm));
PCA9632_set_led_color(curColor);
delay(RGB_STARTUP_TEST_INNER_MS);
}

#endif // PCA9632 && RGB_STARTUP_TEST

TERN_(NEOPIXEL_LED, neo.init());
TERN_(PCA9533, PCA9533_init());
TERN_(LED_USER_PRESET_STARTUP, set_default());
Expand Down
2 changes: 1 addition & 1 deletion Marlin/src/feature/leds/neopixel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ void Marlin_NeoPixel::init() {
set_color(adaneo1.Color
TERN(LED_USER_PRESET_STARTUP,
(LED_USER_PRESET_RED, LED_USER_PRESET_GREEN, LED_USER_PRESET_BLUE, LED_USER_PRESET_WHITE),
(255, 255, 255, 255))
(0, 0, 0, 0))
);
}

Expand Down
13 changes: 4 additions & 9 deletions Marlin/src/feature/pause.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ bool load_filament(const_float_t slow_load_length/*=0*/, const_float_t fast_load
while (wait_for_user) {
impatient_beep(max_beep_count);
#if BOTH(FILAMENT_CHANGE_RESUME_ON_INSERT, FILAMENT_RUNOUT_SENSOR)
#if ENABLED(MULTI_FILAMENT_SENSOR)
#if MULTI_FILAMENT_SENSOR
#define _CASE_INSERTED(N) case N-1: if (READ(FIL_RUNOUT##N##_PIN) != FIL_RUNOUT##N##_STATE) wait_for_user = false; break;
switch (active_extruder) {
REPEAT_1(NUM_RUNOUT_SENSORS, _CASE_INSERTED)
Expand Down Expand Up @@ -410,7 +410,6 @@ bool pause_print(const_float_t retract, const xyz_pos_t &park_point, const bool
#endif

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

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

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

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

TERN_(HAS_FILAMENT_SENSOR, runout.reset());

#if ENABLED(DWIN_LCD_PROUI)
DWIN_Print_Resume();
HMI_ReturnScreen();
#else
ui.reset_status();
ui.return_to_status();
#endif
ui.reset_status();
ui.return_to_status();
}

#endif // ADVANCED_PAUSE_FEATURE
2 changes: 1 addition & 1 deletion Marlin/src/gcode/config/M302.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
#include "../../module/temperature.h"

#if ENABLED(DWIN_LCD_PROUI)
#include "../../lcd/e3v2/proui/dwin_defines.h"
#include "../../lcd/e3v2/proui/dwin.h"
#endif

/**
Expand Down
2 changes: 1 addition & 1 deletion Marlin/src/gcode/control/M605.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@
if (parser.seen("EPS")) {
planner.synchronize();
if (parser.seenval('P')) duplication_e_mask = parser.value_int(); // Set the mask directly
else if (parser.seenval('E')) duplication_e_mask = pow(2, parser.value_int() + 1) - 1; // Set the mask by E index
else if (parser.seenval('E')) duplication_e_mask = _BV(parser.value_int() + 1) - 1; // Set the mask by E index
ena = (2 == parser.intval('S', extruder_duplication_enabled ? 2 : 0));
set_duplication_enabled(ena && (duplication_e_mask >= 3));
}
Expand Down
4 changes: 2 additions & 2 deletions Marlin/src/gcode/feature/input_shaping/M593.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@ void GcodeSuite::M593_report(const bool forReplay/*=true*/) {
* D<factor> Set the zeta/damping factor. If axes (X, Y, etc.) are not specified, set for all axes.
* F<frequency> Set the frequency. If axes (X, Y, etc.) are not specified, set for all axes.
* T[map] Input Shaping type, 0:ZV, 1:EI, 2:2H EI (not implemented yet)
* X<1> Set the given parameters only for the X axis.
* Y<1> Set the given parameters only for the Y axis.
* X Set the given parameters only for the X axis.
* Y Set the given parameters only for the Y axis.
*/
void GcodeSuite::M593() {
if (!parser.seen_any()) return M593_report();
Expand Down
2 changes: 1 addition & 1 deletion Marlin/src/gcode/gcode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1081,7 +1081,7 @@ void GcodeSuite::process_parsed_command(const bool no_ok/*=false*/) {
case 1001: M1001(); break; // M1001: [INTERNAL] Handle SD completion
#endif

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

Expand Down
2 changes: 1 addition & 1 deletion Marlin/src/gcode/gcode.h
Original file line number Diff line number Diff line change
Expand Up @@ -1226,7 +1226,7 @@ class GcodeSuite {
static void M1001();
#endif

#if ENABLED(DGUS_LCD_UI_MKS)
#if DGUS_LCD_UI_MKS
static void M1002();
#endif

Expand Down
2 changes: 1 addition & 1 deletion Marlin/src/gcode/lcd/M145.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ void GcodeSuite::M145() {
preheat_t &mat = ui.material_preset[material];
#if HAS_HOTEND
if (parser.seenval('H'))
mat.hotend_temp = constrain(parser.value_int(), EXTRUDE_MINTEMP, thermalManager.hotend_max_target(0));
mat.hotend_temp = constrain(parser.value_int(), thermalManager.extrude_min_temp, thermalManager.hotend_max_target(0));
#endif
#if HAS_HEATED_BED
if (parser.seenval('B'))
Expand Down
1 change: 0 additions & 1 deletion Marlin/src/gcode/sd/M1001.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,6 @@ void GcodeSuite::M1001() {
#endif

TERN_(EXTENSIBLE_UI, ExtUI::onPrintDone());
TERN_(DWIN_LCD_PROUI, DWIN_Print_Finished());

// Re-select the last printed file in the UI
TERN_(SD_REPRINT_LAST_SELECTED_FILE, ui.reselect_last_file());
Expand Down
4 changes: 2 additions & 2 deletions Marlin/src/gcode/sd/M24_M25.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
#include "../../feature/powerloss.h"
#endif

#if ENABLED(DGUS_LCD_UI_MKS)
#if DGUS_LCD_UI_MKS
#include "../../lcd/extui/dgus/DGUSDisplayDef.h"
#endif

Expand All @@ -52,7 +52,7 @@
*/
void GcodeSuite::M24() {

#if ENABLED(DGUS_LCD_UI_MKS)
#if DGUS_LCD_UI_MKS
if ((print_job_timer.isPaused() || print_job_timer.isRunning()) && !parser.seen("ST"))
MKS_resume_print_move();
#endif
Expand Down
4 changes: 2 additions & 2 deletions Marlin/src/gcode/sd/M524.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
#include "../../sd/cardreader.h"

#if ENABLED(DWIN_LCD_PROUI)
#include "../../lcd/e3v2/proui/dwin.h"
#include "../../lcd/marlinui.h"
#endif

/**
Expand All @@ -38,7 +38,7 @@ void GcodeSuite::M524() {

#if ENABLED(DWIN_LCD_PROUI)

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

#else

Expand Down
5 changes: 1 addition & 4 deletions Marlin/src/gcode/stats/M75-M78.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@
void GcodeSuite::M75() {
startOrResumeJob();
#if ENABLED(DWIN_LCD_PROUI)
DWIN_Print_Started(false);
if (!IS_SD_PRINTING()) DWIN_Print_Header(parser.string_arg && parser.string_arg[0] ? parser.string_arg : GET_TEXT(MSG_HOST_START_PRINT));
#endif
}
Expand All @@ -48,17 +47,15 @@ void GcodeSuite::M75() {
* M76: Pause print timer
*/
void GcodeSuite::M76() {
print_job_timer.pause();
TERN(DWIN_LCD_PROUI, ui.pause_print(), print_job_timer.pause());
TERN_(HOST_PAUSE_M76, hostui.pause());
TERN_(DWIN_LCD_PROUI, DWIN_Print_Pause());
}

/**
* M77: Stop print timer
*/
void GcodeSuite::M77() {
print_job_timer.stop();
TERN_(DWIN_LCD_PROUI, DWIN_Print_Finished());
}

#if ENABLED(PRINTCOUNTER)
Expand Down
22 changes: 11 additions & 11 deletions Marlin/src/gcode/temp/M303.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,15 +61,9 @@ void GcodeSuite::M303() {
const heater_id_t hid = (heater_id_t)parser.intval('E');
celsius_t default_temp;
switch (hid) {
#if ENABLED(PIDTEMP)
case 0 ... HOTENDS - 1: default_temp = PREHEAT_1_TEMP_HOTEND; break;
#endif
#if ENABLED(PIDTEMPBED)
case H_BED: default_temp = PREHEAT_1_TEMP_BED; break;
#endif
#if ENABLED(PIDTEMPCHAMBER)
case H_CHAMBER: default_temp = PREHEAT_1_TEMP_CHAMBER; break;
#endif
OPTCODE(PIDTEMP, case 0 ... HOTENDS - 1: default_temp = PREHEAT_1_TEMP_HOTEND; break)
OPTCODE(PIDTEMPBED, case H_BED: default_temp = PREHEAT_1_TEMP_BED; break)
OPTCODE(PIDTEMPCHAMBER, case H_CHAMBER: default_temp = PREHEAT_1_TEMP_CHAMBER; break)
default:
SERIAL_ECHOPGM(STR_PID_AUTOTUNE);
SERIAL_ECHOLNPGM(STR_PID_BAD_HEATER_ID);
Expand All @@ -84,9 +78,15 @@ void GcodeSuite::M303() {
const celsius_t temp = seenS ? parser.value_celsius() : default_temp;
const bool u = parser.boolval('U');

#if ENABLED(DWIN_LCD_PROUI)
#if ENABLED(DWIN_LCD_PROUI) && EITHER(PIDTEMP, PIDTEMPBED)
if (seenC) HMI_data.PidCycles = c;
if (seenS) { if (hid == H_BED) HMI_data.BedPidT = temp; else HMI_data.HotendPidT = temp; }
if (seenS) {
switch (hid) {
OPTCODE(PIDTEMP, case 0 ... HOTENDS - 1: HMI_data.HotendPidT = temp; break)
OPTCODE(PIDTEMPBED, case H_BED: HMI_data.BedPidT = temp; break)
default: break;
}
}
#endif

#if DISABLED(BUSY_WHILE_HEATING)
Expand Down
14 changes: 7 additions & 7 deletions Marlin/src/inc/Conditionals_LCD.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,19 +36,19 @@
#define FYSETC_MINI_12864_2_1
#endif

// Updated DGUS_UI shorthand single option can be used, or old settings, for now
// Old settings are now conditional on DGUS_LCD_UI
#if DGUS_UI_IS(ORIGIN)
#define DGUS_LCD_UI_ORIGIN
#define DGUS_LCD_UI_ORIGIN 1
#elif DGUS_UI_IS(FYSETC)
#define DGUS_LCD_UI_FYSETC
#define DGUS_LCD_UI_FYSETC 1
#elif DGUS_UI_IS(HIPRECY)
#define DGUS_LCD_UI_HIPRECY
#define DGUS_LCD_UI_HIPRECY 1
#elif DGUS_UI_IS(MKS)
#define DGUS_LCD_UI_MKS
#define DGUS_LCD_UI_MKS 1
#elif DGUS_UI_IS(RELOADED)
#define DGUS_LCD_UI_RELOADED
#define DGUS_LCD_UI_RELOADED 1
#elif DGUS_UI_IS(IA_CREALITY)
#define DGUS_LCD_UI_IA_CREALITY
#define DGUS_LCD_UI_IA_CREALITY 1
#endif

/**
Expand Down
1 change: 1 addition & 0 deletions Marlin/src/inc/Conditionals_post.h
Original file line number Diff line number Diff line change
Expand Up @@ -2472,6 +2472,7 @@
#define BED_MAX_TARGET (BED_MAXTEMP - (BED_OVERSHOOT))
#else
#undef PIDTEMPBED
#undef PREHEAT_BEFORE_LEVELING
#endif

#if HAS_TEMP_COOLER && PIN_EXISTS(COOLER)
Expand Down
Loading

0 comments on commit 6444761

Please sign in to comment.