Skip to content

Add hangUpOnNextMessages: hang up on a message, before or after answering - #33

Merged
ps2 merged 1 commit into
mainfrom
drop-during-next-command
Nov 24, 2026
Merged

ps2 merged 1 commit into
mainfrom
drop-during-next-command

Conversation

@ps2

@ps2 ps2 commented Nov 10, 2026

Copy link
Copy Markdown

Adds hangUpOnNextMessages: on each of the next count messages, the pod hangs up, then takes the phone's reconnect as usual.

  • {"command": "hangUpOnNextMessages", "value": 1} hangs up when the message arrives, without answering, as a pod that drops the link during a command does.
  • With "afterAnswering": true it answers, waits for the phone's ACK, then hangs up, as a pod that drops the link soon after a command does.
  • On -transport impossible the phone gets CoreBluetooth's "peripheral disconnected" error (CBError 7), the way a pod's hang-up reaches a phone. On a Bluetooth adapter it's an ordinary disconnect from the pod.

The simulator could already leave a message unanswered with the link up (ignoreNextMessages), fail a connect during setup (failNextConnects), or exit (crashNextCommand). None of those is a pod-initiated drop that leaves the pod available, which is the case in the loopandlearn/OmnipodKit#209 review: a pod that hangs up during or after a command, with the phone in the background.

Testing

  • go test ./pkg/... passes. A new test checks that the hang-up carries CBErrorDomain 7 and that the next connect is accepted.
  • Used against Loop (next-dev with Log each connect's setup and every failed exchange and disconnect; don't mark unsent commands unacknowledged loopandlearn/OmnipodKit#209) in the iOS Simulator through ImpossiBLE, with the app in the background on a heartbeat probe:
    pod:  hanging up on message seq 4 without answering (hangUpOnNextMessages)
    pod:  ** disconnected by the pod
    app:  [disconnect] CBErrorDomain 7, 0.010s after connect, during session Get pod status, setup ok
    app:  [read] emptyValue at RTS after 5.084s, link already down; …
    app:  Unacknowledged message. seq:6, error = incorrectResponse
    
    and with afterAnswering, the status read completes and the drop follows it:
    pod:  hanging up after answering message seq 4 (hangUpOnNextMessages)
    app:  [disconnect] CBErrorDomain 7, 0.017s after connect, during session Get pod status, setup ok
    

…ring

A pod in the field sometimes drops the link during a command, or soon
after one. The simulator could leave a message unanswered with the link
up, fail a connect during setup, or crash, but not hang up and stay
available. With this command it hangs up, with CBErrorPeripheralDisconnected
on the ImpossiBLE transport, on each of the next count messages: when the
message arrives, or with afterAnswering once the phone has acknowledged
the answer. It accepts the phone's reconnect either way.
@marionbarker

Copy link
Copy Markdown

Test

✅ successful test

Claude review

Claude approved this PR and assisted in developing the test plan

Test Details

This test was performed on 2026-11-24

Paired the pod, configured for 50 hours pod time and 45 U in reservoir.

Hang up before answering.

✅ successful test

Issued this command in terminal

curl -s -X POST http://IP:8080/command -d '{"command":"hangUpOnNextMessages","value":1}'

(where IP is the address for the rPi on my local network)

Issued a 5 U bolus

  • got an Unable to reach pump model
  • phone/app and rPi recovered.
  • confirm no bolus was issued because rPi dropped the bolus command

Hang up after answering

✅ successful test

Issued this command in terminal

curl -s -X POST http://IP:8080/command -d '{"command":"hangUpOnNextMessages","value":1,"afterAnswering":true}'

Issued a 5 U bolus

  • got a bolus issue warning from app (I suspect this is a time when a getStatus was issued before the bolus command
    • no bolus went through
  • repeated the test - this time got Unable to reach pump
  • ✅ this time bolus got through - stopped the bolus at 1.65 U out of 5 U

Background recovery

Prepare phone to expect autoboluses

  • Enter 60 g carbs
  • Accept without bolusing the recommended 6+ U
  • lock the phone at 13:24

configure to hang up before answering - make sure app recovers while phone it locked.

  • observe what happens in Nightscout URL
    • ✅ expect first cycle to fail to bolus (13:25)
    • ✅ expect next cycle to have automatically recovered and bolus (13:30), AB of 2.7 U

Configure to hang up the next 3 messages

curl -s -X POST http://IP:8080/command -d '{"command":"hangUpOnNextMessages","value":3}'
  • observe what happens in NS URL
    • expect failed boluses and then recovery
    • ✅ next autobolus occurred after 10 minutes (not 5)
      • 1.55 U at 13:40

@marionbarker marionbarker left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Approved by code review (Claude) and test using an rPi

@ps2
ps2 merged commit c02d0d3 into main Nov 24, 2026
1 check passed
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.

2 participants