Skip to content

Commit

Permalink
Allow button press to skip scroll
Browse files Browse the repository at this point in the history
  • Loading branch information
Ralim committed Jun 18, 2023
1 parent ae5d57d commit 63a866d
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions source/Core/Drivers/OLED.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ static uint8_t easeInOutTiming(uint8_t t) { return t * t * (300 - 2 * t) / 10000
* @param b The value associated with 100%
* @param t The percentage [0..<100]
*/
static uint8_t lerp(uint8_t a, uint8_t b, uint8_t t) { return a + t * (b - a) / 100; }
static uint16_t lerp(uint16_t a, uint16_t b, uint16_t t) { return a + t * (b - a) / 100; }

void OLED::initialize() {
cursor_x = cursor_y = 0;
Expand Down Expand Up @@ -367,9 +367,14 @@ void OLED::transitionScrollDown() {
secondFrameBuffer[secondStripPos] >>= 1;
#endif
}

if (getButtonState() != BUTTON_NONE) {
// Exit early, but have to transition whole buffer
memcpy(screenBuffer + FRAMEBUFFER_START, secondFrameBuffer + FRAMEBUFFER_START, sizeof(screenBuffer) - FRAMEBUFFER_START);
refresh(); // Now refresh to write out the contents to the new page
return;
}
refresh(); // Now refresh to write out the contents to the new page
osDelay(TICKS_100MS / 5);
osDelay(TICKS_100MS / 7);
}
}

Expand Down

0 comments on commit 63a866d

Please sign in to comment.