Disable reading reservoir level units.

This commit is contained in:
Johannes Mockenhaupt 2018-01-10 15:04:38 +01:00
parent 9ece407f32
commit b4998feee1
No known key found for this signature in database
GPG key ID: 9E1EA6AF7BBBB0D1
5 changed files with 11 additions and 20 deletions

View file

@ -172,17 +172,17 @@ public class ComboFragment extends SubscriberFragment implements View.OnClickLis
}
// reservoir
int reservoirLevel = plugin.getPump().reservoirLevel;
reservoirView.setText(reservoirLevel == -1 ? "" : "" + reservoirLevel + " "
+ MainApp.sResources.getString(R.string.treatments_wizard_unit_label));
if (ps.insulinState == PumpState.LOW) {
reservoirView.setTextColor(Color.YELLOW);
reservoirView.setText(R.string.combo_reservoir_low);
reservoirView.setTypeface(null, Typeface.BOLD);
} else if (ps.insulinState == PumpState.EMPTY) {
reservoirView.setTextColor(Color.RED);
reservoirView.setText(R.string.combo_reservoir_empty);
reservoirView.setTypeface(null, Typeface.BOLD);
} else {
reservoirView.setTextColor(Color.WHITE);
reservoirView.setText(R.string.combo_reservoir_normal);
reservoirView.setTypeface(null, Typeface.NORMAL);
}

View file

@ -339,7 +339,7 @@ public class ComboPlugin implements PluginBase, PumpInterface, ConstraintsInterf
if (!pump.initialized) {
initializePump();
} else {
runCommand(MainApp.sResources.getString(R.string.combo_pump_action_refreshing), 1, ruffyScripter::readReservoirLevelAndLastBolus);
runCommand(MainApp.sResources.getString(R.string.combo_pump_action_refreshing), 1, ruffyScripter::readPumpState);
}
}
@ -379,13 +379,10 @@ public class ComboPlugin implements PluginBase, PumpInterface, ConstraintsInterf
MainApp.bus().post(new EventInitializationChanged());
// ComboFragment updates state fully only after the pump has initialized, so run this manually here
updateLocalData(runCommand(null, 1, ruffyScripter::readReservoirLevelAndLastBolus));
updateLocalData(readBasalResult);
}
private void updateLocalData(CommandResult result) {
if (result.reservoirLevel != PumpState.UNKNOWN) {
pump.reservoirLevel = result.reservoirLevel;
}
if (result.state.menu != null) {
pump.state = result.state;
}
@ -470,18 +467,13 @@ public class ComboPlugin implements PluginBase, PumpInterface, ConstraintsInterf
}
lastRequestedBolus = new Bolus(System.currentTimeMillis(), detailedBolusInfo.insulin, true);
CommandResult stateResult = runCommand(null, 1, ruffyScripter::readReservoirLevelAndLastBolus);
CommandResult stateResult = runCommand(null, 1, ruffyScripter::readPumpState);
long pumpTimeWhenBolusWasRequested = stateResult .state.pumpTime;
if (!stateResult.success || pumpTimeWhenBolusWasRequested == 0) {
return new PumpEnactResult().success(false).enacted(false)
.comment(MainApp.sResources.getString(R.string.combo_error_no_bolus_delivered));
}
if (stateResult.reservoirLevel < detailedBolusInfo.insulin) {
return new PumpEnactResult().success(false).enacted(false)
.comment(MainApp.sResources.getString(R.string.combo_reservoir_level_insufficient_for_bolus));
}
try {
pump.activity = MainApp.sResources.getString(R.string.combo_pump_action_bolusing, detailedBolusInfo.insulin);
MainApp.bus().post(new EventComboPumpUpdateGUI());
@ -1034,9 +1026,11 @@ public class ComboPlugin implements PluginBase, PumpInterface, ConstraintsInterf
try {
JSONObject pumpJson = new JSONObject();
pumpJson.put("clock", DateUtil.toISOString(pump.lastSuccessfulCmdTime));
if (pump.reservoirLevel != -1) {
pumpJson.put("reservoir", pump.reservoirLevel);
}
int level = 150;
if (pump.state.insulinState == PumpState.LOW) level = 8;
else if (pump.state.insulinState == PumpState.EMPTY) level = 0;
pumpJson.put("reservoir", level);
JSONObject statusJson = new JSONObject();
statusJson.put("status", getStateSummary());

View file

@ -17,7 +17,6 @@ class ComboPump {
public volatile String activity;
@NonNull
volatile PumpState state = new PumpState();
volatile int reservoirLevel = -1;
@NonNull
volatile BasalProfile basalProfile = new BasalProfile();

View file

@ -778,5 +778,4 @@
<string name="openapsama_bolussnooze_dia_divisor_summary">Standarwert: 2\nBolus snooze (\"Bolus-Schlummer\") bremst den Loop nach einem Mahleiten-Bolus, damit dieser nicht mit niedrigen TBR reagiert, wenn Du gerade gegessen hast. Beispiel: Der Standardwert 2 bewirkt, dass bei einem 3 Stunden DIA der Bolus snooze während 1.5 Stunden nach dem Bolus linear ausläuft (3 h Dia / 2 = 1.5 h Bolus snooze).</string>
<string name="openapsama_min_5m_carbimpact_summary">Standardwert: 3.0\nDies ist eine Einstellung für die Standard-Kohlenhydrat-Absorptionswirkung pro 5 Minuten. Der Standardwert ist 3mg/dl/5min. Dies wirkt sich darauf aus, wie schnell der COB-Wert fällt und wieviel KH-Absorption bei der Berechnung des vorhergesagten BZ angenommen wird, wenn der BZ stärker als erwartet fällt oder nicht so stark wie erwartet steigt.</string>
<string name="openapsama_link_to_preferncejson_doc_txt">Achtung! Normalerweise musst Du diese Werte nicht ändern. Bitte KLICKE HIER und LESE den Text. Verändere Werte erst, wenn Du den Inhalt des Textes verstanden hast.</string>
<string name="combo_reservoir_level_insufficient_for_bolus">Nicht mehr genug Insulin im Reservoir für den Bolus</string>
</resources>

View file

@ -865,6 +865,5 @@
<string name="combo_error_partial_bolus_delivered">Only %.2f U of the requested bolus of %.2f U was delivered due to an error. Please check the pump to verify this and take appropriate actions.</string>
<string name="combo_error_bolus_verification_failed">Delivering the bolus and verifying the pump\'s history failed, please check the pump and manually create a bolus record using the Careportal tab if a bolus was delivered.</string>
<string name="combo_error_bolus_recovery_progress">Recovering from connection loss</string>
<string name="combo_reservoir_level_insufficient_for_bolus">Not enough insulin left in reservoir for bolus</string>
</resources>