This commit is contained in:
Johannes Mockenhaupt 2017-11-18 18:33:46 +01:00
parent 9459dfe321
commit 2c0975994d
No known key found for this signature in database
GPG key ID: 9E1EA6AF7BBBB0D1
3 changed files with 18 additions and 6 deletions

View file

@ -56,6 +56,11 @@ Testing:
v2 v2
Limitations Limitations
- Extended bolus and multiwave bolus are not supported. - Extended bolus and multiwave bolus are not supported.
- If multiple boluses are given within a single minute, only one might be recognized.
This is due to the Combo saving history records with minute-precision only.
However, this case is only possible for very small boluses and is unlikely to occur
in non-testing scenarios (e.g. bolusing from the pump and then immediately bolusing
from AAPS).
// TODO when to check for pump-boluses? before a bolus, sure, but also every 15m when running another command (or through keepalive?) // TODO when to check for pump-boluses? before a bolus, sure, but also every 15m when running another command (or through keepalive?)

View file

@ -165,9 +165,11 @@ public class PreferencesActivity extends PreferenceActivity implements SharedPre
} }
} }
/* No usable settings yet
if (Config.COMBO) { if (Config.COMBO) {
addPreferencesFromResourceIfEnabled(ComboPlugin.getPlugin(), PluginBase.PUMP); addPreferencesFromResourceIfEnabled(ComboPlugin.getPlugin(), PluginBase.PUMP);
} }
*/
addPreferencesFromResourceIfEnabled(VirtualPumpPlugin.getPlugin(), PluginBase.PUMP); addPreferencesFromResourceIfEnabled(VirtualPumpPlugin.getPlugin(), PluginBase.PUMP);

View file

@ -214,18 +214,20 @@ public class ComboPlugin implements PluginBase, PumpInterface, ConstraintsInterf
@Override @Override
public int setNewBasalProfile(Profile profile) { public int setNewBasalProfile(Profile profile) {
BasalProfile basalProfile = convertProfileToComboProfile(profile); return PumpInterface.FAILED;
/* BasalProfile basalProfile = convertProfileToComboProfile(profile);
if (pump.basalProfile.equals(basalProfile)) { if (pump.basalProfile.equals(basalProfile)) {
return PumpInterface.NOT_NEEDED; return PumpInterface.NOT_NEEDED;
} }
CommandResult commandResult = runCommand(MainApp.sResources.getString(R.string.combo_activity_setting_basal_profile), 2, CommandResult commandResult = runCommand(MainApp.sResources.getString(R.string.combo_activity_setting_basal_profile), 2,
() -> ruffyScripter.setBasalProfile(basalProfile)); () -> ruffyScripter.setBasalProfile(basalProfile));
return commandResult.success ? PumpInterface.SUCCESS : PumpInterface.FAILED; return commandResult.success ? PumpInterface.SUCCESS : PumpInterface.FAILED;*/
} }
@Override @Override
public boolean isThisProfileSet(Profile profile) { public boolean isThisProfileSet(Profile profile) {
return pump.basalProfile.equals(convertProfileToComboProfile(profile)); return true;
// return pump.basalProfile.equals(convertProfileToComboProfile(profile));
} }
@NonNull @NonNull
@ -412,6 +414,8 @@ public class ComboPlugin implements PluginBase, PumpInterface, ConstraintsInterf
} }
lastRequestedBolus = new Bolus(System.currentTimeMillis(), detailedBolusInfo.insulin, true); lastRequestedBolus = new Bolus(System.currentTimeMillis(), detailedBolusInfo.insulin, true);
Bolus lastKnownBolus = pump.lastBolus;
try { try {
pump.activity = MainApp.sResources.getString(R.string.combo_pump_action_bolusing); pump.activity = MainApp.sResources.getString(R.string.combo_pump_action_bolusing);
MainApp.bus().post(new EventComboPumpUpdateGUI()); MainApp.bus().post(new EventComboPumpUpdateGUI());
@ -430,7 +434,7 @@ public class ComboPlugin implements PluginBase, PumpInterface, ConstraintsInterf
} }
// verify we're update to date and know the most recent bolus // verify we're update to date and know the most recent bolus
if (!Objects.equals(pump.lastBolus, reservoirBolusResult.lastBolus)) { if (!Objects.equals(lastKnownBolus, reservoirBolusResult.lastBolus)) {
new Thread(this::checkPumpHistory).start(); new Thread(this::checkPumpHistory).start();
return new PumpEnactResult().success(false).enacted(false) return new PumpEnactResult().success(false).enacted(false)
.comment(MainApp.sResources.getString(R.string.combo_pump_bolus_history_state_mismatch)); .comment(MainApp.sResources.getString(R.string.combo_pump_bolus_history_state_mismatch));
@ -628,6 +632,7 @@ public class ComboPlugin implements PluginBase, PumpInterface, ConstraintsInterf
*/ */
private synchronized CommandResult runCommand(String activity, int retries, CommandExecution commandExecution) { private synchronized CommandResult runCommand(String activity, int retries, CommandExecution commandExecution) {
pump.lastCmdTime = System.currentTimeMillis(); pump.lastCmdTime = System.currentTimeMillis();
CommandResult commandResult; CommandResult commandResult;
try { try {
if (activity != null) { if (activity != null) {
@ -656,13 +661,13 @@ public class ComboPlugin implements PluginBase, PumpInterface, ConstraintsInterf
} }
if (commandResult.success) { if (commandResult.success) {
updateLocalData(commandResult); pump.lastSuccessfulCmdTime = pump.lastCmdTime;
} }
pump.lastCmdResult = commandResult; pump.lastCmdResult = commandResult;
if (commandResult.success) { if (commandResult.success) {
pump.lastSuccessfulCmdTime = pump.lastCmdTime; updateLocalData(commandResult);
} }
} finally { } finally {
if (activity != null) { if (activity != null) {