Skip to content

Commit d5f4f6c

Browse files
committed
Merge branch 'bugfix-2.0.x' into 2.0.x-Sapphire-Pro
2 parents b226623 + 63dd0f2 commit d5f4f6c

36 files changed

+1018
-361
lines changed

.github/workflows/test-builds.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ jobs:
3232
- megaatmega2560
3333
- teensy31
3434
- teensy35
35+
- SAMD51_grandcentral_m4
3536

3637
# Extended AVR Environments
3738

@@ -75,7 +76,6 @@ jobs:
7576
#- mks_robin_lite
7677
#- mks_robin_mini
7778
#- mks_robin_nano
78-
#- SAMD51_grandcentral_m4
7979

8080
steps:
8181

Marlin/Configuration_adv.h

+3-1
Original file line numberDiff line numberDiff line change
@@ -1333,9 +1333,11 @@
13331333
//#define AO_EXP1_PINMAP // AlephObjects CLCD UI EXP1 mapping
13341334
//#define AO_EXP2_PINMAP // AlephObjects CLCD UI EXP2 mapping
13351335
//#define CR10_TFT_PINMAP // Rudolph Riedel's CR10 pin mapping
1336+
//#define S6_TFT_PINMAP // FYSETC S6 pin mapping
1337+
13361338
//#define OTHER_PIN_LAYOUT // Define pins manually below
13371339
#if ENABLED(OTHER_PIN_LAYOUT)
1338-
// The pins for CS and MOD_RESET (PD) must be chosen.
1340+
// Pins for CS and MOD_RESET (PD) must be chosen
13391341
#define CLCD_MOD_RESET 9
13401342
#define CLCD_SPI_CS 10
13411343

Marlin/src/HAL/HAL_ESP32/i2s.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -153,8 +153,8 @@ void stepperTask(void* parameter) {
153153
remaining--;
154154
}
155155
else {
156-
Stepper::stepper_pulse_phase_isr();
157-
remaining = Stepper::stepper_block_phase_isr();
156+
Stepper::pulse_phase_isr();
157+
remaining = Stepper::block_phase_isr();
158158
}
159159
}
160160
}

Marlin/src/HAL/HAL_ESP32/web.cpp

+2
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@
2626

2727
#if BOTH(WIFISUPPORT, WEBSUPPORT)
2828

29+
#include "../../inc/MarlinConfig.h"
30+
2931
#undef DISABLED // esp32-hal-gpio.h
3032
#include <SPIFFS.h>
3133
#include "wifi.h"

Marlin/src/HAL/HAL_LPC1768/MarlinSerial.cpp

+4-4
Original file line numberDiff line numberDiff line change
@@ -25,28 +25,28 @@
2525
#include "../../inc/MarlinConfigPre.h"
2626
#include "MarlinSerial.h"
2727

28-
#if (defined(SERIAL_PORT) && SERIAL_PORT == 0) || (defined(SERIAL_PORT_2) && SERIAL_PORT_2 == 0)
28+
#if (defined(SERIAL_PORT) && SERIAL_PORT == 0) || (defined(SERIAL_PORT_2) && SERIAL_PORT_2 == 0) || (defined(DGUS_SERIAL_PORT) && DGUS_SERIAL_PORT == 0)
2929
MarlinSerial MSerial(LPC_UART0);
3030
extern "C" void UART0_IRQHandler() {
3131
MSerial.IRQHandler();
3232
}
3333
#endif
3434

35-
#if (defined(SERIAL_PORT) && SERIAL_PORT == 1) || (defined(SERIAL_PORT_2) && SERIAL_PORT_2 == 1)
35+
#if (defined(SERIAL_PORT) && SERIAL_PORT == 1) || (defined(SERIAL_PORT_2) && SERIAL_PORT_2 == 1) || (defined(DGUS_SERIAL_PORT) && DGUS_SERIAL_PORT == 1)
3636
MarlinSerial MSerial1((LPC_UART_TypeDef *) LPC_UART1);
3737
extern "C" void UART1_IRQHandler() {
3838
MSerial1.IRQHandler();
3939
}
4040
#endif
4141

42-
#if (defined(SERIAL_PORT) && SERIAL_PORT == 2) || (defined(SERIAL_PORT_2) && SERIAL_PORT_2 == 2)
42+
#if (defined(SERIAL_PORT) && SERIAL_PORT == 2) || (defined(SERIAL_PORT_2) && SERIAL_PORT_2 == 2) || (defined(DGUS_SERIAL_PORT) && DGUS_SERIAL_PORT == 2)
4343
MarlinSerial MSerial2(LPC_UART2);
4444
extern "C" void UART2_IRQHandler() {
4545
MSerial2.IRQHandler();
4646
}
4747
#endif
4848

49-
#if (defined(SERIAL_PORT) && SERIAL_PORT == 3) || (defined(SERIAL_PORT_2) && SERIAL_PORT_2 == 3)
49+
#if (defined(SERIAL_PORT) && SERIAL_PORT == 3) || (defined(SERIAL_PORT_2) && SERIAL_PORT_2 == 3) || (defined(DGUS_SERIAL_PORT) && DGUS_SERIAL_PORT == 3)
5050
MarlinSerial MSerial3(LPC_UART3);
5151
extern "C" void UART3_IRQHandler() {
5252
MSerial3.IRQHandler();

Marlin/src/HAL/HAL_SAMD51/timers.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
typedef uint32_t hal_timer_t;
3030
#define HAL_TIMER_TYPE_MAX 0xFFFFFFFF
3131

32-
#define HAL_TIMER_RATE SystemCoreClock // frequency of timers peripherals
32+
#define HAL_TIMER_RATE F_CPU // frequency of timers peripherals
3333

3434
#define STEP_TIMER_NUM 0 // index of timer to use for stepper (also +1 for 32bits counter)
3535
#define PULSE_TIMER_NUM STEP_TIMER_NUM

Marlin/src/MarlinCore.cpp

+1-2
Original file line numberDiff line numberDiff line change
@@ -345,7 +345,7 @@ void disable_all_steppers() {
345345

346346
void event_probe_recover() {
347347
#if ENABLED(HOST_PROMPT_SUPPORT)
348-
host_prompt_do(PROMPT_INFO, PSTR("G29 Retrying"), PSTR("Dismiss"));
348+
host_prompt_do(PROMPT_INFO, PSTR("G29 Retrying"), DISMISS_STR);
349349
#endif
350350
#ifdef ACTION_ON_G29_RECOVER
351351
host_action(PSTR(ACTION_ON_G29_RECOVER));
@@ -798,7 +798,6 @@ void stop() {
798798
#endif
799799

800800
if (IsRunning()) {
801-
queue.stop();
802801
SERIAL_ERROR_MSG(MSG_ERR_STOPPED);
803802
LCD_MESSAGEPGM(MSG_STOPPED);
804803
safe_delay(350); // allow enough time for messages to get out before stopping

Marlin/src/core/boards.h

+5-1
Original file line numberDiff line numberDiff line change
@@ -295,7 +295,6 @@
295295
#define BOARD_GTM32_MINI_A30 4022 // STM32F103VET6 controller
296296
#define BOARD_GTM32_REV_B 4023 // STM32F103VET6 controller
297297

298-
299298
//
300299
// ARM Cortex-M4F
301300
//
@@ -340,6 +339,11 @@
340339
#define BOARD_MRR_ESPE 6002
341340
#define BOARD_E4D_BOX 6003 // E4d@BOX
342341

342+
//
343+
// SAMD51 ARM Cortex M4
344+
//
345+
#define BOARD_AGCM4_RAMPS_144 6100 // RAMPS 1.4.4
346+
343347
//
344348
// Simulations
345349
//

Marlin/src/feature/babystep.cpp

-8
Original file line numberDiff line numberDiff line change
@@ -49,14 +49,6 @@ void Babystep::step_axis(const AxisEnum axis) {
4949
}
5050
}
5151

52-
void Babystep::task() {
53-
#if EITHER(BABYSTEP_XY, I2C_POSITION_ENCODERS)
54-
LOOP_XYZ(axis) step_axis((AxisEnum)axis);
55-
#else
56-
step_axis(Z_AXIS);
57-
#endif
58-
}
59-
6052
void Babystep::add_mm(const AxisEnum axis, const float &mm) {
6153
add_steps(axis, mm * planner.settings.axis_steps_per_mm[axis]);
6254
}

Marlin/src/feature/babystep.h

+9-1
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,15 @@ class Babystep {
5555

5656
static void add_steps(const AxisEnum axis, const int16_t distance);
5757
static void add_mm(const AxisEnum axis, const float &mm);
58-
static void task();
58+
59+
//
60+
// Called by the Temperature ISR to
61+
// apply accumulated babysteps to the axes.
62+
//
63+
static inline void task() {
64+
LOOP_L_N(axis, BS_TODO_AXIS(Z_AXIS)) step_axis((AxisEnum)axis);
65+
}
66+
5967
private:
6068
static void step_axis(const AxisEnum axis);
6169
};

Marlin/src/feature/host_actions.cpp

+55-44
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,8 @@ void host_action(const char * const pstr, const bool eol) {
6464

6565
#if ENABLED(HOST_PROMPT_SUPPORT)
6666

67-
const char CONTINUE_STR[] PROGMEM = "Continue";
67+
const char CONTINUE_STR[] PROGMEM = "Continue",
68+
DISMISS_STR[] PROGMEM = "Dismiss";
6869

6970
#if HAS_RESUME_CONTINUE
7071
extern bool wait_for_user;
@@ -84,70 +85,78 @@ void host_action(const char * const pstr, const bool eol) {
8485
if (eol) SERIAL_EOL();
8586
}
8687

87-
void host_action_prompt_plus(const char * const ptype, const char * const pstr, const bool eol=true) {
88+
void host_action_prompt_plus(const char * const ptype, const char * const pstr, const char extra_char='\0') {
8889
host_action_prompt(ptype, false);
8990
SERIAL_CHAR(' ');
9091
serialprintPGM(pstr);
91-
if (eol) SERIAL_EOL();
92+
if (extra_char != '\0') SERIAL_CHAR(extra_char);
93+
SERIAL_EOL();
94+
}
95+
void host_action_prompt_begin(const PromptReason reason, const char * const pstr, const char extra_char/*='\0'*/) {
96+
host_action_prompt_end();
97+
host_prompt_reason = reason;
98+
host_action_prompt_plus(PSTR("begin"), pstr, extra_char);
9299
}
93-
void host_action_prompt_begin(const char * const pstr, const bool eol/*=true*/) { host_action_prompt_plus(PSTR("begin"), pstr, eol); }
94100
void host_action_prompt_button(const char * const pstr) { host_action_prompt_plus(PSTR("button"), pstr); }
95101
void host_action_prompt_end() { host_action_prompt(PSTR("end")); }
96102
void host_action_prompt_show() { host_action_prompt(PSTR("show")); }
97-
void host_prompt_do(const PromptReason reason, const char * const pstr, const char * const pbtn/*=nullptr*/) {
98-
host_prompt_reason = reason;
99-
host_action_prompt_end();
100-
host_action_prompt_begin(pstr);
101-
if (pbtn) host_action_prompt_button(pbtn);
103+
void host_prompt_do(const PromptReason reason, const char * const pstr, const char * const btn1/*=nullptr*/, const char * const btn2/*=nullptr*/) {
104+
host_action_prompt_begin(reason, pstr);
105+
if (btn1) host_action_prompt_button(btn1);
106+
if (btn2) host_action_prompt_button(btn2);
102107
host_action_prompt_show();
103108
}
104109

105-
inline void say_m876_response(const char * const pstr) {
106-
SERIAL_ECHOPGM("M876 Responding PROMPT_");
107-
serialprintPGM(pstr);
108-
SERIAL_EOL();
110+
void filament_load_host_prompt() {
111+
const bool disable_to_continue = (false
112+
#if HAS_FILAMENT_SENSOR
113+
|| runout.filament_ran_out
114+
#endif
115+
);
116+
host_prompt_do(PROMPT_FILAMENT_RUNOUT, PSTR("Paused"), PSTR("PurgeMore"),
117+
disable_to_continue ? PSTR("DisableRunout") : CONTINUE_STR
118+
);
109119
}
110120

121+
//
122+
// Handle responses from the host, such as:
123+
// - Filament runout responses: Purge More, Continue
124+
// - General "Continue" response
125+
// - Resume Print response
126+
// - Dismissal of info
127+
//
111128
void host_response_handler(const uint8_t response) {
112129
#ifdef DEBUG_HOST_ACTIONS
113-
SERIAL_ECHOLNPAIR("M876 Handle Reason: ", host_prompt_reason);
114-
SERIAL_ECHOLNPAIR("M876 Handle Response: ", response);
130+
static const char m876_prefix[] PROGMEM = "M876 Handle Re";
131+
serialprintPGM(m876_prefix); SERIAL_ECHOLNPAIR("ason: ", host_prompt_reason);
132+
serialprintPGM(m876_prefix); SERIAL_ECHOLNPAIR("sponse: ", response);
115133
#endif
116134
const char *msg = PSTR("UNKNOWN STATE");
117135
const PromptReason hpr = host_prompt_reason;
118-
host_prompt_reason = PROMPT_NOT_DEFINED;
136+
host_prompt_reason = PROMPT_NOT_DEFINED; // Reset now ahead of logic
119137
switch (hpr) {
120138
case PROMPT_FILAMENT_RUNOUT:
121139
msg = PSTR("FILAMENT_RUNOUT");
122-
if (response == 0) {
123-
#if ENABLED(ADVANCED_PAUSE_FEATURE)
124-
pause_menu_response = PAUSE_RESPONSE_EXTRUDE_MORE;
125-
#endif
126-
host_action_prompt_end(); // Close current prompt
127-
host_action_prompt_begin(PSTR("Paused"));
128-
host_action_prompt_button(PSTR("Purge More"));
129-
if (false
140+
switch (response) {
141+
142+
case 0: // "Purge More" button
143+
#if HAS_LCD_MENU && ENABLED(ADVANCED_PAUSE_FEATURE)
144+
pause_menu_response = PAUSE_RESPONSE_EXTRUDE_MORE; // Simulate menu selection (menu exits, doesn't extrude more)
145+
#endif
146+
filament_load_host_prompt(); // Initiate another host prompt. (NOTE: The loop in load_filament may also do this!)
147+
break;
148+
149+
case 1: // "Continue" / "Disable Runout" button
150+
#if HAS_LCD_MENU && ENABLED(ADVANCED_PAUSE_FEATURE)
151+
pause_menu_response = PAUSE_RESPONSE_RESUME_PRINT; // Simulate menu selection
152+
#endif
130153
#if HAS_FILAMENT_SENSOR
131-
|| runout.filament_ran_out
154+
if (runout.filament_ran_out) { // Disable a triggered sensor
155+
runout.enabled = false;
156+
runout.reset();
157+
}
132158
#endif
133-
)
134-
host_action_prompt_button(PSTR("DisableRunout"));
135-
else {
136-
host_prompt_reason = PROMPT_FILAMENT_RUNOUT;
137-
host_action_prompt_button(CONTINUE_STR);
138-
}
139-
host_action_prompt_show();
140-
}
141-
else if (response == 1) {
142-
#if HAS_FILAMENT_SENSOR
143-
if (runout.filament_ran_out) {
144-
runout.enabled = false;
145-
runout.reset();
146-
}
147-
#endif
148-
#if ENABLED(ADVANCED_PAUSE_FEATURE)
149-
pause_menu_response = PAUSE_RESPONSE_RESUME_PRINT;
150-
#endif
159+
break;
151160
}
152161
break;
153162
case PROMPT_USER_CONTINUE:
@@ -168,7 +177,9 @@ void host_action(const char * const pstr, const bool eol) {
168177
break;
169178
default: break;
170179
}
171-
say_m876_response(msg);
180+
SERIAL_ECHOPGM("M876 Responding PROMPT_");
181+
serialprintPGM(msg);
182+
SERIAL_EOL();
172183
}
173184

174185
#endif // HOST_PROMPT_SUPPORT

Marlin/src/feature/host_actions.h

+7-5
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ void host_action(const char * const pstr, const bool eol=true);
4646

4747
#if ENABLED(HOST_PROMPT_SUPPORT)
4848

49-
extern const char CONTINUE_STR[];
49+
extern const char CONTINUE_STR[], DISMISS_STR[];
5050

5151
enum PromptReason : uint8_t {
5252
PROMPT_NOT_DEFINED,
@@ -61,13 +61,15 @@ void host_action(const char * const pstr, const bool eol=true);
6161

6262
void host_response_handler(const uint8_t response);
6363
void host_action_notify(const char * const message);
64-
void host_action_prompt_begin(const char * const pstr, const bool eol=true);
64+
void host_action_prompt_begin(const PromptReason reason, const char * const pstr, const char extra_char='\0');
6565
void host_action_prompt_button(const char * const pstr);
6666
void host_action_prompt_end();
6767
void host_action_prompt_show();
68-
void host_prompt_do(const PromptReason type, const char * const pstr, const char * const pbtn=nullptr);
69-
inline void host_prompt_open(const PromptReason reason, const char * const pstr, const char * const pbtn=nullptr) {
70-
if (host_prompt_reason == PROMPT_NOT_DEFINED) host_prompt_do(reason, pstr, pbtn);
68+
void host_prompt_do(const PromptReason reason, const char * const pstr, const char * const btn1=nullptr, const char * const btn2=nullptr);
69+
inline void host_prompt_open(const PromptReason reason, const char * const pstr, const char * const btn1=nullptr, const char * const btn2=nullptr) {
70+
if (host_prompt_reason == PROMPT_NOT_DEFINED) host_prompt_do(reason, pstr, btn1, btn2);
7171
}
7272

73+
void filament_load_host_prompt();
74+
7375
#endif

0 commit comments

Comments
 (0)