|
|
|
@ -43,25 +43,27 @@
|
|
|
|
|
|
|
|
|
|
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;
|
|
|
|
|
paused_state_t ChironTFT::pause_state;
|
|
|
|
|
heater_state_t ChironTFT::hotend_state;
|
|
|
|
|
heater_state_t ChironTFT::hotbed_state;
|
|
|
|
|
xy_uint8_t ChironTFT::selectedmeshpoint;
|
|
|
|
|
char ChironTFT::selectedfile[MAX_PATH_LEN];
|
|
|
|
|
char ChironTFT::panel_command[MAX_CMND_LEN];
|
|
|
|
|
char ChironTFT::selectedfile[MAX_PATH_LEN + 1];
|
|
|
|
|
char ChironTFT::panel_command[MAX_CMND_LEN + 1];
|
|
|
|
|
uint8_t ChironTFT::command_len;
|
|
|
|
|
float ChironTFT::live_Zoffset;
|
|
|
|
|
file_menu_t ChironTFT::file_menu;
|
|
|
|
|
|
|
|
|
|
ChironTFT Chiron;
|
|
|
|
|
|
|
|
|
|
ChironTFT::ChironTFT(){}
|
|
|
|
|
|
|
|
|
|
void ChironTFT::Startup() {
|
|
|
|
|
selectedfile[0] = '\0';
|
|
|
|
|
panel_command[0] = '\0';
|
|
|
|
|
command_len = 0;
|
|
|
|
|
last_error = AC_error_none;
|
|
|
|
|
printer_state = AC_printer_idle;
|
|
|
|
|
pause_state = AC_paused_idle;
|
|
|
|
|
hotend_state = AC_heater_off;
|
|
|
|
@ -80,27 +82,41 @@ void ChironTFT::Startup() {
|
|
|
|
|
// 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_enable FIL_RUNOUT_PULLUP
|
|
|
|
|
|
|
|
|
|
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
|
|
|
|
|
SendtoTFTLN(AC_msg_main_board_has_reset);
|
|
|
|
|
|
|
|
|
|
safe_delay(200);
|
|
|
|
|
|
|
|
|
|
// 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
|
|
|
|
|
injectCommands_P(AC_cmnd_enable_leveling);
|
|
|
|
|
|
|
|
|
|
// Startup tunes are defined in Tunes.h
|
|
|
|
|
//PlayTune(BEEPER_PIN, Anycubic_PowerOn, 1);
|
|
|
|
|
PlayTune(BEEPER_PIN, GB_PowerOn, 1);
|
|
|
|
|
PlayTune(BEEPER_PIN, TERN(AC_DEFAULT_STARTUP_TUNE, Anycubic_PowerOn, GB_PowerOn), 1);
|
|
|
|
|
|
|
|
|
|
#if ACDEBUGLEVEL
|
|
|
|
|
SERIAL_ECHOLNPAIR("AC Debug Level ", ACDEBUGLEVEL);
|
|
|
|
|
#endif
|
|
|
|
|
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() {
|
|
|
|
|
if (ReadTFTCommand()) {
|
|
|
|
|
ProcessPanelRequest();
|
|
|
|
@ -123,15 +139,16 @@ void ChironTFT::MediaEvent(media_event_t event) {
|
|
|
|
|
switch (event) {
|
|
|
|
|
case AC_media_inserted:
|
|
|
|
|
SendtoTFTLN(AC_msg_sd_card_inserted);
|
|
|
|
|
break;
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case AC_media_removed:
|
|
|
|
|
SendtoTFTLN(AC_msg_sd_card_removed);
|
|
|
|
|
break;
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case AC_media_error:
|
|
|
|
|
last_error = AC_error_noSD;
|
|
|
|
|
SendtoTFTLN(AC_msg_no_sd_card);
|
|
|
|
|
break;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -170,8 +187,8 @@ void ChironTFT::FilamentRunout() {
|
|
|
|
|
SERIAL_ECHOLNPAIR("FilamentRunout() printer_state ", printer_state);
|
|
|
|
|
#endif
|
|
|
|
|
// 1 Signal filament out
|
|
|
|
|
last_error = AC_error_filament_runout;
|
|
|
|
|
SendtoTFTLN(isPrintingFromMedia() ? AC_msg_filament_out_alert : AC_msg_filament_out_block);
|
|
|
|
|
//printer_state = AC_printer_filament_out;
|
|
|
|
|
PlayTune(BEEPER_PIN, FilamentOut, 1);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -278,14 +295,23 @@ void ChironTFT::StatusChange(const char * const msg) {
|
|
|
|
|
SendtoTFTLN(AC_msg_bed_heating);
|
|
|
|
|
hotbed_state = AC_heater_temp_set;
|
|
|
|
|
}
|
|
|
|
|
else if (strcmp_P(msg, MARLIN_msg_EEPROM_version) == 0) {
|
|
|
|
|
last_error = AC_error_EEPROM;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void ChironTFT::PowerLossRecovery() {
|
|
|
|
|
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);
|
|
|
|
|
SERIAL_ECHOLNPGM("Resuming from power outage...");
|
|
|
|
|
SERIAL_ECHOLNPGM("Select SD file then press resume");
|
|
|
|
|
SERIAL_ECHOLNPGM_P(AC_msg_powerloss_recovery);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
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
|
|
|
|
@ -319,26 +345,29 @@ bool ChironTFT::ReadTFTCommand() {
|
|
|
|
|
command_len++;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (command_ready) {
|
|
|
|
|
panel_command[command_len] = 0x00;
|
|
|
|
|
if (command_ready || command_len == MAX_CMND_LEN) {
|
|
|
|
|
panel_command[command_len] = '\0';
|
|
|
|
|
#if ACDEBUG(AC_ALL)
|
|
|
|
|
SERIAL_ECHOLNPAIR("< ", 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);
|
|
|
|
|
}
|
|
|
|
|
SERIAL_ECHOLNPAIR("len(",command_len,") < ", panel_command);
|
|
|
|
|
#endif
|
|
|
|
|
command_ready = true;
|
|
|
|
|
}
|
|
|
|
|
return command_ready;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int8_t ChironTFT::Findcmndpos(const char * buff, char q) {
|
|
|
|
|
int8_t ChironTFT::FindToken(char c) {
|
|
|
|
|
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;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -352,6 +381,7 @@ void ChironTFT::CheckHeaters() {
|
|
|
|
|
faultDuration++;
|
|
|
|
|
if (faultDuration >= AC_HEATER_FAULT_VALIDATION_TIME) {
|
|
|
|
|
SendtoTFTLN(AC_msg_nozzle_temp_abnormal);
|
|
|
|
|
last_error = AC_error_abnormal_temp_t0;
|
|
|
|
|
SERIAL_ECHOLNPAIR("Extruder temp abnormal! : ", temp);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
@ -366,6 +396,7 @@ void ChironTFT::CheckHeaters() {
|
|
|
|
|
faultDuration++;
|
|
|
|
|
if (faultDuration >= AC_HEATER_FAULT_VALIDATION_TIME) {
|
|
|
|
|
SendtoTFTLN(AC_msg_nozzle_temp_abnormal);
|
|
|
|
|
last_error = AC_error_abnormal_temp_bed;
|
|
|
|
|
SERIAL_ECHOLNPAIR("Bed temp abnormal! : ", temp);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
@ -396,15 +427,21 @@ void ChironTFT::SendFileList(int8_t startindex) {
|
|
|
|
|
SERIAL_ECHOLNPAIR("## SendFileList ## ", startindex);
|
|
|
|
|
#endif
|
|
|
|
|
SendtoTFTLN(PSTR("FN "));
|
|
|
|
|
filenavigator.getFiles(startindex);
|
|
|
|
|
filenavigator.getFiles(startindex, panel_type, 4);
|
|
|
|
|
SendtoTFTLN(PSTR("END"));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void ChironTFT::SelectFile() {
|
|
|
|
|
strncpy(selectedfile, panel_command + 4, command_len - 4);
|
|
|
|
|
selectedfile[command_len - 5] = '\0';
|
|
|
|
|
if (panel_type == AC_panel_new) {
|
|
|
|
|
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)
|
|
|
|
|
SERIAL_ECHOLNPAIR_F(" Selected File: ",selectedfile);
|
|
|
|
|
SERIAL_ECHOLNPAIR(" Selected File: ",selectedfile);
|
|
|
|
|
#endif
|
|
|
|
|
switch (selectedfile[0]) {
|
|
|
|
|
case '/': // Valid file selected
|
|
|
|
@ -417,6 +454,9 @@ void ChironTFT::SelectFile() {
|
|
|
|
|
SendFileList( 0 );
|
|
|
|
|
break;
|
|
|
|
|
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);
|
|
|
|
|
SendtoTFTLN(AC_msg_sd_file_open_failed);
|
|
|
|
|
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() {
|
|
|
|
|
// 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
|
|
|
|
|
if (req <= 8 || req == 33) PanelInfo(req);
|
|
|
|
|
// Information requests A0 - A8 and A33
|
|
|
|
|
if (req <= 8 || req == 33) PanelInfo(req);
|
|
|
|
|
|
|
|
|
|
// Simple Actions A9 - A28
|
|
|
|
|
else if ( req <= 28) PanelAction(req);
|
|
|
|
|
// Simple Actions A9 - A28
|
|
|
|
|
else if (req <= 28) PanelAction(req);
|
|
|
|
|
|
|
|
|
|
// Process Initiation
|
|
|
|
|
else if (req <= 34) PanelProcess(req);
|
|
|
|
|
// Process Initiation
|
|
|
|
|
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) {
|
|
|
|
@ -513,7 +576,8 @@ void ChironTFT::PanelInfo(uint8_t req) {
|
|
|
|
|
|
|
|
|
|
case 33: // A33 Get firmware info
|
|
|
|
|
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;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -567,11 +631,7 @@ void ChironTFT::PanelAction(uint8_t req) {
|
|
|
|
|
#if ACDebugLevel >= 1
|
|
|
|
|
SERIAL_ECHOLNPAIR_F("Print: ", selectedfile);
|
|
|
|
|
#endif
|
|
|
|
|
// the card library needs a path starting // but the File api doesn't...
|
|
|
|
|
char file[MAX_PATH_LEN];
|
|
|
|
|
file[0] = '/';
|
|
|
|
|
strcpy(file + 1, selectedfile);
|
|
|
|
|
printFile(file);
|
|
|
|
|
printFile(selectedfile);
|
|
|
|
|
SendtoTFTLN(AC_msg_print_from_sd_card);
|
|
|
|
|
} break;
|
|
|
|
|
|
|
|
|
@ -631,29 +691,24 @@ void ChironTFT::PanelAction(uint8_t req) {
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case 22: // A22 Move Axis A22 Y +10F3000
|
|
|
|
|
// Ignore request if printing
|
|
|
|
|
if (!isPrinting()) {
|
|
|
|
|
// setAxisPosition_mm() uses pre defined manual feedrates so ignore the feedrate from the panel
|
|
|
|
|
setSoftEndstopState(true); // enable endstops
|
|
|
|
|
float newposition = atof(&panel_command[6]);
|
|
|
|
|
case 22: { // A22 Move Axis
|
|
|
|
|
// The commands have changed on the new panel
|
|
|
|
|
// Old TFT A22 X -1F1500 A22 X +1F1500
|
|
|
|
|
// New TFT A22 X-1.0 F1500 A22 X1.0 F1500
|
|
|
|
|
|
|
|
|
|
// 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)
|
|
|
|
|
SERIAL_ECHOLNPAIR("Nudge ", AS_CHAR(panel_command[4]), " axis ", newposition);
|
|
|
|
|
SERIAL_ECHOLNPAIR("Move: ", MoveCmnd);
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
switch (panel_command[4]) {
|
|
|
|
|
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;
|
|
|
|
|
}
|
|
|
|
|
setSoftEndstopState(true); // enable endstops
|
|
|
|
|
injectCommands(MoveCmnd);
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
} break;
|
|
|
|
|
|
|
|
|
|
case 23: // A23 Preheat PLA
|
|
|
|
|
// Ignore request if printing
|
|
|
|
@ -690,7 +745,9 @@ void ChironTFT::PanelAction(uint8_t req) {
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
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();
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
@ -710,8 +767,8 @@ void ChironTFT::PanelProcess(uint8_t req) {
|
|
|
|
|
case 29: { // A29 Read Mesh Point A29 X1 Y1
|
|
|
|
|
xy_uint8_t pos;
|
|
|
|
|
float pos_z;
|
|
|
|
|
pos.x = atoi(&panel_command[5]);
|
|
|
|
|
pos.y = atoi(&panel_command[8]);
|
|
|
|
|
pos.x = atoi(&panel_command[FindToken('X')+1]);
|
|
|
|
|
pos.y = atoi(&panel_command[FindToken('Y')+1]);
|
|
|
|
|
pos_z = getMeshPoint(pos);
|
|
|
|
|
|
|
|
|
|
SendtoTFT(PSTR("A29V "));
|
|
|
|
@ -743,48 +800,60 @@ void ChironTFT::PanelProcess(uint8_t req) {
|
|
|
|
|
}
|
|
|
|
|
} break;
|
|
|
|
|
|
|
|
|
|
case 30: { // A30 Auto leveling
|
|
|
|
|
if (panel_command[3] == 'S') { // Start probing
|
|
|
|
|
case 30: { // A30 Auto leveling
|
|
|
|
|
if (FindToken('S') != -1) { // Start probing New panel adds spaces..
|
|
|
|
|
// Ignore request if printing
|
|
|
|
|
if (isPrinting())
|
|
|
|
|
SendtoTFTLN(AC_msg_probing_not_allowed); // forbid auto leveling
|
|
|
|
|
else {
|
|
|
|
|
injectCommands_P(PSTR("G28O\nG29"));
|
|
|
|
|
printer_state = AC_printer_probing;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
SendtoTFTLN(AC_msg_start_probing);
|
|
|
|
|
injectCommands_P(PSTR("G28\nG29"));
|
|
|
|
|
printer_state = AC_printer_probing;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else SendtoTFTLN(AC_msg_start_probing);
|
|
|
|
|
} break;
|
|
|
|
|
else {
|
|
|
|
|
SendtoTFTLN(AC_msg_start_probing); // Just enter levelling menu
|
|
|
|
|
}
|
|
|
|
|
} break;
|
|
|
|
|
|
|
|
|
|
case 31: { // A31 Adjust all Probe Points
|
|
|
|
|
switch (panel_command[3]) {
|
|
|
|
|
case 'C': // Restore and apply original offsets
|
|
|
|
|
if (!isPrinting()) {
|
|
|
|
|
injectCommands_P(PSTR("M501\nM420 S1"));
|
|
|
|
|
selectedmeshpoint.x = selectedmeshpoint.y = 99;
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case 'D': // Save Z Offset tables and restore leveling state
|
|
|
|
|
if (!isPrinting()) {
|
|
|
|
|
setAxisPosition_mm(1.0,Z);
|
|
|
|
|
injectCommands_P(PSTR("M500"));
|
|
|
|
|
selectedmeshpoint.x = selectedmeshpoint.y = 99;
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case 'G': // Get current offset
|
|
|
|
|
SendtoTFT(PSTR("A31V "));
|
|
|
|
|
// When printing use the live z Offset position
|
|
|
|
|
// we will use babystepping to move the print head
|
|
|
|
|
if (isPrinting())
|
|
|
|
|
TFTSer.println(live_Zoffset);
|
|
|
|
|
else {
|
|
|
|
|
TFTSer.println(getZOffset_mm());
|
|
|
|
|
selectedmeshpoint.x = selectedmeshpoint.y = 99;
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case 'S': { // Set offset (adjusts all points by value)
|
|
|
|
|
float Zshift = atof(&panel_command[4]);
|
|
|
|
|
// The tokens can occur in different places on the new panel so we need to find it.
|
|
|
|
|
|
|
|
|
|
if (FindToken('C') != -1) { // Restore and apply original offsets
|
|
|
|
|
if (!isPrinting()) {
|
|
|
|
|
injectCommands_P(PSTR("M501\nM420 S1"));
|
|
|
|
|
selectedmeshpoint.x = selectedmeshpoint.y = 99;
|
|
|
|
|
SERIAL_ECHOLNPGM_P(AC_msg_mesh_changes_abandoned);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
else if (FindToken('D') != -1) { // Save Z Offset tables and restore leveling state
|
|
|
|
|
if (!isPrinting()) {
|
|
|
|
|
setAxisPosition_mm(1.0,Z); // Lift nozzle before any further movements are made
|
|
|
|
|
injectCommands_P(PSTR("M500"));
|
|
|
|
|
SERIAL_ECHOLNPGM_P(AC_msg_mesh_changes_saved);
|
|
|
|
|
selectedmeshpoint.x = selectedmeshpoint.y = 99;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
else if (FindToken('G') != -1) { // Get current offset
|
|
|
|
|
SendtoTFT(PSTR("A31V "));
|
|
|
|
|
// When printing use the live z Offset position
|
|
|
|
|
// we will use babystepping to move the print head
|
|
|
|
|
if (isPrinting())
|
|
|
|
|
TFTSer.println(live_Zoffset);
|
|
|
|
|
else {
|
|
|
|
|
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
|
|
|
|
|
// Allow temporary Z position nudging during print
|
|
|
|
|
// 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 float currval = getMeshPoint(pos);
|
|
|
|
|
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();
|
|
|
|
|
#if ACDEBUG(AC_INFO)
|
|
|
|
@ -878,9 +950,27 @@ void ChironTFT::PanelProcess(uint8_t req) {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
} break;
|
|
|
|
|
|
|
|
|
|
case 36: // A36 Auto leveling for new TFT bet that was a typo in the panel code!
|
|
|
|
|
SendtoTFTLN(AC_msg_start_probing);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
} // Anycubic
|
|
|
|
|
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 namespace
|
|
|
|
|
|
|
|
|
|
#endif // ANYCUBIC_LCD_CHIRON
|
|
|
|
|