ledmatrix.cpp small code sanitization
This commit is contained in:
parent
012bf545c4
commit
43cf6b7fe5
@ -13,6 +13,6 @@ void refreshTheMatrixDisplay(bool nextPage = false);
|
|||||||
void DrawNumber(String strNum, uint8_t iDotPos = 0);
|
void DrawNumber(String strNum, uint8_t iDotPos = 0);
|
||||||
uint8_t GetCharFromFont(char cChar);
|
uint8_t GetCharFromFont(char cChar);
|
||||||
uint8_t GetCharWidth(char cChar);
|
uint8_t GetCharWidth(char cChar);
|
||||||
void ScrollLeft(uint8_t *buf, uint16_t cols, uint16_t rows);
|
void ScrollLeft(uint8_t *buf, const uint16_t cols, const uint16_t rows);
|
||||||
|
|
||||||
#endif
|
#endif
|
@ -204,13 +204,14 @@ uint8_t GetCharWidth(char cChar) {
|
|||||||
return CharDescriptor.width;
|
return CharDescriptor.width;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ScrollLeft(uint8_t *buf, uint16_t cols, uint16_t rows) {
|
void ScrollLeft(uint8_t *buf, const uint16_t cols, const uint16_t rows) {
|
||||||
uint32_t i, k, idx;
|
uint32_t i, k, idx;
|
||||||
|
const uint32_t x = cols / 8;
|
||||||
|
|
||||||
for (k = 0; k < rows; k++) {
|
for (k = 0; k < rows; k++) {
|
||||||
// scroll a line with x bytes one dot to the left
|
// scroll a line with x bytes one dot to the left
|
||||||
for (i = 0; i < cols / 8 - 1; ++i) {
|
for (i = 0; i < x - 1; ++i) {
|
||||||
idx = i + k * cols / 8;
|
idx = i + k * x;
|
||||||
buf[idx] = (buf[idx] << 1) | ((buf[idx + 1] >> 7) & 1);
|
buf[idx] = (buf[idx] << 1) | ((buf[idx + 1] >> 7) & 1);
|
||||||
}
|
}
|
||||||
buf[idx + 1] <<= 1;
|
buf[idx + 1] <<= 1;
|
||||||
|
Loading…
Reference in New Issue
Block a user