Make diff smaller and revert some changes in DisplayApp
This commit is contained in:
parent
8a694adb09
commit
6776776421
|
@ -52,6 +52,28 @@ namespace {
|
||||||
static inline bool in_isr(void) {
|
static inline bool in_isr(void) {
|
||||||
return (SCB->ICSR & SCB_ICSR_VECTACTIVE_Msk) != 0;
|
return (SCB->ICSR & SCB_ICSR_VECTACTIVE_Msk) != 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TouchEvents ConvertGesture(Pinetime::Drivers::Cst816S::Gestures gesture) {
|
||||||
|
switch (gesture) {
|
||||||
|
case Pinetime::Drivers::Cst816S::Gestures::SingleTap:
|
||||||
|
return TouchEvents::Tap;
|
||||||
|
case Pinetime::Drivers::Cst816S::Gestures::LongPress:
|
||||||
|
return TouchEvents::LongTap;
|
||||||
|
case Pinetime::Drivers::Cst816S::Gestures::DoubleTap:
|
||||||
|
return TouchEvents::DoubleTap;
|
||||||
|
case Pinetime::Drivers::Cst816S::Gestures::SlideRight:
|
||||||
|
return TouchEvents::SwipeRight;
|
||||||
|
case Pinetime::Drivers::Cst816S::Gestures::SlideLeft:
|
||||||
|
return TouchEvents::SwipeLeft;
|
||||||
|
case Pinetime::Drivers::Cst816S::Gestures::SlideDown:
|
||||||
|
return TouchEvents::SwipeDown;
|
||||||
|
case Pinetime::Drivers::Cst816S::Gestures::SlideUp:
|
||||||
|
return TouchEvents::SwipeUp;
|
||||||
|
case Pinetime::Drivers::Cst816S::Gestures::None:
|
||||||
|
default:
|
||||||
|
return TouchEvents::None;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
DisplayApp::DisplayApp(Drivers::St7789& lcd,
|
DisplayApp::DisplayApp(Drivers::St7789& lcd,
|
||||||
|
@ -185,6 +207,41 @@ void DisplayApp::Refresh() {
|
||||||
LoadApp(Apps::Timer, DisplayApp::FullRefreshDirections::Down);
|
LoadApp(Apps::Timer, DisplayApp::FullRefreshDirections::Down);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case Messages::TouchEvent: {
|
||||||
|
if (state != States::Running) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
auto gesture = ConvertGesture(touchHandler.GestureGet());
|
||||||
|
if (gesture == TouchEvents::None) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (!currentScreen->OnTouchEvent(gesture)) {
|
||||||
|
if (currentApp == Apps::Clock) {
|
||||||
|
switch (gesture) {
|
||||||
|
case TouchEvents::SwipeUp:
|
||||||
|
LoadApp(Apps::Launcher, DisplayApp::FullRefreshDirections::Up);
|
||||||
|
break;
|
||||||
|
case TouchEvents::SwipeDown:
|
||||||
|
LoadApp(Apps::Notifications, DisplayApp::FullRefreshDirections::Down);
|
||||||
|
break;
|
||||||
|
case TouchEvents::SwipeRight:
|
||||||
|
LoadApp(Apps::QuickSettings, DisplayApp::FullRefreshDirections::RightAnim);
|
||||||
|
break;
|
||||||
|
case TouchEvents::DoubleTap:
|
||||||
|
PushMessageToSystemTask(System::Messages::GoToSleep);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
} else if (returnTouchEvent == gesture) {
|
||||||
|
LoadApp(returnToApp, returnDirection);
|
||||||
|
brightnessController.Set(settingsController.GetBrightness());
|
||||||
|
brightnessController.Backup();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
touchHandler.CancelTap();
|
||||||
|
}
|
||||||
|
} break;
|
||||||
case Messages::ButtonPushed:
|
case Messages::ButtonPushed:
|
||||||
if (currentApp == Apps::Clock) {
|
if (currentApp == Apps::Clock) {
|
||||||
PushMessageToSystemTask(System::Messages::GoToSleep);
|
PushMessageToSystemTask(System::Messages::GoToSleep);
|
||||||
|
@ -207,44 +264,14 @@ void DisplayApp::Refresh() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
auto gesture = GetGesture();
|
if (nextApp != Apps::None) {
|
||||||
if (gesture != TouchEvents::None) {
|
LoadApp(nextApp, nextDirection);
|
||||||
if (!currentScreen->OnTouchEvent(gesture)) {
|
nextApp = Apps::None;
|
||||||
if (currentApp == Apps::Clock) {
|
|
||||||
switch (gesture) {
|
|
||||||
case TouchEvents::SwipeUp:
|
|
||||||
LoadApp(Apps::Launcher, DisplayApp::FullRefreshDirections::Up);
|
|
||||||
break;
|
|
||||||
case TouchEvents::SwipeDown:
|
|
||||||
LoadApp(Apps::Notifications, DisplayApp::FullRefreshDirections::Down);
|
|
||||||
break;
|
|
||||||
case TouchEvents::SwipeRight:
|
|
||||||
LoadApp(Apps::QuickSettings, DisplayApp::FullRefreshDirections::RightAnim);
|
|
||||||
break;
|
|
||||||
case TouchEvents::DoubleTap:
|
|
||||||
PushMessageToSystemTask(System::Messages::GoToSleep);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
} else if (returnTouchEvent == gesture) {
|
|
||||||
LoadApp(returnToApp, returnDirection);
|
|
||||||
brightnessController.Set(settingsController.GetBrightness());
|
|
||||||
brightnessController.Backup();
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
touchHandler.CancelTap();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (touchHandler.IsTouching()) {
|
if (touchHandler.IsTouching()) {
|
||||||
currentScreen->OnTouchEvent(touchHandler.GetX(), touchHandler.GetY());
|
currentScreen->OnTouchEvent(touchHandler.GetX(), touchHandler.GetY());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (nextApp != Apps::None) {
|
|
||||||
LoadApp(nextApp, nextDirection);
|
|
||||||
nextApp = Apps::None;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void DisplayApp::RunningState() {
|
void DisplayApp::RunningState() {
|
||||||
|
@ -407,30 +434,6 @@ void DisplayApp::PushMessage(Messages msg) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TouchEvents DisplayApp::GetGesture() {
|
|
||||||
auto gesture = touchHandler.GestureGet();
|
|
||||||
switch (gesture) {
|
|
||||||
case Pinetime::Drivers::Cst816S::Gestures::SingleTap:
|
|
||||||
return TouchEvents::Tap;
|
|
||||||
case Pinetime::Drivers::Cst816S::Gestures::LongPress:
|
|
||||||
return TouchEvents::LongTap;
|
|
||||||
case Pinetime::Drivers::Cst816S::Gestures::DoubleTap:
|
|
||||||
return TouchEvents::DoubleTap;
|
|
||||||
case Pinetime::Drivers::Cst816S::Gestures::SlideRight:
|
|
||||||
return TouchEvents::SwipeRight;
|
|
||||||
case Pinetime::Drivers::Cst816S::Gestures::SlideLeft:
|
|
||||||
return TouchEvents::SwipeLeft;
|
|
||||||
case Pinetime::Drivers::Cst816S::Gestures::SlideDown:
|
|
||||||
return TouchEvents::SwipeDown;
|
|
||||||
case Pinetime::Drivers::Cst816S::Gestures::SlideUp:
|
|
||||||
return TouchEvents::SwipeUp;
|
|
||||||
case Pinetime::Drivers::Cst816S::Gestures::None:
|
|
||||||
default:
|
|
||||||
return TouchEvents::None;
|
|
||||||
}
|
|
||||||
return TouchEvents::None;
|
|
||||||
}
|
|
||||||
|
|
||||||
void DisplayApp::SetFullRefresh(DisplayApp::FullRefreshDirections direction) {
|
void DisplayApp::SetFullRefresh(DisplayApp::FullRefreshDirections direction) {
|
||||||
switch (direction) {
|
switch (direction) {
|
||||||
case DisplayApp::FullRefreshDirections::Down:
|
case DisplayApp::FullRefreshDirections::Down:
|
||||||
|
|
|
@ -8,6 +8,7 @@ namespace Pinetime {
|
||||||
UpdateDateTime,
|
UpdateDateTime,
|
||||||
UpdateBleConnection,
|
UpdateBleConnection,
|
||||||
UpdateBatteryLevel,
|
UpdateBatteryLevel,
|
||||||
|
TouchEvent,
|
||||||
ButtonPushed,
|
ButtonPushed,
|
||||||
NewNotification,
|
NewNotification,
|
||||||
TimerDone,
|
TimerDone,
|
||||||
|
|
|
@ -302,6 +302,7 @@ void SystemTask::Work() {
|
||||||
touchHandler.UpdateLvglTouchPoint();
|
touchHandler.UpdateLvglTouchPoint();
|
||||||
}
|
}
|
||||||
ReloadIdleTimer();
|
ReloadIdleTimer();
|
||||||
|
displayApp.PushMessage(Pinetime::Applications::Display::Messages::TouchEvent);
|
||||||
break;
|
break;
|
||||||
case Messages::OnButtonEvent:
|
case Messages::OnButtonEvent:
|
||||||
ReloadIdleTimer();
|
ReloadIdleTimer();
|
||||||
|
|
Loading…
Reference in New Issue
Block a user