Animation non block (#1347)
* Buttons cancel animation * Button cancels transition * Update OLED.cpp
This commit is contained in:
@@ -5,6 +5,7 @@
|
|||||||
* Author: Ben V. Brown
|
* Author: Ben V. Brown
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include "Buttons.hpp"
|
||||||
#include "Translation.h"
|
#include "Translation.h"
|
||||||
#include "cmsis_os.h"
|
#include "cmsis_os.h"
|
||||||
#include "configuration.h"
|
#include "configuration.h"
|
||||||
@@ -285,7 +286,10 @@ void OLED::transitionSecondaryFramebuffer(bool forwardNavigation) {
|
|||||||
memmove(&secondStripPtr[newStart], &secondBackStripPtr[newEnd], progress);
|
memmove(&secondStripPtr[newStart], &secondBackStripPtr[newEnd], progress);
|
||||||
|
|
||||||
refresh();
|
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.
|
// Scroll the screen by changing display start line.
|
||||||
for (uint8_t current = startLine; current <= scrollTo; current++) {
|
for (uint8_t current = startLine; current <= scrollTo; current++) {
|
||||||
|
if (getButtonState() != BUTTON_NONE) {
|
||||||
|
current = scrollTo;
|
||||||
|
}
|
||||||
|
|
||||||
// Set display start line (0x40~0x7F):
|
// Set display start line (0x40~0x7F):
|
||||||
// X[5:0] - display start line value
|
// X[5:0] - display start line value
|
||||||
uint8_t scrollCommandByte = 0b01000000 | (current & 0b00111111);
|
uint8_t scrollCommandByte = 0b01000000 | (current & 0b00111111);
|
||||||
@@ -332,7 +340,7 @@ void OLED::transitionScrollDown() {
|
|||||||
OLED_Setup_Array[8].val = scrollCommandByte;
|
OLED_Setup_Array[8].val = scrollCommandByte;
|
||||||
|
|
||||||
I2C_CLASS::I2C_RegisterWrite(DEVICEADDR_OLED, 0x80, scrollCommandByte);
|
I2C_CLASS::I2C_RegisterWrite(DEVICEADDR_OLED, 0x80, scrollCommandByte);
|
||||||
osDelay(TICKS_100MS / 5);
|
osDelay(TICKS_100MS / 7);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user