From 9fcb0d2dda6ed46641cdb82ca8f78dc53ed11145 Mon Sep 17 00:00:00 2001 From: Navid Date: Sat, 23 Dec 2023 10:46:46 -0500 Subject: [PATCH] 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