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,11 +409,17 @@ static void pwm_details(uint8_t pin) {
// looking for port B7 - PWMs 0A and 1C
if ( ('B' == digitalPinToPort(pin) + 64) && (0x80 == digitalPinToBitMask(pin))) {
#ifndef TEENSYDUINO_IDE
SERIAL_PROTOCOLPGM("\n . TIMER1C is also tied to this pin ");
timer_prefix(1,'C',4);
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);
#else
SERIAL_PROTOCOLPGM("\n . TIMER0A is also tied to this pin ");
timer_prefix(0,'A',3);
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);
#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;
SERIAL_CHAR(x);
#else
SERIAL_PROTOCOLPGM(" ");
SERIAL_PROTOCOL_SP(10);
#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
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
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);
}
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>");
if (get_pinMode(pin))
SERIAL_PROTOCOLPAIR(" Output = ", digitalRead_mod(pin));
if (get_pinMode(pin)) {
SERIAL_PROTOCOL_SP(12);
SERIAL_PROTOCOLPAIR("Output = ", digitalRead_mod(pin));
}
else {
if (IS_ANALOG(pin)) {
sprintf(buffer, " Analog in = %5d", analogRead(pin - analogInputToDigitalPin(0)));
SERIAL_ECHO(buffer);
}
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));
}

View File

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