Fix gestures
This commit is contained in:
parent
93ccbf38e8
commit
baffa1594f
4 changed files with 13 additions and 20 deletions
|
@ -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() {
|
||||
return running;
|
||||
}
|
||||
|
|
|
@ -29,7 +29,6 @@ namespace Pinetime {
|
|||
|
||||
bool Refresh() override;
|
||||
|
||||
bool OnTouchEvent(Pinetime::Applications::TouchEvents event) override;
|
||||
void OnButtonEvent(lv_obj_t* object, lv_event_t event);
|
||||
|
||||
void UpdateScreen();
|
||||
|
|
|
@ -29,11 +29,23 @@ void TouchHandler::Process(void* instance) {
|
|||
|
||||
void TouchHandler::Work() {
|
||||
Pinetime::Drivers::Cst816S::TouchInfos info;
|
||||
Pinetime::Drivers::Cst816S::Gestures prevGesture = Pinetime::Drivers::Cst816S::Gestures::None;
|
||||
while (true) {
|
||||
vTaskSuspend(taskHandle);
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
if (systemTask->IsSleeping()) {
|
||||
systemTask->PushMessage(System::Messages::TouchWakeUp);
|
||||
} else {
|
||||
x = info.x;
|
||||
|
@ -42,12 +54,6 @@ void TouchHandler::Work() {
|
|||
if (!isCancelled) {
|
||||
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 {
|
||||
if (isCancelled) {
|
||||
lvgl.SetNewTouchPoint(-1, -1, false);
|
||||
|
|
|
@ -37,7 +37,6 @@ namespace Pinetime {
|
|||
Pinetime::Drivers::Cst816S& touchPanel;
|
||||
Pinetime::Components::LittleVgl& lvgl;
|
||||
Pinetime::Drivers::Cst816S::Gestures gesture;
|
||||
Pinetime::Drivers::Cst816S::Gestures prevGesture;
|
||||
bool isCancelled = false;
|
||||
uint8_t x, y;
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue