display_ssd1306.c: read symbol index only once.

Saves just 2 bytes, but more than nothing.
This commit is contained in:
Markus Hitter 2016-04-24 23:48:32 +02:00
parent e3fd9eaea7
commit 455b07eb6e
1 changed files with 3 additions and 3 deletions

View File

@ -81,7 +81,7 @@ void display_clear(void) {
Prints the text at a given position. Prints the text at a given position.
*/ */
void display_text_P(uint8_t line, uint8_t column, PGM_P message) { void display_text_P(uint8_t line, uint8_t column, PGM_P message) {
uint8_t i; uint8_t i, index;
// Enter command mode. // Enter command mode.
displaybus_write(0x00, 0); 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. // Render text to bitmap to display.
displaybus_write(0x40, 0); displaybus_write(0x40, 0);
while (pgm_read_byte(message)) { while ((index = pgm_read_byte(message))) {
uint8_t index = pgm_read_byte(message) - 0x20; index -= 0x20;
// Send the character bitmap. // Send the character bitmap.
for (i = 0; i < pgm_read_byte(&font[index].columns); i++) { for (i = 0; i < pgm_read_byte(&font[index].columns); i++) {