bufix for ALARM_ILLEGAL_PUMP_STATE

This commit is contained in:
Andrei Vereha 2021-09-14 20:01:21 +02:00
parent d4b0935d6b
commit 40a56d11ee
2 changed files with 6 additions and 10 deletions

View file

@ -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 ->

View file

@ -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")