Some more TBR certainty improvements

This commit is contained in:
Bart Sopers 2020-11-19 18:49:15 +01:00
parent 084c8fd02f
commit 3daff2527e

View file

@ -424,7 +424,12 @@ public abstract class PodStateManager {
}
public final void setTempBasalCertain(boolean certain) {
setSafe(() -> podState.setTempBasalCertain(certain));
setAndStore(() -> {
if (!Objects.equals(podState.isTempBasalCertain(), certain)) {
podState.setTempBasalCertain(certain);
onTbrChanged();
}
});
}
public final void setTempBasal(DateTime startTime, Double amount, Duration duration) {
@ -565,8 +570,13 @@ public abstract class PodStateManager {
clearTempBasal(false);
}
podState.setLastUpdatedFromResponse(DateTime.now());
podState.setTempBasalCertain(true);
podState.setBasalCertain(true);
if (!podState.isTempBasalCertain()) {
podState.setTempBasalCertain(true);
onTbrChanged();
}
if (!podState.isBasalCertain()) {
podState.setBasalCertain(true);
}
if (status instanceof PodInfoDetailedStatus) {
PodInfoDetailedStatus detailedStatus = (PodInfoDetailedStatus) status;