More logging around bolusing.
(cherry picked from commit df89b7f)
This commit is contained in:
parent
0f8442d65c
commit
c36eac1ff3
2 changed files with 7 additions and 0 deletions
|
@ -461,6 +461,7 @@ public class ComboPlugin implements PluginBase, PumpInterface, ConstraintsInterf
|
||||||
if (lastRequestedBolus != null
|
if (lastRequestedBolus != null
|
||||||
&& Math.abs(lastRequestedBolus.amount - detailedBolusInfo.insulin) < 0.01
|
&& Math.abs(lastRequestedBolus.amount - detailedBolusInfo.insulin) < 0.01
|
||||||
&& lastRequestedBolus.timestamp + 60 * 1000 > System.currentTimeMillis()) {
|
&& lastRequestedBolus.timestamp + 60 * 1000 > System.currentTimeMillis()) {
|
||||||
|
log.error("Bolus delivery failure at stage 0", new Exception());
|
||||||
return new PumpEnactResult().success(false).enacted(false)
|
return new PumpEnactResult().success(false).enacted(false)
|
||||||
.comment(MainApp.sResources.getString(R.string.bolus_frequency_exceeded));
|
.comment(MainApp.sResources.getString(R.string.bolus_frequency_exceeded));
|
||||||
}
|
}
|
||||||
|
@ -476,11 +477,13 @@ public class ComboPlugin implements PluginBase, PumpInterface, ConstraintsInterf
|
||||||
CommandResult reservoirBolusResult = runCommand(null, 3,
|
CommandResult reservoirBolusResult = runCommand(null, 3,
|
||||||
ruffyScripter::readReservoirLevelAndLastBolus);
|
ruffyScripter::readReservoirLevelAndLastBolus);
|
||||||
if (!reservoirBolusResult.success) {
|
if (!reservoirBolusResult.success) {
|
||||||
|
log.error("Bolus delivery failure at stage 1", new Exception());
|
||||||
return new PumpEnactResult().success(false).enacted(false);
|
return new PumpEnactResult().success(false).enacted(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
// check enough insulin left for bolus
|
// check enough insulin left for bolus
|
||||||
if (Math.round(detailedBolusInfo.insulin + 0.5) > reservoirBolusResult.reservoirLevel) {
|
if (Math.round(detailedBolusInfo.insulin + 0.5) > reservoirBolusResult.reservoirLevel) {
|
||||||
|
log.error("Bolus delivery failure at stage 2", new Exception());
|
||||||
return new PumpEnactResult().success(false).enacted(false)
|
return new PumpEnactResult().success(false).enacted(false)
|
||||||
.comment(MainApp.sResources.getString(R.string.combo_reservoir_level_insufficient_for_bolus));
|
.comment(MainApp.sResources.getString(R.string.combo_reservoir_level_insufficient_for_bolus));
|
||||||
}
|
}
|
||||||
|
@ -505,6 +508,7 @@ public class ComboPlugin implements PluginBase, PumpInterface, ConstraintsInterf
|
||||||
|
|
||||||
if (!bolusCmdResult.success) {
|
if (!bolusCmdResult.success) {
|
||||||
new Thread(this::checkPumpHistory).start();
|
new Thread(this::checkPumpHistory).start();
|
||||||
|
log.error("Bolus delivery failure at stage 4", new Exception());
|
||||||
return new PumpEnactResult().success(false).enacted(false)
|
return new PumpEnactResult().success(false).enacted(false)
|
||||||
.comment(MainApp.sResources.getString(R.string.combo_bolus_bolus_delivery_failed));
|
.comment(MainApp.sResources.getString(R.string.combo_bolus_bolus_delivery_failed));
|
||||||
}
|
}
|
||||||
|
@ -512,6 +516,7 @@ public class ComboPlugin implements PluginBase, PumpInterface, ConstraintsInterf
|
||||||
// verify delivered bolus
|
// verify delivered bolus
|
||||||
reservoirBolusResult = runCommand(null, 3, ruffyScripter::readReservoirLevelAndLastBolus);
|
reservoirBolusResult = runCommand(null, 3, ruffyScripter::readReservoirLevelAndLastBolus);
|
||||||
if (!reservoirBolusResult.success) {
|
if (!reservoirBolusResult.success) {
|
||||||
|
log.error("Bolus delivery failure at stage 5", new Exception());
|
||||||
return new PumpEnactResult().success(false).enacted(false)
|
return new PumpEnactResult().success(false).enacted(false)
|
||||||
.comment(MainApp.sResources.getString(R.string.combo_pump_bolus_verification_failed));
|
.comment(MainApp.sResources.getString(R.string.combo_pump_bolus_verification_failed));
|
||||||
}
|
}
|
||||||
|
@ -519,6 +524,7 @@ public class ComboPlugin implements PluginBase, PumpInterface, ConstraintsInterf
|
||||||
if (cancelBolus) {
|
if (cancelBolus) {
|
||||||
// if cancellation was requested, the delivered bolus is allowed to differ from requested
|
// if cancellation was requested, the delivered bolus is allowed to differ from requested
|
||||||
} else if (lastPumpBolus == null || lastPumpBolus.amount != detailedBolusInfo.insulin) {
|
} else if (lastPumpBolus == null || lastPumpBolus.amount != detailedBolusInfo.insulin) {
|
||||||
|
log.error("Bolus delivery failure at stage 6", new Exception());
|
||||||
return new PumpEnactResult().success(false).enacted(false).
|
return new PumpEnactResult().success(false).enacted(false).
|
||||||
comment(MainApp.sResources.getString(R.string.combo_pump_bolus_verification_failed));
|
comment(MainApp.sResources.getString(R.string.combo_pump_bolus_verification_failed));
|
||||||
}
|
}
|
||||||
|
|
|
@ -64,6 +64,7 @@ public class CommandResult {
|
||||||
", basalProfile=" + basalProfile +
|
", basalProfile=" + basalProfile +
|
||||||
", duration='" + duration + '\'' +
|
", duration='" + duration + '\'' +
|
||||||
", forwardedWarnings='" + forwardedWarnings + '\'' +
|
", forwardedWarnings='" + forwardedWarnings + '\'' +
|
||||||
|
", lastBolus=" + lastBolus +
|
||||||
'}';
|
'}';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue