Remove automatic consumption reset migration

This commit is contained in:
TCFDONMEZ
2026-09-30 23:10:03 +03:00
parent eb40b3d31d
commit 74723335e1
4 changed files with 3 additions and 17 deletions
-1
View File
@@ -1 +0,0 @@
664256b5d57096f3e3b9a24a71bde6cedb6ee4ff307f85fc4b576cb555a94f4f FatihsMG4-unstable-2.2.29.apk
+1
View File
@@ -0,0 +1 @@
0069924daa5e61e5e0e5bd82976fe5adafbb3c020fde8b5f41755f4844a25d4f FatihsMG4-unstable-2.2.30.apk
+2 -2
View File
@@ -34,8 +34,8 @@ android {
applicationId "com.evsuite.abrp"
minSdk 27
targetSdk 36
versionCode 46
versionName "2.2.29"
versionCode 47
versionName "2.2.30"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
@@ -39,7 +39,6 @@ final class ConsumptionTracker {
synchronized void sample(EnergySnapshot s) {
migrateSwi69DistanceScale(s.getFirmware());
migrateConsumptionMethodV2(s.getFirmware());
long now = s.getTimestampMs();
if (lastMs > 0 && now > lastMs) {
double hours = (now - lastMs) / 3_600_000d;
@@ -158,19 +157,6 @@ final class ConsumptionTracker {
lifetime = load("life"); tripA = load("a"); tripB = load("b");
}
/** Old net-power energy cannot be repaired exactly; discard it once before OEM deltas. */
private void migrateConsumptionMethodV2(FirmwareInfo.Gen firmware) {
if (firmware != FirmwareInfo.Gen.SWI69 || prefs.getBoolean("consumption_energy_v2", false)) return;
SharedPreferences.Editor editor = prefs.edit();
for (String key : prefs.getAll().keySet()) {
if (key.startsWith("day_") || key.startsWith("life_")
|| key.startsWith("a_") || key.startsWith("b_")) editor.remove(key);
}
editor.putBoolean("consumption_energy_v2", true).commit();
lifetime = zero(); tripA = zero(); tripB = zero();
lastMs = 0; lastSpeed = null; lastPower = null; lastSoc = null;
lastVehicleConsumedKwh = null;
}
private Totals load(String key) { return new Totals(bits(key,"km"), bits(key,"kwh"), bits(key,"h"), bits(key,"soc")); }
private double bits(String key, String field) { return Double.longBitsToDouble(prefs.getLong(key + "_" + field, 0L)); }