Minor fixes and polish around bolus cancellation.

This commit is contained in:
Johannes Mockenhaupt 2017-12-15 10:40:56 +01:00
parent f0f34d03df
commit a6a87d0790
No known key found for this signature in database
GPG key ID: 9E1EA6AF7BBBB0D1
4 changed files with 7 additions and 11 deletions

View file

@ -473,10 +473,7 @@ public class ComboPlugin implements PluginBase, PumpInterface, ConstraintsInterf
// start bolus delivery
bolusInProgress = true;
CommandResult bolusCmdResult = runCommand(null, 0,
() -> {
return ruffyScripter.deliverBolus(detailedBolusInfo.insulin,
progressReporter);
});
() -> ruffyScripter.deliverBolus(detailedBolusInfo.insulin, progressReporter));
bolusInProgress = false;
if (bolusCmdResult.success) {
@ -543,7 +540,7 @@ public class ComboPlugin implements PluginBase, PumpInterface, ConstraintsInterf
MainApp.getConfigBuilder().addToHistoryTreatment(detailedBolusInfo);
log.debug(String.format(Locale.getDefault(), "Added partial bolus of %.2f to treatments", lastBolus.amount));
return new PumpEnactResult().success(false).enacted(true)
.comment(String.format(MainApp.sResources.getString(R.string.combo_error_partial_bolus_delivered),
.comment(MainApp.sResources.getString(R.string.combo_error_partial_bolus_delivered,
lastBolus.amount, detailedBolusInfo.insulin));
}

View file

@ -813,7 +813,7 @@
<string name="combo_pump_never_connected">Never</string>
<string name="combo_pump_unsupported_operation">Requested operation not supported by pump</string>
<string name="combo_force_disabled_notification">Unsafe usage: extended or multiwave boluses have been delivered within the last 6 hours or the selected basal rate is not 1. Loop mode has been set to low-suspend only until 6 hours after the last unsupported bolus or basal rate profile. Only normal boluses are supported in loop mode with basal rate profile 1.</string>
<string name="bolus_frequency_exceeded">A bolus with the same amount was requested within the last minute. For safety reasons this is disallowed.</string>
<string name="bolus_frequency_exceeded">A bolus with the same amount was requested within the last minute. To prevent accidental double boluses and to guard against bugs this is disallowed.</string>
<string name="combo_pump_connected_now">Now</string>
<string name="combo_activity_reading_pump_history">Reading pump history</string>
<string name="danar_history">pump history</string>

View file

@ -23,7 +23,7 @@ public interface RuffyCommands {
/** Indicate of the pump is busy processing a command. */
boolean isPumpBusy();
/** Whether there's an active BT connection to the pump. */
/** Whether there's usable connection to the pump. */
boolean isConnected();
void disconnect();

View file

@ -90,8 +90,8 @@ public class BolusCommand extends BaseCommand {
result.success = true;
return;
}
SystemClock.sleep(10);
}
SystemClock.sleep(10);
}
// the bolus progress is displayed on the main menu
@ -171,16 +171,15 @@ public class BolusCommand extends BaseCommand {
readReservoirLevelAndLastBolus.setScripter(scripter);
readReservoirLevelAndLastBolus.execute();
Bolus lastBolus = readReservoirLevelAndLastBolus.result.lastBolus;
if (Math.abs(System.currentTimeMillis() - lastBolus.timestamp) >= 10 * 60 * 1000) {
if (lastBolus == null || Math.abs(System.currentTimeMillis() - lastBolus.timestamp) >= 10 * 60 * 1000) {
throw new CommandException("Unable to determine last bolus");
}
result.delivered = lastBolus.amount;
} else {
// bolus delivery completed successfully and completely
result.delivered = bolus;
bolusProgressReporter.report(DELIVERED, 100, bolus);
}
bolusProgressReporter.report(DELIVERED, 100, bolus);
result.success = true;
}