Set Source.PUMP when setting/cancelling TBR.

While technically, the history isn't read, we can be reasonably
sure a TBR was set/cancelled by reading the main menu (and for
TBR starts that's the only way to do so). Reading the history
might cause (more) problems with the pump's minute-precision
and not yield much safety. Besides, command mode is expected
to take over yesterday.

(cherry picked from commit 04fb1c8)
This commit is contained in:
Johannes Mockenhaupt 2017-11-26 21:03:22 +01:00
parent 383750d5e8
commit dc6c91fd87
No known key found for this signature in database
GPG key ID: 9E1EA6AF7BBBB0D1

View file

@ -627,7 +627,7 @@ public class ComboPlugin implements PluginBase, PumpInterface, ConstraintsInterf
tempStart.durationInMinutes = durationInMinutes;
tempStart.percentRate = adjustedPercent;
tempStart.isAbsolute = false;
tempStart.source = Source.USER;
tempStart.source = Source.PUMP;
tempStart.pumpId = tempStart.date;
ConfigBuilderPlugin treatmentsInterface = MainApp.getConfigBuilder();
treatmentsInterface.addToHistoryTempBasal(tempStart);
@ -658,7 +658,7 @@ public class ComboPlugin implements PluginBase, PumpInterface, ConstraintsInterf
TemporaryBasal tempBasal = new TemporaryBasal();
tempBasal.date = commandResult.state.timestamp;
tempBasal.durationInMinutes = 0;
tempBasal.source = Source.USER;
tempBasal.source = Source.PUMP;
tempBasal.pumpId = activeTemp.pumpId;
MainApp.getConfigBuilder().addToHistoryTempBasal(tempBasal);
return new PumpEnactResult().isTempCancel(true).success(true).enacted(true);
@ -684,7 +684,7 @@ public class ComboPlugin implements PluginBase, PumpInterface, ConstraintsInterf
TemporaryBasal tempBasal = new TemporaryBasal();
tempBasal.date = System.currentTimeMillis() / (60 * 1000) * (60 * 1000);
tempBasal.durationInMinutes = 15;
tempBasal.source = Source.USER;
tempBasal.source = Source.PUMP;
tempBasal.pumpId = tempBasal.date;
tempBasal.percentRate = percentage;
tempBasal.isAbsolute = false;