Commit graph

1895 commits

Author SHA1 Message Date
AdrianLxM 7a7f75db01 fix cancel real temp basals from actions 2017-08-03 03:22:30 +02:00
AdrianLxM 0ac7357ee9 color for active temp 2017-08-03 03:12:47 +02:00
AdrianLxM 1ac1b77fd4 remove translated string not in default strings and add flag to cancel method 2017-08-03 02:01:52 +02:00
AdrianLxM 23abc0e4e5 Some more German 2017-08-02 00:08:56 +02:00
AdrianLxM 5d51b8f0f9 Some more German 2017-08-01 23:56:16 +02:00
AdrianLxM e30e62e9ab Some German translations, remove unused strings, App name for all 2017-08-01 23:46:58 +02:00
Radoslav Radev 39891bbad9 Update strings.xml 2017-08-01 23:29:23 +03:00
Milos Kozak e933650330 CS translations 2017-08-01 22:17:39 +02:00
Milos Kozak 9cf5c6b6c3 hide all overview buttons by default 2017-08-01 20:52:23 +02:00
Milos Kozak 34d4bec556 move cancel temp to actions 2017-08-01 20:45:57 +02:00
Milos Kozak 9596987b35 new temp basal dialog refactor 2017-08-01 20:02:17 +02:00
Milos Kozak d2a5939ce3 fix virtual pump crash 2017-08-01 17:53:28 +02:00
Milos Kozak a24cbfda50 Disconnect pump: cancel temp before setting new to make sure it will last as expected 2017-08-01 17:37:32 +02:00
Milos Kozak 6828e11dd9 remove notes strings as well 2017-08-01 17:25:43 +02:00
Milos Kozak 6f9f72d849 remove notes from temp basal upload 2017-08-01 17:21:32 +02:00
Sandra Keßler 4147e7f6a1 change Version info 2017-07-31 21:45:03 +02:00
Milos Kozak 668008e1c1 cancel current temp before activating superbolus 2017-07-31 19:53:09 +02:00
Sandra Keßler 791d905b14 exceptions 2017-07-31 13:08:10 +02:00
Sandra Keßler 14fdc14807 maybe better error recovery? 2017-07-31 12:59:03 +02:00
Sandra Keßler 58e6791441 alternate setTBR based on StateMachine 2017-07-31 11:52:31 +02:00
Sandra Keßler 3497296b6c more time 2017-07-31 09:08:12 +02:00
Sandra Keßler a7165497ea increase Button Timing to 200ms 2017-07-30 22:49:52 +02:00
Sandra Keßler 7c001e97bf wait till we get something currentDuration % 15 == 0 2017-07-30 22:25:49 +02:00
Sandra Keßler bfb6039c16 slow pump fix 2017-07-30 22:25:49 +02:00
Sandra Keßler 1d3fee54e9 if umbind fails while service is dead, bind would never be called 2017-07-30 22:23:01 +02:00
Sandra Keßler afda4f9254 Merge remote-tracking branch 'refs/remotes/origin/trim-to-max-tbr' into HEAD 2017-07-30 16:21:10 +02:00
Johannes Mockenhaupt 16dc21c7f1 Merge branch 'changeRuffyService' into 'stable'
change to support changed IRuffyService

See merge request !7
2017-07-30 11:27:27 +00:00
Johannes Mockenhaupt 27f788424a
Trim requested TBR rate to maximum the pump supports, properly round. 2017-07-30 13:06:52 +02:00
Johannes Mockenhaupt d672f3c653
Remove hander on ruffy unbind. 2017-07-30 13:03:43 +02:00
AdrianLxM bfd96b0635 Merge branch 'stable' into '1_5f'
# Conflicts:
#   app/src/main/res/values/strings.xml
2017-07-29 16:55:55 +00:00
Sandra Keßler 5e845e37f7 change to support changed IRuffyService 2017-07-28 13:41:10 +02:00
AdrianLxM 785e1b323c refresh-data - make guard condition better readable 2017-07-28 05:48:34 +02:00
AdrianLxM f680d70548 refresh data greater smaller fix 2017-07-27 23:35:44 +02:00
AdrianLxM 9572c8d9fc Merge remote-tracking branch 'origin/develop' into read-maxtbr-clean 2017-07-27 20:27:48 +02:00
AdrianLxM e79dc4fb66 only set icons when initialized 2017-07-27 16:31:09 +02:00
Johannes Mockenhaupt 17b0e7d71a
Fix some typos. 2017-07-27 14:35:56 +02:00
AdrianLxM c41b12492f tbr capability retry change 2017-07-27 13:43:50 +02:00
Johannes Mockenhaupt bd353a7043
BolusCommand: confirm via My Data history the correct amount was delivered. 2017-07-27 13:39:23 +02:00
AdrianLxM 2697ac9420 battery and insulinstate 2017-07-27 12:20:59 +02:00
AdrianLxM e34009271f preserve max tbr through app restarts 2017-07-27 09:53:33 +02:00
AdrianLxM 8937fbe574 use pumpdescription.maxTempPercent to cutoff temps 2017-07-26 22:35:13 +02:00
AdrianLxM 13173e48c1 tbr capability in ComboFragment 2017-07-26 22:16:35 +02:00
Johannes Mockenhaupt b96edc048e
Merge remote-tracking branch 'fork/develop' into stable
* fork/develop:
  setTBR - check for TBR and RUNTIME
2017-07-26 18:18:10 +02:00
AdrianLxM 76c0b999ff determine max possible tbr firstshot 2017-07-26 18:11:45 +02:00
Johannes Mockenhaupt 78d2322c14
Typos. 2017-07-26 18:02:21 +02:00
Johannes Mockenhaupt 02c80a924c
SetTbrCommand: remove retry logic, add extra checks for final bolus. 2017-07-26 18:00:18 +02:00
Johannes Mockenhaupt da69e69570
BolusCommand: remove retry logic, add extra checks for final bolus. 2017-07-26 16:06:58 +02:00
Johannes Mockenhaupt e1b63a4a74
Command doc. 2017-07-26 15:50:07 +02:00
Johannes Mockenhaupt f6b1887fd2
Logging: Print filename and line instead of logger name. 2017-07-26 15:26:44 +02:00
Johannes Mockenhaupt d79b221940
CommandException: provide message for printing. 2017-07-26 14:44:28 +02:00
Johannes Mockenhaupt 0516eacfe5
ConfigBuilder.applyAPSResult: log request rate. 2017-07-26 14:44:21 +02:00
AdrianLxM 21b81a5084 setTBR - check for TBR and RUNTIME 2017-07-26 12:19:28 +00:00
AdrianLxM 5569b42ac3 wear wizard percentage 2017-07-26 09:58:51 +02:00
Milos Kozak 7a572d2341 1.5f 2017-07-25 22:53:55 +02:00
Milos Kozak 4bb3b7c11d Merge pull request #323 from MilosKozak/nsclient-local-second
Nsclient local broadcasts
2017-07-25 19:51:57 +02:00
Milos Kozak 0914e67c11 typo 2017-07-25 19:25:58 +02:00
Milos Kozak f1e21053b5 use key instead of string 2017-07-25 19:24:51 +02:00
Milos Kozak d6cb8ef6bc check for existing value 2017-07-25 19:18:51 +02:00
Milos Kozak 252b24cefe Merge pull request #313 from MilosKozak/synchronize-nsclientlog
synchronize NSClient log
2017-07-25 12:50:48 +02:00
Johannes Mockenhaupt 58505922f2 Merge branch 'fixTBR' into 'combo'
fix >500% basal setting

See merge request !3
2017-07-25 09:35:59 +00:00
Sandra Keßler f68042af66 fix >500% basal setting 2017-07-24 18:39:43 +02:00
Johannes Mockenhaupt 314a551c96
Mark log entries comming from ruffy. 2017-07-24 15:18:16 +02:00
Johannes Mockenhaupt c8c4cf2813
Add log statement. 2017-07-24 13:30:08 +02:00
Johannes Mockenhaupt ebd9c0d876
Add wait time between reconnects.
Might improve GL#34.
2017-07-24 13:16:35 +02:00
Johannes Mockenhaupt 674fb398b8
Safeguard against communication issues with ruffy.
In most cases we can't do much, but we can handle exceptions
and show a notification and message what's wrong, so the user
can try to fix the issue.

Fixes jotomo/AndroidAPS#35.
2017-07-24 12:59:56 +02:00
Johannes Mockenhaupt 81f3aea42a
Provide basic pump data for upload. 2017-07-24 12:59:56 +02:00
AdrianLxM 3500e92a41 nsclient ackAlarm local 2017-07-24 02:33:29 +02:00
AdrianLxM d60321b4d1 nsclient alarms local 2017-07-24 02:27:16 +02:00
Johannes Mockenhaupt e6eee42081
Merge remote-tracking branch 'origin/dev' into combo
* origin/dev:
  recategorize cp icons
  removed unnecessary text colour and fixed indentation
  layout indentation
  Moving some buttons to the right categories
  removed empty ghost files
  remove duplicate IDs and indentation fix
  Picture renaming (#311)
2017-07-24 02:25:28 +02:00
Johannes Mockenhaupt 6a0273046d
Comment on English being the only supported pump language so far. 2017-07-24 02:24:48 +02:00
AdrianLxM a4864c3d06 nsclient cal local 2017-07-24 02:09:26 +02:00
AdrianLxM 194a817332 nsclient devicestatus local 2017-07-24 02:06:05 +02:00
AdrianLxM fe57d4a61d nsclient mbg local 2017-07-24 02:02:54 +02:00
AdrianLxM 82b99e1708 nsclient status local 2017-07-24 02:00:46 +02:00
AdrianLxM 759154e578 nsclient profile local 2017-07-24 01:58:23 +02:00
AdrianLxM 7a171bd949 nsclient sgv local 2017-07-24 01:55:01 +02:00
AdrianLxM 38100e758e nsclient treatments local 2017-07-24 01:50:27 +02:00
AdrianLxM 796b7ecdf2 rename package lowercase 2017-07-24 00:12:53 +02:00
Johannes Mockenhaupt 5e5c837949
Clean up comment. 2017-07-23 23:42:44 +02:00
Johannes Mockenhaupt cc715cf76f
Notes, typo. 2017-07-23 17:51:08 +02:00
Johannes Mockenhaupt 9826c1d953
Bugfix: NPE when refreshing pump status without a profile set.
The base basal rate is a different thing than a TBR rate, when a TBR
is running the PumpStatus has a tbrRate, when no TBR is running
there's no TBR rate, so don't display the base basal rate.
2017-07-23 14:07:46 +02:00
AdrianLxM 5e1e48be0a Allow prime/fill 2017-07-23 00:24:27 +00:00
AdrianLxM 1c0e97c175 recategorize cp icons 2017-07-22 20:57:30 +02:00
Johannes Mockenhaupt 27187b5e75
Bugfix: More reliable way to determine if the connection is ready to execute comands. 2017-07-22 20:02:35 +02:00
Johannes Mockenhaupt 9cdd988bff
Bugfix: sleep *inside* the loop.
Whops, maxing out a core, draining the battery.
2017-07-22 17:53:55 +02:00
AdrianLxM 2e32d12bc0 removed unnecessary text colour and fixed indentation 2017-07-22 14:34:59 +02:00
AdrianLxM c187bf1575 layout indentation 2017-07-22 14:30:55 +02:00
Roumen Georgiev 54697df358 Moving some buttons to the right categories 2017-07-22 14:27:51 +02:00
Johannes Mockenhaupt fcd6f4ea0e
jotomo/AndroidAPS#29 Don't raise alarm on 'double cancellation'. 2017-07-22 11:36:52 +02:00
Johannes Mockenhaupt a153b59d5d
Increase timeouts.
90s until timeout due to no menu updates
60s timeout for operations (waitForMenuToBeLeft, verifyMenuIsDisplayed).
2017-07-22 11:34:28 +02:00
Johannes Mockenhaupt b3a7585a52
Note an pump sluggishness. 2017-07-22 11:07:35 +02:00
AdrianLxM 3d4fa0cebf remove duplicate IDs and indentation fix 2017-07-22 02:15:55 +02:00
Johannes Mockenhaupt e45acab420
Return original exception in case retry fails as well. 2017-07-22 02:13:34 +02:00
AdrianLxM 0b6c9845fa synchronize NSClient log 2017-07-22 01:43:33 +02:00
Johannes Mockenhaupt d0d3e46e03
Log exception when automatically retrying command. 2017-07-22 00:44:53 +02:00
Johannes Mockenhaupt 7f185557f4
DEBUG: log temp basals that are active when pump receives command to issue a tbr when non is active on the pump. 2017-07-21 22:46:00 +02:00
Johannes Mockenhaupt 0029fdad01
Combo-specifici hack: Consider a TBR with less than 60 seconds left as completed
when determining whether to set a new TBR.

Setting a new TBR overrides an running TBR if any, so this won't fail on
the Combo. Without this, a TBR mostly runs out 20 seconds after a loop
iteration (when receiving a SGV), so for that almost 5 minutes to TBR
is set.

Note that this is Combo-specific and needs to be revised when
integrating this with mainline.
2017-07-21 22:45:47 +02:00
AdrianLxM 10d27f0b6a Picture renaming (#311)
* adding icons
2017-07-21 22:24:06 +02:00
Johannes Mockenhaupt 3bd865a870
Merge remote-tracking branch 'origin/dev' into combo
* origin/dev:
  1.5e
  Let CircadianPercentageProfileFragment inherit from SubscriberFragment.
  Fix after merge-conflict cleanup
  Files renamed
  Added icons for home, actions and care portal screens
  update bg translation
  synchronize interval access from other classes
  remove unnecessary semicolons
  spanish emptiy string
  remove extra strings
  self asignment -> comment
  string comparison
  Add color of chart to corresponding lables/scale
  Update InsulinFastactingProlongedFragment.java
  Update InsulinFastactingFragment.java
  Extract SubscriberFragment base class.
  Have most fragments update their content in onResume.
2017-07-21 17:42:27 +02:00
Johannes Mockenhaupt 9af2e0af01
Add v2 TODO 2017-07-21 17:40:12 +02:00
Johannes Mockenhaupt 893a604ef9
Fix combo_fragment blunder. 2017-07-21 17:40:12 +02:00
Johannes Mockenhaupt d7eee17112
Fix creating treatment record when bolusing (carb only treatment). 2017-07-21 17:40:12 +02:00
Johannes Mockenhaupt 46b1dff334
Make accessing pump/cmd state in Fragment safer. 2017-07-21 17:40:12 +02:00
Johannes Mockenhaupt cb8a22582a
Wait up to 90s before timing out on connection attempt.
Might take longer if we need to wait for the pump display to time
out due to recent user activity.
2017-07-21 17:40:12 +02:00
Johannes Mockenhaupt a28efb4be0
Add "pump error (message)" as a field in Combo fragement. 2017-07-21 17:40:12 +02:00
Johannes Mockenhaupt 63131f73d0
Cleanups. 2017-07-21 17:40:12 +02:00
Johannes Mockenhaupt 29cb1def50
Fix up "Rebind ruffy if there is an exception.".
Some removals, but more importantly to note that
the commit set pump/command state variables
volatile again.
2017-07-21 17:40:12 +02:00
Johannes Mockenhaupt 5c36094b8b
Remove some debug code. 2017-07-21 17:40:12 +02:00
Johannes Mockenhaupt 821e31c1c3
Add debug logging. 2017-07-21 17:40:12 +02:00
Johannes Mockenhaupt a2fad3293d
Fix adding pump state to CommandResult when there are violations. 2017-07-21 17:40:12 +02:00
Johannes Mockenhaupt d85425e68b
NPE guard. 2017-07-21 17:40:12 +02:00
Johannes Mockenhaupt d5bf5812b7
Rebind ruffy if there is an exception. 2017-07-21 17:40:12 +02:00
Johannes Mockenhaupt e526de68ea
Some improvements around connection state. 2017-07-21 17:40:12 +02:00
Johannes Mockenhaupt bf179cd751
Fail on attempts to cancel non-running TBR.
Until we know this would be benign.
We still return 'enacted=true', so AAPS can mark the TBR as finished
to recover from this error state.
2017-07-21 17:28:30 +02:00
AdrianLxM e381d197cb 1.5e 2017-07-21 16:49:43 +02:00
AdrianLxM 3d82bdb347 Merge pull request #295 from jotomo/on-resume-update-gui
On resume update gui
2017-07-21 16:47:28 +02:00
AdrianLxM 06497a862d Merge pull request #303 from AdrianLxM/synchronize-intervals
synchronize interval access from other classes
2017-07-21 16:47:00 +02:00
AdrianLxM 6d1c0feeab Merge pull request #302 from AdrianLxM/cleanups
Cleanups
2017-07-21 16:46:48 +02:00
AdrianLxM 0297f2b75d Merge pull request #301 from MilosKozak/insulin-colourlables
Add color of chart to corresponding lables/scale
2017-07-21 16:46:39 +02:00
Johannes Mockenhaupt fdc0aea24b
Let CircadianPercentageProfileFragment inherit from SubscriberFragment. 2017-07-21 14:56:14 +02:00
AdrianLxM 31fcf34a2d Fix after merge-conflict cleanup 2017-07-21 11:59:36 +02:00
PoweRGbg 059e58c640 Files renamed 2017-07-21 11:55:12 +02:00
Milos Kozak c68eccc328 Merge pull request #306 from boikonur/dev 2017-07-20 20:49:35 +02:00
Boyko Kazakov 3b1407b8dd Added icons for home, actions and care portal screens 2017-07-20 20:57:45 +03:00
Radoslav Radev 3098f0bdfa update bg translation 2017-07-20 09:24:35 +03:00
AdrianLxM 42263e979e synchronize interval access from other classes 2017-07-20 02:43:01 +02:00
AdrianLxM b72482601e remove unnecessary semicolons 2017-07-20 01:06:41 +02:00
AdrianLxM 1ba11ed006 spanish emptiy string 2017-07-20 01:06:21 +02:00
AdrianLxM b5cb68be73 remove extra strings 2017-07-20 01:06:00 +02:00
AdrianLxM 6daff6fae9 self asignment -> comment 2017-07-20 01:05:25 +02:00
AdrianLxM c35b7bb9d6 string comparison 2017-07-20 01:05:05 +02:00
AdrianLxM 03ad898562 Merge branch 'dev' into on-resume-update-gui 2017-07-20 00:17:32 +02:00
AdrianLxM 98bb792264 Add color of chart to corresponding lables/scale 2017-07-19 23:46:32 +02:00
Johannes Mockenhaupt a1564d5bb7
RuffyScripter: only set connected variable in rtConnected, rtDisconnected.
Hopefully fixes intermittent failures to close the connection, as
idleDisconnectMonitorThread sometimes fails to disconnect
because connected == false.
2017-07-19 21:45:28 +02:00
Johannes Mockenhaupt e322b15e1c
debug: setTbrPercent: 5 minute head start 2017-07-19 21:45:28 +02:00
Johannes Mockenhaupt a55756367f
ComboPlugin: use CommandResult.completionTime for treatment entries. 2017-07-19 21:45:28 +02:00
Johannes Mockenhaupt a8ecc85429
ConfigBuilderPlugin.applyApsResult: more verbose logging
Log whether the pump was asked to set a TBR if if that is skipped
since the pump still runs the requested TBR and for how long.
2017-07-19 21:45:28 +02:00
Johannes Mockenhaupt 1cf6448b0e
Add CommandResult.completionTime field and set it in RuffyScripter when the command has finished executing. 2017-07-19 21:45:28 +02:00
Johannes Mockenhaupt 97733848e7
SetTbrCommand: replace static wait with dynamic wait to have completionDate more accurate. 2017-07-19 21:45:28 +02:00
Johannes Mockenhaupt 467cf1e6ed
Pass pre-cmd pump state to command, log it. 2017-07-19 21:45:28 +02:00
Johannes Mockenhaupt a7c77bc177
Add "pump error (message)" as a field in Combo fragement. 2017-07-19 21:45:28 +02:00
Johannes Mockenhaupt 8cdd604b84
Merge remote-tracking branch 'origin/dev' into combo
* origin/dev:
  bulgarian removed non-translatable
  synchronize interval access
  nsclient remove debug data that puts stress on the broadcast system 3
  nsclient remove debug data that puts stress on the broadcast system 2
  nsclient remove debug data that puts stress on the broadcast system
  Align OpenAS(A)MA fragments with layout of other fragments.
  local broadcasts better setting title
  setting to disable local broadcasts in NSClient
  removed some "unneeded" translations
  wear tdd weighted
  wear TDD status
  wear menu simplification
  Translated latest additions strings.xml
  ns client quickfix now catch all
  NS client quickfix - catch even more
  catch TransactionTooLargeException
  TT new "old" logic for temp targets
  TT refactor OverlappingIntervals to two classes with an abstract superclass Intervals

# Conflicts:
#	app/src/main/res/values/strings.xml
2017-07-19 19:54:50 +02:00
AdrianLxM 732e225c7d bulgarian removed non-translatable 2017-07-19 19:50:40 +02:00
AdrianLxM f220bb034e Merge pull request #286 from AdrianLxM/temp-target-logic
Temp target logic
2017-07-19 19:33:17 +02:00
AdrianLxM e51954cec3 Merge pull request #292 from AdrianLxM/wear-tdd
Wear tdd
2017-07-19 19:05:41 +02:00
Milos Kozak 3475b64e1b Merge pull request #299 from MilosKozak/dev-nsclient-quickfix
NSClient quickfix
2017-07-19 18:53:38 +02:00
AdrianLxM 76990b7983 synchronize interval access 2017-07-19 17:39:55 +02:00
Milos Kozak 62ff62a31f Merge pull request #290 from PoweRGbg/patch-1 2017-07-19 17:21:15 +02:00
AdrianLxM e6ce35485a nsclient remove debug data that puts stress on the broadcast system 3 2017-07-19 16:09:34 +02:00
AdrianLxM 621c32d832 nsclient remove debug data that puts stress on the broadcast system 2 2017-07-19 16:06:36 +02:00
AdrianLxM c1e030d789 nsclient remove debug data that puts stress on the broadcast system 2017-07-19 16:05:13 +02:00
Johannes Mockenhaupt c95879e6ad
Align OpenAS(A)MA fragments with layout of other fragments.
Removes a margin that makes the top elements jump up and
down when flipping through tabs.
2017-07-19 12:32:18 +02:00
Johannes Mockenhaupt 7b16716b65
Clean up statusSumary, command result and pump status. 2017-07-19 01:53:37 +02:00
Johannes Mockenhaupt 485b99e260
Show last command and pump state better in the Combo tab.
Gets rid of unhelpful "Unknown error" messaegs.
2017-07-19 01:33:19 +02:00
Johannes Mockenhaupt 5aacf8410d
Fix CancelTbrCommand to return command resutlt not in PumpState but as part of the CommandResult object. 2017-07-19 01:30:26 +02:00
Johannes Mockenhaupt 825a87f474
Use OpenAPS-requested duration for TBRs. 2017-07-18 23:57:48 +02:00
AdrianLxM cfe8e0a23a local broadcasts better setting title 2017-07-18 22:18:10 +02:00
AdrianLxM c753873769 setting to disable local broadcasts in NSClient 2017-07-18 22:15:17 +02:00
Johannes Mockenhaupt 9927ab4989
Raise an error upon attempting to cancel a TBR when none is active. 2017-07-18 21:20:40 +02:00
Johannes Mockenhaupt 14d7043600
Skip fetching initial pump state if ruffy service isn't ready yet. 2017-07-18 21:20:40 +02:00
Johannes Mockenhaupt f3b508ba2d
Combo tab: refresh on resume
Since we're not getting events when the fragement is not displayed,
since we're unregistering from event in onPause.
2017-07-18 21:20:40 +02:00
Johannes Mockenhaupt 3b287df77d
Check active menu again when retrying inputs. 2017-07-18 21:20:40 +02:00
Johannes Mockenhaupt abf9566476
Log exception 2017-07-18 21:20:40 +02:00
Johannes Mockenhaupt ebe14fb0cf
BolusCommand: deal with blinking values.
How did this not trigger with all the  boluses I've issued so far?
2017-07-18 21:20:40 +02:00
Johannes Mockenhaupt 7fe9ad7910
Add retries for inputing values.
Rarely there seem to be timing issues and e.g.
10 button down presses to go from 100% to 0% only goes down to 20%.
Retry two more times in that case, restarting the input process on the
active screen (bolus input, tbr percent/duration input).
2017-07-18 21:20:40 +02:00
Johannes Mockenhaupt e52c2a857c
RuffyScripter: log command execution time. 2017-07-18 21:20:40 +02:00
Johannes Mockenhaupt 7dda253b88
RuffyScripter: when pump is suspended fail all commands but ReadPumpState.
Safest way for v1 (which I'm trying to stabilize, not rework ;-) ).
2017-07-18 21:20:40 +02:00
Johannes Mockenhaupt bd14b399d5
Comment. 2017-07-18 21:20:40 +02:00
Johannes Mockenhaupt b4950b3037
Provide suspended state information to AAPS.
AAPS seems to still try to issue commands (like cancel TBR,
though none is running?)), despite showing "Pump suspended"
on the home screen.
With the DanaR, AAPS also tries to run commands when the
pump is suspended, but there, the treatment is logged
as being administered despite the pump not having done that.

Here, the pump response with success=false, enacted=false,
which causes the ComboPlugin class to NOT create any
treatments. No errors are raised, as this is considered a regular
state: no treatments are enacted, overview screen shows
"pump suspended" and the combo beeping away.
That AAPS still tries to issue TBR commands ... that's AAPS'
problem for now. Buttons to issue boluses are hiden though.
2017-07-18 21:20:40 +02:00
Johannes Mockenhaupt 55e7006967
Remove superfluous code (state is always set later in controlling thread). 2017-07-18 21:20:40 +02:00
Johannes Mockenhaupt 599f3ce23c
Order methods in the order they're called, start Alerter service earlier to make sure it can catch early errors. 2017-07-18 21:20:40 +02:00
Johannes Mockenhaupt 487e9deb88
Set an error state when the ruffy service can't be bound.
See code comment.
2017-07-18 21:20:40 +02:00
Johannes Mockenhaupt 02a9ed6eda
Set an active command before establishing a connection.
Otherwise the disconnect thread will close the connection
due to inactivity. We could add a variable 'isConnecting',
but I'm not sure if adding another (ruffy-) global state
variable will make things simpler to grasp.
2017-07-18 21:20:40 +02:00
Johannes Mockenhaupt c37310685a
Don't count the time establishing a connection towards a command timeout.
Note: connection timeouts are also dealt with. They're now (cleanly)
separated: connect- and command-timeouts.

If the pump's display is one due to the user interacting with the pump
directly, the pump needs a display timeout before being ready for an
incoming connection. What I'm trying to say is, it might take some time,
maybe up to 30s to establish a connection in that cause and can thus
easily create a false timeout error.
2017-07-18 21:20:40 +02:00
Johannes Mockenhaupt 36966c8907
Handle the pump being stopped: don't treat it like an error, but don't execute commands either. 2017-07-18 21:20:40 +02:00
Johannes Mockenhaupt 222ad0a527
Improve display of error state in Combo tab. 2017-07-18 21:20:40 +02:00
Johannes Mockenhaupt 7fa59c6c16
Combo tab: we have set a TBR duration, we're not showing how much time is remaing, but what has been set. 2017-07-18 21:20:40 +02:00
Johannes Mockenhaupt e9fa9b1788
Silly me, of course fragments (and everything else) are recreated by Android all the time. 2017-07-18 21:20:40 +02:00
Johannes Mockenhaupt 29e7ea1966
Don't ignore user requests to update pump data, tweak alerter. 2017-07-18 21:20:40 +02:00
Johannes Mockenhaupt 338d29630c
Notes from manual timing test (yeah, new timeout code seems to work). 2017-07-18 21:20:40 +02:00
Johannes Mockenhaupt af4ec4d072
BolusCommand: fix contstraint check (doh!) 2017-07-18 21:20:40 +02:00
Johannes Mockenhaupt 5f43f0f147
* Fix stale data in Combo tab after error
* Add info about last command ran to the Combo tab
* Don't refresh data more than once a minute.
* Specify not only error, but also command that raised the error in
  alert notification
2017-07-18 21:20:40 +02:00
Johannes Mockenhaupt 4dc38e447a
Add first ruffyscripter test (needs ruffy to be available during test somehow). 2017-07-18 21:20:40 +02:00
Johannes Mockenhaupt ac10bdc01c
First stab at dynamic timeout. 2017-07-18 21:20:40 +02:00
Johannes Mockenhaupt 44ae79bd50
Move command argument checking out of ctor into a dedicated method and check prior to execution. 2017-07-18 21:20:40 +02:00
Johannes Mockenhaupt 6faa1614ac
ComboFragment: rename Update Button to Refresh. 2017-07-18 21:20:40 +02:00
Johannes Mockenhaupt 5fad9b3a85
Cleanups. 2017-07-18 21:20:40 +02:00
Johannes Mockenhaupt 20a8350c67
Robustness for RuffyScripter. 2017-07-18 21:20:40 +02:00
Johannes Mockenhaupt aa98864d65
... this should have gone into earlier commit, the UI one? 2017-07-18 21:20:40 +02:00
Johannes Mockenhaupt ecf3866b43
Improve alerter. 2017-07-18 21:20:40 +02:00
Johannes Mockenhaupt c131280e91
RuffyScripter.verifyMenuIsDisplayed: don't call waitForMenuUpdate, menu should already be displayed. If not, wait up to 1 second. 2017-07-18 21:20:40 +02:00
Johannes Mockenhaupt ccffa3bfca
Add alerter thread to ComboPlugin that raises an alarm every 6 minutes (Android will by default silence alarms that go off within less than 5 minutes) when the pump state shows an error condition. 2017-07-18 21:20:40 +02:00
Johannes Mockenhaupt 362c3681d5
Clean up commands package. 2017-07-18 21:20:40 +02:00
Johannes Mockenhaupt c63c86f98a
RuffyScripter improvements:
* Keep track of connection status rather than relying in IRuffyService.isConnected
* Abort running command if pump stops sending menu updates
* Fail if ruffy goes away (binding becomes invalid), currently only if this happens during disconnect attempts
2017-07-18 21:20:40 +02:00
Johannes Mockenhaupt 52b9621e29
Paranoia: check we're in the expected menu before each and every button press. 2017-07-18 21:20:40 +02:00
Johannes Mockenhaupt d619796019
Improving pump status in the UI (combo tab) 2017-07-18 21:20:40 +02:00
Johannes Mockenhaupt f7586268c7
Dead code be gone. 2017-07-18 21:20:39 +02:00
Johannes Mockenhaupt 93c0147b23
RuffyScripter: take over connection management. Disconnect after 5s of inactivity. Plus some fixes. 2017-07-18 21:20:39 +02:00
Johannes Mockenhaupt b954ddaa84
Clean up ComoPlugin a bit. 2017-07-18 21:20:39 +02:00
Johannes Mockenhaupt ccd81c67fd
UI for pump state. 2017-07-18 21:20:39 +02:00
Johannes Mockenhaupt 2ddccd3c31
RuffyScripter.runCommand: Next shot at understanding threading better. 2017-07-18 21:20:39 +02:00
Johannes Mockenhaupt 83e9ec743e
Properly accessing volatile field pumpState. 2017-07-18 21:20:39 +02:00
Johannes Mockenhaupt 69e560baee
Cleanup. 2017-07-18 21:20:39 +02:00
Johannes Mockenhaupt 4c0944b9f8
Optimize cancelling TBR. 2017-07-18 21:20:39 +02:00
Johannes Mockenhaupt 3aecf0f58b
Be more cautious handling command failures. 2017-07-18 21:20:39 +02:00
Johannes Mockenhaupt 8dd714b390
UI crimes 2017-07-18 21:20:39 +02:00
Johannes Mockenhaupt 8ecf6922f7
Misc improvements:
* Make command execution (RuffyScripter/ComoboPlugin.runCommand) more robust (I still suck at threading).
* Return all possible states in PumpState
* Add absolute TBR to PumpState
* Add NoOpCommand to fetch state data from pump
* Display returned pump state in Combo fragment/tab.
2017-07-18 21:20:39 +02:00
Johannes Mockenhaupt f251427d1b
Remove ReadStateCommand, all state will be return through the PumpState field on CommandResult, so it's passed back after every command. 2017-07-18 21:20:39 +02:00
Johannes Mockenhaupt ec6491fcb7
Return absolute TBR rate in PumpState. 2017-07-18 21:20:39 +02:00
Johannes Mockenhaupt 69b98c54c6
Polish. 2017-07-18 21:20:39 +02:00
Johannes Mockenhaupt 9653af5501
RuffyScripter.navigateToMenu: detect if we're wrapping around not finding a menu (likely because it's hidden) 2017-07-18 21:20:39 +02:00
Johannes Mockenhaupt 7e538cbcf6
Update PumpState s/errorCode/errorMsg/g 2017-07-18 21:20:39 +02:00
Johannes Mockenhaupt 99830b05b6
Fix detecting error state on connection and fix cancelling TBR.
When there's an error, timing is crucial. Waiting for the blinking error code
to be readable hangs the thread running the command.
2017-07-18 21:20:39 +02:00
Johannes Mockenhaupt f6c8f3638b
Reflect reject TBR change in comment. 2017-07-18 21:20:39 +02:00
Johannes Mockenhaupt 4ff81e885c
Simplify reading alerts (message doesn't blink) 2017-07-18 21:20:39 +02:00
Johannes Mockenhaupt e01e85c54f
On connect, check if pump is in an error state. 2017-07-18 21:20:39 +02:00
Johannes Mockenhaupt 364123c261
Fix carb only treatment. 2017-07-18 21:20:39 +02:00
Johannes Mockenhaupt d0dabf34da
Fix handling TBR CANCELLED alert, remove ill-advised attempts to fake a command queue and have all commands return a state object. 2017-07-18 21:20:39 +02:00
Johannes Mockenhaupt 952aa0e8a2
RuffyScripter.waitForMenuToBeLeft: add timeout. 2017-07-18 21:20:39 +02:00
Johannes Mockenhaupt 77711b2174
ComboPlugin.runCommand: wait if pump is busy with a command. 2017-07-18 21:20:39 +02:00
Johannes Mockenhaupt d8011aeaa4
Make cancelling TBR more robust to dismiss TBR cancelled alert specifially and only if it is raised.
Cancelling a TBR with a runtime < 60s (0:01 in the display) does NOT raise a TBR cancelled alert.
2017-07-18 21:20:39 +02:00
Johannes Mockenhaupt 2c706e7c22
Remove status logging in Ruffy, now done by command. 2017-07-18 21:20:39 +02:00
Johannes Mockenhaupt 8bc4cd255a
Don't close connection when other cmds are about to be run. 2017-07-18 21:20:39 +02:00
Johannes Mockenhaupt f5ef666061
Add timestamp to State and rename to PumpState. 2017-07-18 21:20:39 +02:00
Johannes Mockenhaupt f28a27a93f
Read pump state. 2017-07-18 21:20:39 +02:00
Johannes Mockenhaupt 9d8d12fcb9
Cleanups. 2017-07-18 21:20:39 +02:00
Johannes Mockenhaupt eab9d8dcd7
Fix reducing duration of OpenAPS TBRs 2017-07-18 21:20:39 +02:00
Johannes Mockenhaupt e76524a539
Include state in CommandResult.toString. 2017-07-18 21:20:39 +02:00
Johannes Mockenhaupt 375eb46695
ReadStateCommand: properly read TBR %. 2017-07-18 21:20:39 +02:00
Johannes Mockenhaupt fa039e6961
Note on cancelling TBRs that don't trigger a pump alert. 2017-07-18 21:20:18 +02:00
Johannes Mockenhaupt 0345a01fc1
Make CancelTbrCommand more robust. 2017-07-18 20:59:56 +02:00
Johannes Mockenhaupt 30fc385970
Apply pump specific modifications to OpenAPS suggestion in ComboPlugin. 2017-07-18 20:59:56 +02:00
Johannes Mockenhaupt 5631488cc8
Add ReadStateCommand. 2017-07-18 20:59:56 +02:00
Johannes Mockenhaupt 8b21bb1203
Skip TBR changes smaller than 20%.
~50 TBR changes in a 6 hour night seem excessive, even if pump was
handicapped by not being connected and thus not having any effect
to work with.
2017-07-18 20:59:56 +02:00
Johannes Mockenhaupt a2b3c26b33
Log pump status on connect. 2017-07-18 20:59:56 +02:00
Johannes Mockenhaupt 347890496b
SetTbrCommand: wain for menu update when switching to TBR_DURATION to make it safer, hopefully. 2017-07-18 20:59:56 +02:00
Johannes Mockenhaupt 8c107cb48a
RuffyScripter: Log button presses. 2017-07-18 20:59:56 +02:00
Johannes Mockenhaupt df58b6d1c2
CancelTbrCommand: log running TBR to be cancelled. 2017-07-18 20:59:56 +02:00
Johannes Mockenhaupt 8e2cd844a5
Round requested absolute TBR to percent TBR. 2017-07-18 20:59:56 +02:00
Johannes Mockenhaupt a21da8aba7
Remove pointless events about connection status. 2017-07-18 20:59:56 +02:00
Johannes Mockenhaupt 848a32eade
Logging cleanup. 2017-07-18 20:59:56 +02:00
Johannes Mockenhaupt 9674db8d85
CancelTbrCommand: set enacted=true, even when there was no TBR to cancel.
This helps recover when there was an issue. AAPS thinks there's a TBR
running and by reporting back 'enacted', the plugin will create a
"Cancel temp" treatment.
2017-07-18 20:55:48 +02:00
Johannes Mockenhaupt 264e252300
Set last command date.
Though this is only relevant when starting to fetch data from the pump.
2017-07-18 20:55:48 +02:00
Johannes Mockenhaupt 336315823e
ComboPlugin.getBaseBasalRate: return profile value. 2017-07-18 20:55:48 +02:00
Johannes Mockenhaupt 0729d7a114
RuffyScripter: Abort a running command after 90s timeout 2017-07-18 20:55:47 +02:00
Johannes Mockenhaupt f34fed1f05
Semi-fix bolusing not logging a treatment when there was an error. 2017-07-18 20:55:47 +02:00
Johannes Mockenhaupt e29ef5ffce
Update treatment history when setting/cancelling a TBR. 2017-07-18 20:55:47 +02:00
Johannes Mockenhaupt a27bb28e87
ComboPlugin.deliverTreatment: return command message as comment in PumpEnactResult.
Important when there's an error.
2017-07-18 20:55:47 +02:00
Johannes Mockenhaupt d35d93ed44
RuffyScripter.verifyMenuIsDisplayed: wait a bit longer if needed.
Sometimes the pump seems to take a bit longer.
2017-07-18 20:55:47 +02:00
Johannes Mockenhaupt 76578872d1
ComoPlugin.deliverTreatment: take more time.
Even if not interacting with the pump, AAPS calculator doesn't dismiss the
dialog if we return within the first 5s.
2017-07-18 20:55:47 +02:00