Merge pull request #1972 from Philoul/New/DashBolusDelivered

Update BOlus dialog with estimated amount of Unit injected
This commit is contained in:
Milos Kozak 2022-08-01 09:15:37 +02:00 committed by GitHub
commit 9849d3758a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 9 additions and 8 deletions

View file

@ -25,6 +25,7 @@ android {
dependencies {
implementation project(':core')
implementation project(':shared')
implementation project(':pump-common')
api "androidx.room:room-ktx:$room_version"
api "androidx.room:room-runtime:$room_version"

View file

@ -590,7 +590,7 @@ public class LocalInsightPlugin extends PumpPluginBase implements Pump, Constrai
EventOverviewBolusProgress.Treatment t = new EventOverviewBolusProgress.Treatment(0, 0, detailedBolusInfo.getBolusType() == DetailedBolusInfo.BolusType.SMB, detailedBolusInfo.getId());
final EventOverviewBolusProgress bolusingEvent = EventOverviewBolusProgress.INSTANCE;
bolusingEvent.setT(t);
bolusingEvent.setStatus(rh.gs(R.string.insight_delivered, 0d, insulin));
bolusingEvent.setStatus(rh.gs(R.string.bolus_delivered, 0d, insulin));
bolusingEvent.setPercent(0);
rxBus.send(bolusingEvent);
int trials = 0;
@ -629,14 +629,14 @@ public class LocalInsightPlugin extends PumpPluginBase implements Pump, Constrai
trials = -1;
int percentBefore = bolusingEvent.getPercent();
bolusingEvent.setPercent((int) (100D / activeBolus.getInitialAmount() * (activeBolus.getInitialAmount() - activeBolus.getRemainingAmount())));
bolusingEvent.setStatus(rh.gs(R.string.insight_delivered, activeBolus.getInitialAmount() - activeBolus.getRemainingAmount(), activeBolus.getInitialAmount()));
bolusingEvent.setStatus(rh.gs(R.string.bolus_delivered, activeBolus.getInitialAmount() - activeBolus.getRemainingAmount(), activeBolus.getInitialAmount()));
if (percentBefore != bolusingEvent.getPercent())
rxBus.send(bolusingEvent);
} else {
synchronized ($bolusLock) {
if (bolusCancelled || trials == -1 || trials++ >= 5) {
if (!bolusCancelled) {
bolusingEvent.setStatus(rh.gs(R.string.insight_delivered, insulin, insulin));
bolusingEvent.setStatus(rh.gs(R.string.bolus_delivered, insulin, insulin));
bolusingEvent.setPercent(100);
rxBus.send(bolusingEvent);
}

View file

@ -28,7 +28,6 @@
<string name="code_compare">Do the codes displayed on this device and on your pump match?</string>
<string name="insight_pairing">Insight pairing</string>
<string name="insight_local">Accu-Chek Insight</string>
<string name="insight_delivered">%1$.2f U / %2$.2f U delivered</string>
<string name="insight_alert_formatter">%1$s: %2$s</string>
<string name="tube_changed">Tube changed</string>
<string name="insightpump_shortname">Sight</string>

View file

@ -46,6 +46,7 @@ import info.nightscout.androidaps.queue.commands.CustomCommand
import info.nightscout.androidaps.utils.DateUtil
import info.nightscout.androidaps.utils.DecimalFormatter.to2Decimal
import info.nightscout.androidaps.utils.FabricPrivacy
import info.nightscout.androidaps.utils.Round
import info.nightscout.androidaps.utils.T
import info.nightscout.androidaps.utils.TimeChangeType
import info.nightscout.androidaps.utils.rx.AapsSchedulers
@ -698,7 +699,7 @@ class OmnipodDashPumpPlugin @Inject constructor(
}
val percent = (waited.toFloat() / estimatedDeliveryTimeSeconds) * 100
updateBolusProgressDialog(
rh.gs(R.string.dash_bolusdelivering, requestedBolusAmount),
rh.gs(R.string.bolus_delivered, Round.roundTo(percent*requestedBolusAmount/100, PodConstants.POD_PULSE_BOLUS_UNITS), requestedBolusAmount),
percent.toInt()
)
}
@ -729,7 +730,7 @@ class OmnipodDashPumpPlugin @Inject constructor(
val remainingUnits = podStateManager.lastBolus!!.bolusUnitsRemaining
val percent = ((requestedBolusAmount - remainingUnits) / requestedBolusAmount) * 100
updateBolusProgressDialog(
rh.gs(R.string.bolusdelivering, requestedBolusAmount),
rh.gs(R.string.bolus_delivered, Round.roundTo(requestedBolusAmount - remainingUnits, PodConstants.POD_PULSE_BOLUS_UNITS), requestedBolusAmount),
percent.toInt()
)

View file

@ -46,7 +46,6 @@
<string name="omnipod_dash_unknown">Unknown state for the command</string>
<string name="omnipod_common_history_tbr_value">Rate: %1$.2f U, duration: %2$d minutes</string>
<string name="omnipod_common_history_bolus_value">%1$.2f U</string>
<string name="dash_bolusdelivering">Delivering %1$.2f U</string>
<string name="omnipod_common_alert_delivery_suspended">Insulin delivery is suspended</string>
<string name="omnipod_dash_connection_lost">Lost connection to pod</string>
<string name="omnipod_dash_bolus_already_in_progress">Another bolus is being delivered</string>

View file

@ -370,7 +370,7 @@ public class AapsOmnipodErosManager {
bolusCommandResult = executeCommand(() -> delegate.bolus(PumpType.OMNIPOD_EROS.determineCorrectBolusSize(detailedBolusInfo.insulin), beepsEnabled, beepsEnabled, detailedBolusInfo.getBolusType() == DetailedBolusInfo.BolusType.SMB ? null :
(estimatedUnitsDelivered, percentage) -> {
EventOverviewBolusProgress progressUpdateEvent = EventOverviewBolusProgress.INSTANCE;
progressUpdateEvent.setStatus(getStringResource(R.string.goingtodeliver, detailedBolusInfo.insulin));
progressUpdateEvent.setStatus(getStringResource(R.string.bolus_delivered, estimatedUnitsDelivered, detailedBolusInfo.insulin));
progressUpdateEvent.setPercent(percentage);
sendEvent(progressUpdateEvent);
}));

View file

@ -7,6 +7,7 @@
<string name="common_resultok">OK</string>
<string name="pump_serial_number">Pump Serial Number</string>
<string name="bolus_delivered">%1$.2f U / %2$.2f U delivered</string>
<!-- PumpCommon - Pump Status -->