Command 1F Cancel Request - openaps/openomni GitHub Wiki
0x1F Cancel Command
Command $1F is the Cancel command. It has the following format:
OFF 1 2 3 4 5 6
1f 05 NNNNNNNN AX
1f(1 byte): Mtype value of 0x1F specifies a cancel command05(1 byte): The cancel command always has a fixed length of05NNNNNNNN(4 bytes): Nonce, the 32-bit validator (random looking numbers)AX(1 byte): Command byte of the formaaaa0bcd:-
The
aaaa(A) nibble is a beep type value. Recordings for common beep values can be found in All Beep Types.0x0No Sound0x1BeepBeepBeepBeep0x2BipBeep BipBeep BipBeep BipBeep0x3BipBip0x4Beep0x5BeepBeepBeep0x6Beeeeeep0x7BipBipBip BipBipBip0x8BeeepBeeep0x9No Sound0xANo Sound0xBBeepBeep0xCBeeep0xDBipBeeeeep0xEContinuous beep for 5 seconds (if Pod is suspended)
-
The
b(0x04) bit being set will cancel any ongoing bolus and will turn off theRRreminder variables set from the 0x17 Bolus Extra command. -
The
c(0x02) bit being set will cancel any ongoing temporary basal and will turn off theRRreminder variables set from the 0x16 Temp Basal Extra command. -
The
d(0x01) bit being set will cancel the basal program and will turn off theRRreminder variables set from the 0x13 Basal Schedule Extra command.
-
If none of the b, c, or d bits are set, then the beep type value is not examined or used and
no insulin delivery is cancelled (i.e., it functions as a Cancel None command).
If more than one of the b, c and d bits are specified with a non-silent value for A,
then the specified beep sequence will play once for each insulin delivery type being cancelled
(e.g., an AX value of 0x67 will emit a type 6 beep three times,
an AX value of 0x53 will emit a type 5 beep two times,
an AX value of 0x82 will emit a type 8 beep one time, etc).
Cancel Temp Basal
An important use of the 0x1F cancel command for closed loop use is to cancel a temporary basal rate.
An example from Temp Basal Packets:
1f 05 NNNNNNNN AX
1f 05 d88df895 62
The AX value of 0x62 has an aaaa nibble value of 6
which will cause the Pod to emit a a single longer type 6 beep.
The c (0x02) bit being set cancels the in-progress temporary basal
and clears any associated temp basal completion beep and Program Reminders.
An example cancel temporary basal sequence:
2017-10-04T14:37:14.307150 ID1:1f0b3555 PTYPE:PDM SEQ:23 ID2:1f0b3555 B9:08 BLEN:7 BODY:1f05156b93e8620028 CRC:35
2017-10-04T14:37:14.377525 ID1:1f0b3555 PTYPE:POD SEQ:24 ID2:1f0b3555 B9:0c BLEN:10 BODY:1d1800251000000063ff82bb CRC:91
2017-10-04T14:37:14.378063 ID1:1f0b3555 PTYPE:ACK SEQ:25 ID2:1f0b3555 CRC:f0
Pod Deactivate
A cancel is also done as part of a Deactivate Pod.
1f 05 NNNNNNNN AX
1f 05 e1f78752 07
The AX value of 0x07 will cancel any on-going
bolus, temporary basal, and basal program in effect
and clears all completion beep and Program Reminders.
Suspend
The $1F command is also used as part of a "Suspend"
in conjunction with a $19 command.
Consider this example Suspend for 0.5 hours taken from
Temp basal with suspend cancel.
1f 05 NNNNNNNN AX 19 LL NNNNNNNN IVXX YYYY 0J0K IVXX YYYY 0J0K
1f 05 b15898b0 03 19 10 b15898b0 580f 000f 0604 6800 001e 0302
In this example,
the Cancel Command AX value of 0x03 is silent with an A nibble value of 0
while the c (0x02) and d (0x01) bits being set will cancel
the current temporary basal and basal programs
and clears the associated completion beeps and Program Reminders.
The subsequent Command 19 Configure Alerts then sets the Suspend related beeps.
Cancel Insulin Delivery
Yet, another 0x1F command variation is to
cancel a bolus operation before it is finished.
The PDM reports the partially delivered amount.
2017-11-17T15:07:17.702593 ID1:1f068f54 PTYPE:PDM SEQ:17 ID2:1f068f54 B9:08 BLEN:7 BODY:1f053b9a70286401c0 CRC:2c
2017-11-17T15:07:17.737905 ID1:1f068f54 PTYPE:POD SEQ:18 ID2:1f068f54 B9:0c BLEN:10 BODY:1d1800d610010007dfff803b CRC:87
2017-11-17T15:07:18.143485 ID1:1f068f54 PTYPE:ACK SEQ:19 ID2:1f068f54 CRC:33
2017-11-17T15:07:22.162888 ID1:1f068f54 PTYPE:PDM SEQ:20 ID2:1f068f54 B9:10 BLEN:3 BODY:0e01000110 CRC:f7
2017-11-17T15:07:22.236193 ID1:1f068f54 PTYPE:POD SEQ:21 ID2:1f068f54 B9:14 BLEN:10 BODY:1d1800d610010007dfff02b5 CRC:d3
1f 05 NNNNNNNN AX
1f 05 3b9a7028 64
In this cancel bolus example,
the $1F command AX value is 0x64.
The aaaa nibble value will generate one longer type 6 beep
and the b (0x04) bit being set specifies to cancel the bolus
and clears the bolus completion beep and Program Reminders.
Restrictions
This command can only be used when the current Pod Progress State is between 8 and 12.