Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions Marlin/src/HAL/HAL_AVR/persistent_store_eeprom.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
Expand Down
68 changes: 34 additions & 34 deletions Marlin/src/HAL/HAL_AVR/pinsDebug.h
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ static bool pwm_status(uint8_t pin) {
default:
return false;
}
SERIAL_PROTOCOL_SP(2);
SERIAL_ECHO_SP(2);
} // pwm_status


Expand Down Expand Up @@ -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;
}
}
Expand All @@ -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');
Expand All @@ -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(); }
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
}

Expand Down
3 changes: 1 addition & 2 deletions Marlin/src/HAL/HAL_AVR/watchdog_AVR.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions Marlin/src/HAL/HAL_DUE/EepromEmulation_Due.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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];
}
}
Expand Down
3 changes: 1 addition & 2 deletions Marlin/src/HAL/HAL_DUE/persistent_store_eeprom.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
Expand Down
2 changes: 1 addition & 1 deletion Marlin/src/HAL/HAL_DUE/pinsDebug.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}

Expand Down
4 changes: 2 additions & 2 deletions Marlin/src/HAL/HAL_DUE/usb/sd_mmc_spi_mem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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))
Expand Down
22 changes: 11 additions & 11 deletions Marlin/src/HAL/HAL_LPC1768/persistent_store_sdcard.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 1 addition & 2 deletions Marlin/src/HAL/HAL_STM32/persistent_store_impl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
Expand Down
3 changes: 1 addition & 2 deletions Marlin/src/HAL/HAL_STM32F4/persistent_store_eeprom.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
Expand Down
3 changes: 1 addition & 2 deletions Marlin/src/HAL/HAL_STM32F7/persistent_store_eeprom.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
Expand Down
3 changes: 1 addition & 2 deletions Marlin/src/HAL/HAL_TEENSY31_32/persistent_store_impl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
Expand Down
3 changes: 1 addition & 2 deletions Marlin/src/HAL/HAL_TEENSY35_36/persistent_store_eeprom.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
Expand Down
3 changes: 1 addition & 2 deletions Marlin/src/HAL/HAL_TEENSY35_36/persistent_store_impl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
Expand Down
2 changes: 1 addition & 1 deletion Marlin/src/HAL/HAL_TEENSY35_36/pinsDebug.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 */ }
Expand Down
3 changes: 1 addition & 2 deletions Marlin/src/HAL/shared/backtrace/backtrace.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
17 changes: 6 additions & 11 deletions Marlin/src/Marlin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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));
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -745,7 +741,7 @@ void setup() {
#endif
#endif

SERIAL_PROTOCOLLNPGM("start");
SERIAL_ECHOLNPGM("start");
SERIAL_ECHO_START();

#if TMC_HAS_SPI
Expand Down Expand Up @@ -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();
Expand Down
Loading