Merge remote-tracking branch 'milosremote/dev' into use-gs

This commit is contained in:
AdrianLxM 2018-05-02 14:11:45 +02:00
commit 4a22fd355d
5 changed files with 14 additions and 10 deletions

View file

@ -17,14 +17,12 @@ public class CobInfo {
}
@NonNull
public static String generateCOBString() {
public String generateCOBString() {
String cobStringResult = "--g";
CobInfo cobInfo = IobCobCalculatorPlugin.getPlugin().getCobInfo(false, "WatcherUpdaterService");
if (cobInfo.displayCob != null) {
cobStringResult = DecimalFormatter.to0Decimal(cobInfo.displayCob);
if (cobInfo.futureCarbs > 0) {
cobStringResult += "(" + DecimalFormatter.to0Decimal(cobInfo.futureCarbs) + ")";
if (displayCob != null) {
cobStringResult = DecimalFormatter.to0Decimal(displayCob);
if (futureCarbs > 0) {
cobStringResult += "(" + DecimalFormatter.to0Decimal(futureCarbs) + ")";
}
cobStringResult += "g";
}

View file

@ -1,6 +1,7 @@
package info.nightscout.androidaps.plugins.IobCobCalculator;
import android.os.SystemClock;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.v4.util.LongSparseArray;
@ -404,6 +405,8 @@ public class IobCobCalculatorPlugin extends PluginBase {
}
}
@NonNull
public CobInfo getCobInfo(boolean _synchronized, String reason) {
AutosensData autosensData = _synchronized ? getLastAutosensDataSynchronized(reason) : getLastAutosensData(reason);
Double displayCob = null;

View file

@ -36,6 +36,7 @@ import info.nightscout.androidaps.interfaces.PluginDescription;
import info.nightscout.androidaps.interfaces.PluginType;
import info.nightscout.androidaps.plugins.ConfigBuilder.ConfigBuilderPlugin;
import info.nightscout.androidaps.plugins.IobCobCalculator.CobInfo;
import info.nightscout.androidaps.plugins.IobCobCalculator.IobCobCalculatorPlugin;
import info.nightscout.androidaps.plugins.Treatments.TreatmentsPlugin;
import info.nightscout.utils.DecimalFormatter;
@ -127,7 +128,7 @@ public class PersistentNotificationPlugin extends PluginBase {
IobTotal basalIob = TreatmentsPlugin.getPlugin().getLastCalculationTempBasals().round();
String line2 = ctx.getString(R.string.treatments_iob_label_string) + " " + DecimalFormatter.to2Decimal(bolusIob.iob + basalIob.basaliob) + "U " + MainApp.gs(R.string.cob)+": " + CobInfo.generateCOBString();
String line2 = ctx.getString(R.string.treatments_iob_label_string) + " " + DecimalFormatter.to2Decimal(bolusIob.iob + basalIob.basaliob) + "U " + MainApp.gs(R.string.cob)+": " + IobCobCalculatorPlugin.getPlugin().getCobInfo(false, "PersistentNotificationPlugin").generateCOBString();;
String line3 = DecimalFormatter.to2Decimal(ConfigBuilderPlugin.getActivePump().getBaseBasalRate()) + " U/h";

View file

@ -38,6 +38,7 @@ import info.nightscout.androidaps.db.BgReading;
import info.nightscout.androidaps.db.DatabaseHelper;
import info.nightscout.androidaps.db.TemporaryBasal;
import info.nightscout.androidaps.plugins.IobCobCalculator.CobInfo;
import info.nightscout.androidaps.plugins.IobCobCalculator.IobCobCalculatorPlugin;
import info.nightscout.androidaps.plugins.Treatments.Treatment;
import info.nightscout.androidaps.interfaces.PluginType;
import info.nightscout.androidaps.interfaces.TreatmentsInterface;
@ -590,7 +591,7 @@ public class WatchUpdaterService extends WearableListenerService implements
iobSum = DecimalFormatter.to2Decimal(bolusIob.iob + basalIob.basaliob);
iobDetail = "(" + DecimalFormatter.to2Decimal(bolusIob.iob) + "|" + DecimalFormatter.to2Decimal(basalIob.basaliob) + ")";
cobString = CobInfo.generateCOBString();
cobString = IobCobCalculatorPlugin.getPlugin().getCobInfo(false, "WatcherUpdaterService").generateCOBString();
currentBasal = generateBasalString(treatmentsInterface);
//bgi

View file

@ -26,6 +26,7 @@ import info.nightscout.androidaps.interfaces.PluginType;
import info.nightscout.androidaps.interfaces.TreatmentsInterface;
import info.nightscout.androidaps.plugins.ConfigBuilder.ConfigBuilderPlugin;
import info.nightscout.androidaps.plugins.IobCobCalculator.CobInfo;
import info.nightscout.androidaps.plugins.IobCobCalculator.IobCobCalculatorPlugin;
import info.nightscout.androidaps.plugins.Loop.LoopPlugin;
import info.nightscout.androidaps.plugins.Treatments.TreatmentsPlugin;
import info.nightscout.utils.DecimalFormatter;
@ -147,7 +148,7 @@ public class StatuslinePlugin extends PluginBase {
double bgi = -(bolusIob.activity + basalIob.activity) * 5 * profile.getIsf();
status += " " + ((bgi >= 0) ? "+" : "") + DecimalFormatter.to2Decimal(bgi);
status += " " + CobInfo.generateCOBString();
status += " " + IobCobCalculatorPlugin.getPlugin().getCobInfo(false, "StatuslinePlugin").generateCOBString();
return status;
}