diff --git a/README.md b/README.md
index 04fc747..04f07a3 100644
--- a/README.md
+++ b/README.md
@@ -19,4 +19,10 @@ Trail running focused Garmin watch DataField (for myself)
- cadence
- distance to destination gauge
+# Settings
+
+- 3 theme colors
+ - set primary theme color to 0 to use the HR color instead
+- HR display type (value, percentage, zone)
+

diff --git a/resources/settings/properties.xml b/resources/settings/properties.xml
index 8ddb74e..d1a400d 100644
--- a/resources/settings/properties.xml
+++ b/resources/settings/properties.xml
@@ -1,6 +1,7 @@
- 1.0.3
- 0088FF
+ 1.1.0
+ 0
0088FF
FFFF00
+ 0
diff --git a/resources/settings/settings.xml b/resources/settings/settings.xml
index 1366662..007944d 100644
--- a/resources/settings/settings.xml
+++ b/resources/settings/settings.xml
@@ -12,5 +12,12 @@
+
+
+ @Strings.HrValue
+ @Strings.HrPercentage
+ @Strings.HrZone
+
+
\ No newline at end of file
diff --git a/resources/strings/strings.xml b/resources/strings/strings.xml
index ccec925..73a3f73 100644
--- a/resources/strings/strings.xml
+++ b/resources/strings/strings.xml
@@ -4,4 +4,8 @@
Primary Theme Color
Secondary Theme Color
Clock Color
+ Heart Rate Display
+ Value
+ Percentage
+ Zone
diff --git a/source/RepaFieldView.mc b/source/RepaFieldView.mc
index fcabd77..e4d4fbf 100644
--- a/source/RepaFieldView.mc
+++ b/source/RepaFieldView.mc
@@ -6,17 +6,41 @@ import Toybox.WatchUi;
import Toybox.System;
import Toybox.Application;
+const HR_TYPE_PERCENT = 1;
+const HR_TYPE_ZONE = 2;
+
+function displayHr(hr as Number, type as Number, zones as Array) as String {
+ if (hr == 0) {
+ return "-";
+ } else if (type == 1) {
+ var maxHr = zones[zones.size() - 1];
+ var percentage = (hr.toFloat() / maxHr) * 100;
+ return percentage.format("%.0f") + "%";
+ } else if (type == 2) {
+ var hrzsize = zones.size();
+ for (var i = 0; i < hrzsize; i++) {
+ if (hr < zones[i] || i == hrzsize - 1) {
+ return ((hr - zones[i - 1]) / (zones[i] - zones[i - 1]).toFloat() + i).format("%.1f");
+ }
+ }
+ } else { // type == 0 or anything else
+ return hr.format("%d");
+ }
+ return "?";
+}
+
class RepaFieldView extends WatchUi.DataField {
// settings
- hidden var themeColor as Numeric;
- hidden var themeColor2 as Numeric;
- hidden var themeColor3 as Numeric;
- hidden var hrZones as Array;
- hidden var hrHist as Array;
- hidden var hrZoneColors as Array;
- hidden var cadenceZones as Array;
- hidden var cadenceZoneColors as Array;
+ hidden var themeColor as Number;
+ hidden var themeColor2 as Number;
+ hidden var themeColor3 as Number;
+ hidden var hrDisplayType as Number;
+ hidden var hrZones as Array;
+ hidden var hrHist as Array;
+ hidden var hrZoneColors as Array;
+ hidden var cadenceZones as Array;
+ hidden var cadenceZoneColors as Array;
hidden var isDistanceMetric as Boolean;
hidden var isElevationMetric as Boolean;
hidden var mileToKm as Float = 1.609344f;
@@ -65,6 +89,7 @@ class RepaFieldView extends WatchUi.DataField {
themeColor = Application.Properties.getValue("themeColor").toNumberWithBase(16);
themeColor2 = Application.Properties.getValue("themeColor2").toNumberWithBase(16);
themeColor3 = Application.Properties.getValue("themeColor3").toNumberWithBase(16);
+ hrDisplayType = Application.Properties.getValue("hrDisplay").toNumber();
hrValue = 0;
ahrValue = 0;
@@ -167,9 +192,13 @@ class RepaFieldView extends WatchUi.DataField {
fHrGraph.setHRZoneColors(hrZoneColors);
// theme setup
- fBgOverlay.setColor1(darken(themeColor, 4));
- fBgOverlay.setColor2(darken(themeColor, 2));
- fAPace.setColor(themeColor);
+ if (themeColor != 0) {
+ fBgOverlay.setColor1(darken(themeColor, 4));
+ fBgOverlay.setColor2(darken(themeColor, 2));
+ fAPace.setColor(themeColor);
+ } else {
+ fAPace.setColor(Graphics.COLOR_WHITE);
+ }
fElevation.setColor(themeColor2);
fElevationGain.setColor(themeColor2);
fElevationLoss.setColor(themeColor2);
@@ -287,16 +316,23 @@ class RepaFieldView extends WatchUi.DataField {
// HR value
var hrColor = calculateZoneColor(hrValue, hrZones, hrZoneColors);
fHr.setColor(hrColor);
- fHr.setText(hrValue.format("%d"));
fAHr.setColor(darken(calculateZoneColor(ahrValue, hrZones, hrZoneColors), 2));
- fAHr.setText(ahrValue.format("%d"));
fMHr.setColor(darken(calculateZoneColor(mhrValue, hrZones, hrZoneColors), 2));
- fMHr.setText(mhrValue.format("%d"));
+
+ fHr.setText(displayHr(hrValue, hrDisplayType, hrZones));
+ fAHr.setText(displayHr(ahrValue, hrDisplayType, hrZones));
+ fMHr.setText(displayHr(mhrValue, hrDisplayType, hrZones));
+
if (fHrGraph != null) {
fHrGraph.setHRHist(hrHist);
fHrGraph.setHRTicks(hrTicks);
}
+ if (themeColor == 0) {
+ fBgOverlay.setColor1(darken(hrColor, 4));
+ fBgOverlay.setColor2(darken(hrColor, 2));
+ }
+
// track
if (fTrack != null) {
fTrack.setToDestination(toDestination);