Fix gestures

This commit is contained in:
Riku Isokoski 2021-07-16 02:17:17 +03:00
parent 93ccbf38e8
commit baffa1594f
4 changed files with 13 additions and 20 deletions

View File

@ -154,17 +154,6 @@ void QuickSettings::OnButtonEvent(lv_obj_t* object, lv_event_t event) {
} }
} }
bool QuickSettings::OnTouchEvent(Pinetime::Applications::TouchEvents event) {
switch (event) {
case Pinetime::Applications::TouchEvents::SwipeLeft:
running = false;
return false;
default:
return true;
}
}
bool QuickSettings::Refresh() { bool QuickSettings::Refresh() {
return running; return running;
} }

View File

@ -29,7 +29,6 @@ namespace Pinetime {
bool Refresh() override; bool Refresh() override;
bool OnTouchEvent(Pinetime::Applications::TouchEvents event) override;
void OnButtonEvent(lv_obj_t* object, lv_event_t event); void OnButtonEvent(lv_obj_t* object, lv_event_t event);
void UpdateScreen(); void UpdateScreen();

View File

@ -29,11 +29,23 @@ void TouchHandler::Process(void* instance) {
void TouchHandler::Work() { void TouchHandler::Work() {
Pinetime::Drivers::Cst816S::TouchInfos info; Pinetime::Drivers::Cst816S::TouchInfos info;
Pinetime::Drivers::Cst816S::Gestures prevGesture = Pinetime::Drivers::Cst816S::Gestures::None;
while (true) { while (true) {
vTaskSuspend(taskHandle); vTaskSuspend(taskHandle);
info = touchPanel.GetTouchInfo(); info = touchPanel.GetTouchInfo();
if (info.gesture != Pinetime::Drivers::Cst816S::Gestures::None) {
if (prevGesture != info.gesture) {
if (info.gesture == Pinetime::Drivers::Cst816S::Gestures::SlideDown || info.gesture == Pinetime::Drivers::Cst816S::Gestures::SlideLeft ||
info.gesture == Pinetime::Drivers::Cst816S::Gestures::SlideUp || info.gesture == Pinetime::Drivers::Cst816S::Gestures::SlideRight) {
prevGesture = info.gesture;
}
gesture = info.gesture;
}
}
if (systemTask->IsSleeping()) { if (systemTask->IsSleeping()) {
gesture = info.gesture;
systemTask->PushMessage(System::Messages::TouchWakeUp); systemTask->PushMessage(System::Messages::TouchWakeUp);
} else { } else {
x = info.x; x = info.x;
@ -42,12 +54,6 @@ void TouchHandler::Work() {
if (!isCancelled) { if (!isCancelled) {
lvgl.SetNewTouchPoint(info.x, info.y, true); lvgl.SetNewTouchPoint(info.x, info.y, true);
} }
if (info.gesture != Pinetime::Drivers::Cst816S::Gestures::None) {
if (prevGesture != info.gesture) {
prevGesture = info.gesture;
gesture = info.gesture;
}
}
} else { } else {
if (isCancelled) { if (isCancelled) {
lvgl.SetNewTouchPoint(-1, -1, false); lvgl.SetNewTouchPoint(-1, -1, false);

View File

@ -37,7 +37,6 @@ namespace Pinetime {
Pinetime::Drivers::Cst816S& touchPanel; Pinetime::Drivers::Cst816S& touchPanel;
Pinetime::Components::LittleVgl& lvgl; Pinetime::Components::LittleVgl& lvgl;
Pinetime::Drivers::Cst816S::Gestures gesture; Pinetime::Drivers::Cst816S::Gestures gesture;
Pinetime::Drivers::Cst816S::Gestures prevGesture;
bool isCancelled = false; bool isCancelled = false;
uint8_t x, y; uint8_t x, y;
}; };