From 4154eb907b76d8d525612376b36527f920a29594 Mon Sep 17 00:00:00 2001 From: Hendrik Langer Date: Fri, 6 Apr 2018 15:53:39 +0200 Subject: [PATCH] remove stupid scrolling --- src/screen.cpp | 28 ++++++++++------------------ 1 file changed, 10 insertions(+), 18 deletions(-) diff --git a/src/screen.cpp b/src/screen.cpp index 02de86c..18ac8b9 100644 --- a/src/screen.cpp +++ b/src/screen.cpp @@ -289,25 +289,17 @@ void MainScreen::draw() { u8g2_uint_t width = u8g2.getUTF8Width(titleStr); // calculate the pixel width of the text if (width > u8g2.getDisplayWidth()) { - u8g2_uint_t x = titleStr_offset; - do { // repeated drawing of the scrolling text... - u8g2.drawUTF8(x, 54, titleStr); // draw the scolling text - x += width; // add the pixel width of the scrolling text - } while( x < u8g2.getDisplayWidth() ); // draw again until the complete display is filled + u8g2.drawUTF8(titleStr_offset, 54, titleStr); // draw the scolling text - // repeated drawing of the scrolling text... - - titleStr_offset-=2; // scroll by one pixel - if ( (u8g2_uint_t)titleStr_offset < (u8g2_uint_t)-width ) - titleStr_offset = 0; // start over again - - } else { // don't scroll - u8g2.drawUTF8((u8g2.getDisplayWidth()-width)/2, 54, titleStr); - } - uint32_t buffFill = mp3.getBuffFill(); - if (buffFill > 0 && buffFill <= 100) { - u8g2.drawLine(10,60,10+buffFill,60); - } + titleStr_offset-=4; // scroll by one pixel + + } else { // don't scroll + u8g2.drawUTF8((u8g2.getDisplayWidth()-width)/2, 54, titleStr); + } + uint32_t buffFill = mp3.getBuffFill(); + if (buffFill > 0 && buffFill <= 100) { + u8g2.drawLine(10,60,10+buffFill,60); + } } u8g2.sendBuffer(); // bme280.printValues();