A single SERIAL_ECHO macro type (#12557)

This commit is contained in:
Scott Lahteine 2018-11-29 16:58:58 -06:00 committed by GitHub
parent 69d869c3d9
commit c986239837
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
86 changed files with 1016 additions and 1356 deletions

View file

@ -39,8 +39,7 @@ bool PersistentStore::write_data(int &pos, const uint8_t *value, size_t size, ui
if (v != eeprom_read_byte(p)) {
eeprom_write_byte(p, v);
if (eeprom_read_byte(p) != v) {
SERIAL_ECHO_START();
SERIAL_ECHOLNPGM(MSG_ERR_EEPROM_WRITE);
SERIAL_ECHO_MSG(MSG_ERR_EEPROM_WRITE);
return true;
}
}

View file

@ -150,7 +150,7 @@ static bool pwm_status(uint8_t pin) {
default:
return false;
}
SERIAL_PROTOCOL_SP(2);
SERIAL_ECHO_SP(2);
} // pwm_status
@ -222,24 +222,24 @@ const volatile uint8_t* const PWM_OCR[][3] PROGMEM = {
#define OCR_VAL(T, L) pgm_read_word(&PWM_OCR[T][L])
static void err_is_counter() { SERIAL_PROTOCOLPGM(" non-standard PWM mode"); }
static void err_is_interrupt() { SERIAL_PROTOCOLPGM(" compare interrupt enabled"); }
static void err_prob_interrupt() { SERIAL_PROTOCOLPGM(" overflow interrupt enabled"); }
static void print_is_also_tied() { SERIAL_PROTOCOLPGM(" is also tied to this pin"); SERIAL_PROTOCOL_SP(14); }
static void err_is_counter() { SERIAL_ECHOPGM(" non-standard PWM mode"); }
static void err_is_interrupt() { SERIAL_ECHOPGM(" compare interrupt enabled"); }
static void err_prob_interrupt() { SERIAL_ECHOPGM(" overflow interrupt enabled"); }
static void print_is_also_tied() { SERIAL_ECHOPGM(" is also tied to this pin"); SERIAL_ECHO_SP(14); }
void com_print(uint8_t N, uint8_t Z) {
const uint8_t *TCCRA = (uint8_t*)TCCR_A(N);
SERIAL_PROTOCOLPGM(" COM");
SERIAL_PROTOCOLCHAR(N + '0');
SERIAL_ECHOPGM(" COM");
SERIAL_CHAR(N + '0');
switch (Z) {
case 'A':
SERIAL_PROTOCOLPAIR("A: ", ((*TCCRA & (_BV(7) | _BV(6))) >> 6));
SERIAL_ECHOPAIR("A: ", ((*TCCRA & (_BV(7) | _BV(6))) >> 6));
break;
case 'B':
SERIAL_PROTOCOLPAIR("B: ", ((*TCCRA & (_BV(5) | _BV(4))) >> 4));
SERIAL_ECHOPAIR("B: ", ((*TCCRA & (_BV(5) | _BV(4))) >> 4));
break;
case 'C':
SERIAL_PROTOCOLPAIR("C: ", ((*TCCRA & (_BV(3) | _BV(2))) >> 2));
SERIAL_ECHOPAIR("C: ", ((*TCCRA & (_BV(3) | _BV(2))) >> 2));
break;
}
}
@ -251,10 +251,10 @@ void timer_prefix(uint8_t T, char L, uint8_t N) { // T - timer L - pwm N -
uint8_t WGM = (((*TCCRB & _BV(WGM_2)) >> 1) | (*TCCRA & (_BV(WGM_0) | _BV(WGM_1))));
if (N == 4) WGM |= ((*TCCRB & _BV(WGM_3)) >> 1);
SERIAL_PROTOCOLPGM(" TIMER");
SERIAL_PROTOCOLCHAR(T + '0');
SERIAL_PROTOCOLCHAR(L);
SERIAL_PROTOCOL_SP(3);
SERIAL_ECHOPGM(" TIMER");
SERIAL_CHAR(T + '0');
SERIAL_CHAR(L);
SERIAL_ECHO_SP(3);
if (N == 3) {
const uint8_t *OCRVAL8 = (uint8_t*)OCR_VAL(T, L - 'A');
@ -264,22 +264,22 @@ void timer_prefix(uint8_t T, char L, uint8_t N) { // T - timer L - pwm N -
const uint16_t *OCRVAL16 = (uint16_t*)OCR_VAL(T, L - 'A');
PWM_PRINT(*OCRVAL16);
}
SERIAL_PROTOCOLPAIR(" WGM: ", WGM);
SERIAL_ECHOPAIR(" WGM: ", WGM);
com_print(T,L);
SERIAL_PROTOCOLPAIR(" CS: ", (*TCCRB & (_BV(CS_0) | _BV(CS_1) | _BV(CS_2)) ));
SERIAL_ECHOPAIR(" CS: ", (*TCCRB & (_BV(CS_0) | _BV(CS_1) | _BV(CS_2)) ));
SERIAL_PROTOCOLPGM(" TCCR");
SERIAL_PROTOCOLCHAR(T + '0');
SERIAL_PROTOCOLPAIR("A: ", *TCCRA);
SERIAL_ECHOPGM(" TCCR");
SERIAL_CHAR(T + '0');
SERIAL_ECHOPAIR("A: ", *TCCRA);
SERIAL_PROTOCOLPGM(" TCCR");
SERIAL_PROTOCOLCHAR(T + '0');
SERIAL_PROTOCOLPAIR("B: ", *TCCRB);
SERIAL_ECHOPGM(" TCCR");
SERIAL_CHAR(T + '0');
SERIAL_ECHOPAIR("B: ", *TCCRB);
const uint8_t *TMSK = (uint8_t*)TIMSK(T);
SERIAL_PROTOCOLPGM(" TIMSK");
SERIAL_PROTOCOLCHAR(T + '0');
SERIAL_PROTOCOLPAIR(": ", *TMSK);
SERIAL_ECHOPGM(" TIMSK");
SERIAL_CHAR(T + '0');
SERIAL_ECHOPAIR(": ", *TMSK);
const uint8_t OCIE = L - 'A' + 1;
if (N == 3) { if (WGM == 0 || WGM == 2 || WGM == 4 || WGM == 6) err_is_counter(); }
@ -336,22 +336,22 @@ static void pwm_details(uint8_t pin) {
case NOT_ON_TIMER: break;
}
SERIAL_PROTOCOLPGM(" ");
SERIAL_ECHOPGM(" ");
// on pins that have two PWMs, print info on second PWM
#if AVR_ATmega2560_FAMILY || AVR_AT90USB1286_FAMILY
// looking for port B7 - PWMs 0A and 1C
if (digitalPinToPort_DEBUG(pin) == 'B' - 64 && 0x80 == digitalPinToBitMask_DEBUG(pin)) {
#if !AVR_AT90USB1286_FAMILY
SERIAL_PROTOCOLPGM("\n .");
SERIAL_PROTOCOL_SP(18);
SERIAL_PROTOCOLPGM("TIMER1C");
SERIAL_ECHOPGM("\n .");
SERIAL_ECHO_SP(18);
SERIAL_ECHOPGM("TIMER1C");
print_is_also_tied();
timer_prefix(1, 'C', 4);
#else
SERIAL_PROTOCOLPGM("\n .");
SERIAL_PROTOCOL_SP(18);
SERIAL_PROTOCOLPGM("TIMER0A");
SERIAL_ECHOPGM("\n .");
SERIAL_ECHO_SP(18);
SERIAL_ECHOPGM("TIMER0A");
print_is_also_tied();
timer_prefix(0, 'A', 3);
#endif
@ -372,7 +372,7 @@ static void pwm_details(uint8_t pin) {
void print_port(int8_t pin) { // print port number
#ifdef digitalPinToPort_DEBUG
uint8_t x;
SERIAL_PROTOCOLPGM(" Port: ");
SERIAL_ECHOPGM(" Port: ");
#if AVR_AT90USB1286_FAMILY
x = (pin == 46 || pin == 47) ? 'E' : digitalPinToPort_DEBUG(pin) + 64;
#else
@ -395,7 +395,7 @@ static void pwm_details(uint8_t pin) {
#endif
SERIAL_CHAR(x);
#else
SERIAL_PROTOCOL_SP(10);
SERIAL_ECHO_SP(10);
#endif
}

View file

@ -62,8 +62,7 @@ void watchdog_init() {
#if ENABLED(WATCHDOG_RESET_MANUAL)
ISR(WDT_vect) {
sei(); // With the interrupt driven serial we need to allow interrupts.
SERIAL_ERROR_START();
SERIAL_ERRORLNPGM(MSG_WATCHDOG_FIRED);
SERIAL_ERROR_MSG(MSG_WATCHDOG_FIRED);
minkill(); // interrupt-safe final kill and infinite loop
}
#endif // WATCHDOG_RESET_MANUAL

View file

@ -121,7 +121,7 @@ static uint8_t buffer[256] = {0}, // The RAM buffer to accumulate writes
char buffer[80];
sprintf(buffer, "Page: %d (0x%04x)\n", page, page);
SERIAL_PROTOCOL(buffer);
SERIAL_ECHO(buffer);
char* p = &buffer[0];
for (int i = 0; i< PageSize; ++i) {
@ -131,7 +131,7 @@ static uint8_t buffer[256] = {0}, // The RAM buffer to accumulate writes
if ((i & 0xF) == 0xF) {
*p++ = '\n';
*p = 0;
SERIAL_PROTOCOL(buffer);
SERIAL_ECHO(buffer);
p = &buffer[0];
}
}

View file

@ -53,8 +53,7 @@ bool PersistentStore::write_data(int &pos, const uint8_t *value, size_t size, ui
if (v != eeprom_read_byte(p)) {
eeprom_write_byte(p, v);
if (eeprom_read_byte(p) != v) {
SERIAL_ECHO_START();
SERIAL_ECHOLNPGM(MSG_ERR_EEPROM_WRITE);
SERIAL_ECHO_MSG(MSG_ERR_EEPROM_WRITE);
return true;
}
}

View file

@ -93,7 +93,7 @@ bool GET_ARRAY_IS_DIGITAL(int8_t pin) {
void pwm_details(int32_t pin) {
if (pwm_status(pin)) {
uint32_t chan = g_APinDescription[pin].ulPWMChannel;
SERIAL_PROTOCOLPAIR("PWM = ", PWM_INTERFACE->PWM_CH_NUM[chan].PWM_CDTY);
SERIAL_ECHOPAIR("PWM = ", PWM_INTERFACE->PWM_CH_NUM[chan].PWM_CDTY);
}
}

View file

@ -67,7 +67,7 @@ Ctrl_status sd_mmc_spi_usb_read_10(uint32_t addr, uint16_t nb_sector) {
#ifdef DEBUG_MMC
char buffer[80];
sprintf(buffer, "SDRD: %d @ 0x%08x\n", nb_sector, addr);
SERIAL_PROTOCOL_P(0, buffer);
SERIAL_ECHO_P(0, buffer);
#endif
// Start reading
@ -101,7 +101,7 @@ Ctrl_status sd_mmc_spi_usb_write_10(uint32_t addr, uint16_t nb_sector) {
#ifdef DEBUG_MMC
char buffer[80];
sprintf(buffer, "SDWR: %d @ 0x%08x\n", nb_sector, addr);
SERIAL_PROTOCOL_P(0, buffer);
SERIAL_ECHO_P(0, buffer);
#endif
if (!card.getSd2Card().writeStart(addr, nb_sector))

View file

@ -80,23 +80,23 @@ bool PersistentStore::access_finish() {
// to see errors that are happening in read_data / write_data
static void debug_rw(const bool write, int &pos, const uint8_t *value, const size_t size, const FRESULT s, const size_t total=0) {
PGM_P const rw_str = write ? PSTR("write") : PSTR("read");
SERIAL_PROTOCOLCHAR(' ');
SERIAL_CHAR(' ');
serialprintPGM(rw_str);
SERIAL_PROTOCOLPAIR("_data(", pos);
SERIAL_PROTOCOLPAIR(",", (int)value);
SERIAL_PROTOCOLPAIR(",", (int)size);
SERIAL_PROTOCOLLNPGM(", ...)");
SERIAL_ECHOPAIR("_data(", pos);
SERIAL_ECHOPAIR(",", (int)value);
SERIAL_ECHOPAIR(",", (int)size);
SERIAL_ECHOLNPGM(", ...)");
if (total) {
SERIAL_PROTOCOLPGM(" f_");
SERIAL_ECHOPGM(" f_");
serialprintPGM(rw_str);
SERIAL_PROTOCOLPAIR("()=", (int)s);
SERIAL_PROTOCOLPAIR("\n size=", size);
SERIAL_PROTOCOLPGM("\n bytes_");
SERIAL_ECHOPAIR("()=", (int)s);
SERIAL_ECHOPAIR("\n size=", size);
SERIAL_ECHOPGM("\n bytes_");
serialprintPGM(write ? PSTR("written=") : PSTR("read="));
SERIAL_PROTOCOLLN(total);
SERIAL_ECHOLN(total);
}
else
SERIAL_PROTOCOLLNPAIR(" f_lseek()=", (int)s);
SERIAL_ECHOLNPAIR(" f_lseek()=", (int)s);
}
// File function return codes for type FRESULT. This goes away soon, but

View file

@ -62,8 +62,7 @@ bool PersistentStore::write_data(int &pos, const uint8_t *value, size_t size, ui
if (v != eeprom_read_byte(p)) {
eeprom_write_byte(p, v);
if (eeprom_read_byte(p) != v) {
SERIAL_ECHO_START();
SERIAL_ECHOLNPGM(MSG_ERR_EEPROM_WRITE);
SERIAL_ECHO_MSG(MSG_ERR_EEPROM_WRITE);
return true;
}
}

View file

@ -41,8 +41,7 @@ bool PersistentStore::write_data(int &pos, const uint8_t *value, size_t size, ui
if (v != eeprom_read_byte(p)) {
eeprom_write_byte(p, v);
if (eeprom_read_byte(p) != v) {
SERIAL_ECHO_START();
SERIAL_ECHOLNPGM(MSG_ERR_EEPROM_WRITE);
SERIAL_ECHO_MSG(MSG_ERR_EEPROM_WRITE);
return true;
}
}

View file

@ -41,8 +41,7 @@ bool PersistentStore::write_data(int &pos, const uint8_t *value, size_t size, ui
if (v != eeprom_read_byte(p)) {
eeprom_write_byte(p, v);
if (eeprom_read_byte(p) != v) {
SERIAL_ECHO_START();
SERIAL_ECHOLNPGM(MSG_ERR_EEPROM_WRITE);
SERIAL_ECHO_MSG(MSG_ERR_EEPROM_WRITE);
return true;
}
}

View file

@ -21,8 +21,7 @@ bool write_data(int &pos, const uint8_t *value, uint16_t size, uint16_t *crc) {
if (v != eeprom_read_byte(p)) {
eeprom_write_byte(p, v);
if (eeprom_read_byte(p) != v) {
SERIAL_ECHO_START();
SERIAL_ECHOLNPGM(MSG_ERR_EEPROM_WRITE);
SERIAL_ECHO_MSG(MSG_ERR_EEPROM_WRITE);
return true;
}
}

View file

@ -42,8 +42,7 @@ bool PersistentStore::write_data(int &pos, const uint8_t *value, size_t size, ui
if (v != eeprom_read_byte(p)) {
eeprom_write_byte(p, v);
if (eeprom_read_byte(p) != v) {
SERIAL_ECHO_START();
SERIAL_ECHOLNPGM(MSG_ERR_EEPROM_WRITE);
SERIAL_ECHO_MSG(MSG_ERR_EEPROM_WRITE);
return true;
}
}

View file

@ -21,8 +21,7 @@ bool write_data(int &pos, const uint8_t *value, uint16_t size, uint16_t *crc) {
if (v != eeprom_read_byte(p)) {
eeprom_write_byte(p, v);
if (eeprom_read_byte(p) != v) {
SERIAL_ECHO_START();
SERIAL_ECHOLNPGM(MSG_ERR_EEPROM_WRITE);
SERIAL_ECHO_MSG(MSG_ERR_EEPROM_WRITE);
return true;
}
}

View file

@ -102,7 +102,7 @@ bool HAL_pwm_status(int8_t pin) {
default:
return false;
}
SERIAL_PROTOCOLPGM(" ");
SERIAL_ECHOPGM(" ");
}
static void HAL_pwm_details(uint8_t pin) { /* TODO */ }

View file

@ -88,8 +88,7 @@ void backtrace(void) {
btf.pc = pc | 1; // Force Thumb, as CORTEX only support it
// Perform a backtrace
SERIAL_ERROR_START();
SERIAL_ERRORLNPGM("Backtrace:");
SERIAL_ERROR_MSG("Backtrace:");
int ctr = 0;
UnwindStart(&btf, &UnwCallbacks, &ctr);
}

View file

@ -264,8 +264,7 @@ bool pin_is_protected(const pin_t pin) {
}
void protected_pin_err() {
SERIAL_ERROR_START();
SERIAL_ERRORLNPGM(MSG_ERR_PROTECTED_PIN);
SERIAL_ERROR_MSG(MSG_ERR_PROTECTED_PIN);
}
void quickstop_stepper() {
@ -400,8 +399,7 @@ void manage_inactivity(const bool ignore_stepper_queue/*=false*/) {
// KILL the machine
// ----------------------------------------------------------------
if (killCount >= KILL_DELAY) {
SERIAL_ERROR_START();
SERIAL_ERRORLNPGM(MSG_KILL_BUTTON);
SERIAL_ERROR_MSG(MSG_KILL_BUTTON);
kill();
}
#endif
@ -606,8 +604,7 @@ void idle(
void kill(PGM_P const lcd_msg/*=NULL*/) {
thermalManager.disable_all_heaters();
SERIAL_ERROR_START();
SERIAL_ERRORLNPGM(MSG_ERR_KILLED);
SERIAL_ERROR_MSG(MSG_ERR_KILLED);
#if HAS_SPI_LCD || ENABLED(EXTENSIBLE_UI)
ui.kill_screen(lcd_msg ? lcd_msg : PSTR(MSG_KILLED));
@ -663,8 +660,7 @@ void stop() {
if (IsRunning()) {
Stopped_gcode_LastN = gcode_LastN; // Save last g_code for restart
SERIAL_ERROR_START();
SERIAL_ERRORLNPGM(MSG_ERR_STOPPED);
SERIAL_ERROR_MSG(MSG_ERR_STOPPED);
LCD_MESSAGEPGM(MSG_STOPPED);
safe_delay(350); // allow enough time for messages to get out before stopping
Running = false;
@ -745,7 +741,7 @@ void setup() {
#endif
#endif
SERIAL_PROTOCOLLNPGM("start");
SERIAL_ECHOLNPGM("start");
SERIAL_ECHO_START();
#if TMC_HAS_SPI
@ -781,8 +777,7 @@ void setup() {
SERIAL_ECHOPGM(MSG_CONFIGURATION_VER);
SERIAL_ECHOPGM(STRING_DISTRIBUTION_DATE);
SERIAL_ECHOLNPGM(MSG_AUTHOR STRING_CONFIG_H_AUTHOR);
SERIAL_ECHO_START();
SERIAL_ECHOLNPGM("Compiled: " __DATE__);
SERIAL_ECHO_MSG("Compiled: " __DATE__);
#endif
SERIAL_ECHO_START();

View file

@ -33,14 +33,14 @@ static const char echomagic[] PROGMEM = "echo:";
while (char ch = pgm_read_byte(str++)) SERIAL_CHAR_P(p, ch);
}
void serial_echopair_PGM_P(const int8_t p, PGM_P s_P, const char *v) { serialprintPGM_P(p, s_P); SERIAL_ECHO_P(p, v); }
void serial_echopair_PGM_P(const int8_t p, PGM_P s_P, char v) { serialprintPGM_P(p, s_P); SERIAL_CHAR_P(p, v); }
void serial_echopair_PGM_P(const int8_t p, PGM_P s_P, int v) { serialprintPGM_P(p, s_P); SERIAL_ECHO_P(p, v); }
void serial_echopair_PGM_P(const int8_t p, PGM_P s_P, long v) { serialprintPGM_P(p, s_P); SERIAL_ECHO_P(p, v); }
void serial_echopair_PGM_P(const int8_t p, PGM_P s_P, float v) { serialprintPGM_P(p, s_P); SERIAL_ECHO_P(p, v); }
void serial_echopair_PGM_P(const int8_t p, PGM_P s_P, double v) { serialprintPGM_P(p, s_P); SERIAL_ECHO_P(p, v); }
void serial_echopair_PGM_P(const int8_t p, PGM_P s_P, unsigned int v) { serialprintPGM_P(p, s_P); SERIAL_ECHO_P(p, v); }
void serial_echopair_PGM_P(const int8_t p, PGM_P s_P, unsigned long v) { serialprintPGM_P(p, s_P); SERIAL_ECHO_P(p, v); }
void serial_echopair_PGM_P(const int8_t p, PGM_P const s_P, const char *v) { serialprintPGM_P(p, s_P); SERIAL_ECHO_P(p, v); }
void serial_echopair_PGM_P(const int8_t p, PGM_P const s_P, char v) { serialprintPGM_P(p, s_P); SERIAL_CHAR_P(p, v); }
void serial_echopair_PGM_P(const int8_t p, PGM_P const s_P, int v) { serialprintPGM_P(p, s_P); SERIAL_ECHO_P(p, v); }
void serial_echopair_PGM_P(const int8_t p, PGM_P const s_P, long v) { serialprintPGM_P(p, s_P); SERIAL_ECHO_P(p, v); }
void serial_echopair_PGM_P(const int8_t p, PGM_P const s_P, float v) { serialprintPGM_P(p, s_P); SERIAL_ECHO_P(p, v); }
void serial_echopair_PGM_P(const int8_t p, PGM_P const s_P, double v) { serialprintPGM_P(p, s_P); SERIAL_ECHO_P(p, v); }
void serial_echopair_PGM_P(const int8_t p, PGM_P const s_P, unsigned int v) { serialprintPGM_P(p, s_P); SERIAL_ECHO_P(p, v); }
void serial_echopair_PGM_P(const int8_t p, PGM_P const s_P, unsigned long v) { serialprintPGM_P(p, s_P); SERIAL_ECHO_P(p, v); }
void serial_spaces_P(const int8_t p, uint8_t count) { count *= (PROPORTIONAL_FONT_RATIO); while (count--) SERIAL_CHAR_P(p, ' '); }
@ -56,14 +56,14 @@ void serialprintPGM(PGM_P str) {
void serial_echo_start() { serialprintPGM(echomagic); }
void serial_error_start() { serialprintPGM(errormagic); }
void serial_echopair_PGM(PGM_P s_P, const char *v) { serialprintPGM(s_P); SERIAL_ECHO(v); }
void serial_echopair_PGM(PGM_P s_P, char v) { serialprintPGM(s_P); SERIAL_CHAR(v); }
void serial_echopair_PGM(PGM_P s_P, int v) { serialprintPGM(s_P); SERIAL_ECHO(v); }
void serial_echopair_PGM(PGM_P s_P, long v) { serialprintPGM(s_P); SERIAL_ECHO(v); }
void serial_echopair_PGM(PGM_P s_P, float v) { serialprintPGM(s_P); SERIAL_ECHO(v); }
void serial_echopair_PGM(PGM_P s_P, double v) { serialprintPGM(s_P); SERIAL_ECHO(v); }
void serial_echopair_PGM(PGM_P s_P, unsigned int v) { serialprintPGM(s_P); SERIAL_ECHO(v); }
void serial_echopair_PGM(PGM_P s_P, unsigned long v) { serialprintPGM(s_P); SERIAL_ECHO(v); }
void serial_echopair_PGM(PGM_P const s_P, const char *v) { serialprintPGM(s_P); SERIAL_ECHO(v); }
void serial_echopair_PGM(PGM_P const s_P, char v) { serialprintPGM(s_P); SERIAL_CHAR(v); }
void serial_echopair_PGM(PGM_P const s_P, int v) { serialprintPGM(s_P); SERIAL_ECHO(v); }
void serial_echopair_PGM(PGM_P const s_P, long v) { serialprintPGM(s_P); SERIAL_ECHO(v); }
void serial_echopair_PGM(PGM_P const s_P, float v) { serialprintPGM(s_P); SERIAL_ECHO(v); }
void serial_echopair_PGM(PGM_P const s_P, double v) { serialprintPGM(s_P); SERIAL_ECHO(v); }
void serial_echopair_PGM(PGM_P const s_P, unsigned int v) { serialprintPGM(s_P); SERIAL_ECHO(v); }
void serial_echopair_PGM(PGM_P const s_P, unsigned long v) { serialprintPGM(s_P); SERIAL_ECHO(v); }
void serial_spaces(uint8_t count) { count *= (PROPORTIONAL_FONT_RATIO); while (count--) SERIAL_CHAR(' '); }
@ -74,7 +74,7 @@ void serialprintln_onoff(const bool onoff) { serialprint_onoff(onoff); SERIAL_EO
#include "enum.h"
void print_xyz(PGM_P prefix, PGM_P suffix, const float x, const float y, const float z) {
void print_xyz(PGM_P const prefix, PGM_P const suffix, const float x, const float y, const float z) {
serialprintPGM(prefix);
SERIAL_CHAR('(');
SERIAL_ECHO(x);
@ -84,7 +84,7 @@ void serialprintln_onoff(const bool onoff) { serialprint_onoff(onoff); SERIAL_EO
if (suffix) serialprintPGM(suffix); else SERIAL_EOL();
}
void print_xyz(PGM_P prefix, PGM_P suffix, const float xyz[]) {
void print_xyz(PGM_P const prefix, PGM_P const suffix, const float xyz[]) {
print_xyz(prefix, suffix, xyz[X_AXIS], xyz[Y_AXIS], xyz[Z_AXIS]);
}

View file

@ -48,193 +48,159 @@ extern uint8_t marlin_debug_flags;
#endif
#if NUM_SERIAL > 1
#define SERIAL_CHAR_P(p,x) (WITHIN(p, 0, NUM_SERIAL-1) ? (p == 0 ? MYSERIAL0.write(x) : MYSERIAL1.write(x)) : SERIAL_CHAR(x))
#define SERIAL_PROTOCOL_P(p,x) (WITHIN(p, 0, NUM_SERIAL-1) ? (p == 0 ? MYSERIAL0.print(x) : MYSERIAL1.print(x)) : SERIAL_PROTOCOL(x))
#define SERIAL_PROTOCOL_F_P(p,x,y) (WITHIN(p, 0, NUM_SERIAL-1) ? (p == 0 ? MYSERIAL0.print(x,y) : MYSERIAL1.print(x,y)) : SERIAL_PROTOCOL_F(x,y))
#define SERIAL_PROTOCOLLN_P(p,x) (WITHIN(p, 0, NUM_SERIAL-1) ? (p == 0 ? MYSERIAL0.println(x) : MYSERIAL1.println(x)) : SERIAL_PROTOCOLLN(x))
#define SERIAL_PRINT_P(p,x,b) (WITHIN(p, 0, NUM_SERIAL-1) ? (p == 0 ? MYSERIAL0.print(x,b) : MYSERIAL1.print(x,b)) : SERIAL_PRINT(x,b))
#define SERIAL_PRINTLN_P(p,x,b) (WITHIN(p, 0, NUM_SERIAL-1) ? (p == 0 ? MYSERIAL0.println(x,b) : MYSERIAL1.println(x,b)) : SERIAL_PRINTLN(x,b))
#define SERIAL_PRINTF_P(p,args...) (WITHIN(p, 0, NUM_SERIAL-1) ? (p == 0 ? MYSERIAL0.printf(args) : MYSERIAL1.printf(args)) : SERIAL_PRINTF(args))
#define SERIAL_CHAR(x) (MYSERIAL0.write(x), MYSERIAL1.write(x))
#define SERIAL_PROTOCOL(x) (MYSERIAL0.print(x), MYSERIAL1.print(x))
#define SERIAL_PROTOCOL_F(x,y) (MYSERIAL0.print(x,y), MYSERIAL1.print(x,y))
#define SERIAL_PROTOCOLLN(x) (MYSERIAL0.println(x), MYSERIAL1.println(x))
#define SERIAL_PRINT(x,b) (MYSERIAL0.print(x,b), MYSERIAL1.print(x,b))
#define SERIAL_PRINTLN(x,b) (MYSERIAL0.println(x,b), MYSERIAL1.println(x,b))
#define SERIAL_PRINTF(args...) (MYSERIAL0.printf(args), MYSERIAL1.printf(args))
#define SERIAL_FLUSH_P(p) (WITHIN(p, 0, NUM_SERIAL-1) ? (p == 0 ? MYSERIAL0.flush() : MYSERIAL1.flush()) : SERIAL_FLUSH())
#define SERIAL_FLUSH() (MYSERIAL0.flush(), MYSERIAL1.flush())
//
// Serial out to all ports
//
#define SERIAL_CHAR(x) (MYSERIAL0.write(x), MYSERIAL1.write(x))
#define SERIAL_ECHO(x) (MYSERIAL0.print(x), MYSERIAL1.print(x))
#define SERIAL_ECHO_F(x,y) (MYSERIAL0.print(x,y), MYSERIAL1.print(x,y))
#define SERIAL_ECHOLN(x) (MYSERIAL0.println(x), MYSERIAL1.println(x))
#define SERIAL_PRINT(x,b) (MYSERIAL0.print(x,b), MYSERIAL1.print(x,b))
#define SERIAL_PRINTLN(x,b) (MYSERIAL0.println(x,b), MYSERIAL1.println(x,b))
#define SERIAL_PRINTF(args...) (MYSERIAL0.printf(args), MYSERIAL1.printf(args))
#define SERIAL_FLUSH() (MYSERIAL0.flush(), MYSERIAL1.flush())
#if TX_BUFFER_SIZE > 0
#define SERIAL_FLUSHTX_P(p) (WITHIN(p, 0, NUM_SERIAL-1) ? (p == 0 ? MYSERIAL0.flushTX() : MYSERIAL1.flushTX()) : SERIAL_FLUSHTX())
#define SERIAL_FLUSHTX() (MYSERIAL0.flushTX(), MYSERIAL1.flushTX())
#define SERIAL_FLUSHTX() (MYSERIAL0.flushTX(), MYSERIAL1.flushTX())
#endif
#define SERIAL_EOL_P(p) SERIAL_CHAR_P(p,'\n')
//
// Serial out with port redirect
//
#define SERIAL_CHAR_P(p,x) (WITHIN(p, 0, NUM_SERIAL-1) ? (p == 0 ? MYSERIAL0.write(x) : MYSERIAL1.write(x)) : SERIAL_CHAR(x))
#define SERIAL_ECHO_P(p,x) (WITHIN(p, 0, NUM_SERIAL-1) ? (p == 0 ? MYSERIAL0.print(x) : MYSERIAL1.print(x)) : SERIAL_ECHO(x))
#define SERIAL_ECHO_F_P(p,x,y) (WITHIN(p, 0, NUM_SERIAL-1) ? (p == 0 ? MYSERIAL0.print(x,y) : MYSERIAL1.print(x,y)) : SERIAL_ECHO_F(x,y))
#define SERIAL_ECHOLN_P(p,x) (WITHIN(p, 0, NUM_SERIAL-1) ? (p == 0 ? MYSERIAL0.println(x) : MYSERIAL1.println(x)) : SERIAL_ECHOLN(x))
#define SERIAL_PRINT_P(p,x,b) (WITHIN(p, 0, NUM_SERIAL-1) ? (p == 0 ? MYSERIAL0.print(x,b) : MYSERIAL1.print(x,b)) : SERIAL_PRINT(x,b))
#define SERIAL_PRINTLN_P(p,x,b) (WITHIN(p, 0, NUM_SERIAL-1) ? (p == 0 ? MYSERIAL0.println(x,b) : MYSERIAL1.println(x,b)) : SERIAL_PRINTLN(x,b))
#define SERIAL_PRINTF_P(p,args...) (WITHIN(p, 0, NUM_SERIAL-1) ? (p == 0 ? MYSERIAL0.printf(args) : MYSERIAL1.printf(args)) : SERIAL_PRINTF(args))
#define SERIAL_FLUSH_P(p) (WITHIN(p, 0, NUM_SERIAL-1) ? (p == 0 ? MYSERIAL0.flush() : MYSERIAL1.flush()) : SERIAL_FLUSH())
#if TX_BUFFER_SIZE > 0
#define SERIAL_FLUSHTX_P(p) (WITHIN(p, 0, NUM_SERIAL-1) ? (p == 0 ? MYSERIAL0.flushTX() : MYSERIAL1.flushTX()) : SERIAL_FLUSHTX())
#endif
#define SERIAL_PROTOCOLCHAR_P(p,x) SERIAL_CHAR_P(p,x)
#define SERIAL_PROTOCOLPGM_P(p,x) (serialprintPGM_P(p,PSTR(x)))
#define SERIAL_PROTOCOLLNPGM_P(p,x) (serialprintPGM_P(p,PSTR(x "\n")))
#define SERIAL_PROTOCOLPAIR_P(p, pre, value) (serial_echopair_PGM_P(p,PSTR(pre),(value)))
#define SERIAL_PROTOCOLLNPAIR_P(p, pre, value) do{ SERIAL_PROTOCOLPAIR_P(p, pre, value); SERIAL_EOL_P(p); }while(0)
#define SERIAL_ECHOPGM_P(p,x) (serialprintPGM_P(p,PSTR(x)))
#define SERIAL_ECHOLNPGM_P(p,x) (serialprintPGM_P(p,PSTR(x "\n")))
#define SERIAL_ECHOPAIR_P(p, pre, value) (serial_echopair_PGM_P(p,PSTR(pre),(value)))
#define SERIAL_ECHO_START_P(p) serial_echo_start_P(p)
#define SERIAL_ECHO_P(p,x) SERIAL_PROTOCOL_P(p,x)
#define SERIAL_ECHOPGM_P(p,x) SERIAL_PROTOCOLPGM_P(p,x)
#define SERIAL_ECHOLN_P(p,x) SERIAL_PROTOCOLLN_P(p,x)
#define SERIAL_ECHOLNPGM_P(p,x) SERIAL_PROTOCOLLNPGM_P(p,x)
#define SERIAL_ECHOPAIR_P(p,pre,value) SERIAL_PROTOCOLPAIR_P(p, pre, value)
#define SERIAL_ECHOLNPAIR_P(p,pre, value) SERIAL_PROTOCOLLNPAIR_P(p, pre, value)
#define SERIAL_ECHO_F_P(p,x,y) SERIAL_PROTOCOL_F_P(p,x,y)
#define SERIAL_ECHO_START_P(p) serial_echo_start_P(p)
#define SERIAL_ERROR_START_P(p) serial_error_start_P(p)
#define SERIAL_EOL_P(p) SERIAL_CHAR_P(p,'\n')
#define SERIAL_ERROR_START_P(p) serial_error_start_P(p)
#define SERIAL_ERROR_P(p,x) SERIAL_PROTOCOL_P(p,x)
#define SERIAL_ERRORPGM_P(p,x) SERIAL_PROTOCOLPGM_P(p,x)
#define SERIAL_ERRORLN_P(p,x) SERIAL_PROTOCOLLN_P(p,x)
#define SERIAL_ERRORLNPGM_P(p,x) SERIAL_PROTOCOLLNPGM_P(p,x)
#define SERIAL_ECHOPAIR_F_P(p, pre, value, y) do{ SERIAL_ECHO_P(p, pre); SERIAL_ECHO_F_P(p, value, y); }while(0)
#define SERIAL_ECHOLNPAIR_F_P(p, pre, value, y) do{ SERIAL_ECHOPAIR_F_P(p, pre, value, y); SERIAL_EOL_P(p); }while(0)
// These macros compensate for float imprecision
#define SERIAL_PROTOCOLPAIR_F_P(p, pre, value) SERIAL_PROTOCOLPAIR_P(p, pre, FIXFLOAT(value))
#define SERIAL_PROTOCOLLNPAIR_F_P(p, pre, value) SERIAL_PROTOCOLLNPAIR_P(p, pre, FIXFLOAT(value))
#define SERIAL_ECHOPAIR_F_P(p,pre,value) SERIAL_ECHOPAIR_P(p, pre, FIXFLOAT(value))
#define SERIAL_ECHOLNPAIR_F_P(p,pre, value) SERIAL_ECHOLNPAIR_P(p, pre, FIXFLOAT(value))
void serial_echopair_PGM_P(const int8_t p, PGM_P s_P, const char *v);
void serial_echopair_PGM_P(const int8_t p, PGM_P s_P, char v);
void serial_echopair_PGM_P(const int8_t p, PGM_P s_P, int v);
void serial_echopair_PGM_P(const int8_t p, PGM_P s_P, long v);
void serial_echopair_PGM_P(const int8_t p, PGM_P s_P, float v);
void serial_echopair_PGM_P(const int8_t p, PGM_P s_P, double v);
void serial_echopair_PGM_P(const int8_t p, PGM_P s_P, unsigned int v);
void serial_echopair_PGM_P(const int8_t p, PGM_P s_P, unsigned long v);
inline void serial_echopair_PGM_P(const int8_t p, PGM_P s_P, uint8_t v) { serial_echopair_PGM_P(p, s_P, (int)v); }
inline void serial_echopair_PGM_P(const int8_t p, PGM_P s_P, bool v) { serial_echopair_PGM_P(p, s_P, (int)v); }
inline void serial_echopair_PGM_P(const int8_t p, PGM_P s_P, void *v) { serial_echopair_PGM_P(p, s_P, (unsigned long)v); }
void serial_echopair_PGM_P(const int8_t p, PGM_P const s_P, const char *v);
void serial_echopair_PGM_P(const int8_t p, PGM_P const s_P, char v);
void serial_echopair_PGM_P(const int8_t p, PGM_P const s_P, int v);
void serial_echopair_PGM_P(const int8_t p, PGM_P const s_P, long v);
void serial_echopair_PGM_P(const int8_t p, PGM_P const s_P, float v);
void serial_echopair_PGM_P(const int8_t p, PGM_P const s_P, double v);
void serial_echopair_PGM_P(const int8_t p, PGM_P const s_P, unsigned int v);
void serial_echopair_PGM_P(const int8_t p, PGM_P const s_P, unsigned long v);
inline void serial_echopair_PGM_P(const int8_t p, PGM_P const s_P, uint8_t v) { serial_echopair_PGM_P(p, s_P, (int)v); }
inline void serial_echopair_PGM_P(const int8_t p, PGM_P const s_P, bool v) { serial_echopair_PGM_P(p, s_P, (int)v); }
inline void serial_echopair_PGM_P(const int8_t p, PGM_P const s_P, void *v) { serial_echopair_PGM_P(p, s_P, (unsigned long)v); }
void serial_spaces_P(const int8_t p, uint8_t count);
#define SERIAL_ECHO_SP_P(p,C) serial_spaces_P(p,C)
#define SERIAL_ERROR_SP_P(p,C) serial_spaces_P(p,C)
#define SERIAL_PROTOCOL_SP_P(p,C) serial_spaces_P(p,C)
#define SERIAL_ECHO_SP_P(p,C) serial_spaces_P(p,C)
void serialprintPGM_P(const int8_t p, PGM_P str);
void serial_echo_start_P(const int8_t p);
void serial_error_start_P(const int8_t p);
#else // NUM_SERIAL < 2
#else // NUM_SERIAL <= 1
#define SERIAL_CHAR_P(p,x) SERIAL_CHAR(x)
#define SERIAL_PROTOCOL_P(p,x) SERIAL_PROTOCOL(x)
#define SERIAL_PROTOCOL_F_P(p,x,y) SERIAL_PROTOCOL_F(x,y)
#define SERIAL_PROTOCOLLN_P(p,x) SERIAL_PROTOCOLLN(x)
#define SERIAL_PRINT_P(p,x,b) SERIAL_PRINT(x,b)
#define SERIAL_PRINTLN_P(p,x,b) SERIAL_PRINTLN(x,b)
#define SERIAL_PRINTF_P(p,args...) SERIAL_PRINTF(args)
#define SERIAL_CHAR(x) MYSERIAL0.write(x)
#define SERIAL_PROTOCOL(x) MYSERIAL0.print(x)
#define SERIAL_PROTOCOL_F(x,y) MYSERIAL0.print(x,y)
#define SERIAL_PROTOCOLLN(x) MYSERIAL0.println(x)
#define SERIAL_PRINT(x,b) MYSERIAL0.print(x,b)
#define SERIAL_PRINTLN(x,b) MYSERIAL0.println(x,b)
#define SERIAL_PRINTF(args...) MYSERIAL0.printf(args)
#define SERIAL_FLUSH_P(p) SERIAL_FLUSH()
#define SERIAL_FLUSH() MYSERIAL0.flush()
//
// Serial out to all ports
//
#define SERIAL_CHAR(x) MYSERIAL0.write(x)
#define SERIAL_ECHO(x) MYSERIAL0.print(x)
#define SERIAL_ECHO_F(x,y) MYSERIAL0.print(x,y)
#define SERIAL_ECHOLN(x) MYSERIAL0.println(x)
#define SERIAL_PRINT(x,b) MYSERIAL0.print(x,b)
#define SERIAL_PRINTLN(x,b) MYSERIAL0.println(x,b)
#define SERIAL_PRINTF(args...) MYSERIAL0.printf(args)
#define SERIAL_FLUSH() MYSERIAL0.flush()
#if TX_BUFFER_SIZE > 0
#define SERIAL_FLUSHTX_P(p) SERIAL_FLUSHTX()
#define SERIAL_FLUSHTX() MYSERIAL0.flushTX()
#define SERIAL_FLUSHTX() MYSERIAL0.flushTX()
#endif
#define SERIAL_EOL_P(p) SERIAL_EOL()
//
// Serial out with port redirect
//
#define SERIAL_CHAR_P(p,x) SERIAL_CHAR(x)
#define SERIAL_ECHO_P(p,x) SERIAL_ECHO(x)
#define SERIAL_ECHO_F_P(p,x,y) SERIAL_ECHO_F(x,y)
#define SERIAL_ECHOLN_P(p,x) SERIAL_ECHOLN(x)
#define SERIAL_PRINT_P(p,x,b) SERIAL_PRINT(x,b)
#define SERIAL_PRINTLN_P(p,x,b) SERIAL_PRINTLN(x,b)
#define SERIAL_PRINTF_P(p,args...) SERIAL_PRINTF(args)
#define SERIAL_FLUSH_P(p) SERIAL_FLUSH()
#if TX_BUFFER_SIZE > 0
#define SERIAL_FLUSHTX_P(p) SERIAL_FLUSHTX()
#endif
#define SERIAL_PROTOCOLCHAR_P(p,x) SERIAL_PROTOCOLCHAR(x)
#define SERIAL_PROTOCOLPGM_P(p,x) SERIAL_PROTOCOLPGM(x)
#define SERIAL_PROTOCOLLNPGM_P(p,x) SERIAL_PROTOCOLLNPGM(x)
#define SERIAL_PROTOCOLPAIR_P(p, pre, value) SERIAL_PROTOCOLPAIR(pre, value)
#define SERIAL_PROTOCOLLNPAIR_P(p, pre, value) SERIAL_PROTOCOLLNPAIR(pre, value)
#define SERIAL_ECHOPGM_P(p,x) SERIAL_ECHOPGM(x)
#define SERIAL_ECHOLNPGM_P(p,x) SERIAL_ECHOLNPGM(x)
#define SERIAL_ECHOPAIR_P(p, pre, value) SERIAL_ECHOPAIR(pre, value)
#define SERIAL_ECHO_START_P(p) SERIAL_ECHO_START()
#define SERIAL_ECHO_P(p,x) SERIAL_ECHO(x)
#define SERIAL_ECHOPGM_P(p,x) SERIAL_ECHOPGM(x)
#define SERIAL_ECHOLN_P(p,x) SERIAL_ECHOLN(x)
#define SERIAL_ECHOLNPGM_P(p,x) SERIAL_ECHOLNPGM(x)
#define SERIAL_ECHOPAIR_P(p,pre,value) SERIAL_ECHOPAIR(pre, value)
#define SERIAL_ECHOLNPAIR_P(p,pre, value) SERIAL_ECHOLNPAIR(pre, value)
#define SERIAL_ECHO_F_P(p,x,y) SERIAL_ECHO_F(x,y)
#define SERIAL_ECHO_P(p,x) SERIAL_ECHO(x)
#define SERIAL_ECHOLN_P(p,x) SERIAL_ECHOLN(x)
#define SERIAL_ERROR_START_P(p) SERIAL_ERROR_START()
#define SERIAL_ERROR_P(p,x) SERIAL_ERROR(x)
#define SERIAL_ERRORPGM_P(p,x) SERIAL_ERRORPGM(x)
#define SERIAL_ERRORLN_P(p,x) SERIAL_ERRORLN(x)
#define SERIAL_ERRORLNPGM_P(p,x) SERIAL_ERRORLNPGM(x)
#define SERIAL_ECHO_START_P(p) SERIAL_ECHO_START()
#define SERIAL_ERROR_START_P(p) SERIAL_ERROR_START()
#define SERIAL_EOL_P(p) SERIAL_EOL()
// These macros compensate for float imprecision
#define SERIAL_PROTOCOLPAIR_F_P(p, pre, value) SERIAL_PROTOCOLPAIR_F(pre, value)
#define SERIAL_PROTOCOLLNPAIR_F_P(p, pre, value) SERIAL_PROTOCOLLNPAIR_F(pre, value)
#define SERIAL_ECHOPAIR_F_P(p,pre,value) SERIAL_ECHOPAIR_F(pre, value)
#define SERIAL_ECHOLNPAIR_F_P(p,pre, value) SERIAL_ECHOLNPAIR_F(pre, value)
#define SERIAL_ECHOPAIR_F_P(p, pre, value, y) SERIAL_ECHOPAIR_F(pre, value, y)
#define SERIAL_ECHOLNPAIR_F_P(p, pre, value, y) SERIAL_ECHOLNPAIR_F(pre, value, y)
#define serial_echopair_PGM_P(p,s_P,v) serial_echopair_PGM(s_P, v)
#define serial_echopair_PGM_P(p,s_P,v) serial_echopair_PGM(s_P, v)
#define serial_spaces_P(p,c) serial_spaces(c)
#define SERIAL_ECHO_SP_P(p,C) SERIAL_ECHO_SP(C)
#define SERIAL_ERROR_SP_P(p,C) SERIAL_ERROR_SP(C)
#define SERIAL_PROTOCOL_SP_P(p,C) SERIAL_PROTOCOL_SP(C)
#define serial_spaces_P(p,c) serial_spaces(c)
#define SERIAL_ECHO_SP_P(p,C) SERIAL_ECHO_SP(C)
#define serialprintPGM_P(p,s) serialprintPGM(s)
#define serialprintPGM_P(p,s) serialprintPGM(s)
#endif // NUM_SERIAL < 2
#define SERIAL_EOL() SERIAL_CHAR('\n')
#define SERIAL_ECHOPGM(x) (serialprintPGM(PSTR(x)))
#define SERIAL_ECHOLNPGM(x) (serialprintPGM(PSTR(x "\n")))
#define SERIAL_ECHOPAIR(pre, value) (serial_echopair_PGM(PSTR(pre), value))
#define SERIAL_ECHOLNPAIR(pre, value) do { SERIAL_ECHOPAIR(pre, value); SERIAL_EOL(); } while(0)
#define SERIAL_PROTOCOLCHAR(x) SERIAL_CHAR(x)
#define SERIAL_PROTOCOLPGM(x) (serialprintPGM(PSTR(x)))
#define SERIAL_PROTOCOLLNPGM(x) (serialprintPGM(PSTR(x "\n")))
#define SERIAL_PROTOCOLPAIR(pre, value) (serial_echopair_PGM(PSTR(pre), value))
#define SERIAL_PROTOCOLLNPAIR(pre, value) do { SERIAL_PROTOCOLPAIR(pre, value); SERIAL_EOL(); } while(0)
#define SERIAL_ECHOPAIR_F(pre, value, y) do{ SERIAL_ECHO(pre); SERIAL_ECHO_F(value, y); }while(0)
#define SERIAL_ECHOLNPAIR_F(pre, value, y) do{ SERIAL_ECHOPAIR_F(pre, value, y); SERIAL_EOL(); }while(0)
#define SERIAL_ECHO_START() serial_echo_start()
#define SERIAL_ECHO(x) SERIAL_PROTOCOL(x)
#define SERIAL_ECHOPGM(x) SERIAL_PROTOCOLPGM(x)
#define SERIAL_ECHOLN(x) SERIAL_PROTOCOLLN(x)
#define SERIAL_ECHOLNPGM(x) SERIAL_PROTOCOLLNPGM(x)
#define SERIAL_ECHOPAIR(pre,value) SERIAL_PROTOCOLPAIR(pre, value)
#define SERIAL_ECHOLNPAIR(pre, value) SERIAL_PROTOCOLLNPAIR(pre, value)
#define SERIAL_ECHO_F(x,y) SERIAL_PROTOCOL_F(x, y)
#define SERIAL_ECHO_START() serial_echo_start()
#define SERIAL_ERROR_START() serial_error_start()
#define SERIAL_EOL() SERIAL_CHAR('\n')
#define SERIAL_ERROR_START() serial_error_start()
#define SERIAL_ERROR(x) SERIAL_PROTOCOL(x)
#define SERIAL_ERRORPGM(x) SERIAL_PROTOCOLPGM(x)
#define SERIAL_ERRORLN(x) SERIAL_PROTOCOLLN(x)
#define SERIAL_ERRORLNPGM(x) SERIAL_PROTOCOLLNPGM(x)
#define SERIAL_ECHO_MSG(STR) do{ SERIAL_ECHO_START(); SERIAL_ECHOLNPGM(STR); }while(0)
#define SERIAL_ECHO_MSG_P(p, STR) do{ SERIAL_ECHO_START_P(p); SERIAL_ECHOLNPGM_P(p, STR); }while(0)
#define SERIAL_ERROR_MSG(STR) do{ SERIAL_ERROR_START(); SERIAL_ECHOLNPGM(STR); }while(0)
#define SERIAL_ERROR_MSG_P(p, STR) do{ SERIAL_ERROR_START_P(p); SERIAL_ECHOLNPGM_P(p, STR); }while(0)
// These macros compensate for float imprecision
#define SERIAL_PROTOCOLPAIR_F(pre, value) SERIAL_PROTOCOLPAIR(pre, FIXFLOAT(value))
#define SERIAL_PROTOCOLLNPAIR_F(pre, value) SERIAL_PROTOCOLLNPAIR(pre, FIXFLOAT(value))
#define SERIAL_ECHOPAIR_F(pre,value) SERIAL_ECHOPAIR(pre, FIXFLOAT(value))
#define SERIAL_ECHOLNPAIR_F(pre, value) SERIAL_ECHOLNPAIR(pre, FIXFLOAT(value))
void serial_echopair_PGM(PGM_P s_P, const char *v);
void serial_echopair_PGM(PGM_P s_P, char v);
void serial_echopair_PGM(PGM_P s_P, int v);
void serial_echopair_PGM(PGM_P s_P, long v);
void serial_echopair_PGM(PGM_P s_P, float v);
void serial_echopair_PGM(PGM_P s_P, double v);
void serial_echopair_PGM(PGM_P s_P, unsigned int v);
void serial_echopair_PGM(PGM_P s_P, unsigned long v);
inline void serial_echopair_PGM(PGM_P s_P, uint8_t v) { serial_echopair_PGM(s_P, (int)v); }
inline void serial_echopair_PGM(PGM_P s_P, bool v) { serial_echopair_PGM(s_P, (int)v); }
inline void serial_echopair_PGM(PGM_P s_P, void *v) { serial_echopair_PGM(s_P, (unsigned long)v); }
#define SERIAL_ECHOLNPAIR_P(p, pre, value) do{ SERIAL_ECHOPAIR_P(p, pre, value); SERIAL_EOL_P(p); }while(0)
void serial_spaces(uint8_t count);
#define SERIAL_ECHO_SP(C) serial_spaces(C)
#define SERIAL_ERROR_SP(C) serial_spaces(C)
#define SERIAL_PROTOCOL_SP(C) serial_spaces(C)
#define SERIAL_ECHO_SP(C) serial_spaces(C)
//
// Functions for serial printing from PROGMEM. (Saves loads of SRAM.)
//
void serial_echopair_PGM(PGM_P const s_P, const char *v);
void serial_echopair_PGM(PGM_P const s_P, char v);
void serial_echopair_PGM(PGM_P const s_P, int v);
void serial_echopair_PGM(PGM_P const s_P, long v);
void serial_echopair_PGM(PGM_P const s_P, float v);
void serial_echopair_PGM(PGM_P const s_P, double v);
void serial_echopair_PGM(PGM_P const s_P, unsigned int v);
void serial_echopair_PGM(PGM_P const s_P, unsigned long v);
inline void serial_echopair_PGM(PGM_P const s_P, uint8_t v) { serial_echopair_PGM(s_P, (int)v); }
inline void serial_echopair_PGM(PGM_P const s_P, bool v) { serial_echopair_PGM(s_P, (int)v); }
inline void serial_echopair_PGM(PGM_P const s_P, void *v) { serial_echopair_PGM(s_P, (unsigned long)v); }
void serialprintPGM(PGM_P str);
void serial_echo_start();
void serial_error_start();
@ -242,7 +208,7 @@ void serialprint_onoff(const bool onoff);
void serialprintln_onoff(const bool onoff);
#if ENABLED(DEBUG_LEVELING_FEATURE)
void print_xyz(PGM_P prefix, PGM_P suffix, const float x, const float y, const float z);
void print_xyz(PGM_P prefix, PGM_P suffix, const float xyz[]);
void print_xyz(PGM_P const prefix, PGM_P const suffix, const float x, const float y, const float z);
void print_xyz(PGM_P const prefix, PGM_P const suffix, const float xyz[]);
#define DEBUG_POS(SUFFIX,VAR) do { print_xyz(PSTR(" " STRINGIFY(VAR) "="), PSTR(" : " SUFFIX "\n"), VAR); } while(0)
#endif

View file

@ -66,8 +66,7 @@ void I2CPositionEncoder::update() {
/*
if (trusted) { //commented out as part of the note below
trusted = false;
SERIAL_ECHOPGM("Fault detected on ");
SERIAL_ECHO(axis_codes[encoderAxis]);
SERIAL_ECHOPAIR("Fault detected on ", axis_codes[encoderAxis]);
SERIAL_ECHOLNPGM(" axis encoder. Disengaging error correction until module is trusted again.");
}
*/
@ -93,8 +92,7 @@ void I2CPositionEncoder::update() {
if (millis() - lastErrorTime > I2CPE_TIME_TRUSTED) {
trusted = true;
SERIAL_ECHOPGM("Untrusted encoder module on ");
SERIAL_ECHO(axis_codes[encoderAxis]);
SERIAL_ECHOPAIR("Untrusted encoder module on ", axis_codes[encoderAxis]);
SERIAL_ECHOLNPGM(" axis has been fault-free for set duration, reinstating error correction.");
//the encoder likely lost its place when the error occured, so we'll reset and use the printer's
@ -106,17 +104,10 @@ void I2CPositionEncoder::update() {
zeroOffset -= (positionInTicks - get_position());
#ifdef I2CPE_DEBUG
SERIAL_ECHOPGM("Current position is ");
SERIAL_ECHOLN(pos);
SERIAL_ECHOPGM("Position in encoder ticks is ");
SERIAL_ECHOLN(positionInTicks);
SERIAL_ECHOPGM("New zero-offset of ");
SERIAL_ECHOLN(zeroOffset);
SERIAL_ECHOPGM("New position reads as ");
SERIAL_ECHO(get_position());
SERIAL_ECHOLNPAIR("Current position is ", pos);
SERIAL_ECHOLNPAIR("Position in encoder ticks is ", positionInTicks);
SERIAL_ECHOLNPAIR("New zero-offset of ", zeroOffset);
SERIAL_ECHOPAIR("New position reads as ", get_position());
SERIAL_CHAR('(');
SERIAL_ECHO(mm_from_count(get_position()));
SERIAL_ECHOLNPGM(")");
@ -159,14 +150,12 @@ void I2CPositionEncoder::update() {
const int32_t error = get_axis_error_steps(false);
#endif
//SERIAL_ECHOPGM("Axis error steps: ");
//SERIAL_ECHOLN(error);
//SERIAL_ECHOLNPAIR("Axis error steps: ", error);
#ifdef I2CPE_ERR_THRESH_ABORT
if (ABS(error) > I2CPE_ERR_THRESH_ABORT * planner.settings.axis_steps_per_mm[encoderAxis]) {
//kill(PSTR("Significant Error"));
SERIAL_ECHOPGM("Axis error greater than set threshold, aborting!");
SERIAL_ECHOLN(error);
SERIAL_ECHOLNPAIR("Axis error greater than set threshold, aborting!", error);
safe_delay(5000);
}
#endif
@ -800,33 +789,33 @@ int8_t I2CPositionEncodersMgr::parse() {
if (parser.seen('A')) {
if (!parser.has_value()) {
SERIAL_PROTOCOLLNPGM("?A seen, but no address specified! [30-200]");
SERIAL_ECHOLNPGM("?A seen, but no address specified! [30-200]");
return I2CPE_PARSE_ERR;
};
I2CPE_addr = parser.value_byte();
if (!WITHIN(I2CPE_addr, 30, 200)) { // reserve the first 30 and last 55
SERIAL_PROTOCOLLNPGM("?Address out of range. [30-200]");
SERIAL_ECHOLNPGM("?Address out of range. [30-200]");
return I2CPE_PARSE_ERR;
}
I2CPE_idx = idx_from_addr(I2CPE_addr);
if (I2CPE_idx >= I2CPE_ENCODER_CNT) {
SERIAL_PROTOCOLLNPGM("?No device with this address!");
SERIAL_ECHOLNPGM("?No device with this address!");
return I2CPE_PARSE_ERR;
}
}
else if (parser.seenval('I')) {
if (!parser.has_value()) {
SERIAL_PROTOCOLLNPAIR("?I seen, but no index specified! [0-", I2CPE_ENCODER_CNT - 1);
SERIAL_PROTOCOLLNPGM("]");
SERIAL_ECHOLNPAIR("?I seen, but no index specified! [0-", I2CPE_ENCODER_CNT - 1);
SERIAL_ECHOLNPGM("]");
return I2CPE_PARSE_ERR;
};
I2CPE_idx = parser.value_byte();
if (I2CPE_idx >= I2CPE_ENCODER_CNT) {
SERIAL_PROTOCOLLNPAIR("?Index out of range. [0-", I2CPE_ENCODER_CNT - 1);
SERIAL_ECHOLNPAIR("?Index out of range. [0-", I2CPE_ENCODER_CNT - 1);
SERIAL_ECHOLNPGM("]");
return I2CPE_PARSE_ERR;
}
@ -984,18 +973,18 @@ void I2CPositionEncodersMgr::M864() {
if (parser.seen('S')) {
if (!parser.has_value()) {
SERIAL_PROTOCOLLNPGM("?S seen, but no address specified! [30-200]");
SERIAL_ECHOLNPGM("?S seen, but no address specified! [30-200]");
return;
};
newAddress = parser.value_byte();
if (!WITHIN(newAddress, 30, 200)) {
SERIAL_PROTOCOLLNPGM("?New address out of range. [30-200]");
SERIAL_ECHOLNPGM("?New address out of range. [30-200]");
return;
}
}
else if (!I2CPE_anyaxis) {
SERIAL_PROTOCOLLNPGM("?You must specify S or [XYZE].");
SERIAL_ECHOLNPGM("?You must specify S or [XYZE].");
return;
}
else {

View file

@ -288,7 +288,7 @@ class I2CPositionEncodersMgr {
CHECK_IDX();
encoders[idx].set_ec_threshold(newThreshold);
SERIAL_ECHOPAIR("Error correct threshold for ", axis_codes[axis]);
SERIAL_ECHOPAIR_F(" axis set to ", newThreshold);
SERIAL_ECHOPAIR(" axis set to ", FIXFLOAT(newThreshold));
SERIAL_ECHOLNPGM("mm.");
}
@ -296,7 +296,7 @@ class I2CPositionEncodersMgr {
CHECK_IDX();
const float threshold = encoders[idx].get_ec_threshold();
SERIAL_ECHOPAIR("Error correct threshold for ", axis_codes[axis]);
SERIAL_ECHOPAIR_F(" axis is ", threshold);
SERIAL_ECHOPAIR(" axis is ", FIXFLOAT(threshold));
SERIAL_ECHOLNPGM("mm.");
}

View file

@ -160,50 +160,50 @@ void reset_bed_level() {
#ifndef SCAD_MESH_OUTPUT
for (uint8_t x = 0; x < sx; x++) {
serial_spaces(precision + (x < 10 ? 3 : 2));
SERIAL_PROTOCOL(int(x));
SERIAL_ECHO(int(x));
}
SERIAL_EOL();
#endif
#ifdef SCAD_MESH_OUTPUT
SERIAL_PROTOCOLLNPGM("measured_z = ["); // open 2D array
SERIAL_ECHOLNPGM("measured_z = ["); // open 2D array
#endif
for (uint8_t y = 0; y < sy; y++) {
#ifdef SCAD_MESH_OUTPUT
SERIAL_PROTOCOLPGM(" ["); // open sub-array
SERIAL_ECHOPGM(" ["); // open sub-array
#else
if (y < 10) SERIAL_PROTOCOLCHAR(' ');
SERIAL_PROTOCOL(int(y));
if (y < 10) SERIAL_CHAR(' ');
SERIAL_ECHO(int(y));
#endif
for (uint8_t x = 0; x < sx; x++) {
SERIAL_PROTOCOLCHAR(' ');
SERIAL_CHAR(' ');
const float offset = fn(x, y);
if (!isnan(offset)) {
if (offset >= 0) SERIAL_PROTOCOLCHAR('+');
SERIAL_PROTOCOL_F(offset, int(precision));
if (offset >= 0) SERIAL_CHAR('+');
SERIAL_ECHO_F(offset, int(precision));
}
else {
#ifdef SCAD_MESH_OUTPUT
for (uint8_t i = 3; i < precision + 3; i++)
SERIAL_PROTOCOLCHAR(' ');
SERIAL_PROTOCOLPGM("NAN");
SERIAL_CHAR(' ');
SERIAL_ECHOPGM("NAN");
#else
for (uint8_t i = 0; i < precision + 3; i++)
SERIAL_PROTOCOLCHAR(i ? '=' : ' ');
SERIAL_CHAR(i ? '=' : ' ');
#endif
}
#ifdef SCAD_MESH_OUTPUT
if (x < sx - 1) SERIAL_PROTOCOLCHAR(',');
if (x < sx - 1) SERIAL_CHAR(',');
#endif
}
#ifdef SCAD_MESH_OUTPUT
SERIAL_PROTOCOLCHAR(' ');
SERIAL_PROTOCOLCHAR(']'); // close sub-array
if (y < sy - 1) SERIAL_PROTOCOLCHAR(',');
SERIAL_CHAR(' ');
SERIAL_CHAR(']'); // close sub-array
if (y < sy - 1) SERIAL_CHAR(',');
#endif
SERIAL_EOL();
}
#ifdef SCAD_MESH_OUTPUT
SERIAL_PROTOCOLPGM("];"); // close 2D array
SERIAL_ECHOPGM("];"); // close 2D array
#endif
SERIAL_EOL();
}

View file

@ -119,9 +119,8 @@
#endif // IS_CARTESIAN && !SEGMENT_LEVELED_MOVES
void mesh_bed_leveling::report_mesh() {
SERIAL_PROTOCOLPGM(STRINGIFY(GRID_MAX_POINTS_X) "x" STRINGIFY(GRID_MAX_POINTS_Y) " mesh. Z offset: ");
SERIAL_PROTOCOL_F(z_offset, 5);
SERIAL_PROTOCOLLNPGM("\nMeasured points:");
SERIAL_ECHOPAIR_F(STRINGIFY(GRID_MAX_POINTS_X) "x" STRINGIFY(GRID_MAX_POINTS_Y) " mesh. Z offset: ", z_offset, 5);
SERIAL_ECHOLNPGM("\nMeasured points:");
print_2d_array(GRID_MAX_POINTS_X, GRID_MAX_POINTS_Y, 5,
[](const uint8_t ix, const uint8_t iy) { return z_values[ix][iy]; }
);

View file

@ -39,7 +39,7 @@
const int8_t port/*= -1*/
#endif
) {
SERIAL_PROTOCOLPGM_P(port, "Unified Bed Leveling");
SERIAL_ECHOPGM_P(port, "Unified Bed Leveling");
}
void unified_bed_leveling::report_current_mesh(
@ -48,16 +48,14 @@
#endif
) {
if (!leveling_is_valid()) return;
SERIAL_ECHO_START_P(port);
SERIAL_ECHOLNPGM_P(port, " G29 I99");
SERIAL_ECHO_MSG_P(port, " G29 I99");
for (uint8_t x = 0; x < GRID_MAX_POINTS_X; x++)
for (uint8_t y = 0; y < GRID_MAX_POINTS_Y; y++)
if (!isnan(z_values[x][y])) {
SERIAL_ECHO_START_P(port);
SERIAL_ECHOPAIR_P(port, " M421 I", x);
SERIAL_ECHOPAIR_P(port, " J", y);
SERIAL_ECHOPGM_P(port, " Z");
SERIAL_ECHO_F_P(port, z_values[x][y], 2);
SERIAL_ECHOPAIR_F_P(port, " Z", z_values[x][y], 2);
SERIAL_EOL_P(port);
serial_delay(75); // Prevent Printrun from exploding
}
@ -73,9 +71,9 @@
port
#endif
);
SERIAL_PROTOCOLPGM_P(port, " System v" UBL_VERSION " ");
if (!planner.leveling_active) SERIAL_PROTOCOLPGM_P(port, "in");
SERIAL_PROTOCOLLNPGM_P(port, "active.");
SERIAL_ECHOPGM_P(port, " System v" UBL_VERSION " ");
if (!planner.leveling_active) SERIAL_ECHOPGM_P(port, "in");
SERIAL_ECHOLNPGM_P(port, "active.");
serial_delay(50);
}
@ -105,16 +103,16 @@
if (xy_dist == 0.0) return;
const float fpmm = de / xy_dist;
SERIAL_ECHOPGM(" fpmm="); SERIAL_ECHO_F(fpmm, 6);
SERIAL_ECHOPGM(" current=( ");
SERIAL_ECHO_F(current_position[X_AXIS], 6); SERIAL_ECHOPGM(", ");
SERIAL_ECHO_F(current_position[Y_AXIS], 6); SERIAL_ECHOPGM(", ");
SERIAL_ECHO_F(current_position[Z_AXIS], 6); SERIAL_ECHOPGM(", ");
SERIAL_ECHO_F(current_position[E_AXIS], 6); SERIAL_ECHOPGM(" ) destination=( ");
debug_echo_axis(X_AXIS); SERIAL_ECHOPGM(", ");
debug_echo_axis(Y_AXIS); SERIAL_ECHOPGM(", ");
debug_echo_axis(Z_AXIS); SERIAL_ECHOPGM(", ");
debug_echo_axis(E_AXIS); SERIAL_ECHOPGM(" ) ");
SERIAL_ECHOPAIR_F(" fpmm=", fpmm, 6);
SERIAL_ECHOPAIR_F(" current=( ", current_position[X_AXIS], 6);
SERIAL_ECHOPAIR_F(", ", current_position[Y_AXIS], 6);
SERIAL_ECHOPAIR_F(", ", current_position[Z_AXIS], 6);
SERIAL_ECHOPAIR_F(", ", current_position[E_AXIS], 6);
SERIAL_ECHOPGM(" ) destination=( "); debug_echo_axis(X_AXIS);
SERIAL_ECHOPGM(", "); debug_echo_axis(Y_AXIS);
SERIAL_ECHOPGM(", "); debug_echo_axis(Z_AXIS);
SERIAL_ECHOPGM(", "); debug_echo_axis(E_AXIS);
SERIAL_ECHOPGM(" ) ");
serialprintPGM(title);
SERIAL_EOL();
}
@ -279,7 +277,7 @@
uint8_t error_flag = 0;
if (settings.calc_num_meshes() < 1) {
SERIAL_PROTOCOLLNPGM("?Mesh too big for EEPROM.");
SERIAL_ECHOLNPGM("?Mesh too big for EEPROM.");
error_flag++;
}

View file

@ -308,19 +308,13 @@ class unified_bed_leveling {
#if ENABLED(DEBUG_LEVELING_FEATURE)
if (DEBUGGING(MESH_ADJUST)) {
SERIAL_ECHOPAIR(" raw get_z_correction(", rx0);
SERIAL_CHAR(',');
SERIAL_ECHO(ry0);
SERIAL_ECHOPGM(") = ");
SERIAL_ECHO_F(z0, 6);
SERIAL_CHAR(','); SERIAL_ECHO(ry0);
SERIAL_ECHOPAIR_F(") = ", z0, 6);
}
#endif
#if ENABLED(DEBUG_LEVELING_FEATURE)
if (DEBUGGING(MESH_ADJUST)) {
SERIAL_ECHOPGM(" >>>---> ");
SERIAL_ECHO_F(z0, 6);
SERIAL_EOL();
}
if (DEBUGGING(MESH_ADJUST)) SERIAL_ECHOLNPAIR_F(" >>>---> ", z0, 6);
#endif
if (isnan(z0)) { // if part of the Mesh is undefined, it will show up as NAN

View file

@ -331,23 +331,23 @@
// meant to invalidate the ENTIRE mesh, which cannot be done with
// find_closest_mesh_point loop which only returns REACHABLE points.
set_all_mesh_points_to_value(NAN);
SERIAL_PROTOCOLLNPGM("Entire Mesh invalidated.\n");
SERIAL_ECHOLNPGM("Entire Mesh invalidated.\n");
break; // No more invalid Mesh Points to populate
}
z_values[location.x_index][location.y_index] = NAN;
cnt++;
}
}
SERIAL_PROTOCOLLNPGM("Locations invalidated.\n");
SERIAL_ECHOLNPGM("Locations invalidated.\n");
}
if (parser.seen('Q')) {
const int test_pattern = parser.has_value() ? parser.value_int() : -99;
if (!WITHIN(test_pattern, -1, 2)) {
SERIAL_PROTOCOLLNPGM("Invalid test_pattern value. (-1 to 2)\n");
SERIAL_ECHOLNPGM("Invalid test_pattern value. (-1 to 2)\n");
return;
}
SERIAL_PROTOCOLLNPGM("Loading test_pattern values.\n");
SERIAL_ECHOLNPGM("Loading test_pattern values.\n");
switch (test_pattern) {
#if ENABLED(UBL_DEVEL_DEBUGGING)
@ -405,7 +405,7 @@
if (parser.seen('P')) {
if (WITHIN(g29_phase_value, 0, 1) && storage_slot == -1) {
storage_slot = 0;
SERIAL_PROTOCOLLNPGM("Default storage slot 0 selected.");
SERIAL_ECHOLNPGM("Default storage slot 0 selected.");
}
switch (g29_phase_value) {
@ -414,7 +414,7 @@
// Zero Mesh Data
//
reset();
SERIAL_PROTOCOLLNPGM("Mesh zeroed.");
SERIAL_ECHOLNPGM("Mesh zeroed.");
break;
#if HAS_BED_PROBE
@ -425,13 +425,13 @@
//
if (!parser.seen('C')) {
invalidate();
SERIAL_PROTOCOLLNPGM("Mesh invalidated. Probing mesh.");
SERIAL_ECHOLNPGM("Mesh invalidated. Probing mesh.");
}
if (g29_verbose_level > 1) {
SERIAL_PROTOCOLPAIR("Probing Mesh Points Closest to (", g29_x_pos);
SERIAL_PROTOCOLCHAR(',');
SERIAL_PROTOCOL(g29_y_pos);
SERIAL_PROTOCOLLNPGM(").\n");
SERIAL_ECHOPAIR("Probing Mesh Points Closest to (", g29_x_pos);
SERIAL_CHAR(',');
SERIAL_ECHO(g29_y_pos);
SERIAL_ECHOLNPGM(").\n");
}
probe_entire_mesh(g29_x_pos + X_PROBE_OFFSET_FROM_EXTRUDER, g29_y_pos + Y_PROBE_OFFSET_FROM_EXTRUDER,
parser.seen('T'), parser.seen('E'), parser.seen('U'));
@ -446,7 +446,7 @@
//
// Manually Probe Mesh in areas that can't be reached by the probe
//
SERIAL_PROTOCOLLNPGM("Manually probing unreachable mesh locations.");
SERIAL_ECHOLNPGM("Manually probing unreachable mesh locations.");
do_blocking_move_to_z(Z_CLEARANCE_BETWEEN_PROBES);
if (parser.seen('C') && !g29_x_flag && !g29_y_flag) {
@ -469,26 +469,26 @@
if (parser.seen('B')) {
g29_card_thickness = parser.has_value() ? parser.value_float() : measure_business_card_thickness((float) Z_CLEARANCE_BETWEEN_PROBES);
if (ABS(g29_card_thickness) > 1.5f) {
SERIAL_PROTOCOLLNPGM("?Error in Business Card measurement.");
SERIAL_ECHOLNPGM("?Error in Business Card measurement.");
return;
}
}
if (!position_is_reachable(g29_x_pos, g29_y_pos)) {
SERIAL_PROTOCOLLNPGM("XY outside printable radius.");
SERIAL_ECHOLNPGM("XY outside printable radius.");
return;
}
const float height = parser.floatval('H', Z_CLEARANCE_BETWEEN_PROBES);
manually_probe_remaining_mesh(g29_x_pos, g29_y_pos, height, g29_card_thickness, parser.seen('T'));
SERIAL_PROTOCOLLNPGM("G29 P2 finished.");
SERIAL_ECHOLNPGM("G29 P2 finished.");
report_current_position();
#else
SERIAL_PROTOCOLLNPGM("?P2 is only available when an LCD is present.");
SERIAL_ECHOLNPGM("?P2 is only available when an LCD is present.");
return;
#endif
@ -553,7 +553,7 @@
#if HAS_LCD_MENU
fine_tune_mesh(g29_x_pos, g29_y_pos, parser.seen('T'));
#else
SERIAL_PROTOCOLLNPGM("?P4 is only available when an LCD is present.");
SERIAL_ECHOLNPGM("?P4 is only available when an LCD is present.");
return;
#endif
break;
@ -593,20 +593,20 @@
int16_t a = settings.calc_num_meshes();
if (!a) {
SERIAL_PROTOCOLLNPGM("?EEPROM storage not available.");
SERIAL_ECHOLNPGM("?EEPROM storage not available.");
return;
}
if (!WITHIN(g29_storage_slot, 0, a - 1)) {
SERIAL_PROTOCOLLNPGM("?Invalid storage slot.");
SERIAL_PROTOCOLLNPAIR("?Use 0 to ", a - 1);
SERIAL_ECHOLNPGM("?Invalid storage slot.");
SERIAL_ECHOLNPAIR("?Use 0 to ", a - 1);
return;
}
settings.load_mesh(g29_storage_slot);
storage_slot = g29_storage_slot;
SERIAL_PROTOCOLLNPGM("Done.");
SERIAL_ECHOLNPGM("Done.");
}
//
@ -622,20 +622,20 @@
int16_t a = settings.calc_num_meshes();
if (!a) {
SERIAL_PROTOCOLLNPGM("?EEPROM storage not available.");
SERIAL_ECHOLNPGM("?EEPROM storage not available.");
goto LEAVE;
}
if (!WITHIN(g29_storage_slot, 0, a - 1)) {
SERIAL_PROTOCOLLNPGM("?Invalid storage slot.");
SERIAL_PROTOCOLLNPAIR("?Use 0 to ", a - 1);
SERIAL_ECHOLNPGM("?Invalid storage slot.");
SERIAL_ECHOLNPAIR("?Use 0 to ", a - 1);
goto LEAVE;
}
settings.store_mesh(g29_storage_slot);
storage_slot = g29_storage_slot;
SERIAL_PROTOCOLLNPGM("Done.");
SERIAL_ECHOLNPGM("Done.");
}
if (parser.seen('T'))
@ -675,14 +675,10 @@
sum_of_diff_squared += sq(z_values[x][y] - mean);
SERIAL_ECHOLNPAIR("# of samples: ", n);
SERIAL_ECHOPGM("Mean Mesh Height: ");
SERIAL_ECHO_F(mean, 6);
SERIAL_EOL();
SERIAL_ECHOLNPAIR_F("Mean Mesh Height: ", mean, 6);
const float sigma = SQRT(sum_of_diff_squared / (n + 1));
SERIAL_ECHOPGM("Standard Deviation: ");
SERIAL_ECHO_F(sigma, 6);
SERIAL_EOL();
SERIAL_ECHOLNPAIR_F("Standard Deviation: ", sigma, 6);
if (cflag)
for (uint8_t x = 0; x < GRID_MAX_POINTS_X; x++)
@ -721,7 +717,7 @@
#if HAS_LCD_MENU
if (ui.button_pressed()) {
ui.quick_feedback(false); // Preserve button state for click-and-hold
SERIAL_PROTOCOLLNPGM("\nMesh only partially populated.\n");
SERIAL_ECHOLNPGM("\nMesh only partially populated.\n");
STOW_PROBE();
ui.wait_for_release();
ui.quick_feedback();
@ -803,7 +799,7 @@
return current_position[Z_AXIS];
}
static void echo_and_take_a_measurement() { SERIAL_PROTOCOLLNPGM(" and take a measurement."); }
static void echo_and_take_a_measurement() { SERIAL_ECHOLNPGM(" and take a measurement."); }
float unified_bed_leveling::measure_business_card_thickness(float in_height) {
ui.capture();
@ -813,7 +809,7 @@
//, MIN(planner.settings.max_feedrate_mm_s[X_AXIS], planner.settings.max_feedrate_mm_s[Y_AXIS]) * 0.5f);
planner.synchronize();
SERIAL_PROTOCOLPGM("Place shim under nozzle");
SERIAL_ECHOPGM("Place shim under nozzle");
LCD_MESSAGEPGM(MSG_UBL_BC_INSERT);
ui.return_to_status();
echo_and_take_a_measurement();
@ -822,7 +818,7 @@
do_blocking_move_to_z(current_position[Z_AXIS] + SIZE_OF_LITTLE_RAISE);
planner.synchronize();
SERIAL_PROTOCOLPGM("Remove shim");
SERIAL_ECHOPGM("Remove shim");
LCD_MESSAGEPGM(MSG_UBL_BC_REMOVE);
echo_and_take_a_measurement();
@ -833,9 +829,8 @@
const float thickness = ABS(z1 - z2);
if (g29_verbose_level > 1) {
SERIAL_PROTOCOLPGM("Business Card is ");
SERIAL_PROTOCOL_F(thickness, 4);
SERIAL_PROTOCOLLNPGM("mm thick.");
SERIAL_ECHOPAIR_F("Business Card is ", thickness, 4);
SERIAL_ECHOLNPGM("mm thick.");
}
ui.release();
@ -846,7 +841,7 @@
}
void abort_manual_probe_remaining_mesh() {
SERIAL_PROTOCOLLNPGM("\nMesh only partially populated.");
SERIAL_ECHOLNPGM("\nMesh only partially populated.");
do_blocking_move_to_z(Z_CLEARANCE_DEPLOY_PROBE);
ui.release();
KEEPALIVE_STATE(IN_HANDLER);
@ -892,7 +887,7 @@
move_z_with_encoder(z_step);
if (click_and_hold()) {
SERIAL_PROTOCOLLNPGM("\nMesh only partially populated.");
SERIAL_ECHOLNPGM("\nMesh only partially populated.");
do_blocking_move_to_z(Z_CLEARANCE_DEPLOY_PROBE);
ui.release();
KEEPALIVE_STATE(IN_HANDLER);
@ -901,11 +896,8 @@
}
z_values[location.x_index][location.y_index] = current_position[Z_AXIS] - thick;
if (g29_verbose_level > 2) {
SERIAL_PROTOCOLPGM("Mesh Point Measured at: ");
SERIAL_PROTOCOL_F(z_values[location.x_index][location.y_index], 6);
SERIAL_EOL();
}
if (g29_verbose_level > 2)
SERIAL_ECHOLNPAIR_F("Mesh Point Measured at: ", z_values[location.x_index][location.y_index], 6);
SERIAL_FLUSH(); // Prevent host M105 buffer overrun.
} while (location.x_index >= 0 && location.y_index >= 0);
@ -934,7 +926,7 @@
#if ENABLED(UBL_MESH_EDIT_MOVES_Z)
const float h_offset = parser.seenval('H') ? parser.value_linear_units() : 0;
if (!WITHIN(h_offset, 0, 10)) {
SERIAL_PROTOCOLLNPGM("Offset out of bounds. (0 to 10mm)\n");
SERIAL_ECHOLNPGM("Offset out of bounds. (0 to 10mm)\n");
return;
}
#endif
@ -942,7 +934,7 @@
mesh_index_pair location;
if (!position_is_reachable(rx, ry)) {
SERIAL_PROTOCOLLNPGM("(X,Y) outside printable radius.");
SERIAL_ECHOLNPGM("(X,Y) outside printable radius.");
return;
}
@ -1050,14 +1042,14 @@
g29_repetition_cnt = parser.has_value() ? parser.value_int() : GRID_MAX_POINTS;
NOMORE(g29_repetition_cnt, GRID_MAX_POINTS);
if (g29_repetition_cnt < 1) {
SERIAL_PROTOCOLLNPGM("?(R)epetition count invalid (1+).\n");
SERIAL_ECHOLNPGM("?(R)epetition count invalid (1+).\n");
return UBL_ERR;
}
}
g29_verbose_level = parser.seen('V') ? parser.value_int() : 0;
if (!WITHIN(g29_verbose_level, 0, 4)) {
SERIAL_PROTOCOLLNPGM("?(V)erbose level is implausible (0-4).\n");
SERIAL_ECHOLNPGM("?(V)erbose level is implausible (0-4).\n");
err_flag = true;
}
@ -1065,7 +1057,7 @@
const int pv = parser.value_int();
#if !HAS_BED_PROBE
if (pv == 1) {
SERIAL_PROTOCOLLNPGM("G29 P1 requires a probe.\n");
SERIAL_ECHOLNPGM("G29 P1 requires a probe.\n");
err_flag = true;
}
else
@ -1073,7 +1065,7 @@
{
g29_phase_value = pv;
if (!WITHIN(g29_phase_value, 0, 6)) {
SERIAL_PROTOCOLLNPGM("?(P)hase value invalid (0-6).\n");
SERIAL_ECHOLNPGM("?(P)hase value invalid (0-6).\n");
err_flag = true;
}
}
@ -1083,17 +1075,17 @@
#if HAS_BED_PROBE
g29_grid_size = parser.has_value() ? parser.value_int() : 0;
if (g29_grid_size && !WITHIN(g29_grid_size, 2, 9)) {
SERIAL_PROTOCOLLNPGM("?Invalid grid size (J) specified (2-9).\n");
SERIAL_ECHOLNPGM("?Invalid grid size (J) specified (2-9).\n");
err_flag = true;
}
#else
SERIAL_PROTOCOLLNPGM("G29 J action requires a probe.\n");
SERIAL_ECHOLNPGM("G29 J action requires a probe.\n");
err_flag = true;
#endif
}
if (g29_x_flag != g29_y_flag) {
SERIAL_PROTOCOLLNPGM("Both X & Y locations must be specified.\n");
SERIAL_ECHOLNPGM("Both X & Y locations must be specified.\n");
err_flag = true;
}
@ -1111,7 +1103,7 @@
*/
if (parser.seen('A')) {
if (parser.seen('D')) {
SERIAL_PROTOCOLLNPGM("?Can't activate and deactivate at the same time.\n");
SERIAL_ECHOLNPGM("?Can't activate and deactivate at the same time.\n");
return UBL_ERR;
}
set_bed_leveling_enabled(true);
@ -1130,7 +1122,7 @@
if (parser.seenval('F')) {
const float fh = parser.value_float();
if (!WITHIN(fh, 0, 100)) {
SERIAL_PROTOCOLLNPGM("?(F)ade height for Bed Level Correction not plausible.\n");
SERIAL_ECHOLNPGM("?(F)ade height for Bed Level Correction not plausible.\n");
return UBL_ERR;
}
set_z_fade_height(fh);
@ -1139,7 +1131,7 @@
g29_map_type = parser.intval('T');
if (!WITHIN(g29_map_type, 0, 2)) {
SERIAL_PROTOCOLLNPGM("Invalid map type.\n");
SERIAL_ECHOLNPGM("Invalid map type.\n");
return UBL_ERR;
}
return UBL_OK;
@ -1435,29 +1427,23 @@
#if ENABLED(DEBUG_LEVELING_FEATURE)
if (DEBUGGING(LEVELING)) {
SERIAL_CHAR('(');
SERIAL_PROTOCOL_F(rx, 7);
SERIAL_ECHO_F(rx, 7);
SERIAL_CHAR(',');
SERIAL_PROTOCOL_F(ry, 7);
SERIAL_ECHO_F(ry, 7);
SERIAL_ECHOPGM(") logical: ");
SERIAL_CHAR('(');
SERIAL_PROTOCOL_F(LOGICAL_X_POSITION(rx), 7);
SERIAL_ECHO_F(LOGICAL_X_POSITION(rx), 7);
SERIAL_CHAR(',');
SERIAL_PROTOCOL_F(LOGICAL_Y_POSITION(ry), 7);
SERIAL_ECHOPGM(") measured: ");
SERIAL_PROTOCOL_F(measured_z, 7);
SERIAL_ECHOPGM(" correction: ");
SERIAL_PROTOCOL_F(get_z_correction(rx, ry), 7);
SERIAL_ECHO_F(LOGICAL_Y_POSITION(ry), 7);
SERIAL_ECHOPAIR_F(") measured: ", measured_z, 7);
SERIAL_ECHOPAIR_F(" correction: ", get_z_correction(rx, ry), 7);
}
#endif
measured_z -= get_z_correction(rx, ry) /* + zprobe_zoffset */ ;
#if ENABLED(DEBUG_LEVELING_FEATURE)
if (DEBUGGING(LEVELING)) {
SERIAL_ECHOPGM(" final >>>---> ");
SERIAL_PROTOCOL_F(measured_z, 7);
SERIAL_EOL();
}
if (DEBUGGING(LEVELING)) SERIAL_ECHOLNPAIR_F(" final >>>---> ", measured_z, 7);
#endif
if (g29_verbose_level > 3) {
serial_spaces(16);
@ -1483,12 +1469,11 @@
vector_3 normal = vector_3(lsf_results.A, lsf_results.B, 1).get_normal();
if (g29_verbose_level > 2) {
SERIAL_ECHOPGM("bed plane normal = [");
SERIAL_PROTOCOL_F(normal.x, 7);
SERIAL_PROTOCOLCHAR(',');
SERIAL_PROTOCOL_F(normal.y, 7);
SERIAL_PROTOCOLCHAR(',');
SERIAL_PROTOCOL_F(normal.z, 7);
SERIAL_ECHOPAIR_F("bed plane normal = [", normal.x, 7);
SERIAL_CHAR(',');
SERIAL_ECHO_F(normal.y, 7);
SERIAL_CHAR(',');
SERIAL_ECHO_F(normal.z, 7);
SERIAL_ECHOLNPGM("]");
}
@ -1502,12 +1487,11 @@
#if ENABLED(DEBUG_LEVELING_FEATURE)
if (DEBUGGING(LEVELING)) {
SERIAL_ECHOPGM("before rotation = [");
SERIAL_PROTOCOL_F(x_tmp, 7);
SERIAL_PROTOCOLCHAR(',');
SERIAL_PROTOCOL_F(y_tmp, 7);
SERIAL_PROTOCOLCHAR(',');
SERIAL_PROTOCOL_F(z_tmp, 7);
SERIAL_ECHOPAIR_F("before rotation = [", x_tmp, 7);
SERIAL_CHAR(',');
SERIAL_ECHO_F(y_tmp, 7);
SERIAL_CHAR(',');
SERIAL_ECHO_F(z_tmp, 7);
SERIAL_ECHOPGM("] ---> ");
serial_delay(20);
}
@ -1517,12 +1501,11 @@
#if ENABLED(DEBUG_LEVELING_FEATURE)
if (DEBUGGING(LEVELING)) {
SERIAL_ECHOPGM("after rotation = [");
SERIAL_PROTOCOL_F(x_tmp, 7);
SERIAL_PROTOCOLCHAR(',');
SERIAL_PROTOCOL_F(y_tmp, 7);
SERIAL_PROTOCOLCHAR(',');
SERIAL_PROTOCOL_F(z_tmp, 7);
SERIAL_ECHOPAIR_F("after rotation = [", x_tmp, 7);
SERIAL_CHAR(',');
SERIAL_ECHO_F(y_tmp, 7);
SERIAL_CHAR(',');
SERIAL_ECHO_F(z_tmp, 7);
SERIAL_ECHOLNPGM("]");
serial_delay(55);
}
@ -1535,22 +1518,17 @@
#if ENABLED(DEBUG_LEVELING_FEATURE)
if (DEBUGGING(LEVELING)) {
rotation.debug(PSTR("rotation matrix:\n"));
SERIAL_ECHOPGM("LSF Results A=");
SERIAL_PROTOCOL_F(lsf_results.A, 7);
SERIAL_ECHOPGM(" B=");
SERIAL_PROTOCOL_F(lsf_results.B, 7);
SERIAL_ECHOPGM(" D=");
SERIAL_PROTOCOL_F(lsf_results.D, 7);
SERIAL_EOL();
SERIAL_ECHOPAIR_F("LSF Results A=", lsf_results.A, 7);
SERIAL_ECHOPAIR_F(" B=", lsf_results.B, 7);
SERIAL_ECHOLNPAIR_F(" D=", lsf_results.D, 7);
serial_delay(55);
SERIAL_ECHOPGM("bed plane normal = [");
SERIAL_PROTOCOL_F(normal.x, 7);
SERIAL_PROTOCOLCHAR(',');
SERIAL_PROTOCOL_F(normal.y, 7);
SERIAL_PROTOCOLCHAR(',');
SERIAL_PROTOCOL_F(normal.z, 7);
SERIAL_ECHOPGM("]\n");
SERIAL_ECHOPAIR_F("bed plane normal = [", normal.x, 7);
SERIAL_CHAR(',');
SERIAL_ECHO_F(normal.y, 7);
SERIAL_CHAR(',');
SERIAL_ECHO_F(normal.z, 7);
SERIAL_ECHOLNPGM("]");
SERIAL_EOL();
/**
@ -1565,45 +1543,31 @@
float t, t1, d;
t = normal.x * (PROBE_PT_1_X) + normal.y * (PROBE_PT_1_Y);
d = t + normal.z * z1;
SERIAL_ECHOPGM("D from 1st point: ");
SERIAL_ECHO_F(d, 6);
SERIAL_ECHOPGM(" Z error: ");
SERIAL_ECHO_F(normal.z*z1-get_z_correction(PROBE_PT_1_X, PROBE_PT_1_Y), 6);
SERIAL_EOL();
SERIAL_ECHOPAIR_F("D from 1st point: ", d, 6);
SERIAL_ECHOLNPAIR_F(" Z error: ", normal.z*z1-get_z_correction(PROBE_PT_1_X, PROBE_PT_1_Y), 6);
t = normal.x * (PROBE_PT_2_X) + normal.y * (PROBE_PT_2_Y);
d = t + normal.z * z2;
SERIAL_EOL();
SERIAL_ECHOPGM("D from 2nd point: ");
SERIAL_ECHO_F(d, 6);
SERIAL_ECHOPGM(" Z error: ");
SERIAL_ECHO_F(normal.z*z2-get_z_correction(PROBE_PT_2_X, PROBE_PT_2_Y), 6);
SERIAL_EOL();
SERIAL_ECHOPAIR_F("D from 2nd point: ", d, 6);
SERIAL_ECHOLNPAIR_F(" Z error: ", normal.z*z2-get_z_correction(PROBE_PT_2_X, PROBE_PT_2_Y), 6);
t = normal.x * (PROBE_PT_3_X) + normal.y * (PROBE_PT_3_Y);
d = t + normal.z * z3;
SERIAL_ECHOPGM("D from 3rd point: ");
SERIAL_ECHO_F(d, 6);
SERIAL_ECHOPGM(" Z error: ");
SERIAL_ECHO_F(normal.z*z3-get_z_correction(PROBE_PT_3_X, PROBE_PT_3_Y), 6);
SERIAL_EOL();
SERIAL_ECHOPAIR_F("D from 3rd point: ", d, 6);
SERIAL_ECHOLNPAIR_F(" Z error: ", normal.z*z3-get_z_correction(PROBE_PT_3_X, PROBE_PT_3_Y), 6);
t = normal.x * (Z_SAFE_HOMING_X_POINT) + normal.y * (Z_SAFE_HOMING_Y_POINT);
d = t + normal.z * 0;
SERIAL_ECHOPGM("D from home location with Z=0 : ");
SERIAL_ECHO_F(d, 6);
SERIAL_EOL();
SERIAL_ECHOLNPAIR_F("D from home location with Z=0 : ", d, 6);
t = normal.x * (Z_SAFE_HOMING_X_POINT) + normal.y * (Z_SAFE_HOMING_Y_POINT);
d = t + get_z_correction(Z_SAFE_HOMING_X_POINT, Z_SAFE_HOMING_Y_POINT); // normal.z * 0;
SERIAL_ECHOPGM("D from home location using mesh value for Z: ");
SERIAL_ECHO_F(d, 6);
SERIAL_ECHOPAIR_F("D from home location using mesh value for Z: ", d, 6);
SERIAL_ECHOPAIR(" Z error: (", Z_SAFE_HOMING_X_POINT);
SERIAL_ECHOPAIR(",", Z_SAFE_HOMING_Y_POINT );
SERIAL_ECHOPGM(") = ");
SERIAL_ECHO_F(get_z_correction(Z_SAFE_HOMING_X_POINT, Z_SAFE_HOMING_Y_POINT), 6);
SERIAL_EOL();
SERIAL_ECHOPAIR(",", Z_SAFE_HOMING_Y_POINT);
SERIAL_ECHOLNPAIR_F(") = ", get_z_correction(Z_SAFE_HOMING_X_POINT, Z_SAFE_HOMING_Y_POINT), 6);
#endif
} // DEBUGGING(LEVELING)
#endif
@ -1675,26 +1639,22 @@
report_state();
if (storage_slot == -1)
SERIAL_PROTOCOLPGM("No Mesh Loaded.");
SERIAL_ECHOPGM("No Mesh Loaded.");
else {
SERIAL_PROTOCOLPAIR("Mesh ", storage_slot);
SERIAL_PROTOCOLPGM(" Loaded.");
SERIAL_ECHOPAIR("Mesh ", storage_slot);
SERIAL_ECHOPGM(" Loaded.");
}
SERIAL_EOL();
serial_delay(50);
#if ENABLED(ENABLE_LEVELING_FADE_HEIGHT)
SERIAL_PROTOCOLPGM("planner.z_fade_height : ");
SERIAL_PROTOCOL_F(planner.z_fade_height, 4);
SERIAL_EOL();
SERIAL_ECHOLNPAIR_F("planner.z_fade_height : ", planner.z_fade_height, 4);
#endif
adjust_mesh_to_mean(g29_c_flag, g29_constant);
#if HAS_BED_PROBE
SERIAL_PROTOCOLPGM("zprobe_zoffset: ");
SERIAL_PROTOCOL_F(zprobe_zoffset, 7);
SERIAL_EOL();
SERIAL_ECHOLNPAIR_F("zprobe_zoffset: ", zprobe_zoffset, 7);
#endif
SERIAL_ECHOLNPAIR("MESH_MIN_X " STRINGIFY(MESH_MIN_X) "=", MESH_MIN_X); serial_delay(50);
@ -1706,53 +1666,53 @@
SERIAL_ECHOLNPAIR("MESH_X_DIST ", MESH_X_DIST);
SERIAL_ECHOLNPAIR("MESH_Y_DIST ", MESH_Y_DIST); serial_delay(50);
SERIAL_PROTOCOLPGM("X-Axis Mesh Points at: ");
SERIAL_ECHOPGM("X-Axis Mesh Points at: ");
for (uint8_t i = 0; i < GRID_MAX_POINTS_X; i++) {
SERIAL_PROTOCOL_F(LOGICAL_X_POSITION(mesh_index_to_xpos(i)), 3);
SERIAL_PROTOCOLPGM(" ");
SERIAL_ECHO_F(LOGICAL_X_POSITION(mesh_index_to_xpos(i)), 3);
SERIAL_ECHOPGM(" ");
serial_delay(25);
}
SERIAL_EOL();
SERIAL_PROTOCOLPGM("Y-Axis Mesh Points at: ");
SERIAL_ECHOPGM("Y-Axis Mesh Points at: ");
for (uint8_t i = 0; i < GRID_MAX_POINTS_Y; i++) {
SERIAL_PROTOCOL_F(LOGICAL_Y_POSITION(mesh_index_to_ypos(i)), 3);
SERIAL_PROTOCOLPGM(" ");
SERIAL_ECHO_F(LOGICAL_Y_POSITION(mesh_index_to_ypos(i)), 3);
SERIAL_ECHOPGM(" ");
serial_delay(25);
}
SERIAL_EOL();
#if HAS_KILL
SERIAL_PROTOCOLPAIR("Kill pin on :", KILL_PIN);
SERIAL_PROTOCOLLNPAIR(" state:", READ(KILL_PIN));
SERIAL_ECHOPAIR("Kill pin on :", KILL_PIN);
SERIAL_ECHOLNPAIR(" state:", READ(KILL_PIN));
#endif
SERIAL_EOL();
serial_delay(50);
#if ENABLED(UBL_DEVEL_DEBUGGING)
SERIAL_PROTOCOLLNPAIR("ubl_state_at_invocation :", ubl_state_at_invocation); SERIAL_EOL();
SERIAL_PROTOCOLLNPAIR("ubl_state_recursion_chk :", ubl_state_recursion_chk); SERIAL_EOL();
SERIAL_ECHOLNPAIR("ubl_state_at_invocation :", ubl_state_at_invocation); SERIAL_EOL();
SERIAL_ECHOLNPAIR("ubl_state_recursion_chk :", ubl_state_recursion_chk); SERIAL_EOL();
serial_delay(50);
SERIAL_PROTOCOLPAIR("Meshes go from ", hex_address((void*)settings.meshes_start_index()));
SERIAL_PROTOCOLLNPAIR(" to ", hex_address((void*)settings.meshes_end_index()));
SERIAL_ECHOPAIR("Meshes go from ", hex_address((void*)settings.meshes_start_index()));
SERIAL_ECHOLNPAIR(" to ", hex_address((void*)settings.meshes_end_index()));
serial_delay(50);
SERIAL_PROTOCOLLNPAIR("sizeof(ubl) : ", (int)sizeof(ubl)); SERIAL_EOL();
SERIAL_PROTOCOLLNPAIR("z_value[][] size: ", (int)sizeof(z_values)); SERIAL_EOL();
SERIAL_ECHOLNPAIR("sizeof(ubl) : ", (int)sizeof(ubl)); SERIAL_EOL();
SERIAL_ECHOLNPAIR("z_value[][] size: ", (int)sizeof(z_values)); SERIAL_EOL();
serial_delay(25);
SERIAL_PROTOCOLLNPAIR("EEPROM free for UBL: ", hex_address((void*)(settings.meshes_end_index() - settings.meshes_start_index())));
SERIAL_ECHOLNPAIR("EEPROM free for UBL: ", hex_address((void*)(settings.meshes_end_index() - settings.meshes_start_index())));
serial_delay(50);
SERIAL_PROTOCOLPAIR("EEPROM can hold ", settings.calc_num_meshes());
SERIAL_PROTOCOLLNPGM(" meshes.\n");
SERIAL_ECHOPAIR("EEPROM can hold ", settings.calc_num_meshes());
SERIAL_ECHOLNPGM(" meshes.\n");
serial_delay(25);
#endif // UBL_DEVEL_DEBUGGING
if (!sanity_check()) {
echo_name();
SERIAL_PROTOCOLLNPGM(" sanity checks passed.");
SERIAL_ECHOLNPGM(" sanity checks passed.");
}
}
@ -1763,8 +1723,7 @@
void unified_bed_leveling::g29_eeprom_dump() {
uint8_t cccc;
SERIAL_ECHO_START();
SERIAL_ECHOLNPGM("EEPROM Dump:");
SERIAL_ECHO_MSG("EEPROM Dump:");
persistentStore.access_start();
for (uint16_t i = 0; i < persistentStore.capacity(); i += 16) {
if (!(i & 0x3)) idle();
@ -1773,7 +1732,7 @@
for (uint16_t j = 0; j < 16; j++) {
persistentStore.read_data(i + j, &cccc, sizeof(uint8_t));
print_hex_byte(cccc);
SERIAL_ECHO(' ');
SERIAL_CHAR(' ');
}
SERIAL_EOL();
}
@ -1789,29 +1748,29 @@
int16_t a = settings.calc_num_meshes();
if (!a) {
SERIAL_PROTOCOLLNPGM("?EEPROM storage not available.");
SERIAL_ECHOLNPGM("?EEPROM storage not available.");
return;
}
if (!parser.has_value()) {
SERIAL_PROTOCOLLNPGM("?Storage slot # required.");
SERIAL_PROTOCOLLNPAIR("?Use 0 to ", a - 1);
SERIAL_ECHOLNPGM("?Storage slot # required.");
SERIAL_ECHOLNPAIR("?Use 0 to ", a - 1);
return;
}
g29_storage_slot = parser.value_int();
if (!WITHIN(g29_storage_slot, 0, a - 1)) {
SERIAL_PROTOCOLLNPGM("?Invalid storage slot.");
SERIAL_PROTOCOLLNPAIR("?Use 0 to ", a - 1);
SERIAL_ECHOLNPGM("?Invalid storage slot.");
SERIAL_ECHOLNPAIR("?Use 0 to ", a - 1);
return;
}
float tmp_z_values[GRID_MAX_POINTS_X][GRID_MAX_POINTS_Y];
settings.load_mesh(g29_storage_slot, &tmp_z_values);
SERIAL_PROTOCOLPAIR("Subtracting mesh in slot ", g29_storage_slot);
SERIAL_PROTOCOLLNPGM(" from current mesh.");
SERIAL_ECHOPAIR("Subtracting mesh in slot ", g29_storage_slot);
SERIAL_ECHOLNPGM(" from current mesh.");
for (uint8_t x = 0; x < GRID_MAX_POINTS_X; x++)
for (uint8_t y = 0; y < GRID_MAX_POINTS_Y; y++)

View file

@ -103,8 +103,7 @@ void dac_current_set_percents(const uint8_t pct[XYZE]) {
void dac_print_values() {
if (!dac_present) return;
SERIAL_ECHO_START();
SERIAL_ECHOLNPGM("Stepper current values in % (Amps):");
SERIAL_ECHO_MSG("Stepper current values in % (Amps):");
SERIAL_ECHO_START();
SERIAL_ECHOPAIR(" X:", dac_perc(X_AXIS));
SERIAL_ECHOPAIR(" (", dac_amps(X_AXIS));

View file

@ -93,8 +93,7 @@ static bool ensure_safe_temperature(const AdvancedPauseMode mode=ADVANCED_PAUSE_
#if ENABLED(PREVENT_COLD_EXTRUSION)
if (!DEBUGGING(DRYRUN) && thermalManager.targetTooColdToExtrude(active_extruder)) {
SERIAL_ERROR_START();
SERIAL_ERRORLNPGM(MSG_ERR_HOTEND_TOO_COLD);
SERIAL_ERROR_MSG(MSG_ERR_HOTEND_TOO_COLD);
return false;
}
#endif
@ -142,8 +141,7 @@ bool load_filament(const float &slow_load_length/*=0*/, const float &fast_load_l
#if HAS_LCD_MENU
if (show_lcd) lcd_advanced_pause_show_message(ADVANCED_PAUSE_MESSAGE_INSERT, mode);
#endif
SERIAL_ECHO_START();
SERIAL_ECHOLNPGM(MSG_FILAMENT_CHANGE_INSERT);
SERIAL_ECHO_MSG(MSG_FILAMENT_CHANGE_INSERT);
#if HAS_BUZZER
filament_change_beep(max_beep_count, true);
@ -336,8 +334,7 @@ bool pause_print(const float &retract, const point_t &park_point, const float &u
#endif
if (!DEBUGGING(DRYRUN) && unload_length && thermalManager.targetTooColdToExtrude(active_extruder)) {
SERIAL_ERROR_START();
SERIAL_ERRORLNPGM(MSG_ERR_HOTEND_TOO_COLD);
SERIAL_ERROR_MSG(MSG_ERR_HOTEND_TOO_COLD);
#if HAS_LCD_MENU
if (show_lcd) { // Show status screen
@ -464,8 +461,7 @@ void wait_for_confirmation(const bool is_reload/*=false*/, const int8_t max_beep
#if HAS_LCD_MENU
lcd_advanced_pause_show_message(ADVANCED_PAUSE_MESSAGE_HEAT);
#endif
SERIAL_ECHO_START();
SERIAL_ECHOLNPGM(_PMSG(MSG_FILAMENT_CHANGE_HEAT));
SERIAL_ECHO_MSG(_PMSG(MSG_FILAMENT_CHANGE_HEAT));
// Wait for LCD click or M108
while (wait_for_user) idle(true);

View file

@ -192,7 +192,7 @@ class FilamentSensorBase {
#ifdef FILAMENT_RUNOUT_SENSOR_DEBUG
if (change) {
SERIAL_PROTOCOLPGM("Motion detected:");
SERIAL_ECHOPGM("Motion detected:");
for (uint8_t e = 0; e < NUM_RUNOUT_SENSORS; e++)
if (TEST(change, e)) { SERIAL_CHAR(' '); SERIAL_CHAR('0' + e); }
SERIAL_EOL();
@ -253,7 +253,7 @@ class FilamentSensorBase {
static bool was_out = false;
if (out != was_out) {
was_out = out;
SERIAL_PROTOCOL("Filament ");
SERIAL_ECHOPGM("Filament ");
serialprintPGM(out ? PSTR("OUT\n") : PSTR("IN\n"));
}
#endif
@ -289,7 +289,7 @@ class FilamentSensorBase {
t = millis() + 1000UL;
LOOP_L_N(i, EXTRUDERS) {
serialprintPGM(i ? PSTR(", ") : PSTR("Remaining mm: "));
SERIAL_PROTOCOL(runout_mm_countdown[i]);
SERIAL_ECHO(runout_mm_countdown[i]);
}
SERIAL_EOL();
}

View file

@ -59,8 +59,7 @@ void enable_solenoid(const uint8_t num) {
break;
#endif
default:
SERIAL_ECHO_START();
SERIAL_ECHOLNPGM(MSG_INVALID_SOLENOID);
SERIAL_ECHO_MSG(MSG_INVALID_SOLENOID);
break;
}
}

View file

@ -358,12 +358,12 @@
template <typename TMC>
static void tmc_status(TMC &st, const TMC_debug_enum i, const float spmm) {
SERIAL_ECHO('\t');
SERIAL_CHAR('\t');
switch (i) {
case TMC_CODES: st.printLabel(); break;
case TMC_ENABLED: serialprintPGM(st.isEnabled() ? PSTR("true") : PSTR("false")); break;
case TMC_CURRENT: SERIAL_ECHO(st.getMilliamps()); break;
case TMC_RMS_CURRENT: SERIAL_PROTOCOL(st.rms_current()); break;
case TMC_RMS_CURRENT: SERIAL_ECHO(st.rms_current()); break;
case TMC_MAX_CURRENT: SERIAL_PRINT((float)st.rms_current() * 1.41, 0); break;
case TMC_IRUN:
SERIAL_PRINT(st.irun(), DEC);
@ -408,12 +408,12 @@
#if HAS_DRIVER(TMC2660)
template<char AXIS_LETTER, char DRIVER_ID>
void tmc_status(TMCMarlin<TMC2660Stepper, AXIS_LETTER, DRIVER_ID> &st, const TMC_debug_enum i, const float) {
SERIAL_ECHO('\t');
SERIAL_CHAR('\t');
switch (i) {
case TMC_CODES: st.printLabel(); break;
case TMC_ENABLED: serialprintPGM(st.isEnabled() ? PSTR("true") : PSTR("false")); break;
case TMC_CURRENT: SERIAL_ECHO(st.getMilliamps()); break;
case TMC_RMS_CURRENT: SERIAL_PROTOCOL(st.rms_current()); break;
case TMC_RMS_CURRENT: SERIAL_ECHO(st.rms_current()); break;
case TMC_MAX_CURRENT: SERIAL_PRINT((float)st.rms_current() * 1.41, 0); break;
case TMC_IRUN:
SERIAL_PRINT(st.cs(), DEC);

View file

@ -44,8 +44,7 @@ void TWIBus::reset() {
void TWIBus::address(const uint8_t adr) {
if (!WITHIN(adr, 8, 127)) {
SERIAL_ECHO_START();
SERIAL_ECHOLNPGM("Bad I2C address (8-127)");
SERIAL_ECHO_MSG("Bad I2C address (8-127)");
}
this->addr = adr;

View file

@ -573,7 +573,7 @@ void GcodeSuite::G26() {
if (parser.seenval('B')) {
g26_bed_temp = parser.value_celsius();
if (g26_bed_temp && !WITHIN(g26_bed_temp, 40, 140)) {
SERIAL_PROTOCOLLNPGM("?Specified bed temperature not plausible (40-140C).");
SERIAL_ECHOLNPGM("?Specified bed temperature not plausible (40-140C).");
return;
}
}
@ -581,7 +581,7 @@ void GcodeSuite::G26() {
if (parser.seenval('L')) {
g26_layer_height = parser.value_linear_units();
if (!WITHIN(g26_layer_height, 0.0, 2.0)) {
SERIAL_PROTOCOLLNPGM("?Specified layer height not plausible.");
SERIAL_ECHOLNPGM("?Specified layer height not plausible.");
return;
}
}
@ -590,12 +590,12 @@ void GcodeSuite::G26() {
if (parser.has_value()) {
g26_retraction_multiplier = parser.value_float();
if (!WITHIN(g26_retraction_multiplier, 0.05, 15.0)) {
SERIAL_PROTOCOLLNPGM("?Specified Retraction Multiplier not plausible.");
SERIAL_ECHOLNPGM("?Specified Retraction Multiplier not plausible.");
return;
}
}
else {
SERIAL_PROTOCOLLNPGM("?Retraction Multiplier must be specified.");
SERIAL_ECHOLNPGM("?Retraction Multiplier must be specified.");
return;
}
}
@ -603,7 +603,7 @@ void GcodeSuite::G26() {
if (parser.seenval('S')) {
g26_nozzle = parser.value_float();
if (!WITHIN(g26_nozzle, 0.1, 1.0)) {
SERIAL_PROTOCOLLNPGM("?Specified nozzle size not plausible.");
SERIAL_ECHOLNPGM("?Specified nozzle size not plausible.");
return;
}
}
@ -613,7 +613,7 @@ void GcodeSuite::G26() {
#if HAS_LCD_MENU
g26_prime_flag = -1;
#else
SERIAL_PROTOCOLLNPGM("?Prime length must be specified when not using an LCD.");
SERIAL_ECHOLNPGM("?Prime length must be specified when not using an LCD.");
return;
#endif
}
@ -621,7 +621,7 @@ void GcodeSuite::G26() {
g26_prime_flag++;
g26_prime_length = parser.value_linear_units();
if (!WITHIN(g26_prime_length, 0.0, 25.0)) {
SERIAL_PROTOCOLLNPGM("?Specified prime length not plausible.");
SERIAL_ECHOLNPGM("?Specified prime length not plausible.");
return;
}
}
@ -630,7 +630,7 @@ void GcodeSuite::G26() {
if (parser.seenval('F')) {
g26_filament_diameter = parser.value_linear_units();
if (!WITHIN(g26_filament_diameter, 1.0, 4.0)) {
SERIAL_PROTOCOLLNPGM("?Specified filament size not plausible.");
SERIAL_ECHOLNPGM("?Specified filament size not plausible.");
return;
}
}
@ -643,7 +643,7 @@ void GcodeSuite::G26() {
if (parser.seenval('H')) {
g26_hotend_temp = parser.value_celsius();
if (!WITHIN(g26_hotend_temp, 165, 280)) {
SERIAL_PROTOCOLLNPGM("?Specified nozzle temperature not plausible.");
SERIAL_ECHOLNPGM("?Specified nozzle temperature not plausible.");
return;
}
}
@ -659,21 +659,21 @@ void GcodeSuite::G26() {
g26_repeats = parser.intval('R', GRID_MAX_POINTS + 1);
#else
if (!parser.seen('R')) {
SERIAL_PROTOCOLLNPGM("?(R)epeat must be specified when not using an LCD.");
SERIAL_ECHOLNPGM("?(R)epeat must be specified when not using an LCD.");
return;
}
else
g26_repeats = parser.has_value() ? parser.value_int() : GRID_MAX_POINTS + 1;
#endif
if (g26_repeats < 1) {
SERIAL_PROTOCOLLNPGM("?(R)epeat value not plausible; must be at least 1.");
SERIAL_ECHOLNPGM("?(R)epeat value not plausible; must be at least 1.");
return;
}
g26_x_pos = parser.seenval('X') ? RAW_X_POSITION(parser.value_linear_units()) : current_position[X_AXIS];
g26_y_pos = parser.seenval('Y') ? RAW_Y_POSITION(parser.value_linear_units()) : current_position[Y_AXIS];
if (!position_is_reachable(g26_x_pos, g26_y_pos)) {
SERIAL_PROTOCOLLNPGM("?Specified X,Y coordinate out of bounds.");
SERIAL_ECHOLNPGM("?Specified X,Y coordinate out of bounds.");
return;
}

View file

@ -95,13 +95,13 @@ void GcodeSuite::M420() {
const int16_t a = settings.calc_num_meshes();
if (!a) {
SERIAL_PROTOCOLLNPGM("?EEPROM storage not available.");
SERIAL_ECHOLNPGM("?EEPROM storage not available.");
return;
}
if (!WITHIN(storage_slot, 0, a - 1)) {
SERIAL_PROTOCOLLNPGM("?Invalid storage slot.");
SERIAL_PROTOCOLLNPAIR("?Use 0 to ", a - 1);
SERIAL_ECHOLNPGM("?Invalid storage slot.");
SERIAL_ECHOLNPAIR("?Use 0 to ", a - 1);
return;
}
@ -110,7 +110,7 @@ void GcodeSuite::M420() {
#else
SERIAL_PROTOCOLLNPGM("?EEPROM storage not available.");
SERIAL_ECHOLNPGM("?EEPROM storage not available.");
return;
#endif
@ -206,10 +206,8 @@ void GcodeSuite::M420() {
set_bed_leveling_enabled(to_enable);
// Error if leveling failed to enable or reenable
if (to_enable && !planner.leveling_active) {
SERIAL_ERROR_START();
SERIAL_ERRORLNPGM(MSG_ERR_M420_FAILED);
}
if (to_enable && !planner.leveling_active)
SERIAL_ERROR_MSG(MSG_ERR_M420_FAILED);
SERIAL_ECHO_START();
SERIAL_ECHOPGM("Bed Leveling ");

View file

@ -293,15 +293,13 @@ G29_TYPE GcodeSuite::G29() {
const bool seen_w = parser.seen('W');
if (seen_w) {
if (!leveling_is_valid()) {
SERIAL_ERROR_START();
SERIAL_ERRORLNPGM("No bilinear grid");
SERIAL_ERROR_MSG("No bilinear grid");
G29_RETURN(false);
}
const float rz = parser.seenval('Z') ? RAW_Z_POSITION(parser.value_linear_units()) : current_position[Z_AXIS];
if (!WITHIN(rz, -10, 10)) {
SERIAL_ERROR_START();
SERIAL_ERRORLNPGM("Bad Z value");
SERIAL_ERROR_MSG("Bad Z value");
G29_RETURN(false);
}
@ -343,7 +341,7 @@ G29_TYPE GcodeSuite::G29() {
verbose_level = parser.intval('V');
if (!WITHIN(verbose_level, 0, 4)) {
SERIAL_PROTOCOLLNPGM("?(V)erbose level is implausible (0-4).");
SERIAL_ECHOLNPGM("?(V)erbose level is implausible (0-4).");
G29_RETURN(false);
}
@ -364,11 +362,11 @@ G29_TYPE GcodeSuite::G29() {
if (parser.seenval('P')) abl_grid_points_x = abl_grid_points_y = parser.value_int();
if (!WITHIN(abl_grid_points_x, 2, GRID_MAX_POINTS_X)) {
SERIAL_PROTOCOLLNPGM("?Probe points (X) is implausible (2-" STRINGIFY(GRID_MAX_POINTS_X) ").");
SERIAL_ECHOLNPGM("?Probe points (X) is implausible (2-" STRINGIFY(GRID_MAX_POINTS_X) ").");
G29_RETURN(false);
}
if (!WITHIN(abl_grid_points_y, 2, GRID_MAX_POINTS_Y)) {
SERIAL_PROTOCOLLNPGM("?Probe points (Y) is implausible (2-" STRINGIFY(GRID_MAX_POINTS_Y) ").");
SERIAL_ECHOLNPGM("?Probe points (Y) is implausible (2-" STRINGIFY(GRID_MAX_POINTS_Y) ").");
G29_RETURN(false);
}
@ -410,7 +408,7 @@ G29_TYPE GcodeSuite::G29() {
|| !position_is_reachable_by_probe(right_probe_bed_position, back_probe_bed_position)
#endif
) {
SERIAL_PROTOCOLLNPGM("? (L,R,F,B) out of bounds.");
SERIAL_ECHOLNPGM("? (L,R,F,B) out of bounds.");
G29_RETURN(false);
}
@ -421,8 +419,8 @@ G29_TYPE GcodeSuite::G29() {
#endif // ABL_GRID
if (verbose_level > 0) {
SERIAL_PROTOCOLPGM("G29 Auto Bed Leveling");
if (dryrun) SERIAL_PROTOCOLPGM(" (DRYRUN)");
SERIAL_ECHOPGM("G29 Auto Bed Leveling");
if (dryrun) SERIAL_ECHOPGM(" (DRYRUN)");
SERIAL_EOL();
}
@ -491,7 +489,7 @@ G29_TYPE GcodeSuite::G29() {
// Abort current G29 procedure, go back to idle state
if (seenA && g29_in_progress) {
SERIAL_PROTOCOLLNPGM("Manual G29 aborted");
SERIAL_ECHOLNPGM("Manual G29 aborted");
#if HAS_SOFTWARE_ENDSTOPS
soft_endstops_enabled = enable_soft_endstops;
#endif
@ -504,13 +502,13 @@ G29_TYPE GcodeSuite::G29() {
// Query G29 status
if (verbose_level || seenQ) {
SERIAL_PROTOCOLPGM("Manual G29 ");
SERIAL_ECHOPGM("Manual G29 ");
if (g29_in_progress) {
SERIAL_PROTOCOLPAIR("point ", MIN(abl_probe_index + 1, abl_points));
SERIAL_PROTOCOLLNPAIR(" of ", abl_points);
SERIAL_ECHOPAIR("point ", MIN(abl_probe_index + 1, abl_points));
SERIAL_ECHOLNPAIR(" of ", abl_points);
}
else
SERIAL_PROTOCOLLNPGM("idle");
SERIAL_ECHOLNPGM("idle");
}
if (no_action) G29_RETURN(false);
@ -553,9 +551,9 @@ G29_TYPE GcodeSuite::G29() {
#if ENABLED(DEBUG_LEVELING_FEATURE)
if (DEBUGGING(LEVELING)) {
SERIAL_PROTOCOLPAIR("Save X", xCount);
SERIAL_PROTOCOLPAIR(" Y", yCount);
SERIAL_PROTOCOLLNPAIR(" Z", measured_z + zoffset);
SERIAL_ECHOPAIR("Save X", xCount);
SERIAL_ECHOPAIR(" Y", yCount);
SERIAL_ECHOLNPAIR(" Z", measured_z + zoffset);
}
#endif
@ -609,7 +607,7 @@ G29_TYPE GcodeSuite::G29() {
// Leveling done! Fall through to G29 finishing code below
SERIAL_PROTOCOLLNPGM("Grid probing done.");
SERIAL_ECHOLNPGM("Grid probing done.");
// Re-enable software endstops, if needed
#if HAS_SOFTWARE_ENDSTOPS
@ -633,7 +631,7 @@ G29_TYPE GcodeSuite::G29() {
}
else {
SERIAL_PROTOCOLLNPGM("3-point probing done.");
SERIAL_ECHOLNPGM("3-point probing done.");
// Re-enable software endstops, if needed
#if HAS_SOFTWARE_ENDSTOPS
@ -829,18 +827,12 @@ G29_TYPE GcodeSuite::G29() {
mean /= abl_points;
if (verbose_level) {
SERIAL_PROTOCOLPGM("Eqn coefficients: a: ");
SERIAL_PROTOCOL_F(plane_equation_coefficients[0], 8);
SERIAL_PROTOCOLPGM(" b: ");
SERIAL_PROTOCOL_F(plane_equation_coefficients[1], 8);
SERIAL_PROTOCOLPGM(" d: ");
SERIAL_PROTOCOL_F(plane_equation_coefficients[2], 8);
SERIAL_ECHOPAIR_F("Eqn coefficients: a: ", plane_equation_coefficients[0], 8);
SERIAL_ECHOPAIR_F(" b: ", plane_equation_coefficients[1], 8);
SERIAL_ECHOPAIR_F(" d: ", plane_equation_coefficients[2], 8);
if (verbose_level > 2)
SERIAL_ECHOPAIR_F("\nMean of sampled points: ", mean, 8);
SERIAL_EOL();
if (verbose_level > 2) {
SERIAL_PROTOCOLPGM("Mean of sampled points: ");
SERIAL_PROTOCOL_F(mean, 8);
SERIAL_EOL();
}
}
// Create the matrix but don't correct the position yet
@ -852,7 +844,7 @@ G29_TYPE GcodeSuite::G29() {
// Show the Topography map if enabled
if (do_topography_map) {
SERIAL_PROTOCOLLNPGM("\nBed Height Topography:\n"
SERIAL_ECHOLNPGM("\nBed Height Topography:\n"
" +--- BACK --+\n"
" | |\n"
" L | (+) | R\n"
@ -879,17 +871,17 @@ G29_TYPE GcodeSuite::G29() {
NOMORE(min_diff, eqnBVector[ind] - z_tmp);
if (diff >= 0.0)
SERIAL_PROTOCOLPGM(" +"); // Include + for column alignment
SERIAL_ECHOPGM(" +"); // Include + for column alignment
else
SERIAL_PROTOCOLCHAR(' ');
SERIAL_PROTOCOL_F(diff, 5);
SERIAL_CHAR(' ');
SERIAL_ECHO_F(diff, 5);
} // xx
SERIAL_EOL();
} // yy
SERIAL_EOL();
if (verbose_level > 3) {
SERIAL_PROTOCOLLNPGM("\nCorrected Bed Height vs. Bed Topology:");
SERIAL_ECHOLNPGM("\nCorrected Bed Height vs. Bed Topology:");
for (int8_t yy = abl_grid_points_y - 1; yy >= 0; yy--) {
for (uint8_t xx = 0; xx < abl_grid_points_x; xx++) {
@ -902,11 +894,11 @@ G29_TYPE GcodeSuite::G29() {
float diff = eqnBVector[ind] - z_tmp - min_diff;
if (diff >= 0.0)
SERIAL_PROTOCOLPGM(" +");
SERIAL_ECHOPGM(" +");
// Include + for column alignment
else
SERIAL_PROTOCOLCHAR(' ');
SERIAL_PROTOCOL_F(diff, 5);
SERIAL_CHAR(' ');
SERIAL_ECHO_F(diff, 5);
} // xx
SERIAL_EOL();
} // yy

View file

@ -45,14 +45,10 @@ void GcodeSuite::M421() {
hasZ = parser.seen('Z'),
hasQ = !hasZ && parser.seen('Q');
if (!hasI || !hasJ || !(hasZ || hasQ)) {
SERIAL_ERROR_START();
SERIAL_ERRORLNPGM(MSG_ERR_M421_PARAMETERS);
}
else if (!WITHIN(ix, 0, GRID_MAX_POINTS_X - 1) || !WITHIN(iy, 0, GRID_MAX_POINTS_Y - 1)) {
SERIAL_ERROR_START();
SERIAL_ERRORLNPGM(MSG_ERR_MESH_XY);
}
if (!hasI || !hasJ || !(hasZ || hasQ))
SERIAL_ERROR_MSG(MSG_ERR_M421_PARAMETERS);
else if (!WITHIN(ix, 0, GRID_MAX_POINTS_X - 1) || !WITHIN(iy, 0, GRID_MAX_POINTS_Y - 1))
SERIAL_ERROR_MSG(MSG_ERR_MESH_XY);
else {
z_values[ix][iy] = parser.value_linear_units() + (hasQ ? z_values[ix][iy] : 0);
#if ENABLED(ABL_BILINEAR_SUBDIVISION)

View file

@ -39,7 +39,7 @@
#include "../../../module/stepper.h"
// Save 130 bytes with non-duplication of PSTR
inline void echo_not_entered(const char c) { SERIAL_CHAR(c); SERIAL_PROTOCOLLNPGM(" not entered."); }
inline void echo_not_entered(const char c) { SERIAL_CHAR(c); SERIAL_ECHOLNPGM(" not entered."); }
/**
* G29: Mesh-based Z probe, probes a grid and produces a
@ -64,7 +64,7 @@ void GcodeSuite::G29() {
MeshLevelingState state = (MeshLevelingState)parser.byteval('S', (int8_t)MeshReport);
if (!WITHIN(state, 0, 5)) {
SERIAL_PROTOCOLLNPGM("S out of range (0-5).");
SERIAL_ECHOLNPGM("S out of range (0-5).");
return;
}
@ -72,13 +72,13 @@ void GcodeSuite::G29() {
switch (state) {
case MeshReport:
SERIAL_PROTOCOLPGM("Mesh Bed Leveling ");
SERIAL_ECHOPGM("Mesh Bed Leveling ");
if (leveling_is_valid()) {
serialprintln_onoff(planner.leveling_active);
mbl.report_mesh();
}
else
SERIAL_PROTOCOLLNPGM("has no data.");
SERIAL_ECHOLNPGM("has no data.");
break;
case MeshStart:
@ -92,7 +92,7 @@ void GcodeSuite::G29() {
case MeshNext:
if (mbl_probe_index < 0) {
SERIAL_PROTOCOLLNPGM("Start mesh probing with \"G29 S1\" first.");
SERIAL_ECHOLNPGM("Start mesh probing with \"G29 S1\" first.");
return;
}
// For each G29 S2...
@ -130,7 +130,7 @@ void GcodeSuite::G29() {
// After recording the last point, activate home and activate
mbl_probe_index = -1;
SERIAL_PROTOCOLLNPGM("Mesh probing done.");
SERIAL_ECHOLNPGM("Mesh probing done.");
BUZZ(100, 659);
BUZZ(100, 698);
@ -154,8 +154,8 @@ void GcodeSuite::G29() {
if (parser.seenval('I')) {
ix = parser.value_int();
if (!WITHIN(ix, 0, GRID_MAX_POINTS_X - 1)) {
SERIAL_PROTOCOLPAIR("I out of range (0-", int(GRID_MAX_POINTS_X - 1));
SERIAL_PROTOCOLLNPGM(")");
SERIAL_ECHOPAIR("I out of range (0-", int(GRID_MAX_POINTS_X - 1));
SERIAL_ECHOLNPGM(")");
return;
}
}
@ -165,8 +165,8 @@ void GcodeSuite::G29() {
if (parser.seenval('J')) {
iy = parser.value_int();
if (!WITHIN(iy, 0, GRID_MAX_POINTS_Y - 1)) {
SERIAL_PROTOCOLPAIR("J out of range (0-", int(GRID_MAX_POINTS_Y - 1));
SERIAL_PROTOCOLLNPGM(")");
SERIAL_ECHOPAIR("J out of range (0-", int(GRID_MAX_POINTS_Y - 1));
SERIAL_ECHOLNPGM(")");
return;
}
}
@ -193,8 +193,8 @@ void GcodeSuite::G29() {
} // switch(state)
if (state == MeshNext) {
SERIAL_PROTOCOLPAIR("MBL G29 point ", MIN(mbl_probe_index, GRID_MAX_POINTS));
SERIAL_PROTOCOLLNPAIR(" of ", int(GRID_MAX_POINTS));
SERIAL_ECHOPAIR("MBL G29 point ", MIN(mbl_probe_index, GRID_MAX_POINTS));
SERIAL_ECHOLNPAIR(" of ", int(GRID_MAX_POINTS));
}
report_current_position();

View file

@ -48,14 +48,10 @@ void GcodeSuite::M421() {
const int8_t iy = hasJ ? parser.value_int() : hasY ? mbl.probe_index_y(RAW_Y_POSITION(parser.value_linear_units())) : -1;
const bool hasZ = parser.seen('Z'), hasQ = !hasZ && parser.seen('Q');
if (int(hasI && hasJ) + int(hasX && hasY) != 1 || !(hasZ || hasQ)) {
SERIAL_ERROR_START();
SERIAL_ERRORLNPGM(MSG_ERR_M421_PARAMETERS);
}
else if (ix < 0 || iy < 0) {
SERIAL_ERROR_START();
SERIAL_ERRORLNPGM(MSG_ERR_MESH_XY);
}
if (int(hasI && hasJ) + int(hasX && hasY) != 1 || !(hasZ || hasQ))
SERIAL_ERROR_MSG(MSG_ERR_M421_PARAMETERS);
else if (ix < 0 || iy < 0)
SERIAL_ERROR_MSG(MSG_ERR_MESH_XY);
else
mbl.set_z(ix, iy, parser.value_linear_units() + (hasQ ? mbl.z_values[ix][iy] : 0));
}

View file

@ -56,14 +56,10 @@ void GcodeSuite::M421() {
iy = location.y_index;
}
if (int(hasC) + int(hasI && hasJ) != 1 || !(hasZ || hasQ || hasN)) {
SERIAL_ERROR_START();
SERIAL_ERRORLNPGM(MSG_ERR_M421_PARAMETERS);
}
else if (!WITHIN(ix, 0, GRID_MAX_POINTS_X - 1) || !WITHIN(iy, 0, GRID_MAX_POINTS_Y - 1)) {
SERIAL_ERROR_START();
SERIAL_ERRORLNPGM(MSG_ERR_MESH_XY);
}
if (int(hasC) + int(hasI && hasJ) != 1 || !(hasZ || hasQ || hasN))
SERIAL_ERROR_MSG(MSG_ERR_M421_PARAMETERS);
else if (!WITHIN(ix, 0, GRID_MAX_POINTS_X - 1) || !WITHIN(iy, 0, GRID_MAX_POINTS_Y - 1))
SERIAL_ERROR_MSG(MSG_ERR_MESH_XY);
else
ubl.z_values[ix][iy] = hasN ? NAN : parser.value_linear_units() + (hasQ ? ubl.z_values[ix][iy] : 0);
}

View file

@ -33,7 +33,7 @@
void GcodeSuite::M49() {
g26_debug_flag ^= true;
SERIAL_PROTOCOLPGM("G26 Debug: ");
SERIAL_ECHOPGM("G26 Debug: ");
serialprintPGM(g26_debug_flag ? PSTR("On\n") : PSTR("Off\n"));
}

View file

@ -92,8 +92,7 @@
// Disallow Z homing if X or Y are unknown
if (!TEST(axis_known_position, X_AXIS) || !TEST(axis_known_position, Y_AXIS)) {
LCD_MESSAGEPGM(MSG_ERR_Z_HOMING);
SERIAL_ECHO_START();
SERIAL_ECHOLNPGM(MSG_ERR_Z_HOMING);
SERIAL_ECHO_MSG(MSG_ERR_Z_HOMING);
return;
}
@ -135,8 +134,7 @@
}
else {
LCD_MESSAGEPGM(MSG_ZPROBE_OUT);
SERIAL_ECHO_START();
SERIAL_ECHOLNPGM(MSG_ZPROBE_OUT);
SERIAL_ECHO_MSG(MSG_ZPROBE_OUT);
}
#if ENABLED(DEBUG_LEVELING_FEATURE)

View file

@ -109,28 +109,28 @@ void ac_cleanup(
}
void print_signed_float(PGM_P const prefix, const float &f) {
SERIAL_PROTOCOLPGM(" ");
SERIAL_ECHOPGM(" ");
serialprintPGM(prefix);
SERIAL_PROTOCOLCHAR(':');
SERIAL_CHAR(':');
if (f >= 0) SERIAL_CHAR('+');
SERIAL_PROTOCOL_F(f, 2);
SERIAL_ECHO_F(f, 2);
}
/**
* - Print the delta settings
*/
static void print_calibration_settings(const bool end_stops, const bool tower_angles) {
SERIAL_PROTOCOLPAIR(".Height:", delta_height);
SERIAL_ECHOPAIR(".Height:", delta_height);
if (end_stops) {
print_signed_float(PSTR("Ex"), delta_endstop_adj[A_AXIS]);
print_signed_float(PSTR("Ey"), delta_endstop_adj[B_AXIS]);
print_signed_float(PSTR("Ez"), delta_endstop_adj[C_AXIS]);
}
if (end_stops && tower_angles) {
SERIAL_PROTOCOLPAIR(" Radius:", delta_radius);
SERIAL_ECHOPAIR(" Radius:", delta_radius);
SERIAL_EOL();
SERIAL_CHAR('.');
SERIAL_PROTOCOL_SP(13);
SERIAL_ECHO_SP(13);
}
if (tower_angles) {
print_signed_float(PSTR("Tx"), delta_tower_angle_trim[A_AXIS]);
@ -138,11 +138,11 @@ static void print_calibration_settings(const bool end_stops, const bool tower_an
print_signed_float(PSTR("Tz"), delta_tower_angle_trim[C_AXIS]);
}
if ((!end_stops && tower_angles) || (end_stops && !tower_angles)) { // XOR
SERIAL_PROTOCOLPAIR(" Radius:", delta_radius);
SERIAL_ECHOPAIR(" Radius:", delta_radius);
}
#if HAS_BED_PROBE
if (!end_stops && !tower_angles) {
SERIAL_PROTOCOL_SP(30);
SERIAL_ECHO_SP(30);
print_signed_float(PSTR("Offset"), zprobe_zoffset);
}
#endif
@ -153,7 +153,7 @@ static void print_calibration_settings(const bool end_stops, const bool tower_an
* - Print the probe results
*/
static void print_calibration_results(const float z_pt[NPP + 1], const bool tower_points, const bool opposite_points) {
SERIAL_PROTOCOLPGM(". ");
SERIAL_ECHOPGM(". ");
print_signed_float(PSTR("c"), z_pt[CEN]);
if (tower_points) {
print_signed_float(PSTR(" x"), z_pt[__A]);
@ -163,7 +163,7 @@ static void print_calibration_results(const float z_pt[NPP + 1], const bool towe
if (tower_points && opposite_points) {
SERIAL_EOL();
SERIAL_CHAR('.');
SERIAL_PROTOCOL_SP(13);
SERIAL_ECHO_SP(13);
}
if (opposite_points) {
print_signed_float(PSTR("yz"), z_pt[_BC]);
@ -438,7 +438,7 @@ void GcodeSuite::G33() {
const int8_t probe_points = set_up ? 2 : parser.intval('P', DELTA_CALIBRATION_DEFAULT_POINTS);
if (!WITHIN(probe_points, -1, 10)) {
SERIAL_PROTOCOLLNPGM("?(P)oints is implausible (-1 - 10).");
SERIAL_ECHOLNPGM("?(P)oints is implausible (-1 - 10).");
return;
}
@ -446,19 +446,19 @@ void GcodeSuite::G33() {
const float calibration_precision = set_up ? Z_CLEARANCE_BETWEEN_PROBES / 5.0 : parser.floatval('C', 0.0);
if (calibration_precision < 0) {
SERIAL_PROTOCOLLNPGM("?(C)alibration precision is implausible (>=0).");
SERIAL_ECHOLNPGM("?(C)alibration precision is implausible (>=0).");
return;
}
const int8_t force_iterations = parser.intval('F', 0);
if (!WITHIN(force_iterations, 0, 30)) {
SERIAL_PROTOCOLLNPGM("?(F)orce iteration is implausible (0 - 30).");
SERIAL_ECHOLNPGM("?(F)orce iteration is implausible (0 - 30).");
return;
}
const int8_t verbose_level = parser.byteval('V', 1);
if (!WITHIN(verbose_level, 0, 3)) {
SERIAL_PROTOCOLLNPGM("?(V)erbose level is implausible (0 - 3).");
SERIAL_ECHOLNPGM("?(V)erbose level is implausible (0 - 3).");
return;
}
@ -503,14 +503,14 @@ void GcodeSuite::G33() {
delta_tower_angle_trim[C_AXIS]
};
SERIAL_PROTOCOLLNPGM("G33 Auto Calibrate");
SERIAL_ECHOLNPGM("G33 Auto Calibrate");
if (!_1p_calibration && !_0p_calibration) { // test if the outer radius is reachable
LOOP_CAL_RAD(axis) {
const float a = RADIANS(210 + (360 / NPP) * (axis - 1)),
r = delta_calibration_radius;
if (!position_is_reachable(cos(a) * r, sin(a) * r)) {
SERIAL_PROTOCOLLNPGM("?(M665 B)ed radius is implausible.");
SERIAL_ECHOLNPGM("?(M665 B)ed radius is implausible.");
return;
}
}
@ -519,8 +519,8 @@ void GcodeSuite::G33() {
// Report settings
PGM_P checkingac = PSTR("Checking... AC");
serialprintPGM(checkingac);
if (verbose_level == 0) SERIAL_PROTOCOLPGM(" (DRY-RUN)");
if (set_up) SERIAL_PROTOCOLPGM(" (SET-UP)");
if (verbose_level == 0) SERIAL_ECHOPGM(" (DRY-RUN)");
if (set_up) SERIAL_ECHOPGM(" (SET-UP)");
SERIAL_EOL();
ui.set_status_P(checkingac);
@ -540,7 +540,7 @@ void GcodeSuite::G33() {
// Probe the points
zero_std_dev_old = zero_std_dev;
if (!probe_calibration_points(z_at_pt, probe_points, towers_set, stow_after_each, set_up)) {
SERIAL_PROTOCOLLNPGM("Correct delta settings with M665 and M666");
SERIAL_ECHOLNPGM("Correct delta settings with M665 and M666");
return AC_CLEANUP();
}
zero_std_dev = std_dev_points(z_at_pt, _0p_calibration, _1p_calibration, _4p_calibration, _4p_opposite_points);
@ -665,16 +665,15 @@ void GcodeSuite::G33() {
if (verbose_level != 0) { // !dry run
if ((zero_std_dev >= test_precision && iterations > force_iterations) || zero_std_dev <= calibration_precision) { // end iterations
SERIAL_PROTOCOLPGM("Calibration OK");
SERIAL_PROTOCOL_SP(32);
SERIAL_ECHOPGM("Calibration OK");
SERIAL_ECHO_SP(32);
#if HAS_BED_PROBE
if (zero_std_dev >= test_precision && !_1p_calibration && !_0p_calibration)
SERIAL_PROTOCOLPGM("rolling back.");
SERIAL_ECHOPGM("rolling back.");
else
#endif
{
SERIAL_PROTOCOLPGM("std dev:");
SERIAL_PROTOCOL_F(zero_std_dev_min, 3);
SERIAL_ECHOPAIR_F("std dev:", zero_std_dev_min, 3);
}
SERIAL_EOL();
char mess[21];
@ -694,11 +693,9 @@ void GcodeSuite::G33() {
sprintf_P(mess, PSTR("Iteration : %02i"), (int)iterations);
else
strcpy_P(mess, PSTR("No convergence"));
SERIAL_PROTOCOL(mess);
SERIAL_PROTOCOL_SP(32);
SERIAL_PROTOCOLPGM("std dev:");
SERIAL_PROTOCOL_F(zero_std_dev, 3);
SERIAL_EOL();
SERIAL_ECHO(mess);
SERIAL_ECHO_SP(32);
SERIAL_ECHOLNPAIR_F("std dev:", zero_std_dev, 3);
ui.set_status(mess);
if (verbose_level > 1)
print_calibration_settings(_endstop_results, _angle_results);
@ -707,10 +704,8 @@ void GcodeSuite::G33() {
else { // dry run
PGM_P enddryrun = PSTR("End DRY-RUN");
serialprintPGM(enddryrun);
SERIAL_PROTOCOL_SP(35);
SERIAL_PROTOCOLPGM("std dev:");
SERIAL_PROTOCOL_F(zero_std_dev, 3);
SERIAL_EOL();
SERIAL_ECHO_SP(35);
SERIAL_ECHOLNPAIR_F("std dev:", zero_std_dev, 3);
char mess[21];
strcpy_P(mess, enddryrun);

View file

@ -263,19 +263,19 @@ void GcodeSuite::G34() {
void GcodeSuite::M422() {
const int8_t zstepper = parser.intval('S') - 1;
if (!WITHIN(zstepper, 0, Z_STEPPER_COUNT - 1)) {
SERIAL_PROTOCOLLNPGM("?(S) Z-Stepper index invalid.");
SERIAL_ECHOLNPGM("?(S) Z-Stepper index invalid.");
return;
}
const float x_pos = parser.floatval('X', z_auto_align_xpos[zstepper]);
if (!WITHIN(x_pos, X_MIN_POS, X_MAX_POS)) {
SERIAL_PROTOCOLLNPGM("?(X) out of bounds.");
SERIAL_ECHOLNPGM("?(X) out of bounds.");
return;
}
const float y_pos = parser.floatval('Y', z_auto_align_ypos[zstepper]);
if (!WITHIN(y_pos, Y_MIN_POS, Y_MAX_POS)) {
SERIAL_PROTOCOLLNPGM("?(Y) out of bounds.");
SERIAL_ECHOLNPGM("?(Y) out of bounds.");
return;
}

View file

@ -55,16 +55,16 @@ void GcodeSuite::M48() {
const int8_t verbose_level = parser.byteval('V', 1);
if (!WITHIN(verbose_level, 0, 4)) {
SERIAL_PROTOCOLLNPGM("?(V)erbose level is implausible (0-4).");
SERIAL_ECHOLNPGM("?(V)erbose level is implausible (0-4).");
return;
}
if (verbose_level > 0)
SERIAL_PROTOCOLLNPGM("M48 Z-Probe Repeatability Test");
SERIAL_ECHOLNPGM("M48 Z-Probe Repeatability Test");
const int8_t n_samples = parser.byteval('P', 10);
if (!WITHIN(n_samples, 4, 50)) {
SERIAL_PROTOCOLLNPGM("?Sample size not plausible (4-50).");
SERIAL_ECHOLNPGM("?Sample size not plausible (4-50).");
return;
}
@ -77,14 +77,14 @@ void GcodeSuite::M48() {
Y_probe_location = parser.linearval('Y', Y_current + Y_PROBE_OFFSET_FROM_EXTRUDER);
if (!position_is_reachable_by_probe(X_probe_location, Y_probe_location)) {
SERIAL_PROTOCOLLNPGM("? (X,Y) out of bounds.");
SERIAL_ECHOLNPGM("? (X,Y) out of bounds.");
return;
}
bool seen_L = parser.seen('L');
uint8_t n_legs = seen_L ? parser.value_byte() : 0;
if (n_legs > 15) {
SERIAL_PROTOCOLLNPGM("?Number of legs in movement not plausible (0-15).");
SERIAL_ECHOLNPGM("?Number of legs in movement not plausible (0-15).");
return;
}
if (n_legs == 1) n_legs = 2;
@ -98,7 +98,7 @@ void GcodeSuite::M48() {
* we don't want to use that as a starting point for each probe.
*/
if (verbose_level > 2)
SERIAL_PROTOCOLLNPGM("Positioning the probe...");
SERIAL_ECHOLNPGM("Positioning the probe...");
// Disable bed level correction in M48 because we want the raw data when we probe
@ -178,7 +178,7 @@ void GcodeSuite::M48() {
}
#endif
if (verbose_level > 3) {
SERIAL_PROTOCOLPGM("Going to:");
SERIAL_ECHOPGM("Going to:");
SERIAL_ECHOPAIR(" X", X_current);
SERIAL_ECHOPAIR(" Y", Y_current);
SERIAL_ECHOLNPAIR(" Z", current_position[Z_AXIS]);
@ -215,22 +215,15 @@ void GcodeSuite::M48() {
sigma = SQRT(sum / (n + 1));
if (verbose_level > 0) {
if (verbose_level > 1) {
SERIAL_PROTOCOL(n + 1);
SERIAL_PROTOCOLPGM(" of ");
SERIAL_PROTOCOL((int)n_samples);
SERIAL_PROTOCOLPGM(": z: ");
SERIAL_PROTOCOL_F(sample_set[n], 3);
SERIAL_ECHO(n + 1);
SERIAL_ECHOPAIR(" of ", (int)n_samples);
SERIAL_ECHOPAIR_F(": z: ", sample_set[n], 3);
if (verbose_level > 2) {
SERIAL_PROTOCOLPGM(" mean: ");
SERIAL_PROTOCOL_F(mean, 4);
SERIAL_PROTOCOLPGM(" sigma: ");
SERIAL_PROTOCOL_F(sigma, 6);
SERIAL_PROTOCOLPGM(" min: ");
SERIAL_PROTOCOL_F(min, 3);
SERIAL_PROTOCOLPGM(" max: ");
SERIAL_PROTOCOL_F(max, 3);
SERIAL_PROTOCOLPGM(" range: ");
SERIAL_PROTOCOL_F(max-min, 3);
SERIAL_ECHOPAIR_F(" mean: ", mean, 4);
SERIAL_ECHOPAIR_F(" sigma: ", sigma, 6);
SERIAL_ECHOPAIR_F(" min: ", min, 3);
SERIAL_ECHOPAIR_F(" max: ", max, 3);
SERIAL_ECHOPAIR_F(" range: ", max-min, 3);
}
SERIAL_EOL();
}
@ -242,23 +235,16 @@ void GcodeSuite::M48() {
STOW_PROBE();
if (probing_good) {
SERIAL_PROTOCOLLNPGM("Finished!");
SERIAL_ECHOLNPGM("Finished!");
if (verbose_level > 0) {
SERIAL_PROTOCOLPGM("Mean: ");
SERIAL_PROTOCOL_F(mean, 6);
SERIAL_PROTOCOLPGM(" Min: ");
SERIAL_PROTOCOL_F(min, 3);
SERIAL_PROTOCOLPGM(" Max: ");
SERIAL_PROTOCOL_F(max, 3);
SERIAL_PROTOCOLPGM(" Range: ");
SERIAL_PROTOCOL_F(max-min, 3);
SERIAL_EOL();
SERIAL_ECHOPAIR_F("Mean: ", mean, 6);
SERIAL_ECHOPAIR_F(" Min: ", min, 3);
SERIAL_ECHOPAIR_F(" Max: ", max, 3);
SERIAL_ECHOLNPAIR_F(" Range: ", max-min, 3);
}
SERIAL_PROTOCOLPGM("Standard Deviation: ");
SERIAL_PROTOCOL_F(sigma, 6);
SERIAL_EOL();
SERIAL_ECHOLNPAIR_F("Standard Deviation: ", sigma, 6);
SERIAL_EOL();
}

View file

@ -84,8 +84,7 @@
if (sumAPX == 1)
scara_home_offset[A_AXIS] = parser.value_float();
else {
SERIAL_ERROR_START();
SERIAL_ERRORLNPGM("Only one of A, P, or X is allowed.");
SERIAL_ERROR_MSG("Only one of A, P, or X is allowed.");
return;
}
}
@ -96,8 +95,7 @@
if (sumBTY == 1)
scara_home_offset[B_AXIS] = parser.value_float();
else {
SERIAL_ERROR_START();
SERIAL_ERRORLNPGM("Only one of B, T, or Y is allowed.");
SERIAL_ERROR_MSG("Only one of B, T, or Y is allowed.");
return;
}
}

View file

@ -93,9 +93,7 @@ void GcodeSuite::M852() {
if (!ijk) {
SERIAL_ECHO_START();
SERIAL_ECHOPGM(MSG_SKEW_FACTOR " XY: ");
SERIAL_ECHO_F(planner.skew_factor.xy, 6);
SERIAL_EOL();
SERIAL_ECHOLNPAIR_F(MSG_SKEW_FACTOR " XY: ", planner.skew_factor.xy, 6);
#if ENABLED(SKEW_CORRECTION_FOR_Z)
SERIAL_ECHOPAIR(" XZ: ", planner.skew_factor.xz);
SERIAL_ECHOLNPAIR(" YZ: ", planner.skew_factor.yz);

View file

@ -147,10 +147,8 @@ void GcodeSuite::M205() {
planner.recalculate_max_e_jerk();
#endif
}
else {
SERIAL_ERROR_START();
SERIAL_ERRORLNPGM("?J out of range (0.01 to 0.3)");
}
else
SERIAL_ERROR_MSG("?J out of range (0.01 to 0.3)");
}
#endif
#if HAS_CLASSIC_JERK

View file

@ -70,10 +70,8 @@ void GcodeSuite::M301() {
#endif
SERIAL_EOL();
}
else {
SERIAL_ERROR_START();
SERIAL_ERRORLNPGM(MSG_INVALID_EXTRUDER);
}
else
SERIAL_ERROR_MSG(MSG_INVALID_EXTRUDER);
}
#endif // PIDTEMP

View file

@ -89,22 +89,20 @@ inline void toggle_pins() {
inline void servo_probe_test() {
#if !(NUM_SERVOS > 0 && HAS_SERVO_0)
SERIAL_ERROR_START();
SERIAL_ERRORLNPGM("SERVO not setup");
SERIAL_ERROR_MSG("SERVO not setup");
#elif !HAS_Z_SERVO_PROBE
SERIAL_ERROR_START();
SERIAL_ERRORLNPGM("Z_PROBE_SERVO_NR not setup");
SERIAL_ERROR_MSG("Z_PROBE_SERVO_NR not setup");
#else // HAS_Z_SERVO_PROBE
const uint8_t probe_index = parser.byteval('P', Z_PROBE_SERVO_NR);
SERIAL_PROTOCOLLNPGM("Servo probe test");
SERIAL_PROTOCOLLNPAIR(". using index: ", probe_index);
SERIAL_PROTOCOLLNPAIR(". deploy angle: ", servo_angles[probe_index][0]);
SERIAL_PROTOCOLLNPAIR(". stow angle: ", servo_angles[probe_index][1]);
SERIAL_ECHOLNPGM("Servo probe test");
SERIAL_ECHOLNPAIR(". using index: ", probe_index);
SERIAL_ECHOLNPAIR(". deploy angle: ", servo_angles[probe_index][0]);
SERIAL_ECHOLNPAIR(". stow angle: ", servo_angles[probe_index][1]);
bool probe_inverting;
@ -112,14 +110,14 @@ inline void servo_probe_test() {
#define PROBE_TEST_PIN Z_MIN_PIN
SERIAL_PROTOCOLLNPAIR(". probe uses Z_MIN pin: ", PROBE_TEST_PIN);
SERIAL_PROTOCOLLNPGM(". uses Z_MIN_ENDSTOP_INVERTING (ignores Z_MIN_PROBE_ENDSTOP_INVERTING)");
SERIAL_PROTOCOLPGM(". Z_MIN_ENDSTOP_INVERTING: ");
SERIAL_ECHOLNPAIR(". probe uses Z_MIN pin: ", PROBE_TEST_PIN);
SERIAL_ECHOLNPGM(". uses Z_MIN_ENDSTOP_INVERTING (ignores Z_MIN_PROBE_ENDSTOP_INVERTING)");
SERIAL_ECHOPGM(". Z_MIN_ENDSTOP_INVERTING: ");
#if Z_MIN_ENDSTOP_INVERTING
SERIAL_PROTOCOLLNPGM("true");
SERIAL_ECHOLNPGM("true");
#else
SERIAL_PROTOCOLLNPGM("false");
SERIAL_ECHOLNPGM("false");
#endif
probe_inverting = Z_MIN_ENDSTOP_INVERTING;
@ -127,21 +125,21 @@ inline void servo_probe_test() {
#elif ENABLED(Z_MIN_PROBE_ENDSTOP)
#define PROBE_TEST_PIN Z_MIN_PROBE_PIN
SERIAL_PROTOCOLLNPAIR(". probe uses Z_MIN_PROBE_PIN: ", PROBE_TEST_PIN);
SERIAL_PROTOCOLLNPGM(". uses Z_MIN_PROBE_ENDSTOP_INVERTING (ignores Z_MIN_ENDSTOP_INVERTING)");
SERIAL_PROTOCOLPGM(". Z_MIN_PROBE_ENDSTOP_INVERTING: ");
SERIAL_ECHOLNPAIR(". probe uses Z_MIN_PROBE_PIN: ", PROBE_TEST_PIN);
SERIAL_ECHOLNPGM(". uses Z_MIN_PROBE_ENDSTOP_INVERTING (ignores Z_MIN_ENDSTOP_INVERTING)");
SERIAL_ECHOPGM(". Z_MIN_PROBE_ENDSTOP_INVERTING: ");
#if Z_MIN_PROBE_ENDSTOP_INVERTING
SERIAL_PROTOCOLLNPGM("true");
SERIAL_ECHOLNPGM("true");
#else
SERIAL_PROTOCOLLNPGM("false");
SERIAL_ECHOLNPGM("false");
#endif
probe_inverting = Z_MIN_PROBE_ENDSTOP_INVERTING;
#endif
SERIAL_PROTOCOLLNPGM(". deploy & stow 4 times");
SERIAL_ECHOLNPGM(". deploy & stow 4 times");
SET_INPUT_PULLUP(PROBE_TEST_PIN);
uint8_t i = 0;
bool deploy_state, stow_state;
@ -153,26 +151,26 @@ inline void servo_probe_test() {
safe_delay(500);
stow_state = READ(PROBE_TEST_PIN);
} while (++i < 4);
if (probe_inverting != deploy_state) SERIAL_PROTOCOLLNPGM("WARNING - INVERTING setting probably backwards");
if (probe_inverting != deploy_state) SERIAL_ECHOLNPGM("WARNING - INVERTING setting probably backwards");
if (deploy_state != stow_state) {
SERIAL_PROTOCOLLNPGM("BLTouch clone detected");
SERIAL_ECHOLNPGM("BLTouch clone detected");
if (deploy_state) {
SERIAL_PROTOCOLLNPGM(". DEPLOYED state: HIGH (logic 1)");
SERIAL_PROTOCOLLNPGM(". STOWED (triggered) state: LOW (logic 0)");
SERIAL_ECHOLNPGM(". DEPLOYED state: HIGH (logic 1)");
SERIAL_ECHOLNPGM(". STOWED (triggered) state: LOW (logic 0)");
}
else {
SERIAL_PROTOCOLLNPGM(". DEPLOYED state: LOW (logic 0)");
SERIAL_PROTOCOLLNPGM(". STOWED (triggered) state: HIGH (logic 1)");
SERIAL_ECHOLNPGM(". DEPLOYED state: LOW (logic 0)");
SERIAL_ECHOLNPGM(". STOWED (triggered) state: HIGH (logic 1)");
}
#if ENABLED(BLTOUCH)
SERIAL_PROTOCOLLNPGM("ERROR: BLTOUCH enabled - set this device up as a Z Servo Probe with inverting as true.");
SERIAL_ECHOLNPGM("ERROR: BLTOUCH enabled - set this device up as a Z Servo Probe with inverting as true.");
#endif
}
else { // measure active signal length
MOVE_SERVO(probe_index, servo_angles[Z_PROBE_SERVO_NR][0]); // Deploy
safe_delay(500);
SERIAL_PROTOCOLLNPGM("please trigger probe");
SERIAL_ECHOLNPGM("please trigger probe");
uint16_t probe_counter = 0;
// Allow 30 seconds max for operator to trigger probe
@ -188,11 +186,11 @@ inline void servo_probe_test() {
safe_delay(2);
if (probe_counter == 50)
SERIAL_PROTOCOLLNPGM("Z Servo Probe detected"); // >= 100mS active time
SERIAL_ECHOLNPGM("Z Servo Probe detected"); // >= 100mS active time
else if (probe_counter >= 2)
SERIAL_PROTOCOLLNPAIR("BLTouch compatible probe detected - pulse width (+/- 4mS): ", probe_counter * 2); // allow 4 - 100mS pulse
SERIAL_ECHOLNPAIR("BLTouch compatible probe detected - pulse width (+/- 4mS): ", probe_counter * 2); // allow 4 - 100mS pulse
else
SERIAL_PROTOCOLLNPGM("noise detected - please re-run test"); // less than 2mS pulse
SERIAL_ECHOLNPGM("noise detected - please re-run test"); // less than 2mS pulse
MOVE_SERVO(probe_index, servo_angles[Z_PROBE_SERVO_NR][1]); // Stow
@ -200,7 +198,7 @@ inline void servo_probe_test() {
} // for loop waiting for trigger
if (probe_counter == 0) SERIAL_PROTOCOLLNPGM("trigger not detected");
if (probe_counter == 0) SERIAL_ECHOLNPGM("trigger not detected");
} // measure active signal length
@ -245,9 +243,9 @@ void GcodeSuite::M43() {
// Enable or disable endstop monitoring
if (parser.seen('E')) {
endstops.monitor_flag = parser.value_bool();
SERIAL_PROTOCOLPGM("endstop monitor ");
SERIAL_ECHOPGM("endstop monitor ");
serialprintPGM(endstops.monitor_flag ? PSTR("en") : PSTR("dis"));
SERIAL_PROTOCOLLNPGM("abled");
SERIAL_ECHOLNPGM("abled");
return;
}
@ -266,7 +264,7 @@ void GcodeSuite::M43() {
// Watch until click, M108, or reset
if (parser.boolval('W')) {
SERIAL_PROTOCOLLNPGM("Watching pins");
SERIAL_ECHOLNPGM("Watching pins");
#ifdef ARDUINO_ARCH_SAM
NOLESS(first_pin, 2); // don't hijack the UART pins

View file

@ -94,9 +94,7 @@ void GcodeSuite::M502() {
* M504: Validate EEPROM Contents
*/
void GcodeSuite::M504() {
if (settings.validate(CHAT_PORT)) {
SERIAL_ECHO_START_P(command_queue_port[cmd_queue_index_r]);
SERIAL_ECHOLNPGM_P(command_queue_port[cmd_queue_index_r], "EEPROM OK");
}
if (settings.validate(CHAT_PORT))
SERIAL_ECHO_MSG_P(command_queue_port[cmd_queue_index_r], "EEPROM OK");
}
#endif

View file

@ -40,7 +40,7 @@ void GcodeSuite::M900() {
#else
const uint8_t tmp_extruder = parser.seenval('T') ? parser.value_int() : active_extruder;
if (tmp_extruder >= EXTRUDERS) {
SERIAL_PROTOCOLLNPGM("?T value out of range.");
SERIAL_ECHOLNPGM("?T value out of range.");
return;
}
#endif
@ -52,7 +52,7 @@ void GcodeSuite::M900() {
planner.extruder_advance_K[tmp_extruder] = newK;
}
else
SERIAL_PROTOCOLLNPGM("?K value out of range (0-10).");
SERIAL_ECHOLNPGM("?K value out of range (0-10).");
}
else {
SERIAL_ECHO_START();

View file

@ -63,7 +63,6 @@ void GcodeSuite::M355() {
else SERIAL_ECHOLNPAIR("Case light: ", case_light_brightness);
}
#else
SERIAL_ERROR_START();
SERIAL_ERRORLNPGM(MSG_ERR_M355_NONE);
SERIAL_ERROR_MSG(MSG_ERR_M355_NONE);
#endif
}

View file

@ -38,10 +38,8 @@ void GcodeSuite::M404() {
filament_width_nominal = parser.value_linear_units();
planner.volumetric_area_nominal = CIRCLE_AREA(filament_width_nominal * 0.5);
}
else {
SERIAL_PROTOCOLPGM("Filament dia (nominal mm):");
SERIAL_PROTOCOLLN(filament_width_nominal);
}
else
SERIAL_ECHOLNPAIR("Filament dia (nominal mm):", filament_width_nominal);
}
/**
@ -79,8 +77,7 @@ void GcodeSuite::M406() {
* M407: Get measured filament diameter on serial output
*/
void GcodeSuite::M407() {
SERIAL_PROTOCOLPGM("Filament dia (measured mm):");
SERIAL_PROTOCOLLN(filament_width_meas);
SERIAL_ECHOLNPAIR("Filament dia (measured mm):", filament_width_meas);
}
#endif // FILAMENT_WIDTH_SENSOR

View file

@ -68,13 +68,10 @@ void GcodeSuite::M261() {
uint8_t bytes = parser.byteval('B', 1);
if (i2c.addr && bytes && bytes <= TWIBUS_BUFFER_SIZE) {
if (i2c.addr && bytes && bytes <= TWIBUS_BUFFER_SIZE)
i2c.relay(bytes);
}
else {
SERIAL_ERROR_START();
SERIAL_ERRORLNPGM("Bad i2c request");
}
else
SERIAL_ERROR_MSG("Bad i2c request");
}
#endif

View file

@ -45,10 +45,8 @@ void GcodeSuite::M810_819() {
if (len) {
// Set a macro
if (len > GCODE_MACROS_SLOT_SIZE) {
SERIAL_ERROR_START();
SERIAL_ERRORLNPGM("Macro too long.");
}
if (len > GCODE_MACROS_SLOT_SIZE)
SERIAL_ERROR_MSG("Macro too long.");
else {
char c, *s = parser.string_arg, *d = gcode_macros[index];
do {

View file

@ -790,16 +790,13 @@ void GcodeSuite::process_next_command() {
switch (busy_state) {
case IN_HANDLER:
case IN_PROCESS:
SERIAL_ECHO_START();
SERIAL_ECHOLNPGM(MSG_BUSY_PROCESSING);
SERIAL_ECHO_MSG(MSG_BUSY_PROCESSING);
break;
case PAUSED_FOR_USER:
SERIAL_ECHO_START();
SERIAL_ECHOLNPGM(MSG_BUSY_PAUSED_FOR_USER);
SERIAL_ECHO_MSG(MSG_BUSY_PAUSED_FOR_USER);
break;
case PAUSED_FOR_INPUT:
SERIAL_ECHO_START();
SERIAL_ECHOLNPGM(MSG_BUSY_PAUSED_FOR_INPUT);
SERIAL_ECHO_MSG(MSG_BUSY_PAUSED_FOR_INPUT);
break;
default:
break;

View file

@ -80,7 +80,7 @@ inline void GcodeSuite::G53() {
void G54_59(uint8_t subcode=0) {
const int8_t _space = parser.codenum - 54 + subcode;
if (gcode.select_coordinate_system(_space)) {
SERIAL_PROTOCOLLNPAIR("Select workspace ", _space);
SERIAL_ECHOLNPAIR("Select workspace ", _space);
report_current_position();
}
}

View file

@ -69,8 +69,7 @@ void GcodeSuite::M428() {
if (!WITHIN(diff[i], -20, 20) && home_dir((AxisEnum)i) > 0)
diff[i] = -current_position[i];
if (!WITHIN(diff[i], -20, 20)) {
SERIAL_ERROR_START();
SERIAL_ERRORLNPGM(MSG_ERR_M428_TOO_FAR);
SERIAL_ERROR_MSG(MSG_ERR_M428_TOO_FAR);
LCD_ALERTMESSAGEPGM("Err: Too far!");
BUZZ(200, 40);
return;

View file

@ -34,7 +34,7 @@
SERIAL_CHAR(' ');
SERIAL_CHAR(axis_codes[i]);
SERIAL_CHAR(':');
SERIAL_PROTOCOL(dtostrf(pos[i], 8, precision, str));
SERIAL_ECHO(dtostrf(pos[i], 8, precision, str));
}
SERIAL_EOL();
}
@ -43,7 +43,7 @@
void report_current_position_detail() {
SERIAL_PROTOCOLPGM("\nLogical:");
SERIAL_ECHOPGM("\nLogical:");
const float logical[XYZ] = {
LOGICAL_X_POSITION(current_position[X_AXIS]),
LOGICAL_Y_POSITION(current_position[Y_AXIS]),
@ -51,17 +51,17 @@
};
report_xyz(logical);
SERIAL_PROTOCOLPGM("Raw: ");
SERIAL_ECHOPGM("Raw: ");
report_xyz(current_position);
float leveled[XYZ] = { current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS] };
#if HAS_LEVELING
SERIAL_PROTOCOLPGM("Leveled:");
SERIAL_ECHOPGM("Leveled:");
planner.apply_leveling(leveled);
report_xyz(leveled);
SERIAL_PROTOCOLPGM("UnLevel:");
SERIAL_ECHOPGM("UnLevel:");
float unleveled[XYZ] = { leveled[X_AXIS], leveled[Y_AXIS], leveled[Z_AXIS] };
planner.unapply_leveling(unleveled);
report_xyz(unleveled);
@ -69,9 +69,9 @@
#if IS_KINEMATIC
#if IS_SCARA
SERIAL_PROTOCOLPGM("ScaraK: ");
SERIAL_ECHOPGM("ScaraK: ");
#else
SERIAL_PROTOCOLPGM("DeltaK: ");
SERIAL_ECHOPGM("DeltaK: ");
#endif
inverse_kinematics(leveled); // writes delta[]
report_xyz(delta);
@ -79,12 +79,12 @@
planner.synchronize();
SERIAL_PROTOCOLPGM("Stepper:");
SERIAL_ECHOPGM("Stepper:");
LOOP_XYZE(i) {
SERIAL_CHAR(' ');
SERIAL_CHAR(axis_codes[i]);
SERIAL_CHAR(':');
SERIAL_PROTOCOL(stepper.position((AxisEnum)i));
SERIAL_ECHO(stepper.position((AxisEnum)i));
}
SERIAL_EOL();
@ -93,11 +93,11 @@
planner.get_axis_position_degrees(A_AXIS),
planner.get_axis_position_degrees(B_AXIS)
};
SERIAL_PROTOCOLPGM("Degrees:");
SERIAL_ECHOPGM("Degrees:");
report_xyze(deg, 2);
#endif
SERIAL_PROTOCOLPGM("FromStp:");
SERIAL_ECHOPGM("FromStp:");
get_cartesian_from_steppers(); // writes cartes[XYZ] (with forward kinematics)
const float from_steppers[XYZE] = { cartes[X_AXIS], cartes[Y_AXIS], cartes[Z_AXIS], planner.get_axis_position_mm(E_AXIS) };
report_xyze(from_steppers);
@ -108,7 +108,7 @@
from_steppers[Z_AXIS] - leveled[Z_AXIS],
from_steppers[E_AXIS] - current_position[E_AXIS]
};
SERIAL_PROTOCOLPGM("Differ: ");
SERIAL_ECHOPGM("Differ: ");
report_xyze(diff);
}

View file

@ -29,10 +29,10 @@
#if ENABLED(EXTENDED_CAPABILITIES_REPORT)
static void cap_line(PGM_P const name, bool ena=false) {
SERIAL_PROTOCOLPGM("Cap:");
SERIAL_ECHOPGM("Cap:");
serialprintPGM(name);
SERIAL_CHAR(':');
SERIAL_PROTOCOLLN(int(ena ? 1 : 0));
SERIAL_ECHOLN(int(ena ? 1 : 0));
}
#endif
@ -47,7 +47,7 @@ void GcodeSuite::M115() {
#define CAPLINE(STR,...) cap_line(PSTR(STR), __VA_ARGS__)
#endif
SERIAL_PROTOCOLLNPGM_P(port, MSG_M115_REPORT);
SERIAL_ECHOLNPGM_P(port, MSG_M115_REPORT);
#if ENABLED(EXTENDED_CAPABILITIES_REPORT)

View file

@ -37,10 +37,8 @@
*/
void GcodeSuite::M145() {
const uint8_t material = (uint8_t)parser.intval('S');
if (material >= COUNT(ui.preheat_hotend_temp)) {
SERIAL_ERROR_START();
SERIAL_ERRORLNPGM(MSG_ERR_MATERIAL_INDEX);
}
if (material >= COUNT(ui.preheat_hotend_temp))
SERIAL_ERROR_MSG(MSG_ERR_MATERIAL_INDEX);
else {
int v;
if (parser.seenval('H')) {

View file

@ -32,7 +32,7 @@
*/
void GcodeSuite::M250() {
if (parser.seen('C')) ui.set_contrast(parser.value_int());
SERIAL_PROTOCOLLNPAIR("LCD Contrast: ", ui.contrast);
SERIAL_ECHOLNPAIR("LCD Contrast: ", ui.contrast);
}
#endif // HAS_LCD_CONTRAST

View file

@ -293,10 +293,9 @@ void GcodeSuite::G2_G3(const bool clockwise) {
#if ENABLED(ARC_P_CIRCLES)
// P indicates number of circles to do
int8_t circles_to_do = parser.byteval('P');
if (!WITHIN(circles_to_do, 0, 100)) {
SERIAL_ERROR_START();
SERIAL_ERRORLNPGM(MSG_ERR_ARC_ARGS);
}
if (!WITHIN(circles_to_do, 0, 100))
SERIAL_ERROR_MSG(MSG_ERR_ARC_ARGS);
while (circles_to_do--)
plan_arc(current_position, arc_offset, clockwise);
#endif
@ -305,11 +304,8 @@ void GcodeSuite::G2_G3(const bool clockwise) {
plan_arc(destination, arc_offset, clockwise);
reset_stepper_timeout();
}
else {
// Bad arguments
SERIAL_ERROR_START();
SERIAL_ERRORLNPGM(MSG_ERR_ARC_ARGS);
}
else
SERIAL_ERROR_MSG(MSG_ERR_ARC_ARGS);
}
}

View file

@ -50,8 +50,7 @@ void GcodeSuite::G5() {
#if ENABLED(CNC_WORKSPACE_PLANES)
if (workspace_plane != PLANE_XY) {
SERIAL_ERROR_START();
SERIAL_ERRORLNPGM(MSG_ERR_BAD_PLANE_MODE);
SERIAL_ERROR_MSG(MSG_ERR_BAD_PLANE_MODE);
return;
}
#endif

View file

@ -55,9 +55,9 @@ void GcodeSuite::G30() {
const float measured_z = probe_pt(xpos, ypos, raise_after, 1);
if (!isnan(measured_z)) {
SERIAL_PROTOCOLPAIR_F("Bed X: ", xpos);
SERIAL_PROTOCOLPAIR_F(" Y: ", ypos);
SERIAL_PROTOCOLLNPAIR_F(" Z: ", measured_z);
SERIAL_ECHOPAIR("Bed X: ", FIXFLOAT(xpos));
SERIAL_ECHOPAIR(" Y: ", FIXFLOAT(ypos));
SERIAL_ECHOLNPAIR(" Z: ", FIXFLOAT(measured_z));
}
clean_up_after_endstop_or_probe_move();

View file

@ -108,10 +108,7 @@ void GcodeSuite::G38(const bool is_38_2) {
if (ABS(destination[i] - current_position[i]) >= G38_MINIMUM_MOVE) {
if (!parser.seenval('F')) feedrate_mm_s = homing_feedrate((AxisEnum)i);
// If G38.2 fails throw an error
if (!G38_run_probe() && is_38_2) {
SERIAL_ERROR_START();
SERIAL_ERRORLNPGM("Failed to reach target");
}
if (!G38_run_probe() && is_38_2) SERIAL_ERROR_MSG("Failed to reach target");
break;
}

View file

@ -32,18 +32,13 @@ void GcodeSuite::M851() {
if (parser.seenval('Z')) {
const float value = parser.value_linear_units();
if (WITHIN(value, Z_PROBE_OFFSET_RANGE_MIN, Z_PROBE_OFFSET_RANGE_MAX))
{
zprobe_zoffset = value;
}
else {
SERIAL_ERROR_START();
SERIAL_ERRORLNPGM("?Z out of range (" STRINGIFY(Z_PROBE_OFFSET_RANGE_MIN) " to " STRINGIFY(Z_PROBE_OFFSET_RANGE_MAX) ")");
}
else
SERIAL_ERROR_MSG("?Z out of range (" STRINGIFY(Z_PROBE_OFFSET_RANGE_MIN) " to " STRINGIFY(Z_PROBE_OFFSET_RANGE_MAX) ")");
return;
}
SERIAL_ECHO_START();
SERIAL_ECHOPGM(MSG_PROBE_Z_OFFSET);
SERIAL_ECHOLNPAIR(": ", zprobe_zoffset);
SERIAL_ECHOLNPAIR(MSG_PROBE_Z_OFFSET ": ", zprobe_zoffset);
}
#endif // HAS_BED_PROBE

View file

@ -221,17 +221,17 @@ void ok_to_send() {
if (port < 0) return;
#endif
if (!send_ok[cmd_queue_index_r]) return;
SERIAL_PROTOCOLPGM_P(port, MSG_OK);
SERIAL_ECHOPGM_P(port, MSG_OK);
#if ENABLED(ADVANCED_OK)
char* p = command_queue[cmd_queue_index_r];
if (*p == 'N') {
SERIAL_PROTOCOL_P(port, ' ');
SERIAL_ECHO_P(port, ' ');
SERIAL_ECHO_P(port, *p++);
while (NUMERIC_SIGNED(*p))
SERIAL_ECHO_P(port, *p++);
}
SERIAL_PROTOCOLPGM_P(port, " P"); SERIAL_PROTOCOL_P(port, int(BLOCK_BUFFER_SIZE - planner.movesplanned() - 1));
SERIAL_PROTOCOLPGM_P(port, " B"); SERIAL_PROTOCOL_P(port, BUFSIZE - commands_in_queue);
SERIAL_ECHOPGM_P(port, " P"); SERIAL_ECHO_P(port, int(BLOCK_BUFFER_SIZE - planner.movesplanned() - 1));
SERIAL_ECHOPGM_P(port, " B"); SERIAL_ECHO_P(port, BUFSIZE - commands_in_queue);
#endif
SERIAL_EOL_P(port);
}
@ -246,15 +246,15 @@ void flush_and_request_resend() {
if (port < 0) return;
#endif
SERIAL_FLUSH_P(port);
SERIAL_PROTOCOLPGM_P(port, MSG_RESEND);
SERIAL_PROTOCOLLN_P(port, gcode_LastN + 1);
SERIAL_ECHOPGM_P(port, MSG_RESEND);
SERIAL_ECHOLN_P(port, gcode_LastN + 1);
ok_to_send();
}
void gcode_line_error(PGM_P err, uint8_t port) {
SERIAL_ERROR_START_P(port);
serialprintPGM_P(port, err);
SERIAL_ERRORLN_P(port, gcode_LastN);
SERIAL_ECHOLN_P(port, gcode_LastN);
flush_and_request_resend();
serial_count[port] = 0;
}
@ -648,7 +648,7 @@ inline void get_serial_commands() {
#if ENABLED(BEZIER_CURVE_SUPPORT)
case 5:
#endif
SERIAL_ERRORLNPGM(MSG_ERR_STOPPED);
SERIAL_ECHOLNPGM(MSG_ERR_STOPPED);
LCD_MESSAGEPGM(MSG_STOPPED);
break;
}
@ -754,7 +754,7 @@ inline void get_serial_commands() {
if (IS_SD_PRINTING())
sd_count = 0; // If a sub-file was printing, continue from call point
else {
SERIAL_PROTOCOLLNPGM(MSG_FILE_PRINTED);
SERIAL_ECHOLNPGM(MSG_FILE_PRINTED);
#if ENABLED(PRINTER_EVENT_LEDS)
printerEventLEDs.onPrintCompleted();
#if HAS_RESUME_CONTINUE
@ -769,10 +769,9 @@ inline void get_serial_commands() {
#endif // PRINTER_EVENT_LEDS
}
}
else if (n == -1) {
SERIAL_ERROR_START();
SERIAL_ECHOLNPGM(MSG_SD_ERR_READ);
}
else if (n == -1)
SERIAL_ERROR_MSG(MSG_SD_ERR_READ);
if (sd_char == '#') stop_buffering = true;
sd_comment_mode = false; // for new command
@ -843,7 +842,7 @@ void advance_command_queue() {
if (strstr_P(command, PSTR("M29"))) {
// M29 closes the file
card.closefile();
SERIAL_PROTOCOLLNPGM(MSG_FILE_SAVED);
SERIAL_ECHOLNPGM(MSG_FILE_SAVED);
#if !defined(__AVR__) || !defined(USBCON)
#if ENABLED(SERIAL_STATS_DROPPED_RX)

View file

@ -50,13 +50,13 @@ void GcodeSuite::M20() {
const int16_t port = command_queue_port[cmd_queue_index_r];
#endif
SERIAL_PROTOCOLLNPGM_P(port, MSG_BEGIN_FILE_LIST);
SERIAL_ECHOLNPGM_P(port, MSG_BEGIN_FILE_LIST);
card.ls(
#if NUM_SERIAL > 1
port
#endif
);
SERIAL_PROTOCOLLNPGM_P(port, MSG_END_FILE_LIST);
SERIAL_ECHOLNPGM_P(port, MSG_END_FILE_LIST);
}
/**

View file

@ -40,15 +40,14 @@ void GcodeSuite::M105() {
#endif
#if HAS_TEMP_SENSOR
SERIAL_PROTOCOLPGM_P(port, MSG_OK);
SERIAL_ECHOPGM_P(port, MSG_OK);
thermalManager.print_heater_states(target_extruder
#if NUM_SERIAL > 1
, port
#endif
);
#else // !HAS_TEMP_SENSOR
SERIAL_ERROR_START_P(port);
SERIAL_ERRORLNPGM_P(port, MSG_ERR_NO_THERMISTORS);
SERIAL_ERROR_MSG_P(port, MSG_ERR_NO_THERMISTORS);
#endif
SERIAL_EOL_P(port);

View file

@ -296,7 +296,7 @@ void _menu_ubl_fillin() {
void _lcd_ubl_invalidate() {
ubl.invalidate();
SERIAL_PROTOCOLLNPGM("Mesh invalidated.");
SERIAL_ECHOLNPGM("Mesh invalidated.");
}
/**

View file

@ -84,13 +84,9 @@ void vector_3::apply_rotation(const matrix_3x3 &matrix) {
void vector_3::debug(PGM_P const title) {
serialprintPGM(title);
SERIAL_PROTOCOLPGM(" x: ");
SERIAL_PROTOCOL_F(x, 6);
SERIAL_PROTOCOLPGM(" y: ");
SERIAL_PROTOCOL_F(y, 6);
SERIAL_PROTOCOLPGM(" z: ");
SERIAL_PROTOCOL_F(z, 6);
SERIAL_EOL();
SERIAL_ECHOPAIR_F(" x: ", x, 6);
SERIAL_ECHOPAIR_F(" y: ", y, 6);
SERIAL_ECHOLNPAIR_F(" z: ", z, 6);
}
void apply_rotation_xyz(const matrix_3x3 &matrix, float &x, float &y, float &z) {
@ -151,9 +147,9 @@ void matrix_3x3::debug(PGM_P const title) {
uint8_t count = 0;
for (uint8_t i = 0; i < 3; i++) {
for (uint8_t j = 0; j < 3; j++) {
if (matrix[count] >= 0.0) SERIAL_PROTOCOLCHAR('+');
SERIAL_PROTOCOL_F(matrix[count], 6);
SERIAL_PROTOCOLCHAR(' ');
if (matrix[count] >= 0.0) SERIAL_CHAR('+');
SERIAL_ECHO_F(matrix[count], 6);
SERIAL_CHAR(' ');
count++;
}
SERIAL_EOL();

View file

@ -384,6 +384,36 @@ void MarlinSettings::postprocess() {
#endif // SD_FIRMWARE_UPDATE
#if ENABLED(EEPROM_CHITCHAT)
#define CHITCHAT_ECHO(V) SERIAL_ECHO(V)
#define CHITCHAT_ECHOLNPGM(STR) SERIAL_ECHOLNPGM(STR)
#define CHITCHAT_ECHOPAIR(STR,V) SERIAL_ECHOPAIR(STR,V)
#define CHITCHAT_ECHOLNPAIR(STR,V) SERIAL_ECHOLNPAIR(STR,V)
#define CHITCHAT_ECHO_START_P(port) SERIAL_ECHO_START_P(port)
#define CHITCHAT_ERROR_START_P(port) SERIAL_ERROR_START_P(port)
#define CHITCHAT_ERROR_MSG_P(port, STR) SERIAL_ERROR_MSG_P(port, STR)
#define CHITCHAT_ECHO_P(port, VAL) SERIAL_ECHO_P(port, VAL)
#define CHITCHAT_ECHOPGM_P(port, STR) SERIAL_ECHOPGM_P(port, STR)
#define CHITCHAT_ECHOLNPGM_P(port, STR) SERIAL_ECHOLNPGM_P(port, STR)
#define CHITCHAT_ECHOPAIR_P(port, STR, VAL) SERIAL_ECHOPAIR_P(port, STR, VAL)
#define CHITCHAT_ECHOLNPAIR_P(port, STR, VAL) SERIAL_ECHOLNPAIR_P(port, STR, VAL)
#define CHITCHAT_EOL() SERIAL_EOL()
#else
#define CHITCHAT_ECHO(V) NOOP
#define CHITCHAT_ECHOLNPGM(STR) NOOP
#define CHITCHAT_ECHOPAIR(STR,V) NOOP
#define CHITCHAT_ECHOLNPAIR(STR,V) NOOP
#define CHITCHAT_ECHO_START_P(port) NOOP
#define CHITCHAT_ERROR_START_P(port) NOOP
#define CHITCHAT_ERROR_MSG_P(port, STR) NOOP
#define CHITCHAT_ECHO_P(port, VAL) NOOP
#define CHITCHAT_ECHOPGM_P(port, STR) NOOP
#define CHITCHAT_ECHOLNPGM_P(port, STR) NOOP
#define CHITCHAT_ECHOPAIR_P(port, STR, VAL) NOOP
#define CHITCHAT_ECHOLNPAIR_P(port, STR, VAL) NOOP
#define CHITCHAT_EOL() NOOP
#endif
#if ENABLED(EEPROM_SETTINGS)
#define EEPROM_START() int eeprom_index = EEPROM_OFFSET; persistentStore.access_start()
@ -392,7 +422,7 @@ void MarlinSettings::postprocess() {
#define EEPROM_WRITE(VAR) persistentStore.write_data(eeprom_index, (uint8_t*)&VAR, sizeof(VAR), &working_crc)
#define EEPROM_READ(VAR) persistentStore.read_data(eeprom_index, (uint8_t*)&VAR, sizeof(VAR), &working_crc, !validating)
#define EEPROM_READ_ALWAYS(VAR) persistentStore.read_data(eeprom_index, (uint8_t*)&VAR, sizeof(VAR), &working_crc)
#define EEPROM_ASSERT(TST,ERR) do{ if (!(TST)) { SERIAL_ERROR_START_P(port); SERIAL_ERRORLNPGM_P(port, ERR); eeprom_error = true; } }while(0)
#define EEPROM_ASSERT(TST,ERR) do{ if (!(TST)) { SERIAL_ERROR_MSG_P(port, ERR); eeprom_error = true; } }while(0)
#if ENABLED(DEBUG_EEPROM_READWRITE)
#define _FIELD_TEST(FIELD) \
@ -410,10 +440,7 @@ void MarlinSettings::postprocess() {
bool MarlinSettings::size_error(const uint16_t size PORTARG_AFTER) {
if (size != datasize()) {
#if ENABLED(EEPROM_CHITCHAT)
SERIAL_ERROR_START_P(port);
SERIAL_ERRORLNPGM_P(port, "EEPROM datasize error.");
#endif
CHITCHAT_ERROR_MSG_P(port, "EEPROM datasize error.");
return true;
}
return false;
@ -1050,12 +1077,10 @@ void MarlinSettings::postprocess() {
EEPROM_WRITE(final_crc);
// Report storage size
#if ENABLED(EEPROM_CHITCHAT)
SERIAL_ECHO_START_P(port);
SERIAL_ECHOPAIR_P(port, "Settings Stored (", eeprom_size);
SERIAL_ECHOPAIR_P(port, " bytes; crc ", (uint32_t)final_crc);
SERIAL_ECHOLNPGM_P(port, ")");
#endif
CHITCHAT_ECHO_START_P(port);
CHITCHAT_ECHOPAIR_P(port, "Settings Stored (", eeprom_size);
CHITCHAT_ECHOPAIR_P(port, " bytes; crc ", (uint32_t)final_crc);
CHITCHAT_ECHOLNPGM_P(port, ")");
eeprom_error |= size_error(eeprom_size);
}
@ -1092,12 +1117,10 @@ void MarlinSettings::postprocess() {
stored_ver[0] = '?';
stored_ver[1] = '\0';
}
#if ENABLED(EEPROM_CHITCHAT)
SERIAL_ECHO_START_P(port);
SERIAL_ECHOPGM_P(port, "EEPROM version mismatch ");
SERIAL_ECHOPAIR_P(port, "(EEPROM=", stored_ver);
SERIAL_ECHOLNPGM_P(port, " Marlin=" EEPROM_VERSION ")");
#endif
CHITCHAT_ECHO_START_P(port);
CHITCHAT_ECHOPGM_P(port, "EEPROM version mismatch ");
CHITCHAT_ECHOPAIR_P(port, "(EEPROM=", stored_ver);
CHITCHAT_ECHOLNPGM_P(port, " Marlin=" EEPROM_VERSION ")");
eeprom_error = true;
}
else {
@ -1704,31 +1727,25 @@ void MarlinSettings::postprocess() {
eeprom_error = size_error(eeprom_index - (EEPROM_OFFSET));
if (eeprom_error) {
#if ENABLED(EEPROM_CHITCHAT)
SERIAL_ECHO_START_P(port);
SERIAL_ECHOPAIR_P(port, "Index: ", int(eeprom_index - (EEPROM_OFFSET)));
SERIAL_ECHOLNPAIR_P(port, " Size: ", datasize());
#endif
CHITCHAT_ECHO_START_P(port);
CHITCHAT_ECHOPAIR_P(port, "Index: ", int(eeprom_index - (EEPROM_OFFSET)));
CHITCHAT_ECHOLNPAIR_P(port, " Size: ", datasize());
}
else if (working_crc != stored_crc) {
eeprom_error = true;
#if ENABLED(EEPROM_CHITCHAT)
SERIAL_ERROR_START_P(port);
SERIAL_ERRORPGM_P(port, "EEPROM CRC mismatch - (stored) ");
SERIAL_ERROR_P(port, stored_crc);
SERIAL_ERRORPGM_P(port, " != ");
SERIAL_ERROR_P(port, working_crc);
SERIAL_ERRORLNPGM_P(port, " (calculated)!");
#endif
CHITCHAT_ERROR_START_P(port);
CHITCHAT_ECHOPGM_P(port, "EEPROM CRC mismatch - (stored) ");
CHITCHAT_ECHO_P(port, stored_crc);
CHITCHAT_ECHOPGM_P(port, " != ");
CHITCHAT_ECHO_P(port, working_crc);
CHITCHAT_ECHOLNPGM_P(port, " (calculated)!");
}
else if (!validating) {
#if ENABLED(EEPROM_CHITCHAT)
SERIAL_ECHO_START_P(port);
SERIAL_ECHO_P(port, version);
SERIAL_ECHOPAIR_P(port, " stored settings retrieved (", eeprom_index - (EEPROM_OFFSET));
SERIAL_ECHOPAIR_P(port, " bytes; crc ", (uint32_t)working_crc);
SERIAL_ECHOLNPGM_P(port, ")");
#endif
CHITCHAT_ECHO_START_P(port);
CHITCHAT_ECHO_P(port, version);
CHITCHAT_ECHOPAIR_P(port, " stored settings retrieved (", eeprom_index - (EEPROM_OFFSET));
CHITCHAT_ECHOPAIR_P(port, " bytes; crc ", (uint32_t)working_crc);
CHITCHAT_ECHOLNPGM_P(port, ")");
}
if (!validating && !eeprom_error) postprocess();
@ -1741,31 +1758,27 @@ void MarlinSettings::postprocess() {
SERIAL_EOL_P(port);
#if ENABLED(EEPROM_CHITCHAT)
ubl.echo_name();
SERIAL_ECHOLNPGM_P(port, " initialized.\n");
CHITCHAT_ECHOLNPGM_P(port, " initialized.\n");
#endif
}
else {
eeprom_error = true;
#if ENABLED(EEPROM_CHITCHAT)
SERIAL_PROTOCOLPGM_P(port, "?Can't enable ");
CHITCHAT_ECHOPGM_P(port, "?Can't enable ");
ubl.echo_name();
SERIAL_PROTOCOLLNPGM_P(port, ".");
CHITCHAT_ECHOLNPGM_P(port, ".");
#endif
ubl.reset();
}
if (ubl.storage_slot >= 0) {
load_mesh(ubl.storage_slot);
#if ENABLED(EEPROM_CHITCHAT)
SERIAL_ECHOPAIR_P(port, "Mesh ", ubl.storage_slot);
SERIAL_ECHOLNPGM_P(port, " loaded from storage.");
#endif
CHITCHAT_ECHOPAIR_P(port, "Mesh ", ubl.storage_slot);
CHITCHAT_ECHOLNPGM_P(port, " loaded from storage.");
}
else {
ubl.reset();
#if ENABLED(EEPROM_CHITCHAT)
SERIAL_ECHOLNPGM_P(port, "UBL System reset()");
#endif
CHITCHAT_ECHOLNPGM_P(port, "UBL System reset()");
}
}
#endif
@ -1794,13 +1807,15 @@ void MarlinSettings::postprocess() {
#if ENABLED(AUTO_BED_LEVELING_UBL)
#if ENABLED(EEPROM_CHITCHAT)
void ubl_invalid_slot(const int s) {
SERIAL_PROTOCOLLNPGM("?Invalid slot.");
SERIAL_PROTOCOL(s);
SERIAL_PROTOCOLLNPGM(" mesh slots available.");
}
#endif
inline void ubl_invalid_slot(const int s) {
#if ENABLED(EEPROM_CHITCHAT)
CHITCHAT_ECHOLNPGM("?Invalid slot.");
CHITCHAT_ECHO(s);
CHITCHAT_ECHOLNPGM(" mesh slots available.");
#else
UNUSED(s);
#endif
}
const uint16_t MarlinSettings::meshes_end = persistentStore.capacity() - 129; // 128 (+1 because of the change to capacity rather than last valid address)
// is a placeholder for the size of the MAT; the MAT will always
@ -1824,32 +1839,24 @@ void MarlinSettings::postprocess() {
#if ENABLED(AUTO_BED_LEVELING_UBL)
const int16_t a = calc_num_meshes();
if (!WITHIN(slot, 0, a - 1)) {
#if ENABLED(EEPROM_CHITCHAT)
ubl_invalid_slot(a);
SERIAL_PROTOCOLPAIR("E2END=", persistentStore.capacity() - 1);
SERIAL_PROTOCOLPAIR(" meshes_end=", meshes_end);
SERIAL_PROTOCOLLNPAIR(" slot=", slot);
SERIAL_EOL();
#endif
ubl_invalid_slot(a);
CHITCHAT_ECHOPAIR("E2END=", persistentStore.capacity() - 1);
CHITCHAT_ECHOPAIR(" meshes_end=", meshes_end);
CHITCHAT_ECHOLNPAIR(" slot=", slot);
CHITCHAT_EOL();
return;
}
int pos = mesh_slot_offset(slot);
uint16_t crc = 0;
// Write crc to MAT along with other data, or just tack on to the beginning or end
persistentStore.access_start();
const bool status = persistentStore.write_data(pos, (uint8_t *)&ubl.z_values, sizeof(ubl.z_values), &crc);
persistentStore.access_finish();
if (status)
SERIAL_PROTOCOLPGM("?Unable to save mesh data.\n");
// Write crc to MAT along with other data, or just tack on to the beginning or end
#if ENABLED(EEPROM_CHITCHAT)
if (!status)
SERIAL_PROTOCOLLNPAIR("Mesh saved in slot ", slot);
#endif
if (status) SERIAL_ECHOPGM("?Unable to save mesh data.\n");
else CHITCHAT_ECHOLNPAIR("Mesh saved in slot ", slot);
#else
@ -1865,9 +1872,7 @@ void MarlinSettings::postprocess() {
const int16_t a = settings.calc_num_meshes();
if (!WITHIN(slot, 0, a - 1)) {
#if ENABLED(EEPROM_CHITCHAT)
ubl_invalid_slot(a);
#endif
ubl_invalid_slot(a);
return;
}
@ -1879,13 +1884,9 @@ void MarlinSettings::postprocess() {
const uint16_t status = persistentStore.read_data(pos, dest, sizeof(ubl.z_values), &crc);
persistentStore.access_finish();
if (status)
SERIAL_PROTOCOLPGM("?Unable to load mesh data.\n");
if (status) SERIAL_ECHOPGM("?Unable to load mesh data.\n");
else CHITCHAT_ECHOLNPAIR("Mesh loaded from slot ", slot);
#if ENABLED(EEPROM_CHITCHAT)
else
SERIAL_PROTOCOLLNPAIR("Mesh loaded from slot ", slot);
#endif
EEPROM_FINISH();
#else
@ -1903,10 +1904,7 @@ void MarlinSettings::postprocess() {
#else // !EEPROM_SETTINGS
bool MarlinSettings::save(PORTARG_SOLO) {
#if ENABLED(EEPROM_CHITCHAT)
SERIAL_ERROR_START_P(port);
SERIAL_ERRORLNPGM_P(port, "EEPROM disabled");
#endif
CHITCHAT_ERROR_MSG_P(port, "EEPROM disabled");
return false;
}
@ -2177,15 +2175,15 @@ void MarlinSettings::reset(PORTARG_SOLO) {
postprocess();
#if ENABLED(EEPROM_CHITCHAT)
SERIAL_ECHO_START_P(port);
SERIAL_ECHOLNPGM_P(port, "Hardcoded Default Settings Loaded");
#endif
CHITCHAT_ECHO_START_P(port);
CHITCHAT_ECHOLNPGM_P(port, "Hardcoded Default Settings Loaded");
}
#if DISABLED(DISABLE_M503)
#define CONFIG_ECHO_START do{ if (!forReplay) SERIAL_ECHO_START_P(port); }while(0)
#define CONFIG_ECHO_START() do{ if (!forReplay) SERIAL_ECHO_START_P(port); }while(0)
#define CONFIG_ECHO_MSG(STR) do{ CONFIG_ECHO_START(); SERIAL_ECHOLNPGM_P(port, STR); }while(0)
#define CONFIG_ECHO_HEADING(STR) do{ if (!forReplay) { CONFIG_ECHO_START(); SERIAL_ECHOLNPGM_P(port, STR); } }while(0)
#if HAS_TRINAMIC
void say_M906(PORTARG_SOLO) { SERIAL_ECHOPGM_P(port, " M906"); }
@ -2234,7 +2232,7 @@ void MarlinSettings::reset(PORTARG_SOLO) {
/**
* Announce current units, in case inches are being displayed
*/
CONFIG_ECHO_START;
CONFIG_ECHO_START();
#if ENABLED(INCH_MODE_SUPPORT)
SERIAL_ECHOPGM_P(port, " G2");
SERIAL_CHAR_P(port, parser.linear_unit_factor == 1.0 ? '1' : '0');
@ -2250,7 +2248,7 @@ void MarlinSettings::reset(PORTARG_SOLO) {
// Temperature units - for Ultipanel temperature options
CONFIG_ECHO_START;
CONFIG_ECHO_START();
#if ENABLED(TEMPERATURE_UNITS_SUPPORT)
SERIAL_ECHOPGM_P(port, " M149 ");
SERIAL_CHAR_P(port, parser.temp_units_code());
@ -2270,7 +2268,7 @@ void MarlinSettings::reset(PORTARG_SOLO) {
* Volumetric extrusion M200
*/
if (!forReplay) {
CONFIG_ECHO_START;
CONFIG_ECHO_START();
SERIAL_ECHOPGM_P(port, "Filament settings:");
if (parser.volumetric_enabled)
SERIAL_EOL_P(port);
@ -2278,27 +2276,27 @@ void MarlinSettings::reset(PORTARG_SOLO) {
SERIAL_ECHOLNPGM_P(port, " Disabled");
}
CONFIG_ECHO_START;
CONFIG_ECHO_START();
SERIAL_ECHOPAIR_P(port, " M200 D", LINEAR_UNIT(planner.filament_size[0]));
SERIAL_EOL_P(port);
#if EXTRUDERS > 1
CONFIG_ECHO_START;
CONFIG_ECHO_START();
SERIAL_ECHOPAIR_P(port, " M200 T1 D", LINEAR_UNIT(planner.filament_size[1]));
SERIAL_EOL_P(port);
#if EXTRUDERS > 2
CONFIG_ECHO_START;
CONFIG_ECHO_START();
SERIAL_ECHOPAIR_P(port, " M200 T2 D", LINEAR_UNIT(planner.filament_size[2]));
SERIAL_EOL_P(port);
#if EXTRUDERS > 3
CONFIG_ECHO_START;
CONFIG_ECHO_START();
SERIAL_ECHOPAIR_P(port, " M200 T3 D", LINEAR_UNIT(planner.filament_size[3]));
SERIAL_EOL_P(port);
#if EXTRUDERS > 4
CONFIG_ECHO_START;
CONFIG_ECHO_START();
SERIAL_ECHOPAIR_P(port, " M200 T4 D", LINEAR_UNIT(planner.filament_size[4]));
SERIAL_EOL_P(port);
#if EXTRUDERS > 5
CONFIG_ECHO_START;
CONFIG_ECHO_START();
SERIAL_ECHOPAIR_P(port, " M200 T5 D", LINEAR_UNIT(planner.filament_size[5]));
SERIAL_EOL_P(port);
#endif // EXTRUDERS > 5
@ -2307,18 +2305,13 @@ void MarlinSettings::reset(PORTARG_SOLO) {
#endif // EXTRUDERS > 2
#endif // EXTRUDERS > 1
if (!parser.volumetric_enabled) {
CONFIG_ECHO_START;
SERIAL_ECHOLNPGM_P(port, " M200 D0");
}
if (!parser.volumetric_enabled)
CONFIG_ECHO_MSG(" M200 D0");
#endif // !NO_VOLUMETRICS
if (!forReplay) {
CONFIG_ECHO_START;
SERIAL_ECHOLNPGM_P(port, "Steps per unit:");
}
CONFIG_ECHO_START;
CONFIG_ECHO_HEADING("Steps per unit:");
CONFIG_ECHO_START();
SERIAL_ECHOPAIR_P(port, " M92 X", LINEAR_UNIT(planner.settings.axis_steps_per_mm[X_AXIS]));
SERIAL_ECHOPAIR_P(port, " Y", LINEAR_UNIT(planner.settings.axis_steps_per_mm[Y_AXIS]));
SERIAL_ECHOPAIR_P(port, " Z", LINEAR_UNIT(planner.settings.axis_steps_per_mm[Z_AXIS]));
@ -2327,18 +2320,15 @@ void MarlinSettings::reset(PORTARG_SOLO) {
#endif
SERIAL_EOL_P(port);
#if ENABLED(DISTINCT_E_FACTORS)
CONFIG_ECHO_START;
CONFIG_ECHO_START();
for (uint8_t i = 0; i < E_STEPPERS; i++) {
SERIAL_ECHOPAIR_P(port, " M92 T", (int)i);
SERIAL_ECHOLNPAIR_P(port, " E", VOLUMETRIC_UNIT(planner.settings.axis_steps_per_mm[E_AXIS + i]));
}
#endif
if (!forReplay) {
CONFIG_ECHO_START;
SERIAL_ECHOLNPGM_P(port, "Maximum feedrates (units/s):");
}
CONFIG_ECHO_START;
CONFIG_ECHO_HEADING("Maximum feedrates (units/s):");
CONFIG_ECHO_START();
SERIAL_ECHOPAIR_P(port, " M203 X", LINEAR_UNIT(planner.settings.max_feedrate_mm_s[X_AXIS]));
SERIAL_ECHOPAIR_P(port, " Y", LINEAR_UNIT(planner.settings.max_feedrate_mm_s[Y_AXIS]));
SERIAL_ECHOPAIR_P(port, " Z", LINEAR_UNIT(planner.settings.max_feedrate_mm_s[Z_AXIS]));
@ -2347,18 +2337,15 @@ void MarlinSettings::reset(PORTARG_SOLO) {
#endif
SERIAL_EOL_P(port);
#if ENABLED(DISTINCT_E_FACTORS)
CONFIG_ECHO_START;
CONFIG_ECHO_START();
for (uint8_t i = 0; i < E_STEPPERS; i++) {
SERIAL_ECHOPAIR_P(port, " M203 T", (int)i);
SERIAL_ECHOLNPAIR_P(port, " E", VOLUMETRIC_UNIT(planner.settings.max_feedrate_mm_s[E_AXIS + i]));
}
#endif
if (!forReplay) {
CONFIG_ECHO_START;
SERIAL_ECHOLNPGM_P(port, "Maximum Acceleration (units/s2):");
}
CONFIG_ECHO_START;
CONFIG_ECHO_HEADING("Maximum Acceleration (units/s2):");
CONFIG_ECHO_START();
SERIAL_ECHOPAIR_P(port, " M201 X", LINEAR_UNIT(planner.settings.max_acceleration_mm_per_s2[X_AXIS]));
SERIAL_ECHOPAIR_P(port, " Y", LINEAR_UNIT(planner.settings.max_acceleration_mm_per_s2[Y_AXIS]));
SERIAL_ECHOPAIR_P(port, " Z", LINEAR_UNIT(planner.settings.max_acceleration_mm_per_s2[Z_AXIS]));
@ -2367,24 +2354,21 @@ void MarlinSettings::reset(PORTARG_SOLO) {
#endif
SERIAL_EOL_P(port);
#if ENABLED(DISTINCT_E_FACTORS)
CONFIG_ECHO_START;
CONFIG_ECHO_START();
for (uint8_t i = 0; i < E_STEPPERS; i++) {
SERIAL_ECHOPAIR_P(port, " M201 T", (int)i);
SERIAL_ECHOLNPAIR_P(port, " E", VOLUMETRIC_UNIT(planner.settings.max_acceleration_mm_per_s2[E_AXIS + i]));
}
#endif
if (!forReplay) {
CONFIG_ECHO_START;
SERIAL_ECHOLNPGM_P(port, "Acceleration (units/s2): P<print_accel> R<retract_accel> T<travel_accel>");
}
CONFIG_ECHO_START;
CONFIG_ECHO_HEADING("Acceleration (units/s2): P<print_accel> R<retract_accel> T<travel_accel>");
CONFIG_ECHO_START();
SERIAL_ECHOPAIR_P(port, " M204 P", LINEAR_UNIT(planner.settings.acceleration));
SERIAL_ECHOPAIR_P(port, " R", LINEAR_UNIT(planner.settings.retract_acceleration));
SERIAL_ECHOLNPAIR_P(port, " T", LINEAR_UNIT(planner.settings.travel_acceleration));
if (!forReplay) {
CONFIG_ECHO_START;
CONFIG_ECHO_START();
SERIAL_ECHOPGM_P(port, "Advanced: B<min_segment_time_us> S<min_feedrate> T<min_travel_feedrate>");
#if ENABLED(JUNCTION_DEVIATION)
SERIAL_ECHOPGM_P(port, " J<junc_dev>");
@ -2397,7 +2381,7 @@ void MarlinSettings::reset(PORTARG_SOLO) {
#endif
SERIAL_EOL_P(port);
}
CONFIG_ECHO_START;
CONFIG_ECHO_START();
SERIAL_ECHOPAIR_P(port, " M205 B", LINEAR_UNIT(planner.settings.min_segment_time_us));
SERIAL_ECHOPAIR_P(port, " S", LINEAR_UNIT(planner.settings.min_feedrate_mm_s));
SERIAL_ECHOPAIR_P(port, " T", LINEAR_UNIT(planner.settings.min_travel_feedrate_mm_s));
@ -2417,29 +2401,21 @@ void MarlinSettings::reset(PORTARG_SOLO) {
SERIAL_EOL_P(port);
#if HAS_M206_COMMAND
if (!forReplay) {
CONFIG_ECHO_START;
SERIAL_ECHOLNPGM_P(port, "Home offset:");
}
CONFIG_ECHO_START;
CONFIG_ECHO_HEADING("Home offset:");
CONFIG_ECHO_START();
SERIAL_ECHOPAIR_P(port, " M206 X", LINEAR_UNIT(home_offset[X_AXIS]));
SERIAL_ECHOPAIR_P(port, " Y", LINEAR_UNIT(home_offset[Y_AXIS]));
SERIAL_ECHOLNPAIR_P(port, " Z", LINEAR_UNIT(home_offset[Z_AXIS]));
#endif
#if HAS_HOTEND_OFFSET
if (!forReplay) {
CONFIG_ECHO_START;
SERIAL_ECHOLNPGM_P(port, "Hotend offsets:");
}
CONFIG_ECHO_START;
CONFIG_ECHO_HEADING("Hotend offsets:");
CONFIG_ECHO_START();
for (uint8_t e = 1; e < HOTENDS; e++) {
SERIAL_ECHOPAIR_P(port, " M218 T", (int)e);
SERIAL_ECHOPAIR_P(port, " X", LINEAR_UNIT(hotend_offset[X_AXIS][e]));
SERIAL_ECHOPAIR_P(port, " Y", LINEAR_UNIT(hotend_offset[Y_AXIS][e]));
SERIAL_ECHO_P(port, " Z");
SERIAL_ECHO_F_P(port, LINEAR_UNIT(hotend_offset[Z_AXIS][e]), 3);
SERIAL_EOL_P(port);
SERIAL_ECHOLNPAIR_F_P(port, " Z", LINEAR_UNIT(hotend_offset[Z_AXIS][e]), 3);
}
#endif
@ -2450,29 +2426,23 @@ void MarlinSettings::reset(PORTARG_SOLO) {
#if ENABLED(MESH_BED_LEVELING)
if (!forReplay) {
CONFIG_ECHO_START;
SERIAL_ECHOLNPGM_P(port, "Mesh Bed Leveling:");
}
CONFIG_ECHO_HEADING("Mesh Bed Leveling:");
#elif ENABLED(AUTO_BED_LEVELING_UBL)
if (!forReplay) {
CONFIG_ECHO_START;
CONFIG_ECHO_START();
ubl.echo_name();
SERIAL_ECHOLNPGM_P(port, ":");
}
#elif HAS_ABL
if (!forReplay) {
CONFIG_ECHO_START;
SERIAL_ECHOLNPGM_P(port, "Auto Bed Leveling:");
}
CONFIG_ECHO_HEADING("Auto Bed Leveling:");
#endif
CONFIG_ECHO_START;
CONFIG_ECHO_START();
SERIAL_ECHOPAIR_P(port, " M420 S", planner.leveling_active ? 1 : 0);
#if ENABLED(ENABLE_LEVELING_FADE_HEIGHT)
SERIAL_ECHOPAIR_P(port, " Z", LINEAR_UNIT(planner.z_fade_height));
@ -2484,12 +2454,10 @@ void MarlinSettings::reset(PORTARG_SOLO) {
if (leveling_is_valid()) {
for (uint8_t py = 0; py < GRID_MAX_POINTS_Y; py++) {
for (uint8_t px = 0; px < GRID_MAX_POINTS_X; px++) {
CONFIG_ECHO_START;
CONFIG_ECHO_START();
SERIAL_ECHOPAIR_P(port, " G29 S3 X", (int)px + 1);
SERIAL_ECHOPAIR_P(port, " Y", (int)py + 1);
SERIAL_ECHOPGM_P(port, " Z");
SERIAL_ECHO_F_P(port, LINEAR_UNIT(mbl.z_values[px][py]), 5);
SERIAL_EOL_P(port);
SERIAL_ECHOLNPAIR_F_P(port, " Z", LINEAR_UNIT(mbl.z_values[px][py]), 5);
}
}
}
@ -2504,19 +2472,17 @@ void MarlinSettings::reset(PORTARG_SOLO) {
SERIAL_ECHOLNPGM_P(port, " meshes.\n");
}
// ubl.report_current_mesh(PORTVAR_SOLO); // This is too verbose for large mesh's. A better (more terse)
// solution needs to be found.
//ubl.report_current_mesh(PORTVAR_SOLO); // This is too verbose for large meshes. A better (more terse)
// solution needs to be found.
#elif ENABLED(AUTO_BED_LEVELING_BILINEAR)
if (leveling_is_valid()) {
for (uint8_t py = 0; py < GRID_MAX_POINTS_Y; py++) {
for (uint8_t px = 0; px < GRID_MAX_POINTS_X; px++) {
CONFIG_ECHO_START;
CONFIG_ECHO_START();
SERIAL_ECHOPAIR_P(port, " G29 W I", (int)px);
SERIAL_ECHOPAIR_P(port, " J", (int)py);
SERIAL_ECHOPGM_P(port, " Z");
SERIAL_ECHO_F_P(port, LINEAR_UNIT(z_values[px][py]), 5);
SERIAL_EOL_P(port);
SERIAL_ECHOLNPAIR_F_P(port, " Z", LINEAR_UNIT(z_values[px][py]), 5);
}
}
}
@ -2527,10 +2493,7 @@ void MarlinSettings::reset(PORTARG_SOLO) {
#if HAS_SERVOS && ENABLED(EDITABLE_SERVO_ANGLES)
if (!forReplay) {
CONFIG_ECHO_START;
SERIAL_ECHOLNPGM_P(port, "Servo Angles:");
}
CONFIG_ECHO_HEADING("Servo Angles:");
for (uint8_t i = 0; i < NUM_SERVOS; i++) {
switch (i) {
#if ENABLED(SWITCHING_EXTRUDER)
@ -2543,7 +2506,7 @@ void MarlinSettings::reset(PORTARG_SOLO) {
#elif defined(Z_SERVO_ANGLES) && defined(Z_PROBE_SERVO_NR)
case Z_PROBE_SERVO_NR:
#endif
CONFIG_ECHO_START;
CONFIG_ECHO_START();
SERIAL_ECHOPAIR_P(port, " M281 P", int(i));
SERIAL_ECHOPAIR_P(port, " L", servo_angles[i][0]);
SERIAL_ECHOPAIR_P(port, " U", servo_angles[i][1]);
@ -2556,11 +2519,8 @@ void MarlinSettings::reset(PORTARG_SOLO) {
#if HAS_SCARA_OFFSET
if (!forReplay) {
CONFIG_ECHO_START;
SERIAL_ECHOLNPGM_P(port, "SCARA settings: S<seg-per-sec> P<theta-psi-offset> T<theta-offset>");
}
CONFIG_ECHO_START;
CONFIG_ECHO_HEADING("SCARA settings: S<seg-per-sec> P<theta-psi-offset> T<theta-offset>");
CONFIG_ECHO_START();
SERIAL_ECHOPAIR_P(port, " M665 S", delta_segments_per_second);
SERIAL_ECHOPAIR_P(port, " P", scara_home_offset[A_AXIS]);
SERIAL_ECHOPAIR_P(port, " T", scara_home_offset[B_AXIS]);
@ -2569,19 +2529,14 @@ void MarlinSettings::reset(PORTARG_SOLO) {
#elif ENABLED(DELTA)
if (!forReplay) {
CONFIG_ECHO_START;
SERIAL_ECHOLNPGM_P(port, "Endstop adjustment:");
}
CONFIG_ECHO_START;
CONFIG_ECHO_HEADING("Endstop adjustment:");
CONFIG_ECHO_START();
SERIAL_ECHOPAIR_P(port, " M666 X", LINEAR_UNIT(delta_endstop_adj[X_AXIS]));
SERIAL_ECHOPAIR_P(port, " Y", LINEAR_UNIT(delta_endstop_adj[Y_AXIS]));
SERIAL_ECHOLNPAIR_P(port, " Z", LINEAR_UNIT(delta_endstop_adj[Z_AXIS]));
if (!forReplay) {
CONFIG_ECHO_START;
SERIAL_ECHOLNPGM_P(port, "Delta settings: L<diagonal_rod> R<radius> H<height> S<segments_per_s> B<calibration radius> XYZ<tower angle corrections>");
}
CONFIG_ECHO_START;
CONFIG_ECHO_HEADING("Delta settings: L<diagonal_rod> R<radius> H<height> S<segments_per_s> B<calibration radius> XYZ<tower angle corrections>");
CONFIG_ECHO_START();
SERIAL_ECHOPAIR_P(port, " M665 L", LINEAR_UNIT(delta_diagonal_rod));
SERIAL_ECHOPAIR_P(port, " R", LINEAR_UNIT(delta_radius));
SERIAL_ECHOPAIR_P(port, " H", LINEAR_UNIT(delta_height));
@ -2594,11 +2549,8 @@ void MarlinSettings::reset(PORTARG_SOLO) {
#elif ENABLED(X_DUAL_ENDSTOPS) || ENABLED(Y_DUAL_ENDSTOPS) || ENABLED(Z_DUAL_ENDSTOPS)
if (!forReplay) {
CONFIG_ECHO_START;
SERIAL_ECHOLNPGM_P(port, "Endstop adjustment:");
}
CONFIG_ECHO_START;
CONFIG_ECHO_HEADING("Endstop adjustment:");
CONFIG_ECHO_START();
SERIAL_ECHOPGM_P(port, " M666");
#if ENABLED(X_DUAL_ENDSTOPS)
SERIAL_ECHOPAIR_P(port, " X", LINEAR_UNIT(endstops.x2_endstop_adj));
@ -2608,7 +2560,7 @@ void MarlinSettings::reset(PORTARG_SOLO) {
#endif
#if ENABLED(Z_TRIPLE_ENDSTOPS)
SERIAL_ECHOLNPAIR_P(port, "S1 Z", LINEAR_UNIT(endstops.z2_endstop_adj));
CONFIG_ECHO_START;
CONFIG_ECHO_START();
SERIAL_ECHOPAIR_P(port, " M666 S2 Z", LINEAR_UNIT(endstops.z3_endstop_adj));
#elif ENABLED(Z_DUAL_ENDSTOPS)
SERIAL_ECHOPAIR_P(port, " Z", LINEAR_UNIT(endstops.z2_endstop_adj));
@ -2619,12 +2571,9 @@ void MarlinSettings::reset(PORTARG_SOLO) {
#if HAS_LCD_MENU
if (!forReplay) {
CONFIG_ECHO_START;
SERIAL_ECHOLNPGM_P(port, "Material heatup parameters:");
}
CONFIG_ECHO_HEADING("Material heatup parameters:");
for (uint8_t i = 0; i < COUNT(ui.preheat_hotend_temp); i++) {
CONFIG_ECHO_START;
CONFIG_ECHO_START();
SERIAL_ECHOPAIR_P(port, " M145 S", (int)i);
SERIAL_ECHOPAIR_P(port, " H", TEMP_UNIT(ui.preheat_hotend_temp[i]));
SERIAL_ECHOPAIR_P(port, " B", TEMP_UNIT(ui.preheat_bed_temp[i]));
@ -2635,15 +2584,12 @@ void MarlinSettings::reset(PORTARG_SOLO) {
#if HAS_PID_HEATING
if (!forReplay) {
CONFIG_ECHO_START;
SERIAL_ECHOLNPGM_P(port, "PID settings:");
}
CONFIG_ECHO_HEADING("PID settings:");
#if ENABLED(PIDTEMP)
#if HOTENDS > 1
if (forReplay) {
HOTEND_LOOP() {
CONFIG_ECHO_START;
CONFIG_ECHO_START();
SERIAL_ECHOPAIR_P(port, " M301 E", e);
SERIAL_ECHOPAIR_P(port, " P", PID_PARAM(Kp, e));
SERIAL_ECHOPAIR_P(port, " I", unscalePID_i(PID_PARAM(Ki, e)));
@ -2659,7 +2605,7 @@ void MarlinSettings::reset(PORTARG_SOLO) {
#endif // HOTENDS > 1
// !forReplay || HOTENDS == 1
{
CONFIG_ECHO_START;
CONFIG_ECHO_START();
SERIAL_ECHOPAIR_P(port, " M301 P", PID_PARAM(Kp, 0)); // for compatibility with hosts, only echo values for E0
SERIAL_ECHOPAIR_P(port, " I", unscalePID_i(PID_PARAM(Ki, 0)));
SERIAL_ECHOPAIR_P(port, " D", unscalePID_d(PID_PARAM(Kd, 0)));
@ -2672,7 +2618,7 @@ void MarlinSettings::reset(PORTARG_SOLO) {
#endif // PIDTEMP
#if ENABLED(PIDTEMPBED)
CONFIG_ECHO_START;
CONFIG_ECHO_START();
SERIAL_ECHOPAIR_P(port, " M304 P", thermalManager.bed_pid.Kp);
SERIAL_ECHOPAIR_P(port, " I", unscalePID_i(thermalManager.bed_pid.Ki));
SERIAL_ECHOPAIR_P(port, " D", unscalePID_d(thermalManager.bed_pid.Kd));
@ -2682,51 +2628,36 @@ void MarlinSettings::reset(PORTARG_SOLO) {
#endif // PIDTEMP || PIDTEMPBED
#if HAS_LCD_CONTRAST
if (!forReplay) {
CONFIG_ECHO_START;
SERIAL_ECHOLNPGM_P(port, "LCD Contrast:");
}
CONFIG_ECHO_START;
CONFIG_ECHO_HEADING("LCD Contrast:");
CONFIG_ECHO_START();
SERIAL_ECHOLNPAIR_P(port, " M250 C", ui.contrast);
#endif
#if ENABLED(POWER_LOSS_RECOVERY)
if (!forReplay) {
CONFIG_ECHO_START;
SERIAL_ECHOLNPGM_P(port, "Power-Loss Recovery:");
}
CONFIG_ECHO_START;
CONFIG_ECHO_HEADING("Power-Loss Recovery:");
CONFIG_ECHO_START();
SERIAL_ECHOLNPAIR_P(port, " M413 S", int(recovery.enabled));
#endif
#if ENABLED(FWRETRACT)
if (!forReplay) {
CONFIG_ECHO_START;
SERIAL_ECHOLNPGM_P(port, "Retract: S<length> F<units/m> Z<lift>");
}
CONFIG_ECHO_START;
CONFIG_ECHO_HEADING("Retract: S<length> F<units/m> Z<lift>");
CONFIG_ECHO_START();
SERIAL_ECHOPAIR_P(port, " M207 S", LINEAR_UNIT(fwretract.settings.retract_length));
SERIAL_ECHOPAIR_P(port, " W", LINEAR_UNIT(fwretract.settings.swap_retract_length));
SERIAL_ECHOPAIR_P(port, " F", MMS_TO_MMM(LINEAR_UNIT(fwretract.settings.retract_feedrate_mm_s)));
SERIAL_ECHOLNPAIR_P(port, " Z", LINEAR_UNIT(fwretract.settings.retract_zraise));
if (!forReplay) {
CONFIG_ECHO_START;
SERIAL_ECHOLNPGM_P(port, "Recover: S<length> F<units/m>");
}
CONFIG_ECHO_START;
CONFIG_ECHO_HEADING("Recover: S<length> F<units/m>");
CONFIG_ECHO_START();
SERIAL_ECHOPAIR_P(port, " M208 S", LINEAR_UNIT(fwretract.settings.retract_recover_length));
SERIAL_ECHOPAIR_P(port, " W", LINEAR_UNIT(fwretract.settings.swap_retract_recover_length));
SERIAL_ECHOLNPAIR_P(port, " F", MMS_TO_MMM(LINEAR_UNIT(fwretract.settings.retract_recover_feedrate_mm_s)));
#if ENABLED(FWRETRACT_AUTORETRACT)
if (!forReplay) {
CONFIG_ECHO_START;
SERIAL_ECHOLNPGM_P(port, "Auto-Retract: S=0 to disable, 1 to interpret E-only moves as retract/recover");
}
CONFIG_ECHO_START;
CONFIG_ECHO_HEADING("Auto-Retract: S=0 to disable, 1 to interpret E-only moves as retract/recover");
CONFIG_ECHO_START();
SERIAL_ECHOLNPAIR_P(port, " M209 S", fwretract.autoretract_enabled ? 1 : 0);
#endif // FWRETRACT_AUTORETRACT
@ -2738,11 +2669,11 @@ void MarlinSettings::reset(PORTARG_SOLO) {
*/
#if HAS_BED_PROBE
if (!forReplay) {
CONFIG_ECHO_START;
CONFIG_ECHO_START();
SERIAL_ECHOPGM_P(port, "Z-Probe Offset");
SAY_UNITS_P(port, true);
}
CONFIG_ECHO_START;
CONFIG_ECHO_START();
SERIAL_ECHOLNPAIR_P(port, " M851 Z", LINEAR_UNIT(zprobe_zoffset));
#endif
@ -2750,23 +2681,14 @@ void MarlinSettings::reset(PORTARG_SOLO) {
* Bed Skew Correction
*/
#if ENABLED(SKEW_CORRECTION_GCODE)
if (!forReplay) {
CONFIG_ECHO_START;
SERIAL_ECHOLNPGM_P(port, "Skew Factor: ");
}
CONFIG_ECHO_START;
CONFIG_ECHO_HEADING("Skew Factor: ");
CONFIG_ECHO_START();
#if ENABLED(SKEW_CORRECTION_FOR_Z)
SERIAL_ECHOPGM_P(port, " M852 I");
SERIAL_ECHO_F_P(port, LINEAR_UNIT(planner.skew_factor.xy), 6);
SERIAL_ECHOPGM_P(port, " J");
SERIAL_ECHO_F_P(port, LINEAR_UNIT(planner.skew_factor.xz), 6);
SERIAL_ECHOPGM_P(port, " K");
SERIAL_ECHO_F_P(port, LINEAR_UNIT(planner.skew_factor.yz), 6);
SERIAL_EOL_P(port);
SERIAL_ECHOPAIR_F_P(port, " M852 I", LINEAR_UNIT(planner.skew_factor.xy), 6);
SERIAL_ECHOPAIR_F_P(port, " J", LINEAR_UNIT(planner.skew_factor.xz), 6);
SERIAL_ECHOLNPAIR_F_P(port, " K", LINEAR_UNIT(planner.skew_factor.yz), 6);
#else
SERIAL_ECHOPGM_P(port, " M852 S");
SERIAL_ECHO_F_P(port, LINEAR_UNIT(planner.skew_factor.xy), 6);
SERIAL_EOL_P(port);
SERIAL_ECHOLNPAIR_F_P(port, " M852 S", LINEAR_UNIT(planner.skew_factor.xy), 6);
#endif
#endif
@ -2775,11 +2697,8 @@ void MarlinSettings::reset(PORTARG_SOLO) {
/**
* TMC stepper driver current
*/
if (!forReplay) {
CONFIG_ECHO_START;
SERIAL_ECHOLNPGM_P(port, "Stepper driver current:");
}
CONFIG_ECHO_START;
CONFIG_ECHO_HEADING("Stepper driver current:");
CONFIG_ECHO_START();
#if AXIS_IS_TMC(X) || AXIS_IS_TMC(Y) || AXIS_IS_TMC(Z)
say_M906(PORTVAR_SOLO);
#endif
@ -2848,11 +2767,8 @@ void MarlinSettings::reset(PORTARG_SOLO) {
* TMC Hybrid Threshold
*/
#if ENABLED(HYBRID_THRESHOLD)
if (!forReplay) {
CONFIG_ECHO_START;
SERIAL_ECHOLNPGM_P(port, "Hybrid Threshold:");
}
CONFIG_ECHO_START;
CONFIG_ECHO_HEADING("Hybrid Threshold:");
CONFIG_ECHO_START();
#if AXIS_HAS_STEALTHCHOP(X) || AXIS_HAS_STEALTHCHOP(Y) || AXIS_HAS_STEALTHCHOP(Z)
say_M913(PORTVAR_SOLO);
#endif
@ -2923,11 +2839,8 @@ void MarlinSettings::reset(PORTARG_SOLO) {
* TMC Sensorless homing thresholds
*/
#if USE_SENSORLESS
if (!forReplay) {
CONFIG_ECHO_START;
SERIAL_ECHOLNPGM_P(port, "TMC2130 StallGuard threshold:");
}
CONFIG_ECHO_START;
CONFIG_ECHO_HEADING("TMC2130 StallGuard threshold:");
CONFIG_ECHO_START();
#if X_SENSORLESS || Y_SENSORLESS || Z_SENSORLESS
say_M914(PORTVAR_SOLO);
#if X_SENSORLESS
@ -2975,12 +2888,8 @@ void MarlinSettings::reset(PORTARG_SOLO) {
* Linear Advance
*/
#if ENABLED(LIN_ADVANCE)
if (!forReplay) {
CONFIG_ECHO_START;
SERIAL_ECHOLNPGM_P(port, "Linear Advance:");
}
CONFIG_ECHO_START;
CONFIG_ECHO_HEADING("Linear Advance:");
CONFIG_ECHO_START();
#if EXTRUDERS < 2
SERIAL_ECHOLNPAIR_P(port, " M900 K", planner.extruder_advance_K[0]);
#else
@ -2992,11 +2901,8 @@ void MarlinSettings::reset(PORTARG_SOLO) {
#endif
#if HAS_MOTOR_CURRENT_PWM
CONFIG_ECHO_START;
if (!forReplay) {
SERIAL_ECHOLNPGM_P(port, "Stepper motor currents:");
CONFIG_ECHO_START;
}
CONFIG_ECHO_HEADING("Stepper motor currents:");
CONFIG_ECHO_START();
SERIAL_ECHOPAIR_P(port, " M907 X", stepper.motor_current_setting[0]);
SERIAL_ECHOPAIR_P(port, " Z", stepper.motor_current_setting[1]);
SERIAL_ECHOPAIR_P(port, " E", stepper.motor_current_setting[2]);
@ -3007,11 +2913,8 @@ void MarlinSettings::reset(PORTARG_SOLO) {
* Advanced Pause filament load & unload lengths
*/
#if ENABLED(ADVANCED_PAUSE_FEATURE)
if (!forReplay) {
CONFIG_ECHO_START;
SERIAL_ECHOLNPGM_P(port, "Filament load/unload lengths:");
}
CONFIG_ECHO_START;
CONFIG_ECHO_HEADING("Filament load/unload lengths:");
CONFIG_ECHO_START();
#if EXTRUDERS == 1
say_M603(PORTVAR_SOLO);
SERIAL_ECHOPAIR_P(port, "L", LINEAR_UNIT(fc_settings[0].load_length));
@ -3020,27 +2923,27 @@ void MarlinSettings::reset(PORTARG_SOLO) {
say_M603(PORTVAR_SOLO);
SERIAL_ECHOPAIR_P(port, "T0 L", LINEAR_UNIT(fc_settings[0].load_length));
SERIAL_ECHOLNPAIR_P(port, " U", LINEAR_UNIT(fc_settings[0].unload_length));
CONFIG_ECHO_START;
CONFIG_ECHO_START();
say_M603(PORTVAR_SOLO);
SERIAL_ECHOPAIR_P(port, "T1 L", LINEAR_UNIT(fc_settings[1].load_length));
SERIAL_ECHOLNPAIR_P(port, " U", LINEAR_UNIT(fc_settings[1].unload_length));
#if EXTRUDERS > 2
CONFIG_ECHO_START;
CONFIG_ECHO_START();
say_M603(PORTVAR_SOLO);
SERIAL_ECHOPAIR_P(port, "T2 L", LINEAR_UNIT(fc_settings[2].load_length));
SERIAL_ECHOLNPAIR_P(port, " U", LINEAR_UNIT(fc_settings[2].unload_length));
#if EXTRUDERS > 3
CONFIG_ECHO_START;
CONFIG_ECHO_START();
say_M603(PORTVAR_SOLO);
SERIAL_ECHOPAIR_P(port, "T3 L", LINEAR_UNIT(fc_settings[3].load_length));
SERIAL_ECHOLNPAIR_P(port, " U", LINEAR_UNIT(fc_settings[3].unload_length));
#if EXTRUDERS > 4
CONFIG_ECHO_START;
CONFIG_ECHO_START();
say_M603(PORTVAR_SOLO);
SERIAL_ECHOPAIR_P(port, "T4 L", LINEAR_UNIT(fc_settings[4].load_length));
SERIAL_ECHOLNPAIR_P(port, " U", LINEAR_UNIT(fc_settings[4].unload_length));
#if EXTRUDERS > 5
CONFIG_ECHO_START;
CONFIG_ECHO_START();
say_M603(PORTVAR_SOLO);
SERIAL_ECHOPAIR_P(port, "T5 L", LINEAR_UNIT(fc_settings[5].load_length));
SERIAL_ECHOLNPAIR_P(port, " U", LINEAR_UNIT(fc_settings[5].unload_length));
@ -3052,11 +2955,8 @@ void MarlinSettings::reset(PORTARG_SOLO) {
#endif // ADVANCED_PAUSE_FEATURE
#if EXTRUDERS > 1
CONFIG_ECHO_START;
if (!forReplay) {
SERIAL_ECHOLNPGM_P(port, "Tool-changing:");
CONFIG_ECHO_START;
}
CONFIG_ECHO_HEADING("Tool-changing:");
CONFIG_ECHO_START();
M217_report(true);
#endif
}

View file

@ -365,13 +365,13 @@ void Endstops::event_handler() {
static void print_es_state(const bool is_hit, PGM_P const label=NULL) {
if (label) serialprintPGM(label);
SERIAL_PROTOCOLPGM(": ");
SERIAL_ECHOPGM(": ");
serialprintPGM(is_hit ? PSTR(MSG_ENDSTOP_HIT) : PSTR(MSG_ENDSTOP_OPEN));
SERIAL_EOL();
}
void _O2 Endstops::M119() {
SERIAL_PROTOCOLLNPGM(MSG_M119_REPORT);
SERIAL_ECHOLNPGM(MSG_M119_REPORT);
#define ES_REPORT(S) print_es_state(READ(S##_PIN) != S##_ENDSTOP_INVERTING, PSTR(MSG_##S))
#if HAS_X_MIN
ES_REPORT(X_MIN);
@ -441,7 +441,7 @@ void _O2 Endstops::M119() {
#endif
#endif
}
SERIAL_PROTOCOLPGM(MSG_FILAMENT_RUNOUT_SENSOR);
SERIAL_ECHOPGM(MSG_FILAMENT_RUNOUT_SENSOR);
if (i > 1) { SERIAL_CHAR(' '); SERIAL_CHAR('0' + i); }
print_es_state(digitalRead(pin) != FIL_RUNOUT_INVERTING);
}
@ -825,51 +825,51 @@ void Endstops::update() {
if (endstop_change) {
#if HAS_X_MIN
if (TEST(endstop_change, X_MIN)) SERIAL_PROTOCOLPAIR(" X_MIN:", TEST(live_state_local, X_MIN));
if (TEST(endstop_change, X_MIN)) SERIAL_ECHOPAIR(" X_MIN:", TEST(live_state_local, X_MIN));
#endif
#if HAS_X_MAX
if (TEST(endstop_change, X_MAX)) SERIAL_PROTOCOLPAIR(" X_MAX:", TEST(live_state_local, X_MAX));
if (TEST(endstop_change, X_MAX)) SERIAL_ECHOPAIR(" X_MAX:", TEST(live_state_local, X_MAX));
#endif
#if HAS_Y_MIN
if (TEST(endstop_change, Y_MIN)) SERIAL_PROTOCOLPAIR(" Y_MIN:", TEST(live_state_local, Y_MIN));
if (TEST(endstop_change, Y_MIN)) SERIAL_ECHOPAIR(" Y_MIN:", TEST(live_state_local, Y_MIN));
#endif
#if HAS_Y_MAX
if (TEST(endstop_change, Y_MAX)) SERIAL_PROTOCOLPAIR(" Y_MAX:", TEST(live_state_local, Y_MAX));
if (TEST(endstop_change, Y_MAX)) SERIAL_ECHOPAIR(" Y_MAX:", TEST(live_state_local, Y_MAX));
#endif
#if HAS_Z_MIN
if (TEST(endstop_change, Z_MIN)) SERIAL_PROTOCOLPAIR(" Z_MIN:", TEST(live_state_local, Z_MIN));
if (TEST(endstop_change, Z_MIN)) SERIAL_ECHOPAIR(" Z_MIN:", TEST(live_state_local, Z_MIN));
#endif
#if HAS_Z_MAX
if (TEST(endstop_change, Z_MAX)) SERIAL_PROTOCOLPAIR(" Z_MAX:", TEST(live_state_local, Z_MAX));
if (TEST(endstop_change, Z_MAX)) SERIAL_ECHOPAIR(" Z_MAX:", TEST(live_state_local, Z_MAX));
#endif
#if HAS_Z_MIN_PROBE_PIN
if (TEST(endstop_change, Z_MIN_PROBE)) SERIAL_PROTOCOLPAIR(" PROBE:", TEST(live_state_local, Z_MIN_PROBE));
if (TEST(endstop_change, Z_MIN_PROBE)) SERIAL_ECHOPAIR(" PROBE:", TEST(live_state_local, Z_MIN_PROBE));
#endif
#if HAS_X2_MIN
if (TEST(endstop_change, X2_MIN)) SERIAL_PROTOCOLPAIR(" X2_MIN:", TEST(live_state_local, X2_MIN));
if (TEST(endstop_change, X2_MIN)) SERIAL_ECHOPAIR(" X2_MIN:", TEST(live_state_local, X2_MIN));
#endif
#if HAS_X2_MAX
if (TEST(endstop_change, X2_MAX)) SERIAL_PROTOCOLPAIR(" X2_MAX:", TEST(live_state_local, X2_MAX));
if (TEST(endstop_change, X2_MAX)) SERIAL_ECHOPAIR(" X2_MAX:", TEST(live_state_local, X2_MAX));
#endif
#if HAS_Y2_MIN
if (TEST(endstop_change, Y2_MIN)) SERIAL_PROTOCOLPAIR(" Y2_MIN:", TEST(live_state_local, Y2_MIN));
if (TEST(endstop_change, Y2_MIN)) SERIAL_ECHOPAIR(" Y2_MIN:", TEST(live_state_local, Y2_MIN));
#endif
#if HAS_Y2_MAX
if (TEST(endstop_change, Y2_MAX)) SERIAL_PROTOCOLPAIR(" Y2_MAX:", TEST(live_state_local, Y2_MAX));
if (TEST(endstop_change, Y2_MAX)) SERIAL_ECHOPAIR(" Y2_MAX:", TEST(live_state_local, Y2_MAX));
#endif
#if HAS_Z2_MIN
if (TEST(endstop_change, Z2_MIN)) SERIAL_PROTOCOLPAIR(" Z2_MIN:", TEST(live_state_local, Z2_MIN));
if (TEST(endstop_change, Z2_MIN)) SERIAL_ECHOPAIR(" Z2_MIN:", TEST(live_state_local, Z2_MIN));
#endif
#if HAS_Z2_MAX
if (TEST(endstop_change, Z2_MAX)) SERIAL_PROTOCOLPAIR(" Z2_MAX:", TEST(live_state_local, Z2_MAX));
if (TEST(endstop_change, Z2_MAX)) SERIAL_ECHOPAIR(" Z2_MAX:", TEST(live_state_local, Z2_MAX));
#endif
#if HAS_Z3_MIN
if (TEST(endstop_change, Z3_MIN)) SERIAL_PROTOCOLPAIR(" Z3_MIN:", TEST(live_state_local, Z3_MIN));
if (TEST(endstop_change, Z3_MIN)) SERIAL_ECHOPAIR(" Z3_MIN:", TEST(live_state_local, Z3_MIN));
#endif
#if HAS_Z3_MAX
if (TEST(endstop_change, Z3_MAX)) SERIAL_PROTOCOLPAIR(" Z3_MAX:", TEST(live_state_local, Z3_MAX));
if (TEST(endstop_change, Z3_MAX)) SERIAL_ECHOPAIR(" Z3_MAX:", TEST(live_state_local, Z3_MAX));
#endif
SERIAL_PROTOCOLPGM("\n\n");
SERIAL_ECHOPGM("\n\n");
analogWrite(LED_PIN, local_LED_status);
local_LED_status ^= 255;
old_live_state_local = live_state_local;

View file

@ -163,14 +163,10 @@ float cartes[XYZ];
* Output the current position to serial
*/
void report_current_position() {
SERIAL_PROTOCOLPGM("X:");
SERIAL_PROTOCOL(LOGICAL_X_POSITION(current_position[X_AXIS]));
SERIAL_PROTOCOLPGM(" Y:");
SERIAL_PROTOCOL(LOGICAL_Y_POSITION(current_position[Y_AXIS]));
SERIAL_PROTOCOLPGM(" Z:");
SERIAL_PROTOCOL(LOGICAL_Z_POSITION(current_position[Z_AXIS]));
SERIAL_PROTOCOLPGM(" E:");
SERIAL_PROTOCOL(current_position[E_AXIS]);
SERIAL_ECHOPAIR("X:", LOGICAL_X_POSITION(current_position[X_AXIS]));
SERIAL_ECHOPAIR(" Y:", LOGICAL_Y_POSITION(current_position[Y_AXIS]));
SERIAL_ECHOPAIR(" Z:", LOGICAL_Z_POSITION(current_position[Z_AXIS]));
SERIAL_ECHOPAIR(" E:", current_position[E_AXIS]);
stepper.report_positions();
@ -967,15 +963,13 @@ void prepare_move_to_destination() {
#if ENABLED(PREVENT_COLD_EXTRUSION)
if (thermalManager.tooColdToExtrude(active_extruder)) {
current_position[E_AXIS] = destination[E_AXIS]; // Behave as if the move really took place, but ignore E part
SERIAL_ECHO_START();
SERIAL_ECHOLNPGM(MSG_ERR_COLD_EXTRUDE_STOP);
SERIAL_ECHO_MSG(MSG_ERR_COLD_EXTRUDE_STOP);
}
#endif // PREVENT_COLD_EXTRUSION
#if ENABLED(PREVENT_LENGTHY_EXTRUDE)
if (ABS(destination[E_AXIS] - current_position[E_AXIS]) * planner.e_factor[active_extruder] > (EXTRUDE_MAXLENGTH)) {
current_position[E_AXIS] = destination[E_AXIS]; // Behave as if the move really took place, but ignore E part
SERIAL_ECHO_START();
SERIAL_ECHOLNPGM(MSG_ERR_LONG_EXTRUDE_STOP);
SERIAL_ECHO_MSG(MSG_ERR_LONG_EXTRUDE_STOP);
}
#endif // PREVENT_LENGTHY_EXTRUDE
}
@ -1046,8 +1040,7 @@ inline float get_homing_bump_feedrate(const AxisEnum axis) {
uint8_t hbd = pgm_read_byte(&homing_bump_divisor[axis]);
if (hbd < 1) {
hbd = 10;
SERIAL_ECHO_START();
SERIAL_ECHOLNPGM("Warning: Homing Bump Divisor < 1");
SERIAL_ECHO_MSG("Warning: Homing Bump Divisor < 1");
}
return homing_feedrate(axis) / hbd;
}

View file

@ -1661,8 +1661,7 @@ bool Planner::_populate_block(block_t * const block, bool split_move,
position_float[E_AXIS] = target_float[E_AXIS];
#endif
de = 0; // no difference
SERIAL_ECHO_START();
SERIAL_ECHOLNPGM(MSG_ERR_COLD_EXTRUDE_STOP);
SERIAL_ECHO_MSG(MSG_ERR_COLD_EXTRUDE_STOP);
}
#endif // PREVENT_COLD_EXTRUSION
#if ENABLED(PREVENT_LENGTHY_EXTRUDE)
@ -1672,8 +1671,7 @@ bool Planner::_populate_block(block_t * const block, bool split_move,
position_float[E_AXIS] = target_float[E_AXIS];
#endif
de = 0; // no difference
SERIAL_ECHO_START();
SERIAL_ECHOLNPGM(MSG_ERR_LONG_EXTRUDE_STOP);
SERIAL_ECHO_MSG(MSG_ERR_LONG_EXTRUDE_STOP);
}
#endif // PREVENT_LENGTHY_EXTRUDE
}

View file

@ -111,7 +111,7 @@ void PrintCounter::saveStats() {
void PrintCounter::showStats() {
char buffer[21];
SERIAL_PROTOCOLPGM(MSG_STATS);
SERIAL_ECHOPGM(MSG_STATS);
SERIAL_ECHOPGM("Prints: ");
SERIAL_ECHO(data.totalPrints);
@ -124,7 +124,7 @@ void PrintCounter::showStats() {
- ((isRunning() || isPaused()) ? 1 : 0));
SERIAL_EOL();
SERIAL_PROTOCOLPGM(MSG_STATS);
SERIAL_ECHOPGM(MSG_STATS);
duration_t elapsed = data.printTime;
elapsed.toString(buffer);
@ -151,7 +151,7 @@ void PrintCounter::showStats() {
#endif
SERIAL_EOL();
SERIAL_PROTOCOLPGM(MSG_STATS);
SERIAL_ECHOPGM(MSG_STATS);
SERIAL_ECHOPGM("Filament used: ");
SERIAL_ECHO(data.filamentUsed / 1000);

View file

@ -320,8 +320,7 @@ float zprobe_zoffset; // Initialized by settings.load()
// (Measured completion time was 0.65 seconds
// after reset, deploy, and stow sequence)
if (TEST_BLTOUCH()) { // If it still claims to be triggered...
SERIAL_ERROR_START();
SERIAL_ERRORLNPGM(MSG_STOP_BLTOUCH);
SERIAL_ERROR_MSG(MSG_STOP_BLTOUCH);
stop(); // punt!
return true;
}
@ -450,8 +449,7 @@ bool set_probe_deployed(const bool deploy) {
#define _AUE_ARGS
#endif
if (axis_unhomed_error(_AUE_ARGS)) {
SERIAL_ERROR_START();
SERIAL_ERRORLNPGM(MSG_STOP_UNHOMED);
SERIAL_ERROR_MSG(MSG_STOP_UNHOMED);
stop();
return true;
}
@ -479,8 +477,7 @@ bool set_probe_deployed(const bool deploy) {
if (PROBE_STOWED() == deploy) { // Unchanged after deploy/stow action?
if (IsRunning()) {
SERIAL_ERROR_START();
SERIAL_ERRORLNPGM("Z-Probe failed");
SERIAL_ERROR_MSG("Z-Probe failed");
LCD_ALERTMESSAGEPGM("Err: ZPROBE");
}
stop();
@ -771,13 +768,9 @@ float probe_pt(const float &rx, const float &ry, const ProbePtRaise raise_after/
}
if (verbose_level > 2) {
SERIAL_PROTOCOLPGM("Bed X: ");
SERIAL_PROTOCOL_F(LOGICAL_X_POSITION(rx), 3);
SERIAL_PROTOCOLPGM(" Y: ");
SERIAL_PROTOCOL_F(LOGICAL_Y_POSITION(ry), 3);
SERIAL_PROTOCOLPGM(" Z: ");
SERIAL_PROTOCOL_F(measured_z, 3);
SERIAL_EOL();
SERIAL_ECHOPAIR_F("Bed X: ", LOGICAL_X_POSITION(rx), 3);
SERIAL_ECHOPAIR_F(" Y: ", LOGICAL_Y_POSITION(ry), 3);
SERIAL_ECHOLNPAIR_F(" Z: ", measured_z, 3);
}
feedrate_mm_s = old_feedrate_mm_s;
@ -785,8 +778,7 @@ float probe_pt(const float &rx, const float &ry, const ProbePtRaise raise_after/
if (isnan(measured_z)) {
STOW_PROBE();
LCD_MESSAGEPGM(MSG_ERR_PROBING_FAILED);
SERIAL_ERROR_START();
SERIAL_ERRORLNPGM(MSG_ERR_PROBING_FAILED);
SERIAL_ERROR_MSG(MSG_ERR_PROBING_FAILED);
}
#if ENABLED(DEBUG_LEVELING_FEATURE)

View file

@ -142,8 +142,8 @@ void inverse_kinematics(const float (&raw)[XYZ]) {
}
void scara_report_positions() {
SERIAL_PROTOCOLPAIR("SCARA Theta:", planner.get_axis_position_degrees(A_AXIS));
SERIAL_PROTOCOLLNPAIR(" Psi+Theta:", planner.get_axis_position_degrees(B_AXIS));
SERIAL_ECHOPAIR("SCARA Theta:", planner.get_axis_position_degrees(A_AXIS));
SERIAL_ECHOLNPAIR(" Psi+Theta:", planner.get_axis_position_degrees(B_AXIS));
SERIAL_EOL();
}

View file

@ -2218,25 +2218,25 @@ void Stepper::report_positions() {
if (was_enabled) ENABLE_STEPPER_DRIVER_INTERRUPT();
#if CORE_IS_XY || CORE_IS_XZ || ENABLED(DELTA) || IS_SCARA
SERIAL_PROTOCOLPGM(MSG_COUNT_A);
SERIAL_ECHOPGM(MSG_COUNT_A);
#else
SERIAL_PROTOCOLPGM(MSG_COUNT_X);
SERIAL_ECHOPGM(MSG_COUNT_X);
#endif
SERIAL_PROTOCOL(xpos);
SERIAL_ECHO(xpos);
#if CORE_IS_XY || CORE_IS_YZ || ENABLED(DELTA) || IS_SCARA
SERIAL_PROTOCOLPGM(" B:");
SERIAL_ECHOPGM(" B:");
#else
SERIAL_PROTOCOLPGM(" Y:");
SERIAL_ECHOPGM(" Y:");
#endif
SERIAL_PROTOCOL(ypos);
SERIAL_ECHO(ypos);
#if CORE_IS_XZ || CORE_IS_YZ || ENABLED(DELTA)
SERIAL_PROTOCOLPGM(" C:");
SERIAL_ECHOPGM(" C:");
#else
SERIAL_PROTOCOLPGM(" Z:");
SERIAL_ECHOPGM(" Z:");
#endif
SERIAL_PROTOCOL(zpos);
SERIAL_ECHO(zpos);
SERIAL_EOL();
}
@ -2813,82 +2813,81 @@ void Stepper::report_positions() {
case 128: microstep_ms(driver, MICROSTEP128); break;
#endif
default: SERIAL_ERROR_START(); SERIAL_ERRORLNPGM("Microsteps unavailable"); break;
default: SERIAL_ERROR_MSG("Microsteps unavailable"); break;
}
}
void Stepper::microstep_readings() {
SERIAL_PROTOCOLLNPGM("MS1,MS2,MS3 Pins");
SERIAL_PROTOCOLPGM("X: ");
SERIAL_ECHOPGM("MS1,MS2,MS3 Pins\nX: ");
#if HAS_X_MICROSTEPS
SERIAL_PROTOCOL(READ(X_MS1_PIN));
SERIAL_PROTOCOL(READ(X_MS2_PIN));
SERIAL_ECHO(READ(X_MS1_PIN));
SERIAL_ECHO(READ(X_MS2_PIN));
#if PIN_EXISTS(X_MS3)
SERIAL_PROTOCOLLN(READ(X_MS3_PIN));
SERIAL_ECHOLN(READ(X_MS3_PIN));
#endif
#endif
#if HAS_Y_MICROSTEPS
SERIAL_PROTOCOLPGM("Y: ");
SERIAL_PROTOCOL(READ(Y_MS1_PIN));
SERIAL_PROTOCOL(READ(Y_MS2_PIN));
SERIAL_ECHOPGM("Y: ");
SERIAL_ECHO(READ(Y_MS1_PIN));
SERIAL_ECHO(READ(Y_MS2_PIN));
#if PIN_EXISTS(Y_MS3)
SERIAL_PROTOCOLLN(READ(Y_MS3_PIN));
SERIAL_ECHOLN(READ(Y_MS3_PIN));
#endif
#endif
#if HAS_Z_MICROSTEPS
SERIAL_PROTOCOLPGM("Z: ");
SERIAL_PROTOCOL(READ(Z_MS1_PIN));
SERIAL_PROTOCOL(READ(Z_MS2_PIN));
SERIAL_ECHOPGM("Z: ");
SERIAL_ECHO(READ(Z_MS1_PIN));
SERIAL_ECHO(READ(Z_MS2_PIN));
#if PIN_EXISTS(Z_MS3)
SERIAL_PROTOCOLLN(READ(Z_MS3_PIN));
SERIAL_ECHOLN(READ(Z_MS3_PIN));
#endif
#endif
#if HAS_E0_MICROSTEPS
SERIAL_PROTOCOLPGM("E0: ");
SERIAL_PROTOCOL(READ(E0_MS1_PIN));
SERIAL_PROTOCOL(READ(E0_MS2_PIN));
SERIAL_ECHOPGM("E0: ");
SERIAL_ECHO(READ(E0_MS1_PIN));
SERIAL_ECHO(READ(E0_MS2_PIN));
#if PIN_EXISTS(E0_MS3)
SERIAL_PROTOCOLLN(READ(E0_MS3_PIN));
SERIAL_ECHOLN(READ(E0_MS3_PIN));
#endif
#endif
#if HAS_E1_MICROSTEPS
SERIAL_PROTOCOLPGM("E1: ");
SERIAL_PROTOCOL(READ(E1_MS1_PIN));
SERIAL_PROTOCOL(READ(E1_MS2_PIN));
SERIAL_ECHOPGM("E1: ");
SERIAL_ECHO(READ(E1_MS1_PIN));
SERIAL_ECHO(READ(E1_MS2_PIN));
#if PIN_EXISTS(E1_MS3)
SERIAL_PROTOCOLLN(READ(E1_MS3_PIN));
SERIAL_ECHOLN(READ(E1_MS3_PIN));
#endif
#endif
#if HAS_E2_MICROSTEPS
SERIAL_PROTOCOLPGM("E2: ");
SERIAL_PROTOCOL(READ(E2_MS1_PIN));
SERIAL_PROTOCOL(READ(E2_MS2_PIN));
SERIAL_ECHOPGM("E2: ");
SERIAL_ECHO(READ(E2_MS1_PIN));
SERIAL_ECHO(READ(E2_MS2_PIN));
#if PIN_EXISTS(E2_MS3)
SERIAL_PROTOCOLLN(READ(E2_MS3_PIN));
SERIAL_ECHOLN(READ(E2_MS3_PIN));
#endif
#endif
#if HAS_E3_MICROSTEPS
SERIAL_PROTOCOLPGM("E3: ");
SERIAL_PROTOCOL(READ(E3_MS1_PIN));
SERIAL_PROTOCOL(READ(E3_MS2_PIN));
SERIAL_ECHOPGM("E3: ");
SERIAL_ECHO(READ(E3_MS1_PIN));
SERIAL_ECHO(READ(E3_MS2_PIN));
#if PIN_EXISTS(E3_MS3)
SERIAL_PROTOCOLLN(READ(E3_MS3_PIN));
SERIAL_ECHOLN(READ(E3_MS3_PIN));
#endif
#endif
#if HAS_E4_MICROSTEPS
SERIAL_PROTOCOLPGM("E4: ");
SERIAL_PROTOCOL(READ(E4_MS1_PIN));
SERIAL_PROTOCOL(READ(E4_MS2_PIN));
SERIAL_ECHOPGM("E4: ");
SERIAL_ECHO(READ(E4_MS1_PIN));
SERIAL_ECHO(READ(E4_MS2_PIN));
#if PIN_EXISTS(E4_MS3)
SERIAL_PROTOCOLLN(READ(E4_MS3_PIN));
SERIAL_ECHOLN(READ(E4_MS3_PIN));
#endif
#endif
#if HAS_E5_MICROSTEPS
SERIAL_PROTOCOLPGM("E5: ");
SERIAL_PROTOCOL(READ(E5_MS1_PIN));
SERIAL_PROTOCOLLN(READ(E5_MS2_PIN));
SERIAL_ECHOPGM("E5: ");
SERIAL_ECHO(READ(E5_MS1_PIN));
SERIAL_ECHOLN(READ(E5_MS2_PIN));
#if PIN_EXISTS(E5_MS3)
SERIAL_PROTOCOLLN(READ(E5_MS3_PIN));
SERIAL_ECHOLN(READ(E5_MS3_PIN));
#endif
#endif
}

View file

@ -228,7 +228,7 @@ uint8_t Temperature::soft_pwm_amount[HOTENDS];
#if HAS_PID_HEATING
inline void say_default_() { SERIAL_PROTOCOLPGM("#define DEFAULT_"); }
inline void say_default_() { SERIAL_ECHOPGM("#define DEFAULT_"); }
/**
* PID Autotuning (M303)
@ -343,37 +343,37 @@ uint8_t Temperature::soft_pwm_amount[HOTENDS];
bias = constrain(bias, 20, max_pow - 20);
d = (bias > max_pow >> 1) ? max_pow - 1 - bias : bias;
SERIAL_PROTOCOLPAIR(MSG_BIAS, bias);
SERIAL_PROTOCOLPAIR(MSG_D, d);
SERIAL_PROTOCOLPAIR(MSG_T_MIN, min);
SERIAL_PROTOCOLPAIR(MSG_T_MAX, max);
SERIAL_ECHOPAIR(MSG_BIAS, bias);
SERIAL_ECHOPAIR(MSG_D, d);
SERIAL_ECHOPAIR(MSG_T_MIN, min);
SERIAL_ECHOPAIR(MSG_T_MAX, max);
if (cycles > 2) {
float Ku = (4.0f * d) / (float(M_PI) * (max - min) * 0.5f),
Tu = ((float)(t_low + t_high) * 0.001f);
SERIAL_PROTOCOLPAIR(MSG_KU, Ku);
SERIAL_PROTOCOLPAIR(MSG_TU, Tu);
SERIAL_ECHOPAIR(MSG_KU, Ku);
SERIAL_ECHOPAIR(MSG_TU, Tu);
tune_pid.Kp = 0.6f * Ku;
tune_pid.Ki = 2 * tune_pid.Kp / Tu;
tune_pid.Kd = tune_pid.Kp * Tu * 0.125f;
SERIAL_PROTOCOLLNPGM("\n" MSG_CLASSIC_PID);
SERIAL_PROTOCOLPAIR(MSG_KP, tune_pid.Kp);
SERIAL_PROTOCOLPAIR(MSG_KI, tune_pid.Ki);
SERIAL_PROTOCOLLNPAIR(MSG_KD, tune_pid.Kd);
SERIAL_ECHOLNPGM("\n" MSG_CLASSIC_PID);
SERIAL_ECHOPAIR(MSG_KP, tune_pid.Kp);
SERIAL_ECHOPAIR(MSG_KI, tune_pid.Ki);
SERIAL_ECHOLNPAIR(MSG_KD, tune_pid.Kd);
/**
tune_pid.Kp = 0.33*Ku;
tune_pid.Ki = tune_pid.Kp/Tu;
tune_pid.Kd = tune_pid.Kp*Tu/3;
SERIAL_PROTOCOLLNPGM(" Some overshoot");
SERIAL_PROTOCOLPAIR(" Kp: ", tune_pid.Kp);
SERIAL_PROTOCOLPAIR(" Ki: ", tune_pid.Ki);
SERIAL_PROTOCOLPAIR(" Kd: ", tune_pid.Kd);
SERIAL_ECHOLNPGM(" Some overshoot");
SERIAL_ECHOPAIR(" Kp: ", tune_pid.Kp);
SERIAL_ECHOPAIR(" Ki: ", tune_pid.Ki);
SERIAL_ECHOPAIR(" Kd: ", tune_pid.Kd);
tune_pid.Kp = 0.2*Ku;
tune_pid.Ki = 2*tune_pid.Kp/Tu;
tune_pid.Kd = tune_pid.Kp*Tu/3;
SERIAL_PROTOCOLLNPGM(" No overshoot");
SERIAL_PROTOCOLPAIR(" Kp: ", tune_pid.Kp);
SERIAL_PROTOCOLPAIR(" Ki: ", tune_pid.Ki);
SERIAL_PROTOCOLPAIR(" Kd: ", tune_pid.Kd);
SERIAL_ECHOLNPGM(" No overshoot");
SERIAL_ECHOPAIR(" Kp: ", tune_pid.Kp);
SERIAL_ECHOPAIR(" Ki: ", tune_pid.Ki);
SERIAL_ECHOPAIR(" Kd: ", tune_pid.Kd);
*/
}
}
@ -389,7 +389,7 @@ uint8_t Temperature::soft_pwm_amount[HOTENDS];
#define MAX_OVERSHOOT_PID_AUTOTUNE 20
#endif
if (current > target + MAX_OVERSHOOT_PID_AUTOTUNE) {
SERIAL_PROTOCOLLNPGM(MSG_PID_TEMP_TOO_HIGH);
SERIAL_ECHOLNPGM(MSG_PID_TEMP_TOO_HIGH);
break;
}
@ -432,26 +432,26 @@ uint8_t Temperature::soft_pwm_amount[HOTENDS];
#define MAX_CYCLE_TIME_PID_AUTOTUNE 20L
#endif
if (((ms - t1) + (ms - t2)) > (MAX_CYCLE_TIME_PID_AUTOTUNE * 60L * 1000L)) {
SERIAL_PROTOCOLLNPGM(MSG_PID_TIMEOUT);
SERIAL_ECHOLNPGM(MSG_PID_TIMEOUT);
break;
}
if (cycles > ncycles) {
SERIAL_PROTOCOLLNPGM(MSG_PID_AUTOTUNE_FINISHED);
SERIAL_ECHOLNPGM(MSG_PID_AUTOTUNE_FINISHED);
#if HAS_PID_FOR_BOTH
const char * const estring = GHV(PSTR("bed"), PSTR(""));
say_default_(); serialprintPGM(estring); SERIAL_PROTOCOLLNPAIR("Kp ", tune_pid.Kp);
say_default_(); serialprintPGM(estring); SERIAL_PROTOCOLLNPAIR("Ki ", tune_pid.Ki);
say_default_(); serialprintPGM(estring); SERIAL_PROTOCOLLNPAIR("Kd ", tune_pid.Kd);
say_default_(); serialprintPGM(estring); SERIAL_ECHOLNPAIR("Kp ", tune_pid.Kp);
say_default_(); serialprintPGM(estring); SERIAL_ECHOLNPAIR("Ki ", tune_pid.Ki);
say_default_(); serialprintPGM(estring); SERIAL_ECHOLNPAIR("Kd ", tune_pid.Kd);
#elif ENABLED(PIDTEMP)
say_default_(); SERIAL_PROTOCOLLNPAIR("Kp ", tune_pid.Kp);
say_default_(); SERIAL_PROTOCOLLNPAIR("Ki ", tune_pid.Ki);
say_default_(); SERIAL_PROTOCOLLNPAIR("Kd ", tune_pid.Kd);
say_default_(); SERIAL_ECHOLNPAIR("Kp ", tune_pid.Kp);
say_default_(); SERIAL_ECHOLNPAIR("Ki ", tune_pid.Ki);
say_default_(); SERIAL_ECHOLNPAIR("Kd ", tune_pid.Kd);
#else
say_default_(); SERIAL_PROTOCOLLNPAIR("bedKp ", tune_pid.Kp);
say_default_(); SERIAL_PROTOCOLLNPAIR("bedKi ", tune_pid.Ki);
say_default_(); SERIAL_PROTOCOLLNPAIR("bedKd ", tune_pid.Kd);
say_default_(); SERIAL_ECHOLNPAIR("bedKp ", tune_pid.Kp);
say_default_(); SERIAL_ECHOLNPAIR("bedKi ", tune_pid.Ki);
say_default_(); SERIAL_ECHOLNPAIR("bedKd ", tune_pid.Kd);
#endif
#define _SET_BED_PID() do { \
@ -564,8 +564,8 @@ void Temperature::_temp_error(const int8_t heater, PGM_P const serial_msg, PGM_P
if (IsRunning()) {
SERIAL_ERROR_START();
serialprintPGM(serial_msg);
SERIAL_ERRORPGM(MSG_STOPPED_HEATER);
if (heater >= 0) SERIAL_ERRORLN((int)heater); else SERIAL_ERRORLNPGM(MSG_HEATER_BED);
SERIAL_ECHOPGM(MSG_STOPPED_HEATER);
if (heater >= 0) SERIAL_ECHOLN((int)heater); else SERIAL_ECHOLNPGM(MSG_HEATER_BED);
}
#if DISABLED(BOGUS_TEMPERATURE_FAILSAFE_OVERRIDE)
if (!killed) {
@ -940,8 +940,8 @@ float Temperature::analog_to_celsius_hotend(const int raw, const uint8_t e) {
#endif
{
SERIAL_ERROR_START();
SERIAL_ERROR((int)e);
SERIAL_ERRORLNPGM(MSG_INVALID_EXTRUDER_NUM);
SERIAL_ECHO((int)e);
SERIAL_ECHOLNPGM(MSG_INVALID_EXTRUDER_NUM);
kill();
return 0.0;
}
@ -1684,17 +1684,17 @@ void Temperature::disable_all_heaters() {
if (max6675_temp & MAX6675_ERROR_MASK) {
SERIAL_ERROR_START();
SERIAL_ERRORPGM("Temp measurement error! ");
SERIAL_ECHOPGM("Temp measurement error! ");
#if MAX6675_ERROR_MASK == 7
SERIAL_ERRORPGM("MAX31855 ");
SERIAL_ECHOPGM("MAX31855 ");
if (max6675_temp & 1)
SERIAL_ERRORLNPGM("Open Circuit");
SERIAL_ECHOLNPGM("Open Circuit");
else if (max6675_temp & 2)
SERIAL_ERRORLNPGM("Short to GND");
SERIAL_ECHOLNPGM("Short to GND");
else if (max6675_temp & 4)
SERIAL_ERRORLNPGM("Short to VCC");
SERIAL_ECHOLNPGM("Short to VCC");
#else
SERIAL_ERRORLNPGM("MAX6675");
SERIAL_ECHOLNPGM("MAX6675");
#endif
// Thermocouple open
@ -2365,8 +2365,8 @@ void Temperature::isr() {
UNUSED(e);
#endif
SERIAL_PROTOCOLCHAR_P(port, ' ');
SERIAL_PROTOCOLCHAR_P(port,
SERIAL_CHAR_P(port, ' ');
SERIAL_CHAR_P(port,
#if HAS_TEMP_CHAMBER && HAS_HEATED_BED && HAS_TEMP_HOTEND
e == -2 ? 'C' : e == -1 ? 'B' : 'T'
#elif HAS_HEATED_BED && HAS_TEMP_HOTEND
@ -2378,14 +2378,14 @@ void Temperature::isr() {
#endif
);
#if HOTENDS > 1
if (e >= 0) SERIAL_PROTOCOLCHAR_P(port, '0' + e);
if (e >= 0) SERIAL_CHAR_P(port, '0' + e);
#endif
SERIAL_PROTOCOLCHAR_P(port, ':');
SERIAL_PROTOCOL_P(port, c);
SERIAL_PROTOCOLPAIR_P(port, " /" , t);
SERIAL_CHAR_P(port, ':');
SERIAL_ECHO_P(port, c);
SERIAL_ECHOPAIR_P(port, " /" , t);
#if ENABLED(SHOW_TEMP_ADC_VALUES)
SERIAL_PROTOCOLPAIR_P(port, " (", r / OVERSAMPLENR);
SERIAL_PROTOCOLCHAR_P(port, ')');
SERIAL_ECHOPAIR_P(port, " (", r / OVERSAMPLENR);
SERIAL_CHAR_P(port, ')');
#endif
delay(2);
}
@ -2435,17 +2435,17 @@ void Temperature::isr() {
, e
);
#endif
SERIAL_PROTOCOLPGM_P(port, " @:");
SERIAL_PROTOCOL_P(port, getHeaterPower(target_extruder));
SERIAL_ECHOPGM_P(port, " @:");
SERIAL_ECHO_P(port, getHeaterPower(target_extruder));
#if HAS_HEATED_BED
SERIAL_PROTOCOLPGM_P(port, " B@:");
SERIAL_PROTOCOL_P(port, getHeaterPower(-1));
SERIAL_ECHOPGM_P(port, " B@:");
SERIAL_ECHO_P(port, getHeaterPower(-1));
#endif
#if HOTENDS > 1
HOTEND_LOOP() {
SERIAL_PROTOCOLPAIR_P(port, " @", e);
SERIAL_PROTOCOLCHAR_P(port, ':');
SERIAL_PROTOCOL_P(port, getHeaterPower(e));
SERIAL_ECHOPAIR_P(port, " @", e);
SERIAL_CHAR_P(port, ':');
SERIAL_ECHO_P(port, getHeaterPower(e));
}
#endif
}
@ -2528,11 +2528,11 @@ void Temperature::isr() {
next_temp_ms = now + 1000UL;
print_heater_states(target_extruder);
#if TEMP_RESIDENCY_TIME > 0
SERIAL_PROTOCOLPGM(" W:");
SERIAL_ECHOPGM(" W:");
if (residency_start_ms)
SERIAL_PROTOCOL(long((((TEMP_RESIDENCY_TIME) * 1000UL) - (now - residency_start_ms)) / 1000UL));
SERIAL_ECHO(long((((TEMP_RESIDENCY_TIME) * 1000UL) - (now - residency_start_ms)) / 1000UL));
else
SERIAL_PROTOCOLCHAR('?');
SERIAL_CHAR('?');
#endif
SERIAL_EOL();
}
@ -2651,11 +2651,11 @@ void Temperature::isr() {
next_temp_ms = now + 1000UL;
print_heater_states(active_extruder);
#if TEMP_BED_RESIDENCY_TIME > 0
SERIAL_PROTOCOLPGM(" W:");
SERIAL_ECHOPGM(" W:");
if (residency_start_ms)
SERIAL_PROTOCOL(long((((TEMP_BED_RESIDENCY_TIME) * 1000UL) - (now - residency_start_ms)) / 1000UL));
SERIAL_ECHO(long((((TEMP_BED_RESIDENCY_TIME) * 1000UL) - (now - residency_start_ms)) / 1000UL));
else
SERIAL_PROTOCOLCHAR('?');
SERIAL_CHAR('?');
#endif
SERIAL_EOL();
}

View file

@ -553,8 +553,7 @@ void tool_change(const uint8_t tmp_extruder, const float fr_mm_s/*=0.0*/, bool n
#endif
if (should_swap) {
if (too_cold) {
SERIAL_ERROR_START();
SERIAL_ERRORLNPGM(MSG_ERR_HOTEND_TOO_COLD);
SERIAL_ERROR_MSG(MSG_ERR_HOTEND_TOO_COLD);
#if ENABLED(SINGLENOZZLE)
active_extruder = tmp_extruder;
return;

View file

@ -140,11 +140,11 @@ inline void report_pin_state_extended(pin_t pin, bool ignore, bool extended = fa
if (pin == 46 || pin == 47) {
if (pin == 46) {
print_input_or_output(GET_OUTPUT(46));
SERIAL_PROTOCOL(READ(46));
SERIAL_ECHO(READ(46));
}
else if (pin == 47) {
print_input_or_output(GET_OUTPUT(47));
SERIAL_PROTOCOL(READ(47));
SERIAL_ECHO(READ(47));
}
}
else
@ -160,14 +160,14 @@ inline void report_pin_state_extended(pin_t pin, bool ignore, bool extended = fa
// because this could interfere with inductive/capacitive
// sensors (high impedance voltage divider) and with PT100 amplifier
print_input_or_output(false);
SERIAL_PROTOCOL(digitalRead_mod(pin));
SERIAL_ECHO(digitalRead_mod(pin));
}
else if (pwm_status(pin)) {
// do nothing
}
else {
print_input_or_output(true);
SERIAL_PROTOCOL(digitalRead_mod(pin));
SERIAL_ECHO(digitalRead_mod(pin));
}
}
if (!multi_name_pin && extended) pwm_details(pin); // report PWM capabilities only on the first pass & only if doing an extended report
@ -193,23 +193,23 @@ inline void report_pin_state_extended(pin_t pin, bool ignore, bool extended = fa
if (extended) {
#if AVR_AT90USB1286_FAMILY //Teensy IDEs don't know about these pins so must use FASTIO
if (pin == 46 || pin == 47) {
SERIAL_PROTOCOL_SP(12);
SERIAL_ECHO_SP(12);
if (pin == 46) {
print_input_or_output(GET_OUTPUT(46));
SERIAL_PROTOCOL(READ(46));
SERIAL_ECHO(READ(46));
}
else {
print_input_or_output(GET_OUTPUT(47));
SERIAL_PROTOCOL(READ(47));
SERIAL_ECHO(READ(47));
}
}
else
#endif
{
if (GET_PINMODE(pin)) {
SERIAL_PROTOCOL_SP(MAX_NAME_LENGTH - 16);
SERIAL_ECHO_SP(MAX_NAME_LENGTH - 16);
print_input_or_output(true);
SERIAL_PROTOCOL(digitalRead_mod(pin));
SERIAL_ECHO(digitalRead_mod(pin));
}
else {
if (IS_ANALOG(pin)) {
@ -221,7 +221,7 @@ inline void report_pin_state_extended(pin_t pin, bool ignore, bool extended = fa
SERIAL_ECHO_SP(MAX_NAME_LENGTH - 16); // add padding if not an analog pin
print_input_or_output(false);
SERIAL_PROTOCOL(digitalRead_mod(pin));
SERIAL_ECHO(digitalRead_mod(pin));
}
//if (!pwm_status(pin)) SERIAL_CHAR(' '); // add padding if it's not a PWM pin
if (extended) pwm_details(pin); // report PWM capabilities only if doing an extended report

View file

@ -905,7 +905,7 @@ int SdBaseFile::peek() {
// print uint8_t with width 2
static void print2u(const uint8_t v) {
if (v < 10) SERIAL_CHAR('0');
SERIAL_ECHO_F(v, DEC);
SERIAL_ECHO(int(v));
}
/**

View file

@ -108,7 +108,7 @@ static inline uint16_t FAT_YEAR(uint16_t fatDate) { return 1980 + (fatDate >> 9)
*
* \return Extracted month [1,12]
*/
static inline uint8_t FAT_MONTH(uint16_t fatDate) { return (fatDate >> 5) & 0XF; }
static inline uint8_t FAT_MONTH(uint16_t fatDate) { return (fatDate >> 5) & 0xF; }
/**
* day part of FAT directory date field

View file

@ -228,10 +228,10 @@ void CardReader::lsDive(const char *prepend, SdFile parent, const char * const m
case LS_SerialPrint:
createFilename(filename, p);
if (prepend) SERIAL_PROTOCOL_P(port, prepend);
SERIAL_PROTOCOL_P(port, filename);
SERIAL_PROTOCOLCHAR_P(port, ' ');
SERIAL_PROTOCOLLN_P(port, p.fileSize);
if (prepend) SERIAL_ECHO_P(port, prepend);
SERIAL_ECHO_P(port, filename);
SERIAL_CHAR_P(port, ' ');
SERIAL_ECHOLN_P(port, p.fileSize);
break;
case LS_GetFilename:
@ -305,8 +305,8 @@ void CardReader::ls(
);
// Print /LongNamePart to serial output
SERIAL_PROTOCOLCHAR_P(port, '/');
SERIAL_PROTOCOL_P(port, longFilename[0] ? longFilename : "???");
SERIAL_CHAR_P(port, '/');
SERIAL_ECHO_P(port, longFilename[0] ? longFilename : "???");
// If the filename was printed then that's it
if (!flag.filenameIsDir) break;
@ -373,21 +373,15 @@ void CardReader::initsd() {
#endif
) {
//if (!sd2card.init(SPI_HALF_SPEED,SDSS))
SERIAL_ECHO_START();
SERIAL_ECHOLNPGM(MSG_SD_INIT_FAIL);
}
else if (!volume.init(&sd2card)) {
SERIAL_ERROR_START();
SERIAL_ERRORLNPGM(MSG_SD_VOL_INIT_FAIL);
}
else if (!root.openRoot(&volume)) {
SERIAL_ERROR_START();
SERIAL_ERRORLNPGM(MSG_SD_OPENROOT_FAIL);
SERIAL_ECHO_MSG(MSG_SD_INIT_FAIL);
}
else if (!volume.init(&sd2card))
SERIAL_ERROR_MSG(MSG_SD_VOL_INIT_FAIL);
else if (!root.openRoot(&volume))
SERIAL_ERROR_MSG(MSG_SD_OPENROOT_FAIL);
else {
flag.cardOK = true;
SERIAL_ECHO_START();
SERIAL_ECHOLNPGM(MSG_SD_CARD_OK);
SERIAL_ECHO_MSG(MSG_SD_CARD_OK);
}
setroot();
}
@ -462,9 +456,7 @@ void CardReader::openFile(char * const path, const bool read, const bool subcall
if (isFileOpen()) { // Replacing current file or doing a subroutine
if (subcall) {
if (file_subcall_ctr > SD_PROCEDURE_DEPTH - 1) {
SERIAL_ERROR_START();
SERIAL_ERRORPGM("trying to call sub-gcode files with too many levels. MAX level is:");
SERIAL_ERRORLN((int)SD_PROCEDURE_DEPTH);
SERIAL_ERROR_MSG("trying to call sub-gcode files with too many levels. MAX level is:" STRINGIFY(SD_PROCEDURE_DEPTH));
kill();
return;
}
@ -482,10 +474,8 @@ void CardReader::openFile(char * const path, const bool read, const bool subcall
else
doing = 1;
}
else if (subcall) { // Returning from a subcall?
SERIAL_ECHO_START();
SERIAL_ECHOLNPGM("END SUBROUTINE");
}
else if (subcall) // Returning from a subcall?
SERIAL_ECHO_MSG("END SUBROUTINE");
else { // Opening fresh file
doing = 2;
file_subcall_ctr = 0; // Reset procedure depth in case user cancels print while in procedure
@ -508,26 +498,26 @@ void CardReader::openFile(char * const path, const bool read, const bool subcall
if (file.open(curDir, fname, O_READ)) {
filesize = file.fileSize();
sdpos = 0;
SERIAL_PROTOCOLPAIR(MSG_SD_FILE_OPENED, fname);
SERIAL_PROTOCOLLNPAIR(MSG_SD_SIZE, filesize);
SERIAL_PROTOCOLLNPGM(MSG_SD_FILE_SELECTED);
SERIAL_ECHOPAIR(MSG_SD_FILE_OPENED, fname);
SERIAL_ECHOLNPAIR(MSG_SD_SIZE, filesize);
SERIAL_ECHOLNPGM(MSG_SD_FILE_SELECTED);
getfilename(0, fname);
ui.set_status(longFilename[0] ? longFilename : fname);
//if (longFilename[0]) {
// SERIAL_PROTOCOLPAIR(MSG_SD_FILE_LONG_NAME, longFilename);
// SERIAL_ECHOPAIR(MSG_SD_FILE_LONG_NAME, longFilename);
//}
}
else {
SERIAL_PROTOCOLPAIR(MSG_SD_OPEN_FILE_FAIL, fname);
SERIAL_PROTOCOLCHAR('.');
SERIAL_ECHOPAIR(MSG_SD_OPEN_FILE_FAIL, fname);
SERIAL_CHAR('.');
SERIAL_EOL();
}
}
else { //write
if (!file.open(curDir, fname, O_CREAT | O_APPEND | O_WRITE | O_TRUNC)) {
SERIAL_PROTOCOLPAIR(MSG_SD_OPEN_FILE_FAIL, fname);
SERIAL_PROTOCOLCHAR('.');
SERIAL_ECHOPAIR(MSG_SD_OPEN_FILE_FAIL, fname);
SERIAL_CHAR('.');
SERIAL_EOL();
}
else {
@ -536,7 +526,7 @@ void CardReader::openFile(char * const path, const bool read, const bool subcall
#if ENABLED(EMERGENCY_PARSER)
emergency_parser.disable();
#endif
SERIAL_PROTOCOLLNPAIR(MSG_SD_WRITE_TO_FILE, fname);
SERIAL_ECHOLNPAIR(MSG_SD_WRITE_TO_FILE, fname);
ui.set_status(fname);
}
}
@ -552,17 +542,15 @@ void CardReader::removeFile(const char * const name) {
if (!fname) return;
if (file.remove(curDir, fname)) {
SERIAL_PROTOCOLPGM("File deleted:");
SERIAL_PROTOCOLLN(fname);
SERIAL_ECHOLNPAIR("File deleted:", fname);
sdpos = 0;
#if ENABLED(SDCARD_SORT_ALPHA)
presort();
#endif
}
else {
SERIAL_PROTOCOLPGM("Deletion failed, File: ");
SERIAL_PROTOCOL(fname);
SERIAL_PROTOCOLCHAR('.');
SERIAL_ECHOPAIR("Deletion failed, File: ", fname);
SERIAL_CHAR('.');
}
}
@ -572,13 +560,13 @@ void CardReader::getStatus(
#endif
) {
if (flag.cardOK && flag.sdprinting) {
SERIAL_PROTOCOLPGM_P(port, MSG_SD_PRINTING_BYTE);
SERIAL_PROTOCOL_P(port, sdpos);
SERIAL_PROTOCOLCHAR_P(port, '/');
SERIAL_PROTOCOLLN_P(port, filesize);
SERIAL_ECHOPGM_P(port, MSG_SD_PRINTING_BYTE);
SERIAL_ECHO_P(port, sdpos);
SERIAL_CHAR_P(port, '/');
SERIAL_ECHOLN_P(port, filesize);
}
else
SERIAL_PROTOCOLLNPGM_P(port, MSG_SD_NOT_PRINTING);
SERIAL_ECHOLNPGM_P(port, MSG_SD_NOT_PRINTING);
}
void CardReader::write_command(char *buf) {
@ -595,10 +583,8 @@ void CardReader::write_command(char *buf) {
end[2] = '\n';
end[3] = '\0';
file.write(begin);
if (file.writeError) {
SERIAL_ERROR_START();
SERIAL_ERRORLNPGM(MSG_SD_ERR_WRITE_TO_FILE);
}
if (file.writeError) SERIAL_ERROR_MSG(MSG_SD_ERR_WRITE_TO_FILE);
}
//
@ -715,8 +701,8 @@ const char* CardReader::diveToFile(SdFile*& curDir, const char * const path, con
if (echo) SERIAL_ECHOLN(dosSubdirname);
if (!myDir.open(curDir, dosSubdirname, O_READ)) {
SERIAL_PROTOCOLPAIR(MSG_SD_OPEN_FILE_FAIL, dosSubdirname);
SERIAL_PROTOCOLCHAR('.');
SERIAL_ECHOPAIR(MSG_SD_OPEN_FILE_FAIL, dosSubdirname);
SERIAL_CHAR('.');
SERIAL_EOL();
return NULL;
}
@ -740,8 +726,7 @@ void CardReader::chdir(const char * relpath) {
}
else {
SERIAL_ECHO_START();
SERIAL_ECHOPGM(MSG_SD_CANT_ENTER_SUBDIR);
SERIAL_ECHOLN(relpath);
SERIAL_ECHOLNPAIR(MSG_SD_CANT_ENTER_SUBDIR, relpath);
}
}
@ -1081,12 +1066,12 @@ void CardReader::printingHasFinished() {
if (!flag.cardOK) return;
if (recovery.file.isOpen()) return;
if (!recovery.file.open(&root, job_recovery_file_name, read ? O_READ : O_CREAT | O_WRITE | O_TRUNC | O_SYNC)) {
SERIAL_PROTOCOLPAIR(MSG_SD_OPEN_FILE_FAIL, job_recovery_file_name);
SERIAL_PROTOCOLCHAR('.');
SERIAL_ECHOPAIR(MSG_SD_OPEN_FILE_FAIL, job_recovery_file_name);
SERIAL_CHAR('.');
SERIAL_EOL();
}
else if (!read)
SERIAL_PROTOCOLLNPAIR(MSG_SD_WRITE_TO_FILE, job_recovery_file_name);
SERIAL_ECHOLNPAIR(MSG_SD_WRITE_TO_FILE, job_recovery_file_name);
}
// Removing the job recovery file currently requires closing
@ -1097,7 +1082,7 @@ void CardReader::printingHasFinished() {
//closefile();
removeFile(job_recovery_file_name);
#if ENABLED(DEBUG_POWER_LOSS_RECOVERY)
SERIAL_PROTOCOLPGM("Power-loss file delete");
SERIAL_ECHOPGM("Power-loss file delete");
serialprintPGM(jobRecoverFileExists() ? PSTR(" failed.\n") : PSTR("d.\n"));
#endif
}