feat: Add touch coordinate mapping and RTOS task yielding (#2481)

Co-authored-by: Julia Nguyen <julia@uxj.io>
This commit is contained in:
Justin Mitchell
2026-07-20 16:31:07 -04:00
committed by GitHub
co-authored by Julia Nguyen
parent c9188a7347
commit f42fab1c66
123 changed files with 3564 additions and 1380 deletions
+12
View File
@@ -10,6 +10,16 @@
#include <Bitmap.h>
#include <HalStorage.h>
#include <Logging.h>
#include <freertos/FreeRTOS.h>
#include <freertos/task.h>
namespace {
void yieldDuringThumbnail(uint8_t& rowsSinceYield) {
if (++rowsSinceYield < 8) return;
rowsSinceYield = 0;
vTaskDelay(1);
}
} // namespace
bool Xtc::load() {
LOG_DBG("XTC", "Loading XTC: %s", filepath.c_str());
@@ -380,6 +390,7 @@ bool Xtc::generateThumbBmp(int height) const {
const uint8_t* plane2 = (bitDepth == 2) ? pageBuffer + planeSize : nullptr;
const size_t colBytes = (bitDepth == 2) ? ((pageInfo.height + 7) / 8) : 0;
const size_t srcRowBytes = (bitDepth == 1) ? ((pageInfo.width + 7) / 8) : 0;
uint8_t rowsSinceYield = 0;
for (uint16_t dstY = 0; dstY < thumbHeight; dstY++) {
memset(rowBuffer, 0xFF, rowSize); // Start with all white (bit 1)
@@ -471,6 +482,7 @@ bool Xtc::generateThumbBmp(int height) const {
// Write row (already padded to 4-byte boundary by rowSize)
thumbBmp.write(rowBuffer, rowSize);
yieldDuringThumbnail(rowsSinceYield);
}
free(rowBuffer);