🎨 Fewer serial macros

This commit is contained in:
Scott Lahteine
2021-09-09 04:57:05 -05:00
committed by Scott Lahteine
parent 6d96c221bd
commit b661795ae5
159 changed files with 1002 additions and 1014 deletions

View File

@ -86,7 +86,7 @@ void FileNavigator::refresh() { filelist.refresh(); }
void FileNavigator::changeDIR(const char *folder) {
if (currentfolderdepth >= MAX_FOLDER_DEPTH) return; // limit the folder depth
DEBUG_ECHOLNPAIR("FD:" , folderdepth, " FP:",currentindex, " currentfolder:", currentfoldername, " enter:", folder);
DEBUG_ECHOLNPGM("FD:" , folderdepth, " FP:",currentindex, " currentfolder:", currentfoldername, " enter:", folder);
currentfolderindex[currentfolderdepth] = currentindex;
strcat(currentfoldername, folder);
strcat(currentfoldername, "/");
@ -96,7 +96,7 @@ void FileNavigator::changeDIR(const char *folder) {
}
void FileNavigator::upDIR() {
DEBUG_ECHOLNPAIR("upDIR() from D:", currentfolderdepth, " N:", currentfoldername);
DEBUG_ECHOLNPGM("upDIR() from D:", currentfolderdepth, " N:", currentfoldername);
if (!filelist.isAtRootDir()) {
filelist.upDir();
currentfolderdepth--;
@ -117,7 +117,7 @@ void FileNavigator::skiptofileindex(uint16_t skip) {
if (skip == 0) return;
while (skip > 0) {
if (filelist.seek(currentindex)) {
DEBUG_ECHOLNPAIR("CI:", currentindex, " FD:", currentfolderdepth, " N:", skip, " ", filelist.longFilename());
DEBUG_ECHOLNPGM("CI:", currentindex, " FD:", currentfolderdepth, " N:", skip, " ", filelist.longFilename());
if (!filelist.isDir()) {
skip--;
currentindex++;
@ -151,7 +151,7 @@ void FileNavigator::skiptofileindex(uint16_t skip) {
}
lastpanelindex = index;
DEBUG_ECHOLNPAIR("index=", index, " currentindex=", currentindex);
DEBUG_ECHOLNPGM("index=", index, " currentindex=", currentindex);
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.
@ -169,7 +169,7 @@ void FileNavigator::skiptofileindex(uint16_t skip) {
for (uint16_t seek = currentindex; seek < currentindex + filesneeded; seek++) {
if (filelist.seek(seek)) {
sendFile(paneltype);
DEBUG_ECHOLNPAIR("-", seek, " '", filelist.longFilename(), "' '", currentfoldername, "", filelist.shortFilename(), "'");
DEBUG_ECHOLNPGM("-", seek, " '", filelist.longFilename(), "' '", currentfoldername, "", filelist.shortFilename(), "'");
}
}
}
@ -212,7 +212,7 @@ void FileNavigator::skiptofileindex(uint16_t skip) {
#else // Flat file list
void FileNavigator::getFiles(uint16_t index, panel_type_t paneltype, uint8_t filesneeded) {
DEBUG_ECHOLNPAIR("getFiles() I:", index," L:", lastpanelindex);
DEBUG_ECHOLNPGM("getFiles() I:", index," L:", lastpanelindex);
// if we're searching backwards, jump back to start and search forward
if (index < lastpanelindex) {
reset();
@ -248,7 +248,7 @@ void FileNavigator::skiptofileindex(uint16_t skip) {
TFTSer.println(filelist.shortFilename());
if (currentfolderdepth > 0) TFTSer.print(currentfoldername);
TFTSer.println(filelist.longFilename());
DEBUG_ECHOLNPAIR("/", currentfoldername, "", filelist.shortFilename(), " ", filelist.longFilename());
DEBUG_ECHOLNPGM("/", currentfoldername, "", filelist.shortFilename(), " ", filelist.longFilename());
}
#endif // Flat file list

View File

@ -107,12 +107,12 @@ namespace ExtUI {
void onMeshUpdate(const int8_t xpos, const int8_t ypos, const_float_t zval) {
// Called when any mesh points are updated
//SERIAL_ECHOLNPAIR("onMeshUpdate() x:", xpos, " y:", ypos, " z:", zval);
//SERIAL_ECHOLNPGM("onMeshUpdate() x:", xpos, " y:", ypos, " z:", zval);
}
void onMeshUpdate(const int8_t xpos, const int8_t ypos, const probe_state_t state) {
// Called to indicate a special condition
//SERIAL_ECHOLNPAIR("onMeshUpdate() x:", xpos, " y:", ypos, " state:", state);
//SERIAL_ECHOLNPGM("onMeshUpdate() x:", xpos, " y:", ypos, " state:", state);
}
#endif

View File

@ -104,7 +104,7 @@ void ChironTFT::Startup() {
PlayTune(BEEPER_PIN, TERN(AC_DEFAULT_STARTUP_TUNE, Anycubic_PowerOn, GB_PowerOn), 1);
#if ACDEBUGLEVEL
SERIAL_ECHOLNPAIR("AC Debug Level ", ACDEBUGLEVEL);
SERIAL_ECHOLNPGM("AC Debug Level ", ACDEBUGLEVEL);
#endif
SendtoTFTLN(AC_msg_ready);
}
@ -128,13 +128,13 @@ void ChironTFT::IdleLoop() {
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);
SERIAL_ECHOLNPGM("PrinterKilled()\nerror: ", error , "\ncomponent: ", component);
#endif
}
void ChironTFT::MediaEvent(media_event_t event) {
#if ACDEBUG(AC_MARLIN)
SERIAL_ECHOLNPAIR("ProcessMediaStatus() ", event);
SERIAL_ECHOLNPGM("ProcessMediaStatus() ", event);
#endif
switch (event) {
case AC_media_inserted:
@ -154,8 +154,8 @@ void ChironTFT::MediaEvent(media_event_t event) {
void ChironTFT::TimerEvent(timer_event_t event) {
#if ACDEBUG(AC_MARLIN)
SERIAL_ECHOLNPAIR("TimerEvent() ", event);
SERIAL_ECHOLNPAIR("Printer State: ", printer_state);
SERIAL_ECHOLNPGM("TimerEvent() ", event);
SERIAL_ECHOLNPGM("Printer State: ", printer_state);
#endif
switch (event) {
@ -184,7 +184,7 @@ void ChironTFT::TimerEvent(timer_event_t event) {
void ChironTFT::FilamentRunout() {
#if ACDEBUG(AC_MARLIN)
SERIAL_ECHOLNPAIR("FilamentRunout() printer_state ", printer_state);
SERIAL_ECHOLNPGM("FilamentRunout() printer_state ", printer_state);
#endif
// 1 Signal filament out
last_error = AC_error_filament_runout;
@ -195,7 +195,7 @@ void ChironTFT::FilamentRunout() {
void ChironTFT::ConfirmationRequest(const char * const msg) {
// M108 continue
#if ACDEBUG(AC_MARLIN)
SERIAL_ECHOLNPAIR("ConfirmationRequest() ", msg, " printer_state:", printer_state);
SERIAL_ECHOLNPGM("ConfirmationRequest() ", msg, " printer_state:", printer_state);
#endif
switch (printer_state) {
case AC_printer_pausing: {
@ -232,8 +232,8 @@ void ChironTFT::ConfirmationRequest(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);
SERIAL_ECHOLNPGM("StatusChange() ", msg);
SERIAL_ECHOLNPGM("printer_state:", printer_state);
#endif
bool msg_matched = false;
// The only way to get printer status is to parse messages
@ -348,7 +348,7 @@ bool ChironTFT::ReadTFTCommand() {
if (command_ready || command_len == MAX_CMND_LEN) {
panel_command[command_len] = '\0';
#if ACDEBUG(AC_ALL)
SERIAL_ECHOLNPAIR("len(",command_len,") < ", panel_command);
SERIAL_ECHOLNPGM("len(",command_len,") < ", panel_command);
#endif
command_ready = true;
}
@ -360,13 +360,13 @@ int8_t ChironTFT::FindToken(char c) {
do {
if (panel_command[pos] == c) {
#if ACDEBUG(AC_INFO)
SERIAL_ECHOLNPAIR("Tpos:", pos, " ", c);
SERIAL_ECHOLNPGM("Tpos:", pos, " ", c);
#endif
return pos;
}
} while(++pos < command_len);
#if ACDEBUG(AC_INFO)
SERIAL_ECHOLNPAIR("Not found: ", c);
SERIAL_ECHOLNPGM("Not found: ", c);
#endif
return -1;
}
@ -381,7 +381,7 @@ void ChironTFT::CheckHeaters() {
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);
SERIAL_ECHOLNPGM("Extruder temp abnormal! : ", temp);
break;
}
delay_ms(500);
@ -396,7 +396,7 @@ void ChironTFT::CheckHeaters() {
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);
SERIAL_ECHOLNPGM("Bed temp abnormal! : ", temp);
break;
}
delay_ms(500);
@ -423,7 +423,7 @@ void ChironTFT::CheckHeaters() {
void ChironTFT::SendFileList(int8_t startindex) {
// Respond to panel request for 4 files starting at index
#if ACDEBUG(AC_INFO)
SERIAL_ECHOLNPAIR("## SendFileList ## ", startindex);
SERIAL_ECHOLNPGM("## SendFileList ## ", startindex);
#endif
SendtoTFTLN(PSTR("FN "));
filenavigator.getFiles(startindex, panel_type, 4);
@ -440,7 +440,7 @@ void ChironTFT::SelectFile() {
selectedfile[command_len - 5] = '\0';
}
#if ACDEBUG(AC_FILE)
SERIAL_ECHOLNPAIR(" Selected File: ",selectedfile);
SERIAL_ECHOLNPGM(" Selected File: ",selectedfile);
#endif
switch (selectedfile[0]) {
case '/': // Valid file selected
@ -561,7 +561,7 @@ void ChironTFT::PanelInfo(uint8_t req) {
TFTSer.print(ui8tostr2(time % 60));
SendtoTFT(PSTR(" M"));
#if ACDEBUG(AC_ALL)
SERIAL_ECHOLNPAIR("Print time ", ui8tostr2(time / 60), ":", ui8tostr2(time % 60));
SERIAL_ECHOLNPGM("Print time ", ui8tostr2(time / 60), ":", ui8tostr2(time % 60));
#endif
} break;
@ -702,7 +702,7 @@ void ChironTFT::PanelAction(uint8_t req) {
char MoveCmnd[30];
sprintf_P(MoveCmnd, PSTR("G91\nG0%s\nG90"), panel_command + 3);
#if ACDEBUG(AC_ACTION)
SERIAL_ECHOLNPAIR("Move: ", MoveCmnd);
SERIAL_ECHOLNPGM("Move: ", MoveCmnd);
#endif
setSoftEndstopState(true); // enable endstops
injectCommands(MoveCmnd);
@ -781,7 +781,7 @@ void ChironTFT::PanelProcess(uint8_t req) {
if (isPositionKnown()) {
#if ACDEBUG(AC_INFO)
SERIAL_ECHOLNPAIR("Moving to mesh point at x: ", pos.x, " y: ", pos.y, " z: ", pos_z);
SERIAL_ECHOLNPGM("Moving to mesh point at x: ", pos.x, " y: ", pos.y, " z: ", pos_z);
#endif
// Go up before moving
setAxisPosition_mm(3.0,Z);
@ -790,7 +790,7 @@ void ChironTFT::PanelProcess(uint8_t req) {
setAxisPosition_mm(20 + (93 * pos.y), Y);
setAxisPosition_mm(0.0, Z);
#if ACDEBUG(AC_INFO)
SERIAL_ECHOLNPAIR("Current Z: ", getAxisPosition_mm(Z));
SERIAL_ECHOLNPGM("Current Z: ", getAxisPosition_mm(Z));
#endif
}
}
@ -858,17 +858,17 @@ void ChironTFT::PanelProcess(uint8_t req) {
// From the leveling panel use the all points UI to adjust the print pos.
if (isPrinting()) {
#if ACDEBUG(AC_INFO)
SERIAL_ECHOLNPAIR("Change Zoffset from:", live_Zoffset, " to ", live_Zoffset + Zshift);
SERIAL_ECHOLNPGM("Change Zoffset from:", live_Zoffset, " to ", live_Zoffset + Zshift);
#endif
if (isAxisPositionKnown(Z)) {
#if ACDEBUG(AC_INFO)
const float currZpos = getAxisPosition_mm(Z);
SERIAL_ECHOLNPAIR("Nudge Z pos from ", currZpos, " to ", currZpos + constrain(Zshift, -0.05, 0.05));
SERIAL_ECHOLNPGM("Nudge Z pos from ", currZpos, " to ", currZpos + constrain(Zshift, -0.05, 0.05));
#endif
// Use babystepping to adjust the head position
int16_t steps = mmToWholeSteps(constrain(Zshift,-0.05,0.05), Z);
#if ACDEBUG(AC_INFO)
SERIAL_ECHOLNPAIR("Steps to move Z: ", steps);
SERIAL_ECHOLNPGM("Steps to move Z: ", steps);
#endif
babystepAxis_steps(steps, Z);
live_Zoffset += Zshift;
@ -882,12 +882,12 @@ void ChironTFT::PanelProcess(uint8_t req) {
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) );
SERIAL_ECHOLNPGM("Change mesh point X", x," Y",y ," from ", currval, " to ", getMeshPoint(pos) );
#endif
}
const float currZOffset = getZOffset_mm();
#if ACDEBUG(AC_INFO)
SERIAL_ECHOLNPAIR("Change probe offset from ", currZOffset, " to ", currZOffset + Zshift);
SERIAL_ECHOLNPGM("Change probe offset from ", currZOffset, " to ", currZOffset + Zshift);
#endif
setZOffset_mm(currZOffset + Zshift);
@ -898,7 +898,7 @@ void ChironTFT::PanelProcess(uint8_t req) {
// Move Z axis
const float currZpos = getAxisPosition_mm(Z);
#if ACDEBUG(AC_INFO)
SERIAL_ECHOLNPAIR("Move Z pos from ", currZpos, " to ", currZpos + constrain(Zshift, -0.05, 0.05));
SERIAL_ECHOLNPGM("Move Z pos from ", currZpos, " to ", currZpos + constrain(Zshift, -0.05, 0.05));
#endif
setAxisPosition_mm(currZpos+constrain(Zshift,-0.05,0.05),Z);
}
@ -930,8 +930,8 @@ void ChironTFT::PanelProcess(uint8_t req) {
float currmesh = getMeshPoint(pos);
float newval = atof(&panel_command[11])/100;
#if ACDEBUG(AC_INFO)
SERIAL_ECHOLNPAIR("Change mesh point x:", pos.x, " y:", pos.y);
SERIAL_ECHOLNPAIR("from ", currmesh, " to ", newval);
SERIAL_ECHOLNPGM("Change mesh point x:", pos.x, " y:", pos.y);
SERIAL_ECHOLNPGM("from ", currmesh, " to ", newval);
#endif
// Update Meshpoint
setMeshPoint(pos,newval);
@ -942,7 +942,7 @@ void ChironTFT::PanelProcess(uint8_t req) {
setSoftEndstopState(false);
float currZpos = getAxisPosition_mm(Z);
#if ACDEBUG(AC_INFO)
SERIAL_ECHOLNPAIR("Move Z pos from ", currZpos, " to ", currZpos + constrain(newval - currmesh, -0.05, 0.05));
SERIAL_ECHOLNPGM("Move Z pos from ", currZpos, " to ", currZpos + constrain(newval - currmesh, -0.05, 0.05));
#endif
setAxisPosition_mm(currZpos + constrain(newval - currmesh, -0.05, 0.05), Z);
}