Commit graph

38 commits

Author SHA1 Message Date
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 2ddccd3c31
RuffyScripter.runCommand: Next shot at understanding threading better. 2017-07-18 21:20:39 +02:00
Johannes Mockenhaupt 4c0944b9f8
Optimize cancelling TBR. 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 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 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 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 f5ef666061
Add timestamp to State and rename to PumpState. 2017-07-18 21:20:39 +02:00
Johannes Mockenhaupt 9d8d12fcb9
Cleanups. 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 5631488cc8
Add ReadStateCommand. 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 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 0729d7a114
RuffyScripter: Abort a running command after 90s timeout 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 e07d62bf79
Fix setting TBR when existing TBR has runtime < 15m. 2017-07-18 20:55:47 +02:00
Johannes Mockenhaupt 97f9e99437
toString methods for Commands. 2017-07-18 20:55:47 +02:00
Johannes Mockenhaupt 1f5c03b64e
Cleanups. 2017-07-18 20:55:47 +02:00
Johannes Mockenhaupt 3280092566
Source ruffy scripter for the time being (already some fixes and tweaks in). 2017-07-18 20:55:44 +02:00