From bf4bcef8f79a5e158671798b0c6dcdd34548fdcf Mon Sep 17 00:00:00 2001 From: Bart Sopers Date: Sat, 19 Dec 2020 02:36:46 +0100 Subject: [PATCH] Don't upload Omnipod bogus battery level to NS and only upload reservoir level when <= 50 units --- .../plugins/pump/omnipod/OmnipodPumpPlugin.java | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/omnipod/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/OmnipodPumpPlugin.java b/omnipod/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/OmnipodPumpPlugin.java index ddfa94ebfc..166dc5da7f 100644 --- a/omnipod/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/OmnipodPumpPlugin.java +++ b/omnipod/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/OmnipodPumpPlugin.java @@ -738,10 +738,20 @@ public class OmnipodPumpPlugin extends PumpPluginBase implements PumpInterface, status.put("timestamp", DateUtil.toISOString(new Date())); - pump.put("battery", battery); + // BS: Leave battery level out for now as we only have a fixed bogus value + // TODO use RL battery level + //pump.put("battery", battery); + pump.put("status", status); pump.put("extended", extended); - pump.put("reservoir", getReservoirLevel()); + + // If the reservoir level is over 50 units, we don't know the actual value, + // so only include the reservoir level if it's under 50 units + double reservoirLevel = getReservoirLevel(); + if (reservoirLevel <= OmnipodConstants.MAX_RESERVOIR_READING) { + pump.put("reservoir", reservoirLevel); + } + pump.put("clock", DateUtil.toISOString(new Date())); } catch (JSONException e) { aapsLogger.error(LTag.PUMP, "Unhandled exception", e);