From 652221aa8c59e348ed4c6e1847391364d5f2972d Mon Sep 17 00:00:00 2001 From: Josh Date: Mon, 13 May 2024 15:12:54 -0400 Subject: [PATCH] Switch outside border to seconds on gravel watchface --- src/displayapp/screens/WatchFaceGravel.cpp | 12 +++++++----- src/displayapp/screens/WatchFaceGravel.h | 2 +- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/src/displayapp/screens/WatchFaceGravel.cpp b/src/displayapp/screens/WatchFaceGravel.cpp index b39be86e..24d29b95 100644 --- a/src/displayapp/screens/WatchFaceGravel.cpp +++ b/src/displayapp/screens/WatchFaceGravel.cpp @@ -129,6 +129,8 @@ void WatchFaceGravel::Refresh() { } lv_label_set_text(labelTimeAMPM, ampmChar); } + uint16_t pointCount = refreshStepLinePoints(dateTimeController.Seconds(), 60); + lv_line_set_points(stepLine, stepLinePoints.data(), pointCount); lv_label_set_text_fmt(labelTime, "%02d:%02d", hour, minute); lv_obj_align_origo(labelTime, lv_scr_act(), LV_ALIGN_CENTER, 0, 0); @@ -141,11 +143,11 @@ void WatchFaceGravel::Refresh() { lv_obj_realign(labelDate); } - stepCount = motionController.NbSteps(); + /*stepCount = motionController.NbSteps(); if (stepCount.IsUpdated()) { - uint16_t pointCount = refreshStepLinePoints(std::min(stepCount.Get(), settingsController.GetStepsGoal())); + uint16_t pointCount = refreshStepLinePoints(std::min(stepCount.Get(), settingsController.GetStepsGoal()), settingsController.GetStepsGoal()); lv_line_set_points(stepLine, stepLinePoints.data(), pointCount); - } + }*/ lv_obj_realign(stepLine); isCharging = batteryController.IsCharging(); @@ -255,7 +257,7 @@ WatchFaceGravel::DrawStop WatchFaceGravel::getDrawEnd(float percent, uint16_t wi } // Credit to https://github.com/mrwonderman/android-square-progressbar for original source -uint16_t WatchFaceGravel::refreshStepLinePoints(uint32_t stepCount) { +uint16_t WatchFaceGravel::refreshStepLinePoints(uint32_t stepCount, uint32_t max) { uint16_t currentPointIndex = 0; if (stepCount == 0) @@ -271,7 +273,7 @@ uint16_t WatchFaceGravel::refreshStepLinePoints(uint32_t stepCount) { stepLinePoints[currentPointIndex++] = {.x = x, .y = y}; }; - float progress = static_cast(stepCount * 100) / static_cast(settingsController.GetStepsGoal()); + float progress = static_cast(stepCount * 100) / static_cast(max); float percent = (scope / 100.0F) * progress; auto drawEnd = getDrawEnd(percent, barWidth, barHeight); diff --git a/src/displayapp/screens/WatchFaceGravel.h b/src/displayapp/screens/WatchFaceGravel.h index 480985e4..31f786c8 100644 --- a/src/displayapp/screens/WatchFaceGravel.h +++ b/src/displayapp/screens/WatchFaceGravel.h @@ -76,7 +76,7 @@ namespace Pinetime { } DrawStop; DrawStop getDrawEnd(float percent, uint16_t width, uint16_t height); - uint16_t refreshStepLinePoints(uint32_t stepCount); + uint16_t refreshStepLinePoints(uint32_t stepCount, uint32_t max); void updateBatteryBar(uint8_t percent); void toggleBatteryChargingAnimation(bool enabled, uint8_t percent); };