Skip to content

Commit 329482f

Browse files
committed
Fix remaining known issues
1 parent baffa15 commit 329482f

4 files changed

Lines changed: 17 additions & 10 deletions

File tree

src/displayapp/DisplayApp.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,9 @@ void DisplayApp::Refresh() {
226226
}
227227
}
228228

229-
currentScreen->OnTouchEvent(touchHandler.GetX(), touchHandler.GetY());
229+
if (touchHandler.IsTouching()) {
230+
currentScreen->OnTouchEvent(touchHandler.GetX(), touchHandler.GetY());
231+
}
230232

231233
if (nextApp != Apps::None) {
232234
LoadApp(nextApp, nextDirection);

src/displayapp/screens/Tile.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,7 @@ Tile::Tile(uint8_t screenID,
9191
lv_obj_set_style_local_bg_color(btnm1, LV_BTNMATRIX_PART_BTN, LV_STATE_DISABLED, lv_color_hex(0x111111));
9292

9393
for (uint8_t i = 0; i < 6; i++) {
94+
lv_btnmatrix_set_btn_ctrl(btnm1, i, LV_BTNMATRIX_CTRL_CLICK_TRIG);
9495
if (applications[i].application == Apps::None) {
9596
lv_btnmatrix_set_btn_ctrl(btnm1, i, LV_BTNMATRIX_CTRL_DISABLED);
9697
}
@@ -123,7 +124,7 @@ bool Tile::Refresh() {
123124
}
124125

125126
void Tile::OnObjectEvent(lv_obj_t* obj, lv_event_t event) {
126-
if (event == LV_EVENT_CLICKED) {
127+
if (event == LV_EVENT_VALUE_CHANGED) {
127128
app->StartApp(apps[lv_btnmatrix_get_active_btn(obj)], DisplayApp::FullRefreshDirections::Up);
128129
running = false;
129130
}

src/touchhandler/TouchHandler.cpp

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,10 @@ TouchHandler::TouchHandler(Drivers::Cst816S& touchPanel, Components::LittleVgl&
66
}
77

88
void TouchHandler::CancelTap() {
9-
isCancelled = true;
10-
lvgl.SetNewTouchPoint(-1, -1, true);
9+
if (info.touching) {
10+
isCancelled = true;
11+
lvgl.SetNewTouchPoint(-1, -1, true);
12+
}
1113
}
1214

1315
Pinetime::Drivers::Cst816S::Gestures TouchHandler::GestureGet() {
@@ -28,7 +30,6 @@ void TouchHandler::Process(void* instance) {
2830
}
2931

3032
void TouchHandler::Work() {
31-
Pinetime::Drivers::Cst816S::TouchInfos info;
3233
Pinetime::Drivers::Cst816S::Gestures prevGesture = Pinetime::Drivers::Cst816S::Gestures::None;
3334
while (true) {
3435
vTaskSuspend(taskHandle);
@@ -48,8 +49,6 @@ void TouchHandler::Work() {
4849
if (systemTask->IsSleeping()) {
4950
systemTask->PushMessage(System::Messages::TouchWakeUp);
5051
} else {
51-
x = info.x;
52-
y = info.y;
5352
if (info.touching) {
5453
if (!isCancelled) {
5554
lvgl.SetNewTouchPoint(info.x, info.y, true);

src/touchhandler/TouchHandler.h

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,23 +22,28 @@ namespace Pinetime {
2222
void Register(Pinetime::System::SystemTask* systemTask);
2323
void Start();
2424
void WakeUp();
25+
26+
bool IsTouching() const {
27+
return info.touching;
28+
}
2529
uint8_t GetX() const {
26-
return x;
30+
return info.x;
2731
}
2832
uint8_t GetY() const {
29-
return y;
33+
return info.y;
3034
}
3135
Drivers::Cst816S::Gestures GestureGet();
3236
private:
3337
static void Process(void* instance);
3438
void Work();
39+
40+
Pinetime::Drivers::Cst816S::TouchInfos info;
3541
Pinetime::System::SystemTask* systemTask = nullptr;
3642
TaskHandle_t taskHandle;
3743
Pinetime::Drivers::Cst816S& touchPanel;
3844
Pinetime::Components::LittleVgl& lvgl;
3945
Pinetime::Drivers::Cst816S::Gestures gesture;
4046
bool isCancelled = false;
41-
uint8_t x, y;
4247
};
4348
}
4449
}

0 commit comments

Comments
 (0)