This commit is contained in:
Milos Kozak 2021-03-07 22:04:51 +01:00
commit cb29e7a33c
3 changed files with 41 additions and 3 deletions

View file

@ -18,6 +18,9 @@ class ConstraintChecker @Inject constructor(private val activePlugin: ActivePlug
fun isClosedLoopAllowed(): Constraint<Boolean> =
isClosedLoopAllowed(Constraint(true))
fun isLgsAllowed(): Constraint<Boolean> =
isLgsAllowed(Constraint(true))
fun isAutosensModeEnabled(): Constraint<Boolean> =
isAutosensModeEnabled(Constraint(true))
@ -77,6 +80,16 @@ class ConstraintChecker @Inject constructor(private val activePlugin: ActivePlug
return value
}
override fun isLgsAllowed(value: Constraint<Boolean>): Constraint<Boolean> {
val constraintsPlugins = activePlugin.getSpecificPluginsListByInterface(ConstraintsInterface::class.java)
for (p in constraintsPlugins) {
val constraint = p as ConstraintsInterface
if (!p.isEnabled(PluginType.CONSTRAINTS)) continue
constraint.isLgsAllowed(value)
}
return value
}
override fun isAutosensModeEnabled(value: Constraint<Boolean>): Constraint<Boolean> {
val constraintsPlugins = activePlugin.getSpecificPluginsListByInterface(ConstraintsInterface::class.java)
for (p in constraintsPlugins) {

View file

@ -106,7 +106,7 @@ public class MedtronicPumpHistoryDecoder extends MedtronicHistoryDecoder<PumpHis
int els = getUnsignedInt(elements);
for (int k = 0; k < (els - 2); k++) {
if (counter<1022) {
if (counter < 1022) {
listRawData.add(dataClear.get(counter));
counter++;
}
@ -621,8 +621,16 @@ public class MedtronicPumpHistoryDecoder extends MedtronicHistoryDecoder<PumpHis
tbrRate = tbrPreviousRecord;
}
TempBasalPair tbr = new TempBasalPair(tbrRate.getHead()[0], tbrDuration.getHead()[0], (ByteUtil.asUINT8(tbrRate
.getDatetime()[4]) >> 3) == 0);
// TempBasalPair tbr = new TempBasalPair(
// tbrRate.getHead()[0],
// tbrDuration.getHead()[0],
// (ByteUtil.asUINT8(tbrRate.getDatetime()[4]) >> 3) == 0);
TempBasalPair tbr = new TempBasalPair(
tbrRate.getHead()[0],
tbrRate.getBody()[0],
tbrDuration.getHead()[0],
(ByteUtil.asUINT8(tbrRate.getDatetime()[4]) >> 3) == 0);
// System.out.println("TBR: amount=" + tbr.getInsulinRate() + ", duration=" + tbr.getDurationMinutes()
// // + " min. Packed: " + tbr.getValue()

View file

@ -38,6 +38,23 @@ public class TempBasalPair extends info.nightscout.androidaps.plugins.pump.commo
}
/**
* This constructor is for use with PumpHistoryDecoder
*
* @param rateByte0
* @param startTimeByte
* @param isPercent
*/
public TempBasalPair(byte rateByte0, byte rateByte1, int startTimeByte, boolean isPercent) {
if (isPercent) {
this.insulinRate = rateByte0;
} else {
this.insulinRate = ByteUtil.toInt(rateByte1, rateByte0) * 0.025;
}
this.durationMinutes = startTimeByte * 30;
this.isPercent = isPercent;
}
public TempBasalPair(AAPSLogger aapsLogger, byte[] response) {
super();