Fix gestures
This commit is contained in:
parent
93ccbf38e8
commit
baffa1594f
|
@ -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;
|
||||||
}
|
}
|
||||||
|
|
|
@ -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();
|
||||||
|
|
|
@ -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 (systemTask->IsSleeping()) {
|
|
||||||
|
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;
|
gesture = info.gesture;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (systemTask->IsSleeping()) {
|
||||||
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);
|
||||||
|
|
|
@ -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;
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue
Block a user