From 3ebf002f9db75513d036c0eaa0863e75882b3a40 Mon Sep 17 00:00:00 2001 From: Tim Keller Date: Mon, 27 Sep 2021 02:52:02 +0000 Subject: Add start of settings app for senstivity. really just debugging. I want to make it more configurable then high med low. Position of setting needs a new location...dynamicly adding it currently at the end. Which honestly im fine with. --- src/displayapp/screens/settings/Settings.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src/displayapp/screens/settings/Settings.cpp') diff --git a/src/displayapp/screens/settings/Settings.cpp b/src/displayapp/screens/settings/Settings.cpp index 31ee8831..cf78ad13 100644 --- a/src/displayapp/screens/settings/Settings.cpp +++ b/src/displayapp/screens/settings/Settings.cpp @@ -65,6 +65,8 @@ std::unique_ptr Settings::CreateScreen3() { {Symbols::none, "None", Apps::None}, {Symbols::none, "None", Apps::None} }}; - + if (settingsController.isWakeUpModeOn(Pinetime::Controllers::Settings::WakeUpMode::Shake)) { + applications[1] = {Symbols::list, "Shake Threshold", Apps::SettingShakeThreshold}; + } return std::make_unique(2, 3, app, settingsController, applications); } \ No newline at end of file -- cgit v1.2.3-70-g09d2 From f780ac999a069b3539f5419b9e07a624ae018030 Mon Sep 17 00:00:00 2001 From: Tim Keller Date: Tue, 28 Sep 2021 04:21:47 +0000 Subject: Actually save the threshold Prevent a few crashes due to an LV task being active when it shouldnt be. --- src/components/settings/Settings.h | 6 +++++- .../screens/settings/SettingShakeThreshold.cpp | 23 ++++++++++++++++------ src/displayapp/screens/settings/Settings.cpp | 2 +- 3 files changed, 23 insertions(+), 8 deletions(-) (limited to 'src/displayapp/screens/settings/Settings.cpp') diff --git a/src/components/settings/Settings.h b/src/components/settings/Settings.h index e623f3a5..12ac85b5 100644 --- a/src/components/settings/Settings.h +++ b/src/components/settings/Settings.h @@ -115,7 +115,11 @@ namespace Pinetime { }; void SetShakeThreshold(uint16_t thresh){ - settings.shakeWakeThreshold = thresh; + if(settings.shakeWakeThreshold != thresh){ + settings.shakeWakeThreshold = thresh; + settingsChanged = true; + } + } int16_t GetShakeThreshold() const{ diff --git a/src/displayapp/screens/settings/SettingShakeThreshold.cpp b/src/displayapp/screens/settings/SettingShakeThreshold.cpp index 19afa24f..dc0812a7 100644 --- a/src/displayapp/screens/settings/SettingShakeThreshold.cpp +++ b/src/displayapp/screens/settings/SettingShakeThreshold.cpp @@ -24,13 +24,14 @@ SettingShakeThreshold::SettingShakeThreshold(DisplayApp* app, systemTask {systemTask} { lv_obj_t* title = lv_label_create(lv_scr_act(), nullptr); - lv_label_set_text_static(title, "Shake Threshold"); + lv_label_set_text_static(title, "Wake Sensitivity"); lv_label_set_align(title, LV_LABEL_ALIGN_CENTER); lv_obj_align(title, lv_scr_act(), LV_ALIGN_IN_TOP_MID, 0, 0); + taskCount = 0; positionArc = lv_arc_create(lv_scr_act(), nullptr); - // Why do this? + positionArc->user_data = this; lv_obj_set_event_cb(positionArc, event_handler); @@ -59,6 +60,8 @@ SettingShakeThreshold::SettingShakeThreshold(DisplayApp* app, } SettingShakeThreshold::~SettingShakeThreshold() { + settingsController.SetShakeThreshold(lv_arc_get_value(positionArc)); + lv_task_del(refreshTask); lv_obj_clean(lv_scr_act()); settingsController.SaveSettings(); } @@ -69,8 +72,9 @@ void SettingShakeThreshold::Refresh() { if((motionController.currentShakeSpeed()-200) > lv_arc_get_value(positionArc)){ lv_arc_set_value(positionArc,(int16_t)motionController.currentShakeSpeed()-200); } - if(taskCount >= 100){ + if(taskCount >= 50){ lv_label_set_text(calLabel, "Calibrate"); + taskCount=0; lv_task_del(refreshTask); } @@ -80,11 +84,18 @@ void SettingShakeThreshold::UpdateSelected(lv_obj_t* object, lv_event_t event) { switch (event) { case LV_EVENT_PRESSED: { - taskCount = 0; - refreshTask = lv_task_create(RefreshTaskCallback, 100, LV_TASK_PRIO_MID, this); - lv_label_set_text(calLabel, "Shake!!!"); + if(taskCount == 0){ + refreshTask = lv_task_create(RefreshTaskCallback, 100, LV_TASK_PRIO_MID, this); + lv_label_set_text(calLabel, "Shake!!!"); + }else{ + + lv_task_del(refreshTask); + taskCount=0; + lv_label_set_text(calLabel, "Calibrate"); + } break; } + case LV_EVENT_VALUE_CHANGED: { if (object == positionArc) { settingsController.SetShakeThreshold(lv_arc_get_value(positionArc)); diff --git a/src/displayapp/screens/settings/Settings.cpp b/src/displayapp/screens/settings/Settings.cpp index cf78ad13..0f77456a 100644 --- a/src/displayapp/screens/settings/Settings.cpp +++ b/src/displayapp/screens/settings/Settings.cpp @@ -66,7 +66,7 @@ std::unique_ptr Settings::CreateScreen3() { {Symbols::none, "None", Apps::None} }}; if (settingsController.isWakeUpModeOn(Pinetime::Controllers::Settings::WakeUpMode::Shake)) { - applications[1] = {Symbols::list, "Shake Threshold", Apps::SettingShakeThreshold}; + applications[1] = {Symbols::list, "Wake Sense", Apps::SettingShakeThreshold}; } return std::make_unique(2, 3, app, settingsController, applications); } \ No newline at end of file -- cgit v1.2.3-70-g09d2 From 92b1e83e3efab14140fa48267dbb49c4210ea85c Mon Sep 17 00:00:00 2001 From: Tim Keller Date: Tue, 5 Oct 2021 03:29:49 +0000 Subject: Remove "fancy" settings display and always show ShakeWakeThresholdSetting --- src/displayapp/screens/settings/Settings.cpp | 24 ++++++++++-------------- 1 file changed, 10 insertions(+), 14 deletions(-) (limited to 'src/displayapp/screens/settings/Settings.cpp') diff --git a/src/displayapp/screens/settings/Settings.cpp b/src/displayapp/screens/settings/Settings.cpp index 0f77456a..ea72ec96 100644 --- a/src/displayapp/screens/settings/Settings.cpp +++ b/src/displayapp/screens/settings/Settings.cpp @@ -47,26 +47,22 @@ std::unique_ptr Settings::CreateScreen1() { std::unique_ptr Settings::CreateScreen2() { - std::array applications {{ - {Symbols::shoe, "Steps", Apps::SettingSteps}, - {Symbols::clock, "Set date", Apps::SettingSetDate}, - {Symbols::clock, "Set time", Apps::SettingSetTime}, - {Symbols::batteryHalf, "Battery", Apps::BatteryInfo} - }}; + std::array applications {{{Symbols::shoe, "Steps", Apps::SettingSteps}, + {Symbols::clock, "Set date", Apps::SettingSetDate}, + {Symbols::clock, "Set time", Apps::SettingSetTime}, + {Symbols::batteryHalf, "Battery", Apps::BatteryInfo}}}; return std::make_unique(1, 3, app, settingsController, applications); } std::unique_ptr Settings::CreateScreen3() { - std::array applications {{ - {Symbols::check, "Firmware", Apps::FirmwareValidation}, - {Symbols::list, "About", Apps::SysInfo}, - {Symbols::none, "None", Apps::None}, - {Symbols::none, "None", Apps::None} + std::array applications {{{Symbols::paintbrush, "PTS Colors", Apps::SettingPineTimeStyle}, + {Symbols::none, "Wake Sense", Apps::SettingShakeThreshold}, + {Symbols::check, "Firmware", Apps::FirmwareValidation}, + {Symbols::list, "About", Apps::SysInfo} + }}; - if (settingsController.isWakeUpModeOn(Pinetime::Controllers::Settings::WakeUpMode::Shake)) { - applications[1] = {Symbols::list, "Wake Sense", Apps::SettingShakeThreshold}; - } + return std::make_unique(2, 3, app, settingsController, applications); } \ No newline at end of file -- cgit v1.2.3-70-g09d2 From e82469bffac6383ab898fa71dc3a88e164dc86ff Mon Sep 17 00:00:00 2001 From: Tim Keller Date: Fri, 12 Nov 2021 00:53:27 +0000 Subject: Fix setting removing it self from wake settings when opening calibration window twice. --- src/displayapp/screens/settings/SettingShakeThreshold.cpp | 1 + src/displayapp/screens/settings/Settings.cpp | 6 +++--- 2 files changed, 4 insertions(+), 3 deletions(-) (limited to 'src/displayapp/screens/settings/Settings.cpp') diff --git a/src/displayapp/screens/settings/SettingShakeThreshold.cpp b/src/displayapp/screens/settings/SettingShakeThreshold.cpp index 06e233c4..1791b550 100644 --- a/src/displayapp/screens/settings/SettingShakeThreshold.cpp +++ b/src/displayapp/screens/settings/SettingShakeThreshold.cpp @@ -63,6 +63,7 @@ SettingShakeThreshold::SettingShakeThreshold(DisplayApp* app, vDecay = xTaskGetTickCount(); calibrating = false; + EnableForCal = false; if(!settingsController.isWakeUpModeOn(Pinetime::Controllers::Settings::WakeUpMode::Shake)){ EnableForCal = true; settingsController.setWakeUpMode(Pinetime::Controllers::Settings::WakeUpMode::Shake,true); diff --git a/src/displayapp/screens/settings/Settings.cpp b/src/displayapp/screens/settings/Settings.cpp index ea72ec96..e59d68e4 100644 --- a/src/displayapp/screens/settings/Settings.cpp +++ b/src/displayapp/screens/settings/Settings.cpp @@ -57,10 +57,10 @@ std::unique_ptr Settings::CreateScreen2() { std::unique_ptr Settings::CreateScreen3() { - std::array applications {{{Symbols::paintbrush, "PTS Colors", Apps::SettingPineTimeStyle}, - {Symbols::none, "Wake Sense", Apps::SettingShakeThreshold}, + std::array applications {{{Symbols::none, "Wake Sense", Apps::SettingShakeThreshold}, {Symbols::check, "Firmware", Apps::FirmwareValidation}, - {Symbols::list, "About", Apps::SysInfo} + {Symbols::list, "About", Apps::SysInfo}, + {Symbols::none, "None", Apps::None} }}; -- cgit v1.2.3-70-g09d2