Change step gauge range to 100 and calculate progress as percantage (#468)
This commit is contained in:
parent
084123b752
commit
6a91b83b12
|
@ -179,8 +179,8 @@ PineTimeStyle::PineTimeStyle(DisplayApp* app,
|
||||||
lv_obj_align(stepGauge, sidebar, LV_ALIGN_IN_BOTTOM_MID, 0, 0);
|
lv_obj_align(stepGauge, sidebar, LV_ALIGN_IN_BOTTOM_MID, 0, 0);
|
||||||
lv_gauge_set_scale(stepGauge, 360, 11, 0);
|
lv_gauge_set_scale(stepGauge, 360, 11, 0);
|
||||||
lv_gauge_set_angle_offset(stepGauge, 180);
|
lv_gauge_set_angle_offset(stepGauge, 180);
|
||||||
lv_gauge_set_critical_value(stepGauge, (settingsController.GetStepsGoal() / 100));
|
lv_gauge_set_critical_value(stepGauge, 100);
|
||||||
lv_gauge_set_range(stepGauge, 0, (settingsController.GetStepsGoal() / 100));
|
lv_gauge_set_range(stepGauge, 0, 100);
|
||||||
lv_gauge_set_value(stepGauge, 0, 0);
|
lv_gauge_set_value(stepGauge, 0, 0);
|
||||||
|
|
||||||
lv_obj_set_style_local_pad_right(stepGauge, LV_GAUGE_PART_MAIN, LV_STATE_DEFAULT, 3);
|
lv_obj_set_style_local_pad_right(stepGauge, LV_GAUGE_PART_MAIN, LV_STATE_DEFAULT, 3);
|
||||||
|
@ -328,7 +328,7 @@ bool PineTimeStyle::Refresh() {
|
||||||
stepCount = motionController.NbSteps();
|
stepCount = motionController.NbSteps();
|
||||||
motionSensorOk = motionController.IsSensorOk();
|
motionSensorOk = motionController.IsSensorOk();
|
||||||
if (stepCount.IsUpdated() || motionSensorOk.IsUpdated()) {
|
if (stepCount.IsUpdated() || motionSensorOk.IsUpdated()) {
|
||||||
lv_gauge_set_value(stepGauge, 0, (stepCount.Get() / 100));
|
lv_gauge_set_value(stepGauge, 0, (stepCount.Get() / (settingsController.GetStepsGoal() / 100)));
|
||||||
lv_obj_realign(stepGauge);
|
lv_obj_realign(stepGauge);
|
||||||
if (stepCount.Get() > settingsController.GetStepsGoal()) {
|
if (stepCount.Get() > settingsController.GetStepsGoal()) {
|
||||||
lv_obj_set_style_local_line_color(stepGauge, LV_GAUGE_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_WHITE);
|
lv_obj_set_style_local_line_color(stepGauge, LV_GAUGE_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_WHITE);
|
||||||
|
|
Loading…
Reference in a new issue