Skip to content

Commit a65f173

Browse files
stephanie-engJF002
authored andcommitted
Renamed confusing variables and general cleanup
1 parent 7eff1db commit a65f173

4 files changed

Lines changed: 18 additions & 21 deletions

File tree

src/components/motion/MotionController.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ void MotionController::Update(int16_t x, int16_t y, int16_t z, uint32_t nbSteps)
1414
this->x = x;
1515
this->y = y;
1616
this->z = z;
17-
deltaSteps = nbSteps - this->nbSteps;
17+
int32_t deltaSteps = nbSteps - this->nbSteps;
1818
this->nbSteps = nbSteps;
1919
if(deltaSteps > 0){
2020
currentTripSteps += deltaSteps;

src/components/motion/MotionController.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,6 @@ namespace Pinetime {
5151

5252
private:
5353
uint32_t nbSteps;
54-
int32_t deltaSteps = 0;
5554
uint32_t currentTripSteps = 0;
5655
int16_t x;
5756
int16_t y;

src/displayapp/screens/Steps.cpp

Lines changed: 14 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -54,23 +54,21 @@ Steps::Steps(Pinetime::Applications::DisplayApp* app,
5454
lv_obj_set_pos(backgroundLabel, 0, 0);
5555
lv_label_set_text_static(backgroundLabel, "");
5656

57-
btnTrip = lv_btn_create(lv_scr_act(), nullptr);
58-
btnTrip->user_data = this;
59-
lv_obj_set_event_cb(btnTrip, lap_event_handler);
60-
lv_obj_set_height(btnTrip, 50);
61-
lv_obj_set_width(btnTrip, 115);
62-
lv_obj_align(btnTrip, lv_scr_act(), LV_ALIGN_IN_BOTTOM_MID, 0, 0);
63-
lv_obj_set_style_local_bg_color(btnTrip, LV_BTN_PART_MAIN, LV_STATE_DISABLED, lv_color_hex(0x080808));
64-
txtTrip = lv_label_create(btnTrip, nullptr);
65-
lv_obj_set_style_local_text_color(btnTrip, LV_BTN_PART_MAIN, LV_STATE_DISABLED, lv_color_hex(0x888888));
66-
lv_label_set_text(txtTrip, "Reset");
57+
resetBtn = lv_btn_create(lv_scr_act(), nullptr);
58+
resetBtn->user_data = this;
59+
lv_obj_set_event_cb(resetBtn, lap_event_handler);
60+
lv_obj_set_height(resetBtn, 50);
61+
lv_obj_set_width(resetBtn, 115);
62+
lv_obj_align(resetBtn, lv_scr_act(), LV_ALIGN_IN_BOTTOM_MID, 0, 0);
63+
resetButtonLabel = lv_label_create(resetBtn, nullptr);
64+
lv_label_set_text(resetButtonLabel, "Reset");
6765

6866
currentTripSteps = motionController.GetTripSteps();
6967

70-
tripText = lv_label_create(lv_scr_act(), nullptr);
71-
lv_obj_set_style_local_text_color(tripText, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_YELLOW);
72-
lv_label_set_text_fmt(tripText, "Trip: %5li", currentTripSteps);
73-
lv_obj_align(tripText, lstepsGoal, LV_ALIGN_IN_LEFT_MID, 0, 20);
68+
tripLabel = lv_label_create(lv_scr_act(), nullptr);
69+
lv_obj_set_style_local_text_color(tripLabel, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_YELLOW);
70+
lv_label_set_text_fmt(tripLabel, "Trip: %5li", currentTripSteps);
71+
lv_obj_align(tripLabel, lstepsGoal, LV_ALIGN_IN_LEFT_MID, 0, 20);
7472

7573
taskRefresh = lv_task_create(RefreshTaskCallback, 100, LV_TASK_PRIO_MID, this);
7674
}
@@ -88,9 +86,9 @@ void Steps::Refresh() {
8886
lv_obj_align(lSteps, nullptr, LV_ALIGN_CENTER, 0, -40);
8987

9088
if (currentTripSteps < 100000){
91-
lv_label_set_text_fmt(tripText, "Trip: %5li", currentTripSteps);
89+
lv_label_set_text_fmt(tripLabel, "Trip: %5li", currentTripSteps);
9290
} else {
93-
lv_label_set_text_fmt(tripText, "Trip: 99999+");
91+
lv_label_set_text_fmt(tripLabel, "Trip: 99999+");
9492
}
9593
lv_arc_set_value(stepsArc, int16_t(500 * stepsCount / settingsController.GetStepsGoal()));
9694
}

src/displayapp/screens/Steps.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,9 @@ namespace Pinetime {
3131
lv_obj_t* lSteps;
3232
lv_obj_t* lStepsIcon;
3333
lv_obj_t* stepsArc;
34-
lv_obj_t* btnTrip;
35-
lv_obj_t* txtTrip;
36-
lv_obj_t* tripText;
34+
lv_obj_t* resetBtn;
35+
lv_obj_t* resetButtonLabel;
36+
lv_obj_t* tripLabel;
3737

3838
uint32_t stepsCount;
3939

0 commit comments

Comments
 (0)