Only update pumpState cache if menu could be read.

This commit is contained in:
Johannes Mockenhaupt 2017-11-20 21:36:25 +01:00
parent 86eb33403d
commit 3cccf287da
No known key found for this signature in database
GPG key ID: 9E1EA6AF7BBBB0D1

View file

@ -315,12 +315,16 @@ public class ComboPlugin implements PluginBase, PumpInterface, ConstraintsInterf
if (result.reservoirLevel != PumpState.UNKNOWN) {
pump.reservoirLevel = result.reservoirLevel;
}
if (result.lastBolus != null) {
pump.lastBolus = result.lastBolus;
} else if (result.history != null && !result.history.bolusHistory.isEmpty()) {
pump.lastBolus = result.history.bolusHistory.get(0);
}
pump.state = result.state;
if (result.state.menu != null) {
pump.state = result.state;
}
MainApp.bus().post(new EventComboPumpUpdateGUI());
}