From 063ead4c17d7b05147334aac449ba98dc41fe65b Mon Sep 17 00:00:00 2001 From: Milos Kozak Date: Wed, 29 Aug 2018 20:14:36 +0200 Subject: [PATCH] RS text bolus error codes --- .../plugins/PumpDanaRS/DanaRSPlugin.java | 21 ++++++++++++++++--- app/src/main/res/values/strings.xml | 6 +++++- 2 files changed, 23 insertions(+), 4 deletions(-) diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/PumpDanaRS/DanaRSPlugin.java b/app/src/main/java/info/nightscout/androidaps/plugins/PumpDanaRS/DanaRSPlugin.java index d671a3f784..41f662f6b2 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/PumpDanaRS/DanaRSPlugin.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/PumpDanaRS/DanaRSPlugin.java @@ -408,9 +408,24 @@ public class DanaRSPlugin extends PluginBase implements PumpInterface, DanaRInte result.success = connectionOK && Math.abs(detailedBolusInfo.insulin - t.insulin) < pumpDescription.bolusStep; result.bolusDelivered = t.insulin; result.carbsDelivered = detailedBolusInfo.carbs; - if (!result.success) - result.comment = String.format(MainApp.gs(R.string.boluserrorcode), detailedBolusInfo.insulin, t.insulin, DanaRS_Packet_Bolus_Set_Step_Bolus_Start.errorCode); - else + if (!result.success) { + String error = "" + DanaRS_Packet_Bolus_Set_Step_Bolus_Start.errorCode; + switch (DanaRS_Packet_Bolus_Set_Step_Bolus_Start.errorCode) { + case 0x10: + error = MainApp.gs(R.string.maxbolusviolation); + break; + case 0x20: + error = MainApp.gs(R.string.commanderror); + break; + case 0x40: + error = MainApp.gs(R.string.speederror); + break; + case 0x80: + error = MainApp.gs(R.string.insulinlimitviolation); + break; + } + result.comment = String.format(MainApp.gs(R.string.boluserrorcode), detailedBolusInfo.insulin, t.insulin, error); + } else result.comment = MainApp.gs(R.string.virtualpump_resultok); if (L.isEnabled(L.PUMP)) log.debug("deliverTreatment: OK. Asked: " + detailedBolusInfo.insulin + " Delivered: " + result.bolusDelivered); diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index a4d30c78fa..c2a3800653 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -1058,7 +1058,7 @@ Select your language language openapsama_min_5m_carbimpact - Asked: %1$.2fU Delivered: %2$.2fU Error code: %3$d + Asked: %1$.2fU Delivered: %2$.2fU Error code: %3$s First insulin increment Second insulin increment Third insulin increment @@ -1195,6 +1195,10 @@ Calc Handshaking Send today\'s log files to developers along with this time. Unexpected situation. + Max bolus violation + Command error + Speed error + Insulin limit violation %1$d day