|
|
@ -43,22 +43,22 @@ |
|
|
|
|
|
|
|
namespace Anycubic { |
|
|
|
|
|
|
|
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]; |
|
|
|
uint8_t ChironTFT::command_len; |
|
|
|
float ChironTFT::live_Zoffset; |
|
|
|
file_menu_t ChironTFT::file_menu; |
|
|
|
|
|
|
|
ChironTFT Chiron; |
|
|
|
|
|
|
|
ChironTFT::ChironTFT(){} |
|
|
|
|
|
|
|
void ChironTFT::Startup() { |
|
|
|
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]; |
|
|
|
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; |
|
|
@ -99,24 +99,24 @@ namespace Anycubic { |
|
|
|
SERIAL_ECHOLNPAIR("AC Debug Level ", ACDEBUGLEVEL); |
|
|
|
#endif |
|
|
|
SendtoTFTLN(AC_msg_ready); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
void ChironTFT::IdleLoop() { |
|
|
|
void ChironTFT::IdleLoop() { |
|
|
|
if (ReadTFTCommand()) { |
|
|
|
ProcessPanelRequest(); |
|
|
|
command_len = 0; |
|
|
|
} |
|
|
|
CheckHeaters(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
void ChironTFT::PrinterKilled(PGM_P error,PGM_P component) { |
|
|
|
void ChironTFT::PrinterKilled(PGM_P error,PGM_P component) { |
|
|
|
SendtoTFTLN(AC_msg_kill_lcd); |
|
|
|
#if ACDEBUG(AC_MARLIN) |
|
|
|
SERIAL_ECHOLNPAIR("PrinterKilled()\nerror: ", error , "\ncomponent: ", component); |
|
|
|
#endif |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
void ChironTFT::MediaEvent(media_event_t event) { |
|
|
|
void ChironTFT::MediaEvent(media_event_t event) { |
|
|
|
#if ACDEBUG(AC_MARLIN) |
|
|
|
SERIAL_ECHOLNPAIR("ProcessMediaStatus() ", event); |
|
|
|
#endif |
|
|
@ -133,9 +133,9 @@ namespace Anycubic { |
|
|
|
SendtoTFTLN(AC_msg_no_sd_card); |
|
|
|
break; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
void ChironTFT::TimerEvent(timer_event_t event) { |
|
|
|
void ChironTFT::TimerEvent(timer_event_t event) { |
|
|
|
#if ACDEBUG(AC_MARLIN) |
|
|
|
SERIAL_ECHOLNPAIR("TimerEvent() ", event); |
|
|
|
SERIAL_ECHOLNPAIR("Printer State: ", printer_state); |
|
|
@ -163,9 +163,9 @@ namespace Anycubic { |
|
|
|
setSoftEndstopState(true); // enable endstops
|
|
|
|
} break; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
void ChironTFT::FilamentRunout() { |
|
|
|
void ChironTFT::FilamentRunout() { |
|
|
|
#if ACDEBUG(AC_MARLIN) |
|
|
|
SERIAL_ECHOLNPAIR("FilamentRunout() printer_state ", printer_state); |
|
|
|
#endif |
|
|
@ -173,9 +173,9 @@ namespace Anycubic { |
|
|
|
SendtoTFTLN(isPrintingFromMedia() ? AC_msg_filament_out_alert : AC_msg_filament_out_block); |
|
|
|
//printer_state = AC_printer_filament_out;
|
|
|
|
PlayTune(BEEPER_PIN, FilamentOut, 1); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
void ChironTFT::ConfirmationRequest(const char * const msg) { |
|
|
|
void ChironTFT::ConfirmationRequest(const char * const msg) { |
|
|
|
// M108 continue
|
|
|
|
#if ACDEBUG(AC_MARLIN) |
|
|
|
SERIAL_ECHOLNPAIR("ConfirmationRequest() ", msg, " printer_state:", printer_state); |
|
|
@ -211,9 +211,9 @@ namespace Anycubic { |
|
|
|
default: |
|
|
|
break; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
void ChironTFT::StatusChange(const char * const msg) { |
|
|
|
void ChironTFT::StatusChange(const char * const msg) { |
|
|
|
#if ACDEBUG(AC_MARLIN) |
|
|
|
SERIAL_ECHOLNPAIR("StatusChange() ", msg); |
|
|
|
SERIAL_ECHOLNPAIR("printer_state:", printer_state); |
|
|
@ -279,23 +279,23 @@ namespace Anycubic { |
|
|
|
hotbed_state = AC_heater_temp_set; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
void ChironTFT::PowerLossRecovery() { |
|
|
|
void ChironTFT::PowerLossRecovery() { |
|
|
|
printer_state = AC_printer_resuming_from_power_outage; // Play tune to notify user we can recover.
|
|
|
|
PlayTune(BEEPER_PIN, SOS, 1); |
|
|
|
SERIAL_ECHOLNPGM("Resuming from power outage..."); |
|
|
|
SERIAL_ECHOLNPGM("Select SD file then press resume"); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
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
|
|
|
|
#if ACDEBUG(AC_SOME) |
|
|
|
SERIAL_ECHOPGM_P(str); |
|
|
|
#endif |
|
|
|
while (const char c = pgm_read_byte(str++)) TFTSer.write(c); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
void ChironTFT::SendtoTFTLN(PGM_P str = nullptr) { |
|
|
|
void ChironTFT::SendtoTFTLN(PGM_P str = nullptr) { |
|
|
|
if (str) { |
|
|
|
#if ACDEBUG(AC_SOME) |
|
|
|
SERIAL_ECHOPGM("> "); |
|
|
@ -306,9 +306,9 @@ namespace Anycubic { |
|
|
|
#endif |
|
|
|
} |
|
|
|
TFTSer.println(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
bool ChironTFT::ReadTFTCommand() { |
|
|
|
bool ChironTFT::ReadTFTCommand() { |
|
|
|
bool command_ready = false; |
|
|
|
while (TFTSer.available() > 0 && command_len < MAX_CMND_LEN) { |
|
|
|
panel_command[command_len] = TFTSer.read(); |
|
|
@ -334,15 +334,15 @@ namespace Anycubic { |
|
|
|
#endif |
|
|
|
} |
|
|
|
return command_ready; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
int8_t ChironTFT::Findcmndpos(const char * buff, char q) { |
|
|
|
int8_t ChironTFT::Findcmndpos(const char * buff, char q) { |
|
|
|
int8_t pos = 0; |
|
|
|
do { if (buff[pos] == q) return pos; } while (++pos < MAX_CMND_LEN); |
|
|
|
return -1; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
void ChironTFT::CheckHeaters() { |
|
|
|
void ChironTFT::CheckHeaters() { |
|
|
|
uint8_t faultDuration = 0; |
|
|
|
float temp = 0; |
|
|
|
|
|
|
@ -388,9 +388,9 @@ namespace Anycubic { |
|
|
|
hotbed_state = AC_heater_temp_reached; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
void ChironTFT::SendFileList(int8_t startindex) { |
|
|
|
void ChironTFT::SendFileList(int8_t startindex) { |
|
|
|
// Respond to panel request for 4 files starting at index
|
|
|
|
#if ACDEBUG(AC_INFO) |
|
|
|
SERIAL_ECHOLNPAIR("## SendFileList ## ", startindex); |
|
|
@ -398,9 +398,9 @@ namespace Anycubic { |
|
|
|
SendtoTFTLN(PSTR("FN ")); |
|
|
|
filenavigator.getFiles(startindex); |
|
|
|
SendtoTFTLN(PSTR("END")); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
void ChironTFT::SelectFile() { |
|
|
|
void ChironTFT::SelectFile() { |
|
|
|
strncpy(selectedfile, panel_command + 4, command_len - 4); |
|
|
|
selectedfile[command_len - 5] = '\0'; |
|
|
|
#if ACDEBUG(AC_FILE) |
|
|
@ -422,14 +422,14 @@ namespace Anycubic { |
|
|
|
SendFileList( 0 ); |
|
|
|
break; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
void ChironTFT::InjectCommandandWait(PGM_P cmd) { |
|
|
|
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!
|
|
|
|
int8_t req = atoi(&panel_command[1]); |
|
|
|
|
|
|
@ -443,9 +443,9 @@ namespace Anycubic { |
|
|
|
else if (req <= 34) PanelProcess(req); |
|
|
|
|
|
|
|
else SendtoTFTLN(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
void ChironTFT::PanelInfo(uint8_t req) { |
|
|
|
void ChironTFT::PanelInfo(uint8_t req) { |
|
|
|
// information requests A0-A8 and A33
|
|
|
|
switch (req) { |
|
|
|
case 0: // A0 Get HOTEND Temp
|
|
|
@ -516,9 +516,9 @@ namespace Anycubic { |
|
|
|
SendtoTFTLN(PSTR(SHORT_BUILD_VERSION)); |
|
|
|
break; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
void ChironTFT::PanelAction(uint8_t req) { |
|
|
|
void ChironTFT::PanelAction(uint8_t req) { |
|
|
|
switch (req) { |
|
|
|
case 9: // A9 Pause SD print
|
|
|
|
if (isPrintingFromMedia()) { |
|
|
@ -703,9 +703,9 @@ namespace Anycubic { |
|
|
|
SendtoTFTLN(); |
|
|
|
break; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
void ChironTFT::PanelProcess(uint8_t req) { |
|
|
|
void ChironTFT::PanelProcess(uint8_t req) { |
|
|
|
switch (req) { |
|
|
|
case 29: { // A29 Read Mesh Point A29 X1 Y1
|
|
|
|
xy_uint8_t pos; |
|
|
@ -832,8 +832,8 @@ namespace Anycubic { |
|
|
|
setAxisPosition_mm(currZpos+constrain(Zshift,-0.05,0.05),Z); |
|
|
|
} |
|
|
|
} |
|
|
|
} break; |
|
|
|
} // end switch
|
|
|
|
} |
|
|
|
} |
|
|
|
} break; |
|
|
|
|
|
|
|
case 32: { // A32 clean leveling beep flag
|
|
|
@ -843,7 +843,7 @@ namespace Anycubic { |
|
|
|
//TFTSer.println();
|
|
|
|
} break; |
|
|
|
|
|
|
|
// A33 firmware info request seet PanelInfo()
|
|
|
|
// A33 firmware info request see PanelInfo()
|
|
|
|
|
|
|
|
case 34: { // A34 Adjust single mesh point A34 C/S X1 Y1 V123
|
|
|
|
if (panel_command[3] == 'C') { // Restore original offsets
|
|
|
@ -879,7 +879,7 @@ namespace Anycubic { |
|
|
|
} |
|
|
|
} break; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} // Anycubic
|
|
|
|
|
|
|
|