diff options
author | Riku Isokoski <riksu9000@gmail.com> | 2021-08-28 17:25:50 +0300 |
---|---|---|
committer | Riku Isokoski <riksu9000@gmail.com> | 2021-08-28 17:25:50 +0300 |
commit | c2fae47391f02b515c8d85a00ae1b7190bcd30a0 (patch) | |
tree | 75c4b96ace962cbb965c2bdd0dd11137b471c5ac /src/displayapp/screens | |
parent | 3cef05b7451fca3b2bbd5e96714c0262d52ac4d1 (diff) | |
parent | fab49f8557ef8ff38fe4f607e33b18fb5a1aeb9a (diff) |
Merge branch 'develop' into refresh_rework
Diffstat (limited to 'src/displayapp/screens')
-rw-r--r-- | src/displayapp/screens/FirmwareValidation.cpp | 4 | ||||
-rw-r--r-- | src/displayapp/screens/InfiniPaint.cpp | 3 | ||||
-rw-r--r-- | src/displayapp/screens/List.cpp | 2 | ||||
-rw-r--r-- | src/displayapp/screens/Metronome.cpp | 3 | ||||
-rw-r--r-- | src/displayapp/screens/Music.cpp | 2 | ||||
-rw-r--r-- | src/displayapp/screens/Paddle.cpp | 4 | ||||
-rw-r--r-- | src/displayapp/screens/Screen.h | 1 | ||||
-rw-r--r-- | src/displayapp/screens/StopWatch.cpp | 4 | ||||
-rw-r--r-- | src/displayapp/screens/SystemInfo.cpp | 6 | ||||
-rw-r--r-- | src/displayapp/screens/Tile.cpp | 1 | ||||
-rw-r--r-- | src/displayapp/screens/settings/QuickSettings.cpp | 6 | ||||
-rw-r--r-- | src/displayapp/screens/settings/SettingDisplay.cpp | 2 |
12 files changed, 15 insertions, 23 deletions
diff --git a/src/displayapp/screens/FirmwareValidation.cpp b/src/displayapp/screens/FirmwareValidation.cpp index 1ad1b8b2..eef8f919 100644 --- a/src/displayapp/screens/FirmwareValidation.cpp +++ b/src/displayapp/screens/FirmwareValidation.cpp @@ -64,10 +64,10 @@ FirmwareValidation::~FirmwareValidation() { } void FirmwareValidation::OnButtonEvent(lv_obj_t* object, lv_event_t event) { - if (object == buttonValidate && event == LV_EVENT_PRESSED) { + if (object == buttonValidate && event == LV_EVENT_CLICKED) { validator.Validate(); running = false; - } else if (object == buttonReset && event == LV_EVENT_PRESSED) { + } else if (object == buttonReset && event == LV_EVENT_CLICKED) { validator.Reset(); } } diff --git a/src/displayapp/screens/InfiniPaint.cpp b/src/displayapp/screens/InfiniPaint.cpp index 4dde81a4..85a5e826 100644 --- a/src/displayapp/screens/InfiniPaint.cpp +++ b/src/displayapp/screens/InfiniPaint.cpp @@ -5,13 +5,10 @@ using namespace Pinetime::Applications::Screens; InfiniPaint::InfiniPaint(Pinetime::Applications::DisplayApp* app, Pinetime::Components::LittleVgl& lvgl) : Screen(app), lvgl {lvgl} { - app->SetTouchMode(DisplayApp::TouchModes::Polling); std::fill(b, b + bufferSize, selectColor); } InfiniPaint::~InfiniPaint() { - // Reset the touchmode - app->SetTouchMode(DisplayApp::TouchModes::Gestures); lv_obj_clean(lv_scr_act()); } diff --git a/src/displayapp/screens/List.cpp b/src/displayapp/screens/List.cpp index c064a9cf..064b47a6 100644 --- a/src/displayapp/screens/List.cpp +++ b/src/displayapp/screens/List.cpp @@ -99,7 +99,7 @@ List::~List() { } void List::OnButtonEvent(lv_obj_t* object, lv_event_t event) { - if (event == LV_EVENT_RELEASED) { + 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); diff --git a/src/displayapp/screens/Metronome.cpp b/src/displayapp/screens/Metronome.cpp index 4396e360..884a4a51 100644 --- a/src/displayapp/screens/Metronome.cpp +++ b/src/displayapp/screens/Metronome.cpp @@ -67,14 +67,11 @@ Metronome::Metronome(DisplayApp* app, Controllers::MotorController& motorControl lv_obj_align(playPause, lv_scr_act(), LV_ALIGN_IN_BOTTOM_RIGHT, 0, 0); lv_obj_set_style_local_value_str(playPause, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, Symbols::play); - app->SetTouchMode(DisplayApp::TouchModes::Polling); - taskRefresh = lv_task_create(RefreshTaskCallback, LV_DISP_DEF_REFR_PERIOD, LV_TASK_PRIO_MID, this); } Metronome::~Metronome() { lv_task_del(taskRefresh); - app->SetTouchMode(DisplayApp::TouchModes::Gestures); systemTask.PushMessage(System::Messages::EnableSleeping); lv_obj_clean(lv_scr_act()); } diff --git a/src/displayapp/screens/Music.cpp b/src/displayapp/screens/Music.cpp index 8b7a23c1..47ddb655 100644 --- a/src/displayapp/screens/Music.cpp +++ b/src/displayapp/screens/Music.cpp @@ -293,7 +293,7 @@ bool Music::OnTouchEvent(Pinetime::Applications::TouchEvents event) { return true; } default: { - return true; + return false; } } } diff --git a/src/displayapp/screens/Paddle.cpp b/src/displayapp/screens/Paddle.cpp index d43173dc..3b6d60e3 100644 --- a/src/displayapp/screens/Paddle.cpp +++ b/src/displayapp/screens/Paddle.cpp @@ -5,8 +5,6 @@ using namespace Pinetime::Applications::Screens; Paddle::Paddle(Pinetime::Applications::DisplayApp* app, Pinetime::Components::LittleVgl& lvgl) : Screen(app), lvgl {lvgl} { - app->SetTouchMode(DisplayApp::TouchModes::Polling); - background = lv_obj_create(lv_scr_act(), nullptr); lv_obj_set_size(background, LV_HOR_RES + 1, LV_VER_RES); lv_obj_set_pos(background, -1, 0); @@ -35,8 +33,6 @@ Paddle::Paddle(Pinetime::Applications::DisplayApp* app, Pinetime::Components::Li Paddle::~Paddle() { lv_task_del(taskRefresh); - // Reset the touchmode - app->SetTouchMode(DisplayApp::TouchModes::Gestures); lv_obj_clean(lv_scr_act()); } diff --git a/src/displayapp/screens/Screen.h b/src/displayapp/screens/Screen.h index 0a5588b1..ce5741b2 100644 --- a/src/displayapp/screens/Screen.h +++ b/src/displayapp/screens/Screen.h @@ -60,6 +60,7 @@ namespace Pinetime { } /** @return false if the event hasn't been handled by the app, true if it has been handled */ + // Returning true will cancel lvgl tap virtual bool OnTouchEvent(TouchEvents event) { return false; } diff --git a/src/displayapp/screens/StopWatch.cpp b/src/displayapp/screens/StopWatch.cpp index 0d4feb20..9b27a89d 100644 --- a/src/displayapp/screens/StopWatch.cpp +++ b/src/displayapp/screens/StopWatch.cpp @@ -162,7 +162,7 @@ void StopWatch::Refresh() { } void StopWatch::playPauseBtnEventHandler(lv_event_t event) { - if (event != LV_EVENT_PRESSED) { + if (event != LV_EVENT_CLICKED) { return; } if (currentState == States::Init) { @@ -175,7 +175,7 @@ void StopWatch::playPauseBtnEventHandler(lv_event_t event) { } void StopWatch::stopLapBtnEventHandler(lv_event_t event) { - if (event != LV_EVENT_PRESSED) { + if (event != LV_EVENT_CLICKED) { return; } // If running, then this button is used to save laps diff --git a/src/displayapp/screens/SystemInfo.cpp b/src/displayapp/screens/SystemInfo.cpp index a0aef9a4..b7a4fc60 100644 --- a/src/displayapp/screens/SystemInfo.cpp +++ b/src/displayapp/screens/SystemInfo.cpp @@ -200,7 +200,7 @@ bool SystemInfo::sortById(const TaskStatus_t& lhs, const TaskStatus_t& rhs) { } std::unique_ptr<Screen> SystemInfo::CreateScreen4() { - TaskStatus_t tasksStatus[7]; + TaskStatus_t tasksStatus[10]; lv_obj_t* infoTask = lv_table_create(lv_scr_act(), NULL); lv_table_set_col_cnt(infoTask, 4); lv_table_set_row_cnt(infoTask, 8); @@ -215,9 +215,9 @@ std::unique_ptr<Screen> SystemInfo::CreateScreen4() { lv_table_set_cell_value(infoTask, 0, 3, "Free"); lv_table_set_col_width(infoTask, 3, 90); - auto nb = uxTaskGetSystemState(tasksStatus, 7, nullptr); + auto nb = uxTaskGetSystemState(tasksStatus, sizeof(tasksStatus) / sizeof(tasksStatus[0]), nullptr); std::sort(tasksStatus, tasksStatus + nb, sortById); - for (uint8_t i = 0; i < nb; i++) { + for (uint8_t i = 0; i < nb && i < 7; i++) { lv_table_set_cell_value(infoTask, i + 1, 0, std::to_string(tasksStatus[i].xTaskNumber).c_str()); char state[2] = {0}; diff --git a/src/displayapp/screens/Tile.cpp b/src/displayapp/screens/Tile.cpp index 85bd2c5f..1d4f0d0e 100644 --- a/src/displayapp/screens/Tile.cpp +++ b/src/displayapp/screens/Tile.cpp @@ -95,6 +95,7 @@ Tile::Tile(uint8_t screenID, lv_obj_set_style_local_pad_inner(btnm1, LV_BTNMATRIX_PART_BG, LV_STATE_DEFAULT, 10); for (uint8_t i = 0; i < 6; i++) { + lv_btnmatrix_set_btn_ctrl(btnm1, i, LV_BTNMATRIX_CTRL_CLICK_TRIG); if (applications[i].application == Apps::None) { lv_btnmatrix_set_btn_ctrl(btnm1, i, LV_BTNMATRIX_CTRL_DISABLED); } diff --git a/src/displayapp/screens/settings/QuickSettings.cpp b/src/displayapp/screens/settings/QuickSettings.cpp index 4f5ecd4d..22b56360 100644 --- a/src/displayapp/screens/settings/QuickSettings.cpp +++ b/src/displayapp/screens/settings/QuickSettings.cpp @@ -128,12 +128,12 @@ void QuickSettings::UpdateScreen() { } void QuickSettings::OnButtonEvent(lv_obj_t* object, lv_event_t event) { - if (object == btn2 && event == LV_EVENT_PRESSED) { + if (object == btn2 && event == LV_EVENT_CLICKED) { running = false; app->StartApp(Apps::FlashLight, DisplayApp::FullRefreshDirections::None); - } else if (object == btn1 && event == LV_EVENT_PRESSED) { + } else if (object == btn1 && event == LV_EVENT_CLICKED) { brightness.Step(); lv_label_set_text_static(btn1_lvl, brightness.GetIcon()); @@ -150,7 +150,7 @@ void QuickSettings::OnButtonEvent(lv_obj_t* object, lv_event_t event) { lv_label_set_text_static(btn3_lvl, Symbols::notificationsOff); } - } else if (object == btn4 && event == LV_EVENT_PRESSED) { + } else if (object == btn4 && event == LV_EVENT_CLICKED) { running = false; settingsController.SetSettingsMenu(0); app->StartApp(Apps::Settings, DisplayApp::FullRefreshDirections::Up); diff --git a/src/displayapp/screens/settings/SettingDisplay.cpp b/src/displayapp/screens/settings/SettingDisplay.cpp index 7b31c47c..d8d6c767 100644 --- a/src/displayapp/screens/settings/SettingDisplay.cpp +++ b/src/displayapp/screens/settings/SettingDisplay.cpp @@ -81,7 +81,7 @@ SettingDisplay::~SettingDisplay() { } void SettingDisplay::UpdateSelected(lv_obj_t* object, lv_event_t event) { - if (event == LV_EVENT_VALUE_CHANGED) { + if (event == LV_EVENT_CLICKED) { for (int i = 0; i < optionsTotal; i++) { if (object == cbOption[i]) { lv_checkbox_set_checked(cbOption[i], true); |