Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Retry wakeup — more consistent communications for x22 pumps #113

Merged
merged 3 commits into from
Jun 12, 2016

Conversation

kamens
Copy link
Contributor

@kamens kamens commented Jun 9, 2016

(Apologies if I should base this PR off of a branch other than dev. Lemme know the process you'd prefer.)

As discussed in gitter/slack, this PR adds retry logic to the initial short wakeup attempt, which has been verified by me and aemazaheri to increase likelihood of RL<=>pump communication success.

You and @loudnate know far more than I do about why that is the case ;). Happy to add more findings/context from my experience here if helpful.

kamens and others added 2 commits June 9, 2016 00:59
…p message when first waking pump.

This, combined with turning on my 722's 'remote' option, makes communication stable. May help others using x22 pumps.

Warning: likely full of swift faux pas. Hacking around swift for first time. Apologies.

Test plan: install rileylink_ios on phone, tap to manual 'get pump model', verify that pump model is returned and you don't see RileyLinkTimeout.
...then wait ~2 minutes (for pump's RF to turn off) and do it again. Do it a few times, verify that RileyLinkTimeout never shows up.
Test plan:
  build and run rileylink_ios on phone
  tap to manual 'get pump model'
  verify that pump model is properly retrieved/displayed
  shut off bluetooth connection in rileylink app, close rileylink app
  wait 2 minutes
  open rileylink app, turn on bluetooth connection
  physically separate pump and rileylink by quite a bit to make sure RF comms won't work well
  tap to manually 'get pump model'
  verify that RileyLinkTimeout properly shows up on screen.
lastError = PumpCommsError.UnknownResponse("Wakeup shortResponse: \(shortResponse.txData)")
}
} catch let error {
print("Wakeup failure on attempt #\(attempt): \(error)")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is probably unnecessary logging, since it's not something we previously logged.

Eventual stretch goal would be to remove all direct NSLog calls and let the framework's client choose how to handle logging, but that's a long way off.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good call, fixed

@loudnate
Copy link
Collaborator

Changes look good to me. I want to wait for @ps2's blessing to merge.

@ps2
Copy link
Owner

ps2 commented Jun 12, 2016

Looks good to me. I wanted to try it out, but haven't found time. I think we should go ahead and merge, since it's helping others.

@loudnate loudnate merged commit 8dc8418 into ps2:dev Jun 12, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants