DanaRv2 modify 3

This commit is contained in:
Milos Kozak 2017-05-09 15:53:11 +02:00
parent b30d79c4cb
commit ee16fabdfc
4 changed files with 19 additions and 8 deletions

View file

@ -22,6 +22,7 @@ import info.nightscout.androidaps.plugins.Actions.dialogs.NewExtendedBolusDialog
import info.nightscout.androidaps.plugins.Actions.dialogs.NewTempBasalDialog;
import info.nightscout.androidaps.plugins.Careportal.Dialogs.NewNSTreatmentDialog;
import info.nightscout.androidaps.plugins.Careportal.OptionsToShow;
import info.nightscout.androidaps.plugins.PumpDanaRv2.DanaRv2Plugin;
/**
* A simple {@link Fragment} subclass.
@ -152,8 +153,12 @@ public class ActionsFragment extends Fragment implements View.OnClickListener {
fillDialog.show(manager, "FillDialog");
break;
case R.id.actions_50_30:
DanaRv2Plugin danaRv2Plugin = (DanaRv2Plugin) MainApp.getSpecificPlugin(DanaRv2Plugin.class);
danaRv2Plugin.setHighTempBasalPercent(50);
break;
case R.id.actions_400_15:
danaRv2Plugin = (DanaRv2Plugin) MainApp.getSpecificPlugin(DanaRv2Plugin.class);
danaRv2Plugin.setHighTempBasalPercent(400);
break;
}
}

View file

@ -85,6 +85,9 @@ public class MsgHistoryEvents extends MessageBase {
case 13:
log.debug("EVENT PROFILECHANGE (" + recordCode + ") " + DateUtil.dateAndTimeString(datetime) + " No: " + param1 + "U CurrentRate: " + param2 + "U/h");
break;
case 14:
log.debug("EVENT CARBS (" + recordCode + ") " + DateUtil.dateAndTimeString(datetime) + " Carbs: " + param1 + "g");
break;
default:
log.debug("Event: " + recordCode + " " + DateUtil.dateAndTimeString(datetime) + " Param1: " + param1 + " Param2: " + param2);
break;

View file

@ -21,9 +21,16 @@ public class MsgSetAPSTempBasalStart extends MessageBase {
if (percent > 500) percent = 500;
AddParamInt(percent);
if (percent < 100) {
AddParamByte((byte) 0xA0); // 160
if (Config.logDanaMessageDetail)
log.debug("APS Temp basal start percent: " + percent + " duration 30 min");
} else {
AddParamByte((byte) 0x96); // 150
if (Config.logDanaMessageDetail)
log.debug("APS Temp basal start percent: " + percent + " duration 15 min");
}
if (Config.logDanaMessageDetail)
log.debug("APS Temp basal start percent: " + percent + " duration 15 min");
}
public void handleMessage(byte[] bytes) {

View file

@ -16,17 +16,13 @@ public class MsgStatusAPSTempBasal extends MessageBase {
public void handleMessage(byte[] bytes) {
double iob = intFromBuff(bytes, 0, 2) / 100d;
int tempBasalPercent = intFromBuff(bytes, 2, 2);
double deliveredSoFar = intFromBuff(bytes, 2, 2) / 100d;
DanaRPump pump = DanaRPump.getInstance();
pump.isTempBasalInProgress = tempBasalPercent != 100;
pump.tempBasalPercent = tempBasalPercent;
pump.iob = iob;
if (Config.logDanaMessageDetail) {
log.debug("Is APS temp basal running: " + pump.isTempBasalInProgress);
log.debug("Current APS temp basal percent: " + tempBasalPercent);
log.debug("Delivered so far: " + deliveredSoFar);
log.debug("Current pump IOB: " + iob);
}
}