Merged MilosKozak/dev into dev
Conflicts: app/src/main/res/values/strings.xml
This commit is contained in:
commit
c64d45b758
|
@ -64,6 +64,7 @@ public class DanaRFragment extends Fragment implements FragmentBase {
|
||||||
TextView batteryView;
|
TextView batteryView;
|
||||||
TextView reservoirView;
|
TextView reservoirView;
|
||||||
TextView iobView;
|
TextView iobView;
|
||||||
|
TextView firmwareView;
|
||||||
Button viewProfileButton;
|
Button viewProfileButton;
|
||||||
Button historyButton;
|
Button historyButton;
|
||||||
Button statsButton;
|
Button statsButton;
|
||||||
|
@ -106,6 +107,7 @@ public class DanaRFragment extends Fragment implements FragmentBase {
|
||||||
batteryView = (TextView) view.findViewById(R.id.danar_battery);
|
batteryView = (TextView) view.findViewById(R.id.danar_battery);
|
||||||
reservoirView = (TextView) view.findViewById(R.id.danar_reservoir);
|
reservoirView = (TextView) view.findViewById(R.id.danar_reservoir);
|
||||||
iobView = (TextView) view.findViewById(R.id.danar_iob);
|
iobView = (TextView) view.findViewById(R.id.danar_iob);
|
||||||
|
firmwareView = (TextView) view.findViewById(R.id.danar_firmware);
|
||||||
viewProfileButton = (Button) view.findViewById(R.id.danar_viewprofile);
|
viewProfileButton = (Button) view.findViewById(R.id.danar_viewprofile);
|
||||||
historyButton = (Button) view.findViewById(R.id.danar_history);
|
historyButton = (Button) view.findViewById(R.id.danar_history);
|
||||||
statsButton = (Button) view.findViewById(R.id.danar_stats);
|
statsButton = (Button) view.findViewById(R.id.danar_stats);
|
||||||
|
@ -206,24 +208,24 @@ public class DanaRFragment extends Fragment implements FragmentBase {
|
||||||
@SuppressLint("SetTextI18n")
|
@SuppressLint("SetTextI18n")
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
|
DanaRPump pump = DanaRPlugin.getDanaRPump();
|
||||||
if (DanaRPlugin.getDanaRPump().lastConnection.getTime() != 0) {
|
if (pump.lastConnection.getTime() != 0) {
|
||||||
Long agoMsec = new Date().getTime() - DanaRPlugin.getDanaRPump().lastConnection.getTime();
|
Long agoMsec = new Date().getTime() - pump.lastConnection.getTime();
|
||||||
int agoMin = (int) (agoMsec / 60d / 1000d);
|
int agoMin = (int) (agoMsec / 60d / 1000d);
|
||||||
lastConnectionView.setText(DateUtil.timeString(DanaRPlugin.getDanaRPump().lastConnection) + " (" + String.format(MainApp.sResources.getString(R.string.minago), agoMin) + ")");
|
lastConnectionView.setText(DateUtil.timeString(pump.lastConnection) + " (" + String.format(MainApp.sResources.getString(R.string.minago), agoMin) + ")");
|
||||||
SetWarnColor.setColor(lastConnectionView, agoMin, 16d, 31d);
|
SetWarnColor.setColor(lastConnectionView, agoMin, 16d, 31d);
|
||||||
}
|
}
|
||||||
if (DanaRPlugin.getDanaRPump().lastBolusTime.getTime() != 0) {
|
if (pump.lastBolusTime.getTime() != 0) {
|
||||||
Long agoMsec = new Date().getTime() - DanaRPlugin.getDanaRPump().lastBolusTime.getTime();
|
Long agoMsec = new Date().getTime() - pump.lastBolusTime.getTime();
|
||||||
double agoHours = agoMsec / 60d / 60d / 1000d;
|
double agoHours = agoMsec / 60d / 60d / 1000d;
|
||||||
if (agoHours < 6) // max 6h back
|
if (agoHours < 6) // max 6h back
|
||||||
lastBolusView.setText(DateUtil.timeString(DanaRPlugin.getDanaRPump().lastBolusTime) + " (" + DecimalFormatter.to1Decimal(agoHours) + " " + getString(R.string.hoursago) + ") " + DecimalFormatter.to2Decimal(getPlugin().getDanaRPump().lastBolusAmount) + " U");
|
lastBolusView.setText(DateUtil.timeString(pump.lastBolusTime) + " (" + DecimalFormatter.to1Decimal(agoHours) + " " + getString(R.string.hoursago) + ") " + DecimalFormatter.to2Decimal(getPlugin().getDanaRPump().lastBolusAmount) + " U");
|
||||||
else lastBolusView.setText("");
|
else lastBolusView.setText("");
|
||||||
}
|
}
|
||||||
|
|
||||||
dailyUnitsView.setText(DecimalFormatter.to0Decimal(DanaRPlugin.getDanaRPump().dailyTotalUnits) + " / " + DanaRPlugin.getDanaRPump().maxDailyTotalUnits + " U");
|
dailyUnitsView.setText(DecimalFormatter.to0Decimal(pump.dailyTotalUnits) + " / " + pump.maxDailyTotalUnits + " U");
|
||||||
SetWarnColor.setColor(dailyUnitsView, DanaRPlugin.getDanaRPump().dailyTotalUnits, DanaRPlugin.getDanaRPump().maxDailyTotalUnits * 0.75d, DanaRPlugin.getDanaRPump().maxDailyTotalUnits * 0.9d);
|
SetWarnColor.setColor(dailyUnitsView, pump.dailyTotalUnits, pump.maxDailyTotalUnits * 0.75d, pump.maxDailyTotalUnits * 0.9d);
|
||||||
basaBasalRateView.setText("( " + (DanaRPlugin.getDanaRPump().activeProfile + 1) + " ) " + DecimalFormatter.to2Decimal(getPlugin().getBaseBasalRate()) + " U/h");
|
basaBasalRateView.setText("( " + (pump.activeProfile + 1) + " ) " + DecimalFormatter.to2Decimal(getPlugin().getBaseBasalRate()) + " U/h");
|
||||||
if (getPlugin().isRealTempBasalInProgress()) {
|
if (getPlugin().isRealTempBasalInProgress()) {
|
||||||
tempBasalView.setText(getPlugin().getRealTempBasal().toString());
|
tempBasalView.setText(getPlugin().getRealTempBasal().toString());
|
||||||
} else {
|
} else {
|
||||||
|
@ -234,11 +236,16 @@ public class DanaRFragment extends Fragment implements FragmentBase {
|
||||||
} else {
|
} else {
|
||||||
extendedBolusView.setText("");
|
extendedBolusView.setText("");
|
||||||
}
|
}
|
||||||
reservoirView.setText(DecimalFormatter.to0Decimal(DanaRPlugin.getDanaRPump().reservoirRemainingUnits) + " / 300 U");
|
reservoirView.setText(DecimalFormatter.to0Decimal(pump.reservoirRemainingUnits) + " / 300 U");
|
||||||
SetWarnColor.setColorInverse(reservoirView, DanaRPlugin.getDanaRPump().reservoirRemainingUnits, 50d, 20d);
|
SetWarnColor.setColorInverse(reservoirView, pump.reservoirRemainingUnits, 50d, 20d);
|
||||||
batteryView.setText("{fa-battery-" + (DanaRPlugin.getDanaRPump().batteryRemaining / 25) + "}");
|
batteryView.setText("{fa-battery-" + (pump.batteryRemaining / 25) + "}");
|
||||||
SetWarnColor.setColorInverse(batteryView, DanaRPlugin.getDanaRPump().batteryRemaining, 51d, 26d);
|
SetWarnColor.setColorInverse(batteryView, pump.batteryRemaining, 51d, 26d);
|
||||||
iobView.setText(DanaRPlugin.getDanaRPump().iob + " U");
|
iobView.setText(pump.iob + " U");
|
||||||
|
if (pump.isNewPump) {
|
||||||
|
firmwareView.setText(String.format(getString(R.string.danar_model), pump.model, pump.protocol, pump.productCode));
|
||||||
|
} else {
|
||||||
|
firmwareView.setText("OLD");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -36,7 +36,7 @@ public class DanaRPump {
|
||||||
public String serialNumber = "";
|
public String serialNumber = "";
|
||||||
public Date shippingDate = new Date(0);
|
public Date shippingDate = new Date(0);
|
||||||
public String shippingCountry = "";
|
public String shippingCountry = "";
|
||||||
public boolean isNewPump = false;
|
public boolean isNewPump = true;
|
||||||
public int password = -1;
|
public int password = -1;
|
||||||
public Date pumpTime = new Date(0);
|
public Date pumpTime = new Date(0);
|
||||||
|
|
||||||
|
|
|
@ -176,6 +176,10 @@ public class SerialIOThread extends Thread {
|
||||||
}
|
}
|
||||||
if (!message.received) {
|
if (!message.received) {
|
||||||
log.warn("Reply not received " + message.getMessageName());
|
log.warn("Reply not received " + message.getMessageName());
|
||||||
|
if (message.getCommand() == 0xF0F1) {
|
||||||
|
DanaRPlugin.getDanaRPump().isNewPump = false;
|
||||||
|
log.debug("Old firmware detected");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
scheduleDisconnection();
|
scheduleDisconnection();
|
||||||
}
|
}
|
||||||
|
|
|
@ -226,6 +226,7 @@ public class ExecutionService extends Service {
|
||||||
if (!getPumpStatus()) {
|
if (!getPumpStatus()) {
|
||||||
mSerialIOThread.disconnect("getPumpStatus failed");
|
mSerialIOThread.disconnect("getPumpStatus failed");
|
||||||
waitMsec(3000);
|
waitMsec(3000);
|
||||||
|
getBTSocketForSelectedPump();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -276,18 +277,20 @@ public class ExecutionService extends Service {
|
||||||
MsgStatusBasic statusBasicMsg = new MsgStatusBasic();
|
MsgStatusBasic statusBasicMsg = new MsgStatusBasic();
|
||||||
MsgStatusTempBasal tempStatusMsg = new MsgStatusTempBasal();
|
MsgStatusTempBasal tempStatusMsg = new MsgStatusTempBasal();
|
||||||
MsgStatusBolusExtended exStatusMsg = new MsgStatusBolusExtended();
|
MsgStatusBolusExtended exStatusMsg = new MsgStatusBolusExtended();
|
||||||
|
MsgCheckValue checkValue = new MsgCheckValue();
|
||||||
|
|
||||||
|
if (danaRPump.isNewPump) {
|
||||||
|
mSerialIOThread.sendMessage(checkValue);
|
||||||
|
if (!checkValue.received) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
mSerialIOThread.sendMessage(new MsgSettingShippingInfo()); // TODO: show it somewhere
|
|
||||||
mSerialIOThread.sendMessage(tempStatusMsg); // do this before statusBasic because here is temp duration
|
mSerialIOThread.sendMessage(tempStatusMsg); // do this before statusBasic because here is temp duration
|
||||||
mSerialIOThread.sendMessage(exStatusMsg);
|
mSerialIOThread.sendMessage(exStatusMsg);
|
||||||
mSerialIOThread.sendMessage(statusMsg);
|
mSerialIOThread.sendMessage(statusMsg);
|
||||||
mSerialIOThread.sendMessage(statusBasicMsg);
|
mSerialIOThread.sendMessage(statusBasicMsg);
|
||||||
|
|
||||||
if (danaRPump.isNewPump) {
|
|
||||||
mSerialIOThread.sendMessage(new MsgCheckValue());
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!statusMsg.received) {
|
if (!statusMsg.received) {
|
||||||
mSerialIOThread.sendMessage(statusMsg);
|
mSerialIOThread.sendMessage(statusMsg);
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,6 +24,9 @@ public class MsgCheckValue extends MessageBase {
|
||||||
public void handleMessage(byte[] bytes) {
|
public void handleMessage(byte[] bytes) {
|
||||||
DanaRPump pump = DanaRPlugin.getDanaRPump();
|
DanaRPump pump = DanaRPlugin.getDanaRPump();
|
||||||
|
|
||||||
|
DanaRPlugin.getDanaRPump().isNewPump = true;
|
||||||
|
log.debug("New firmware confirmed");
|
||||||
|
|
||||||
pump.model = intFromBuff(bytes, 0, 1);
|
pump.model = intFromBuff(bytes, 0, 1);
|
||||||
pump.protocol = intFromBuff(bytes, 1, 1);
|
pump.protocol = intFromBuff(bytes, 1, 1);
|
||||||
pump.productCode = intFromBuff(bytes, 2, 1);
|
pump.productCode = intFromBuff(bytes, 2, 1);
|
||||||
|
|
|
@ -24,15 +24,10 @@ public class MsgSettingShippingInfo extends MessageBase {
|
||||||
pump.serialNumber = stringFromBuff(bytes, 0, 10);
|
pump.serialNumber = stringFromBuff(bytes, 0, 10);
|
||||||
pump.shippingDate = dateFromBuff(bytes, 10);
|
pump.shippingDate = dateFromBuff(bytes, 10);
|
||||||
pump.shippingCountry = asciiStringFromBuff(bytes, 13, 3);
|
pump.shippingCountry = asciiStringFromBuff(bytes, 13, 3);
|
||||||
if (pump.shippingDate.getTime() > new Date(116, 4, 1).getTime()) {
|
|
||||||
pump.isNewPump = true;
|
|
||||||
} else
|
|
||||||
pump.isNewPump = false;
|
|
||||||
if (Config.logDanaMessageDetail) {
|
if (Config.logDanaMessageDetail) {
|
||||||
log.debug("Serial number: " + pump.serialNumber);
|
log.debug("Serial number: " + pump.serialNumber);
|
||||||
log.debug("Shipping date: " + pump.shippingDate);
|
log.debug("Shipping date: " + pump.shippingDate);
|
||||||
log.debug("Shipping country: " + pump.shippingCountry);
|
log.debug("Shipping country: " + pump.shippingCountry);
|
||||||
log.debug("Is new pump: " + pump.isNewPump);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -61,6 +61,7 @@ public class DanaRKoreanFragment extends Fragment implements FragmentBase {
|
||||||
TextView batteryView;
|
TextView batteryView;
|
||||||
TextView reservoirView;
|
TextView reservoirView;
|
||||||
TextView iobView;
|
TextView iobView;
|
||||||
|
TextView firmwareView;
|
||||||
Button viewProfileButton;
|
Button viewProfileButton;
|
||||||
Button historyButton;
|
Button historyButton;
|
||||||
Button statsButton;
|
Button statsButton;
|
||||||
|
@ -103,6 +104,7 @@ public class DanaRKoreanFragment extends Fragment implements FragmentBase {
|
||||||
batteryView = (TextView) view.findViewById(R.id.danar_battery);
|
batteryView = (TextView) view.findViewById(R.id.danar_battery);
|
||||||
reservoirView = (TextView) view.findViewById(R.id.danar_reservoir);
|
reservoirView = (TextView) view.findViewById(R.id.danar_reservoir);
|
||||||
iobView = (TextView) view.findViewById(R.id.danar_iob);
|
iobView = (TextView) view.findViewById(R.id.danar_iob);
|
||||||
|
firmwareView = (TextView) view.findViewById(R.id.danar_firmware);
|
||||||
viewProfileButton = (Button) view.findViewById(R.id.danar_viewprofile);
|
viewProfileButton = (Button) view.findViewById(R.id.danar_viewprofile);
|
||||||
historyButton = (Button) view.findViewById(R.id.danar_history);
|
historyButton = (Button) view.findViewById(R.id.danar_history);
|
||||||
statsButton = (Button) view.findViewById(R.id.danar_stats);
|
statsButton = (Button) view.findViewById(R.id.danar_stats);
|
||||||
|
@ -204,24 +206,24 @@ public class DanaRKoreanFragment extends Fragment implements FragmentBase {
|
||||||
@SuppressLint("SetTextI18n")
|
@SuppressLint("SetTextI18n")
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
|
DanaRKoreanPump pump = DanaRKoreanPlugin.getDanaRPump();
|
||||||
if (DanaRKoreanPlugin.getDanaRPump().lastConnection.getTime() != 0) {
|
if (pump.lastConnection.getTime() != 0) {
|
||||||
Long agoMsec = new Date().getTime() - DanaRKoreanPlugin.getDanaRPump().lastConnection.getTime();
|
Long agoMsec = new Date().getTime() - pump.lastConnection.getTime();
|
||||||
int agoMin = (int) (agoMsec / 60d / 1000d);
|
int agoMin = (int) (agoMsec / 60d / 1000d);
|
||||||
lastConnectionView.setText(DateUtil.timeString(DanaRKoreanPlugin.getDanaRPump().lastConnection) + " (" + String.format(MainApp.sResources.getString(R.string.minago), agoMin) + ")");
|
lastConnectionView.setText(DateUtil.timeString(pump.lastConnection) + " (" + String.format(MainApp.sResources.getString(R.string.minago), agoMin) + ")");
|
||||||
SetWarnColor.setColor(lastConnectionView, agoMin, 16d, 31d);
|
SetWarnColor.setColor(lastConnectionView, agoMin, 16d, 31d);
|
||||||
}
|
}
|
||||||
// if (DanaRKoreanPlugin.getDanaRPump().lastBolusTime.getTime() != 0) {
|
// if (pump.lastBolusTime.getTime() != 0) {
|
||||||
// Long agoMsec = new Date().getTime() - DanaRKoreanPlugin.getDanaRPump().lastBolusTime.getTime();
|
// Long agoMsec = new Date().getTime() - pump.lastBolusTime.getTime();
|
||||||
// double agoHours = agoMsec / 60d / 60d / 1000d;
|
// double agoHours = agoMsec / 60d / 60d / 1000d;
|
||||||
// if (agoHours < 6) // max 6h back
|
// if (agoHours < 6) // max 6h back
|
||||||
// lastBolusView.setText(formatTime.format(DanaRKoreanPlugin.getDanaRPump().lastBolusTime) + " (" + DecimalFormatter.to1Decimal(agoHours) + " " + getString(R.string.hoursago) + ") " + DecimalFormatter.to2Decimal(danaRKoreanPlugin.getDanaRPump().lastBolusAmount) + " U");
|
// lastBolusView.setText(formatTime.format(pump.lastBolusTime) + " (" + DecimalFormatter.to1Decimal(agoHours) + " " + getString(R.string.hoursago) + ") " + DecimalFormatter.to2Decimal(pump.lastBolusAmount) + " U");
|
||||||
// else lastBolusView.setText("");
|
// else lastBolusView.setText("");
|
||||||
// }
|
// }
|
||||||
|
|
||||||
dailyUnitsView.setText(DecimalFormatter.to0Decimal(DanaRKoreanPlugin.getDanaRPump().dailyTotalUnits) + " / " + DanaRKoreanPlugin.getDanaRPump().maxDailyTotalUnits + " U");
|
dailyUnitsView.setText(DecimalFormatter.to0Decimal(pump.dailyTotalUnits) + " / " + pump.maxDailyTotalUnits + " U");
|
||||||
SetWarnColor.setColor(dailyUnitsView, DanaRKoreanPlugin.getDanaRPump().dailyTotalUnits, DanaRKoreanPlugin.getDanaRPump().maxDailyTotalUnits * 0.75d, DanaRKoreanPlugin.getDanaRPump().maxDailyTotalUnits * 0.9d);
|
SetWarnColor.setColor(dailyUnitsView, pump.dailyTotalUnits, pump.maxDailyTotalUnits * 0.75d, pump.maxDailyTotalUnits * 0.9d);
|
||||||
basaBasalRateView.setText("( " + (DanaRKoreanPlugin.getDanaRPump().activeProfile + 1) + " ) " + DecimalFormatter.to2Decimal(danaRKoreanPlugin.getBaseBasalRate()) + " U/h");
|
basaBasalRateView.setText("( " + (pump.activeProfile + 1) + " ) " + DecimalFormatter.to2Decimal(danaRKoreanPlugin.getBaseBasalRate()) + " U/h");
|
||||||
if (danaRKoreanPlugin.isRealTempBasalInProgress()) {
|
if (danaRKoreanPlugin.isRealTempBasalInProgress()) {
|
||||||
tempBasalView.setText(danaRKoreanPlugin.getRealTempBasal().toString());
|
tempBasalView.setText(danaRKoreanPlugin.getRealTempBasal().toString());
|
||||||
} else {
|
} else {
|
||||||
|
@ -232,11 +234,16 @@ public class DanaRKoreanFragment extends Fragment implements FragmentBase {
|
||||||
} else {
|
} else {
|
||||||
extendedBolusView.setText("");
|
extendedBolusView.setText("");
|
||||||
}
|
}
|
||||||
reservoirView.setText(DecimalFormatter.to0Decimal(DanaRKoreanPlugin.getDanaRPump().reservoirRemainingUnits) + " / 300 U");
|
reservoirView.setText(DecimalFormatter.to0Decimal(pump.reservoirRemainingUnits) + " / 300 U");
|
||||||
SetWarnColor.setColorInverse(reservoirView, DanaRKoreanPlugin.getDanaRPump().reservoirRemainingUnits, 50d, 20d);
|
SetWarnColor.setColorInverse(reservoirView, pump.reservoirRemainingUnits, 50d, 20d);
|
||||||
batteryView.setText("{fa-battery-" + (DanaRKoreanPlugin.getDanaRPump().batteryRemaining / 25) + "}");
|
batteryView.setText("{fa-battery-" + (pump.batteryRemaining / 25) + "}");
|
||||||
SetWarnColor.setColorInverse(batteryView, DanaRKoreanPlugin.getDanaRPump().batteryRemaining, 51d, 26d);
|
SetWarnColor.setColorInverse(batteryView, pump.batteryRemaining, 51d, 26d);
|
||||||
iobView.setText(DanaRKoreanPlugin.getDanaRPump().iob + " U");
|
iobView.setText(pump.iob + " U");
|
||||||
|
if (pump.isNewPump) {
|
||||||
|
firmwareView.setText(String.format(getString(R.string.danar_model), pump.model, pump.protocol, pump.productCode));
|
||||||
|
} else {
|
||||||
|
firmwareView.setText("OLD");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -36,7 +36,7 @@ public class DanaRKoreanPump {
|
||||||
public String serialNumber = "";
|
public String serialNumber = "";
|
||||||
public Date shippingDate = new Date(0);
|
public Date shippingDate = new Date(0);
|
||||||
public String shippingCountry = "";
|
public String shippingCountry = "";
|
||||||
public boolean isNewPump = false;
|
public boolean isNewPump = true;
|
||||||
public int password = -1;
|
public int password = -1;
|
||||||
public Date pumpTime = new Date(0);
|
public Date pumpTime = new Date(0);
|
||||||
|
|
||||||
|
|
|
@ -176,6 +176,10 @@ public class SerialIOThread extends Thread {
|
||||||
}
|
}
|
||||||
if (!message.received) {
|
if (!message.received) {
|
||||||
log.warn("Reply not received " + message.getMessageName());
|
log.warn("Reply not received " + message.getMessageName());
|
||||||
|
if (message.getCommand() == 0xF0F1) {
|
||||||
|
DanaRKoreanPlugin.getDanaRPump().isNewPump = false;
|
||||||
|
log.debug("Old firmware detected");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
scheduleDisconnection();
|
scheduleDisconnection();
|
||||||
}
|
}
|
||||||
|
|
|
@ -222,6 +222,7 @@ public class ExecutionService extends Service {
|
||||||
if (!getPumpStatus()) {
|
if (!getPumpStatus()) {
|
||||||
mSerialIOThread.disconnect("getPumpStatus failed");
|
mSerialIOThread.disconnect("getPumpStatus failed");
|
||||||
waitMsec(3000);
|
waitMsec(3000);
|
||||||
|
getBTSocketForSelectedPump();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -272,7 +273,14 @@ public class ExecutionService extends Service {
|
||||||
MsgStatusBasic statusBasicMsg = new MsgStatusBasic();
|
MsgStatusBasic statusBasicMsg = new MsgStatusBasic();
|
||||||
MsgStatusTempBasal tempStatusMsg = new MsgStatusTempBasal();
|
MsgStatusTempBasal tempStatusMsg = new MsgStatusTempBasal();
|
||||||
MsgStatusBolusExtended exStatusMsg = new MsgStatusBolusExtended();
|
MsgStatusBolusExtended exStatusMsg = new MsgStatusBolusExtended();
|
||||||
|
MsgCheckValue checkValue = new MsgCheckValue();
|
||||||
|
|
||||||
|
if (danaRKoreanPump.isNewPump) {
|
||||||
|
mSerialIOThread.sendMessage(checkValue);
|
||||||
|
if (!checkValue.received) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
mSerialIOThread.sendMessage(new MsgSettingShippingInfo()); // TODO: show it somewhere
|
mSerialIOThread.sendMessage(new MsgSettingShippingInfo()); // TODO: show it somewhere
|
||||||
mSerialIOThread.sendMessage(tempStatusMsg); // do this before statusBasic because here is temp duration
|
mSerialIOThread.sendMessage(tempStatusMsg); // do this before statusBasic because here is temp duration
|
||||||
|
@ -280,8 +288,6 @@ public class ExecutionService extends Service {
|
||||||
//mSerialIOThread.sendMessage(statusMsg);
|
//mSerialIOThread.sendMessage(statusMsg);
|
||||||
mSerialIOThread.sendMessage(statusBasicMsg);
|
mSerialIOThread.sendMessage(statusBasicMsg);
|
||||||
|
|
||||||
mSerialIOThread.sendMessage(new MsgCheckValue());
|
|
||||||
|
|
||||||
// if (!statusMsg.received) {
|
// if (!statusMsg.received) {
|
||||||
// mSerialIOThread.sendMessage(statusMsg);
|
// mSerialIOThread.sendMessage(statusMsg);
|
||||||
// }
|
// }
|
||||||
|
|
|
@ -25,6 +25,9 @@ public class MsgCheckValue extends MessageBase {
|
||||||
public void handleMessage(byte[] bytes) {
|
public void handleMessage(byte[] bytes) {
|
||||||
DanaRKoreanPump pump = DanaRKoreanPlugin.getDanaRPump();
|
DanaRKoreanPump pump = DanaRKoreanPlugin.getDanaRPump();
|
||||||
|
|
||||||
|
DanaRKoreanPlugin.getDanaRPump().isNewPump = true;
|
||||||
|
log.debug("New firmware confirmed");
|
||||||
|
|
||||||
pump.model = intFromBuff(bytes, 0, 1);
|
pump.model = intFromBuff(bytes, 0, 1);
|
||||||
pump.protocol = intFromBuff(bytes, 1, 1);
|
pump.protocol = intFromBuff(bytes, 1, 1);
|
||||||
pump.productCode = intFromBuff(bytes, 2, 1);
|
pump.productCode = intFromBuff(bytes, 2, 1);
|
||||||
|
|
|
@ -25,10 +25,6 @@ public class MsgSettingShippingInfo extends MessageBase {
|
||||||
pump.serialNumber = stringFromBuff(bytes, 0, 10);
|
pump.serialNumber = stringFromBuff(bytes, 0, 10);
|
||||||
pump.shippingDate = dateFromBuff(bytes, 10);
|
pump.shippingDate = dateFromBuff(bytes, 10);
|
||||||
pump.shippingCountry = asciiStringFromBuff(bytes, 13, 3);
|
pump.shippingCountry = asciiStringFromBuff(bytes, 13, 3);
|
||||||
if (pump.shippingDate.getTime() > new Date(116, 4, 1).getTime()) {
|
|
||||||
pump.isNewPump = true;
|
|
||||||
} else
|
|
||||||
pump.isNewPump = false;
|
|
||||||
if (Config.logDanaMessageDetail) {
|
if (Config.logDanaMessageDetail) {
|
||||||
log.debug("Serial number: " + pump.serialNumber);
|
log.debug("Serial number: " + pump.serialNumber);
|
||||||
log.debug("Shipping date: " + pump.shippingDate);
|
log.debug("Shipping date: " + pump.shippingDate);
|
||||||
|
|
|
@ -102,7 +102,7 @@ public class Autosens {
|
||||||
// avgDelta = avgDelta.toFixed(2);
|
// avgDelta = avgDelta.toFixed(2);
|
||||||
IobTotal iob = IobTotal.calulateFromTreatmentsAndTemps(bgTime);
|
IobTotal iob = IobTotal.calulateFromTreatmentsAndTemps(bgTime);
|
||||||
|
|
||||||
double bgi = Math.round((-iob.activity * sens * 5) * 100) / 100;
|
double bgi = Math.round((-iob.activity * sens * 5) * 100) / 100d;
|
||||||
// bgi = bgi.toFixed(2);
|
// bgi = bgi.toFixed(2);
|
||||||
//console.error(delta);
|
//console.error(delta);
|
||||||
double deviation = delta - bgi;
|
double deviation = delta - bgi;
|
||||||
|
|
|
@ -252,22 +252,49 @@
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:orientation="vertical"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content">
|
|
||||||
|
|
||||||
<Button
|
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:text="@string/danar_viewprofile"
|
android:layout_marginTop="10dp"
|
||||||
android:id="@+id/danar_viewprofile"
|
android:orientation="horizontal">
|
||||||
android:layout_weight="1" />
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginRight="15dp"
|
||||||
|
android:singleLine="true"
|
||||||
|
android:text="@string/virtualpump_firmware_label"
|
||||||
|
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||||
|
android:textColor="@color/colorPumpLabel"
|
||||||
|
android:textStyle="bold" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/danar_firmware"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:gravity="right"
|
||||||
|
android:paddingRight="5dp"
|
||||||
|
android:textAppearance="?android:attr/textAppearanceSmall" />
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:orientation="vertical">
|
||||||
|
|
||||||
<Button
|
<Button
|
||||||
|
android:id="@+id/danar_viewprofile"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:text="@string/danar_viewprofile" />
|
||||||
|
|
||||||
|
<Button
|
||||||
|
android:id="@+id/danar_history"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:text="@string/danar_history"
|
android:text="@string/danar_history"
|
||||||
android:id="@+id/danar_history"
|
|
||||||
android:layout_weight="1" />
|
android:layout_weight="1" />
|
||||||
<Button
|
<Button
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
|
|
|
@ -454,6 +454,8 @@
|
||||||
<string name="always_use_shortavg">Always use short average delta instead of simple delta</string>
|
<string name="always_use_shortavg">Always use short average delta instead of simple delta</string>
|
||||||
<string name="always_use_shortavg_summary">Useful when data from unfiltered sources like xDrip gets noisy.</string>
|
<string name="always_use_shortavg_summary">Useful when data from unfiltered sources like xDrip gets noisy.</string>
|
||||||
<string name="advancedsettings_title">Advanced Settings</string>
|
<string name="advancedsettings_title">Advanced Settings</string>
|
||||||
|
<string name="virtualpump_firmware_label">Firmware:</string>
|
||||||
|
<string formatted="false" name="danar_model">Model: %02X Protocol: %02X Code: %02X</string>
|
||||||
<string name="openapsama_max_daily_safety_multiplier">max_daily_safety_multiplier</string>
|
<string name="openapsama_max_daily_safety_multiplier">max_daily_safety_multiplier</string>
|
||||||
<string name="openapsama_max_daily_safety_multiplier_summary">Default value: 3\nThis is a key OpenAPS safety cap. What this does is limit your basals to be 3x (in this people) your biggest basal rate. You likely will not need to change this, but you should be aware that’s what is discussed about “3x max daily; 4x current” for safety caps.</string>
|
<string name="openapsama_max_daily_safety_multiplier_summary">Default value: 3\nThis is a key OpenAPS safety cap. What this does is limit your basals to be 3x (in this people) your biggest basal rate. You likely will not need to change this, but you should be aware that’s what is discussed about “3x max daily; 4x current” for safety caps.</string>
|
||||||
<string name="openapsama_current_basal_safety_multiplier">current_basal_safety_multiplier</string>
|
<string name="openapsama_current_basal_safety_multiplier">current_basal_safety_multiplier</string>
|
||||||
|
|
Loading…
Reference in a new issue