Move the condition before the loop

Result see: https://youtu.be/AEnBzdu9_tk
Dot is moving not so fast -> less executed loops.
This commit is contained in:
AnHardt 2015-04-04 17:49:39 +02:00
parent 4cb7dfc546
commit 6d4b3f0d6a

View file

@ -1363,16 +1363,18 @@ void lcd_update() {
#ifdef DOGLCD // Changes due to different driver architecture of the DOGM display #ifdef DOGLCD // Changes due to different driver architecture of the DOGM display
blink++; // Variable for fan animation and alive dot blink++; // Variable for fan animation and alive dot
u8g.firstPage(); u8g.firstPage();
do { (*currentMenu)();
if (!dotcounter) dotcounter = 63; if (lcdDrawUpdate) {
lcd_setFont(FONT_MENU); do {
u8g.setPrintPos(125, 0); if (!dotcounter) dotcounter = 63;
// if (blink % 2) u8g.setColorIndex(1); else u8g.setColorIndex(0); // Set color for the alive dot lcd_setFont(FONT_MENU);
u8g.drawPixel(127, dotcounter--); // draw alive dot u8g.setPrintPos(125, 0);
// u8g.setColorIndex(1); // black on white // if (blink % 2) u8g.setColorIndex(1); else u8g.setColorIndex(0); // Set color for the alive dot
(*currentMenu)(); u8g.drawPixel(127, dotcounter--); // draw alive dot
if (!lcdDrawUpdate) break; // Terminate display update, when nothing new to draw. This must be done before the last dogm.next() // u8g.setColorIndex(1); // black on white
} while( u8g.nextPage() ); (*currentMenu)();
} while( u8g.nextPage() );
}
#else #else
(*currentMenu)(); (*currentMenu)();
#endif #endif