From 455b07eb6eb966266952d82c107c5829f116be8a Mon Sep 17 00:00:00 2001 From: Markus Hitter Date: Sun, 24 Apr 2016 23:48:32 +0200 Subject: [PATCH] display_ssd1306.c: read symbol index only once. Saves just 2 bytes, but more than nothing. --- display_ssd1306.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/display_ssd1306.c b/display_ssd1306.c index 8f432cb..97f5553 100644 --- a/display_ssd1306.c +++ b/display_ssd1306.c @@ -81,7 +81,7 @@ void display_clear(void) { Prints the text at a given position. */ void display_text_P(uint8_t line, uint8_t column, PGM_P message) { - uint8_t i; + uint8_t i, index; // Enter command mode. displaybus_write(0x00, 0); @@ -93,8 +93,8 @@ void display_text_P(uint8_t line, uint8_t column, PGM_P message) { // Render text to bitmap to display. displaybus_write(0x40, 0); - while (pgm_read_byte(message)) { - uint8_t index = pgm_read_byte(message) - 0x20; + while ((index = pgm_read_byte(message))) { + index -= 0x20; // Send the character bitmap. for (i = 0; i < pgm_read_byte(&font[index].columns); i++) {