Merge pull request #497 from jotomo/dev2-cd+insight
Insight fixes and refactorings
This commit is contained in:
commit
e17f96ac5c
|
@ -400,7 +400,7 @@ open class VirtualPumpPlugin @Inject constructor(
|
||||||
aapsLogger.debug(LTag.PUMP, "Pump in configuration: $pumpType, PumpType object: $pumpTypeNew")
|
aapsLogger.debug(LTag.PUMP, "Pump in configuration: $pumpType, PumpType object: $pumpTypeNew")
|
||||||
if (this.pumpType == pumpTypeNew) return
|
if (this.pumpType == pumpTypeNew) return
|
||||||
aapsLogger.debug(LTag.PUMP, "New pump configuration found ($pumpTypeNew), changing from previous (${this.pumpType})")
|
aapsLogger.debug(LTag.PUMP, "New pump configuration found ($pumpTypeNew), changing from previous (${this.pumpType})")
|
||||||
pumpDescription.setPumpDescription(pumpTypeNew)
|
pumpDescription.fillFor(pumpTypeNew)
|
||||||
this.pumpType = pumpTypeNew
|
this.pumpType = pumpTypeNew
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -175,7 +175,7 @@ public class ComboPlugin extends PumpPluginBase implements Pump, Constraints {
|
||||||
this.pumpSync = pumpSync;
|
this.pumpSync = pumpSync;
|
||||||
this.dateUtil = dateUtil;
|
this.dateUtil = dateUtil;
|
||||||
|
|
||||||
pumpDescription.setPumpDescription(PumpType.ACCU_CHEK_COMBO);
|
pumpDescription.fillFor(PumpType.ACCU_CHEK_COMBO);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override protected void onStart() {
|
@Override protected void onStart() {
|
||||||
|
|
|
@ -425,7 +425,7 @@ class TDDStatsActivity : NoSplashAppCompatActivity() {
|
||||||
|
|
||||||
private fun isOldData(historyList: List<TotalDailyDose>): Boolean {
|
private fun isOldData(historyList: List<TotalDailyDose>): Boolean {
|
||||||
val type = activePlugin.activePump.pumpDescription.pumpType
|
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())
|
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))
|
return historyList.size < 3 || df.format(Date(historyList[0].timestamp)) != df.format(Date(System.currentTimeMillis() - if (startsYesterday) 1000 * 60 * 60 * 24 else 0))
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,7 +7,7 @@ import info.nightscout.androidaps.plugins.pump.common.defs.PumpType
|
||||||
class PumpDescription() {
|
class PumpDescription() {
|
||||||
|
|
||||||
constructor(pumpType: PumpType) : this() {
|
constructor(pumpType: PumpType) : this() {
|
||||||
setPumpDescription(pumpType)
|
fillFor(pumpType)
|
||||||
}
|
}
|
||||||
|
|
||||||
var pumpType = PumpType.GENERIC_AAPS
|
var pumpType = PumpType.GENERIC_AAPS
|
||||||
|
@ -69,7 +69,7 @@ class PumpDescription() {
|
||||||
hasCustomUnreachableAlertCheck = false
|
hasCustomUnreachableAlertCheck = false
|
||||||
}
|
}
|
||||||
|
|
||||||
fun setPumpDescription(pumpType: PumpType) {
|
fun fillFor(pumpType: PumpType) {
|
||||||
resetSettings()
|
resetSettings()
|
||||||
this.pumpType = pumpType
|
this.pumpType = pumpType
|
||||||
val pumpCapability = pumpType.pumpCapability ?: return
|
val pumpCapability = pumpType.pumpCapability ?: return
|
||||||
|
|
|
@ -82,7 +82,7 @@ class RunningConfiguration @Inject constructor(
|
||||||
if (configuration.has("pump")) {
|
if (configuration.has("pump")) {
|
||||||
val pumpType = JsonHelper.safeGetString(configuration, "pump", PumpType.GENERIC_AAPS.description)
|
val pumpType = JsonHelper.safeGetString(configuration, "pump", PumpType.GENERIC_AAPS.description)
|
||||||
sp.putString(R.string.key_virtualpump_type, pumpType)
|
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")
|
aapsLogger.debug(LTag.CORE, "Changing pump type to $pumpType")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -64,7 +64,7 @@ enum class PumpType {
|
||||||
baseBasalStep = 0.1,
|
baseBasalStep = 0.1,
|
||||||
baseBasalSpecialSteps = null,
|
baseBasalSpecialSteps = null,
|
||||||
pumpCapability = PumpCapability.VirtualPumpCapabilities),
|
pumpCapability = PumpCapability.VirtualPumpCapabilities),
|
||||||
ACCU_CHEK_INSIGHT(description = "Accu-Chek Insight",
|
ACCU_CHEK_INSIGHT_VIRTUAL(description = "Accu-Chek Insight",
|
||||||
manufacturer = ManufacturerType.Roche,
|
manufacturer = ManufacturerType.Roche,
|
||||||
model = "Insight",
|
model = "Insight",
|
||||||
bolusSize = 0.05,
|
bolusSize = 0.05,
|
||||||
|
@ -77,7 +77,7 @@ enum class PumpType {
|
||||||
baseBasalStep = 0.01,
|
baseBasalStep = 0.01,
|
||||||
baseBasalSpecialSteps = null,
|
baseBasalSpecialSteps = null,
|
||||||
pumpCapability = PumpCapability.InsightCapabilities),
|
pumpCapability = PumpCapability.InsightCapabilities),
|
||||||
ACCU_CHEK_INSIGHT_BLUETOOTH(description = "Accu-Chek Insight",
|
ACCU_CHEK_INSIGHT(description = "Accu-Chek Insight",
|
||||||
manufacturer = ManufacturerType.Roche,
|
manufacturer = ManufacturerType.Roche,
|
||||||
model = "Insight",
|
model = "Insight",
|
||||||
bolusSize = 0.01,
|
bolusSize = 0.01,
|
||||||
|
@ -89,7 +89,7 @@ enum class PumpType {
|
||||||
baseBasalMinValue = 0.02,
|
baseBasalMinValue = 0.02,
|
||||||
baseBasalMaxValue = null,
|
baseBasalMaxValue = null,
|
||||||
baseBasalStep = 0.01,
|
baseBasalStep = 0.01,
|
||||||
baseBasalSpecialSteps = DoseStepSize.InsightBolus,
|
baseBasalSpecialSteps = DoseStepSize.InsightBasal,
|
||||||
pumpCapability = PumpCapability.InsightCapabilities),
|
pumpCapability = PumpCapability.InsightCapabilities),
|
||||||
ACCU_CHEK_SOLO(description = "Accu-Chek Solo",
|
ACCU_CHEK_SOLO(description = "Accu-Chek Solo",
|
||||||
manufacturer = ManufacturerType.Roche,
|
manufacturer = ManufacturerType.Roche,
|
||||||
|
@ -418,9 +418,9 @@ enum class PumpType {
|
||||||
CELLNOVO -> InterfaceIDs.PumpType.CELLNOVO
|
CELLNOVO -> InterfaceIDs.PumpType.CELLNOVO
|
||||||
ACCU_CHEK_COMBO -> InterfaceIDs.PumpType.ACCU_CHEK_COMBO
|
ACCU_CHEK_COMBO -> InterfaceIDs.PumpType.ACCU_CHEK_COMBO
|
||||||
ACCU_CHEK_SPIRIT -> InterfaceIDs.PumpType.ACCU_CHEK_SPIRIT
|
ACCU_CHEK_SPIRIT -> InterfaceIDs.PumpType.ACCU_CHEK_SPIRIT
|
||||||
ACCU_CHEK_INSIGHT -> InterfaceIDs.PumpType.ACCU_CHEK_INSIGHT
|
ACCU_CHEK_INSIGHT_VIRTUAL -> InterfaceIDs.PumpType.ACCU_CHEK_INSIGHT
|
||||||
ACCU_CHEK_INSIGHT_BLUETOOTH -> InterfaceIDs.PumpType.ACCU_CHEK_INSIGHT_BLUETOOTH
|
ACCU_CHEK_INSIGHT -> InterfaceIDs.PumpType.ACCU_CHEK_INSIGHT_BLUETOOTH
|
||||||
ACCU_CHEK_SOLO -> InterfaceIDs.PumpType.ACCU_CHEK_SOLO
|
ACCU_CHEK_SOLO -> InterfaceIDs.PumpType.ACCU_CHEK_SOLO
|
||||||
ANIMAS_VIBE -> InterfaceIDs.PumpType.ANIMAS_VIBE
|
ANIMAS_VIBE -> InterfaceIDs.PumpType.ANIMAS_VIBE
|
||||||
ANIMAS_PING -> InterfaceIDs.PumpType.ANIMAS_PING
|
ANIMAS_PING -> InterfaceIDs.PumpType.ANIMAS_PING
|
||||||
DANA_R -> InterfaceIDs.PumpType.DANA_R
|
DANA_R -> InterfaceIDs.PumpType.DANA_R
|
||||||
|
|
|
@ -10,7 +10,7 @@ class PumpDescriptionTest {
|
||||||
|
|
||||||
@Test fun setPumpDescription() {
|
@Test fun setPumpDescription() {
|
||||||
val pumpDescription = PumpDescription()
|
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.bolusStep, PumpType.ACCU_CHEK_COMBO.bolusSize, 0.1)
|
||||||
Assert.assertEquals(pumpDescription.basalMinimumRate, PumpType.ACCU_CHEK_COMBO.baseBasalStep, 0.1)
|
Assert.assertEquals(pumpDescription.basalMinimumRate, PumpType.ACCU_CHEK_COMBO.baseBasalStep, 0.1)
|
||||||
Assert.assertEquals(pumpDescription.basalStep, PumpType.ACCU_CHEK_COMBO.baseBasalStep, 0.1)
|
Assert.assertEquals(pumpDescription.basalStep, PumpType.ACCU_CHEK_COMBO.baseBasalStep, 0.1)
|
||||||
|
|
|
@ -51,7 +51,7 @@ class APSResultTest : TestBaseWithProfile() {
|
||||||
// BASAL RATE IN TEST PROFILE IS 1U/h
|
// BASAL RATE IN TEST PROFILE IS 1U/h
|
||||||
|
|
||||||
// **** PERCENT pump ****
|
// **** PERCENT pump ****
|
||||||
testPumpPlugin.pumpDescription.setPumpDescription(PumpType.CELLNOVO) // % based
|
testPumpPlugin.pumpDescription.fillFor(PumpType.CELLNOVO) // % based
|
||||||
apsResult.usePercent(true)
|
apsResult.usePercent(true)
|
||||||
|
|
||||||
// closed loop mode return original request
|
// closed loop mode return original request
|
||||||
|
@ -109,7 +109,7 @@ class APSResultTest : TestBaseWithProfile() {
|
||||||
Assert.assertEquals(true, apsResult.isChangeRequested)
|
Assert.assertEquals(true, apsResult.isChangeRequested)
|
||||||
|
|
||||||
// **** ABSOLUTE pump ****
|
// **** 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)
|
apsResult.usePercent(false)
|
||||||
|
|
||||||
// open loop
|
// open loop
|
||||||
|
|
|
@ -60,7 +60,7 @@ class DanaRKoreanPlugin @Inject constructor(
|
||||||
init {
|
init {
|
||||||
pluginDescription.description(R.string.description_pump_dana_r_korean)
|
pluginDescription.description(R.string.description_pump_dana_r_korean)
|
||||||
useExtendedBoluses = sp.getBoolean(R.string.key_danar_useextended, false)
|
useExtendedBoluses = sp.getBoolean(R.string.key_danar_useextended, false)
|
||||||
pumpDescription.setPumpDescription(PumpType.DANA_R_KOREAN)
|
pumpDescription.fillFor(PumpType.DANA_R_KOREAN)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onStart() {
|
override fun onStart() {
|
||||||
|
|
|
@ -85,7 +85,7 @@ public class DanaRv2Plugin extends AbstractDanaRPlugin {
|
||||||
getPluginDescription().description(R.string.description_pump_dana_r_v2);
|
getPluginDescription().description(R.string.description_pump_dana_r_v2);
|
||||||
|
|
||||||
useExtendedBoluses = false;
|
useExtendedBoluses = false;
|
||||||
pumpDescription.setPumpDescription(PumpType.DANA_RV2);
|
pumpDescription.fillFor(PumpType.DANA_RV2);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -74,7 +74,7 @@ public class DanaRPlugin extends AbstractDanaRPlugin {
|
||||||
this.fabricPrivacy = fabricPrivacy;
|
this.fabricPrivacy = fabricPrivacy;
|
||||||
|
|
||||||
useExtendedBoluses = sp.getBoolean(R.string.key_danar_useextended, false);
|
useExtendedBoluses = sp.getBoolean(R.string.key_danar_useextended, false);
|
||||||
pumpDescription.setPumpDescription(PumpType.DANA_R);
|
pumpDescription.fillFor(PumpType.DANA_R);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -241,7 +241,7 @@ public class LocalInsightPlugin extends PumpPluginBase implements Pump, Constrai
|
||||||
this.pumpSync = pumpSync;
|
this.pumpSync = pumpSync;
|
||||||
|
|
||||||
pumpDescription = new PumpDescription();
|
pumpDescription = new PumpDescription();
|
||||||
pumpDescription.setPumpDescription(PumpType.ACCU_CHEK_INSIGHT_BLUETOOTH);
|
pumpDescription.fillFor(PumpType.ACCU_CHEK_INSIGHT);
|
||||||
}
|
}
|
||||||
|
|
||||||
public TBROverNotificationBlock getTBROverNotificationBlock() {
|
public TBROverNotificationBlock getTBROverNotificationBlock() {
|
||||||
|
@ -1026,7 +1026,7 @@ public class LocalInsightPlugin extends PumpPluginBase implements Pump, Constrai
|
||||||
|
|
||||||
@NonNull @Override
|
@NonNull @Override
|
||||||
public PumpType model() {
|
public PumpType model() {
|
||||||
return PumpType.ACCU_CHEK_INSIGHT_BLUETOOTH;
|
return PumpType.ACCU_CHEK_INSIGHT;
|
||||||
}
|
}
|
||||||
|
|
||||||
@NonNull @Override
|
@NonNull @Override
|
||||||
|
|
|
@ -99,7 +99,7 @@ public abstract class PumpPluginAbstract extends PumpPluginBase implements Pump,
|
||||||
this.sp = sp;
|
this.sp = sp;
|
||||||
this.commandQueue = commandQueue;
|
this.commandQueue = commandQueue;
|
||||||
|
|
||||||
pumpDescription.setPumpDescription(pumpType);
|
pumpDescription.fillFor(pumpType);
|
||||||
this.pumpType = pumpType;
|
this.pumpType = pumpType;
|
||||||
this.dateUtil = dateUtil;
|
this.dateUtil = dateUtil;
|
||||||
this.aapsSchedulers = aapsSchedulers;
|
this.aapsSchedulers = aapsSchedulers;
|
||||||
|
@ -457,7 +457,7 @@ public abstract class PumpPluginAbstract extends PumpPluginBase implements Pump,
|
||||||
|
|
||||||
public void setPumpType(PumpType pumpType) {
|
public void setPumpType(PumpType pumpType) {
|
||||||
this.pumpType = pumpType;
|
this.pumpType = pumpType;
|
||||||
this.pumpDescription.setPumpDescription(pumpType);
|
this.pumpDescription.fillFor(pumpType);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue