Combo: always send out progress updates (SMB or not).

Without this, showing SMB progress on wear is broken.

(cherry picked from commit 5ebff72)
This commit is contained in:
Johannes Mockenhaupt 2018-05-13 23:04:50 +02:00
parent 7be418fdf2
commit 29efe11ece
No known key found for this signature in database
GPG key ID: 9E1EA6AF7BBBB0D1

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