Skip to content

Commit

Permalink
default tempbasal to 1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
robertbuessow committed Jan 7, 2024
1 parent c6ddc7e commit 2e89737
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 21 deletions.
2 changes: 1 addition & 1 deletion GlucoseWatchFace/manifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
launcherIcon="@Drawables.LauncherIcon"
name="@Strings.AppName"
type="watchface"
version="1.1.20.pre">
version="1.2.0.pre">
<iq:products>
<iq:product id="legacyherocaptainmarvel"/>
<iq:product id="fr55"/>
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ bin-$(device)/%.prg: %/monkey.jungle %/manifest.xml %/source/_Version.mc %/sourc
[ -d "$(@D)" ] || mkdir "$(@D)"
monkeyc --jungle $< --output $@ $(MONKEYC_FLAGS) --optimization $(opt) --device $(device) $(test_flag)

bin/%.iq: %/monkey.jungle %/manifest.xml %/source/*.mc %/resources/_version.xml %/resources*/* $(shared_dep)
bin/%.iq: %/monkey.jungle %/manifest.xml %/source/_Version.mc %/source/*.mc %/resources/_version.xml %/resources*/* $(shared_dep)
[ -d "$(@D)" ] || mkdir "$(@D)"
monkeyc --jungle $< --output $@ $(MONKEYC_FLAGS) --optimization 3pz --package-app --release

Expand Down
12 changes: 5 additions & 7 deletions Shared/source/Data.mc
Original file line number Diff line number Diff line change
Expand Up @@ -95,16 +95,14 @@ class Data {

function getBasalCorrectionStr() as String {
if (fakeMode != normal) { return "S10%"; }
if (temporaryBasalRate == null || profile == null) {
return "-";
}
var tbr = Util.ifNullFloat(temporaryBasalRate, 1.0);
var s;
if (temporaryBasalRate < 1) {
s = (temporaryBasalRate * 100).format("%0.0f") + "%";
if (tbr < 1.0) {
s = (tbr * 100).format("%0.0f") + "%";
} else {
s = " " + temporaryBasalRate.format("%0.1f");
s = " " + tbr.format("%0.1f");
}
if (!"D".equals(profile)) {
if (profile != null && !"D".equals(profile)) {
s = profile + s;
}
return s;
Expand Down
25 changes: 13 additions & 12 deletions Shared/source/Graph.mc
Original file line number Diff line number Diff line change
Expand Up @@ -246,8 +246,8 @@ class Graph extends Ui.Drawable {
}
while (x < initialWidth) {
x += glucoseBarWidth + glucoseBarPadding;
drawRectangle(dc, glucoseRangeColor, x, yHigh, glucoseBarWidth, yHigh + 1);
drawRectangle(dc, glucoseRangeColor, x, yLow, glucoseBarWidth, yLow + 1);
drawRectangle(dc, glucoseRangeColor, x, yHigh, glucoseBarWidth, 1);
drawRectangle(dc, glucoseRangeColor, x, yLow, glucoseBarWidth, -1);
}
}

Expand Down Expand Up @@ -340,8 +340,8 @@ class Graph extends Ui.Drawable {
private function drawValue(dc as Gfx.Dc, startSec as Number, i as Number) as Void {
var x = getX(startSec, glucoseBuffer.getDateSec(i));
var y = getYForGlucose(glucoseBuffer.getValue(i));

var justification;

if (i < firstValueIdx + 3) {
justification = Gfx.TEXT_JUSTIFY_LEFT;
} else if (i > glucoseBuffer.size() - 3) {
Expand All @@ -353,20 +353,21 @@ class Graph extends Ui.Drawable {
}

dc.drawText(
xOffset + x, yOffset + y - 18,
Gfx.FONT_XTINY,
xOffset + x, yOffset + y - 25,
Gfx.FONT_TINY,
formatValue(glucoseBuffer.getValue(i)),
justification);
}

private function getColorForValue(glucose as Number) as Number {
if (useLowHighGlucoseMarks()) {
return glucose < lowGlucoseMark ? lowGlucoseHighlightColor
: glucose <= highGlucoseMark ? normalGlucoseHighlightColor
: highGlucoseHighlightColor;
} else {
return glucoseRangeColor;
}
return hrColor;
// if (useLowHighGlucoseMarks()) {
// return glucose < lowGlucoseMark ? lowGlucoseHighlightColor
// : glucose <= highGlucoseMark ? normalGlucoseHighlightColor
// : highGlucoseHighlightColor;
// } else {
// return glucoseRangeColor;
// }
}

private function drawMinMax(dc as Gfx.Dc, startSec as Number) as Void {
Expand Down
4 changes: 4 additions & 0 deletions Shared/source/Util.mc
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,10 @@ module Util {
return a == null ? b : a;
}

function ifNullFloat(a as Float?, b as Float) as Float {
return a == null ? b : a;
}

(:exclude)
function join(sep as String, array as Array<String>) as String {
var s = "";
Expand Down

0 comments on commit 2e89737

Please sign in to comment.