Don't update pump basal profile during startup.
* Avoids issues of no profile being set yet * Making startup take minutes * KeepAlive will update profile as needed every 5m.
This commit is contained in:
parent
ea1fd8fee8
commit
40edb9ff5c
|
@ -242,6 +242,8 @@ public class ComboPlugin implements PluginBase, PumpInterface, ConstraintsInterf
|
|||
@Override
|
||||
public synchronized PumpEnactResult setNewBasalProfile(Profile profile) {
|
||||
if (!isInitialized()) {
|
||||
// note that this should not happen anymore since the queue is present, which
|
||||
// issues a READSTATE when starting to issue commands which initializes the pump
|
||||
log.error("setNewBasalProfile not initialized");
|
||||
Notification notification = new Notification(Notification.PROFILE_NOT_SET_NOT_INITIALIZED, MainApp.sResources.getString(R.string.pumpNotInitializedProfileNotSet), Notification.URGENT);
|
||||
MainApp.bus().post(new EventNewNotification(notification));
|
||||
|
@ -283,9 +285,10 @@ public class ComboPlugin implements PluginBase, PumpInterface, ConstraintsInterf
|
|||
@Override
|
||||
public boolean isThisProfileSet(Profile profile) {
|
||||
if (!isInitialized()) {
|
||||
// This is called too soon (for the Combo) on startup, so ignore this.
|
||||
// The Combo init (refreshDataFromPump) will read the profile and update the pump's
|
||||
// profile if the pref is set;
|
||||
/* This might be called too soon during boot. Return true to prevent a request
|
||||
to update the profile. KeepAlive is called every Constants.keepalivems
|
||||
and will detect the need for a profile update and apply it.
|
||||
*/
|
||||
return true;
|
||||
}
|
||||
return pump.basalProfile.equals(convertProfileToComboProfile(profile));
|
||||
|
@ -353,14 +356,6 @@ public class ComboPlugin implements PluginBase, PumpInterface, ConstraintsInterf
|
|||
return;
|
||||
}
|
||||
pump.basalProfile = readBasalResult.basalProfile;
|
||||
|
||||
Profile profile = MainApp.getConfigBuilder().getProfile();
|
||||
if (!pump.basalProfile.equals(convertProfileToComboProfile(profile))) {
|
||||
PumpEnactResult setNewBasalProfileResult = setNewBasalProfile(profile);
|
||||
if (!setNewBasalProfileResult.success) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!pump.initialized) {
|
||||
|
|
Loading…
Reference in a new issue