@@ -44,11 +44,11 @@ Steps::Steps(Controllers::MotionController& motionController, Controllers::Setti
4444 lv_obj_align (lStepsYesterday, lSteps, LV_ALIGN_OUT_BOTTOM_MID , 0 , 20 );
4545 lv_obj_set_auto_realign (lStepsYesterday, true );
4646
47- lv_obj_t * lstepsGoal = lv_label_create (lv_scr_act (), nullptr );
48- lv_obj_set_style_local_text_color (lstepsGoal , LV_LABEL_PART_MAIN , LV_STATE_DEFAULT , LV_COLOR_CYAN );
49- lv_label_set_text_fmt (lstepsGoal, " Goal: %5lu " , settingsController. GetStepsGoal () );
50- lv_label_set_align (lstepsGoal, LV_LABEL_ALIGN_CENTER );
51- lv_obj_align (lstepsGoal, lSteps, LV_ALIGN_OUT_BOTTOM_MID , 0 , 40 );
47+ lStepsGoal = lv_label_create (lv_scr_act (), nullptr );
48+ lv_obj_set_style_local_text_color (lStepsGoal , LV_LABEL_PART_MAIN , LV_STATE_DEFAULT , LV_COLOR_CYAN );
49+ lv_label_set_align (lStepsGoal, LV_LABEL_ALIGN_CENTER );
50+ lv_obj_align (lStepsGoal, lSteps, LV_ALIGN_OUT_BOTTOM_MID , 0 , 40 );
51+ lv_obj_set_auto_realign (lStepsGoal, true );
5252
5353 resetBtn = lv_btn_create (lv_scr_act (), nullptr );
5454 resetBtn->user_data = this ;
@@ -62,7 +62,8 @@ Steps::Steps(Controllers::MotionController& motionController, Controllers::Setti
6262
6363 tripLabel = lv_label_create (lv_scr_act (), nullptr );
6464 lv_obj_set_style_local_text_color (tripLabel, LV_LABEL_PART_MAIN , LV_STATE_DEFAULT , LV_COLOR_YELLOW );
65- lv_obj_align (tripLabel, lstepsGoal, LV_ALIGN_IN_LEFT_MID , 0 , 20 );
65+ lv_obj_align (tripLabel, lStepsGoal, LV_ALIGN_IN_LEFT_MID , 0 , 20 );
66+ lv_obj_set_auto_realign (tripLabel, true );
6667
6768 Refresh ();
6869 taskRefresh = lv_task_create (RefreshTaskCallback, LV_DISP_DEF_REFR_PERIOD , LV_TASK_PRIO_MID , this );
@@ -76,14 +77,16 @@ Steps::~Steps() {
7677void Steps::Refresh () {
7778 stepsCount = motionController.NbSteps ();
7879 currentTripSteps = motionController.GetTripSteps ();
80+ stepsGoal = settingsController.GetStepsGoal ();
7981
80- if (stepsCount.IsUpdated ()) {
82+ if (stepsCount.IsUpdated () || stepsGoal. IsUpdated () ) {
8183 lv_label_set_text_fmt (lSteps, " %lu" , stepsCount.Get ());
84+ lv_label_set_text_fmt (lStepsGoal, " Goal: %5lu" , stepsGoal.Get ());
8285 lv_label_set_text_fmt (lStepsYesterday, " Yest: %5lu" , motionController.NbSteps (Days::Yesterday));
83- lv_arc_set_value (stepsArc, int16_t (500 * stepsCount.Get () / settingsController. GetStepsGoal ()));
86+ lv_arc_set_value (stepsArc, int16_t (500 * stepsCount.Get () / stepsGoal. Get ()));
8487 }
8588
86- if (currentTripSteps.IsUpdated ()) { // Can be because of Reset button pressed
89+ if (currentTripSteps.IsUpdated ()) {
8790 if (currentTripSteps.Get () < 100000 ) {
8891 lv_label_set_text_fmt (tripLabel, " Trip: %5li" , currentTripSteps.Get ());
8992 } else {
0 commit comments