Merge pull request #1042 from jotomo/bleep-bleep-bleep

[Bugfix] Combo: always send out progress updates (SMB or not).
This commit is contained in:
Milos Kozak 2018-05-15 10:35:45 +02:00 committed by GitHub
commit e918301f9a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -56,6 +56,7 @@ import info.nightscout.androidaps.plugins.PumpCombo.ruffyscripter.history.Bolus;
import info.nightscout.androidaps.plugins.PumpCombo.ruffyscripter.history.PumpHistory;
import info.nightscout.androidaps.plugins.PumpCombo.ruffyscripter.history.PumpHistoryRequest;
import info.nightscout.androidaps.plugins.PumpCombo.ruffyscripter.history.Tdd;
import info.nightscout.androidaps.plugins.Treatments.Treatment;
import info.nightscout.androidaps.plugins.Treatments.TreatmentsPlugin;
import info.nightscout.androidaps.queue.Callback;
import info.nightscout.androidaps.queue.CommandQueue;
@ -421,9 +422,6 @@ public class ComboPlugin extends PluginBase implements PumpInterface, Constraint
return pump.basalProfile.hourlyRates[currentHour];
}
private static BolusProgressReporter nullBolusProgressReporter = (state, percent, delivered) -> {
};
private static BolusProgressReporter bolusProgressReporter = (state, percent, delivered) -> {
EventOverviewBolusProgress event = EventOverviewBolusProgress.getInstance();
switch (state) {
@ -549,12 +547,14 @@ public class ComboPlugin extends PluginBase implements PumpInterface, Constraint
return new PumpEnactResult().success(true).enacted(false);
}
BolusProgressReporter progressReporter = detailedBolusInfo.isSMB ? nullBolusProgressReporter : bolusProgressReporter;
Treatment treatment = new Treatment();
treatment.isSMB = detailedBolusInfo.isSMB;
EventOverviewBolusProgress.getInstance().t = treatment;
// start bolus delivery
scripterIsBolusing = true;
runCommand(null, 0,
() -> ruffyScripter.deliverBolus(detailedBolusInfo.insulin, progressReporter));
() -> ruffyScripter.deliverBolus(detailedBolusInfo.insulin, bolusProgressReporter));
scripterIsBolusing = false;
// Note that the result of the issued bolus command is not checked. If there was