Merge pull request #893 from 0pen-dash/avereha/fix-bolus
Avereha/fix bolus
This commit is contained in:
commit
43287f6dca
2 changed files with 42 additions and 37 deletions
|
@ -461,16 +461,16 @@ class OmnipodDashPumpPlugin @Inject constructor(
|
||||||
R.string.key_omnipod_common_expiration_reminder_enabled
|
R.string.key_omnipod_common_expiration_reminder_enabled
|
||||||
) ||
|
) ||
|
||||||
it.isChanged(
|
it.isChanged(
|
||||||
rh,
|
rh,
|
||||||
R.string.key_omnipod_common_expiration_reminder_hours_before_shutdown
|
R.string.key_omnipod_common_expiration_reminder_hours_before_shutdown
|
||||||
) ||
|
) ||
|
||||||
it.isChanged(
|
it.isChanged(
|
||||||
rh,
|
rh,
|
||||||
R.string.key_omnipod_common_low_reservoir_alert_enabled
|
R.string.key_omnipod_common_low_reservoir_alert_enabled
|
||||||
) ||
|
) ||
|
||||||
it.isChanged(
|
it.isChanged(
|
||||||
rh,
|
rh,
|
||||||
R.string.key_omnipod_common_low_reservoir_alert_units
|
R.string.key_omnipod_common_low_reservoir_alert_units
|
||||||
)
|
)
|
||||||
) {
|
) {
|
||||||
commandQueue.customCommand(CommandUpdateAlertConfiguration(), null)
|
commandQueue.customCommand(CommandUpdateAlertConfiguration(), null)
|
||||||
|
@ -625,15 +625,20 @@ class OmnipodDashPumpPlugin @Inject constructor(
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}.toSingleDefault(
|
}.toSingle {
|
||||||
PumpEnactResult(injector).success(true).enacted(true).bolusDelivered(deliveredBolusAmount)
|
PumpEnactResult(injector).success(true).enacted(true).bolusDelivered(deliveredBolusAmount)
|
||||||
|
}.onErrorReturnItem(
|
||||||
|
// success if canceled
|
||||||
|
PumpEnactResult(injector).success(bolusCanceled).enacted(false)
|
||||||
)
|
)
|
||||||
.onErrorReturnItem(
|
|
||||||
// success if canceled
|
|
||||||
PumpEnactResult(injector).success(bolusCanceled).enacted(false)
|
|
||||||
)
|
|
||||||
.blockingGet()
|
.blockingGet()
|
||||||
aapsLogger.info(LTag.PUMP, "deliverTreatment result: $ret")
|
aapsLogger.info(
|
||||||
|
LTag.PUMP,
|
||||||
|
"deliverTreatment result: $ret. " +
|
||||||
|
"deliveredBolusAmount=$deliveredBolusAmount. " +
|
||||||
|
"ret bolus=${ret.bolusDelivered}" +
|
||||||
|
"bolusCanceled=$bolusCanceled"
|
||||||
|
)
|
||||||
return ret
|
return ret
|
||||||
} finally {
|
} finally {
|
||||||
bolusCanceled = false
|
bolusCanceled = false
|
||||||
|
|
|
@ -56,44 +56,44 @@ class DashPodHistoryActivity : NoSplashAppCompatActivity() {
|
||||||
|
|
||||||
private fun groupForCommandType(type: OmnipodCommandType): PumpHistoryEntryGroup {
|
private fun groupForCommandType(type: OmnipodCommandType): PumpHistoryEntryGroup {
|
||||||
return when (type) {
|
return when (type) {
|
||||||
OmnipodCommandType.INITIALIZE_POD ->
|
OmnipodCommandType.INITIALIZE_POD ->
|
||||||
PumpHistoryEntryGroup.Prime
|
PumpHistoryEntryGroup.Prime
|
||||||
OmnipodCommandType.INSERT_CANNULA ->
|
OmnipodCommandType.INSERT_CANNULA ->
|
||||||
PumpHistoryEntryGroup.Prime
|
PumpHistoryEntryGroup.Prime
|
||||||
OmnipodCommandType.DEACTIVATE_POD ->
|
OmnipodCommandType.DEACTIVATE_POD ->
|
||||||
PumpHistoryEntryGroup.Prime
|
PumpHistoryEntryGroup.Prime
|
||||||
OmnipodCommandType.DISCARD_POD ->
|
OmnipodCommandType.DISCARD_POD ->
|
||||||
PumpHistoryEntryGroup.Prime
|
PumpHistoryEntryGroup.Prime
|
||||||
|
|
||||||
OmnipodCommandType.CANCEL_TEMPORARY_BASAL ->
|
OmnipodCommandType.CANCEL_TEMPORARY_BASAL ->
|
||||||
PumpHistoryEntryGroup.Basal
|
PumpHistoryEntryGroup.Basal
|
||||||
OmnipodCommandType.SET_BASAL_PROFILE ->
|
OmnipodCommandType.SET_BASAL_PROFILE ->
|
||||||
PumpHistoryEntryGroup.Basal
|
PumpHistoryEntryGroup.Basal
|
||||||
OmnipodCommandType.SET_TEMPORARY_BASAL ->
|
OmnipodCommandType.SET_TEMPORARY_BASAL ->
|
||||||
PumpHistoryEntryGroup.Basal
|
PumpHistoryEntryGroup.Basal
|
||||||
OmnipodCommandType.RESUME_DELIVERY ->
|
OmnipodCommandType.RESUME_DELIVERY ->
|
||||||
PumpHistoryEntryGroup.Basal
|
PumpHistoryEntryGroup.Basal
|
||||||
OmnipodCommandType.SUSPEND_DELIVERY ->
|
OmnipodCommandType.SUSPEND_DELIVERY ->
|
||||||
PumpHistoryEntryGroup.Basal
|
PumpHistoryEntryGroup.Basal
|
||||||
|
|
||||||
OmnipodCommandType.SET_BOLUS ->
|
OmnipodCommandType.SET_BOLUS ->
|
||||||
PumpHistoryEntryGroup.Bolus
|
PumpHistoryEntryGroup.Bolus
|
||||||
OmnipodCommandType.CANCEL_BOLUS ->
|
OmnipodCommandType.CANCEL_BOLUS ->
|
||||||
PumpHistoryEntryGroup.Bolus
|
PumpHistoryEntryGroup.Bolus
|
||||||
|
|
||||||
OmnipodCommandType.ACKNOWLEDGE_ALERTS ->
|
OmnipodCommandType.ACKNOWLEDGE_ALERTS ->
|
||||||
PumpHistoryEntryGroup.Alarm
|
PumpHistoryEntryGroup.Alarm
|
||||||
OmnipodCommandType.CONFIGURE_ALERTS ->
|
OmnipodCommandType.CONFIGURE_ALERTS ->
|
||||||
PumpHistoryEntryGroup.Alarm
|
PumpHistoryEntryGroup.Alarm
|
||||||
OmnipodCommandType.PLAY_TEST_BEEP ->
|
OmnipodCommandType.PLAY_TEST_BEEP ->
|
||||||
PumpHistoryEntryGroup.Alarm
|
PumpHistoryEntryGroup.Alarm
|
||||||
|
|
||||||
OmnipodCommandType.GET_POD_STATUS ->
|
OmnipodCommandType.GET_POD_STATUS ->
|
||||||
PumpHistoryEntryGroup.Configuration
|
PumpHistoryEntryGroup.Configuration
|
||||||
OmnipodCommandType.SET_TIME ->
|
OmnipodCommandType.SET_TIME ->
|
||||||
PumpHistoryEntryGroup.Configuration
|
PumpHistoryEntryGroup.Configuration
|
||||||
|
|
||||||
OmnipodCommandType.READ_POD_PULSE_LOG ->
|
OmnipodCommandType.READ_POD_PULSE_LOG ->
|
||||||
PumpHistoryEntryGroup.Unknown
|
PumpHistoryEntryGroup.Unknown
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -225,13 +225,13 @@ class DashPodHistoryActivity : NoSplashAppCompatActivity() {
|
||||||
OmnipodCommandType.DISCARD_POD,
|
OmnipodCommandType.DISCARD_POD,
|
||||||
OmnipodCommandType.SUSPEND_DELIVERY,
|
OmnipodCommandType.SUSPEND_DELIVERY,
|
||||||
OmnipodCommandType.RESUME_DELIVERY,
|
OmnipodCommandType.RESUME_DELIVERY,
|
||||||
OmnipodCommandType.SET_BASAL_PROFILE -> {
|
OmnipodCommandType.SET_BASAL_PROFILE -> {
|
||||||
android.graphics.Color.CYAN
|
android.graphics.Color.CYAN
|
||||||
}
|
}
|
||||||
// User action
|
// User action
|
||||||
OmnipodCommandType.PLAY_TEST_BEEP,
|
OmnipodCommandType.PLAY_TEST_BEEP,
|
||||||
OmnipodCommandType.ACKNOWLEDGE_ALERTS,
|
OmnipodCommandType.ACKNOWLEDGE_ALERTS,
|
||||||
OmnipodCommandType.CANCEL_BOLUS -> {
|
OmnipodCommandType.CANCEL_BOLUS -> {
|
||||||
android.graphics.Color.GREEN
|
android.graphics.Color.GREEN
|
||||||
}
|
}
|
||||||
// Insulin treatment
|
// Insulin treatment
|
||||||
|
@ -240,7 +240,7 @@ class DashPodHistoryActivity : NoSplashAppCompatActivity() {
|
||||||
android.graphics.Color.WHITE
|
android.graphics.Color.WHITE
|
||||||
}
|
}
|
||||||
|
|
||||||
else ->
|
else ->
|
||||||
// Other
|
// Other
|
||||||
android.graphics.Color.LTGRAY
|
android.graphics.Color.LTGRAY
|
||||||
}
|
}
|
||||||
|
@ -268,7 +268,7 @@ class DashPodHistoryActivity : NoSplashAppCompatActivity() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
OmnipodCommandType.SET_BOLUS -> {
|
OmnipodCommandType.SET_BOLUS -> {
|
||||||
val bolus = historyEntry.record as BolusRecord
|
val bolus = historyEntry.record as BolusRecord
|
||||||
bolus.let {
|
bolus.let {
|
||||||
rh.gs(R.string.omnipod_common_history_bolus_value, it.amout)
|
rh.gs(R.string.omnipod_common_history_bolus_value, it.amout)
|
||||||
|
@ -278,12 +278,12 @@ class DashPodHistoryActivity : NoSplashAppCompatActivity() {
|
||||||
OmnipodCommandType.SET_BASAL_PROFILE,
|
OmnipodCommandType.SET_BASAL_PROFILE,
|
||||||
OmnipodCommandType.SET_TIME,
|
OmnipodCommandType.SET_TIME,
|
||||||
OmnipodCommandType.INSERT_CANNULA,
|
OmnipodCommandType.INSERT_CANNULA,
|
||||||
OmnipodCommandType.RESUME_DELIVERY -> {
|
OmnipodCommandType.RESUME_DELIVERY -> {
|
||||||
val basal = historyEntry.record as BasalValuesRecord
|
val basal = historyEntry.record as BasalValuesRecord
|
||||||
ProfileUtil.getBasalProfilesDisplayable(basal.segments.toTypedArray(), PumpType.OMNIPOD_DASH)
|
ProfileUtil.getBasalProfilesDisplayable(basal.segments.toTypedArray(), PumpType.OMNIPOD_DASH)
|
||||||
}
|
}
|
||||||
|
|
||||||
else ->
|
else ->
|
||||||
""
|
""
|
||||||
}
|
}
|
||||||
// Set some color
|
// Set some color
|
||||||
|
@ -306,12 +306,12 @@ class DashPodHistoryActivity : NoSplashAppCompatActivity() {
|
||||||
return when {
|
return when {
|
||||||
historyEntry.initialResult == InitialResult.FAILURE_SENDING ->
|
historyEntry.initialResult == InitialResult.FAILURE_SENDING ->
|
||||||
R.string.omnipod_dash_failed_to_send
|
R.string.omnipod_dash_failed_to_send
|
||||||
historyEntry.initialResult == InitialResult.NOT_SENT ->
|
historyEntry.initialResult == InitialResult.NOT_SENT ->
|
||||||
R.string.omnipod_dash_command_not_sent
|
R.string.omnipod_dash_command_not_sent
|
||||||
historyEntry.initialResult == InitialResult.SENT &&
|
historyEntry.initialResult == InitialResult.SENT &&
|
||||||
historyEntry.resolvedResult == ResolvedResult.FAILURE ->
|
historyEntry.resolvedResult == ResolvedResult.FAILURE ->
|
||||||
R.string.omnipod_dash_command_not_received_by_the_pod
|
R.string.omnipod_dash_command_not_received_by_the_pod
|
||||||
else ->
|
else ->
|
||||||
R.string.omnipod_dash_unknown
|
R.string.omnipod_dash_unknown
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue