@@ -22,19 +22,19 @@ Steps::Steps(Pinetime::Applications::DisplayApp* app,
2222 lv_obj_set_style_local_radius (stepsArc, LV_ARC_PART_BG, LV_STATE_DEFAULT, 0 );
2323 lv_obj_set_style_local_line_color (stepsArc, LV_ARC_PART_INDIC, LV_STATE_DEFAULT, lv_color_hex (0x0000FF ));
2424 lv_arc_set_end_angle (stepsArc, 200 );
25- lv_obj_set_size (stepsArc, 200 , 200 );
25+ lv_obj_set_size (stepsArc, 240 , 240 );
2626 lv_arc_set_range (stepsArc, 0 , 500 );
27- lv_obj_align (stepsArc, nullptr , LV_ALIGN_CENTER, 0 , - 20 );
27+ lv_obj_align (stepsArc, nullptr , LV_ALIGN_CENTER, 0 , 0 );
2828
2929 stepsCount = motionController.NbSteps ();
30- currentLapSteps = stepsCount - motionController.GetPrevTotalSteps ();
30+ currentTripSteps = stepsCount - motionController.GetTripSteps ();
3131
3232 lv_arc_set_value (stepsArc, int16_t (500 * stepsCount / settingsController.GetStepsGoal ()));
3333
3434 lSteps = lv_label_create (lv_scr_act (), nullptr );
3535 lv_obj_set_style_local_text_color (lSteps, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, lv_color_hex (0x00FF00 ));
3636 lv_obj_set_style_local_text_font (lSteps, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, &jetbrains_mono_42);
37- lv_label_set_text_fmt (lSteps, " %li" , currentLapSteps );
37+ lv_label_set_text_fmt (lSteps, " %li" , stepsCount );
3838 lv_obj_align (lSteps, nullptr , LV_ALIGN_CENTER, 0 , -40 );
3939
4040 lv_obj_t * lstepsL = lv_label_create (lv_scr_act (), nullptr );
@@ -44,7 +44,7 @@ Steps::Steps(Pinetime::Applications::DisplayApp* app,
4444
4545 lv_obj_t * lstepsGoal = lv_label_create (lv_scr_act (), nullptr );
4646 lv_obj_set_style_local_text_color (lstepsGoal, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_CYAN);
47- lv_label_set_text_fmt (lstepsGoal, " Goal\n %lu" , settingsController.GetStepsGoal ());
47+ lv_label_set_text_fmt (lstepsGoal, " Goal: %lu" , settingsController.GetStepsGoal ());
4848 lv_label_set_align (lstepsGoal, LV_LABEL_ALIGN_CENTER);
4949 lv_obj_align (lstepsGoal, lSteps, LV_ALIGN_OUT_BOTTOM_MID, 0 , 30 );
5050
@@ -54,21 +54,27 @@ Steps::Steps(Pinetime::Applications::DisplayApp* app,
5454 lv_obj_set_pos (backgroundLabel, 0 , 0 );
5555 lv_label_set_text_static (backgroundLabel, " " );
5656
57- btnLap = lv_btn_create (lv_scr_act (), nullptr );
58- btnLap->user_data = this ;
59- lv_obj_set_event_cb (btnLap, lap_event_handler);
60- lv_obj_set_height (btnLap, 50 );
61- lv_obj_set_width (btnLap, 115 );
62- lv_obj_align (btnLap, lv_scr_act (), LV_ALIGN_IN_BOTTOM_LEFT, 0 , 0 );
63- lv_obj_set_style_local_bg_color (btnLap, LV_BTN_PART_MAIN, LV_STATE_DISABLED, lv_color_hex (0x080808 ));
64- txtLap = lv_label_create (btnLap, nullptr );
65- lv_obj_set_style_local_text_color (btnLap, LV_BTN_PART_MAIN, LV_STATE_DISABLED, lv_color_hex (0x888888 ));
66- lv_label_set_text (txtLap, Symbols::lapsFlag);
67-
68- totalStepsText = lv_label_create (lv_scr_act (), nullptr );
69- lv_obj_set_style_local_text_color (totalStepsText, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_YELLOW);
70- lv_label_set_text_fmt (totalStepsText, " Total\n %li" , motionController.GetPrevTotalSteps ());
71- lv_obj_align (totalStepsText, lv_scr_act (), LV_ALIGN_IN_BOTTOM_RIGHT, 0 , 0 );
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" );
67+
68+ if (stepsCount >= motionController.GetTripSteps ()){
69+ currentTripSteps = stepsCount - motionController.GetTripSteps ();
70+ } else {
71+ currentTripSteps = stepsCount + motionController.GetTripSteps ();
72+ }
73+
74+ tripText = lv_label_create (lv_scr_act (), nullptr );
75+ lv_obj_set_style_local_text_color (tripText, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_YELLOW);
76+ lv_label_set_text_fmt (tripText, " Trip: %li" , currentTripSteps);
77+ lv_obj_align (tripText, lSteps, LV_ALIGN_OUT_BOTTOM_MID, 0 , 50 );
7278
7379 taskRefresh = lv_task_create (RefreshTaskCallback, 100 , LV_TASK_PRIO_MID, this );
7480}
@@ -80,13 +86,17 @@ Steps::~Steps() {
8086
8187void Steps::Refresh () {
8288 stepsCount = motionController.NbSteps ();
83- currentLapSteps = stepsCount - motionController.GetPrevTotalSteps ();
89+ if (stepsCount >= motionController.GetTripSteps ()){
90+ currentTripSteps = stepsCount - motionController.GetTripSteps ();
91+ } else {
92+ currentTripSteps = stepsCount + motionController.GetTripSteps ();
93+ }
8494
85- lv_label_set_text_fmt (lSteps, " %li" , currentLapSteps );
95+ lv_label_set_text_fmt (lSteps, " %li" , stepsCount );
8696 lv_obj_align (lSteps, nullptr , LV_ALIGN_CENTER, 0 , -40 );
8797
88- lv_label_set_text_fmt (totalStepsText , " Total \n %li" , stepsCount );
89- lv_obj_align (totalStepsText, lv_scr_act (), LV_ALIGN_IN_BOTTOM_RIGHT , 0 , 0 );
98+ lv_label_set_text_fmt (tripText , " Trip: %li" , currentTripSteps );
99+ lv_obj_align (tripText, lSteps, LV_ALIGN_OUT_BOTTOM_MID , 0 , 50 );
90100
91101 lv_arc_set_value (stepsArc, int16_t (500 * stepsCount / settingsController.GetStepsGoal ()));
92102}
@@ -96,7 +106,7 @@ void Steps::lapBtnEventHandler(lv_event_t event) {
96106 return ;
97107 }
98108 stepsCount = motionController.NbSteps ();
99- motionController.SetPrevTotalSteps (stepsCount);
109+ motionController.SetTripSteps (stepsCount);
100110 Refresh ();
101111}
102112
0 commit comments