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 b0e497a376..36c9a5cae8 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
@@ -119,6 +119,7 @@ public class OmnipodPumpPlugin extends PumpPluginBase implements PumpInterface,
private static final long STATUS_CHECK_INTERVAL_MILLIS = 60 * 1000L; // 1 minute
public static final int STARTUP_STATUS_REQUEST_TRIES = 2;
public static final double RESERVOIR_OVER_50_UNITS_DEFAULT = 75.0;
+ private static final int DEFAULT_BATTERY_LEVEL = 75;
private final PodStateManager podStateManager;
private final RileyLinkServiceData rileyLinkServiceData;
@@ -311,7 +312,8 @@ public class OmnipodPumpPlugin extends PumpPluginBase implements PumpInterface,
event.isChanged(getResourceHelper(), OmnipodStorageKeys.Preferences.SMB_BEEPS_ENABLED) ||
event.isChanged(getResourceHelper(), OmnipodStorageKeys.Preferences.SUSPEND_DELIVERY_BUTTON_ENABLED) ||
event.isChanged(getResourceHelper(), OmnipodStorageKeys.Preferences.PULSE_LOG_BUTTON_ENABLED) ||
- event.isChanged(getResourceHelper(), OmnipodStorageKeys.Preferences.RILEYLINK_STATS_BUTTON_ENABLED) ||
+ event.isChanged(getResourceHelper(), OmnipodStorageKeys.Preferences.RILEY_LINK_STATS_BUTTON_ENABLED) ||
+ event.isChanged(getResourceHelper(), OmnipodStorageKeys.Preferences.USE_RILEY_LINK_BATTERY_LEVEL) ||
event.isChanged(getResourceHelper(), OmnipodStorageKeys.Preferences.TIME_CHANGE_EVENT_ENABLED) ||
event.isChanged(getResourceHelper(), OmnipodStorageKeys.Preferences.NOTIFICATION_UNCERTAIN_TBR_SOUND_ENABLED) ||
event.isChanged(getResourceHelper(), OmnipodStorageKeys.Preferences.NOTIFICATION_UNCERTAIN_SMB_SOUND_ENABLED) ||
@@ -611,7 +613,11 @@ public class OmnipodPumpPlugin extends PumpPluginBase implements PumpInterface,
@Override
public int getBatteryLevel() {
- return rileyLinkServiceData.batteryLevel == null ? 0 : rileyLinkServiceData.batteryLevel;
+ if (aapsOmnipodManager.isUseRileyLinkBatteryLevel()) {
+ return rileyLinkServiceData.batteryLevel == null ? 0 : rileyLinkServiceData.batteryLevel;
+ }
+
+ return DEFAULT_BATTERY_LEVEL;
}
@NonNull @Override
diff --git a/omnipod/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/definition/OmnipodStorageKeys.java b/omnipod/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/definition/OmnipodStorageKeys.java
index 07601bb9bd..8327f300bc 100644
--- a/omnipod/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/definition/OmnipodStorageKeys.java
+++ b/omnipod/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/definition/OmnipodStorageKeys.java
@@ -21,7 +21,8 @@ public class OmnipodStorageKeys {
public static final int NOTIFICATION_UNCERTAIN_SMB_SOUND_ENABLED = R.string.key_omnipod_notification_uncertain_smb_sound_enabled;
public static final int NOTIFICATION_UNCERTAIN_BOLUS_SOUND_ENABLED = R.string.key_omnipod_notification_uncertain_bolus_sound_enabled;
public static final int AUTOMATICALLY_ACKNOWLEDGE_ALERTS_ENABLED = R.string.key_omnipod_automatically_acknowledge_alerts_enabled;
- public static final int RILEYLINK_STATS_BUTTON_ENABLED = R.string.key_omnipod_rileylink_stats_button_enabled;
+ public static final int RILEY_LINK_STATS_BUTTON_ENABLED = R.string.key_omnipod_riley_link_stats_button_enabled;
+ public static final int USE_RILEY_LINK_BATTERY_LEVEL = R.string.key_omnipod_use_riley_link_battery_level;
}
public static class Statistics {
diff --git a/omnipod/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/manager/AapsOmnipodManager.java b/omnipod/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/manager/AapsOmnipodManager.java
index 9e8cac415b..f2f24fd5e7 100644
--- a/omnipod/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/manager/AapsOmnipodManager.java
+++ b/omnipod/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/manager/AapsOmnipodManager.java
@@ -120,8 +120,8 @@ public class AapsOmnipodManager {
private boolean notificationUncertainSmbSoundEnabled;
private boolean notificationUncertainBolusSoundEnabled;
private boolean automaticallyAcknowledgeAlertsEnabled;
- private boolean testBeepButtonEnabled;
private boolean rileylinkStatsButtonEnabled;
+ private boolean useRileyLinkBatteryLevel;
@Inject
public AapsOmnipodManager(OmnipodRileyLinkCommunicationManager communicationService,
@@ -165,7 +165,8 @@ public class AapsOmnipodManager {
tbrBeepsEnabled = sp.getBoolean(OmnipodStorageKeys.Preferences.TBR_BEEPS_ENABLED, false);
suspendDeliveryButtonEnabled = sp.getBoolean(OmnipodStorageKeys.Preferences.SUSPEND_DELIVERY_BUTTON_ENABLED, false);
pulseLogButtonEnabled = sp.getBoolean(OmnipodStorageKeys.Preferences.PULSE_LOG_BUTTON_ENABLED, false);
- rileylinkStatsButtonEnabled = sp.getBoolean(OmnipodStorageKeys.Preferences.RILEYLINK_STATS_BUTTON_ENABLED, false);
+ rileylinkStatsButtonEnabled = sp.getBoolean(OmnipodStorageKeys.Preferences.RILEY_LINK_STATS_BUTTON_ENABLED, false);
+ useRileyLinkBatteryLevel = sp.getBoolean(OmnipodStorageKeys.Preferences.USE_RILEY_LINK_BATTERY_LEVEL, false);
timeChangeEventEnabled = sp.getBoolean(OmnipodStorageKeys.Preferences.TIME_CHANGE_EVENT_ENABLED, true);
notificationUncertainTbrSoundEnabled = sp.getBoolean(OmnipodStorageKeys.Preferences.NOTIFICATION_UNCERTAIN_TBR_SOUND_ENABLED, false);
notificationUncertainSmbSoundEnabled = sp.getBoolean(OmnipodStorageKeys.Preferences.NOTIFICATION_UNCERTAIN_SMB_SOUND_ENABLED, true);
@@ -655,14 +656,14 @@ public class AapsOmnipodManager {
return pulseLogButtonEnabled;
}
- public boolean isTestBeepButtonEnabled() {
- return testBeepButtonEnabled;
- }
-
public boolean isRileylinkStatsButtonEnabled() {
return rileylinkStatsButtonEnabled;
}
+ public boolean isUseRileyLinkBatteryLevel() {
+ return useRileyLinkBatteryLevel;
+ }
+
public boolean isTimeChangeEventEnabled() {
return timeChangeEventEnabled;
}
diff --git a/omnipod/src/main/res/values/strings.xml b/omnipod/src/main/res/values/strings.xml
index a4a970c23d..aa39003f05 100644
--- a/omnipod/src/main/res/values/strings.xml
+++ b/omnipod/src/main/res/values/strings.xml
@@ -10,7 +10,8 @@
AAPS.Omnipod.tbr_beeps_enabled
AAPS.Omnipod.suspend_delivery_button_enabled
AAPS.Omnipod.pulse_log_button_enabled
- AAPS.Omnipod.rileylink_stats_button_enabled
+ AAPS.Omnipod.rileylink_stats_button_enabled
+ AAPS.Omnipod.use_riley_link_battery_level
AAPS.Omnipod.time_change_enabled
AAPS.Omnipod.expiration_reminder_enabled
AAPS.Omnipod.expiration_reminder_hours_before_shutdown
@@ -43,6 +44,8 @@
Show Suspend Delivery button in Omnipod tab
Show Pulse Log button in Pod Management menu
Show RileyLink Stats button in Pod Management menu
+ Use battery level reported by RileyLink (experimental)
+ Only tested with EmaLink. The reported battery level may be inaccurate with other devices.\nWhen disabled, the battery level show a fixed value of 75.
DST/Time zone detection enabled
Expiration reminder enabled
Hours before shutdown
diff --git a/omnipod/src/main/res/xml/pref_omnipod.xml b/omnipod/src/main/res/xml/pref_omnipod.xml
index d0135d82a1..79a772e94a 100644
--- a/omnipod/src/main/res/xml/pref_omnipod.xml
+++ b/omnipod/src/main/res/xml/pref_omnipod.xml
@@ -112,9 +112,15 @@
+
+