- fix for getting basal profile (getRawContentOfFrame needed to be rewritten to cut 1 character and then create fixed length of frame at 64 bytes (it seems that in some cases frame can contain crc at end)

This commit is contained in:
Andy Rozman 2019-09-12 12:36:13 +01:00
parent d50d6087ea
commit bdf65ab077

View file

@ -7,7 +7,6 @@ import info.nightscout.androidaps.logging.L;
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.ble.data.RLMessage; import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.ble.data.RLMessage;
import info.nightscout.androidaps.plugins.pump.common.utils.ByteUtil; import info.nightscout.androidaps.plugins.pump.common.utils.ByteUtil;
import info.nightscout.androidaps.plugins.pump.medtronic.defs.MedtronicCommandType; import info.nightscout.androidaps.plugins.pump.medtronic.defs.MedtronicCommandType;
import info.nightscout.androidaps.plugins.pump.medtronic.util.MedtronicUtil;
/** /**
* Created by geoff on 5/29/16. * Created by geoff on 5/29/16.
@ -23,6 +22,8 @@ public class PumpMessage implements RLMessage {
public MessageBody messageBody = new MessageBody(); public MessageBody messageBody = new MessageBody();
public String error = null; public String error = null;
public static final int FRAME_DATA_LENGTH = 64;
public PumpMessage(String error) { public PumpMessage(String error) {
this.error = error; this.error = error;
@ -133,11 +134,7 @@ public class PumpMessage implements RLMessage {
public byte[] getRawContentOfFrame() { public byte[] getRawContentOfFrame() {
byte[] raw = messageBody.getTxData(); byte[] raw = messageBody.getTxData();
return ByteUtil.substring(raw, 1, Math.min(FRAME_DATA_LENGTH, raw.length - 1));
if (MedtronicUtil.getMedtronicPumpModel().isMedtronic_523orHigher())
return ByteUtil.substring(raw, 1, raw.length - 2);
else
return ByteUtil.substring(raw, 1);
} }