Skip to content

Commit

Permalink
Merge branch 'bugfix-2.0.x' into FLSUN_QQS-PRO-MULTI
Browse files Browse the repository at this point in the history
  • Loading branch information
Foxies-CSTL committed Feb 27, 2021
2 parents 3386da8 + 53a7ef3 commit 31e1011
Show file tree
Hide file tree
Showing 8 changed files with 16 additions and 46 deletions.
4 changes: 4 additions & 0 deletions Marlin/src/HAL/SAMD51/inc/SanityCheck.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,3 +50,7 @@
#if ENABLED(FAST_PWM_FAN) || SPINDLE_LASER_FREQUENCY
#error "Features requiring Hardware PWM (FAST_PWM_FAN, SPINDLE_LASER_FREQUENCY) are not yet supported on SAMD51."
#endif

#if ENABLED(POSTMORTEM_DEBUGGING)
#error "POSTMORTEM_DEBUGGING is not yet supported on AGCM4."
#endif
14 changes: 0 additions & 14 deletions Marlin/src/feature/host_actions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -143,24 +143,16 @@ void host_action(PGM_P const pstr, const bool eol) {
// - Dismissal of info
//
void host_response_handler(const uint8_t response) {
#ifdef DEBUG_HOST_ACTIONS
static PGMSTR(m876_prefix, "M876 Handle Re");
serialprintPGM(m876_prefix); SERIAL_ECHOLNPAIR("ason: ", host_prompt_reason);
serialprintPGM(m876_prefix); SERIAL_ECHOLNPAIR("sponse: ", response);
#endif
PGM_P msg = PSTR("UNKNOWN STATE");
const PromptReason hpr = host_prompt_reason;
host_prompt_reason = PROMPT_NOT_DEFINED; // Reset now ahead of logic
switch (hpr) {
case PROMPT_FILAMENT_RUNOUT:
msg = PSTR("FILAMENT_RUNOUT");
switch (response) {

case 0: // "Purge More" button
#if BOTH(HAS_LCD_MENU, ADVANCED_PAUSE_FEATURE)
pause_menu_response = PAUSE_RESPONSE_EXTRUDE_MORE; // Simulate menu selection (menu exits, doesn't extrude more)
#endif
filament_load_host_prompt(); // Initiate another host prompt. (NOTE: The loop in load_filament may also do this!)
break;

case 1: // "Continue" / "Disable Runout" button
Expand All @@ -178,23 +170,17 @@ void host_action(PGM_P const pstr, const bool eol) {
break;
case PROMPT_USER_CONTINUE:
TERN_(HAS_RESUME_CONTINUE, wait_for_user = false);
msg = PSTR("FILAMENT_RUNOUT_CONTINUE");
break;
case PROMPT_PAUSE_RESUME:
msg = PSTR("LCD_PAUSE_RESUME");
#if BOTH(ADVANCED_PAUSE_FEATURE, SDSUPPORT)
extern const char M24_STR[];
queue.inject_P(M24_STR);
#endif
break;
case PROMPT_INFO:
msg = PSTR("GCODE_INFO");
break;
default: break;
}
SERIAL_ECHOPGM("M876 Responding PROMPT_");
serialprintPGM(msg);
SERIAL_EOL();
}

#endif // HOST_PROMPT_SUPPORT
Expand Down
32 changes: 8 additions & 24 deletions Marlin/src/feature/mmu/mmu2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,29 +62,13 @@ MMU2 mmu2;
#endif

#define MMU_CMD_NONE 0
#define MMU_CMD_T0 0x10
#define MMU_CMD_T1 0x11
#define MMU_CMD_T2 0x12
#define MMU_CMD_T3 0x13
#define MMU_CMD_T4 0x14
#define MMU_CMD_L0 0x20
#define MMU_CMD_L1 0x21
#define MMU_CMD_L2 0x22
#define MMU_CMD_L3 0x23
#define MMU_CMD_L4 0x24
#define MMU_CMD_T0 0x10 // up to supported filaments
#define MMU_CMD_L0 0x20 // up to supported filaments
#define MMU_CMD_C0 0x30
#define MMU_CMD_U0 0x40
#define MMU_CMD_E0 0x50
#define MMU_CMD_E1 0x51
#define MMU_CMD_E2 0x52
#define MMU_CMD_E3 0x53
#define MMU_CMD_E4 0x54
#define MMU_CMD_E0 0x50 // up to supported filaments
#define MMU_CMD_R0 0x60
#define MMU_CMD_F0 0x70
#define MMU_CMD_F1 0x71
#define MMU_CMD_F2 0x72
#define MMU_CMD_F3 0x73
#define MMU_CMD_F4 0x74
#define MMU_CMD_F0 0x70 // up to supported filaments

#define MMU_REQUIRED_FW_BUILDNR TERN(MMU2_MODE_12V, 132, 126)

Expand Down Expand Up @@ -243,15 +227,15 @@ void MMU2::mmu_loop() {

case 1:
if (cmd) {
if (WITHIN(cmd, MMU_CMD_T0, MMU_CMD_T4)) {
if (WITHIN(cmd, MMU_CMD_T0, MMU_CMD_T0 + EXTRUDERS - 1)) {
// tool change
int filament = cmd - MMU_CMD_T0;
DEBUG_ECHOLNPAIR("MMU <= T", filament);
tx_printf_P(PSTR("T%d\n"), filament);
TERN_(MMU_EXTRUDER_SENSOR, mmu_idl_sens = 1); // enable idler sensor, if any
state = 3; // wait for response
}
else if (WITHIN(cmd, MMU_CMD_L0, MMU_CMD_L4)) {
else if (WITHIN(cmd, MMU_CMD_L0, MMU_CMD_L0 + EXTRUDERS - 1)) {
// load
int filament = cmd - MMU_CMD_L0;
DEBUG_ECHOLNPAIR("MMU <= L", filament);
Expand All @@ -271,7 +255,7 @@ void MMU2::mmu_loop() {
MMU2_COMMAND("U0");
state = 3; // wait for response
}
else if (WITHIN(cmd, MMU_CMD_E0, MMU_CMD_E4)) {
else if (WITHIN(cmd, MMU_CMD_E0, MMU_CMD_E0 + EXTRUDERS - 1)) {
// eject filament
int filament = cmd - MMU_CMD_E0;
DEBUG_ECHOLNPAIR("MMU <= E", filament);
Expand All @@ -284,7 +268,7 @@ void MMU2::mmu_loop() {
MMU2_COMMAND("R0");
state = 3; // wait for response
}
else if (WITHIN(cmd, MMU_CMD_F0, MMU_CMD_F4)) {
else if (WITHIN(cmd, MMU_CMD_F0, MMU_CMD_F0 + EXTRUDERS - 1)) {
// filament type
int filament = cmd - MMU_CMD_F0;
DEBUG_ECHOLNPAIR("MMU <= F", filament, " ", cmd_arg);
Expand Down
2 changes: 1 addition & 1 deletion Marlin/src/feature/pause.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ bool load_filament(const float &slow_load_length/*=0*/, const float &fast_load_l
unscaled_e_move(purge_length, ADVANCED_PAUSE_PURGE_FEEDRATE);
}

TERN_(HOST_PROMPT_SUPPORT, filament_load_host_prompt()); // Initiate another host prompt. (NOTE: host_response_handler may also do this!)
TERN_(HOST_PROMPT_SUPPORT, filament_load_host_prompt()); // Initiate another host prompt.

#if HAS_LCD_MENU
if (show_lcd) {
Expand Down
2 changes: 1 addition & 1 deletion Marlin/src/gcode/feature/prusa_MMU2/M403.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ void GcodeSuite::M403() {
int8_t index = parser.intval('E', -1),
type = parser.intval('F', -1);

if (WITHIN(index, 0, 4) && WITHIN(type, 0, 2))
if (WITHIN(index, 0, EXTRUDERS - 1) && WITHIN(type, 0, 2))
mmu2.set_filament_type(index, type);
else
SERIAL_ECHO_MSG("M403 - bad arguments.");
Expand Down
4 changes: 0 additions & 4 deletions Marlin/src/gcode/queue.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,6 @@ GCodeQueue queue;
// Frequently used G-code strings
PGMSTR(G28_STR, "G28");

#if NO_TIMEOUTS > 0
static millis_t last_command_time = 0;
#endif

GCodeQueue::SerialState GCodeQueue::serial_state[NUM_SERIAL] = { 0 };
GCodeQueue::RingBuffer GCodeQueue::ring_buffer = { 0 };

Expand Down
2 changes: 1 addition & 1 deletion Marlin/src/gcode/sd/M28_M29.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ void GcodeSuite::M28() {
// Binary transfer mode
if ((card.flag.binary_mode = binary_mode)) {
SERIAL_ECHO_MSG("Switching to Binary Protocol");
TERN_(HAS_MULTI_SERIAL, card.transfer_port_index = queue.port[queue.index_r]);
TERN_(HAS_MULTI_SERIAL, card.transfer_port_index = queue.ring_buffer.command_port());
}
else
card.openFileWrite(p);
Expand Down
2 changes: 1 addition & 1 deletion Marlin/src/inc/Conditionals_LCD.h
Original file line number Diff line number Diff line change
Expand Up @@ -513,7 +513,7 @@
#define HAS_PRUSA_MMU2 1
#define HAS_PRUSA_MMU2S 1
#endif
#if MMU_MODEL >= SMUFF_EMU_MMU2
#if MMU_MODEL == SMUFF_EMU_MMU2 || MMU_MODEL == SMUFF_EMU_MMU2S
#define HAS_SMUFF 1
#endif
#endif
Expand Down

0 comments on commit 31e1011

Please sign in to comment.