Browse Source

remove stupid scrolling

main
Hendrik Langer 6 years ago
parent
commit
4154eb907b
  1. 28
      src/screen.cpp

28
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();

Loading…
Cancel
Save