From d7252978fbdeb4e28f1dc5ee9807e2f6732a3a2d Mon Sep 17 00:00:00 2001 From: Navid Date: Wed, 13 Dec 2023 22:37:03 -0500 Subject: [PATCH 1/6] G7 battery warning --- .../dexdrip/g5model/Ob1DexTransmitterBattery.java | 5 +++++ .../eveningoutpost/dexdrip/g5model/Ob1G5StateMachine.java | 6 ------ .../eveningoutpost/dexdrip/services/G5BaseService.java | 8 ++++++++ 3 files changed, 13 insertions(+), 6 deletions(-) diff --git a/app/src/main/java/com/eveningoutpost/dexdrip/g5model/Ob1DexTransmitterBattery.java b/app/src/main/java/com/eveningoutpost/dexdrip/g5model/Ob1DexTransmitterBattery.java index 07d2d464b8..ffd1c7c3c5 100644 --- a/app/src/main/java/com/eveningoutpost/dexdrip/g5model/Ob1DexTransmitterBattery.java +++ b/app/src/main/java/com/eveningoutpost/dexdrip/g5model/Ob1DexTransmitterBattery.java @@ -1,6 +1,8 @@ package com.eveningoutpost.dexdrip.g5model; +import static com.eveningoutpost.dexdrip.services.Ob1G5CollectionService.getTransmitterID; + import com.eveningoutpost.dexdrip.models.JoH; import com.eveningoutpost.dexdrip.services.G5BaseService; import com.eveningoutpost.dexdrip.services.Ob1G5CollectionService; @@ -93,6 +95,9 @@ public boolean voltageAWarning() { } public boolean voltageBWarning() { + if (getTransmitterID().length() < 6) { // G7 only TODO Navid Replace with usingG7 after the setting is created. + return voltageB() < (G5BaseService.LOW_BATTERY_WARNING_LEVEL - 25); + } return voltageB() < (G5BaseService.LOW_BATTERY_WARNING_LEVEL - 10); }; diff --git a/app/src/main/java/com/eveningoutpost/dexdrip/g5model/Ob1G5StateMachine.java b/app/src/main/java/com/eveningoutpost/dexdrip/g5model/Ob1G5StateMachine.java index ef13e3cb26..ba949c7788 100644 --- a/app/src/main/java/com/eveningoutpost/dexdrip/g5model/Ob1G5StateMachine.java +++ b/app/src/main/java/com/eveningoutpost/dexdrip/g5model/Ob1G5StateMachine.java @@ -252,12 +252,6 @@ public static boolean doCheckAuth2(final Ob1G5CollectionService parent, final Rx setG6Defaults(); } - if (shortTxId()) { - LOW_BATTERY_WARNING_LEVEL = ALT_LOW_BATTERY_WARNING_DEFAULT; - Pref.setString("g5-battery-warning-level", "" + ALT_LOW_BATTERY_WARNING_DEFAULT); - parent.updateBatteryWarningLevel(); - } - if (parent.android_wear) { speakSlowly = true; UserError.Log.d(TAG, "Setting speak slowly to true"); // WARN should be reactive or on named devices diff --git a/app/src/main/java/com/eveningoutpost/dexdrip/services/G5BaseService.java b/app/src/main/java/com/eveningoutpost/dexdrip/services/G5BaseService.java index dcb78d3a62..2165e39ba0 100644 --- a/app/src/main/java/com/eveningoutpost/dexdrip/services/G5BaseService.java +++ b/app/src/main/java/com/eveningoutpost/dexdrip/services/G5BaseService.java @@ -1,10 +1,13 @@ package com.eveningoutpost.dexdrip.services; +import static com.eveningoutpost.dexdrip.services.Ob1G5CollectionService.getTransmitterID; + import android.app.Service; import android.bluetooth.BluetoothDevice; import android.content.SharedPreferences; import android.os.PowerManager; +import com.eveningoutpost.dexdrip.g5model.FirmwareCapability; import com.eveningoutpost.dexdrip.models.JoH; import com.eveningoutpost.dexdrip.models.UserError; import com.eveningoutpost.dexdrip.utilitymodels.ForegroundServiceStarter; @@ -178,6 +181,11 @@ public static void setG6bareBones() { final int battery_warning_level = Pref.getStringToInt("g5-battery-warning-level", G5_LOW_BATTERY_WARNING_DEFAULT); if (battery_warning_level == G5_LOW_BATTERY_WARNING_DEFAULT) { Pref.setString("g5-battery-warning-level", "" + G6_LOW_BATTERY_WARNING_DEFAULT); + if (getTransmitterID().length() < 6) { // If we are using G7 - TODO Navid change to use setting usingG7 after having been created + if (battery_warning_level == G6_LOW_BATTERY_WARNING_DEFAULT) { + Pref.setString("g5-battery-warning-level", "" + ALT_LOW_BATTERY_WARNING_DEFAULT); + } + } } } From 889655a1842762cee3f10569657e7bf6d2f3cf2b Mon Sep 17 00:00:00 2001 From: Navid Date: Wed, 13 Dec 2023 22:38:41 -0500 Subject: [PATCH 2/6] Cleanup --- .../java/com/eveningoutpost/dexdrip/services/G5BaseService.java | 1 - 1 file changed, 1 deletion(-) diff --git a/app/src/main/java/com/eveningoutpost/dexdrip/services/G5BaseService.java b/app/src/main/java/com/eveningoutpost/dexdrip/services/G5BaseService.java index 2165e39ba0..c6bb2b5d8b 100644 --- a/app/src/main/java/com/eveningoutpost/dexdrip/services/G5BaseService.java +++ b/app/src/main/java/com/eveningoutpost/dexdrip/services/G5BaseService.java @@ -7,7 +7,6 @@ import android.content.SharedPreferences; import android.os.PowerManager; -import com.eveningoutpost.dexdrip.g5model.FirmwareCapability; import com.eveningoutpost.dexdrip.models.JoH; import com.eveningoutpost.dexdrip.models.UserError; import com.eveningoutpost.dexdrip.utilitymodels.ForegroundServiceStarter; From 9fcb0d2dda6ed46641cdb82ca8f78dc53ed11145 Mon Sep 17 00:00:00 2001 From: Navid Date: Sat, 23 Dec 2023 10:46:46 -0500 Subject: [PATCH 3/6] Use public shortTxId - leave G7 warning uneditable --- .../dexdrip/g5model/Ob1DexTransmitterBattery.java | 4 ++-- .../dexdrip/g5model/Ob1G5StateMachine.java | 6 ++++++ .../eveningoutpost/dexdrip/services/G5BaseService.java | 9 +-------- 3 files changed, 9 insertions(+), 10 deletions(-) diff --git a/app/src/main/java/com/eveningoutpost/dexdrip/g5model/Ob1DexTransmitterBattery.java b/app/src/main/java/com/eveningoutpost/dexdrip/g5model/Ob1DexTransmitterBattery.java index ffd1c7c3c5..528a7371b4 100644 --- a/app/src/main/java/com/eveningoutpost/dexdrip/g5model/Ob1DexTransmitterBattery.java +++ b/app/src/main/java/com/eveningoutpost/dexdrip/g5model/Ob1DexTransmitterBattery.java @@ -1,7 +1,7 @@ package com.eveningoutpost.dexdrip.g5model; -import static com.eveningoutpost.dexdrip.services.Ob1G5CollectionService.getTransmitterID; +import static com.eveningoutpost.dexdrip.g5model.Ob1G5StateMachine.shortTxId; import com.eveningoutpost.dexdrip.models.JoH; import com.eveningoutpost.dexdrip.services.G5BaseService; @@ -95,7 +95,7 @@ public boolean voltageAWarning() { } public boolean voltageBWarning() { - if (getTransmitterID().length() < 6) { // G7 only TODO Navid Replace with usingG7 after the setting is created. + if (shortTxId()) { // G7 only return voltageB() < (G5BaseService.LOW_BATTERY_WARNING_LEVEL - 25); } return voltageB() < (G5BaseService.LOW_BATTERY_WARNING_LEVEL - 10); diff --git a/app/src/main/java/com/eveningoutpost/dexdrip/g5model/Ob1G5StateMachine.java b/app/src/main/java/com/eveningoutpost/dexdrip/g5model/Ob1G5StateMachine.java index 4a98995662..918da6e539 100644 --- a/app/src/main/java/com/eveningoutpost/dexdrip/g5model/Ob1G5StateMachine.java +++ b/app/src/main/java/com/eveningoutpost/dexdrip/g5model/Ob1G5StateMachine.java @@ -252,6 +252,12 @@ public static boolean doCheckAuth2(final Ob1G5CollectionService parent, final Rx setG6Defaults(); } + if (shortTxId()) { + LOW_BATTERY_WARNING_LEVEL = ALT_LOW_BATTERY_WARNING_DEFAULT; + Pref.setString("g5-battery-warning-level", "" + ALT_LOW_BATTERY_WARNING_DEFAULT); + parent.updateBatteryWarningLevel(); + } + if (parent.android_wear) { speakSlowly = true; UserError.Log.d(TAG, "Setting speak slowly to true"); // WARN should be reactive or on named devices diff --git a/app/src/main/java/com/eveningoutpost/dexdrip/services/G5BaseService.java b/app/src/main/java/com/eveningoutpost/dexdrip/services/G5BaseService.java index c6bb2b5d8b..e2b0dca66a 100644 --- a/app/src/main/java/com/eveningoutpost/dexdrip/services/G5BaseService.java +++ b/app/src/main/java/com/eveningoutpost/dexdrip/services/G5BaseService.java @@ -1,7 +1,5 @@ package com.eveningoutpost.dexdrip.services; -import static com.eveningoutpost.dexdrip.services.Ob1G5CollectionService.getTransmitterID; - import android.app.Service; import android.bluetooth.BluetoothDevice; import android.content.SharedPreferences; @@ -180,11 +178,6 @@ public static void setG6bareBones() { final int battery_warning_level = Pref.getStringToInt("g5-battery-warning-level", G5_LOW_BATTERY_WARNING_DEFAULT); if (battery_warning_level == G5_LOW_BATTERY_WARNING_DEFAULT) { Pref.setString("g5-battery-warning-level", "" + G6_LOW_BATTERY_WARNING_DEFAULT); - if (getTransmitterID().length() < 6) { // If we are using G7 - TODO Navid change to use setting usingG7 after having been created - if (battery_warning_level == G6_LOW_BATTERY_WARNING_DEFAULT) { - Pref.setString("g5-battery-warning-level", "" + ALT_LOW_BATTERY_WARNING_DEFAULT); - } - } } } @@ -204,4 +197,4 @@ public static String getLastTwoCharacters(final String txid) { if (txid == null) return "NULL"; return txid.length() > 3 ? txid.substring(txid.length() - 2) : "ERR-" + txid; } -} +} \ No newline at end of file From cfbf09c200e70e82668a64b4be376f248100ca16 Mon Sep 17 00:00:00 2001 From: Navid Date: Thu, 4 Jan 2024 18:48:01 -0500 Subject: [PATCH 4/6] Last line --- .../java/com/eveningoutpost/dexdrip/services/G5BaseService.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/src/main/java/com/eveningoutpost/dexdrip/services/G5BaseService.java b/app/src/main/java/com/eveningoutpost/dexdrip/services/G5BaseService.java index e2b0dca66a..dcb78d3a62 100644 --- a/app/src/main/java/com/eveningoutpost/dexdrip/services/G5BaseService.java +++ b/app/src/main/java/com/eveningoutpost/dexdrip/services/G5BaseService.java @@ -197,4 +197,4 @@ public static String getLastTwoCharacters(final String txid) { if (txid == null) return "NULL"; return txid.length() > 3 ? txid.substring(txid.length() - 2) : "ERR-" + txid; } -} \ No newline at end of file +} From 3d0406f4296d2ffc3e9b4db78a6ed2ad8ed99064 Mon Sep 17 00:00:00 2001 From: Navid Date: Sun, 7 Jan 2024 23:24:57 -0500 Subject: [PATCH 5/6] G7 transmitter days --- .../dexdrip/g5model/Ob1DexTransmitterBattery.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/com/eveningoutpost/dexdrip/g5model/Ob1DexTransmitterBattery.java b/app/src/main/java/com/eveningoutpost/dexdrip/g5model/Ob1DexTransmitterBattery.java index 07d2d464b8..3da134c975 100644 --- a/app/src/main/java/com/eveningoutpost/dexdrip/g5model/Ob1DexTransmitterBattery.java +++ b/app/src/main/java/com/eveningoutpost/dexdrip/g5model/Ob1DexTransmitterBattery.java @@ -1,7 +1,12 @@ package com.eveningoutpost.dexdrip.g5model; +import static androidx.constraintlayout.widget.Constraints.TAG; + +import static com.eveningoutpost.dexdrip.g5model.Ob1G5StateMachine.shortTxId; + import com.eveningoutpost.dexdrip.models.JoH; +import com.eveningoutpost.dexdrip.models.UserError; import com.eveningoutpost.dexdrip.services.G5BaseService; import com.eveningoutpost.dexdrip.services.Ob1G5CollectionService; import com.eveningoutpost.dexdrip.utilitymodels.PersistentStore; @@ -61,7 +66,7 @@ public String daysEstimate() { StringBuilder b = new StringBuilder(); - if (battery.runtime > -1) { + if (battery.runtime > -1 && !shortTxId()) { // Excluding G7 b.append(battery.runtime); } From ecfa834a58f839018b1b1acfe64eb55d7cd88c33 Mon Sep 17 00:00:00 2001 From: Navid Date: Sun, 7 Jan 2024 23:30:51 -0500 Subject: [PATCH 6/6] Cleanup --- .../dexdrip/g5model/Ob1DexTransmitterBattery.java | 3 --- 1 file changed, 3 deletions(-) diff --git a/app/src/main/java/com/eveningoutpost/dexdrip/g5model/Ob1DexTransmitterBattery.java b/app/src/main/java/com/eveningoutpost/dexdrip/g5model/Ob1DexTransmitterBattery.java index 3da134c975..54a5e22b28 100644 --- a/app/src/main/java/com/eveningoutpost/dexdrip/g5model/Ob1DexTransmitterBattery.java +++ b/app/src/main/java/com/eveningoutpost/dexdrip/g5model/Ob1DexTransmitterBattery.java @@ -1,12 +1,9 @@ package com.eveningoutpost.dexdrip.g5model; -import static androidx.constraintlayout.widget.Constraints.TAG; - import static com.eveningoutpost.dexdrip.g5model.Ob1G5StateMachine.shortTxId; import com.eveningoutpost.dexdrip.models.JoH; -import com.eveningoutpost.dexdrip.models.UserError; import com.eveningoutpost.dexdrip.services.G5BaseService; import com.eveningoutpost.dexdrip.services.Ob1G5CollectionService; import com.eveningoutpost.dexdrip.utilitymodels.PersistentStore;