Merge branch 'dev' of github.com:MilosKozak/AndroidAPS into carbs-required
This commit is contained in:
commit
0dfdf6c68a
8 changed files with 15 additions and 11 deletions
|
@ -814,9 +814,9 @@ public class IobCobCalculatorPlugin extends PluginBase implements IobCobCalculat
|
|||
getAapsLogger().debug(LTag.AUTOSENS, "Starting calculation thread: " + from + " to " + dateUtil.dateAndTimeString(end));
|
||||
if (thread == null || thread.getState() == Thread.State.TERMINATED) {
|
||||
if (sensitivityOref1Plugin.isEnabled())
|
||||
thread = new IobCobOref1Thread(injector, this, from, end, bgDataReload, limitDataToOldestAvailable, cause);
|
||||
thread = new IobCobOref1Thread(injector, this, treatmentsPlugin, from, end, bgDataReload, limitDataToOldestAvailable, cause);
|
||||
else
|
||||
thread = new IobCobThread(injector, this, from, end, bgDataReload, limitDataToOldestAvailable, cause);
|
||||
thread = new IobCobThread(injector, this, treatmentsPlugin, from, end, bgDataReload, limitDataToOldestAvailable, cause);
|
||||
thread.start();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -36,6 +36,7 @@ import info.nightscout.androidaps.plugins.iob.iobCobCalculator.events.EventIobCa
|
|||
import info.nightscout.androidaps.plugins.sensitivity.SensitivityAAPSPlugin;
|
||||
import info.nightscout.androidaps.plugins.sensitivity.SensitivityWeightedAveragePlugin;
|
||||
import info.nightscout.androidaps.db.Treatment;
|
||||
import info.nightscout.androidaps.plugins.treatments.TreatmentsPlugin;
|
||||
import info.nightscout.androidaps.utils.DateUtil;
|
||||
import info.nightscout.androidaps.utils.DecimalFormatter;
|
||||
import info.nightscout.androidaps.utils.FabricPrivacy;
|
||||
|
@ -62,7 +63,6 @@ public class IobCobOref1Thread extends Thread {
|
|||
@Inject ResourceHelper resourceHelper;
|
||||
@Inject ProfileFunction profileFunction;
|
||||
@Inject Context context;
|
||||
@Inject ActivePluginProvider activePluginProvider;
|
||||
@Inject SensitivityAAPSPlugin sensitivityAAPSPlugin;
|
||||
@Inject SensitivityWeightedAveragePlugin sensitivityWeightedAveragePlugin;
|
||||
@Inject BuildHelper buildHelper;
|
||||
|
@ -72,6 +72,7 @@ public class IobCobOref1Thread extends Thread {
|
|||
|
||||
private final HasAndroidInjector injector;
|
||||
private final IobCobCalculatorPlugin iobCobCalculatorPlugin; // cannot be injected : HistoryBrowser uses different instance
|
||||
private final TreatmentsPlugin treatmentsPlugin; // cannot be injected : HistoryBrowser uses different instance
|
||||
private boolean bgDataReload;
|
||||
private boolean limitDataToOldestAvailable;
|
||||
private String from;
|
||||
|
@ -79,11 +80,12 @@ public class IobCobOref1Thread extends Thread {
|
|||
|
||||
private PowerManager.WakeLock mWakeLock;
|
||||
|
||||
IobCobOref1Thread(HasAndroidInjector injector, IobCobCalculatorPlugin iobCobCalculatorPlugin, String from, long end, boolean bgDataReload, boolean limitDataToOldestAvailable, Event cause) {
|
||||
IobCobOref1Thread(HasAndroidInjector injector, IobCobCalculatorPlugin iobCobCalculatorPlugin, TreatmentsPlugin treatmentsPlugin, String from, long end, boolean bgDataReload, boolean limitDataToOldestAvailable, Event cause) {
|
||||
super();
|
||||
injector.androidInjector().inject(this);
|
||||
this.injector = injector;
|
||||
this.iobCobCalculatorPlugin = iobCobCalculatorPlugin;
|
||||
this.treatmentsPlugin = treatmentsPlugin;
|
||||
|
||||
this.bgDataReload = bgDataReload;
|
||||
this.limitDataToOldestAvailable = limitDataToOldestAvailable;
|
||||
|
@ -242,7 +244,7 @@ public class IobCobOref1Thread extends Thread {
|
|||
}
|
||||
}
|
||||
|
||||
List<Treatment> recentCarbTreatments = activePluginProvider.getActiveTreatments().getCarbTreatments5MinBackFromHistory(bgTime);
|
||||
List<Treatment> recentCarbTreatments = treatmentsPlugin.getCarbTreatments5MinBackFromHistory(bgTime);
|
||||
for (Treatment recentCarbTreatment : recentCarbTreatments) {
|
||||
autosensData.carbsFromBolus += recentCarbTreatment.carbs;
|
||||
boolean isAAPSOrWeighted = sensitivityAAPSPlugin.isEnabled() || sensitivityWeightedAveragePlugin.isEnabled();
|
||||
|
@ -365,7 +367,7 @@ public class IobCobOref1Thread extends Thread {
|
|||
// add an extra negative deviation if a high temptarget is running and exercise mode is set
|
||||
// TODO AS-FIX
|
||||
if (false && sp.getBoolean(R.string.key_high_temptarget_raises_sensitivity, SMBDefaults.high_temptarget_raises_sensitivity)) {
|
||||
TempTarget tempTarget = activePluginProvider.getActiveTreatments().getTempTargetFromHistory(bgTime);
|
||||
TempTarget tempTarget = treatmentsPlugin.getTempTargetFromHistory(bgTime);
|
||||
if (tempTarget != null && tempTarget.target() >= 100) {
|
||||
autosensData.extraDeviation.add(-(tempTarget.target() - 100) / 20);
|
||||
}
|
||||
|
|
|
@ -34,6 +34,7 @@ import info.nightscout.androidaps.plugins.iob.iobCobCalculator.events.EventIobCa
|
|||
import info.nightscout.androidaps.plugins.sensitivity.SensitivityAAPSPlugin;
|
||||
import info.nightscout.androidaps.plugins.sensitivity.SensitivityWeightedAveragePlugin;
|
||||
import info.nightscout.androidaps.db.Treatment;
|
||||
import info.nightscout.androidaps.plugins.treatments.TreatmentsPlugin;
|
||||
import info.nightscout.androidaps.utils.DateUtil;
|
||||
import info.nightscout.androidaps.utils.DecimalFormatter;
|
||||
import info.nightscout.androidaps.utils.FabricPrivacy;
|
||||
|
@ -59,7 +60,6 @@ public class IobCobThread extends Thread {
|
|||
@Inject ResourceHelper resourceHelper;
|
||||
@Inject ProfileFunction profileFunction;
|
||||
@Inject Context context;
|
||||
@Inject ActivePluginProvider activePluginProvider;
|
||||
@Inject SensitivityAAPSPlugin sensitivityAAPSPlugin;
|
||||
@Inject SensitivityWeightedAveragePlugin sensitivityWeightedAveragePlugin;
|
||||
@Inject BuildHelper buildHelper;
|
||||
|
@ -69,6 +69,7 @@ public class IobCobThread extends Thread {
|
|||
|
||||
private final HasAndroidInjector injector;
|
||||
private final IobCobCalculatorPlugin iobCobCalculatorPlugin; // cannot be injected : HistoryBrowser uses different instance
|
||||
private final TreatmentsPlugin treatmentsPlugin; // cannot be injected : HistoryBrowser uses different instance
|
||||
private boolean bgDataReload;
|
||||
private boolean limitDataToOldestAvailable;
|
||||
private String from;
|
||||
|
@ -76,11 +77,12 @@ public class IobCobThread extends Thread {
|
|||
|
||||
private PowerManager.WakeLock mWakeLock;
|
||||
|
||||
@Inject IobCobThread(HasAndroidInjector injector, IobCobCalculatorPlugin iobCobCalculatorPlugin, String from, long end, boolean bgDataReload, boolean limitDataToOldestAvailable, Event cause) {
|
||||
@Inject IobCobThread(HasAndroidInjector injector, IobCobCalculatorPlugin iobCobCalculatorPlugin, TreatmentsPlugin treatmentsPlugin, String from, long end, boolean bgDataReload, boolean limitDataToOldestAvailable, Event cause) {
|
||||
super();
|
||||
injector.androidInjector().inject(this);
|
||||
this.injector = injector;
|
||||
this.iobCobCalculatorPlugin = iobCobCalculatorPlugin;
|
||||
this.treatmentsPlugin = treatmentsPlugin;
|
||||
|
||||
this.bgDataReload = bgDataReload;
|
||||
this.limitDataToOldestAvailable = limitDataToOldestAvailable;
|
||||
|
@ -239,7 +241,7 @@ public class IobCobThread extends Thread {
|
|||
}
|
||||
}
|
||||
|
||||
List<Treatment> recentCarbTreatments = activePluginProvider.getActiveTreatments().getCarbTreatments5MinBackFromHistory(bgTime);
|
||||
List<Treatment> recentCarbTreatments = treatmentsPlugin.getCarbTreatments5MinBackFromHistory(bgTime);
|
||||
for (Treatment recentCarbTreatment : recentCarbTreatments) {
|
||||
autosensData.carbsFromBolus += recentCarbTreatment.carbs;
|
||||
boolean isAAPSOrWeighted = sensitivityAAPSPlugin.isEnabled() || sensitivityWeightedAveragePlugin.isEnabled();
|
||||
|
|
|
@ -55,7 +55,7 @@ class RandomBgPlugin @Inject constructor(
|
|||
}
|
||||
|
||||
override fun advancedFilteringSupported(): Boolean {
|
||||
return false
|
||||
return true
|
||||
}
|
||||
|
||||
override fun onStart() {
|
||||
|
@ -69,7 +69,7 @@ class RandomBgPlugin @Inject constructor(
|
|||
}
|
||||
|
||||
override fun specialEnableCondition(): Boolean {
|
||||
return isRunningTest() || virtualPumpPlugin.isEnabled(PluginType.PUMP) && buildHelper.isEngineeringMode()
|
||||
return true //isRunningTest() || virtualPumpPlugin.isEnabled(PluginType.PUMP) && buildHelper.isEngineeringMode()
|
||||
}
|
||||
|
||||
override fun handleNewData(intent: Intent) {
|
||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 1.1 KiB |
Binary file not shown.
Before Width: | Height: | Size: 974 B |
Binary file not shown.
Before Width: | Height: | Size: 1 KiB |
Binary file not shown.
Before Width: | Height: | Size: 2.2 KiB |
Loading…
Reference in a new issue