|
@ -45,8 +45,6 @@ |
|
|
|
|
|
|
|
|
#if ENABLED(MALYAN_LCD) |
|
|
#if ENABLED(MALYAN_LCD) |
|
|
|
|
|
|
|
|
#include "../sd/cardreader.h" |
|
|
|
|
|
#include "../sd/SdFatConfig.h" |
|
|
|
|
|
#include "../module/temperature.h" |
|
|
#include "../module/temperature.h" |
|
|
#include "../module/planner.h" |
|
|
#include "../module/planner.h" |
|
|
#include "../module/stepper.h" |
|
|
#include "../module/stepper.h" |
|
@ -60,6 +58,13 @@ |
|
|
|
|
|
|
|
|
#include "../Marlin.h" |
|
|
#include "../Marlin.h" |
|
|
|
|
|
|
|
|
|
|
|
#if ENABLED(SDSUPPORT) |
|
|
|
|
|
#include "../sd/cardreader.h" |
|
|
|
|
|
#include "../sd/SdFatConfig.h" |
|
|
|
|
|
#else |
|
|
|
|
|
#define LONG_FILENAME_LENGTH 0 |
|
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
// On the Malyan M200, this will be Serial1. On a RAMPS board,
|
|
|
// On the Malyan M200, this will be Serial1. On a RAMPS board,
|
|
|
// it might not be.
|
|
|
// it might not be.
|
|
|
#define LCD_SERIAL Serial1 |
|
|
#define LCD_SERIAL Serial1 |
|
@ -135,8 +140,6 @@ void process_lcd_c_command(const char* command) { |
|
|
void process_lcd_eb_command(const char* command) { |
|
|
void process_lcd_eb_command(const char* command) { |
|
|
char elapsed_buffer[10]; |
|
|
char elapsed_buffer[10]; |
|
|
duration_t elapsed; |
|
|
duration_t elapsed; |
|
|
bool has_days; |
|
|
|
|
|
uint8_t len; |
|
|
|
|
|
switch (command[0]) { |
|
|
switch (command[0]) { |
|
|
case '0': { |
|
|
case '0': { |
|
|
elapsed = print_job_timer.duration(); |
|
|
elapsed = print_job_timer.duration(); |
|
@ -147,9 +150,17 @@ void process_lcd_eb_command(const char* command) { |
|
|
PSTR("{T0:%03.0f/%03i}{T1:000/000}{TP:%03.0f/%03i}{TQ:%03i}{TT:%s}"), |
|
|
PSTR("{T0:%03.0f/%03i}{T1:000/000}{TP:%03.0f/%03i}{TQ:%03i}{TT:%s}"), |
|
|
thermalManager.degHotend(0), |
|
|
thermalManager.degHotend(0), |
|
|
thermalManager.degTargetHotend(0), |
|
|
thermalManager.degTargetHotend(0), |
|
|
thermalManager.degBed(), |
|
|
#if HAS_HEATED_BED |
|
|
thermalManager.degTargetBed(), |
|
|
thermalManager.degBed(), |
|
|
card.percentDone(), |
|
|
thermalManager.degTargetBed(), |
|
|
|
|
|
#else |
|
|
|
|
|
0, 0, |
|
|
|
|
|
#endif |
|
|
|
|
|
#if ENABLED(SDSUPPORT) |
|
|
|
|
|
card.percentDone(), |
|
|
|
|
|
#else |
|
|
|
|
|
0, |
|
|
|
|
|
#endif |
|
|
elapsed_buffer); |
|
|
elapsed_buffer); |
|
|
write_to_lcd(message_buffer); |
|
|
write_to_lcd(message_buffer); |
|
|
} break; |
|
|
} break; |
|
@ -226,51 +237,55 @@ void process_lcd_p_command(const char* command) { |
|
|
|
|
|
|
|
|
switch (command[0]) { |
|
|
switch (command[0]) { |
|
|
case 'X': |
|
|
case 'X': |
|
|
// cancel print
|
|
|
#if ENABLED(SDSUPPORT) |
|
|
write_to_lcd_P(PSTR("{SYS:CANCELING}")); |
|
|
// cancel print
|
|
|
card.stopSDPrint( |
|
|
write_to_lcd_P(PSTR("{SYS:CANCELING}")); |
|
|
#if SD_RESORT |
|
|
card.stopSDPrint( |
|
|
true |
|
|
#if SD_RESORT |
|
|
|
|
|
true |
|
|
|
|
|
#endif |
|
|
|
|
|
); |
|
|
|
|
|
clear_command_queue(); |
|
|
|
|
|
quickstop_stepper(); |
|
|
|
|
|
print_job_timer.stop(); |
|
|
|
|
|
thermalManager.disable_all_heaters(); |
|
|
|
|
|
#if FAN_COUNT > 0 |
|
|
|
|
|
for (uint8_t i = 0; i < FAN_COUNT; i++) fanSpeeds[i] = 0; |
|
|
#endif |
|
|
#endif |
|
|
); |
|
|
wait_for_heatup = false; |
|
|
clear_command_queue(); |
|
|
write_to_lcd_P(PSTR("{SYS:STARTED}")); |
|
|
quickstop_stepper(); |
|
|
|
|
|
print_job_timer.stop(); |
|
|
|
|
|
thermalManager.disable_all_heaters(); |
|
|
|
|
|
#if FAN_COUNT > 0 |
|
|
|
|
|
for (uint8_t i = 0; i < FAN_COUNT; i++) fanSpeeds[i] = 0; |
|
|
|
|
|
#endif |
|
|
#endif |
|
|
wait_for_heatup = false; |
|
|
|
|
|
write_to_lcd_P(PSTR("{SYS:STARTED}")); |
|
|
|
|
|
break; |
|
|
break; |
|
|
case 'H': |
|
|
case 'H': |
|
|
// Home all axis
|
|
|
// Home all axis
|
|
|
enqueue_and_echo_commands_now_P(PSTR("G28")); |
|
|
enqueue_and_echo_commands_now_P(PSTR("G28")); |
|
|
break; |
|
|
break; |
|
|
default: { |
|
|
default: { |
|
|
// Print file 000 - a three digit number indicating which
|
|
|
#if ENABLED(SDSUPPORT) |
|
|
// file to print in the SD card. If it's a directory,
|
|
|
// Print file 000 - a three digit number indicating which
|
|
|
// then switch to the directory.
|
|
|
// file to print in the SD card. If it's a directory,
|
|
|
|
|
|
// then switch to the directory.
|
|
|
// Find the name of the file to print.
|
|
|
|
|
|
// It's needed to echo the PRINTFILE option.
|
|
|
// Find the name of the file to print.
|
|
|
// The {S:L} command should've ensured the SD card was mounted.
|
|
|
// It's needed to echo the PRINTFILE option.
|
|
|
card.getfilename(atoi(command)); |
|
|
// The {S:L} command should've ensured the SD card was mounted.
|
|
|
|
|
|
card.getfilename(atoi(command)); |
|
|
// There may be a difference in how V1 and V2 LCDs handle subdirectory
|
|
|
|
|
|
// prints. Investigate more. This matches the V1 motion controller actions
|
|
|
// There may be a difference in how V1 and V2 LCDs handle subdirectory
|
|
|
// but the V2 LCD switches to "print" mode on {SYS:DIR} response.
|
|
|
// prints. Investigate more. This matches the V1 motion controller actions
|
|
|
if (card.filenameIsDir) { |
|
|
// but the V2 LCD switches to "print" mode on {SYS:DIR} response.
|
|
|
card.chdir(card.filename); |
|
|
if (card.filenameIsDir) { |
|
|
write_to_lcd_P(PSTR("{SYS:DIR}")); |
|
|
card.chdir(card.filename); |
|
|
} |
|
|
write_to_lcd_P(PSTR("{SYS:DIR}")); |
|
|
else { |
|
|
} |
|
|
char message_buffer[MAX_CURLY_COMMAND]; |
|
|
else { |
|
|
sprintf_P(message_buffer, PSTR("{PRINTFILE:%s}"), card.filename); |
|
|
char message_buffer[MAX_CURLY_COMMAND]; |
|
|
write_to_lcd(message_buffer); |
|
|
sprintf_P(message_buffer, PSTR("{PRINTFILE:%s}"), card.filename); |
|
|
write_to_lcd_P(PSTR("{SYS:BUILD}")); |
|
|
write_to_lcd(message_buffer); |
|
|
card.openAndPrintFile(card.filename); |
|
|
write_to_lcd_P(PSTR("{SYS:BUILD}")); |
|
|
} |
|
|
card.openAndPrintFile(card.filename); |
|
|
|
|
|
} |
|
|
|
|
|
#endif |
|
|
} break; // default
|
|
|
} break; // default
|
|
|
} // switch
|
|
|
} // switch
|
|
|
} |
|
|
} |
|
@ -295,34 +310,40 @@ void process_lcd_s_command(const char* command) { |
|
|
char message_buffer[MAX_CURLY_COMMAND]; |
|
|
char message_buffer[MAX_CURLY_COMMAND]; |
|
|
sprintf_P(message_buffer, PSTR("{T0:%03.0f/%03i}{T1:000/000}{TP:%03.0f/%03i}"), |
|
|
sprintf_P(message_buffer, PSTR("{T0:%03.0f/%03i}{T1:000/000}{TP:%03.0f/%03i}"), |
|
|
thermalManager.degHotend(0), thermalManager.degTargetHotend(0), |
|
|
thermalManager.degHotend(0), thermalManager.degTargetHotend(0), |
|
|
thermalManager.degBed(), thermalManager.degTargetBed() |
|
|
#if HAS_HEATED_BED |
|
|
|
|
|
thermalManager.degBed(), thermalManager.degTargetBed() |
|
|
|
|
|
#else |
|
|
|
|
|
0, 0 |
|
|
|
|
|
#endif |
|
|
); |
|
|
); |
|
|
write_to_lcd(message_buffer); |
|
|
write_to_lcd(message_buffer); |
|
|
} break; |
|
|
} break; |
|
|
|
|
|
|
|
|
case 'H': |
|
|
case 'H': |
|
|
// Home all axis
|
|
|
// Home all axis
|
|
|
enqueue_and_echo_commands_P(PSTR("G28")); |
|
|
enqueue_and_echo_command("G28"); |
|
|
break; |
|
|
break; |
|
|
|
|
|
|
|
|
case 'L': { |
|
|
case 'L': { |
|
|
if (!card.cardOK) card.initsd(); |
|
|
#if ENABLED(SDSUPPORT) |
|
|
|
|
|
if (!card.cardOK) card.initsd(); |
|
|
// A more efficient way to do this would be to
|
|
|
|
|
|
// implement a callback in the ls_SerialPrint code, but
|
|
|
// A more efficient way to do this would be to
|
|
|
// that requires changes to the core cardreader class that
|
|
|
// implement a callback in the ls_SerialPrint code, but
|
|
|
// would not benefit the majority of users. Since one can't
|
|
|
// that requires changes to the core cardreader class that
|
|
|
// select a file for printing during a print, there's
|
|
|
// would not benefit the majority of users. Since one can't
|
|
|
// little reason not to do it this way.
|
|
|
// select a file for printing during a print, there's
|
|
|
char message_buffer[MAX_CURLY_COMMAND]; |
|
|
// little reason not to do it this way.
|
|
|
uint16_t file_count = card.get_num_Files(); |
|
|
char message_buffer[MAX_CURLY_COMMAND]; |
|
|
for (uint16_t i = 0; i < file_count; i++) { |
|
|
uint16_t file_count = card.get_num_Files(); |
|
|
card.getfilename(i); |
|
|
for (uint16_t i = 0; i < file_count; i++) { |
|
|
sprintf_P(message_buffer, card.filenameIsDir ? PSTR("{DIR:%s}") : PSTR("{FILE:%s}"), card.filename); |
|
|
card.getfilename(i); |
|
|
write_to_lcd(message_buffer); |
|
|
sprintf_P(message_buffer, card.filenameIsDir ? PSTR("{DIR:%s}") : PSTR("{FILE:%s}"), card.filename); |
|
|
} |
|
|
write_to_lcd(message_buffer); |
|
|
|
|
|
} |
|
|
write_to_lcd_P(PSTR("{SYS:OK}")); |
|
|
|
|
|
|
|
|
write_to_lcd_P(PSTR("{SYS:OK}")); |
|
|
|
|
|
#endif |
|
|
} break; |
|
|
} break; |
|
|
|
|
|
|
|
|
default: |
|
|
default: |
|
@ -382,7 +403,7 @@ void update_usb_status(const bool forceUpdate) { |
|
|
// appears to use the usb discovery status.
|
|
|
// appears to use the usb discovery status.
|
|
|
// This is more logical.
|
|
|
// This is more logical.
|
|
|
if (last_usb_connected_status != Serial || forceUpdate) { |
|
|
if (last_usb_connected_status != Serial || forceUpdate) { |
|
|
last_usb_connected_status = Serial; |
|
|
last_usb_connected_status = Serial; |
|
|
write_to_lcd_P(last_usb_connected_status ? PSTR("{R:UC}\r\n") : PSTR("{R:UD}\r\n")); |
|
|
write_to_lcd_P(last_usb_connected_status ? PSTR("{R:UC}\r\n") : PSTR("{R:UD}\r\n")); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
@ -411,15 +432,17 @@ void lcd_update() { |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
// If there's a print in progress, we need to emit the status as
|
|
|
#if ENABLED(SDSUPPORT) |
|
|
// {TQ:<PERCENT>}
|
|
|
// If there's a print in progress, we need to emit the status as
|
|
|
if (card.sdprinting) { |
|
|
// {TQ:<PERCENT>}
|
|
|
// We also need to send: T:-2538.0 E:0
|
|
|
if (card.sdprinting) { |
|
|
// I have no idea what this means.
|
|
|
// We also need to send: T:-2538.0 E:0
|
|
|
char message_buffer[10]; |
|
|
// I have no idea what this means.
|
|
|
sprintf_P(message_buffer, PSTR("{TQ:%03i}"), card.percentDone()); |
|
|
char message_buffer[10]; |
|
|
write_to_lcd(message_buffer); |
|
|
sprintf_P(message_buffer, PSTR("{TQ:%03i}"), card.percentDone()); |
|
|
} |
|
|
write_to_lcd(message_buffer); |
|
|
|
|
|
} |
|
|
|
|
|
#endif |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
/**
|
|
|
/**
|
|
|