diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/DanaR/DanaRPump.java b/app/src/main/java/info/nightscout/androidaps/plugins/DanaR/DanaRPump.java index ea692eb25c..579407e365 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/DanaR/DanaRPump.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/DanaR/DanaRPump.java @@ -139,7 +139,7 @@ public class DanaRPump { } else { time = df.format(h) + ":00"; } - basals.put(new JSONObject().put("time", time).put("timeAsSeconds", h * basalIncrement).put("value", pumpProfiles[activeProfile][h])); + basals.put(new JSONObject().put("time", time).put("timeAsSeconds", h * basalIncrement).put("value", pumpProfiles[activeProfile][h])); } profile.put("basal", basals); @@ -149,6 +149,8 @@ public class DanaRPump { store.put("" + (activeProfile + 1), profile); } catch (JSONException e) { e.printStackTrace(); + } catch (Exception e) { + return null; } return new NSProfile(json, "" + (activeProfile + 1)); } diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/DanaR/Services/ExecutionService.java b/app/src/main/java/info/nightscout/androidaps/plugins/DanaR/Services/ExecutionService.java index cb90f25935..2b78538634 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/DanaR/Services/ExecutionService.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/DanaR/Services/ExecutionService.java @@ -175,7 +175,7 @@ public class ExecutionService extends Service { } public void connect(String from) { - if (danaRPump.isNewPump && danaRPump.password != SafeParse.stringToInt(SP.getString("danar_password", "-1"))) { + if (danaRPump.password != -1 && danaRPump.password != SafeParse.stringToInt(SP.getString("danar_password", "-1"))) { ToastUtils.showToastInUiThread(MainApp.instance().getApplicationContext(), MainApp.sResources.getString(R.string.wrongpumppassword), R.raw.error); return; } diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/DanaR/comm/MsgInitConnStatusOption.java b/app/src/main/java/info/nightscout/androidaps/plugins/DanaR/comm/MsgInitConnStatusOption.java index 1b2ca4bd11..b8049c23ee 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/DanaR/comm/MsgInitConnStatusOption.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/DanaR/comm/MsgInitConnStatusOption.java @@ -29,7 +29,6 @@ public class MsgInitConnStatusOption extends MessageBase { int i = intFromBuff(bytes, 8, 1); if (bytes.length >= 21) { DanaRPlugin.getDanaRPump().password = intFromBuff(bytes, 9, 2) ^ 0x3463; - DanaRPlugin.getDanaRPump().isNewPump = true; if (Config.logDanaMessageDetail) log.debug("Pump password: " + DanaRPlugin.getDanaRPump().password); } diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/DanaR/comm/MsgSettingShippingInfo.java b/app/src/main/java/info/nightscout/androidaps/plugins/DanaR/comm/MsgSettingShippingInfo.java index fbc786af6f..ccecfbbd6c 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/DanaR/comm/MsgSettingShippingInfo.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/DanaR/comm/MsgSettingShippingInfo.java @@ -3,6 +3,8 @@ package info.nightscout.androidaps.plugins.DanaR.comm; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import java.util.Date; + import info.nightscout.androidaps.Config; import info.nightscout.androidaps.plugins.DanaR.DanaRPlugin; @@ -20,6 +22,9 @@ public class MsgSettingShippingInfo extends MessageBase { DanaRPlugin.getDanaRPump().serialNumber = stringFromBuff(bytes, 0, 10); DanaRPlugin.getDanaRPump().shippingDate = dateFromBuff(bytes, 10); DanaRPlugin.getDanaRPump().shippingCountry = asciiStringFromBuff(bytes, 13, 3); + if (DanaRPlugin.getDanaRPump().shippingDate.getTime() > new Date(116, 4, 1).getTime()) { + DanaRPlugin.getDanaRPump().isNewPump = true; + } if (Config.logDanaMessageDetail) { log.debug("Serial number: " + DanaRPlugin.getDanaRPump().serialNumber); log.debug("Shipping date: " + DanaRPlugin.getDanaRPump().shippingDate); diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/Objectives/ObjectivesPlugin.java b/app/src/main/java/info/nightscout/androidaps/plugins/Objectives/ObjectivesPlugin.java index 5d25bed6e9..31014b99e9 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/Objectives/ObjectivesPlugin.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/Objectives/ObjectivesPlugin.java @@ -196,12 +196,20 @@ public class ObjectivesPlugin implements PluginBase, ConstraintsInterface { SharedPreferences settings = PreferenceManager.getDefaultSharedPreferences(MainApp.instance().getApplicationContext()); for (int num = 0; num < objectives.size(); num++) { Objective o = objectives.get(num); - o.started = new Date(settings.getLong("Objectives" + num + "started", 0)); - o.accomplished = new Date(settings.getLong("Objectives" + num + "accomplished", 0)); + try { + o.started = new Date(settings.getLong("Objectives" + num + "started", 0)); + o.accomplished = new Date(settings.getLong("Objectives" + num + "accomplished", 0)); + } catch (Exception e) { + e.printStackTrace(); + } } bgIsAvailableInNS = settings.getBoolean("Objectives" + "bgIsAvailableInNS", false); pumpStatusIsAvailableInNS = settings.getBoolean("Objectives" + "pumpStatusIsAvailableInNS", false); - manualEnacts = settings.getInt("Objectives" + "manualEnacts", 0); + try { + manualEnacts = settings.getInt("Objectives" + "manualEnacts", 0); + } catch (Exception e) { + e.printStackTrace(); + } if (Config.logPrefsChange) log.debug("Objectives loaded"); } diff --git a/app/src/main/res/values-bg/strings.xml b/app/src/main/res/values-bg/strings.xml index e2c4dc4cb7..fd2ba0a138 100644 --- a/app/src/main/res/values-bg/strings.xml +++ b/app/src/main/res/values-bg/strings.xml @@ -277,7 +277,7 @@ Прекъсване Презареждане IOB на помпата - Парола за помпа след 2016г + Парола за помпа пълнене Общо %d записа са изпратени Приложено diff --git a/app/src/main/res/values-cs/strings.xml b/app/src/main/res/values-cs/strings.xml index ee18270954..d551bd3c86 100644 --- a/app/src/main/res/values-cs/strings.xml +++ b/app/src/main/res/values-cs/strings.xml @@ -278,7 +278,7 @@ Pumpa je zaneprázdněna Špatné heslo k pumpě MM 640g - Heslo k pumpě (pouze verze 2016) + Heslo k pumpě Okluze Podáno Stop diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index fa28b5bfb6..84dbc46616 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -279,7 +279,7 @@ Refill Suspend Connecting for %d s - Pump password (2016 pump only) + Pump password Wrong pump password! Pump is busy Delivered @@ -304,6 +304,6 @@ Enabling additional features for daytime use, such as advanced meal assist You reached allowed limit Target value for calculations - No profile seselcted + No profile selected