Merge pull request #116 from 0pen-dash/avereha/unconfirmed
bugfix: ALARM_ILLEGAL_PUMP_STATE
This commit is contained in:
commit
829f5fec6a
2 changed files with 6 additions and 10 deletions
|
@ -177,10 +177,10 @@ class MessageIO(
|
|||
}
|
||||
|
||||
BleCommandSuccess -> {
|
||||
if (index != packets.size)
|
||||
MessageSendErrorSending("Received SUCCESS before sending all the data. $index")
|
||||
else
|
||||
if (index == packets.size-1)
|
||||
MessageSendSuccess
|
||||
else
|
||||
MessageSendErrorSending("Received SUCCESS before sending all the data. $index")
|
||||
}
|
||||
|
||||
else ->
|
||||
|
|
|
@ -37,7 +37,6 @@ class Session(
|
|||
aapsLogger.debug(LTag.PUMPBTCOMM, "Sending command: ${cmd.encoded.toHex()} in packet $cmd")
|
||||
|
||||
val msg = getCmdMessage(cmd)
|
||||
var possiblyUnconfirmedCommand = false
|
||||
for (i in 0..MAX_TRIES) {
|
||||
aapsLogger.debug(LTag.PUMPBTCOMM, "Sending command(wrapped): ${msg.payload.toHex()}")
|
||||
|
||||
|
@ -46,8 +45,8 @@ class Session(
|
|||
return CommandSendSuccess
|
||||
|
||||
is MessageSendErrorConfirming -> {
|
||||
possiblyUnconfirmedCommand = true
|
||||
aapsLogger.debug(LTag.PUMPBTCOMM, "Error confirming command: $sendResult")
|
||||
return CommandSendErrorConfirming(sendResult.msg)
|
||||
}
|
||||
|
||||
is MessageSendErrorSending ->
|
||||
|
@ -55,11 +54,8 @@ class Session(
|
|||
}
|
||||
}
|
||||
|
||||
val errMsg = "Maximum number of tries reached. Could not send command\""
|
||||
return if (possiblyUnconfirmedCommand)
|
||||
CommandSendErrorConfirming(errMsg)
|
||||
else
|
||||
CommandSendErrorSending(errMsg)
|
||||
val errMsg = "Maximum number of tries reached. Could not send command"
|
||||
return CommandSendErrorSending(errMsg)
|
||||
}
|
||||
|
||||
@Suppress("ReturnCount")
|
||||
|
|
Loading…
Reference in a new issue