Merge upstream changes from Marlin 2.1.1

This commit is contained in:
Stefan Kalscheuer
2022-09-03 09:23:32 +02:00
parent 626283aadb
commit 986e416c7f
1610 changed files with 73839 additions and 40857 deletions

View File

@@ -155,9 +155,9 @@ void FileNavigator::skiptofileindex(uint16_t skip) {
if (currentindex == 0 && currentfolderdepth > 0) { // Add a link to go up a folder
// The new panel ignores entries that don't end in .GCO or .gcode so add and pad them.
if (paneltype == AC_panel_new) {
if (paneltype <= AC_panel_new) {
TFTSer.println("<<.GCO");
Chiron.SendtoTFTLN(PSTR(".. .gcode"));
Chiron.SendtoTFTLN(F(".. .gcode"));
}
else {
TFTSer.println("<<");
@@ -177,7 +177,7 @@ void FileNavigator::skiptofileindex(uint16_t skip) {
void FileNavigator::sendFile(panel_type_t paneltype) {
if (filelist.isDir()) {
// Add mandatory tags for new panel otherwise lines are ignored.
if (paneltype == AC_panel_new) {
if (paneltype <= AC_panel_new) {
TFTSer.print(filelist.shortFilename());
TFTSer.println(".GCO");
TFTSer.print(filelist.shortFilename());

View File

@@ -35,6 +35,8 @@
#include "../../../inc/MarlinConfigPre.h"
// TODO: Use Marlin's built-in tone player instead.
#if ENABLED(ANYCUBIC_LCD_CHIRON)
#include "Tunes.h"
@@ -44,15 +46,12 @@ namespace Anycubic {
void PlayTune(uint8_t beeperPin, const uint16_t *tune, uint8_t speed=1) {
uint8_t pos = 1;
uint16_t wholenotelen = tune[0] / speed;
const uint16_t wholenotelen = tune[0] / speed;
do {
uint16_t freq = tune[pos];
uint16_t notelen = wholenotelen / tune[pos + 1];
const uint16_t freq = tune[pos], notelen = wholenotelen / tune[pos + 1];
::tone(beeperPin, freq, notelen);
ExtUI::delay_ms(notelen);
pos += 2;
if (pos >= MAX_TUNE_LENGTH) break;
} while (tune[pos] != n_END);
}

View File

@@ -41,8 +41,8 @@ namespace ExtUI {
void onIdle() { Chiron.IdleLoop(); }
void onPrinterKilled(PGM_P const error, PGM_P const component) {
Chiron.PrinterKilled(error,component);
void onPrinterKilled(FSTR_P const error, FSTR_P const component) {
Chiron.PrinterKilled(error, component);
}
void onMediaInserted() { Chiron.MediaEvent(AC_media_inserted); }
@@ -57,14 +57,16 @@ namespace ExtUI {
void onPrintTimerStarted() { Chiron.TimerEvent(AC_timer_started); }
void onPrintTimerPaused() { Chiron.TimerEvent(AC_timer_paused); }
void onPrintTimerStopped() { Chiron.TimerEvent(AC_timer_stopped); }
void onPrintTimerStopped() { Chiron.TimerEvent(AC_timer_stopped); }
void onPrintDone() {}
void onFilamentRunout(const extruder_t) { Chiron.FilamentRunout(); }
void onUserConfirmRequired(const char * const msg) { Chiron.ConfirmationRequest(msg); }
void onStatusChanged(const char * const msg) { Chiron.StatusChange(msg); }
void onHomingStart() {}
void onHomingComplete() {}
void onPrintFinished() {}
void onHomingDone() {}
void onFactoryReset() {}
@@ -92,18 +94,19 @@ namespace ExtUI {
// Called after loading or resetting stored settings
}
void onConfigurationStoreWritten(bool success) {
void onSettingsStored(bool success) {
// Called after the entire EEPROM has been written,
// whether successful or not.
}
void onConfigurationStoreRead(bool success) {
void onSettingsLoaded(bool success) {
// Called after the entire EEPROM has been read,
// whether successful or not.
}
#if HAS_MESH
void onMeshLevelingStart() {}
void onLevelingStart() {}
void onLevelingDone() {}
void onMeshUpdate(const int8_t xpos, const int8_t ypos, const_float_t zval) {
// Called when any mesh points are updated

View File

@@ -85,21 +85,31 @@ void ChironTFT::Startup() {
// opt_enable FIL_RUNOUT_PULLUP
TFTSer.begin(115200);
// wait for the TFT panel to initialise and finish the animation
delay_ms(250);
// Wait for the TFT panel to initialize and finish the animation
safe_delay(1000);
// 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();
switch (panel_type) {
case AC_panel_new:
SERIAL_ECHOLNF(AC_msg_new_panel_set);
break;
case AC_panel_standard:
SERIAL_ECHOLNF(AC_msg_old_panel_set);
break;
default:
SERIAL_ECHOLNF(AC_msg_auto_panel_detection);
DetectPanelType();
break;
}
// Signal Board has reset
SendtoTFTLN(AC_msg_main_board_has_reset);
// 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);
injectCommands(AC_cmnd_enable_leveling);
// Startup tunes are defined in Tunes.h
PlayTune(BEEPER_PIN, TERN(AC_DEFAULT_STARTUP_TUNE, Anycubic_PowerOn, GB_PowerOn), 1);
@@ -126,7 +136,7 @@ void ChironTFT::IdleLoop() {
CheckHeaters();
}
void ChironTFT::PrinterKilled(PGM_P error,PGM_P component) {
void ChironTFT::PrinterKilled(FSTR_P const error, FSTR_P const component) {
SendtoTFTLN(AC_msg_kill_lcd);
#if ACDEBUG(AC_MARLIN)
SERIAL_ECHOLNPGM("PrinterKilled()\nerror: ", error , "\ncomponent: ", component);
@@ -243,8 +253,8 @@ void ChironTFT::StatusChange(const char * const msg) {
case AC_printer_probing: {
// If probing completes ok save the mesh and park
// Ignore the custom machine name
if (strcmp_P(msg + strlen(CUSTOM_MACHINE_NAME), MARLIN_msg_ready) == 0) {
injectCommands_P(PSTR("M500\nG27"));
if (strcmp_P(msg + strlen(MACHINE_NAME), MARLIN_msg_ready) == 0) {
injectCommands(F("M500\nG27"));
SendtoTFTLN(AC_msg_probing_complete);
printer_state = AC_printer_idle;
msg_matched = true;
@@ -252,7 +262,7 @@ void ChironTFT::StatusChange(const char * const msg) {
// If probing fails don't save the mesh raise the probe above the bad point
if (strcmp_P(msg, MARLIN_msg_probing_failed) == 0) {
PlayTune(BEEPER_PIN, BeepBeepBeeep, 1);
injectCommands_P(PSTR("G1 Z50 F500"));
injectCommands(F("G1 Z50 F500"));
SendtoTFTLN(AC_msg_probing_complete);
printer_state = AC_printer_idle;
msg_matched = true;
@@ -306,7 +316,7 @@ 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_P(AC_msg_powerloss_recovery);
SERIAL_ECHOLNF(AC_msg_powerloss_recovery);
}
void ChironTFT::PrintComplete() {
@@ -315,19 +325,20 @@ void ChironTFT::PrintComplete() {
setSoftEndstopState(true); // enable endstops
}
void ChironTFT::SendtoTFT(PGM_P str) { // A helper to print PROGMEM string to the panel
void ChironTFT::SendtoTFT(FSTR_P const fstr/*=nullptr*/) { // A helper to print PROGMEM string to the panel
#if ACDEBUG(AC_SOME)
SERIAL_ECHOPGM_P(str);
SERIAL_ECHOF(fstr);
#endif
PGM_P str = FTOP(fstr);
while (const char c = pgm_read_byte(str++)) TFTSer.write(c);
}
void ChironTFT::SendtoTFTLN(PGM_P str = nullptr) {
if (str) {
void ChironTFT::SendtoTFTLN(FSTR_P const fstr/*=nullptr*/) {
if (fstr) {
#if ACDEBUG(AC_SOME)
SERIAL_ECHOPGM("> ");
#endif
SendtoTFT(str);
SendtoTFT(fstr);
#if ACDEBUG(AC_SOME)
SERIAL_EOL();
#endif
@@ -357,15 +368,14 @@ bool ChironTFT::ReadTFTCommand() {
}
int8_t ChironTFT::FindToken(char c) {
int8_t pos = 0;
do {
for (int8_t pos = 0; pos < command_len; pos++) {
if (panel_command[pos] == c) {
#if ACDEBUG(AC_INFO)
SERIAL_ECHOLNPGM("Tpos:", pos, " ", c);
#endif
return pos;
}
} while(++pos < command_len);
}
#if ACDEBUG(AC_INFO)
SERIAL_ECHOLNPGM("Not found: ", c);
#endif
@@ -426,13 +436,13 @@ void ChironTFT::SendFileList(int8_t startindex) {
#if ACDEBUG(AC_INFO)
SERIAL_ECHOLNPGM("## SendFileList ## ", startindex);
#endif
SendtoTFTLN(PSTR("FN "));
SendtoTFTLN(F("FN "));
filenavigator.getFiles(startindex, panel_type, 4);
SendtoTFTLN(PSTR("END"));
SendtoTFTLN(F("END"));
}
void ChironTFT::SelectFile() {
if (panel_type == AC_panel_new) {
if (panel_type <= AC_panel_new) {
strncpy(selectedfile, panel_command + 4, command_len - 3);
selectedfile[command_len - 4] = '\0';
}
@@ -455,7 +465,7 @@ void ChironTFT::SelectFile() {
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)
if (panel_type <= AC_panel_new)
selectedfile[strlen(selectedfile) - 4] = '\0';
filenavigator.changeDIR(selectedfile);
SendtoTFTLN(AC_msg_sd_file_open_failed);
@@ -468,8 +478,8 @@ void ChironTFT::ProcessPanelRequest() {
// Break these up into logical blocks // as its easier to navigate than one huge switch case!
int8_t tpos = FindToken('A');
// Panel request are 'A0' - 'A36'
if (tpos != -1) {
const int8_t req = atoi(&panel_command[tpos+1]);
if (tpos >= 0) {
const int8_t req = atoi(&panel_command[tpos + 1]);
// Information requests A0 - A8 and A33
if (req <= 8 || req == 33) PanelInfo(req);
@@ -485,18 +495,20 @@ void ChironTFT::ProcessPanelRequest() {
// 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') {
if (tpos >= 0) {
if (panel_command[tpos + 1] == 'X' && panel_command[tpos + 2] =='Y') {
panel_type = AC_panel_standard;
SERIAL_ECHOLNPGM_P(AC_msg_old_panel_detected);
SERIAL_ECHOLNF(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]==']') {
// new panel will respond to 'J200' with '[0]=0'
// it seems only after a power cycle so detection assumes a new panel
tpos = FindToken('[');
if (tpos >= 0) {
if (panel_command[tpos + 1] == '0' && panel_command[tpos + 2] ==']') {
panel_type = AC_panel_new;
SERIAL_ECHOLNPGM_P(AC_msg_new_panel_detected);
SERIAL_ECHOLNF(AC_msg_new_panel_detected);
}
}
}
@@ -512,55 +524,55 @@ void ChironTFT::PanelInfo(uint8_t req) {
// information requests A0-A8 and A33
switch (req) {
case 0: // A0 Get HOTEND Temp
SendtoTFT(PSTR("A0V "));
SendtoTFT(F("A0V "));
TFTSer.println(getActualTemp_celsius(E0));
break;
case 1: // A1 Get HOTEND Target Temp
SendtoTFT(PSTR("A1V "));
SendtoTFT(F("A1V "));
TFTSer.println(getTargetTemp_celsius(E0));
break;
case 2: // A2 Get BED Temp
SendtoTFT(PSTR("A2V "));
SendtoTFT(F("A2V "));
TFTSer.println(getActualTemp_celsius(BED));
break;
case 3: // A3 Get BED Target Temp
SendtoTFT(PSTR("A3V "));
SendtoTFT(F("A3V "));
TFTSer.println(getTargetTemp_celsius(BED));
break;
case 4: // A4 Get FAN Speed
SendtoTFT(PSTR("A4V "));
SendtoTFT(F("A4V "));
TFTSer.println(getActualFan_percent(FAN0));
break;
case 5: // A5 Get Current Coordinates
SendtoTFT(PSTR("A5V X: "));
SendtoTFT(F("A5V X: "));
TFTSer.print(getAxisPosition_mm(X));
SendtoTFT(PSTR(" Y: "));
SendtoTFT(F(" Y: "));
TFTSer.print(getAxisPosition_mm(Y));
SendtoTFT(PSTR(" Z: "));
SendtoTFT(F(" Z: "));
TFTSer.println(getAxisPosition_mm(Z));
break;
case 6: // A6 Get printing progress
if (isPrintingFromMedia()) {
SendtoTFT(PSTR("A6V "));
SendtoTFT(F("A6V "));
TFTSer.println(ui8tostr2(getProgress_percent()));
}
else
SendtoTFTLN(PSTR("A6V ---"));
SendtoTFTLN(F("A6V ---"));
break;
case 7: { // A7 Get Printing Time
uint32_t time = getProgress_seconds_elapsed() / 60;
SendtoTFT(PSTR("A7V "));
SendtoTFT(F("A7V "));
TFTSer.print(ui8tostr2(time / 60));
SendtoTFT(PSTR(" H "));
SendtoTFT(F(" H "));
TFTSer.print(ui8tostr2(time % 60));
SendtoTFT(PSTR(" M"));
SendtoTFT(F(" M"));
#if ACDEBUG(AC_ALL)
SERIAL_ECHOLNPGM("Print time ", ui8tostr2(time / 60), ":", ui8tostr2(time % 60));
#endif
@@ -575,9 +587,9 @@ void ChironTFT::PanelInfo(uint8_t req) {
break;
case 33: // A33 Get firmware info
SendtoTFT(PSTR("J33 "));
SendtoTFT(F("J33 "));
// If there is an error recorded, show that instead of the FW version
if (!GetLastError()) SendtoTFTLN(PSTR(SHORT_BUILD_VERSION));
if (!GetLastError()) SendtoTFTLN(F(SHORT_BUILD_VERSION));
break;
}
}
@@ -608,7 +620,7 @@ void ChironTFT::PanelAction(uint8_t req) {
}
else {
if (printer_state == AC_printer_resuming_from_power_outage)
injectCommands_P(PSTR("M1000 C")); // Cancel recovery
injectCommands(F("M1000 C")); // Cancel recovery
SendtoTFTLN(AC_msg_stop);
printer_state = AC_printer_idle;
}
@@ -622,24 +634,24 @@ void ChironTFT::PanelAction(uint8_t req) {
SelectFile();
break;
case 14: { // A14 Start Printing
case 14: // A14 Start Printing
// Allows printer to restart the job if we don't want to recover
if (printer_state == AC_printer_resuming_from_power_outage) {
injectCommands_P(PSTR("M1000 C")); // Cancel recovery
injectCommands(F("M1000 C")); // Cancel recovery
printer_state = AC_printer_idle;
}
#if ACDebugLevel >= 1
SERIAL_ECHOLNPAIR_F("Print: ", selectedfile);
SERIAL_ECHOLNPGM("Print: ", selectedfile);
#endif
printFile(selectedfile);
SendtoTFTLN(AC_msg_print_from_sd_card);
} break;
break;
case 15: // A15 Resuming from outage
if (printer_state == AC_printer_resuming_from_power_outage) {
// Need to home here to restore the Z position
injectCommands_P(AC_cmnd_power_loss_recovery);
injectCommands_P(PSTR("M1000")); // home and start recovery
injectCommands(AC_cmnd_power_loss_recovery);
injectCommands(F("M1000")); // home and start recovery
}
break;
@@ -675,7 +687,7 @@ void ChironTFT::PanelAction(uint8_t req) {
if (panel_command[4] == 'S')
setFeedrate_percent(atoi(&panel_command[5]));
else {
SendtoTFT(PSTR("A20V "));
SendtoTFT(F("A20V "));
TFTSer.println(getFeedrate_percent());
}
break;
@@ -683,9 +695,9 @@ void ChironTFT::PanelAction(uint8_t req) {
case 21: // A21 Home Axis A21 X
if (!isPrinting()) {
switch ((char)panel_command[4]) {
case 'X': injectCommands_P(PSTR("G28X")); break;
case 'Y': injectCommands_P(PSTR("G28Y")); break;
case 'Z': injectCommands_P(PSTR("G28Z")); break;
case 'X': injectCommands(F("G28X")); break;
case 'Y': injectCommands(F("G28Y")); break;
case 'Z': injectCommands(F("G28Z")); break;
case 'C': injectCommands_P(G28_STR); break;
}
}
@@ -696,7 +708,7 @@ void ChironTFT::PanelAction(uint8_t req) {
// 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
// Send a G-code-relative non-print move and let the controller deal with it
// G91 G0 <panel command> G90
if (!isPrinting()) { // Ignore request if printing
@@ -771,7 +783,7 @@ void ChironTFT::PanelProcess(uint8_t req) {
pos.y = atoi(&panel_command[FindToken('Y')+1]);
pos_z = getMeshPoint(pos);
SendtoTFT(PSTR("A29V "));
SendtoTFT(F("A29V "));
TFTSer.println(pos_z * 100);
if (!isPrinting()) {
setSoftEndstopState(true); // disable endstops
@@ -800,46 +812,43 @@ void ChironTFT::PanelProcess(uint8_t req) {
}
} break;
case 30: { // A30 Auto leveling
if (FindToken('S') != -1) { // Start probing New panel adds spaces..
case 30: // A30 Auto leveling
if (FindToken('S') >= 0) { // Start probing New panel adds spaces..
// Ignore request if printing
if (isPrinting())
SendtoTFTLN(AC_msg_probing_not_allowed); // forbid auto leveling
else {
SendtoTFTLN(AC_msg_start_probing);
injectCommands_P(PSTR("G28\nG29"));
injectCommands(F("G28\nG29"));
printer_state = AC_printer_probing;
}
}
else {
else
SendtoTFTLN(AC_msg_start_probing); // Just enter levelling menu
}
} break;
break;
case 31: { // A31 Adjust all Probe Points
case 31: // A31 Adjust all Probe Points
// 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 (FindToken('C') >= 0) { // Restore and apply original offsets
if (!isPrinting()) {
injectCommands_P(PSTR("M501\nM420 S1"));
injectCommands(F("M501\nM420 S1"));
selectedmeshpoint.x = selectedmeshpoint.y = 99;
SERIAL_ECHOLNPGM_P(AC_msg_mesh_changes_abandoned);
SERIAL_ECHOLNF(AC_msg_mesh_changes_abandoned);
}
}
else if (FindToken('D') != -1) { // Save Z Offset tables and restore leveling state
else if (FindToken('D') >= 0) { // 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);
injectCommands(F("M500"));
SERIAL_ECHOLNF(AC_msg_mesh_changes_saved);
selectedmeshpoint.x = selectedmeshpoint.y = 99;
}
}
else if (FindToken('G') != -1) { // Get current offset
SendtoTFT(PSTR("A31V "));
else if (FindToken('G') >= 0) { // Get current offset
SendtoTFT(F("A31V "));
// When printing use the live z Offset position
// we will use babystepping to move the print head
if (isPrinting())
@@ -852,7 +861,7 @@ void ChironTFT::PanelProcess(uint8_t req) {
else {
int8_t tokenpos = FindToken('S');
if (tokenpos != -1) { // Set offset (adjusts all points by value)
if (tokenpos >= 0) { // 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
@@ -874,7 +883,7 @@ void ChironTFT::PanelProcess(uint8_t req) {
babystepAxis_steps(steps, Z);
live_Zoffset += Zshift;
}
SendtoTFT(PSTR("A31V "));
SendtoTFT(F("A31V "));
TFTSer.println(live_Zoffset);
}
else {
@@ -892,7 +901,7 @@ void ChironTFT::PanelProcess(uint8_t req) {
#endif
setZOffset_mm(currZOffset + Zshift);
SendtoTFT(PSTR("A31V "));
SendtoTFT(F("A31V "));
TFTSer.println(getZOffset_mm());
if (isAxisPositionKnown(Z)) {
@@ -906,20 +915,20 @@ void ChironTFT::PanelProcess(uint8_t req) {
}
}
}
} break;
break;
case 32: { // A32 clean leveling beep flag
case 32: // A32 clean leveling beep flag
// Ignore request if printing
//if (isPrinting()) break;
//injectCommands_P(PSTR("M500\nM420 S1\nG1 Z10 F240\nG1 X0 Y0 F6000"));
//injectCommands(F("M500\nM420 S1\nG1 Z10 F240\nG1 X0 Y0 F6000"));
//TFTSer.println();
} break;
break;
// A33 firmware info request see PanelInfo()
case 34: { // A34 Adjust single mesh point A34 C/S X1 Y1 V123
case 34: // A34 Adjust single mesh point A34 C/S X1 Y1 V123
if (panel_command[3] == 'C') { // Restore original offsets
injectCommands_P(PSTR("M501\nM420 S1"));
injectCommands(F("M501\nM420 S1"));
selectedmeshpoint.x = selectedmeshpoint.y = 99;
//printer_state = AC_printer_idle;
}
@@ -949,7 +958,7 @@ 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);

View File

@@ -59,16 +59,16 @@ class ChironTFT {
public:
static void Startup();
static void IdleLoop();
static void PrinterKilled(PGM_P,PGM_P);
static void PrinterKilled(FSTR_P, FSTR_P);
static void MediaEvent(media_event_t);
static void TimerEvent(timer_event_t);
static void FilamentRunout();
static void ConfirmationRequest(const char * const );
static void StatusChange(const char * const );
static void ConfirmationRequest(const char * const);
static void StatusChange(const char * const);
static void PowerLossRecovery();
static void PrintComplete();
static void SendtoTFT(PGM_P);
static void SendtoTFTLN(PGM_P);
static void SendtoTFT(FSTR_P const=nullptr);
static void SendtoTFTLN(FSTR_P const=nullptr);
private:
static void DetectPanelType();
static bool ReadTFTCommand();

View File

@@ -57,46 +57,50 @@
#define AC_LOWEST_MESHPOINT_VAL -10 // The lowest value you can set for a single mesh point offset
// TFT panel commands
#define AC_msg_sd_card_inserted PSTR("J00")
#define AC_msg_sd_card_removed PSTR("J01")
#define AC_msg_no_sd_card PSTR("J02")
#define AC_msg_usb_connected PSTR("J03")
#define AC_msg_print_from_sd_card PSTR("J04")
#define AC_msg_pause PSTR("J05")
#define AC_msg_nozzle_heating PSTR("J06")
#define AC_msg_nozzle_heating_done PSTR("J07")
#define AC_msg_bed_heating PSTR("J08")
#define AC_msg_bed_heating_done PSTR("J09")
#define AC_msg_nozzle_temp_abnormal PSTR("J10")
#define AC_msg_kill_lcd PSTR("J11")
#define AC_msg_ready PSTR("J12")
#define AC_msg_low_nozzle_temp PSTR("J13")
#define AC_msg_print_complete PSTR("J14")
#define AC_msg_filament_out_alert PSTR("J15")
#define AC_msg_stop PSTR("J16")
#define AC_msg_main_board_has_reset PSTR("J17")
#define AC_msg_paused PSTR("J18")
#define AC_msg_j19_unknown PSTR("J19")
#define AC_msg_sd_file_open_success PSTR("J20")
#define AC_msg_sd_file_open_failed PSTR("J21")
#define AC_msg_level_monitor_finished PSTR("J22")
#define AC_msg_filament_out_block PSTR("J23")
#define AC_msg_probing_not_allowed PSTR("J24")
#define AC_msg_probing_complete PSTR("J25")
#define AC_msg_start_probing PSTR("J26")
#define AC_msg_version PSTR("J27")
#define AC_msg_mesh_changes_abandoned PSTR("Mesh changes abandoned, previous mesh restored.")
#define AC_msg_mesh_changes_saved PSTR("Mesh changes saved.")
#define AC_msg_old_panel_detected PSTR("Standard TFT panel detected!")
#define AC_msg_new_panel_detected PSTR("New TFT panel detected!")
#define AC_msg_powerloss_recovery PSTR("Resuming from power outage! select the same SD file then press resume")
#define AC_msg_sd_card_inserted F("J00")
#define AC_msg_sd_card_removed F("J01")
#define AC_msg_no_sd_card F("J02")
#define AC_msg_usb_connected F("J03")
#define AC_msg_print_from_sd_card F("J04")
#define AC_msg_pause F("J05")
#define AC_msg_nozzle_heating F("J06")
#define AC_msg_nozzle_heating_done F("J07")
#define AC_msg_bed_heating F("J08")
#define AC_msg_bed_heating_done F("J09")
#define AC_msg_nozzle_temp_abnormal F("J10")
#define AC_msg_kill_lcd F("J11")
#define AC_msg_ready F("J12")
#define AC_msg_low_nozzle_temp F("J13")
#define AC_msg_print_complete F("J14")
#define AC_msg_filament_out_alert F("J15")
#define AC_msg_stop F("J16")
#define AC_msg_main_board_has_reset F("J17")
#define AC_msg_paused F("J18")
#define AC_msg_j19_unknown F("J19")
#define AC_msg_sd_file_open_success F("J20")
#define AC_msg_sd_file_open_failed F("J21")
#define AC_msg_level_monitor_finished F("J22")
#define AC_msg_filament_out_block F("J23")
#define AC_msg_probing_not_allowed F("J24")
#define AC_msg_probing_complete F("J25")
#define AC_msg_start_probing F("J26")
#define AC_msg_version F("J27")
#define AC_msg_mesh_changes_abandoned F("Mesh changes abandoned, previous mesh restored.")
#define AC_msg_mesh_changes_saved F("Mesh changes saved.")
#define AC_msg_old_panel_detected F("Standard TFT panel detected!")
#define AC_msg_new_panel_detected F("New TFT panel detected!")
#define AC_msg_auto_panel_detection F("Auto detect panel type (assuming new panel)")
#define AC_msg_old_panel_set F("Set for standard TFT panel.")
#define AC_msg_new_panel_set F("Set for new TFT panel.")
#define AC_msg_powerloss_recovery F("Resuming from power outage! select the same SD file then press resume")
// Error messages must not contain spaces
#define AC_msg_error_bed_temp PSTR("Abnormal_bed_temp")
#define AC_msg_error_hotend_temp PSTR("Abnormal_hotend_temp")
#define AC_msg_error_sd_card PSTR("SD_card_error")
#define AC_msg_filament_out PSTR("Filament_runout")
#define AC_msg_power_loss PSTR("Power_failure")
#define AC_msg_eeprom_version PSTR("EEPROM_ver_wrong")
#define AC_msg_error_bed_temp F("Abnormal_bed_temp")
#define AC_msg_error_hotend_temp F("Abnormal_hotend_temp")
#define AC_msg_error_sd_card F("SD_card_error")
#define AC_msg_filament_out F("Filament_runout")
#define AC_msg_power_loss F("Power_failure")
#define AC_msg_eeprom_version F("EEPROM_ver_wrong")
#define MARLIN_msg_start_probing PSTR("Probing Point 1/25")
#define MARLIN_msg_probing_failed PSTR("Probing Failed")
@@ -113,16 +117,16 @@
#define MARLIN_msg_filament_purging PSTR("Filament Purging...")
#define MARLIN_msg_special_pause PSTR("PB")
#define AC_cmnd_auto_unload_filament PSTR("M701") // Use Marlin unload routine
#define AC_cmnd_auto_load_filament PSTR("M702 M0 PB") // Use Marlin load routing then pause for user to clean nozzle
#define AC_cmnd_auto_unload_filament F("M701") // Use Marlin unload routine
#define AC_cmnd_auto_load_filament F("M702 M0 PB") // Use Marlin load routing then pause for user to clean nozzle
#define AC_cmnd_manual_load_filament PSTR("M83\nG1 E50 F700\nM82") // replace the manual panel commands with something a little faster
#define AC_cmnd_manual_unload_filament PSTR("M83\nG1 E-50 F1200\nM82")
#define AC_cmnd_enable_leveling PSTR("M420SV")
#define AC_cmnd_power_loss_recovery PSTR("G28XYR5\nG28Z") // Lift, home X and Y then home Z when in 'safe' position
#define AC_cmnd_manual_load_filament F("M83\nG1 E50 F700\nM82") // replace the manual panel commands with something a little faster
#define AC_cmnd_manual_unload_filament F("M83\nG1 E-50 F1200\nM82")
#define AC_cmnd_enable_leveling F("M420SV")
#define AC_cmnd_power_loss_recovery F("G28XYR5\nG28Z") // Lift, home X and Y then home Z when in 'safe' position
#define AC_Test_for_OldPanel PSTR("SIZE") // An old panel will respond with 'SXY 480 320' a new panel wont respond.
#define AC_Test_for_NewPanel PSTR("J200") // A new panel will respond with '[0]=0 [1]=0' to '[19]=0 ' an old panel wont respond
#define AC_Test_for_OldPanel F("SIZE") // An old panel will respond with 'SXY 480 320' a new panel wont respond.
#define AC_Test_for_NewPanel F("J200") // A new panel will respond with '[0]=0 [1]=0' to '[19]=0 ' an old panel wont respond
namespace Anycubic {
enum heater_state_t : uint8_t {
@@ -161,10 +165,10 @@ namespace Anycubic {
AC_menu_change_to_file,
AC_menu_change_to_command
};
enum panel_type_t : uint8_t {
enum panel_type_t : uint8_t { // order is important here as we assume new panel if type is unknown
AC_panel_unknown,
AC_panel_standard,
AC_panel_new
AC_panel_new,
AC_panel_standard
};
enum last_error_t : uint8_t {
AC_error_none,