File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -59,7 +59,7 @@ namespace Pinetime {
5959 uint16_t writeOffset = 0 ;
6060 uint16_t scrollOffset = 0 ;
6161
62- lv_point_t touchPoint = {0 };
62+ lv_point_t touchPoint = {};
6363 bool tapped = false ;
6464 bool isCancelled = false ;
6565 };
Original file line number Diff line number Diff line change @@ -111,7 +111,7 @@ Pinetime::Controllers::NotificationManager notificationManager;
111111Pinetime::Controllers::MotionController motionController;
112112Pinetime::Controllers::TimerController timerController;
113113Pinetime::Controllers::AlarmController alarmController {dateTimeController};
114- Pinetime::Controllers::TouchHandler touchHandler (touchPanel) ;
114+ Pinetime::Controllers::TouchHandler touchHandler;
115115Pinetime::Controllers::ButtonHandler buttonHandler;
116116Pinetime::Controllers::BrightnessController brightnessController {};
117117
Original file line number Diff line number Diff line change @@ -250,7 +250,7 @@ void SystemTask::Work() {
250250 isDimmed = false ;
251251 break ;
252252 case Messages::TouchWakeUp: {
253- if (touchHandler.GetNewTouchInfo ( )) {
253+ if (touchHandler.ProcessTouchInfo (touchPanel. GetTouchInfo () )) {
254254 auto gesture = touchHandler.GestureGet ();
255255 if (settingsController.GetNotificationStatus () != Controllers::Settings::Notification::Sleep &&
256256 gesture != Pinetime::Applications::TouchEvents::None &&
@@ -342,7 +342,7 @@ void SystemTask::Work() {
342342 // TODO add intent of fs access icon or something
343343 break ;
344344 case Messages::OnTouchEvent:
345- if (touchHandler.GetNewTouchInfo ( )) {
345+ if (touchHandler.ProcessTouchInfo (touchPanel. GetTouchInfo () )) {
346346 ReloadIdleTimer ();
347347 displayApp.PushMessage (Pinetime::Applications::Display::Messages::TouchEvent);
348348 }
Original file line number Diff line number Diff line change @@ -27,18 +27,13 @@ namespace {
2727 }
2828}
2929
30- TouchHandler::TouchHandler (Drivers::Cst816S& touchPanel) : touchPanel {touchPanel} {
31- }
32-
3330Pinetime::Applications::TouchEvents TouchHandler::GestureGet () {
3431 auto returnGesture = gesture;
3532 gesture = Pinetime::Applications::TouchEvents::None;
3633 return returnGesture;
3734}
3835
39- bool TouchHandler::GetNewTouchInfo () {
40- info = touchPanel.GetTouchInfo ();
41-
36+ bool TouchHandler::ProcessTouchInfo (Drivers::Cst816S::TouchInfos info) {
4237 if (!info.isValid ) {
4338 return false ;
4439 }
@@ -65,5 +60,7 @@ bool TouchHandler::GetNewTouchInfo() {
6560 gestureReleased = true ;
6661 }
6762
63+ currentTouchPoint = {info.x , info.y , info.touching };
64+
6865 return true ;
6966}
Original file line number Diff line number Diff line change 33#include " displayapp/TouchEvents.h"
44
55namespace Pinetime {
6- namespace Drivers {
7- class Cst816S ;
8- }
9-
106 namespace Controllers {
117 class TouchHandler {
128 public:
13- explicit TouchHandler (Drivers::Cst816S&);
9+ struct TouchPoint {
10+ int x;
11+ int y;
12+ bool touching;
13+ };
1414
15- bool GetNewTouchInfo ( );
15+ bool ProcessTouchInfo (Drivers::Cst816S::TouchInfos info );
1616
1717 bool IsTouching () const {
18- return info .touching ;
18+ return currentTouchPoint .touching ;
1919 }
2020
2121 uint8_t GetX () const {
22- return info .x ;
22+ return currentTouchPoint .x ;
2323 }
2424
2525 uint8_t GetY () const {
26- return info .y ;
26+ return currentTouchPoint .y ;
2727 }
2828
2929 Pinetime::Applications::TouchEvents GestureGet ();
3030
3131 private:
32- Pinetime::Drivers::Cst816S::TouchInfos info;
33- Pinetime::Drivers::Cst816S& touchPanel;
3432 Pinetime::Applications::TouchEvents gesture;
35- bool isCancelled = false ;
33+ TouchPoint currentTouchPoint = {} ;
3634 bool gestureReleased = true ;
3735 };
3836 }
You can’t perform that action at this time.
0 commit comments