1
0
forked from me/IronOS

Animation non block (#1347)

* Buttons cancel animation

* Button cancels transition

* Update OLED.cpp
This commit is contained in:
Ben V. Brown
2022-08-12 10:36:10 +10:00
committed by GitHub
parent e43449011e
commit 7fcd2b7c5b

View File

@@ -5,6 +5,7 @@
* Author: Ben V. Brown
*/
#include "Buttons.hpp"
#include "Translation.h"
#include "cmsis_os.h"
#include "configuration.h"
@@ -285,7 +286,10 @@ void OLED::transitionSecondaryFramebuffer(bool forwardNavigation) {
memmove(&secondStripPtr[newStart], &secondBackStripPtr[newEnd], progress);
refresh();
osDelay(TICKS_100MS / 5);
osDelay(TICKS_100MS / 7);
if (getButtonState() != BUTTON_NONE) {
return;
}
}
}
@@ -324,6 +328,10 @@ void OLED::transitionScrollDown() {
// Scroll the screen by changing display start line.
for (uint8_t current = startLine; current <= scrollTo; current++) {
if (getButtonState() != BUTTON_NONE) {
current = scrollTo;
}
// Set display start line (0x40~0x7F):
// X[5:0] - display start line value
uint8_t scrollCommandByte = 0b01000000 | (current & 0b00111111);
@@ -332,7 +340,7 @@ void OLED::transitionScrollDown() {
OLED_Setup_Array[8].val = scrollCommandByte;
I2C_CLASS::I2C_RegisterWrite(DEVICEADDR_OLED, 0x80, scrollCommandByte);
osDelay(TICKS_100MS / 5);
osDelay(TICKS_100MS / 7);
}
}