mirror of
https://github.com/lumapu/ahoy.git
synced 2025-05-22 05:16:11 +02:00
improve pixelshift screensaver
(cherry picked from commit 9eaa369147430c7d8c94830f325192e8f2e81853)
This commit is contained in:
parent
9647044e49
commit
0a6437bf10
4 changed files with 54 additions and 43 deletions
|
@ -78,6 +78,7 @@ class DisplayMono {
|
|||
uint8_t mLineYOffsets[5] = {};
|
||||
|
||||
uint8_t mExtra;
|
||||
int8_t mPixelshift=0;
|
||||
uint32_t mStarttime = millis();
|
||||
bool mDisplayActive = true; // always start with display on
|
||||
char mFmtText[DISP_FMT_TEXT_LEN];
|
||||
|
@ -94,6 +95,11 @@ class DisplayMono {
|
|||
mDispWidth = mDisplay->getDisplayWidth();
|
||||
mDispHeight = mDisplay->getDisplayHeight();
|
||||
}
|
||||
|
||||
void calcPixelShift(int range) {
|
||||
int8_t mod = (millis() / 10000) % ((range >> 1) << 2);
|
||||
mPixelshift = mScreenSaver == 1 ? ((mod < range) ? mod - (range >> 1) : -(mod - range - (range >> 1) + 1)) : 0;
|
||||
}
|
||||
};
|
||||
|
||||
/* adapted 5x8 Font for low-res displays with symbols
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue