aboutsummaryrefslogtreecommitdiffhomepage
path: root/source
diff options
context:
space:
mode:
authorBen V. Brown <[email protected]>2023-06-19 17:12:51 +1000
committerBen V. Brown <[email protected]>2023-06-19 17:12:51 +1000
commit691abd5caa5ae5d755ae2d2421f124c06b1e4df8 (patch)
treeaca4161ff955cca7eb692390d10baa1d75b0e616 /source
parent9b5d155d313b87afc2c0aed21fff9d6c1b26eb2d (diff)
downloadIronOS-691abd5caa5ae5d755ae2d2421f124c06b1e4df8.tar.gz
IronOS-691abd5caa5ae5d755ae2d2421f124c06b1e4df8.zip
Fix OLED display scroll speed being painfully slow + junk on ease in/out
Diffstat (limited to 'source')
-rw-r--r--source/Core/BSP/MHP30/FreeRTOSConfig.h2
-rw-r--r--source/Core/BSP/Miniware/FreeRTOSConfig.h2
-rw-r--r--source/Core/BSP/Sequre_S60/FreeRTOSConfig.h2
-rw-r--r--source/Core/Drivers/OLED.cpp22
4 files changed, 15 insertions, 13 deletions
diff --git a/source/Core/BSP/MHP30/FreeRTOSConfig.h b/source/Core/BSP/MHP30/FreeRTOSConfig.h
index dd95674e..c051701a 100644
--- a/source/Core/BSP/MHP30/FreeRTOSConfig.h
+++ b/source/Core/BSP/MHP30/FreeRTOSConfig.h
@@ -123,7 +123,7 @@ extern uint32_t SystemCoreClock;
#define INCLUDE_vTaskDelete 0
#define INCLUDE_vTaskCleanUpResources 0
#define INCLUDE_vTaskSuspend 0
-#define INCLUDE_vTaskDelayUntil 0
+#define INCLUDE_vTaskDelayUntil 1
#define INCLUDE_vTaskDelay 1
#define INCLUDE_xTaskGetSchedulerState 1
#define INCLUDE_uxTaskGetStackHighWaterMark 1
diff --git a/source/Core/BSP/Miniware/FreeRTOSConfig.h b/source/Core/BSP/Miniware/FreeRTOSConfig.h
index ed690c09..ef0451ef 100644
--- a/source/Core/BSP/Miniware/FreeRTOSConfig.h
+++ b/source/Core/BSP/Miniware/FreeRTOSConfig.h
@@ -123,7 +123,7 @@ extern uint32_t SystemCoreClock;
#define INCLUDE_vTaskDelete 0
#define INCLUDE_vTaskCleanUpResources 0
#define INCLUDE_vTaskSuspend 0
-#define INCLUDE_vTaskDelayUntil 0
+#define INCLUDE_vTaskDelayUntil 1
#define INCLUDE_vTaskDelay 1
#define INCLUDE_xTaskGetSchedulerState 1
#define INCLUDE_uxTaskGetStackHighWaterMark 1
diff --git a/source/Core/BSP/Sequre_S60/FreeRTOSConfig.h b/source/Core/BSP/Sequre_S60/FreeRTOSConfig.h
index ed690c09..ef0451ef 100644
--- a/source/Core/BSP/Sequre_S60/FreeRTOSConfig.h
+++ b/source/Core/BSP/Sequre_S60/FreeRTOSConfig.h
@@ -123,7 +123,7 @@ extern uint32_t SystemCoreClock;
#define INCLUDE_vTaskDelete 0
#define INCLUDE_vTaskCleanUpResources 0
#define INCLUDE_vTaskSuspend 0
-#define INCLUDE_vTaskDelayUntil 0
+#define INCLUDE_vTaskDelayUntil 1
#define INCLUDE_vTaskDelay 1
#define INCLUDE_xTaskGetSchedulerState 1
#define INCLUDE_uxTaskGetStackHighWaterMark 1
diff --git a/source/Core/Drivers/OLED.cpp b/source/Core/Drivers/OLED.cpp
index 05dd6777..71603b84 100644
--- a/source/Core/Drivers/OLED.cpp
+++ b/source/Core/Drivers/OLED.cpp
@@ -102,7 +102,7 @@ const uint8_t REFRESH_COMMANDS[17] = {
* Returns a new percentage value with ease in and ease out.
* Original floating point formula: t * t * (3.0f - 2.0f * t);
*/
-static uint8_t easeInOutTiming(uint8_t t) { return t * t * (300 - 2 * t) / 10000; }
+static uint16_t easeInOutTiming(uint16_t t) { return t * t * (300 - 2 * t) / 10000; }
/*
* Returns the value between a and b, using a percentage value t.
@@ -259,8 +259,8 @@ void OLED::maskScrollIndicatorOnOLED() {
*/
void OLED::transitionSecondaryFramebuffer(bool forwardNavigation) {
uint8_t *stripBackPointers[4];
- stripBackPointers[0] = &secondFrameBuffer[0];
- stripBackPointers[1] = &secondFrameBuffer[OLED_WIDTH];
+ stripBackPointers[0] = &secondFrameBuffer[FRAMEBUFFER_START + 0];
+ stripBackPointers[1] = &secondFrameBuffer[FRAMEBUFFER_START + OLED_WIDTH];
#ifdef OLED_128x32
stripBackPointers[2] = &secondFrameBuffer[OLED_WIDTH * 2];
@@ -273,10 +273,10 @@ void OLED::transitionSecondaryFramebuffer(bool forwardNavigation) {
uint8_t offset = 0;
while (duration <= totalDuration) {
- duration = xTaskGetTickCount() - start;
- uint8_t progress = ((duration * 100) / totalDuration); // Percentage of the period we are through for animation
- progress = easeInOutTiming(progress);
- progress = lerp(0, OLED_WIDTH, progress);
+ duration = xTaskGetTickCount() - start;
+ uint16_t progress = ((duration * 100) / totalDuration); // Percentage of the period we are through for animation
+ progress = easeInOutTiming(progress);
+ progress = lerp(0, OLED_WIDTH, progress);
// Constrain
if (progress > OLED_WIDTH) {
progress = OLED_WIDTH;
@@ -308,8 +308,9 @@ void OLED::transitionSecondaryFramebuffer(bool forwardNavigation) {
memmove(&stripPointers[3][newStart], &stripBackPointers[3][newEnd], progress);
#endif
- refresh();
- osDelay(TICKS_100MS / 7);
+ TickType_t start = xTaskGetTickCount();
+ refresh(); // Now refresh to write out the contents to the new page
+ vTaskDelayUntil(&start, TICKS_100MS / 7);
if (getButtonState() != BUTTON_NONE) {
return;
}
@@ -373,8 +374,9 @@ void OLED::transitionScrollDown() {
refresh(); // Now refresh to write out the contents to the new page
return;
}
+ TickType_t start = xTaskGetTickCount();
refresh(); // Now refresh to write out the contents to the new page
- osDelay(TICKS_100MS / 7);
+ vTaskDelayUntil(&start, TICKS_100MS / 7);
}
}