diff --git a/LCDDisplay.cpp b/LCDDisplay.cpp index 45dda6d..e0c4d87 100644 --- a/LCDDisplay.cpp +++ b/LCDDisplay.cpp @@ -46,20 +46,13 @@ size_t LCDDisplay::write(uint8_t b) { LCDDisplay *LCDDisplay::loop2(bool force) { - static int rowFirst = -1; - static int rowNext = 0; - static int charIndex = 0; - static char buffer[MAX_LCD_COLS+1]; - static char *bptr = 0; - static bool done = false; - unsigned long currentMillis = millis(); if ((!force) && (currentMillis - lastScrollTime) < LCD_SCROLL_TIME) return NULL; do { - if (bptr == 0) { + if (bufferPointer == 0) { // Find a line of data to write to the screen. if (!done) { if (rowFirst < 0) rowFirst = rowNext; @@ -74,26 +67,26 @@ LCDDisplay *LCDDisplay::loop2(bool force) } if (!done) { // Non-blank line found, so copy it. - for (int i=0; i= MAX_LCD_COLS) { // Screen slot completed, move to next one slot++; - bptr = 0; + bufferPointer = 0; if (!done) { rowNext = (rowNext + 1) % MAX_LCD_ROWS; if (rowNext == rowFirst) done = true; diff --git a/LCDDisplay.h b/LCDDisplay.h index 128b840..d667dcd 100644 --- a/LCDDisplay.h +++ b/LCDDisplay.h @@ -52,12 +52,19 @@ class LCDDisplay : public Print { void writeNative(char b); unsigned long lastScrollTime=0; - int hotRow=0; - int hotCol=0; - int topRow=0; - int lcdRows; - int lcdCols; - int slot=0; + int8_t hotRow=0; + int8_t hotCol=0; + int8_t topRow=0; + int8_t lcdRows; + int8_t lcdCols; + int8_t slot=0; + int8_t rowFirst=-1; + int8_t rowNext=0; + int8_t charIndex = 0; + char buffer[MAX_LCD_COLS+1]; + char *bufferPointer = 0; + bool done = false; + void renderRow(byte row); char rowBuffer[MAX_LCD_ROWS][MAX_LCD_COLS+1]; };