commit
b151b795b9
4 changed files with 26 additions and 13 deletions
|
@ -554,11 +554,11 @@ public class DanaRPlugin implements PluginBase, PumpInterface, ConstraintsInterf
|
||||||
public PumpEnactResult setExtendedBolus(Double insulin, Integer durationInMinutes) {
|
public PumpEnactResult setExtendedBolus(Double insulin, Integer durationInMinutes) {
|
||||||
ConfigBuilderPlugin configBuilderPlugin = MainApp.getConfigBuilder();
|
ConfigBuilderPlugin configBuilderPlugin = MainApp.getConfigBuilder();
|
||||||
insulin = configBuilderPlugin.applyBolusConstraints(insulin);
|
insulin = configBuilderPlugin.applyBolusConstraints(insulin);
|
||||||
// needs to be rounded to 0.1
|
// needs to be rounded
|
||||||
insulin = Round.roundTo(insulin, 0.1d);
|
insulin = Round.roundTo(insulin, getPumpDescription().extendedBolusStep);
|
||||||
|
|
||||||
PumpEnactResult result = new PumpEnactResult();
|
PumpEnactResult result = new PumpEnactResult();
|
||||||
if (getDanaRPump().isExtendedInProgress && Math.abs(getDanaRPump().extendedBolusAmount - insulin) < 0.1d) {
|
if (getDanaRPump().isExtendedInProgress && Math.abs(getDanaRPump().extendedBolusAmount - insulin) < getPumpDescription().extendedBolusStep) {
|
||||||
result.enacted = false;
|
result.enacted = false;
|
||||||
result.success = true;
|
result.success = true;
|
||||||
result.comment = MainApp.instance().getString(R.string.virtualpump_resultok);
|
result.comment = MainApp.instance().getString(R.string.virtualpump_resultok);
|
||||||
|
@ -567,12 +567,12 @@ public class DanaRPlugin implements PluginBase, PumpInterface, ConstraintsInterf
|
||||||
result.isPercent = false;
|
result.isPercent = false;
|
||||||
result.isTempCancel = false;
|
result.isTempCancel = false;
|
||||||
if (Config.logPumpActions)
|
if (Config.logPumpActions)
|
||||||
log.debug("setExtendedBolus: Correct extended bolus already set");
|
log.debug("setExtendedBolus: Correct extended bolus already set. Current: " + getDanaRPump().extendedBolusAmount + " Asked: " + insulin);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
int durationInHalfHours = Math.max(durationInMinutes / 30, 1);
|
int durationInHalfHours = Math.max(durationInMinutes / 30, 1);
|
||||||
boolean connectionOK = sExecutionService.extendedBolus(insulin, durationInHalfHours);
|
boolean connectionOK = sExecutionService.extendedBolus(insulin, durationInHalfHours);
|
||||||
if (connectionOK && getDanaRPump().isExtendedInProgress && Math.abs(getDanaRPump().extendedBolusAmount - insulin) < 0.1d) {
|
if (connectionOK && getDanaRPump().isExtendedInProgress && Math.abs(getDanaRPump().extendedBolusAmount - insulin) < getPumpDescription().extendedBolusStep) {
|
||||||
result.enacted = true;
|
result.enacted = true;
|
||||||
result.success = true;
|
result.success = true;
|
||||||
result.comment = MainApp.instance().getString(R.string.virtualpump_resultok);
|
result.comment = MainApp.instance().getString(R.string.virtualpump_resultok);
|
||||||
|
|
|
@ -554,11 +554,11 @@ public class DanaRKoreanPlugin implements PluginBase, PumpInterface, Constraints
|
||||||
public PumpEnactResult setExtendedBolus(Double insulin, Integer durationInMinutes) {
|
public PumpEnactResult setExtendedBolus(Double insulin, Integer durationInMinutes) {
|
||||||
ConfigBuilderPlugin configBuilderPlugin = MainApp.getConfigBuilder();
|
ConfigBuilderPlugin configBuilderPlugin = MainApp.getConfigBuilder();
|
||||||
insulin = configBuilderPlugin.applyBolusConstraints(insulin);
|
insulin = configBuilderPlugin.applyBolusConstraints(insulin);
|
||||||
// needs to be rounded to 0.1
|
// needs to be rounded
|
||||||
insulin = Round.roundTo(insulin, 0.1d);
|
insulin = Round.roundTo(insulin, getPumpDescription().extendedBolusStep);
|
||||||
|
|
||||||
PumpEnactResult result = new PumpEnactResult();
|
PumpEnactResult result = new PumpEnactResult();
|
||||||
if (getDanaRPump().isExtendedInProgress && Math.abs(getDanaRPump().extendedBolusAmount - insulin) < 0.1d) {
|
if (getDanaRPump().isExtendedInProgress && Math.abs(getDanaRPump().extendedBolusAmount - insulin) < getPumpDescription().extendedBolusStep) {
|
||||||
result.enacted = false;
|
result.enacted = false;
|
||||||
result.success = true;
|
result.success = true;
|
||||||
result.comment = MainApp.instance().getString(R.string.virtualpump_resultok);
|
result.comment = MainApp.instance().getString(R.string.virtualpump_resultok);
|
||||||
|
@ -567,12 +567,12 @@ public class DanaRKoreanPlugin implements PluginBase, PumpInterface, Constraints
|
||||||
result.isPercent = false;
|
result.isPercent = false;
|
||||||
result.isTempCancel = false;
|
result.isTempCancel = false;
|
||||||
if (Config.logPumpActions)
|
if (Config.logPumpActions)
|
||||||
log.debug("setExtendedBolus: Correct extended bolus already set");
|
log.debug("setExtendedBolus: Correct extended bolus already set. Current: " + getDanaRPump().extendedBolusAmount + " Asked: " + insulin);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
int durationInHalfHours = Math.max(durationInMinutes / 30, 1);
|
int durationInHalfHours = Math.max(durationInMinutes / 30, 1);
|
||||||
boolean connectionOK = sExecutionService.extendedBolus(insulin, durationInHalfHours);
|
boolean connectionOK = sExecutionService.extendedBolus(insulin, durationInHalfHours);
|
||||||
if (connectionOK && getDanaRPump().isExtendedInProgress && Math.abs(getDanaRPump().extendedBolusAmount - insulin) < 0.1d) {
|
if (connectionOK && getDanaRPump().isExtendedInProgress && Math.abs(getDanaRPump().extendedBolusAmount - insulin) < getPumpDescription().extendedBolusStep) {
|
||||||
result.enacted = true;
|
result.enacted = true;
|
||||||
result.success = true;
|
result.success = true;
|
||||||
result.comment = MainApp.instance().getString(R.string.virtualpump_resultok);
|
result.comment = MainApp.instance().getString(R.string.virtualpump_resultok);
|
||||||
|
|
|
@ -99,6 +99,7 @@ public class OverviewFragment extends Fragment {
|
||||||
TextView arrowView;
|
TextView arrowView;
|
||||||
TextView timeAgoView;
|
TextView timeAgoView;
|
||||||
TextView deltaView;
|
TextView deltaView;
|
||||||
|
TextView avgdeltaView;
|
||||||
TextView runningTempView;
|
TextView runningTempView;
|
||||||
TextView baseBasalView;
|
TextView baseBasalView;
|
||||||
TextView activeProfileView;
|
TextView activeProfileView;
|
||||||
|
@ -143,6 +144,7 @@ public class OverviewFragment extends Fragment {
|
||||||
arrowView = (TextView) view.findViewById(R.id.overview_arrow);
|
arrowView = (TextView) view.findViewById(R.id.overview_arrow);
|
||||||
timeAgoView = (TextView) view.findViewById(R.id.overview_timeago);
|
timeAgoView = (TextView) view.findViewById(R.id.overview_timeago);
|
||||||
deltaView = (TextView) view.findViewById(R.id.overview_delta);
|
deltaView = (TextView) view.findViewById(R.id.overview_delta);
|
||||||
|
avgdeltaView = (TextView) view.findViewById(R.id.overview_avgdelta);
|
||||||
runningTempView = (TextView) view.findViewById(R.id.overview_runningtemp);
|
runningTempView = (TextView) view.findViewById(R.id.overview_runningtemp);
|
||||||
baseBasalView = (TextView) view.findViewById(R.id.overview_basebasal);
|
baseBasalView = (TextView) view.findViewById(R.id.overview_basebasal);
|
||||||
activeProfileView = (TextView) view.findViewById(R.id.overview_activeprofile);
|
activeProfileView = (TextView) view.findViewById(R.id.overview_activeprofile);
|
||||||
|
@ -570,8 +572,11 @@ public class OverviewFragment extends Fragment {
|
||||||
bgView.setText(lastBG.valueToUnitsToString(profile.getUnits()));
|
bgView.setText(lastBG.valueToUnitsToString(profile.getUnits()));
|
||||||
arrowView.setText(lastBG.directionToSymbol());
|
arrowView.setText(lastBG.directionToSymbol());
|
||||||
DatabaseHelper.GlucoseStatus glucoseStatus = MainApp.getDbHelper().getGlucoseStatusData();
|
DatabaseHelper.GlucoseStatus glucoseStatus = MainApp.getDbHelper().getGlucoseStatusData();
|
||||||
if (glucoseStatus != null)
|
if (glucoseStatus != null){
|
||||||
deltaView.setText("Δ " + NSProfile.toUnitsString(glucoseStatus.delta, glucoseStatus.delta * Constants.MGDL_TO_MMOLL, units) + " " + units);
|
deltaView.setText("Δ " + NSProfile.toUnitsString(glucoseStatus.delta, glucoseStatus.delta * Constants.MGDL_TO_MMOLL, units) + " " + units);
|
||||||
|
avgdeltaView.setText("øΔ " + NSProfile.toUnitsString(glucoseStatus.avgdelta, glucoseStatus.avgdelta * Constants.MGDL_TO_MMOLL, units) + " " + units);
|
||||||
|
}
|
||||||
|
|
||||||
BgReading.units = profile.getUnits();
|
BgReading.units = profile.getUnits();
|
||||||
} else
|
} else
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -32,7 +32,7 @@
|
||||||
android:layout_gravity="top|left"
|
android:layout_gravity="top|left"
|
||||||
android:gravity="center_vertical"
|
android:gravity="center_vertical"
|
||||||
android:text="00.0"
|
android:text="00.0"
|
||||||
android:textSize="80dp"
|
android:textSize="70dp"
|
||||||
android:textStyle="bold" />
|
android:textStyle="bold" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
|
@ -44,7 +44,7 @@
|
||||||
android:paddingLeft="-5dp"
|
android:paddingLeft="-5dp"
|
||||||
android:paddingRight="-5dp"
|
android:paddingRight="-5dp"
|
||||||
android:text="→"
|
android:text="→"
|
||||||
android:textSize="80dp"
|
android:textSize="60dp"
|
||||||
android:textStyle="bold" />
|
android:textStyle="bold" />
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
|
@ -90,6 +90,14 @@
|
||||||
android:layout_marginLeft="10dp"
|
android:layout_marginLeft="10dp"
|
||||||
android:textAppearance="?android:attr/textAppearanceMedium" />
|
android:textAppearance="?android:attr/textAppearanceMedium" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/overview_avgdelta"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginLeft="10dp"
|
||||||
|
android:textAppearance="?android:attr/textAppearanceMedium" />
|
||||||
|
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/overview_activeprofile"
|
android:id="@+id/overview_activeprofile"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
|
|
Loading…
Reference in a new issue