Commit graph

156 commits

Author SHA1 Message Date
Johannes Mockenhaupt d47b2f8b4b
Swallow exception on disconnect. 2018-01-04 21:20:12 +01:00
Johannes Mockenhaupt 9457fb61e5
RuffyScripter.isConnected: longer wait.
Declare the connection dead if no menu update was sent within 10s.
Occassionally it takes up 4s for regular updates to come in (possibly
due to other busy background threads? Iob/Cob calc is suspiscously
often running when the error occurs).
With the previous timeout, commands were killed too early when
things (pump, ruffy, aaps ...) needed some time to think).
2018-01-04 11:38:34 +01:00
Johannes Mockenhaupt 2d769ccf9a
Remove debug code. 2018-01-04 11:03:47 +01:00
Johannes Mockenhaupt a6b938d98a
Correctly infer pump date when crossing midnight. Fixes #35.
(cherry picked from commit bda2551)
2017-12-31 00:27:41 +01:00
Johannes Mockenhaupt 8089825c4c
SetBasalProfileCommand: abort if active BR is != 1. 2017-12-27 12:28:01 +01:00
Johannes Mockenhaupt 6af28479d6
Disable loop if unsupported basal rate profile is selected. Fixes #31. 2017-12-27 12:28:01 +01:00
Johannes Mockenhaupt cf9d55747e
Fix NPE. 2017-12-20 21:14:35 +01:00
Johannes Mockenhaupt 7c04f528cc
Revert "Handle edge case of setting basal rate in range 0.00 - 0.05."
This reverts commit 2054e76cde.
2017-12-20 18:06:50 +01:00
Johannes Mockenhaupt 2054e76cde
Handle edge case of setting basal rate in range 0.00 - 0.05. 2017-12-20 16:40:45 +01:00
Johannes Mockenhaupt ea1fd8fee8
Don't declare connection unusable too quickly. 2017-12-20 12:52:54 +01:00
Johannes Mockenhaupt f4c1f4a3a1
Make recovering from command failure more robust. 2017-12-19 23:43:08 +01:00
Johannes Mockenhaupt 559dbdf0b1
Undo over-eager optimization.
Makes setting actual 90/110% TBRs impossiblee and will result in
ComboPlugin starting TBRs with 100% (and failing because duration
is not readable or 0).

(cherry picked from commit 5a4e7d4)
2017-12-18 20:43:00 +01:00
Johannes Mockenhaupt d2339f0a5b
Merge pull request #24 from jotomo/cleanups
Cleanups
2017-12-17 21:23:02 +01:00
Johannes Mockenhaupt 7996acceb7
RuffyScripter.isConnected: one millisecond is a long time.
(cherry picked from commit 796b9a0)
2017-12-17 18:50:56 +01:00
Johannes Mockenhaupt e0d77b9b0c
Don't bother setting a fake TBR if we waited for a TBR to run out.
(cherry picked from commit 3a5ecea)
2017-12-17 15:39:38 +01:00
Johannes Mockenhaupt 5f4a90d068
Explicit disconnect during recovery.
BT connection might still be there, but no menu updates coming in.
Thus, explicitely close the connection before attempting to
reconnect.
2017-12-17 15:39:38 +01:00
Johannes Mockenhaupt 7e7b11ba14
Bolusing: make cancellation during 'confirmation wait window' robust. 2017-12-15 22:38:28 +01:00
Johannes Mockenhaupt b9f12aeddb
Fix formatting. 2017-12-15 21:53:33 +01:00
Johannes Mockenhaupt 1b5b06d349
BolusCommand: log steps. 2017-12-15 21:52:51 +01:00
Johannes Mockenhaupt a6a87d0790
Minor fixes and polish around bolus cancellation. 2017-12-15 10:41:07 +01:00
Johannes Mockenhaupt cac38c2401
Make RuffyScripter.isConnected more robust, remove debug code. 2017-12-14 22:14:05 +01:00
Johannes Mockenhaupt 97a9d65b52
Fix reading pump time. 2017-12-13 21:22:13 +01:00
Johannes Mockenhaupt 27922a045e
Log who requested the disconnect. 2017-12-13 20:42:43 +01:00
Johannes Mockenhaupt 7eb40653b2
The pump doesn't accept connections while a bolus delivery is in progress.
Remove the code which checked for a bolus delivery in progress
and waited.
2017-12-13 20:42:43 +01:00
Johannes Mockenhaupt 5654a8ee6e
Make RuffyScripter.readPumpStateInternal more robust. 2017-12-13 20:39:08 +01:00
Johannes Mockenhaupt 71355f0421
Typo that typo and other minor cleanups. 2017-12-13 16:29:53 +01:00
Johannes Mockenhaupt d0c494fb56
ReadHistoryCommand: minor cleanup. 2017-12-13 15:49:19 +01:00
Johannes Mockenhaupt 03e75ab23f
Typos. 2017-12-13 15:44:07 +01:00
Johannes Mockenhaupt 5b31d39f28
Extract method checkAndWaitIfExistingTbrIsAboutToEnd. 2017-12-13 14:26:41 +01:00
Johannes Mockenhaupt 7ed64c5a7d
SetTbrCommand: verify current menu when checking running TBR. 2017-12-13 14:22:06 +01:00
Johannes Mockenhaupt 3156efaaf6
SetTbr: wait if an existing TBR is about to run out.
See code comment.
2017-12-13 13:17:04 +01:00
Johannes Mockenhaupt 536bd10e9b
Raise hard limit of max duration for zero-temp from 2h to 3h.
(cherry picked from commit 4bf6369)
2017-12-13 13:16:19 +01:00
Johannes Mockenhaupt f83dd1cb67
Unbreak RuffyCommandsV1Impl.readHistory, cleanups. 2017-12-12 00:57:04 +01:00
Johannes Mockenhaupt a6cba8b2d1
RuffyCommandsV1Impl: actually do delegation.
(cherry picked from commit 5e447ad)
2017-12-10 22:24:07 +01:00
Johannes Mockenhaupt ca9fe3e755
Fixes around bolus cancellation. 2017-12-10 01:39:58 +01:00
Johannes Mockenhaupt 6527b13934
Ignore disconnect failures. 2017-12-09 22:21:24 +01:00
Johannes Mockenhaupt bb1c1f79f1
RuffyScripter: fix on-connect checks to detect running bolus properly. 2017-12-09 22:11:41 +01:00
Johannes Mockenhaupt b8ad44ba43
Fix ReadHistoryCommand to not ignore TDD requests. 2017-12-09 19:46:28 +01:00
Johannes Mockenhaupt e286b9e3c2
RuffyScripter: read/infer pump time from menu. 2017-12-09 19:43:24 +01:00
Johannes Mockenhaupt cf142a4538
Merge pull request #4 from jotomo/verify-record-date-after-bolus-cancel
Verify and return delivered bolus amount in BolusCommand
2017-12-09 19:41:16 +01:00
Johannes Mockenhaupt 8bba8c4d5a
SetTbrCommand: handle edge case where TBR expires while a new one is being programmed. 2017-12-09 16:21:40 +01:00
Johannes Mockenhaupt d18fdc4974
Bolus used to determine last bolus must be within last/next 10min. 2017-12-09 00:37:38 +01:00
Johannes Mockenhaupt 197c116c0b
Document corner-cases when bolusing fails. 2017-12-09 00:34:08 +01:00
Johannes Mockenhaupt 2c8c25c082
Another NPE fix when ruffy isn't available. 2017-12-08 13:10:54 +01:00
Johannes Mockenhaupt f09464e5d6
Move detection of partial bolus delivery to BolusCommand.
Have BolusCommand verify delivered bolus if needed and return the
actually delivered bolus amount. This makes more sense now,
given history is only read if unavoidable.
2017-12-08 12:56:15 +01:00
Johannes Mockenhaupt e5a68608a0
Fix NPE when there's no pump. 2017-12-08 12:55:05 +01:00
Johannes Mockenhaupt 8009b32b16
Fix reading history when bolus was attempted to cancel but bolus finished before pump accepted request. 2017-12-06 20:06:56 +01:00
Johannes Mockenhaupt 60d6f305b5
Debug code. 2017-12-06 19:31:51 +01:00
Johannes Mockenhaupt 865fc63bd4
RuffyScripter: consider pump connected when BT connection is there AND menu updates are being received. 2017-12-06 17:14:30 +01:00
Johannes Mockenhaupt 1cbfefffb8
RuffyScripter: wait for command thread to finish up. 2017-12-06 16:06:16 +01:00