Switch outside border to seconds on gravel watchface

This commit is contained in:
Josh 2024-05-13 15:12:54 -04:00
parent a4ae3d4483
commit 652221aa8c
2 changed files with 8 additions and 6 deletions

View File

@ -129,6 +129,8 @@ void WatchFaceGravel::Refresh() {
} }
lv_label_set_text(labelTimeAMPM, ampmChar); 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_label_set_text_fmt(labelTime, "%02d:%02d", hour, minute);
lv_obj_align_origo(labelTime, lv_scr_act(), LV_ALIGN_CENTER, 0, 0); lv_obj_align_origo(labelTime, lv_scr_act(), LV_ALIGN_CENTER, 0, 0);
@ -141,11 +143,11 @@ void WatchFaceGravel::Refresh() {
lv_obj_realign(labelDate); lv_obj_realign(labelDate);
} }
stepCount = motionController.NbSteps(); /*stepCount = motionController.NbSteps();
if (stepCount.IsUpdated()) { 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_line_set_points(stepLine, stepLinePoints.data(), pointCount);
} }*/
lv_obj_realign(stepLine); lv_obj_realign(stepLine);
isCharging = batteryController.IsCharging(); 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 // 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; uint16_t currentPointIndex = 0;
if (stepCount == 0) if (stepCount == 0)
@ -271,7 +273,7 @@ uint16_t WatchFaceGravel::refreshStepLinePoints(uint32_t stepCount) {
stepLinePoints[currentPointIndex++] = {.x = x, .y = y}; stepLinePoints[currentPointIndex++] = {.x = x, .y = y};
}; };
float progress = static_cast<float>(stepCount * 100) / static_cast<float>(settingsController.GetStepsGoal()); float progress = static_cast<float>(stepCount * 100) / static_cast<float>(max);
float percent = (scope / 100.0F) * progress; float percent = (scope / 100.0F) * progress;
auto drawEnd = getDrawEnd(percent, barWidth, barHeight); auto drawEnd = getDrawEnd(percent, barWidth, barHeight);

View File

@ -76,7 +76,7 @@ namespace Pinetime {
} DrawStop; } DrawStop;
DrawStop getDrawEnd(float percent, uint16_t width, uint16_t height); 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 updateBatteryBar(uint8_t percent);
void toggleBatteryChargingAnimation(bool enabled, uint8_t percent); void toggleBatteryChargingAnimation(bool enabled, uint8_t percent);
}; };