From 7661170957df45c954fbdbc8d24cb9542986cf27 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?King=20K=C3=A9vin?= Date: Tue, 26 Jan 2016 10:16:14 +0100 Subject: [PATCH] vfd has how two lines --- main.c | 26 ++++++++++++++++++++------ 1 file changed, 20 insertions(+), 6 deletions(-) diff --git a/main.c b/main.c index 06e0e42..5bbebb2 100644 --- a/main.c +++ b/main.c @@ -123,6 +123,7 @@ int main(void) uint8_t vfd_place = 0; // the place on which the next character will be displayed on the VFD bool vfd_flag = false; // do something with the VFD char c = 0; // the character to display + char previous_line[VFD_DIGITS] = {0}; while (true) { while (usart_received) { // echo every received character c = usart_getchar(); @@ -136,13 +137,26 @@ int main(void) vfd_flag = false; printf("%c", c); // transmit receive character gpio_toggle(LED_PORT, LED_PIN); // toggle LED to show activity - if (c=='\r' || c=='\n') { // on newline - vfd_clear(); // clear display - vfd_place = 0; // restart from beginning + if (c=='\r' || c=='\n') { // on (new) newline + if (vfd_place>0) { // only on new newline + vfd_clear(); // clear display + vfd_place = 0; // restart from beginning + // show previous line on digits (and clear it + for (uint8_t i=0; i