Fixes for PodStateManager

This commit is contained in:
Bart Sopers 2020-08-08 21:38:08 +02:00
parent 10cde3e744
commit 31938547a5
3 changed files with 3 additions and 3 deletions

View file

@ -49,7 +49,6 @@ public class AssignAddressAction implements OmnipodAction<VersionResponse> {
podStateManager.setPairingParameters(assignAddressResponse.getLot(), assignAddressResponse.getTid(), // podStateManager.setPairingParameters(assignAddressResponse.getLot(), assignAddressResponse.getTid(), //
assignAddressResponse.getPiVersion(), assignAddressResponse.getPmVersion(), DateTimeZone.getDefault()); assignAddressResponse.getPiVersion(), assignAddressResponse.getPmVersion(), DateTimeZone.getDefault());
podStateManager.setMessageNumber(0x00);
return assignAddressResponse; return assignAddressResponse;
} }

View file

@ -128,11 +128,11 @@ public class AapsPodStateManager implements PodStateManager {
} }
@Override public void increaseMessageNumber() { @Override public void increaseMessageNumber() {
setAndStore(() -> podState.setMessageNumber(podState.getMessageNumber() + 1)); setAndStore(() -> podState.setMessageNumber((podState.getMessageNumber() + 1) & 0b1111));
} }
@Override public void increasePacketNumber() { @Override public void increasePacketNumber() {
setAndStore(() -> podState.setPacketNumber(podState.getPacketNumber() + 1)); setAndStore(() -> podState.setPacketNumber((podState.getPacketNumber() + 1) & 0b11111));
} }
@Override public synchronized void resyncNonce(int syncWord, int sentNonce, int sequenceNumber) { @Override public synchronized void resyncNonce(int syncWord, int sentNonce, int sequenceNumber) {

View file

@ -125,6 +125,7 @@ public class RileyLinkOmnipodService extends RileyLinkService {
omnipodUtil.setPodStateManager(instance.getPodStateManager()); omnipodUtil.setPodStateManager(instance.getPodStateManager());
aapsOmnipodManager = instance; aapsOmnipodManager = instance;
} }
omnipodUtil.notifyDeviceStatusChanged();
} }