mirror of
https://github.com/DCC-EX/CommandStation-EX.git
synced 2024-11-30 11:36:13 +01:00
Bugfix Scroll LCD without empty lines and consistent
This commit is contained in:
parent
3d35e78533
commit
278347756a
64
Display.cpp
64
Display.cpp
|
@ -129,9 +129,19 @@ Display *Display::loop2(bool force) {
|
||||||
// No non-blank lines left, so draw a blank line
|
// No non-blank lines left, so draw a blank line
|
||||||
buffer[0] = 0;
|
buffer[0] = 0;
|
||||||
}
|
}
|
||||||
|
#if SCROLLMODE==2
|
||||||
|
if (buffer[0] == 0 && needScroll){ // surpresses empty line
|
||||||
|
#else
|
||||||
|
if (false){
|
||||||
|
#endif
|
||||||
|
charIndex = MAX_CHARACTER_COLS;
|
||||||
|
slot--;
|
||||||
|
} else {
|
||||||
_deviceDriver->setRowNative(slot); // Set position for display
|
_deviceDriver->setRowNative(slot); // Set position for display
|
||||||
charIndex = 0;
|
charIndex = 0;
|
||||||
bufferPointer = &buffer[0];
|
bufferPointer = &buffer[0];
|
||||||
|
}
|
||||||
|
rowNext++;
|
||||||
} else {
|
} else {
|
||||||
// Write next character, or a space to erase current position.
|
// Write next character, or a space to erase current position.
|
||||||
char ch = *bufferPointer;
|
char ch = *bufferPointer;
|
||||||
|
@ -141,6 +151,7 @@ Display *Display::loop2(bool force) {
|
||||||
} else {
|
} else {
|
||||||
_deviceDriver->writeNative(' ');
|
_deviceDriver->writeNative(' ');
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (++charIndex >= MAX_CHARACTER_COLS) {
|
if (++charIndex >= MAX_CHARACTER_COLS) {
|
||||||
// Screen slot completed, move to next slot on screen
|
// Screen slot completed, move to next slot on screen
|
||||||
|
@ -148,20 +159,46 @@ Display *Display::loop2(bool force) {
|
||||||
slot++;
|
slot++;
|
||||||
if (slot >= numCharacterRows) {
|
if (slot >= numCharacterRows) {
|
||||||
// Last slot on screen written, reset ready for next screen update.
|
// Last slot on screen written, reset ready for next screen update.
|
||||||
#if SCROLLMODE==2
|
#if SCROLLMODE==2 || SCROLLMODE==1
|
||||||
if (!noMoreRowsToDisplay) {
|
if (!noMoreRowsToDisplay) {
|
||||||
// On next refresh, restart one row on from previous start.
|
needScroll = true;
|
||||||
rowNext = rowFirst;
|
|
||||||
findNextNonBlankRow();
|
|
||||||
}
|
}
|
||||||
|
if (needScroll) {
|
||||||
|
#if SCROLLMODE==2
|
||||||
|
// SCROLLMODE 2 rotates through rowFirst and we
|
||||||
|
// (ab)use findNextBlankRow() to figure out
|
||||||
|
// next valid row which can be start row.
|
||||||
|
rowNext = rowFirst + 1;
|
||||||
|
noMoreRowsToDisplay = false;
|
||||||
|
findNextNonBlankRow();
|
||||||
|
if (rowNext == ROW_INITIAL)
|
||||||
|
rowNext = 0;
|
||||||
|
rowFirst = ROW_INITIAL;
|
||||||
|
#else
|
||||||
|
// SCROLLMODE 1 just alternates when the
|
||||||
|
// flag indicates that we have come to the end
|
||||||
|
if (noMoreRowsToDisplay)
|
||||||
|
rowNext = 0;
|
||||||
#endif
|
#endif
|
||||||
|
} else {
|
||||||
|
// SCROLLMODE 1 or 2 but not scroll active
|
||||||
|
rowNext = 0;
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
// this is for SCROLLMODE 0 but what should it do?
|
||||||
|
rowNext = 0;
|
||||||
|
#endif
|
||||||
|
rowFirst = ROW_INITIAL;
|
||||||
|
|
||||||
noMoreRowsToDisplay = false;
|
noMoreRowsToDisplay = false;
|
||||||
slot = 0;
|
slot = 0;
|
||||||
rowFirst = ROW_INITIAL;
|
|
||||||
lastScrollTime = currentMillis;
|
lastScrollTime = currentMillis;
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
}
|
#if SCROLLMODE==2
|
||||||
|
if (needScroll)
|
||||||
|
noMoreRowsToDisplay = false;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
} while (force);
|
} while (force);
|
||||||
|
|
||||||
|
@ -172,28 +209,19 @@ bool Display::findNextNonBlankRow() {
|
||||||
while (!noMoreRowsToDisplay) {
|
while (!noMoreRowsToDisplay) {
|
||||||
if (rowNext == ROW_INITIAL)
|
if (rowNext == ROW_INITIAL)
|
||||||
rowNext = 0;
|
rowNext = 0;
|
||||||
else
|
|
||||||
rowNext = rowNext + 1;
|
|
||||||
#if SCROLLMODE == 1
|
|
||||||
if (rowNext >= MAX_CHARACTER_ROWS) {
|
if (rowNext >= MAX_CHARACTER_ROWS) {
|
||||||
// Finished if we've looped back to start
|
// Finished if we've looped back to start
|
||||||
rowNext = ROW_INITIAL;
|
rowNext = ROW_INITIAL;
|
||||||
noMoreRowsToDisplay = true;
|
noMoreRowsToDisplay = true;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
#else
|
|
||||||
if (rowNext >= MAX_CHARACTER_ROWS)
|
|
||||||
rowNext = 0;
|
|
||||||
if (rowNext == rowFirst) {
|
|
||||||
// Finished if we're back to the first one shown
|
|
||||||
noMoreRowsToDisplay = true;
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
if (rowBuffer[rowNext][0] != 0) {
|
if (rowBuffer[rowNext][0] != 0) {
|
||||||
|
//rowBuffer[rowNext][0] = '0' + rowNext; // usefull for debug
|
||||||
|
//rowBuffer[rowNext][1] = '0' + rowFirst; // usefull for debug
|
||||||
// Found non-blank row
|
// Found non-blank row
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
rowNext = rowNext + 1;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -56,6 +56,7 @@ private:
|
||||||
char buffer[MAX_CHARACTER_COLS + 1];
|
char buffer[MAX_CHARACTER_COLS + 1];
|
||||||
char* bufferPointer = 0;
|
char* bufferPointer = 0;
|
||||||
bool noMoreRowsToDisplay = false;
|
bool noMoreRowsToDisplay = false;
|
||||||
|
bool needScroll = false;
|
||||||
uint16_t numCharacterRows;
|
uint16_t numCharacterRows;
|
||||||
uint16_t numCharacterColumns = MAX_CHARACTER_COLS;
|
uint16_t numCharacterColumns = MAX_CHARACTER_COLS;
|
||||||
|
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
#define GITHUB_SHA "devel-202303141949Z"
|
#define GITHUB_SHA "devel-202303151539Z"
|
||||||
|
|
|
@ -4,7 +4,8 @@
|
||||||
#include "StringFormatter.h"
|
#include "StringFormatter.h"
|
||||||
|
|
||||||
|
|
||||||
#define VERSION "4.2.28"
|
#define VERSION "4.2.29"
|
||||||
|
// 4.2.29 - Bugfix Scroll LCD without empty lines and consistent
|
||||||
// 4.2.28 - Reinstate use of timer11 in STM32 - remove HA mode.
|
// 4.2.28 - Reinstate use of timer11 in STM32 - remove HA mode.
|
||||||
// - Update IO_DFPlayer to work with MP3-TF-16P rev3.
|
// - Update IO_DFPlayer to work with MP3-TF-16P rev3.
|
||||||
// 4.2.27 - Bugfix LCD showed random characters in SCROLLMODE 2
|
// 4.2.27 - Bugfix LCD showed random characters in SCROLLMODE 2
|
||||||
|
|
Loading…
Reference in New Issue
Block a user