DanaRS: do not send another packet if previous failed

This commit is contained in:
Milos Kozak 2023-03-03 22:20:02 +01:00
parent b4e5b01ea3
commit f651f721e0

View file

@ -371,6 +371,7 @@ class DanaRSService : DaggerService() {
if (!isConnected) return false
val status = DanaRSPacketGeneralInitialScreenInformation(injector)
sendMessage(status)
if (status.failed) return false
if (status.isTempBasalInProgress) {
rxBus.send(EventPumpStatusChanged(rh.gs(info.nightscout.pump.dana.R.string.stoppingtempbasal)))
sendMessage(DanaRSPacketBasalSetCancelTemporaryBasal(injector))
@ -391,6 +392,7 @@ class DanaRSService : DaggerService() {
fun highTempBasal(percent: Int): Boolean {
val status = DanaRSPacketGeneralInitialScreenInformation(injector)
sendMessage(status)
if (status.failed) return false
if (status.isTempBasalInProgress) {
rxBus.send(EventPumpStatusChanged(rh.gs(info.nightscout.pump.dana.R.string.stoppingtempbasal)))
sendMessage(DanaRSPacketBasalSetCancelTemporaryBasal(injector))
@ -414,6 +416,7 @@ class DanaRSService : DaggerService() {
}
val status = DanaRSPacketGeneralInitialScreenInformation(injector)
sendMessage(status)
if (status.failed) return false
if (status.isTempBasalInProgress) {
rxBus.send(EventPumpStatusChanged(rh.gs(info.nightscout.pump.dana.R.string.stoppingtempbasal)))
sendMessage(DanaRSPacketBasalSetCancelTemporaryBasal(injector))