Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
jamorham committed Sep 4, 2024
2 parents a39c17f + 6355497 commit f0a46a3
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ public class FirmwareCapability {
private static final ImmutableSet<String> KNOWN_G6_REV2_RAW_FIRMWARES = ImmutableSet.of("2.18.2.67");
private static final ImmutableSet<String> KNOWN_G6_PLUS_FIRMWARES = ImmutableSet.of("2.4.2.88");
private static final ImmutableSet<String> KNOWN_ONE_FIRMWARES = ImmutableSet.of("30.192.103.34");
private static final ImmutableSet<String> 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<String> 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<String> KNOWN_TIME_TRAVEL_TESTED = ImmutableSet.of("1.6.5.25");
private static final ImmutableSet<String> 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) {
Expand Down Expand Up @@ -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) {
Expand All @@ -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) {
Expand Down Expand Up @@ -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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2250,7 +2250,7 @@ public static List<StatusItem> 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));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit f0a46a3

Please sign in to comment.