|
@ -43,25 +43,27 @@ |
|
|
|
|
|
|
|
|
namespace Anycubic { |
|
|
namespace Anycubic { |
|
|
|
|
|
|
|
|
|
|
|
ChironTFT Chiron; |
|
|
|
|
|
#if AUTO_DETECT_CHIRON_TFT |
|
|
|
|
|
panel_type_t ChironTFT::panel_type = AC_panel_unknown; |
|
|
|
|
|
#endif |
|
|
|
|
|
last_error_t ChironTFT::last_error; |
|
|
printer_state_t ChironTFT::printer_state; |
|
|
printer_state_t ChironTFT::printer_state; |
|
|
paused_state_t ChironTFT::pause_state; |
|
|
paused_state_t ChironTFT::pause_state; |
|
|
heater_state_t ChironTFT::hotend_state; |
|
|
heater_state_t ChironTFT::hotend_state; |
|
|
heater_state_t ChironTFT::hotbed_state; |
|
|
heater_state_t ChironTFT::hotbed_state; |
|
|
xy_uint8_t ChironTFT::selectedmeshpoint; |
|
|
xy_uint8_t ChironTFT::selectedmeshpoint; |
|
|
char ChironTFT::selectedfile[MAX_PATH_LEN]; |
|
|
char ChironTFT::selectedfile[MAX_PATH_LEN + 1]; |
|
|
char ChironTFT::panel_command[MAX_CMND_LEN]; |
|
|
char ChironTFT::panel_command[MAX_CMND_LEN + 1]; |
|
|
uint8_t ChironTFT::command_len; |
|
|
uint8_t ChironTFT::command_len; |
|
|
float ChironTFT::live_Zoffset; |
|
|
float ChironTFT::live_Zoffset; |
|
|
file_menu_t ChironTFT::file_menu; |
|
|
file_menu_t ChironTFT::file_menu; |
|
|
|
|
|
|
|
|
ChironTFT Chiron; |
|
|
|
|
|
|
|
|
|
|
|
ChironTFT::ChironTFT(){} |
|
|
|
|
|
|
|
|
|
|
|
void ChironTFT::Startup() { |
|
|
void ChironTFT::Startup() { |
|
|
selectedfile[0] = '\0'; |
|
|
selectedfile[0] = '\0'; |
|
|
panel_command[0] = '\0'; |
|
|
panel_command[0] = '\0'; |
|
|
command_len = 0; |
|
|
command_len = 0; |
|
|
|
|
|
last_error = AC_error_none; |
|
|
printer_state = AC_printer_idle; |
|
|
printer_state = AC_printer_idle; |
|
|
pause_state = AC_paused_idle; |
|
|
pause_state = AC_paused_idle; |
|
|
hotend_state = AC_heater_off; |
|
|
hotend_state = AC_heater_off; |
|
@ -80,27 +82,41 @@ void ChironTFT::Startup() { |
|
|
// Filament runout is handled by Marlin settings in Configuration.h
|
|
|
// Filament runout is handled by Marlin settings in Configuration.h
|
|
|
// opt_set FIL_RUNOUT_STATE HIGH // Pin state indicating that filament is NOT present.
|
|
|
// opt_set FIL_RUNOUT_STATE HIGH // Pin state indicating that filament is NOT present.
|
|
|
// opt_enable FIL_RUNOUT_PULLUP
|
|
|
// opt_enable FIL_RUNOUT_PULLUP
|
|
|
|
|
|
|
|
|
TFTSer.begin(115200); |
|
|
TFTSer.begin(115200); |
|
|
|
|
|
|
|
|
|
|
|
// wait for the TFT panel to initialise and finish the animation
|
|
|
|
|
|
delay_ms(250); |
|
|
|
|
|
|
|
|
|
|
|
// There are different panels for the Chiron with slightly different commands
|
|
|
|
|
|
// So we need to know what we are working with.
|
|
|
|
|
|
|
|
|
|
|
|
// Panel type can be defined otherwise detect it automatically
|
|
|
|
|
|
if (panel_type == AC_panel_unknown) DetectPanelType(); |
|
|
|
|
|
|
|
|
// Signal Board has reset
|
|
|
// Signal Board has reset
|
|
|
SendtoTFTLN(AC_msg_main_board_has_reset); |
|
|
SendtoTFTLN(AC_msg_main_board_has_reset); |
|
|
|
|
|
|
|
|
safe_delay(200); |
|
|
|
|
|
|
|
|
|
|
|
// Enable leveling and Disable end stops during print
|
|
|
// Enable leveling and Disable end stops during print
|
|
|
// as Z home places nozzle above the bed so we need to allow it past the end stops
|
|
|
// as Z home places nozzle above the bed so we need to allow it past the end stops
|
|
|
injectCommands_P(AC_cmnd_enable_leveling); |
|
|
injectCommands_P(AC_cmnd_enable_leveling); |
|
|
|
|
|
|
|
|
// Startup tunes are defined in Tunes.h
|
|
|
// Startup tunes are defined in Tunes.h
|
|
|
//PlayTune(BEEPER_PIN, Anycubic_PowerOn, 1);
|
|
|
PlayTune(BEEPER_PIN, TERN(AC_DEFAULT_STARTUP_TUNE, Anycubic_PowerOn, GB_PowerOn), 1); |
|
|
PlayTune(BEEPER_PIN, GB_PowerOn, 1); |
|
|
|
|
|
#if ACDEBUGLEVEL |
|
|
#if ACDEBUGLEVEL |
|
|
SERIAL_ECHOLNPAIR("AC Debug Level ", ACDEBUGLEVEL); |
|
|
SERIAL_ECHOLNPAIR("AC Debug Level ", ACDEBUGLEVEL); |
|
|
#endif |
|
|
#endif |
|
|
SendtoTFTLN(AC_msg_ready); |
|
|
SendtoTFTLN(AC_msg_ready); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void ChironTFT::DetectPanelType() { |
|
|
|
|
|
#if AUTO_DETECT_CHIRON_TFT |
|
|
|
|
|
// Send a query to the TFT
|
|
|
|
|
|
SendtoTFTLN(AC_Test_for_OldPanel); // The panel will respond with 'SXY 480 320'
|
|
|
|
|
|
SendtoTFTLN(AC_Test_for_NewPanel); // the panel will respond with '[0]=0 ' to '[19]=0 '
|
|
|
|
|
|
#endif |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
void ChironTFT::IdleLoop() { |
|
|
void ChironTFT::IdleLoop() { |
|
|
if (ReadTFTCommand()) { |
|
|
if (ReadTFTCommand()) { |
|
|
ProcessPanelRequest(); |
|
|
ProcessPanelRequest(); |
|
@ -123,15 +139,16 @@ void ChironTFT::MediaEvent(media_event_t event) { |
|
|
switch (event) { |
|
|
switch (event) { |
|
|
case AC_media_inserted: |
|
|
case AC_media_inserted: |
|
|
SendtoTFTLN(AC_msg_sd_card_inserted); |
|
|
SendtoTFTLN(AC_msg_sd_card_inserted); |
|
|
break; |
|
|
break; |
|
|
|
|
|
|
|
|
case AC_media_removed: |
|
|
case AC_media_removed: |
|
|
SendtoTFTLN(AC_msg_sd_card_removed); |
|
|
SendtoTFTLN(AC_msg_sd_card_removed); |
|
|
break; |
|
|
break; |
|
|
|
|
|
|
|
|
case AC_media_error: |
|
|
case AC_media_error: |
|
|
|
|
|
last_error = AC_error_noSD; |
|
|
SendtoTFTLN(AC_msg_no_sd_card); |
|
|
SendtoTFTLN(AC_msg_no_sd_card); |
|
|
break; |
|
|
break; |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
@ -170,8 +187,8 @@ void ChironTFT::FilamentRunout() { |
|
|
SERIAL_ECHOLNPAIR("FilamentRunout() printer_state ", printer_state); |
|
|
SERIAL_ECHOLNPAIR("FilamentRunout() printer_state ", printer_state); |
|
|
#endif |
|
|
#endif |
|
|
// 1 Signal filament out
|
|
|
// 1 Signal filament out
|
|
|
|
|
|
last_error = AC_error_filament_runout; |
|
|
SendtoTFTLN(isPrintingFromMedia() ? AC_msg_filament_out_alert : AC_msg_filament_out_block); |
|
|
SendtoTFTLN(isPrintingFromMedia() ? AC_msg_filament_out_alert : AC_msg_filament_out_block); |
|
|
//printer_state = AC_printer_filament_out;
|
|
|
|
|
|
PlayTune(BEEPER_PIN, FilamentOut, 1); |
|
|
PlayTune(BEEPER_PIN, FilamentOut, 1); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
@ -278,14 +295,23 @@ void ChironTFT::StatusChange(const char * const msg) { |
|
|
SendtoTFTLN(AC_msg_bed_heating); |
|
|
SendtoTFTLN(AC_msg_bed_heating); |
|
|
hotbed_state = AC_heater_temp_set; |
|
|
hotbed_state = AC_heater_temp_set; |
|
|
} |
|
|
} |
|
|
|
|
|
else if (strcmp_P(msg, MARLIN_msg_EEPROM_version) == 0) { |
|
|
|
|
|
last_error = AC_error_EEPROM; |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
void ChironTFT::PowerLossRecovery() { |
|
|
void ChironTFT::PowerLossRecovery() { |
|
|
printer_state = AC_printer_resuming_from_power_outage; // Play tune to notify user we can recover.
|
|
|
printer_state = AC_printer_resuming_from_power_outage; // Play tune to notify user we can recover.
|
|
|
|
|
|
last_error = AC_error_powerloss; |
|
|
PlayTune(BEEPER_PIN, SOS, 1); |
|
|
PlayTune(BEEPER_PIN, SOS, 1); |
|
|
SERIAL_ECHOLNPGM("Resuming from power outage..."); |
|
|
SERIAL_ECHOLNPGM_P(AC_msg_powerloss_recovery); |
|
|
SERIAL_ECHOLNPGM("Select SD file then press resume"); |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void ChironTFT::PrintComplete() { |
|
|
|
|
|
SendtoTFT(AC_msg_print_complete); |
|
|
|
|
|
printer_state = AC_printer_idle; |
|
|
|
|
|
setSoftEndstopState(true); // enable endstops
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
void ChironTFT::SendtoTFT(PGM_P str) { // A helper to print PROGMEM string to the panel
|
|
|
void ChironTFT::SendtoTFT(PGM_P str) { // A helper to print PROGMEM string to the panel
|
|
@ -319,26 +345,29 @@ bool ChironTFT::ReadTFTCommand() { |
|
|
command_len++; |
|
|
command_len++; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
if (command_ready) { |
|
|
if (command_ready || command_len == MAX_CMND_LEN) { |
|
|
panel_command[command_len] = 0x00; |
|
|
panel_command[command_len] = '\0'; |
|
|
#if ACDEBUG(AC_ALL) |
|
|
#if ACDEBUG(AC_ALL) |
|
|
SERIAL_ECHOLNPAIR("< ", panel_command); |
|
|
SERIAL_ECHOLNPAIR("len(",command_len,") < ", panel_command); |
|
|
#endif |
|
|
|
|
|
#if ACDEBUG(AC_SOME) |
|
|
|
|
|
// Ignore status request commands
|
|
|
|
|
|
uint8_t req = atoi(&panel_command[1]); |
|
|
|
|
|
if (req > 7 && req != 20) { |
|
|
|
|
|
SERIAL_ECHOLNPAIR("> ", panel_command); |
|
|
|
|
|
SERIAL_ECHOLNPAIR("printer_state:", printer_state); |
|
|
|
|
|
} |
|
|
|
|
|
#endif |
|
|
#endif |
|
|
|
|
|
command_ready = true; |
|
|
} |
|
|
} |
|
|
return command_ready; |
|
|
return command_ready; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
int8_t ChironTFT::Findcmndpos(const char * buff, char q) { |
|
|
int8_t ChironTFT::FindToken(char c) { |
|
|
int8_t pos = 0; |
|
|
int8_t pos = 0; |
|
|
do { if (buff[pos] == q) return pos; } while (++pos < MAX_CMND_LEN); |
|
|
do { |
|
|
|
|
|
if (panel_command[pos] == c) { |
|
|
|
|
|
#if ACDEBUG(AC_INFO) |
|
|
|
|
|
SERIAL_ECHOLNPAIR("Tpos:", pos, " ", c); |
|
|
|
|
|
#endif |
|
|
|
|
|
return pos; |
|
|
|
|
|
} |
|
|
|
|
|
} while(++pos < command_len); |
|
|
|
|
|
#if ACDEBUG(AC_INFO) |
|
|
|
|
|
SERIAL_ECHOLNPAIR("Not found: ", c); |
|
|
|
|
|
#endif |
|
|
return -1; |
|
|
return -1; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
@ -352,6 +381,7 @@ void ChironTFT::CheckHeaters() { |
|
|
faultDuration++; |
|
|
faultDuration++; |
|
|
if (faultDuration >= AC_HEATER_FAULT_VALIDATION_TIME) { |
|
|
if (faultDuration >= AC_HEATER_FAULT_VALIDATION_TIME) { |
|
|
SendtoTFTLN(AC_msg_nozzle_temp_abnormal); |
|
|
SendtoTFTLN(AC_msg_nozzle_temp_abnormal); |
|
|
|
|
|
last_error = AC_error_abnormal_temp_t0; |
|
|
SERIAL_ECHOLNPAIR("Extruder temp abnormal! : ", temp); |
|
|
SERIAL_ECHOLNPAIR("Extruder temp abnormal! : ", temp); |
|
|
break; |
|
|
break; |
|
|
} |
|
|
} |
|
@ -366,6 +396,7 @@ void ChironTFT::CheckHeaters() { |
|
|
faultDuration++; |
|
|
faultDuration++; |
|
|
if (faultDuration >= AC_HEATER_FAULT_VALIDATION_TIME) { |
|
|
if (faultDuration >= AC_HEATER_FAULT_VALIDATION_TIME) { |
|
|
SendtoTFTLN(AC_msg_nozzle_temp_abnormal); |
|
|
SendtoTFTLN(AC_msg_nozzle_temp_abnormal); |
|
|
|
|
|
last_error = AC_error_abnormal_temp_bed; |
|
|
SERIAL_ECHOLNPAIR("Bed temp abnormal! : ", temp); |
|
|
SERIAL_ECHOLNPAIR("Bed temp abnormal! : ", temp); |
|
|
break; |
|
|
break; |
|
|
} |
|
|
} |
|
@ -396,15 +427,21 @@ void ChironTFT::SendFileList(int8_t startindex) { |
|
|
SERIAL_ECHOLNPAIR("## SendFileList ## ", startindex); |
|
|
SERIAL_ECHOLNPAIR("## SendFileList ## ", startindex); |
|
|
#endif |
|
|
#endif |
|
|
SendtoTFTLN(PSTR("FN ")); |
|
|
SendtoTFTLN(PSTR("FN ")); |
|
|
filenavigator.getFiles(startindex); |
|
|
filenavigator.getFiles(startindex, panel_type, 4); |
|
|
SendtoTFTLN(PSTR("END")); |
|
|
SendtoTFTLN(PSTR("END")); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
void ChironTFT::SelectFile() { |
|
|
void ChironTFT::SelectFile() { |
|
|
strncpy(selectedfile, panel_command + 4, command_len - 4); |
|
|
if (panel_type == AC_panel_new) { |
|
|
selectedfile[command_len - 5] = '\0'; |
|
|
strncpy(selectedfile, panel_command + 4, command_len - 3); |
|
|
|
|
|
selectedfile[command_len - 4] = '\0'; |
|
|
|
|
|
} |
|
|
|
|
|
else { |
|
|
|
|
|
strncpy(selectedfile, panel_command + 4, command_len - 4); |
|
|
|
|
|
selectedfile[command_len - 5] = '\0'; |
|
|
|
|
|
} |
|
|
#if ACDEBUG(AC_FILE) |
|
|
#if ACDEBUG(AC_FILE) |
|
|
SERIAL_ECHOLNPAIR_F(" Selected File: ",selectedfile); |
|
|
SERIAL_ECHOLNPAIR(" Selected File: ",selectedfile); |
|
|
#endif |
|
|
#endif |
|
|
switch (selectedfile[0]) { |
|
|
switch (selectedfile[0]) { |
|
|
case '/': // Valid file selected
|
|
|
case '/': // Valid file selected
|
|
@ -417,6 +454,9 @@ void ChironTFT::SelectFile() { |
|
|
SendFileList( 0 ); |
|
|
SendFileList( 0 ); |
|
|
break; |
|
|
break; |
|
|
default: // enter sub folder
|
|
|
default: // enter sub folder
|
|
|
|
|
|
// for new panel remove the '.GCO' tag that was added to the end of the path
|
|
|
|
|
|
if (panel_type == AC_panel_new) |
|
|
|
|
|
selectedfile[strlen(selectedfile) - 4] = '\0'; |
|
|
filenavigator.changeDIR(selectedfile); |
|
|
filenavigator.changeDIR(selectedfile); |
|
|
SendtoTFTLN(AC_msg_sd_file_open_failed); |
|
|
SendtoTFTLN(AC_msg_sd_file_open_failed); |
|
|
SendFileList( 0 ); |
|
|
SendFileList( 0 ); |
|
@ -424,25 +464,48 @@ void ChironTFT::SelectFile() { |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
void ChironTFT::InjectCommandandWait(PGM_P cmd) { |
|
|
|
|
|
//injectCommands_P(cmnd); queue.enqueue_now_P(cmd);
|
|
|
|
|
|
//SERIAL_ECHOLN(PSTR("Inject>"));
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void ChironTFT::ProcessPanelRequest() { |
|
|
void ChironTFT::ProcessPanelRequest() { |
|
|
// Break these up into logical blocks // as its easier to navigate than one huge switch case!
|
|
|
// Break these up into logical blocks // as its easier to navigate than one huge switch case!
|
|
|
int8_t req = atoi(&panel_command[1]); |
|
|
const int8_t tpos = FindToken('A'); |
|
|
|
|
|
// Panel request are 'A0' - 'A36'
|
|
|
|
|
|
if (tpos != -1) { |
|
|
|
|
|
const int8_t req = atoi(&panel_command[tpos+1]); |
|
|
|
|
|
|
|
|
// Information requests A0 - A8 and A33
|
|
|
// Information requests A0 - A8 and A33
|
|
|
if (req <= 8 || req == 33) PanelInfo(req); |
|
|
if (req <= 8 || req == 33) PanelInfo(req); |
|
|
|
|
|
|
|
|
// Simple Actions A9 - A28
|
|
|
// Simple Actions A9 - A28
|
|
|
else if ( req <= 28) PanelAction(req); |
|
|
else if (req <= 28) PanelAction(req); |
|
|
|
|
|
|
|
|
// Process Initiation
|
|
|
// Process Initiation
|
|
|
else if (req <= 34) PanelProcess(req); |
|
|
else if (req <= 36) PanelProcess(req); |
|
|
|
|
|
} |
|
|
|
|
|
else { |
|
|
|
|
|
#if AUTO_DETECT_CHIRON_TFT |
|
|
|
|
|
// This may be a response to a panel type detection query
|
|
|
|
|
|
if (panel_type == AC_panel_unknown) { |
|
|
|
|
|
tpos = FindToken('S'); // old panel will respond to 'SIZE' with 'SXY 480 320'
|
|
|
|
|
|
if (tpos != -1) { |
|
|
|
|
|
if (panel_command[tpos+1]== 'X' && panel_command[tpos+2]=='Y') { |
|
|
|
|
|
panel_type = AC_panel_standard; |
|
|
|
|
|
SERIAL_ECHOLNPGM_P(AC_msg_old_panel_detected); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
else { |
|
|
|
|
|
tpos = FindToken('['); // new panel will respond to 'J200' with '[0]=0'
|
|
|
|
|
|
if (tpos != -1) { |
|
|
|
|
|
if (panel_command[tpos+1]== '0' && panel_command[tpos+2]==']') { |
|
|
|
|
|
panel_type = AC_panel_new; |
|
|
|
|
|
SERIAL_ECHOLNPGM_P(AC_msg_new_panel_detected); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
return; |
|
|
|
|
|
} |
|
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
else SendtoTFTLN(); |
|
|
SendtoTFTLN(); // Ignore unknown requests
|
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
void ChironTFT::PanelInfo(uint8_t req) { |
|
|
void ChironTFT::PanelInfo(uint8_t req) { |
|
@ -513,7 +576,8 @@ void ChironTFT::PanelInfo(uint8_t req) { |
|
|
|
|
|
|
|
|
case 33: // A33 Get firmware info
|
|
|
case 33: // A33 Get firmware info
|
|
|
SendtoTFT(PSTR("J33 ")); |
|
|
SendtoTFT(PSTR("J33 ")); |
|
|
SendtoTFTLN(PSTR(SHORT_BUILD_VERSION)); |
|
|
// If there is an error recorded, show that instead of the FW version
|
|
|
|
|
|
if (!GetLastError()) SendtoTFTLN(PSTR(SHORT_BUILD_VERSION)); |
|
|
break; |
|
|
break; |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
@ -567,11 +631,7 @@ void ChironTFT::PanelAction(uint8_t req) { |
|
|
#if ACDebugLevel >= 1 |
|
|
#if ACDebugLevel >= 1 |
|
|
SERIAL_ECHOLNPAIR_F("Print: ", selectedfile); |
|
|
SERIAL_ECHOLNPAIR_F("Print: ", selectedfile); |
|
|
#endif |
|
|
#endif |
|
|
// the card library needs a path starting // but the File api doesn't...
|
|
|
printFile(selectedfile); |
|
|
char file[MAX_PATH_LEN]; |
|
|
|
|
|
file[0] = '/'; |
|
|
|
|
|
strcpy(file + 1, selectedfile); |
|
|
|
|
|
printFile(file); |
|
|
|
|
|
SendtoTFTLN(AC_msg_print_from_sd_card); |
|
|
SendtoTFTLN(AC_msg_print_from_sd_card); |
|
|
} break; |
|
|
} break; |
|
|
|
|
|
|
|
@ -631,29 +691,24 @@ void ChironTFT::PanelAction(uint8_t req) { |
|
|
} |
|
|
} |
|
|
break; |
|
|
break; |
|
|
|
|
|
|
|
|
case 22: // A22 Move Axis A22 Y +10F3000
|
|
|
case 22: { // A22 Move Axis
|
|
|
// Ignore request if printing
|
|
|
// The commands have changed on the new panel
|
|
|
if (!isPrinting()) { |
|
|
// Old TFT A22 X -1F1500 A22 X +1F1500
|
|
|
// setAxisPosition_mm() uses pre defined manual feedrates so ignore the feedrate from the panel
|
|
|
// New TFT A22 X-1.0 F1500 A22 X1.0 F1500
|
|
|
setSoftEndstopState(true); // enable endstops
|
|
|
|
|
|
float newposition = atof(&panel_command[6]); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// lets just wrap this in a gcode relative nonprint move and let the controller deal with it
|
|
|
|
|
|
// G91 G0 <panel command> G90
|
|
|
|
|
|
|
|
|
|
|
|
if (!isPrinting()) { // Ignore request if printing
|
|
|
|
|
|
char MoveCmnd[30]; |
|
|
|
|
|
sprintf_P(MoveCmnd, PSTR("G91\nG0 %s \nG90"), panel_command+3); |
|
|
#if ACDEBUG(AC_ACTION) |
|
|
#if ACDEBUG(AC_ACTION) |
|
|
SERIAL_ECHOLNPAIR("Nudge ", AS_CHAR(panel_command[4]), " axis ", newposition); |
|
|
SERIAL_ECHOLNPAIR("Move: ", MoveCmnd); |
|
|
#endif |
|
|
#endif |
|
|
|
|
|
setSoftEndstopState(true); // enable endstops
|
|
|
switch (panel_command[4]) { |
|
|
injectCommands(MoveCmnd); |
|
|
case 'X': setAxisPosition_mm(getAxisPosition_mm(X) + newposition, X); break; |
|
|
|
|
|
case 'Y': setAxisPosition_mm(getAxisPosition_mm(Y) + newposition, Y); break; |
|
|
|
|
|
case 'Z': setAxisPosition_mm(getAxisPosition_mm(Z) + newposition, Z); break; |
|
|
|
|
|
case 'E': // The only time we get this command is from the filament load/unload menu
|
|
|
|
|
|
// the standard movement is too slow so we will use the load unlod GCode to speed it up a bit
|
|
|
|
|
|
if (canMove(E0) && !commandsInQueue()) |
|
|
|
|
|
injectCommands_P(newposition > 0 ? AC_cmnd_manual_load_filament : AC_cmnd_manual_unload_filament); |
|
|
|
|
|
break; |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
} |
|
|
break; |
|
|
} break; |
|
|
|
|
|
|
|
|
case 23: // A23 Preheat PLA
|
|
|
case 23: // A23 Preheat PLA
|
|
|
// Ignore request if printing
|
|
|
// Ignore request if printing
|
|
@ -690,7 +745,9 @@ void ChironTFT::PanelAction(uint8_t req) { |
|
|
break; |
|
|
break; |
|
|
|
|
|
|
|
|
case 26: // A26 Refresh SD
|
|
|
case 26: // A26 Refresh SD
|
|
|
// M22 M21 maybe needed here to reset sd card
|
|
|
if (card.isMounted())card.release(); |
|
|
|
|
|
card.mount(); |
|
|
|
|
|
safe_delay(500); |
|
|
filenavigator.reset(); |
|
|
filenavigator.reset(); |
|
|
break; |
|
|
break; |
|
|
|
|
|
|
|
@ -710,8 +767,8 @@ void ChironTFT::PanelProcess(uint8_t req) { |
|
|
case 29: { // A29 Read Mesh Point A29 X1 Y1
|
|
|
case 29: { // A29 Read Mesh Point A29 X1 Y1
|
|
|
xy_uint8_t pos; |
|
|
xy_uint8_t pos; |
|
|
float pos_z; |
|
|
float pos_z; |
|
|
pos.x = atoi(&panel_command[5]); |
|
|
pos.x = atoi(&panel_command[FindToken('X')+1]); |
|
|
pos.y = atoi(&panel_command[8]); |
|
|
pos.y = atoi(&panel_command[FindToken('Y')+1]); |
|
|
pos_z = getMeshPoint(pos); |
|
|
pos_z = getMeshPoint(pos); |
|
|
|
|
|
|
|
|
SendtoTFT(PSTR("A29V ")); |
|
|
SendtoTFT(PSTR("A29V ")); |
|
@ -743,48 +800,60 @@ void ChironTFT::PanelProcess(uint8_t req) { |
|
|
} |
|
|
} |
|
|
} break; |
|
|
} break; |
|
|
|
|
|
|
|
|
case 30: { // A30 Auto leveling
|
|
|
case 30: { // A30 Auto leveling
|
|
|
if (panel_command[3] == 'S') { // Start probing
|
|
|
if (FindToken('S') != -1) { // Start probing New panel adds spaces..
|
|
|
// Ignore request if printing
|
|
|
// Ignore request if printing
|
|
|
if (isPrinting()) |
|
|
if (isPrinting()) |
|
|
SendtoTFTLN(AC_msg_probing_not_allowed); // forbid auto leveling
|
|
|
SendtoTFTLN(AC_msg_probing_not_allowed); // forbid auto leveling
|
|
|
else { |
|
|
else { |
|
|
injectCommands_P(PSTR("G28O\nG29")); |
|
|
|
|
|
printer_state = AC_printer_probing; |
|
|
|
|
|
SendtoTFTLN(AC_msg_start_probing); |
|
|
SendtoTFTLN(AC_msg_start_probing); |
|
|
|
|
|
injectCommands_P(PSTR("G28\nG29")); |
|
|
|
|
|
printer_state = AC_printer_probing; |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
else SendtoTFTLN(AC_msg_start_probing); |
|
|
else { |
|
|
} break; |
|
|
SendtoTFTLN(AC_msg_start_probing); // Just enter levelling menu
|
|
|
|
|
|
} |
|
|
|
|
|
} break; |
|
|
|
|
|
|
|
|
case 31: { // A31 Adjust all Probe Points
|
|
|
case 31: { // A31 Adjust all Probe Points
|
|
|
switch (panel_command[3]) { |
|
|
// The tokens can occur in different places on the new panel so we need to find it.
|
|
|
case 'C': // Restore and apply original offsets
|
|
|
|
|
|
if (!isPrinting()) { |
|
|
if (FindToken('C') != -1) { // Restore and apply original offsets
|
|
|
injectCommands_P(PSTR("M501\nM420 S1")); |
|
|
if (!isPrinting()) { |
|
|
selectedmeshpoint.x = selectedmeshpoint.y = 99; |
|
|
injectCommands_P(PSTR("M501\nM420 S1")); |
|
|
} |
|
|
selectedmeshpoint.x = selectedmeshpoint.y = 99; |
|
|
break; |
|
|
SERIAL_ECHOLNPGM_P(AC_msg_mesh_changes_abandoned); |
|
|
case 'D': // Save Z Offset tables and restore leveling state
|
|
|
} |
|
|
if (!isPrinting()) { |
|
|
} |
|
|
setAxisPosition_mm(1.0,Z); |
|
|
|
|
|
injectCommands_P(PSTR("M500")); |
|
|
else if (FindToken('D') != -1) { // Save Z Offset tables and restore leveling state
|
|
|
selectedmeshpoint.x = selectedmeshpoint.y = 99; |
|
|
if (!isPrinting()) { |
|
|
} |
|
|
setAxisPosition_mm(1.0,Z); // Lift nozzle before any further movements are made
|
|
|
break; |
|
|
injectCommands_P(PSTR("M500")); |
|
|
case 'G': // Get current offset
|
|
|
SERIAL_ECHOLNPGM_P(AC_msg_mesh_changes_saved); |
|
|
SendtoTFT(PSTR("A31V ")); |
|
|
selectedmeshpoint.x = selectedmeshpoint.y = 99; |
|
|
// When printing use the live z Offset position
|
|
|
} |
|
|
// we will use babystepping to move the print head
|
|
|
} |
|
|
if (isPrinting()) |
|
|
|
|
|
TFTSer.println(live_Zoffset); |
|
|
else if (FindToken('G') != -1) { // Get current offset
|
|
|
else { |
|
|
SendtoTFT(PSTR("A31V ")); |
|
|
TFTSer.println(getZOffset_mm()); |
|
|
// When printing use the live z Offset position
|
|
|
selectedmeshpoint.x = selectedmeshpoint.y = 99; |
|
|
// we will use babystepping to move the print head
|
|
|
} |
|
|
if (isPrinting()) |
|
|
break; |
|
|
TFTSer.println(live_Zoffset); |
|
|
case 'S': { // Set offset (adjusts all points by value)
|
|
|
else { |
|
|
float Zshift = atof(&panel_command[4]); |
|
|
TFTSer.println(getZOffset_mm()); |
|
|
|
|
|
selectedmeshpoint.x = selectedmeshpoint.y = 99; |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
else { |
|
|
|
|
|
int8_t tokenpos = FindToken('S'); |
|
|
|
|
|
if (tokenpos != -1) { // Set offset (adjusts all points by value)
|
|
|
|
|
|
float Zshift = atof(&panel_command[tokenpos+1]); |
|
|
setSoftEndstopState(false); // disable endstops
|
|
|
setSoftEndstopState(false); // disable endstops
|
|
|
// Allow temporary Z position nudging during print
|
|
|
// Allow temporary Z position nudging during print
|
|
|
// From the leveling panel use the all points UI to adjust the print pos.
|
|
|
// From the leveling panel use the all points UI to adjust the print pos.
|
|
@ -813,6 +882,9 @@ void ChironTFT::PanelProcess(uint8_t req) { |
|
|
const xy_uint8_t pos { x, y }; |
|
|
const xy_uint8_t pos { x, y }; |
|
|
const float currval = getMeshPoint(pos); |
|
|
const float currval = getMeshPoint(pos); |
|
|
setMeshPoint(pos, constrain(currval + Zshift, AC_LOWEST_MESHPOINT_VAL, 2)); |
|
|
setMeshPoint(pos, constrain(currval + Zshift, AC_LOWEST_MESHPOINT_VAL, 2)); |
|
|
|
|
|
#if ACDEBUG(AC_INFO) |
|
|
|
|
|
SERIAL_ECHOLNPAIR("Change mesh point X", x," Y",y ," from ", currval, " to ", getMeshPoint(pos) ); |
|
|
|
|
|
#endif |
|
|
} |
|
|
} |
|
|
const float currZOffset = getZOffset_mm(); |
|
|
const float currZOffset = getZOffset_mm(); |
|
|
#if ACDEBUG(AC_INFO) |
|
|
#if ACDEBUG(AC_INFO) |
|
@ -878,9 +950,27 @@ void ChironTFT::PanelProcess(uint8_t req) { |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} break; |
|
|
} break; |
|
|
|
|
|
|
|
|
|
|
|
case 36: // A36 Auto leveling for new TFT bet that was a typo in the panel code!
|
|
|
|
|
|
SendtoTFTLN(AC_msg_start_probing); |
|
|
|
|
|
break; |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
bool ChironTFT::GetLastError() { |
|
|
|
|
|
switch (last_error) { |
|
|
|
|
|
case AC_error_abnormal_temp_bed: SendtoTFTLN(AC_msg_error_bed_temp); break; |
|
|
|
|
|
case AC_error_abnormal_temp_t0: SendtoTFTLN(AC_msg_error_hotend_temp); break; |
|
|
|
|
|
case AC_error_noSD: SendtoTFTLN(AC_msg_error_sd_card); break; |
|
|
|
|
|
case AC_error_powerloss: SendtoTFTLN(AC_msg_power_loss); break; |
|
|
|
|
|
case AC_error_EEPROM: SendtoTFTLN(AC_msg_eeprom_version); break; |
|
|
|
|
|
case AC_error_filament_runout: SendtoTFTLN(AC_msg_filament_out); break; |
|
|
|
|
|
default: return false; |
|
|
} |
|
|
} |
|
|
|
|
|
last_error = AC_error_none; |
|
|
|
|
|
return true; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
} // Anycubic
|
|
|
} // Anycubic namespace
|
|
|
|
|
|
|
|
|
#endif // ANYCUBIC_LCD_CHIRON
|
|
|
#endif // ANYCUBIC_LCD_CHIRON
|
|
|