diff options
| author | Michele Bini <michele.bini@gmail.com> | 2022-03-25 22:22:22 (GMT) |
|---|---|---|
| committer | Michele Bini <michele.bini@gmail.com> | 2022-03-25 22:22:22 (GMT) |
| commit | 268ddbdc7622ab2a6b0490701064ffdde13fee51 (patch) | |
| tree | b4a5a240f3df214aa8245f9913fb4a9af8c356a4 | |
| parent | 30c319831ab15e6abaf97e4fa8f58a8eaeb8ba4a (diff) | |
sans animations
| -rw-r--r-- | src/displayapp/DisplayApp.cpp | 101 | ||||
| -rw-r--r-- | src/displayapp/DisplayApp.h | 12 | ||||
| -rw-r--r-- | src/displayapp/LittleVgl.cpp | 69 | ||||
| -rw-r--r-- | src/displayapp/LittleVgl.h | 3 | ||||
| -rw-r--r-- | src/displayapp/screens/List.cpp | 2 | ||||
| -rw-r--r-- | src/displayapp/screens/Notifications.cpp | 2 | ||||
| -rw-r--r-- | src/displayapp/screens/ScreenList.h | 5 | ||||
| -rw-r--r-- | src/displayapp/screens/Tile.cpp | 2 | ||||
| -rw-r--r-- | src/displayapp/screens/settings/QuickSettings.cpp | 2 | ||||
| -rw-r--r-- | src/libs/lv_conf.h | 2 |
10 files changed, 44 insertions, 156 deletions
diff --git a/src/displayapp/DisplayApp.cpp b/src/displayapp/DisplayApp.cpp index 904b461..db9d253 100644 --- a/src/displayapp/DisplayApp.cpp +++ b/src/displayapp/DisplayApp.cpp @@ -105,9 +105,9 @@ void DisplayApp::Start(System::BootErrors error) { bootError = error; if (error == System::BootErrors::TouchController) { - LoadApp(Apps::Error, DisplayApp::FullRefreshDirections::None); + LoadApp(Apps::Error); } else { - LoadApp(Apps::Clock, DisplayApp::FullRefreshDirections::None); + LoadApp(Apps::Clock); } if (pdPASS != xTaskCreate(DisplayApp::Process, "displayapp", 800, this, 0, &taskHandle)) { @@ -141,7 +141,7 @@ void DisplayApp::Refresh() { break; case States::Running: if (!currentScreen->IsRunning()) { - LoadApp(returnToApp, returnDirection); + LoadApp(returnToApp); } queueTimeout = lv_task_handler(); break; @@ -183,14 +183,14 @@ void DisplayApp::Refresh() { // Screens::Clock::BleConnectionStates::NotConnected); break; case Messages::NewNotification: - LoadApp(Apps::NotificationsPreview, DisplayApp::FullRefreshDirections::Down); + LoadApp(Apps::NotificationsPreview); break; case Messages::AlarmTriggered: if (currentApp == Apps::Alarm) { auto* alarm = static_cast<Screens::Alarm*>(currentScreen.get()); alarm->SetAlerting(); } else { - LoadApp(Apps::Alarm, DisplayApp::FullRefreshDirections::None); + LoadApp(Apps::Alarm); } break; case Messages::TouchEvent: { @@ -205,13 +205,13 @@ void DisplayApp::Refresh() { if (currentApp == Apps::Clock) { switch (gesture) { case TouchEvents::SwipeUp: - LoadApp(Apps::Launcher, DisplayApp::FullRefreshDirections::Up); + LoadApp(Apps::Launcher); break; case TouchEvents::SwipeDown: - LoadApp(Apps::Notifications, DisplayApp::FullRefreshDirections::Down); + LoadApp(Apps::Notifications); break; case TouchEvents::SwipeRight: - LoadApp(Apps::QuickSettings, DisplayApp::FullRefreshDirections::RightAnim); + LoadApp(Apps::QuickSettings); break; case TouchEvents::DoubleTap: PushMessageToSystemTask(System::Messages::GoToSleep); @@ -219,8 +219,8 @@ void DisplayApp::Refresh() { default: break; } - } else if (returnTouchEvent == gesture) { - LoadApp(returnToApp, returnDirection); + } else { + LoadApp(returnToApp); brightnessController.Set(settingsController.GetBrightness()); brightnessController.Backup(); } @@ -233,7 +233,7 @@ void DisplayApp::Refresh() { if (currentApp == Apps::Clock) { PushMessageToSystemTask(System::Messages::GoToSleep); } else { - LoadApp(returnToApp, returnDirection); + LoadApp(returnToApp); brightnessController.Set(settingsController.GetBrightness()); brightnessController.Backup(); } @@ -242,39 +242,39 @@ void DisplayApp::Refresh() { case Messages::ButtonLongPressed: if (currentApp != Apps::Clock) { if (currentApp == Apps::Notifications) { - LoadApp(Apps::Clock, DisplayApp::FullRefreshDirections::Up); + LoadApp(Apps::Clock); } else if (currentApp == Apps::QuickSettings) { - LoadApp(Apps::Clock, DisplayApp::FullRefreshDirections::LeftAnim); + LoadApp(Apps::Clock); } else { - LoadApp(Apps::Clock, DisplayApp::FullRefreshDirections::Down); + LoadApp(Apps::Clock); } } break; case Messages::ButtonLongerPressed: // Open up Firmware window, before possible reboot if press continues - LoadApp(Apps::FirmwareValidation, DisplayApp::FullRefreshDirections::Up); + LoadApp(Apps::FirmwareValidation); break; case Messages::ButtonDoubleClicked: if (currentApp != Apps::Notifications && currentApp != Apps::NotificationsPreview) { - LoadApp(Apps::Notifications, DisplayApp::FullRefreshDirections::Down); + LoadApp(Apps::Notifications); } break; case Messages::BleFirmwareUpdateStarted: - LoadApp(Apps::FirmwareUpdate, DisplayApp::FullRefreshDirections::Down); + LoadApp(Apps::FirmwareUpdate); break; case Messages::UpdateDateTime: // Added to remove warning // What should happen here? break; case Messages::Clock: - LoadApp(Apps::Clock, DisplayApp::FullRefreshDirections::None); + LoadApp(Apps::Clock); break; } } if (nextApp != Apps::None) { - LoadApp(nextApp, nextDirection); + LoadApp(nextApp); nextApp = Apps::None; } @@ -283,29 +283,25 @@ void DisplayApp::Refresh() { } } -void DisplayApp::StartApp(Apps app, DisplayApp::FullRefreshDirections direction) { +void DisplayApp::StartApp(Apps app) { nextApp = app; - nextDirection = direction; } -void DisplayApp::ReturnApp(Apps app, DisplayApp::FullRefreshDirections direction, TouchEvents touchEvent) { +void DisplayApp::ReturnApp(Apps app) { returnToApp = app; - returnDirection = direction; - returnTouchEvent = touchEvent; } -void DisplayApp::LoadApp(Apps app, DisplayApp::FullRefreshDirections direction) { +void DisplayApp::LoadApp(Apps app) { touchHandler.CancelTap(); currentScreen.reset(nullptr); - SetFullRefresh(direction); // default return to launcher - ReturnApp(Apps::Launcher, FullRefreshDirections::Down, TouchEvents::SwipeDown); + ReturnApp(Apps::Launcher); switch (app) { case Apps::Launcher: currentScreen = std::make_unique<Screens::ApplicationList>(this, settingsController, batteryController, dateTimeController); - ReturnApp(Apps::Clock, FullRefreshDirections::Down, TouchEvents::SwipeDown); + ReturnApp(Apps::Clock); break; case Apps::None: case Apps::Clock: @@ -321,26 +317,26 @@ void DisplayApp::LoadApp(Apps app, DisplayApp::FullRefreshDirections direction) case Apps::Error: currentScreen = std::make_unique<Screens::Error>(this, bootError); - ReturnApp(Apps::Clock, FullRefreshDirections::Down, TouchEvents::None); + ReturnApp(Apps::Clock); break; case Apps::FirmwareValidation: currentScreen = std::make_unique<Screens::FirmwareValidation>(this, validator); - ReturnApp(Apps::Settings, FullRefreshDirections::Down, TouchEvents::SwipeDown); + ReturnApp(Apps::Settings); break; case Apps::FirmwareUpdate: currentScreen = std::make_unique<Screens::FirmwareUpdate>(this, bleController); - ReturnApp(Apps::Clock, FullRefreshDirections::Down, TouchEvents::None); + ReturnApp(Apps::Clock); break; case Apps::Notifications: currentScreen = std::make_unique<Screens::Notifications>( this, notificationManager, systemTask->nimble().alertService(), motorController, *systemTask, Screens::Notifications::Modes::Normal); - ReturnApp(Apps::Clock, FullRefreshDirections::Up, TouchEvents::SwipeUp); + ReturnApp(Apps::Clock); break; case Apps::NotificationsPreview: currentScreen = std::make_unique<Screens::Notifications>( this, notificationManager, systemTask->nimble().alertService(), motorController, *systemTask, Screens::Notifications::Modes::Preview); - ReturnApp(Apps::Clock, FullRefreshDirections::Up, TouchEvents::SwipeUp); + ReturnApp(Apps::Clock); break; case Apps::Alarm: currentScreen = std::make_unique<Screens::Alarm>(this, alarmController, settingsController, *systemTask); @@ -350,31 +346,31 @@ void DisplayApp::LoadApp(Apps app, DisplayApp::FullRefreshDirections direction) case Apps::QuickSettings: currentScreen = std::make_unique<Screens::QuickSettings>( this, batteryController, dateTimeController, brightnessController, motorController, settingsController); - ReturnApp(Apps::Clock, FullRefreshDirections::LeftAnim, TouchEvents::SwipeLeft); + ReturnApp(Apps::Clock); break; case Apps::Settings: currentScreen = std::make_unique<Screens::Settings>(this, settingsController); - ReturnApp(Apps::QuickSettings, FullRefreshDirections::Down, TouchEvents::SwipeDown); + ReturnApp(Apps::QuickSettings); break; case Apps::SettingTimeFormat: currentScreen = std::make_unique<Screens::SettingTimeFormat>(this, settingsController); - ReturnApp(Apps::Settings, FullRefreshDirections::Down, TouchEvents::SwipeDown); + ReturnApp(Apps::Settings); break; case Apps::SettingWakeUp: currentScreen = std::make_unique<Screens::SettingWakeUp>(this, settingsController); - ReturnApp(Apps::Settings, FullRefreshDirections::Down, TouchEvents::SwipeDown); + ReturnApp(Apps::Settings); break; case Apps::SettingDisplay: currentScreen = std::make_unique<Screens::SettingDisplay>(this, settingsController); - ReturnApp(Apps::Settings, FullRefreshDirections::Down, TouchEvents::SwipeDown); + ReturnApp(Apps::Settings); break; case Apps::SettingSteps: currentScreen = std::make_unique<Screens::SettingSteps>(this, settingsController); - ReturnApp(Apps::Settings, FullRefreshDirections::Down, TouchEvents::SwipeDown); + ReturnApp(Apps::Settings); break; case Apps::SettingShakeThreshold: currentScreen = std::make_unique<Screens::SettingShakeThreshold>(this, settingsController, motionController, *systemTask); - ReturnApp(Apps::Settings, FullRefreshDirections::Down, TouchEvents::SwipeDown); + ReturnApp(Apps::Settings); break; case Apps::HeartRate: currentScreen = std::make_unique<Screens::HeartRate>(this, heartRateController, *systemTask); @@ -402,31 +398,6 @@ void DisplayApp::PushMessage(Messages msg) { } } -void DisplayApp::SetFullRefresh(DisplayApp::FullRefreshDirections direction) { - switch (direction) { - case DisplayApp::FullRefreshDirections::Down: - lvgl.SetFullRefresh(Components::LittleVgl::FullRefreshDirections::Down); - break; - case DisplayApp::FullRefreshDirections::Up: - lvgl.SetFullRefresh(Components::LittleVgl::FullRefreshDirections::Up); - break; - case DisplayApp::FullRefreshDirections::Left: - lvgl.SetFullRefresh(Components::LittleVgl::FullRefreshDirections::Left); - break; - case DisplayApp::FullRefreshDirections::Right: - lvgl.SetFullRefresh(Components::LittleVgl::FullRefreshDirections::Right); - break; - case DisplayApp::FullRefreshDirections::LeftAnim: - lvgl.SetFullRefresh(Components::LittleVgl::FullRefreshDirections::LeftAnim); - break; - case DisplayApp::FullRefreshDirections::RightAnim: - lvgl.SetFullRefresh(Components::LittleVgl::FullRefreshDirections::RightAnim); - break; - default: - break; - } -} - void DisplayApp::PushMessageToSystemTask(Pinetime::System::Messages message) { if (systemTask != nullptr) { systemTask->PushMessage(message); diff --git a/src/displayapp/DisplayApp.h b/src/displayapp/DisplayApp.h index 3c8845c..41e0d19 100644 --- a/src/displayapp/DisplayApp.h +++ b/src/displayapp/DisplayApp.h @@ -44,7 +44,6 @@ namespace Pinetime { class DisplayApp { public: enum class States { Idle, Running }; - enum class FullRefreshDirections { None, Up, Down, Left, Right, LeftAnim, RightAnim }; DisplayApp(Drivers::St7789& lcd, Components::LittleVgl& lvgl, @@ -64,9 +63,7 @@ namespace Pinetime { void Start(System::BootErrors error); void PushMessage(Display::Messages msg); - void StartApp(Apps app, DisplayApp::FullRefreshDirections direction); - - void SetFullRefresh(FullRefreshDirections direction); + void StartApp(Apps app); void Register(Pinetime::System::SystemTask* systemTask); @@ -102,19 +99,16 @@ namespace Pinetime { Apps currentApp = Apps::None; Apps returnToApp = Apps::None; - FullRefreshDirections returnDirection = FullRefreshDirections::None; - TouchEvents returnTouchEvent = TouchEvents::None; TouchEvents GetGesture(); static void Process(void* instance); void InitHw(); void Refresh(); - void ReturnApp(Apps app, DisplayApp::FullRefreshDirections direction, TouchEvents touchEvent); - void LoadApp(Apps app, DisplayApp::FullRefreshDirections direction); + void ReturnApp(Apps app); + void LoadApp(Apps app); void PushMessageToSystemTask(Pinetime::System::Messages message); Apps nextApp = Apps::None; - DisplayApp::FullRefreshDirections nextDirection; System::BootErrors bootError; }; } diff --git a/src/displayapp/LittleVgl.cpp b/src/displayapp/LittleVgl.cpp index e7b58c1..0e3fef9 100644 --- a/src/displayapp/LittleVgl.cpp +++ b/src/displayapp/LittleVgl.cpp @@ -63,23 +63,6 @@ void LittleVgl::InitTouchpad() { lv_indev_drv_register(&indev_drv); } -void LittleVgl::SetFullRefresh(FullRefreshDirections direction) { - if (scrollDirection == FullRefreshDirections::None) { - scrollDirection = direction; - if (scrollDirection == FullRefreshDirections::Down) { - lv_disp_set_direction(lv_disp_get_default(), 1); - } else if (scrollDirection == FullRefreshDirections::Right) { - lv_disp_set_direction(lv_disp_get_default(), 2); - } else if (scrollDirection == FullRefreshDirections::Left) { - lv_disp_set_direction(lv_disp_get_default(), 3); - } else if (scrollDirection == FullRefreshDirections::RightAnim) { - lv_disp_set_direction(lv_disp_get_default(), 5); - } else if (scrollDirection == FullRefreshDirections::LeftAnim) { - lv_disp_set_direction(lv_disp_get_default(), 4); - } - } -} - void LittleVgl::FlushDisplay(const lv_area_t* area, lv_color_t* color_p) { uint16_t y1, y2, width, height = 0; @@ -87,63 +70,13 @@ void LittleVgl::FlushDisplay(const lv_area_t* area, lv_color_t* color_p) { // NOtification is still needed (even if there is a mutex on SPI) because of the DataCommand pin // which cannot be set/clear during a transfert. - if ((scrollDirection == LittleVgl::FullRefreshDirections::Down) && (area->y2 == visibleNbLines - 1)) { - writeOffset = ((writeOffset + totalNbLines) - visibleNbLines) % totalNbLines; - } else if ((scrollDirection == FullRefreshDirections::Up) && (area->y1 == 0)) { - writeOffset = (writeOffset + visibleNbLines) % totalNbLines; - } - y1 = (area->y1 + writeOffset) % totalNbLines; y2 = (area->y2 + writeOffset) % totalNbLines; width = (area->x2 - area->x1) + 1; height = (area->y2 - area->y1) + 1; - if (scrollDirection == LittleVgl::FullRefreshDirections::Down) { - - if (area->y2 < visibleNbLines - 1) { - uint16_t toScroll = 0; - if (area->y1 == 0) { - toScroll = height * 2; - scrollDirection = FullRefreshDirections::None; - lv_disp_set_direction(lv_disp_get_default(), 0); - } else { - toScroll = height; - } - - if (scrollOffset >= toScroll) - scrollOffset -= toScroll; - else { - toScroll -= scrollOffset; - scrollOffset = (totalNbLines) -toScroll; - } - lcd.VerticalScrollStartAddress(scrollOffset); - } - - } else if (scrollDirection == FullRefreshDirections::Up) { - - if (area->y1 > 0) { - if (area->y2 == visibleNbLines - 1) { - scrollOffset += (height * 2); - scrollDirection = FullRefreshDirections::None; - lv_disp_set_direction(lv_disp_get_default(), 0); - } else { - scrollOffset += height; - } - scrollOffset = scrollOffset % totalNbLines; - lcd.VerticalScrollStartAddress(scrollOffset); - } - } else if (scrollDirection == FullRefreshDirections::Left or scrollDirection == FullRefreshDirections::LeftAnim) { - if (area->x2 == visibleNbLines - 1) { - scrollDirection = FullRefreshDirections::None; - lv_disp_set_direction(lv_disp_get_default(), 0); - } - } else if (scrollDirection == FullRefreshDirections::Right or scrollDirection == FullRefreshDirections::RightAnim) { - if (area->x1 == 0) { - scrollDirection = FullRefreshDirections::None; - lv_disp_set_direction(lv_disp_get_default(), 0); - } - } + // lv_disp_set_direction(lv_disp_get_default(), 0); if (y2 < y1) { height = totalNbLines - y1; diff --git a/src/displayapp/LittleVgl.h b/src/displayapp/LittleVgl.h index 1f8a3d7..af77eba 100644 --- a/src/displayapp/LittleVgl.h +++ b/src/displayapp/LittleVgl.h @@ -11,7 +11,6 @@ namespace Pinetime { namespace Components { class LittleVgl { public: - enum class FullRefreshDirections { None, Up, Down, Left, Right, LeftAnim, RightAnim }; LittleVgl(Pinetime::Drivers::St7789& lcd, Pinetime::Drivers::Cst816S& touchPanel); LittleVgl(const LittleVgl&) = delete; @@ -23,7 +22,6 @@ namespace Pinetime { void FlushDisplay(const lv_area_t* area, lv_color_t* color_p); bool GetTouchPadInfo(lv_indev_data_t* ptr); - void SetFullRefresh(FullRefreshDirections direction); void SetNewTouchPoint(uint16_t x, uint16_t y, bool contact); private: @@ -48,7 +46,6 @@ namespace Pinetime { static constexpr uint8_t MaxScrollOffset() { return LV_VER_RES_MAX - nbWriteLines; } - FullRefreshDirections scrollDirection = FullRefreshDirections::None; uint16_t writeOffset = 0; uint16_t scrollOffset = 0; diff --git a/src/displayapp/screens/List.cpp b/src/displayapp/screens/List.cpp index af3f30f..47e3a4c 100644 --- a/src/displayapp/screens/List.cpp +++ b/src/displayapp/screens/List.cpp @@ -102,7 +102,7 @@ void List::OnButtonEvent(lv_obj_t* object, lv_event_t event) { if (event == LV_EVENT_CLICKED) { for (int i = 0; i < MAXLISTITEMS; i++) { if (apps[i] != Apps::None && object == itemApps[i]) { - app->StartApp(apps[i], DisplayApp::FullRefreshDirections::Up); + app->StartApp(apps[i]); running = false; return; } diff --git a/src/displayapp/screens/Notifications.cpp b/src/displayapp/screens/Notifications.cpp index c10a60d..221633d 100644 --- a/src/displayapp/screens/Notifications.cpp +++ b/src/displayapp/screens/Notifications.cpp @@ -120,7 +120,6 @@ bool Notifications::OnTouchEvent(Pinetime::Applications::TouchEvents event) { validDisplay = true; currentId = previousNotification.id; currentItem.reset(nullptr); - app->SetFullRefresh(DisplayApp::FullRefreshDirections::Down); currentItem = std::make_unique<NotificationItem>(previousNotification.Title(), previousNotification.Message(), previousNotification.index, @@ -146,7 +145,6 @@ bool Notifications::OnTouchEvent(Pinetime::Applications::TouchEvents event) { validDisplay = true; currentId = nextNotification.id; currentItem.reset(nullptr); - app->SetFullRefresh(DisplayApp::FullRefreshDirections::Up); currentItem = std::make_unique<NotificationItem>(nextNotification.Title(), nextNotification.Message(), nextNotification.index, diff --git a/src/displayapp/screens/ScreenList.h b/src/displayapp/screens/ScreenList.h index e316e36..4178704 100644 --- a/src/displayapp/screens/ScreenList.h +++ b/src/displayapp/screens/ScreenList.h @@ -37,7 +37,6 @@ namespace Pinetime { case TouchEvents::SwipeDown: if (screenIndex > 0) { current.reset(nullptr); - app->SetFullRefresh(DisplayApp::FullRefreshDirections::Down); screenIndex--; current = screens[screenIndex](); return true; @@ -48,7 +47,6 @@ namespace Pinetime { case TouchEvents::SwipeUp: if (screenIndex < screens.size() - 1) { current.reset(nullptr); - app->SetFullRefresh(DisplayApp::FullRefreshDirections::Up); screenIndex++; current = screens[screenIndex](); } @@ -61,7 +59,6 @@ namespace Pinetime { case TouchEvents::SwipeRight: if (screenIndex > 0) { current.reset(nullptr); - app->SetFullRefresh(DisplayApp::FullRefreshDirections::None); screenIndex--; current = screens[screenIndex](); return true; @@ -72,7 +69,6 @@ namespace Pinetime { case TouchEvents::SwipeLeft: if (screenIndex < screens.size() - 1) { current.reset(nullptr); - app->SetFullRefresh(DisplayApp::FullRefreshDirections::None); screenIndex++; current = screens[screenIndex](); } @@ -87,7 +83,6 @@ namespace Pinetime { screenIndex = 0; } current.reset(nullptr); - app->SetFullRefresh(DisplayApp::FullRefreshDirections::None); current = screens[screenIndex](); return true; } diff --git a/src/displayapp/screens/Tile.cpp b/src/displayapp/screens/Tile.cpp index 23d9bca..f33408c 100644 --- a/src/displayapp/screens/Tile.cpp +++ b/src/displayapp/screens/Tile.cpp @@ -126,6 +126,6 @@ void Tile::UpdateScreen() { void Tile::OnValueChangedEvent(lv_obj_t* obj, uint32_t buttonId) { if(obj != btnm1) return; - app->StartApp(apps[buttonId], DisplayApp::FullRefreshDirections::Up); + app->StartApp(apps[buttonId]); running = false; } diff --git a/src/displayapp/screens/settings/QuickSettings.cpp b/src/displayapp/screens/settings/QuickSettings.cpp index c00518e..191d587 100644 --- a/src/displayapp/screens/settings/QuickSettings.cpp +++ b/src/displayapp/screens/settings/QuickSettings.cpp @@ -149,6 +149,6 @@ void QuickSettings::OnButtonEvent(lv_obj_t* object, lv_event_t event) { } else if (object == btn4 && event == LV_EVENT_CLICKED) { running = false; settingsController.SetSettingsMenu(0); - app->StartApp(Apps::Settings, DisplayApp::FullRefreshDirections::Up); + app->StartApp(Apps::Settings); } } diff --git a/src/libs/lv_conf.h b/src/libs/lv_conf.h index d3da8d6..3170fc2 100644 --- a/src/libs/lv_conf.h +++ b/src/libs/lv_conf.h @@ -139,7 +139,7 @@ typedef int16_t lv_coord_t; *==================*/ /*1: Enable the Animations */ -#define LV_USE_ANIMATION 1 +#define LV_USE_ANIMATION 0 #if LV_USE_ANIMATION /*Declare the type of the user data of animations (can be e.g. `void *`, `int`, `struct`)*/ |
