A single SERIAL_ECHO macro type (#12557)
This commit is contained in:
@ -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;
|
||||
}
|
||||
}
|
||||
|
@ -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
|
||||
}
|
||||
|
||||
|
@ -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
|
||||
|
@ -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];
|
||||
}
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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))
|
||||
|
@ -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
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
@ -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 */ }
|
||||
|
@ -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);
|
||||
}
|
||||
|
Reference in New Issue
Block a user