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,30 +207,14 @@ void DisplayApp::Refresh() {
|
||||||
LoadApp(Apps::Timer, DisplayApp::FullRefreshDirections::Down);
|
LoadApp(Apps::Timer, DisplayApp::FullRefreshDirections::Down);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case Messages::ButtonPushed:
|
case Messages::TouchEvent: {
|
||||||
if (currentApp == Apps::Clock) {
|
if (state != States::Running) {
|
||||||
PushMessageToSystemTask(System::Messages::GoToSleep);
|
|
||||||
} else {
|
|
||||||
if (!currentScreen->OnButtonPushed()) {
|
|
||||||
LoadApp(returnToApp, returnDirection);
|
|
||||||
brightnessController.Set(settingsController.GetBrightness());
|
|
||||||
brightnessController.Backup();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
case Messages::BleFirmwareUpdateStarted:
|
|
||||||
LoadApp(Apps::FirmwareUpdate, DisplayApp::FullRefreshDirections::Down);
|
|
||||||
break;
|
|
||||||
case Messages::UpdateDateTime:
|
|
||||||
// Added to remove warning
|
|
||||||
// What should happen here?
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
auto gesture = ConvertGesture(touchHandler.GestureGet());
|
||||||
|
if (gesture == TouchEvents::None) {
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
auto gesture = GetGesture();
|
|
||||||
if (gesture != TouchEvents::None) {
|
|
||||||
if (!currentScreen->OnTouchEvent(gesture)) {
|
if (!currentScreen->OnTouchEvent(gesture)) {
|
||||||
if (currentApp == Apps::Clock) {
|
if (currentApp == Apps::Clock) {
|
||||||
switch (gesture) {
|
switch (gesture) {
|
||||||
|
@ -235,16 +241,37 @@ void DisplayApp::Refresh() {
|
||||||
} else {
|
} else {
|
||||||
touchHandler.CancelTap();
|
touchHandler.CancelTap();
|
||||||
}
|
}
|
||||||
|
} break;
|
||||||
|
case Messages::ButtonPushed:
|
||||||
|
if (currentApp == Apps::Clock) {
|
||||||
|
PushMessageToSystemTask(System::Messages::GoToSleep);
|
||||||
|
} else {
|
||||||
|
if (!currentScreen->OnButtonPushed()) {
|
||||||
|
LoadApp(returnToApp, returnDirection);
|
||||||
|
brightnessController.Set(settingsController.GetBrightness());
|
||||||
|
brightnessController.Backup();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
if (touchHandler.IsTouching()) {
|
case Messages::BleFirmwareUpdateStarted:
|
||||||
currentScreen->OnTouchEvent(touchHandler.GetX(), touchHandler.GetY());
|
LoadApp(Apps::FirmwareUpdate, DisplayApp::FullRefreshDirections::Down);
|
||||||
|
break;
|
||||||
|
case Messages::UpdateDateTime:
|
||||||
|
// Added to remove warning
|
||||||
|
// What should happen here?
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (nextApp != Apps::None) {
|
if (nextApp != Apps::None) {
|
||||||
LoadApp(nextApp, nextDirection);
|
LoadApp(nextApp, nextDirection);
|
||||||
nextApp = Apps::None;
|
nextApp = Apps::None;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (touchHandler.IsTouching()) {
|
||||||
|
currentScreen->OnTouchEvent(touchHandler.GetX(), touchHandler.GetY());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
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 a new issue