diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/PumpCombo/ComboFragment.java b/app/src/main/java/info/nightscout/androidaps/plugins/PumpCombo/ComboFragment.java index f715e641cc..2b7c78bf25 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/PumpCombo/ComboFragment.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/PumpCombo/ComboFragment.java @@ -35,11 +35,7 @@ public class ComboFragment extends SubscriberFragment implements View.OnClickLis private TextView statusView; private TextView batteryView; private TextView reservoirView; - private TextView lastConnectionView; - private TextView lastBolusView; - private TextView basaBasalRateView; - private TextView tempBasalText; private Button refresh; @@ -51,11 +47,7 @@ public class ComboFragment extends SubscriberFragment implements View.OnClickLis statusView = (TextView) view.findViewById(R.id.combo_status); batteryView = (TextView) view.findViewById(R.id.combo_pumpstate_battery); reservoirView = (TextView) view.findViewById(R.id.combo_insulinstate); - lastConnectionView = (TextView) view.findViewById(R.id.combo_lastconnection); - lastBolusView = (TextView) view.findViewById(R.id.combo_lastbolus); - basaBasalRateView = (TextView) view.findViewById(R.id.combo_basabasalrate); - tempBasalText = (TextView) view.findViewById(R.id.combo_temp_basal); refresh = (Button) view.findViewById(R.id.combo_refresh); refresh.setOnClickListener(this); @@ -76,6 +68,12 @@ public class ComboFragment extends SubscriberFragment implements View.OnClickLis }); thread.start(); break; + case R.id.combo_history: + // TODO show popup with warnings/errors from the pump + break; + case R.id.combo_stats: + // TODO show TDD stats from the pump + break; } } @@ -118,16 +116,7 @@ public class ComboFragment extends SubscriberFragment implements View.OnClickLis } if (plugin.isInitialized()) { - // TBR PumpState ps = plugin.getPump().state; - boolean tbrActive = ps.tbrPercent != -1 && ps.tbrPercent != 100; - if (tbrActive) { - String tbr = ps.tbrPercent + "% (" + ps.tbrRemainingDuration + " m remaining)"; - tempBasalText.setText(tbr); - } else { - tempBasalText.setText(""); - } - // battery if (ps.batteryState == PumpState.EMPTY) { batteryView.setText("{fa-battery-empty}"); @@ -158,55 +147,6 @@ public class ComboFragment extends SubscriberFragment implements View.OnClickLis String time = DateUtil.timeString(lastCmdResult.completionTime); lastConnectionView.setText("" + minAgo + " (" + time + ")"); } - - // last bolus - plugin.getPump().history.bolusHistory.add(new Bolus(System.currentTimeMillis() - 7 * 60 * 1000, 12.8d)); - if (!plugin.getPump().history.bolusHistory.isEmpty()) { - Bolus bolus = plugin.getPump().history.bolusHistory.get(0); -// double agoHours = agoMsec / 60d / 60d / 1000d; -// if (agoHours < 6) // max 6h back - if (bolus.timestamp + 6 * 60 * 60 * 1000 < System.currentTimeMillis()) { - lastBolusView.setText(""); - } else { - // TODO only if !SMB; also: bolus history: should only be used to sync to DB; - // remember that datum someplace else? - long agoMsc = System.currentTimeMillis() - bolus.timestamp; - double agoHours = agoMsc / 60d / 60d / 1000d; - lastBolusView.setText(DateUtil.timeString(bolus.timestamp) + - " (" + DecimalFormatter.to1Decimal(agoHours) + " " + MainApp.sResources.getString(R.string.hoursago) + ") " + - DecimalFormatter.to2Decimal(bolus.amount) + " U"); - lastBolusView.setText("12.80 U (15.1 h ago, 19:04)"); // (19:04)"); - } - } - - // basal rate - basaBasalRateView.setText(DecimalFormatter.to2Decimal(plugin.getBaseBasalRate()) + " U/h"); - - // temp basal -// TemporaryBasal temporaryBasal = new TemporaryBasal(System.currentTimeMillis()); -// temporaryBasal.percentRate = 420; -// temporaryBasal.durationInMinutes = 20; - -// tempBasalText.setText(temporaryBasal.toStringFull()); -// tempBasalText.setText("420% 5/20' (18:45)"); - - CommandResult lastCmdResult1 = plugin.getPump().lastCmdResult; - String lastCmd = lastCmdResult1.request; - if (lastCmd != null) { -// lastCmdText.setText(lastCmd); -// lastCmdTimeText.setText(plugin.getPump().lastCmdTime.toLocaleString()); - } else { -// lastCmdText.setText(""); -// lastCmdTimeText.setText(""); - } - - if (lastCmdResult1.message != null) { -// lastCmdResultText.setText(lastCmdResult1.message); -// lastCmdDurationText.setText(lastCmdResult1.duration); - } else { -// lastCmdResultText.setText(""); -// lastCmdDurationText.setText(""); - } } } }); diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/PumpCombo/ComboPlugin.java b/app/src/main/java/info/nightscout/androidaps/plugins/PumpCombo/ComboPlugin.java index 5d1a4dbe6f..8e2c5e3680 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/PumpCombo/ComboPlugin.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/PumpCombo/ComboPlugin.java @@ -562,6 +562,7 @@ public class ComboPlugin implements PluginBase, PumpInterface { // TODO handle running into WARNING_OR_ERROR ... or scripter? purge it CommandResult commandResult = commandExecution.execute(); pump.lastCmdResult = commandResult; + pump.lastCmdResult.completionTime = System.currentTimeMillis(); // todo pump.state = commandResult.state; // TOOD if (commandResult.history != null) diff --git a/app/src/main/res/layout/combopump_fragment.xml b/app/src/main/res/layout/combopump_fragment.xml index c3c76a7aa2..8cc8b92513 100644 --- a/app/src/main/res/layout/combopump_fragment.xml +++ b/app/src/main/res/layout/combopump_fragment.xml @@ -199,141 +199,6 @@ android:layout_marginTop="5dp" android:background="@color/listdelimiter" /> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -