From 7c6d84e40ba7937e7ce06a76ab28e5f9d9f6103a Mon Sep 17 00:00:00 2001 From: Navid Date: Sat, 31 Aug 2024 14:23:47 -0400 Subject: [PATCH] Some cleanup --- .../dexdrip/NavDrawerBuilder.java | 2 +- .../dexdrip/g5model/FirmwareCapability.java | 23 +++++++++++++------ .../dexdrip/g5model/SensorDays.java | 7 +++++- .../services/Ob1G5CollectionService.java | 2 +- .../utilitymodels/BroadcastGlucose.java | 2 +- 5 files changed, 25 insertions(+), 11 deletions(-) diff --git a/app/src/main/java/com/eveningoutpost/dexdrip/NavDrawerBuilder.java b/app/src/main/java/com/eveningoutpost/dexdrip/NavDrawerBuilder.java index daf241c321..e6acba2a33 100644 --- a/app/src/main/java/com/eveningoutpost/dexdrip/NavDrawerBuilder.java +++ b/app/src/main/java/com/eveningoutpost/dexdrip/NavDrawerBuilder.java @@ -91,7 +91,7 @@ public NavDrawerBuilder(final Context context) { } } else { //If there haven't been two initial calibrations if (BgReading.isDataSuitableForDoubleCalibration() || Ob1G5CollectionService.isG5WantingInitialCalibration()) { - if ((FirmwareCapability.isTransmitterRawIncapable(getTransmitterID()) && last_two_bgReadings.size() > 1) || FirmwareCapability.isDeviceG7(getTransmitterID()) ) { //A Firefly G6 after third reading or a G7 + if ((FirmwareCapability.isTransmitterRawIncapable(getTransmitterID()) && last_two_bgReadings.size() > 1) || FirmwareCapability.isDeviceAltOrAlt2(getTransmitterID()) ) { //A Firefly G6 after third reading or a G7 this.nav_drawer_options.add(context.getString(R.string.add_calibration)); this.nav_drawer_intents.add(new Intent(context, AddCalibration.class)); } else { //G5 or non-Firefly G6 or Firefly G6 in no-code mode, after warm-up before initial calibration diff --git a/app/src/main/java/com/eveningoutpost/dexdrip/g5model/FirmwareCapability.java b/app/src/main/java/com/eveningoutpost/dexdrip/g5model/FirmwareCapability.java index f640995546..b110958b5a 100644 --- a/app/src/main/java/com/eveningoutpost/dexdrip/g5model/FirmwareCapability.java +++ b/app/src/main/java/com/eveningoutpost/dexdrip/g5model/FirmwareCapability.java @@ -19,9 +19,9 @@ public class FirmwareCapability { private static final ImmutableSet KNOWN_G6_REV2_RAW_FIRMWARES = ImmutableSet.of("2.18.2.67"); private static final ImmutableSet KNOWN_G6_PLUS_FIRMWARES = ImmutableSet.of("2.4.2.88"); private static final ImmutableSet KNOWN_ONE_FIRMWARES = ImmutableSet.of("30.192.103.34"); - private static final ImmutableSet KNOWN_ALT_FIRMWARES = ImmutableSet.of("29.192.104.59", "32.192.104.82", "32.192.104.109", "32.192.105.64", "32.192.106.0", "44.192.105.72", - "37.192.105.94"); + private static final ImmutableSet KNOWN_ALT_FIRMWARES = ImmutableSet.of("29.192.104.59", "32.192.104.82", "32.192.104.109", "32.192.105.64", "32.192.106.0", "44.192.105.72"); private static final ImmutableSet KNOWN_TIME_TRAVEL_TESTED = ImmutableSet.of("1.6.5.25"); + private static final ImmutableSet KNOWN_ALT2_FIRMWARES = ImmutableSet.of("37.192.105.94"); // new G6 firmware versions will need to be added here / above static boolean isG6Firmware(final String version) { @@ -80,8 +80,12 @@ static boolean isFirmwarePreemptiveRestartCapable(final String version) { return isFirmwareRawCapable(version); // hang off this for now as they are currently the same } - static boolean isG7Firmware(final String version) { - return KNOWN_ALT_FIRMWARES.contains(version); + static boolean isAltOrAlt2Firmware(final String version) { + return KNOWN_ALT_FIRMWARES.contains(version) || KNOWN_ALT2_FIRMWARES.contains(version); + } + + static boolean isAlt2Firmware(final String version) { + return KNOWN_ALT2_FIRMWARES.contains(version); } public static boolean isTransmitterPredictiveCapable(final String tx_id) { @@ -103,8 +107,12 @@ public static boolean isTransmitterStandardFirefly(final String tx_id) { // Fire return false; } - public static boolean isDeviceG7(final String tx_id) { - return isG7Firmware(getRawFirmwareVersionString(tx_id)); + public static boolean isDeviceAltOrAlt2(final String tx_id) { + return isAltOrAlt2Firmware(getRawFirmwareVersionString(tx_id)); + } + + public static boolean isDeviceAlt2(final String tx_id) { + return isAlt2Firmware(getRawFirmwareVersionString(tx_id)); } public static boolean isTransmitterG5(final String tx_id) { @@ -149,7 +157,8 @@ public static boolean isKnownFirmware(final String version) { || KNOWN_ONE_FIRMWARES.contains(version) || KNOWN_ALT_FIRMWARES.contains(version) || KNOWN_G6_REV2_FIRMWARES.contains(version) - || KNOWN_G6_PLUS_FIRMWARES.contains(version)); + || KNOWN_G6_PLUS_FIRMWARES.contains(version) + || KNOWN_ALT2_FIRMWARES.contains(version)); } public static boolean isTransmitterKnownFirmware(final String tx_id) { diff --git a/app/src/main/java/com/eveningoutpost/dexdrip/g5model/SensorDays.java b/app/src/main/java/com/eveningoutpost/dexdrip/g5model/SensorDays.java index 6edcd8250f..7d569793c8 100644 --- a/app/src/main/java/com/eveningoutpost/dexdrip/g5model/SensorDays.java +++ b/app/src/main/java/com/eveningoutpost/dexdrip/g5model/SensorDays.java @@ -20,6 +20,7 @@ import lombok.Getter; import lombok.val; +import static com.eveningoutpost.dexdrip.g5model.FirmwareCapability.isDeviceAlt2; import static com.eveningoutpost.dexdrip.g5model.Ob1G5StateMachine.getFirmwareXDetails; import static com.eveningoutpost.dexdrip.models.JoH.msSince; import static com.eveningoutpost.dexdrip.models.JoH.roundDouble; @@ -103,11 +104,15 @@ public static SensorDays get(DexCollectionType type, final String tx_id) { ths.warmupMs = 2 * HOUR_IN_MS; } - if (getBestCollectorHardwareName().equals("G7")) { // If using a G7 + if (getBestCollectorHardwareName().equals("G7")) { ths.period = DAY_IN_MS * 10 + HOUR_IN_MS * 12; // The device lasts 10.5 days. ths.warmupMs = 30 * MINUTE_IN_MS; // The warmup time is 30 minutes. } + if (isDeviceAlt2(getTransmitterID())) { + ths.period = DAY_IN_MS * 15 + HOUR_IN_MS * 12; + } + } else { // unknown type } diff --git a/app/src/main/java/com/eveningoutpost/dexdrip/services/Ob1G5CollectionService.java b/app/src/main/java/com/eveningoutpost/dexdrip/services/Ob1G5CollectionService.java index 037b9e1df6..30e9bca565 100644 --- a/app/src/main/java/com/eveningoutpost/dexdrip/services/Ob1G5CollectionService.java +++ b/app/src/main/java/com/eveningoutpost/dexdrip/services/Ob1G5CollectionService.java @@ -2250,7 +2250,7 @@ public static List megaStatus() { try { if (vr2 != null) { - if (vr2.typicalSensorDays != 10 && vr2.typicalSensorDays != 7) { + if (vr2.typicalSensorDays != 10 && vr2.typicalSensorDays != 7 && vr2.typicalSensorDays != 15) { l.add(new StatusItem("Sensor Period", niceTimeScalar(vr2.typicalSensorDays * DAY_IN_MS), Highlight.NOTICE)); } diff --git a/app/src/main/java/com/eveningoutpost/dexdrip/utilitymodels/BroadcastGlucose.java b/app/src/main/java/com/eveningoutpost/dexdrip/utilitymodels/BroadcastGlucose.java index 25d9542b57..6741caa697 100644 --- a/app/src/main/java/com/eveningoutpost/dexdrip/utilitymodels/BroadcastGlucose.java +++ b/app/src/main/java/com/eveningoutpost/dexdrip/utilitymodels/BroadcastGlucose.java @@ -158,7 +158,7 @@ public static void sendLocalBroadcast(final BgReading bgReading) { if (getBestCollectorHardwareName().equals("G7") || getBestCollectorHardwareName().equals("Native G6")) { // If we are using G7 or One+, or G6 in native mode usingG6OrG7 = true; } - if (getBestCollectorHardwareName().equals("G7") && FirmwareCapability.isDeviceG7(getTransmitterID())) { // If we are using G7 or One+ and there is connectivity + if (getBestCollectorHardwareName().equals("G7") && FirmwareCapability.isDeviceAltOrAlt2(getTransmitterID())) { // If we are using G7 or One+ and there is connectivity connectedToG7 = true; } if (getBestCollectorHardwareName().equals("G6 Native") && FirmwareCapability.isTransmitterG6(getTransmitterID())) { // If we are using a G6 in native mode and there is connectivity