aboutsummaryrefslogtreecommitdiffstats
path: root/src/displayapp/screens
diff options
context:
space:
mode:
Diffstat (limited to 'src/displayapp/screens')
-rw-r--r--src/displayapp/screens/settings/SettingSteps.cpp32
1 files changed, 18 insertions, 14 deletions
diff --git a/src/displayapp/screens/settings/SettingSteps.cpp b/src/displayapp/screens/settings/SettingSteps.cpp
index a6b6f4a8..8d756c1c 100644
--- a/src/displayapp/screens/settings/SettingSteps.cpp
+++ b/src/displayapp/screens/settings/SettingSteps.cpp
@@ -68,21 +68,25 @@ SettingSteps::~SettingSteps() {
void SettingSteps::UpdateSelected(lv_obj_t* object, lv_event_t event) {
uint32_t value = settingsController.GetStepsGoal();
- if (object == btnPlus && (event == LV_EVENT_PRESSED)) {
- value += 1000;
- if (value <= 500000) {
- settingsController.SetStepsGoal(value);
- lv_label_set_text_fmt(stepValue, "%lu", settingsController.GetStepsGoal());
- lv_obj_align(stepValue, lv_scr_act(), LV_ALIGN_CENTER, 0, -10);
- }
+
+ int valueChange = 0;
+ if (event == LV_EVENT_SHORT_CLICKED) {
+ valueChange = 500;
+ } else if (event == LV_EVENT_LONG_PRESSED || event == LV_EVENT_LONG_PRESSED_REPEAT) {
+ valueChange = 1000;
+ } else {
+ return;
+ }
+
+ if (object == btnPlus) {
+ value += valueChange;
+ } else if (object == btnMinus) {
+ value -= valueChange;
}
- if (object == btnMinus && (event == LV_EVENT_PRESSED)) {
- value -= 1000;
- if (value >= 1000) {
- settingsController.SetStepsGoal(value);
- lv_label_set_text_fmt(stepValue, "%lu", settingsController.GetStepsGoal());
- lv_obj_align(stepValue, lv_scr_act(), LV_ALIGN_CENTER, 0, -10);
- }
+ if (value >= 1000 && value <= 500000) {
+ settingsController.SetStepsGoal(value);
+ lv_label_set_text_fmt(stepValue, "%lu", settingsController.GetStepsGoal());
+ lv_obj_realign(stepValue);
}
}