Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix manual move with MKS H43 #21511

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
aa595f5
Merge pull request #1 from MarlinFirmware/bugfix-2.0.x
makerbase-mks May 11, 2020
d5d325c
Merge pull request #2 from MarlinFirmware/bugfix-2.0.x
makerbase-mks May 13, 2020
d8d5c0f
Merge pull request #4 from MarlinFirmware/bugfix-2.0.x
makerbase-mks May 14, 2020
a1055dd
Merge pull request #6 from MarlinFirmware/bugfix-2.0.x
makerbase-mks May 18, 2020
8b349b1
Merge pull request #7 from MarlinFirmware/bugfix-2.0.x
makerbase-mks May 22, 2020
8c42e50
Merge pull request #14 from MarlinFirmware/bugfix-2.0.x
makerbase-mks Jun 27, 2020
626ed70
Merge pull request #15 from MarlinFirmware/bugfix-2.0.x
makerbase-mks Jul 1, 2020
80a2552
Merge pull request #16 from MarlinFirmware/bugfix-2.0.x
MKS-Sean Jul 2, 2020
1f7bbbd
Merge pull request #36 from MarlinFirmware/bugfix-2.0.x
MKS-Sean Dec 31, 2020
b499a24
Merge pull request #44 from MarlinFirmware/bugfix-2.0.x
solawc Mar 6, 2021
c18642a
Merge pull request #45 from MarlinFirmware/bugfix-2.0.x
solawc Mar 8, 2021
953ea35
Merge pull request #46 from MarlinFirmware/bugfix-2.0.x
solawc Mar 11, 2021
eb4d1de
Merge pull request #47 from MarlinFirmware/bugfix-2.0.x
solawc Mar 17, 2021
1b5dc86
Merge pull request #48 from MarlinFirmware/bugfix-2.0.x
solawc Mar 26, 2021
77d0c9d
Merge pull request #50 from MarlinFirmware/bugfix-2.0.x
solawc Apr 2, 2021
fa67764
fix ex bug
solawc Apr 2, 2021
54ab8f4
Merge remote-tracking branch 'upstream/bugfix-2.0.x' into pr/21511
thinkyhead Apr 6, 2021
a645c08
Try queue.inject with custom G-code
thinkyhead Apr 6, 2021
383a903
FilamentSpeed => FilamentSpeed_mm_s
thinkyhead Apr 6, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions Marlin/src/gcode/gcode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -977,6 +977,10 @@ 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)
case 1002: M1002(); break; // M1002: [INTERNAL] Tool-change and Relative E Move
#endif

#if ENABLED(MAX7219_GCODE)
case 7219: M7219(); break; // M7219: Set LEDs, columns, and rows
#endif
Expand Down
4 changes: 4 additions & 0 deletions Marlin/src/gcode/gcode.h
Original file line number Diff line number Diff line change
Expand Up @@ -1069,6 +1069,10 @@ class GcodeSuite {
static void M1001();
#endif

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

#if ENABLED(MAX7219_GCODE)
static void M7219();
#endif
Expand Down
6 changes: 3 additions & 3 deletions Marlin/src/lcd/extui/lib/dgus/mks/DGUSDisplayDef.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@

uint16_t manualMoveStep = 1;
uint16_t distanceFilament = 10;
uint16_t FilamentSpeed = 25;
uint16_t filamentSpeed_mm_s = 25;
float ZOffset_distance = 0.1;
float mesh_adj_distance = 0.01;
float Z_distance = 0.1;
Expand Down Expand Up @@ -555,7 +555,7 @@ const struct DGUS_VP_Variable ListOfVP[] PROGMEM = {
VPHELPER(VP_LOAD_Filament, nullptr, &ScreenHandler.MKS_FilamentLoad, nullptr),
VPHELPER(VP_UNLOAD_Filament, nullptr, &ScreenHandler.MKS_FilamentUnLoad, nullptr),
VPHELPER(VP_Filament_distance, &distanceFilament, &ScreenHandler.GetManualFilament, ScreenHandler.DGUSLCD_SendWordValueToDisplay),
VPHELPER(VP_Filament_speed, &FilamentSpeed, &ScreenHandler.GetManualFilamentSpeed, ScreenHandler.DGUSLCD_SendWordValueToDisplay),
VPHELPER(VP_Filament_speed, &filamentSpeed_mm_s, &ScreenHandler.GetManualFilamentSpeed, ScreenHandler.DGUSLCD_SendWordValueToDisplay),
#endif
#endif

Expand All @@ -569,7 +569,7 @@ const struct DGUS_VP_Variable ListOfVP[] PROGMEM = {

#if ENABLED(DGUS_FILAMENT_LOADUNLOAD)
VPHELPER(VP_Filament_distance, &distanceFilament, &ScreenHandler.GetManualFilament, ScreenHandler.DGUSLCD_SendFloatAsIntValueToDisplay<0>),
VPHELPER(VP_Filament_speed, &FilamentSpeed, &ScreenHandler.GetManualFilamentSpeed, ScreenHandler.DGUSLCD_SendWordValueToDisplay),
VPHELPER(VP_Filament_speed, &filamentSpeed_mm_s, &ScreenHandler.GetManualFilamentSpeed, ScreenHandler.DGUSLCD_SendWordValueToDisplay),
#endif

#if ENABLED(PIDTEMP)
Expand Down
2 changes: 1 addition & 1 deletion Marlin/src/lcd/extui/lib/dgus/mks/DGUSDisplayDef.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@

extern uint16_t manualMoveStep;
extern uint16_t distanceFilament;
extern uint16_t FilamentSpeed;
extern uint16_t filamentSpeed_mm_s;
extern float ZOffset_distance;
extern float mesh_adj_distance;
extern float Z_distance;
Expand Down
54 changes: 40 additions & 14 deletions Marlin/src/lcd/extui/lib/dgus/mks/DGUSScreenHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -840,7 +840,7 @@ void DGUSScreenHandler::HandleManualMove(DGUS_VP_Variable &var, void *val_ptr) {
// buf[4] = axiscode;

char buf[6];
sprintf(buf,"G28 %c",axiscode);
sprintf(buf, "G28 %c", axiscode);
//DEBUG_ECHOPAIR(" ", buf);
queue.enqueue_one_now(buf);
//DEBUG_ECHOLNPGM(" ✓");
Expand Down Expand Up @@ -1190,17 +1190,18 @@ void DGUSScreenHandler::GetManualFilamentSpeed(DGUS_VP_Variable &var, void *val_

uint16_t value_len = swap16(*(uint16_t*)val_ptr);

DEBUG_ECHOLNPAIR_F("FilamentSpeed value:", value_len);
DEBUG_ECHOLNPAIR_F("filamentSpeed_mm_s value:", value_len);

FilamentSpeed = value_len;
filamentSpeed_mm_s = value_len;

skipVP = var.VP; // don't overwrite value the next update time as the display might autoincrement in parallel
}

void DGUSScreenHandler::MKS_FilamentLoadUnload(DGUS_VP_Variable &var, void *val_ptr, const int filamentDir) {
#if EITHER(HAS_MULTI_HOTEND, SINGLENOZZLE)
char buf[40];
uint8_t swap_tool = 0;
#else
constexpr uint8_t swap_tool = 1; // T0 (or none at all)
#endif

#if HAS_HOTEND
Expand All @@ -1215,9 +1216,8 @@ void DGUSScreenHandler::MKS_FilamentLoadUnload(DGUS_VP_Variable &var, void *val_
default: break;
case 0:
#if HAS_HOTEND
if (thermalManager.tooColdToExtrude(0)) {
if (thermalManager.tooColdToExtrude(0))
hotend_too_cold = 1;
}
else {
#if EITHER(HAS_MULTI_HOTEND, SINGLENOZZLE)
swap_tool = 1;
Expand All @@ -1243,15 +1243,41 @@ void DGUSScreenHandler::MKS_FilamentLoadUnload(DGUS_VP_Variable &var, void *val_
}
#endif

if (swap_tool) {
char buf[30];
snprintf_P(buf, 30
#if EITHER(HAS_MULTI_HOTEND, SINGLENOZZLE)
, PSTR("M1002T%cE%dF%d"), char('0' + swap_tool - 1)
#else
, PSTR("M1002E%dF%d")
#endif
, (int)distanceFilament * filamentDir, filamentSpeed_mm_s * 60
);
queue.inject(buf);
}
}

/**
* M1002: Do a tool-change and relative move for MKS_FilamentLoadUnload
* within the G-code execution window for best concurrency.
*/
void GcodeSuite::M1002() {
#if EITHER(HAS_MULTI_HOTEND, SINGLENOZZLE)
if (swap_tool) {
queue.enqueue_now_P(swap_tool == 2 ? PSTR("T1") : PSTR("T0"));
queue.enqueue_now_P(PSTR("G91"));
snprintf_P(buf, 40, PSTR("G1 E%d F%d"), (int)distanceFilament * filamentDir, FilamentSpeed * 60);
queue.enqueue_one_now(buf);
queue.enqueue_now_P(PSTR("G90"));
}
{
char buf[3];
sprintf_P(buf, PSTR("T%c"), char('0' + parser.intval('T')));
process_subcommands_now(buf);
}
#endif

const uint8_t old_axis_relative = axis_relative;
set_e_relative(true); // M83
{
char buf[20];
snprintf_P(buf, 20, PSTR("G1E%dF%d"), parser.intval('E'), parser.intval('F'));
process_subcommands_now(buf);
}
axis_relative = old_axis_relative;
}

void DGUSScreenHandler::MKS_FilamentLoad(DGUS_VP_Variable &var, void *val_ptr) {
Expand Down Expand Up @@ -1445,7 +1471,7 @@ void DGUSScreenHandler::LanguagePInit() {
void DGUSScreenHandler::DGUS_ExtrudeLoadInit(void) {
ex_filament.ex_length = distanceFilament;
ex_filament.ex_load_unload_flag = 0;
ex_filament.ex_need_time = FilamentSpeed;
ex_filament.ex_need_time = filamentSpeed_mm_s;
ex_filament.ex_speed = 0;
ex_filament.ex_status = EX_NONE;
ex_filament.ex_tick_end = 0;
Expand Down