Use new serial spacing function to save PROGMEM

This commit is contained in:
Scott Lahteine 2017-04-30 18:36:40 -05:00
parent cd72901fb7
commit 42824b0e1f
2 changed files with 25 additions and 13 deletions

View file

@ -409,10 +409,16 @@ static void pwm_details(uint8_t pin) {
// looking for port B7 - PWMs 0A and 1C // looking for port B7 - PWMs 0A and 1C
if ( ('B' == digitalPinToPort(pin) + 64) && (0x80 == digitalPinToBitMask(pin))) { if ( ('B' == digitalPinToPort(pin) + 64) && (0x80 == digitalPinToBitMask(pin))) {
#ifndef TEENSYDUINO_IDE #ifndef TEENSYDUINO_IDE
SERIAL_PROTOCOLPGM("\n . TIMER1C is also tied to this pin "); SERIAL_PROTOCOLPGM("\n .");
SERIAL_PROTOCOL_SP(18);
SERIAL_PROTOCOLPGM("TIMER1C is also tied to this pin");
SERIAL_PROTOCOL_SP(13);
timer_prefix(1, 'C', 4); timer_prefix(1, 'C', 4);
#else #else
SERIAL_PROTOCOLPGM("\n . TIMER0A is also tied to this pin "); SERIAL_PROTOCOLPGM("\n .");
SERIAL_PROTOCOL_SP(18);
SERIAL_PROTOCOLPGM("TIMER0A is also tied to this pin");
SERIAL_PROTOCOL_SP(13);
timer_prefix(0, 'A', 3); timer_prefix(0, 'A', 3);
#endif #endif
} }
@ -437,7 +443,7 @@ void print_port(int8_t pin) { // print port number
for (x = '0'; x < '9' && temp != 1; x++) temp >>= 1; for (x = '0'; x < '9' && temp != 1; x++) temp >>= 1;
SERIAL_CHAR(x); SERIAL_CHAR(x);
#else #else
SERIAL_PROTOCOLPGM(" "); SERIAL_PROTOCOL_SP(10);
#endif #endif
} }
@ -460,7 +466,11 @@ inline void report_pin_state_extended(int8_t pin, bool ignore, bool extended = t
sprintf(buffer, " (A%2d) ", int(pin - analogInputToDigitalPin(0))); // analog pin number sprintf(buffer, " (A%2d) ", int(pin - analogInputToDigitalPin(0))); // analog pin number
SERIAL_ECHO(buffer); SERIAL_ECHO(buffer);
} }
else SERIAL_ECHOPGM(" "); // add padding if not an analog pin else SERIAL_ECHO_SP(8); // add padding if not an analog pin
}
else {
SERIAL_CHAR('.');
SERIAL_ECHO_SP(25); // add padding if not the first instance found
} }
else SERIAL_ECHOPGM(". "); // add padding if not the first instance found else SERIAL_ECHOPGM(". "); // add padding if not the first instance found
name_mem_pointer = (char*) pgm_read_word(&pin_array[x][0]); name_mem_pointer = (char*) pgm_read_word(&pin_array[x][0]);
@ -506,17 +516,19 @@ inline void report_pin_state_extended(int8_t pin, bool ignore, bool extended = t
SERIAL_ECHO(buffer); SERIAL_ECHO(buffer);
} }
else else
SERIAL_ECHOPGM(" "); // add padding if not an analog pin SERIAL_ECHO_SP(8); // add padding if not an analog pin
SERIAL_ECHOPGM("<unused/unknown>"); SERIAL_ECHOPGM("<unused/unknown>");
if (get_pinMode(pin)) if (get_pinMode(pin)) {
SERIAL_PROTOCOL_SP(12);
SERIAL_PROTOCOLPAIR("Output = ", digitalRead_mod(pin)); SERIAL_PROTOCOLPAIR("Output = ", digitalRead_mod(pin));
}
else { else {
if (IS_ANALOG(pin)) { if (IS_ANALOG(pin)) {
sprintf(buffer, " Analog in = %5d", analogRead(pin - analogInputToDigitalPin(0))); sprintf(buffer, " Analog in = %5d", analogRead(pin - analogInputToDigitalPin(0)));
SERIAL_ECHO(buffer); SERIAL_ECHO(buffer);
} }
else else
SERIAL_ECHOPGM(" "); // add padding if not an analog pin SERIAL_ECHO_SP(9); // add padding if not an analog pin
SERIAL_PROTOCOLPAIR(" Input = ", digitalRead_mod(pin)); SERIAL_PROTOCOLPAIR(" Input = ", digitalRead_mod(pin));
} }

View file

@ -52,7 +52,7 @@
static void serial_echo_12x_spaces() { static void serial_echo_12x_spaces() {
for (uint8_t i = GRID_MAX_POINTS_X - 1; --i;) { for (uint8_t i = GRID_MAX_POINTS_X - 1; --i;) {
SERIAL_ECHOPGM(" "); SERIAL_ECHO_SP(12);
safe_delay(10); safe_delay(10);
} }
} }
@ -201,12 +201,12 @@
if (map0) { if (map0) {
serial_echo_xy(UBL_MESH_MIN_X, UBL_MESH_MIN_Y); serial_echo_xy(UBL_MESH_MIN_X, UBL_MESH_MIN_Y);
SERIAL_ECHOPGM(" "); SERIAL_ECHO_SP(4);
serial_echo_12x_spaces(); serial_echo_12x_spaces();
serial_echo_xy(UBL_MESH_MAX_X, UBL_MESH_MIN_Y); serial_echo_xy(UBL_MESH_MAX_X, UBL_MESH_MIN_Y);
SERIAL_EOL; SERIAL_EOL;
serial_echo_xy(0, 0); serial_echo_xy(0, 0);
SERIAL_ECHOPGM(" "); SERIAL_ECHO_SP(7);
serial_echo_12x_spaces(); serial_echo_12x_spaces();
serial_echo_xy(GRID_MAX_POINTS_X - 1, 0); serial_echo_xy(GRID_MAX_POINTS_X - 1, 0);
SERIAL_EOL; SERIAL_EOL;