Merge pull request #2655 from Philoul/FixWearControl

Fix Wear Control
This commit is contained in:
Milos Kozak 2020-05-18 09:43:50 +02:00 committed by GitHub
commit ea20895966
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -86,7 +86,7 @@ class ActionStringHandler @Inject constructor(
var rMessage = "" var rMessage = ""
var rAction = "" var rAction = ""
// do the parsing and check constraints // do the parsing and check constraints
val act = actionString.split("\\s+").toTypedArray() val act = actionString.split("\\s+".toRegex()).toTypedArray()
if ("fillpreset" == act[0]) { ///////////////////////////////////// PRIME/FILL if ("fillpreset" == act[0]) { ///////////////////////////////////// PRIME/FILL
val amount: Double = if ("1" == act[1]) { val amount: Double = if ("1" == act[1]) {
sp.getDouble("fill_button1", 0.3) sp.getDouble("fill_button1", 0.3)
@ -470,7 +470,7 @@ class ActionStringHandler @Inject constructor(
if (System.currentTimeMillis() - lastSentTimestamp > TIMEOUT) return if (System.currentTimeMillis() - lastSentTimestamp > TIMEOUT) return
lastConfirmActionString = null lastConfirmActionString = null
// do the parsing, check constraints and enact! // do the parsing, check constraints and enact!
val act = actionString.split("\\s+").toTypedArray() val act = actionString.split("\\s+".toRegex()).toTypedArray()
if ("fill" == act[0]) { if ("fill" == act[0]) {
val amount = SafeParse.stringToDouble(act[1]) val amount = SafeParse.stringToDouble(act[1])
val insulinAfterConstraints = constraintChecker.applyBolusConstraints(Constraint(amount)).value() val insulinAfterConstraints = constraintChecker.applyBolusConstraints(Constraint(amount)).value()