summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRiku Isokoski <riksu9000@gmail.com>2021-07-16 11:55:29 +0300
committerRiku Isokoski <riksu9000@gmail.com>2021-07-16 11:55:29 +0300
commit329482f87308c185e970b141bcbfe9c83b46c4da (patch)
treed26143a1994f306c675e6f4f317c3ba457f102b3
parentbaffa1594f9c1a03a95f0cc10955e3cf8bf880ce (diff)
Fix remaining known issues
-rw-r--r--src/displayapp/DisplayApp.cpp4
-rw-r--r--src/displayapp/screens/Tile.cpp3
-rw-r--r--src/touchhandler/TouchHandler.cpp9
-rw-r--r--src/touchhandler/TouchHandler.h11
4 files changed, 17 insertions, 10 deletions
diff --git a/src/displayapp/DisplayApp.cpp b/src/displayapp/DisplayApp.cpp
index 945f182a..1ff8d51d 100644
--- a/src/displayapp/DisplayApp.cpp
+++ b/src/displayapp/DisplayApp.cpp
@@ -226,7 +226,9 @@ void DisplayApp::Refresh() {
}
}
- currentScreen->OnTouchEvent(touchHandler.GetX(), touchHandler.GetY());
+ if (touchHandler.IsTouching()) {
+ currentScreen->OnTouchEvent(touchHandler.GetX(), touchHandler.GetY());
+ }
if (nextApp != Apps::None) {
LoadApp(nextApp, nextDirection);
diff --git a/src/displayapp/screens/Tile.cpp b/src/displayapp/screens/Tile.cpp
index 5a40e915..8eb5eb0a 100644
--- a/src/displayapp/screens/Tile.cpp
+++ b/src/displayapp/screens/Tile.cpp
@@ -91,6 +91,7 @@ Tile::Tile(uint8_t screenID,
lv_obj_set_style_local_bg_color(btnm1, LV_BTNMATRIX_PART_BTN, LV_STATE_DISABLED, lv_color_hex(0x111111));
for (uint8_t i = 0; i < 6; i++) {
+ lv_btnmatrix_set_btn_ctrl(btnm1, i, LV_BTNMATRIX_CTRL_CLICK_TRIG);
if (applications[i].application == Apps::None) {
lv_btnmatrix_set_btn_ctrl(btnm1, i, LV_BTNMATRIX_CTRL_DISABLED);
}
@@ -123,7 +124,7 @@ bool Tile::Refresh() {
}
void Tile::OnObjectEvent(lv_obj_t* obj, lv_event_t event) {
- if (event == LV_EVENT_CLICKED) {
+ if (event == LV_EVENT_VALUE_CHANGED) {
app->StartApp(apps[lv_btnmatrix_get_active_btn(obj)], DisplayApp::FullRefreshDirections::Up);
running = false;
}
diff --git a/src/touchhandler/TouchHandler.cpp b/src/touchhandler/TouchHandler.cpp
index 160b5e14..0d0b8273 100644
--- a/src/touchhandler/TouchHandler.cpp
+++ b/src/touchhandler/TouchHandler.cpp
@@ -6,8 +6,10 @@ TouchHandler::TouchHandler(Drivers::Cst816S& touchPanel, Components::LittleVgl&
}
void TouchHandler::CancelTap() {
- isCancelled = true;
- lvgl.SetNewTouchPoint(-1, -1, true);
+ if (info.touching) {
+ isCancelled = true;
+ lvgl.SetNewTouchPoint(-1, -1, true);
+ }
}
Pinetime::Drivers::Cst816S::Gestures TouchHandler::GestureGet() {
@@ -28,7 +30,6 @@ 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);
@@ -48,8 +49,6 @@ void TouchHandler::Work() {
if (systemTask->IsSleeping()) {
systemTask->PushMessage(System::Messages::TouchWakeUp);
} else {
- x = info.x;
- y = info.y;
if (info.touching) {
if (!isCancelled) {
lvgl.SetNewTouchPoint(info.x, info.y, true);
diff --git a/src/touchhandler/TouchHandler.h b/src/touchhandler/TouchHandler.h
index 37ef5af2..6b8189f5 100644
--- a/src/touchhandler/TouchHandler.h
+++ b/src/touchhandler/TouchHandler.h
@@ -22,23 +22,28 @@ namespace Pinetime {
void Register(Pinetime::System::SystemTask* systemTask);
void Start();
void WakeUp();
+
+ bool IsTouching() const {
+ return info.touching;
+ }
uint8_t GetX() const {
- return x;
+ return info.x;
}
uint8_t GetY() const {
- return y;
+ return info.y;
}
Drivers::Cst816S::Gestures GestureGet();
private:
static void Process(void* instance);
void Work();
+
+ Pinetime::Drivers::Cst816S::TouchInfos info;
Pinetime::System::SystemTask* systemTask = nullptr;
TaskHandle_t taskHandle;
Pinetime::Drivers::Cst816S& touchPanel;
Pinetime::Components::LittleVgl& lvgl;
Pinetime::Drivers::Cst816S::Gestures gesture;
bool isCancelled = false;
- uint8_t x, y;
};
}
}