Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix qrcode screen touch issue #79

Merged
merged 1 commit into from
Sep 20, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 21 additions & 19 deletions src/tasks/touchpad_task.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ osSemaphoreId_t g_touchPadSem = NULL;
TouchStatus_t g_touchStatus[TOUCH_RING_BUFFER_SIZE];
volatile bool g_touchPress;
static uint8_t g_touchWriteIndex, g_touchReadIndex;
TouchStatus_t g_touchStatusG;

void CreateTouchPadTask(void)
{
Expand Down Expand Up @@ -62,11 +63,12 @@ static void TouchPadTask(void *argument)
LcdDraw(touchStatus.x, touchStatus.y, touchStatus.x, touchStatus.y, &testColor);
#else
if (lastTouch) {
g_touchWriteIndex++;
if (g_touchWriteIndex >= TOUCH_RING_BUFFER_SIZE) {
g_touchWriteIndex = 0;
}
memcpy(&g_touchStatus[g_touchWriteIndex], &touchStatus, sizeof(TouchStatus_t));
// g_touchWriteIndex++;
// if (g_touchWriteIndex >= TOUCH_RING_BUFFER_SIZE) {
// g_touchWriteIndex = 0;
// }
// memcpy(&g_touchStatus[g_touchWriteIndex], &touchStatus, sizeof(TouchStatus_t));
memcpy(&g_touchStatusG, &touchStatus, sizeof(TouchStatus_t));
}
lastTouch = touchStatus.touch;
#endif
Expand All @@ -83,20 +85,20 @@ static void TouchPadTask(void *argument)

TouchStatus_t *GetTouchStatus(void)
{
uint8_t index;

index = g_touchReadIndex;
//printf("index=%d\r\n", index);
if (g_touchReadIndex != g_touchWriteIndex) {
g_touchReadIndex++;
if (g_touchReadIndex >= TOUCH_RING_BUFFER_SIZE) {
g_touchReadIndex = 0;
}
g_touchStatus[index].continueReading = true;
} else {
g_touchStatus[index].continueReading = false;
}
return &g_touchStatus[index];
// uint8_t index;

// index = g_touchReadIndex;
// //printf("index=%d\r\n", index);
// if (g_touchReadIndex != g_touchWriteIndex) {
// g_touchReadIndex++;
// if (g_touchReadIndex >= TOUCH_RING_BUFFER_SIZE) {
// g_touchReadIndex = 0;
// }
// g_touchStatus[index].continueReading = true;
// } else {
// g_touchStatus[index].continueReading = false;
// }
return &g_touchStatusG;
}


Expand Down
Loading