Fix rejecting multiple TBRs.

(cherry picked from commit c1e9800)
This commit is contained in:
Johannes Mockenhaupt 2017-11-25 19:35:41 +01:00
parent 1e9d0d08c3
commit 1d83abc0d2
No known key found for this signature in database
GPG key ID: 9E1EA6AF7BBBB0D1
3 changed files with 10 additions and 2 deletions

View file

@ -46,6 +46,8 @@ Setup v2:
- Pair the pump, if it doesn't work, switch to the `pairing` branch, pair,
then switch back the original branch. If the pump is already paired and
can be controlled via ruffy, installing the above version is sufficient.
If AAPS is already installed, switch to the MDI plugin to avoid the Combo
plugin from interfering with ruffy during the pairing process.
- Get AndroidAPS from https://gitlab.com/jotomo/KEF (Branch `combo-scripter-v2`)
- Before enabling the Combo plugin in AAPS make sure you're profile is set up
correctly and your basal profile is up to date as AAPS will sync the basal profile
@ -90,6 +92,7 @@ Usage:
- If the loop requests a running TBR to be cancelled the Combo will set a TBR of 90% or 110%
for 15 minutes instead. This is because cancelling a TBR causes an alert on the pump which
causes a lot of vibrations.
- Long press the Refresh button on the Combo tab to force a re-read of all pump data
Reporting bugs:
- Note the precise time the problem occurred and describe the circumstances and steps that caused

View file

@ -94,3 +94,8 @@
Android logs it as crashed and restarts it, thereby restarting the app (or just keeping it alive,
also causes errors with the DB as there were attemtps to open a closed DB instance/ref.
- [ ] Check if TBRs are set to often from ConfigBuilder on high base basal rates (basalstep is 0.01; in reality larger on >1U/h base basal)
- [ ] With long running commands (e.g. setting basal rate, which can take up to 5m), multiple 'set tbr' commands
may stack up. Since setting a TBR multiple times in one minute fails, the ComboPlugin rejects such
request, letting the oldest TBR run till the net iteration. This can potentially be nicely solved
through the queue branch. However, the original problem is the amount of time the Combo can
take to execute commands, which might go away (mostly) with command mode.

View file

@ -590,7 +590,7 @@ public class ComboPlugin implements PluginBase, PumpInterface, ConstraintsInterf
}
long thisMinute = System.currentTimeMillis() / (60 * 1000) * (60 * 1000);
TemporaryBasal activeTbr = MainApp.getConfigBuilder().getTempBasalFromHistory(thisMinute);
TemporaryBasal activeTbr = MainApp.getDbHelper().getTemporaryBasalsDataByDate(thisMinute);
if (activeTbr != null && activeTbr.date == thisMinute) {
// setting multiple TBRs within a single minute (with the first TBR having a runtime
// of 0) is not supported. Attempting to do so sets a new TBR on the pump but adding