From b221508a3fd228d6f0bcd65c1ef3c64eee63bcbf Mon Sep 17 00:00:00 2001 From: R Date: Thu, 25 Jan 2024 11:33:15 +0100 Subject: [PATCH] bugfix - indicator for zero value --- CHANGELOG.md | 3 +++ manifest.xml | 2 +- manifest.xml.prod | 2 +- source/SmartArcsActiveView.mc | 31 ++++++++++++++++++++----------- 4 files changed, 25 insertions(+), 13 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 954e946..2c2ef3c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,6 @@ +# 2.0.2 (January 25, 2024) +* bugfix - indicator for zero value + # 2.0.1 (January 23, 2024) * bugfix - loading settings diff --git a/manifest.xml b/manifest.xml index 1f5ec33..21107cb 100644 --- a/manifest.xml +++ b/manifest.xml @@ -1,7 +1,7 @@ - + diff --git a/manifest.xml.prod b/manifest.xml.prod index 1f5ec33..21107cb 100644 --- a/manifest.xml.prod +++ b/manifest.xml.prod @@ -1,7 +1,7 @@ - + diff --git a/source/SmartArcsActiveView.mc b/source/SmartArcsActiveView.mc index c635447..c231a2c 100644 --- a/source/SmartArcsActiveView.mc +++ b/source/SmartArcsActiveView.mc @@ -111,6 +111,13 @@ class SmartArcsActiveView extends WatchUi.WatchFace { var sunriseColor; var sunsetColor; + enum { + STEPS = 1, + STAIRS = 2, + BODY_BATTERY = 3, + STRESS = 4 + } + function initialize() { WatchFace.initialize(); } @@ -682,7 +689,7 @@ class SmartArcsActiveView extends WatchUi.WatchFace { distance = (distance/100000.0).format("%.2f"); } - drawActivity(dc, 1, steps, distance, stepsGoal, recalculateCoordinate(70), activity1Y, activity2Y, activityArcY); + drawActivity(dc, STEPS, steps, distance, stepsGoal, recalculateCoordinate(70), activity1Y, activity2Y, activityArcY); } function drawFloors(dc, floorsClimbed, floorsDescended, floorsGoal) { @@ -696,15 +703,15 @@ class SmartArcsActiveView extends WatchUi.WatchFace { floorsGoal = 0; } - drawActivity(dc, 2, floorsClimbed, floorsDescended.toString(), floorsGoal, recalculateCoordinate(-30), activity1Y, activity2Y, activityArcY); + drawActivity(dc, STAIRS, floorsClimbed, floorsDescended.toString(), floorsGoal, recalculateCoordinate(-30), activity1Y, activity2Y, activityArcY); } function drawBodyBattery(dc) { - drawActivity(dc, 3, getLastHistoryValue(Toybox.SensorHistory.getBodyBatteryHistory({:period=>1})), -1, 100, recalculateCoordinate(40), screenRadius - (activity1Y - screenRadius + (halfFontHeight * 2)) - recalculateCoordinate(10 - 1), -1, screenRadius - (activityArcY - screenRadius) - recalculateCoordinate(7)); + drawActivity(dc, BODY_BATTERY, getLastHistoryValue(Toybox.SensorHistory.getBodyBatteryHistory({:period=>1})), -1, 100, recalculateCoordinate(40), screenRadius - (activity1Y - screenRadius + (halfFontHeight * 2)) - recalculateCoordinate(10 - 1), -1, screenRadius - (activityArcY - screenRadius) - recalculateCoordinate(7)); } function drawStress(dc) { - drawActivity(dc, 4, getLastHistoryValue(Toybox.SensorHistory.getStressHistory({:period=>1})), -1, 100, recalculateCoordinate(-40), screenRadius - (activity1Y - screenRadius + (halfFontHeight * 2)) - recalculateCoordinate(10 - 1), -1, screenRadius - (activityArcY - screenRadius) - recalculateCoordinate(7)); + drawActivity(dc, STRESS, getLastHistoryValue(Toybox.SensorHistory.getStressHistory({:period=>1})), -1, 100, recalculateCoordinate(-40), screenRadius - (activity1Y - screenRadius + (halfFontHeight * 2)) - recalculateCoordinate(10 - 1), -1, screenRadius - (activityArcY - screenRadius) - recalculateCoordinate(7)); } //activityType - 1 steps, 2 stairs, 3 body battery, 4 stress @@ -719,6 +726,12 @@ class SmartArcsActiveView extends WatchUi.WatchFace { var progressXShift = xShift - recalculateCoordinate(5); dc.setColor(activityColor, Graphics.COLOR_TRANSPARENT); + if (activity1 > 0 || activity2.toFloat() > 0 || showZero) { + dc.setPenWidth(1); + dc.drawArc(screenRadius - progressXShift, activityArcY, halfFontHeight - 1, Graphics.ARC_COUNTER_CLOCKWISE, startActivityAngle, endActivityAngle); + dc.drawArc(screenRadius - progressXShift, activityArcY, halfFontHeight + 3, Graphics.ARC_COUNTER_CLOCKWISE, startActivityAngle, endActivityAngle); + } + if (activity1 > 0 || showZero) { if (activity1 == 999999) { dc.drawText(screenRadius - xShift, activity1Y, font, "--", Graphics.TEXT_JUSTIFY_LEFT); @@ -727,10 +740,6 @@ class SmartArcsActiveView extends WatchUi.WatchFace { dc.drawText(screenRadius - xShift, activity1Y, font, activity1, Graphics.TEXT_JUSTIFY_LEFT); } - dc.setPenWidth(1); - dc.drawArc(screenRadius - progressXShift, activityArcY, halfFontHeight - 1, Graphics.ARC_COUNTER_CLOCKWISE, startActivityAngle, endActivityAngle); - dc.drawArc(screenRadius - progressXShift, activityArcY, halfFontHeight + 3, Graphics.ARC_COUNTER_CLOCKWISE, startActivityAngle, endActivityAngle); - dc.setPenWidth(recalculateCoordinate(5)); if (activity1 > 0) { @@ -742,15 +751,15 @@ class SmartArcsActiveView extends WatchUi.WatchFace { } else if (endAngle.toNumber() == startActivityAngle) { endAngle = startActivityAngle + 1; } - if ((activityType == 3 && activity1 > 25) || (activityType == 4 && activity1 < 75)) { + if ((activityType == BODY_BATTERY && activity1 > 25) || (activityType == STRESS && activity1 < 75)) { dc.setColor(bbStressArcColor, Graphics.COLOR_TRANSPARENT); - } else if (activityType >= 3) { + } else if (activityType >= BODY_BATTERY) { dc.setColor(bbStressWarningArcColor, Graphics.COLOR_TRANSPARENT); } dc.drawArc(screenRadius - progressXShift, activityArcY, halfFontHeight + 1, Graphics.ARC_COUNTER_CLOCKWISE, startActivityAngle, endAngle); } } - if (activityType <= 2 && (activity2.toFloat() > 0 || showZero)) { + if (activityType <= STAIRS && (activity2.toFloat() > 0 || showZero)) { dc.setColor(activityColor, Graphics.COLOR_TRANSPARENT); dc.drawText(screenRadius - xShift + recalculateCoordinate(20), activity2Y, font, activity2, Graphics.TEXT_JUSTIFY_LEFT); }