Skip to content

Commit

Permalink
Use public shortTxId - leave G7 warning uneditable
Browse files Browse the repository at this point in the history
  • Loading branch information
Navid200 committed Dec 23, 2023
1 parent c5ce20a commit 9fcb0d2
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 10 deletions.
Original file line number Diff line number Diff line change
@@ -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;
Expand Down Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -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;
Expand Down Expand Up @@ -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);
}
}
}
}

Expand All @@ -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;
}
}
}

0 comments on commit 9fcb0d2

Please sign in to comment.