Merge branch 'dev2_dana_combo_only' of https://github.com/nightscout/AndroidAPS into dev2_dana_combo_only

This commit is contained in:
Milos Kozak 2021-05-03 10:13:20 +02:00
commit 5817d57e84
13 changed files with 22 additions and 22 deletions

View file

@ -400,7 +400,7 @@ open class VirtualPumpPlugin @Inject constructor(
aapsLogger.debug(LTag.PUMP, "Pump in configuration: $pumpType, PumpType object: $pumpTypeNew")
if (this.pumpType == pumpTypeNew) return
aapsLogger.debug(LTag.PUMP, "New pump configuration found ($pumpTypeNew), changing from previous (${this.pumpType})")
pumpDescription.setPumpDescription(pumpTypeNew)
pumpDescription.fillFor(pumpTypeNew)
this.pumpType = pumpTypeNew
}

View file

@ -175,7 +175,7 @@ public class ComboPlugin extends PumpPluginBase implements Pump, Constraints {
this.pumpSync = pumpSync;
this.dateUtil = dateUtil;
pumpDescription.setPumpDescription(PumpType.ACCU_CHEK_COMBO);
pumpDescription.fillFor(PumpType.ACCU_CHEK_COMBO);
}
@Override protected void onStart() {

View file

@ -425,7 +425,7 @@ class TDDStatsActivity : NoSplashAppCompatActivity() {
private fun isOldData(historyList: List<TotalDailyDose>): Boolean {
val type = activePlugin.activePump.pumpDescription.pumpType
val startsYesterday = type == PumpType.DANA_R || type == PumpType.DANA_RS || type == PumpType.DANA_RV2 || type == PumpType.DANA_R_KOREAN || type == PumpType.ACCU_CHEK_INSIGHT
val startsYesterday = type == PumpType.DANA_R || type == PumpType.DANA_RS || type == PumpType.DANA_RV2 || type == PumpType.DANA_R_KOREAN || type == PumpType.ACCU_CHEK_INSIGHT_VIRTUAL
val df: DateFormat = SimpleDateFormat("dd.MM.", Locale.getDefault())
return historyList.size < 3 || df.format(Date(historyList[0].timestamp)) != df.format(Date(System.currentTimeMillis() - if (startsYesterday) 1000 * 60 * 60 * 24 else 0))
}

View file

@ -7,7 +7,7 @@ import info.nightscout.androidaps.plugins.pump.common.defs.PumpType
class PumpDescription() {
constructor(pumpType: PumpType) : this() {
setPumpDescription(pumpType)
fillFor(pumpType)
}
var pumpType = PumpType.GENERIC_AAPS
@ -69,7 +69,7 @@ class PumpDescription() {
hasCustomUnreachableAlertCheck = false
}
fun setPumpDescription(pumpType: PumpType) {
fun fillFor(pumpType: PumpType) {
resetSettings()
this.pumpType = pumpType
val pumpCapability = pumpType.pumpCapability ?: return

View file

@ -82,7 +82,7 @@ class RunningConfiguration @Inject constructor(
if (configuration.has("pump")) {
val pumpType = JsonHelper.safeGetString(configuration, "pump", PumpType.GENERIC_AAPS.description)
sp.putString(R.string.key_virtualpump_type, pumpType)
activePlugin.activePump.pumpDescription.setPumpDescription(PumpType.getByDescription(pumpType))
activePlugin.activePump.pumpDescription.fillFor(PumpType.getByDescription(pumpType))
aapsLogger.debug(LTag.CORE, "Changing pump type to $pumpType")
}

View file

@ -64,7 +64,7 @@ enum class PumpType {
baseBasalStep = 0.1,
baseBasalSpecialSteps = null,
pumpCapability = PumpCapability.VirtualPumpCapabilities),
ACCU_CHEK_INSIGHT(description = "Accu-Chek Insight",
ACCU_CHEK_INSIGHT_VIRTUAL(description = "Accu-Chek Insight",
manufacturer = ManufacturerType.Roche,
model = "Insight",
bolusSize = 0.05,
@ -77,7 +77,7 @@ enum class PumpType {
baseBasalStep = 0.01,
baseBasalSpecialSteps = null,
pumpCapability = PumpCapability.InsightCapabilities),
ACCU_CHEK_INSIGHT_BLUETOOTH(description = "Accu-Chek Insight",
ACCU_CHEK_INSIGHT(description = "Accu-Chek Insight",
manufacturer = ManufacturerType.Roche,
model = "Insight",
bolusSize = 0.01,
@ -89,7 +89,7 @@ enum class PumpType {
baseBasalMinValue = 0.02,
baseBasalMaxValue = null,
baseBasalStep = 0.01,
baseBasalSpecialSteps = DoseStepSize.InsightBolus,
baseBasalSpecialSteps = DoseStepSize.InsightBasal,
pumpCapability = PumpCapability.InsightCapabilities),
ACCU_CHEK_SOLO(description = "Accu-Chek Solo",
manufacturer = ManufacturerType.Roche,
@ -418,9 +418,9 @@ enum class PumpType {
CELLNOVO -> InterfaceIDs.PumpType.CELLNOVO
ACCU_CHEK_COMBO -> InterfaceIDs.PumpType.ACCU_CHEK_COMBO
ACCU_CHEK_SPIRIT -> InterfaceIDs.PumpType.ACCU_CHEK_SPIRIT
ACCU_CHEK_INSIGHT -> InterfaceIDs.PumpType.ACCU_CHEK_INSIGHT
ACCU_CHEK_INSIGHT_BLUETOOTH -> InterfaceIDs.PumpType.ACCU_CHEK_INSIGHT_BLUETOOTH
ACCU_CHEK_SOLO -> InterfaceIDs.PumpType.ACCU_CHEK_SOLO
ACCU_CHEK_INSIGHT_VIRTUAL -> InterfaceIDs.PumpType.ACCU_CHEK_INSIGHT
ACCU_CHEK_INSIGHT -> InterfaceIDs.PumpType.ACCU_CHEK_INSIGHT_BLUETOOTH
ACCU_CHEK_SOLO -> InterfaceIDs.PumpType.ACCU_CHEK_SOLO
ANIMAS_VIBE -> InterfaceIDs.PumpType.ANIMAS_VIBE
ANIMAS_PING -> InterfaceIDs.PumpType.ANIMAS_PING
DANA_R -> InterfaceIDs.PumpType.DANA_R

View file

@ -10,7 +10,7 @@ class PumpDescriptionTest {
@Test fun setPumpDescription() {
val pumpDescription = PumpDescription()
pumpDescription.setPumpDescription(PumpType.ACCU_CHEK_COMBO)
pumpDescription.fillFor(PumpType.ACCU_CHEK_COMBO)
Assert.assertEquals(pumpDescription.bolusStep, PumpType.ACCU_CHEK_COMBO.bolusSize, 0.1)
Assert.assertEquals(pumpDescription.basalMinimumRate, PumpType.ACCU_CHEK_COMBO.baseBasalStep, 0.1)
Assert.assertEquals(pumpDescription.basalStep, PumpType.ACCU_CHEK_COMBO.baseBasalStep, 0.1)

View file

@ -51,7 +51,7 @@ class APSResultTest : TestBaseWithProfile() {
// BASAL RATE IN TEST PROFILE IS 1U/h
// **** PERCENT pump ****
testPumpPlugin.pumpDescription.setPumpDescription(PumpType.CELLNOVO) // % based
testPumpPlugin.pumpDescription.fillFor(PumpType.CELLNOVO) // % based
apsResult.usePercent(true)
// closed loop mode return original request
@ -109,7 +109,7 @@ class APSResultTest : TestBaseWithProfile() {
Assert.assertEquals(true, apsResult.isChangeRequested)
// **** ABSOLUTE pump ****
testPumpPlugin.pumpDescription.setPumpDescription(PumpType.MEDTRONIC_515_715) // U/h based
testPumpPlugin.pumpDescription.fillFor(PumpType.MEDTRONIC_515_715) // U/h based
apsResult.usePercent(false)
// open loop

View file

@ -60,7 +60,7 @@ class DanaRKoreanPlugin @Inject constructor(
init {
pluginDescription.description(R.string.description_pump_dana_r_korean)
useExtendedBoluses = sp.getBoolean(R.string.key_danar_useextended, false)
pumpDescription.setPumpDescription(PumpType.DANA_R_KOREAN)
pumpDescription.fillFor(PumpType.DANA_R_KOREAN)
}
override fun onStart() {

View file

@ -85,7 +85,7 @@ public class DanaRv2Plugin extends AbstractDanaRPlugin {
getPluginDescription().description(R.string.description_pump_dana_r_v2);
useExtendedBoluses = false;
pumpDescription.setPumpDescription(PumpType.DANA_RV2);
pumpDescription.fillFor(PumpType.DANA_RV2);
}
@Override

View file

@ -74,7 +74,7 @@ public class DanaRPlugin extends AbstractDanaRPlugin {
this.fabricPrivacy = fabricPrivacy;
useExtendedBoluses = sp.getBoolean(R.string.key_danar_useextended, false);
pumpDescription.setPumpDescription(PumpType.DANA_R);
pumpDescription.fillFor(PumpType.DANA_R);
}
@Override

View file

@ -241,7 +241,7 @@ public class LocalInsightPlugin extends PumpPluginBase implements Pump, Constrai
this.pumpSync = pumpSync;
pumpDescription = new PumpDescription();
pumpDescription.setPumpDescription(PumpType.ACCU_CHEK_INSIGHT_BLUETOOTH);
pumpDescription.fillFor(PumpType.ACCU_CHEK_INSIGHT);
}
public TBROverNotificationBlock getTBROverNotificationBlock() {
@ -1026,7 +1026,7 @@ public class LocalInsightPlugin extends PumpPluginBase implements Pump, Constrai
@NonNull @Override
public PumpType model() {
return PumpType.ACCU_CHEK_INSIGHT_BLUETOOTH;
return PumpType.ACCU_CHEK_INSIGHT;
}
@NonNull @Override

View file

@ -99,7 +99,7 @@ public abstract class PumpPluginAbstract extends PumpPluginBase implements Pump,
this.sp = sp;
this.commandQueue = commandQueue;
pumpDescription.setPumpDescription(pumpType);
pumpDescription.fillFor(pumpType);
this.pumpType = pumpType;
this.dateUtil = dateUtil;
this.aapsSchedulers = aapsSchedulers;
@ -457,7 +457,7 @@ public abstract class PumpPluginAbstract extends PumpPluginBase implements Pump,
public void setPumpType(PumpType pumpType) {
this.pumpType = pumpType;
this.pumpDescription.setPumpDescription(pumpType);
this.pumpDescription.fillFor(pumpType);
}