From 72fc2f3a544ed97c3577179cf083f0ecbc30bb75 Mon Sep 17 00:00:00 2001 From: Philoul Date: Sun, 30 Jan 2022 18:19:51 +0100 Subject: [PATCH] Save Last Bolus --- .../androidaps/plugins/pump/insight/LocalInsightFragment.java | 2 +- .../androidaps/plugins/pump/insight/LocalInsightPlugin.java | 4 ++++ insight/src/main/res/values/strings.xml | 2 ++ 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/insight/src/main/java/info/nightscout/androidaps/plugins/pump/insight/LocalInsightFragment.java b/insight/src/main/java/info/nightscout/androidaps/plugins/pump/insight/LocalInsightFragment.java index e4009bea7e..d7cb593bb3 100644 --- a/insight/src/main/java/info/nightscout/androidaps/plugins/pump/insight/LocalInsightFragment.java +++ b/insight/src/main/java/info/nightscout/androidaps/plugins/pump/insight/LocalInsightFragment.java @@ -289,7 +289,7 @@ public class LocalInsightFragment extends DaggerFragment implements View.OnClick if (cartridgeStatus == null) return; String status; if (cartridgeStatus.isInserted()) - status = DecimalFormatter.INSTANCE.to2Decimal(localInsightPlugin.getCartridgeStatus().getRemainingAmount()) + "U"; + status = DecimalFormatter.INSTANCE.to2Decimal(cartridgeStatus.getRemainingAmount()) + "U"; else status = rh.gs(R.string.not_inserted); statusItems.add(getStatusItem(rh.gs(R.string.reservoir_label), status)); } diff --git a/insight/src/main/java/info/nightscout/androidaps/plugins/pump/insight/LocalInsightPlugin.java b/insight/src/main/java/info/nightscout/androidaps/plugins/pump/insight/LocalInsightPlugin.java index 90adc4775e..701d8462a8 100644 --- a/insight/src/main/java/info/nightscout/androidaps/plugins/pump/insight/LocalInsightPlugin.java +++ b/insight/src/main/java/info/nightscout/androidaps/plugins/pump/insight/LocalInsightPlugin.java @@ -232,6 +232,8 @@ public class LocalInsightPlugin extends PumpPluginBase implements Pump, Constrai pumpDescription = new PumpDescription(); pumpDescription.fillFor(PumpType.ACCU_CHEK_INSIGHT); + lastBolusTimestamp = sp.getLong(R.string.key_insight_lastbolustimestamp,0L); + lastBolusAmount = sp.getDouble(R.string.key_insight_lastbolusamount, 0.0); } public TBROverNotificationBlock getTBROverNotificationBlock() { @@ -1442,7 +1444,9 @@ public class LocalInsightPlugin extends PumpPluginBase implements Pump, Constrai PumpType.ACCU_CHEK_INSIGHT, serial); lastBolusTimestamp = bolusID.getTimestamp(); + sp.putLong(R.string.key_insight_lastbolustimestamp,lastBolusTimestamp); lastBolusAmount = event.getImmediateAmount(); + sp.putDouble(R.string.key_insight_lastbolusamount, lastBolusAmount); } if (event.getBolusType() == BolusType.EXTENDED || event.getBolusType() == BolusType.MULTIWAVE) { if (event.getDuration() > 0 && profileFunction.getProfile(bolusID.getTimestamp()) != null) diff --git a/insight/src/main/res/values/strings.xml b/insight/src/main/res/values/strings.xml index ba021a8b99..8c5ec31fdf 100644 --- a/insight/src/main/res/values/strings.xml +++ b/insight/src/main/res/values/strings.xml @@ -47,6 +47,8 @@ insight_min_recovery_duration insight_max_recovery_duration insight_disconnect_delay + insight_lastbolusamount + insight_lastbolustimestamp Disable vibrations on automated bolus delivery For SMB and Temp Basal with TBR emulation (only available with Insight firmware 3.x) Timeout during handshake - reset bluetooth