warn if basal step is not 0.01

This commit is contained in:
Milos Kozak 2017-09-18 13:28:00 +02:00
parent 6cee6c0f51
commit 7f4888978e
9 changed files with 39 additions and 6 deletions

View file

@ -49,6 +49,7 @@ public class Notification {
public static final int NSURGENTALARM = 20;
public static final int SHORT_DIA = 21;
public static final int TOAST_ALARM = 22;
public static final int WRONGBASALSTEP = 23;
public int id;

View file

@ -645,7 +645,11 @@ public class DanaRPlugin implements PluginBase, PumpInterface, DanaRInterface, C
}
public static void doConnect(String from) {
if (sExecutionService != null) sExecutionService.connect(from);
if (sExecutionService != null) {
sExecutionService.connect(from);
pumpDescription.basalStep = pump.basalStep;
pumpDescription.bolusStep = pump.bolusStep;
}
}
public static boolean isConnected() {

View file

@ -40,6 +40,13 @@ public class MsgSettingMeal extends MessageBase {
log.debug("Is Config U/d: " + pump.isConfigUD);
}
if (pump.basalStep != 0.01d) {
Notification notification = new Notification(Notification.WRONGBASALSTEP, MainApp.sResources.getString(R.string.danar_setbasalstep001), Notification.URGENT);
MainApp.bus().post(new EventNewNotification(notification));
} else {
MainApp.bus().post(new EventDismissNotification(Notification.WRONGBASALSTEP));
}
if (pump.isConfigUD) {
Notification notification = new Notification(Notification.UD_MODE_ENABLED, MainApp.sResources.getString(R.string.danar_switchtouhmode), Notification.URGENT);
MainApp.bus().post(new EventNewNotification(notification));

View file

@ -642,7 +642,11 @@ public class DanaRKoreanPlugin implements PluginBase, PumpInterface, DanaRInterf
}
public static void doConnect(String from) {
if (sExecutionService != null) sExecutionService.connect(from);
if (sExecutionService != null) {
sExecutionService.connect(from);
pumpDescription.basalStep = pump.basalStep;
pumpDescription.bolusStep = pump.bolusStep;
}
}
public static boolean isConnected() {

View file

@ -5,6 +5,11 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import info.nightscout.androidaps.Config;
import info.nightscout.androidaps.MainApp;
import info.nightscout.androidaps.R;
import info.nightscout.androidaps.plugins.Overview.Notification;
import info.nightscout.androidaps.plugins.Overview.events.EventDismissNotification;
import info.nightscout.androidaps.plugins.Overview.events.EventNewNotification;
import info.nightscout.androidaps.plugins.PumpDanaR.DanaRPump;
import com.cozmo.danar.util.BleCommandUtil;
@ -46,6 +51,14 @@ public class DanaRS_Packet_Basal_Get_Basal_Rate extends DanaRS_Packet {
for (int index = 0; index < 24; index++)
log.debug("Basal " + String.format("%02d", index) + "h: " + pump.pumpProfiles[pump.activeProfile][index]);
}
if (pump.basalStep != 0.01d) {
Notification notification = new Notification(Notification.WRONGBASALSTEP, MainApp.sResources.getString(R.string.danar_setbasalstep001), Notification.URGENT);
MainApp.bus().post(new EventNewNotification(notification));
} else {
MainApp.bus().post(new EventDismissNotification(Notification.WRONGBASALSTEP));
}
}
@Override

View file

@ -29,7 +29,7 @@ public class DanaRS_Packet_Bolus_Set_Extended_Bolus extends DanaRS_Packet {
@Override
public byte[] getRequestParams() {
int extendedBolusRate = (int) (extendedAmount / 100d);
int extendedBolusRate = (int) (extendedAmount * 100d);
byte[] request = new byte[3];
request[0] = (byte) (extendedBolusRate & 0xff);

View file

@ -144,9 +144,8 @@ public class DanaRSService extends Service {
sendMessage(new DanaRS_Packet_General_Get_Shipping_Information());
sendMessage(new DanaRS_Packet_Basal_Get_Profile_Number());
sendMessage(new DanaRS_Packet_Bolus_Get_Bolus_Option()); // isExtendedEnabled
sendMessage(new DanaRS_Packet_Basal_Get_Basal_Rate()); // basal profile
sendMessage(new DanaRS_Packet_Bolus_Get_Step_Bolus_Information()); // bolusStep, maxBolus
sendMessage(new DanaRS_Packet_Basal_Get_Basal_Rate()); // basalStep, maxBasal
sendMessage(new DanaRS_Packet_Basal_Get_Basal_Rate()); // basal profile, basalStep, maxBasal
sendMessage(new DanaRS_Packet_Bolus_Get_Calculation_Information()); // target
sendMessage(new DanaRS_Packet_Bolus_Get_CIR_CF_Array());
sendMessage(new DanaRS_Packet_Option_Get_Pump_Time());

View file

@ -574,7 +574,11 @@ public class DanaRv2Plugin implements PluginBase, PumpInterface, DanaRInterface,
}
public static void doConnect(String from) {
if (sExecutionService != null) sExecutionService.connect(from);
if (sExecutionService != null) {
sExecutionService.connect(from);
pumpDescription.basalStep = pump.basalStep;
pumpDescription.bolusStep = pump.bolusStep;
}
}
public static boolean isConnected() {

View file

@ -718,5 +718,6 @@
<string name="pairpump">Pair new pump</string>
<string name="bolusspeed">Bolus speed</string>
<string name="key_danars_bolusspeed">danars_bolusspeed</string>
<string name="danar_setbasalstep001">Set basal step to 0.01 U/h</string>
</resources>