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
1 changed files with 6 additions and 11 deletions
|
@ -242,6 +242,8 @@ public class ComboPlugin implements PluginBase, PumpInterface, ConstraintsInterf
|
||||||
@Override
|
@Override
|
||||||
public synchronized PumpEnactResult setNewBasalProfile(Profile profile) {
|
public synchronized PumpEnactResult setNewBasalProfile(Profile profile) {
|
||||||
if (!isInitialized()) {
|
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");
|
log.error("setNewBasalProfile not initialized");
|
||||||
Notification notification = new Notification(Notification.PROFILE_NOT_SET_NOT_INITIALIZED, MainApp.sResources.getString(R.string.pumpNotInitializedProfileNotSet), Notification.URGENT);
|
Notification notification = new Notification(Notification.PROFILE_NOT_SET_NOT_INITIALIZED, MainApp.sResources.getString(R.string.pumpNotInitializedProfileNotSet), Notification.URGENT);
|
||||||
MainApp.bus().post(new EventNewNotification(notification));
|
MainApp.bus().post(new EventNewNotification(notification));
|
||||||
|
@ -283,9 +285,10 @@ public class ComboPlugin implements PluginBase, PumpInterface, ConstraintsInterf
|
||||||
@Override
|
@Override
|
||||||
public boolean isThisProfileSet(Profile profile) {
|
public boolean isThisProfileSet(Profile profile) {
|
||||||
if (!isInitialized()) {
|
if (!isInitialized()) {
|
||||||
// This is called too soon (for the Combo) on startup, so ignore this.
|
/* This might be called too soon during boot. Return true to prevent a request
|
||||||
// The Combo init (refreshDataFromPump) will read the profile and update the pump's
|
to update the profile. KeepAlive is called every Constants.keepalivems
|
||||||
// profile if the pref is set;
|
and will detect the need for a profile update and apply it.
|
||||||
|
*/
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return pump.basalProfile.equals(convertProfileToComboProfile(profile));
|
return pump.basalProfile.equals(convertProfileToComboProfile(profile));
|
||||||
|
@ -353,14 +356,6 @@ public class ComboPlugin implements PluginBase, PumpInterface, ConstraintsInterf
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
pump.basalProfile = readBasalResult.basalProfile;
|
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) {
|
if (!pump.initialized) {
|
||||||
|
|
Loading…
Reference in a new issue