Fatih'sMG4 — ABRP telemetry for an MG4 EH32 on SWI69
A fork of malys/EVABRPUploader (itself a fork of Leon Kernan's ABRP_Uploader) carrying the changes that make it work on this car. History starts here: the tree is what matters, and the upstream projects are where the earlier work belongs. EVHardware is vendored rather than tracked as a submodule, so one clone builds. Telemetry. SOC, battery power and range read as unavailable on SWI69 because the vendor fallbacks were gated to SWI68 alone, while the property ids they use are the ones this car publishes — the gates now admit SWI69. Tyre pressure, the odometer and charge status come from the vendor block too, since the generic properties for all three are declared here and never publish. Tyre pressure is confirmed on the vehicle; the other two are not yet. Vehicle page. Every signal the car answers, in a table. One that it does not publish shows a dash: an unimplemented VHAL property returns zero, and "0 °C" would read as a measurement. Wi-Fi page. Joins a network the unit already has saved, so a phone hotspot does not need a trip into Settings on every drive. Tried on the upload tick and from a button, skipped while already associated. This leans on the unit being API 28 and the build being platform-signed — getConfiguredNetworks and enableNetwork are closed to ordinary apps from API 29 — and fails quietly where that does not hold. The OTA updater points at this repository. An APK from upstream is signed with a different key, which Android will not install over a platform-signed build. Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,69 @@
|
||||
package com.evsuite.abrp;
|
||||
|
||||
import android.content.SharedPreferences;
|
||||
|
||||
/**
|
||||
* User-configurable upload policy.
|
||||
*
|
||||
* Defaults are deliberately conservative. The head unit is awake whenever the car is on,
|
||||
* and both the upload tick and the GPS subscription cost power the whole time, so the
|
||||
* default cadence is the slowest one that still keeps an ABRP route plan usable.
|
||||
*/
|
||||
final class UploadSettings {
|
||||
|
||||
static final String KEY_INTERVAL_SEC = "upload_interval_sec";
|
||||
static final String KEY_BOOST_LOW_SOC = "boost_low_soc";
|
||||
static final String KEY_LOW_SOC_PERCENT = "low_soc_percent";
|
||||
static final String KEY_AUTOSTART = "autostart";
|
||||
|
||||
/**
|
||||
* On by default: an ABRP plan is only useful if it is fed from the moment the drive
|
||||
* starts, and nobody opens this app before setting off. Kept as a switch because a
|
||||
* service that starts itself must also be switchable off.
|
||||
*/
|
||||
static final boolean DEFAULT_AUTOSTART = true;
|
||||
|
||||
/**
|
||||
* Default cadence while driving. 60 s is roughly 1.5 km between points at motorway
|
||||
* speed, which ABRP can still track; going much slower makes the live plan lag
|
||||
* reality. Parked and idle backs off far further on its own — see UploadCadence.
|
||||
*/
|
||||
static final int DEFAULT_INTERVAL_SEC = 60;
|
||||
|
||||
/** Offered in the UI. Kept short so the list stays a single glance on a car screen. */
|
||||
static final int[] INTERVAL_CHOICES_SEC = { 15, 30, 60, 120, 300 };
|
||||
|
||||
static final boolean DEFAULT_BOOST_LOW_SOC = true;
|
||||
|
||||
/** Below this, range planning gets tight and ABRP needs a finer SOC curve. */
|
||||
static final int DEFAULT_LOW_SOC_PERCENT = 20;
|
||||
|
||||
/** Cadence used while SOC is low and the boost is enabled. */
|
||||
static final int BOOSTED_INTERVAL_SEC = 15;
|
||||
|
||||
final int intervalSec;
|
||||
final boolean boostLowSoc;
|
||||
final int lowSocPercent;
|
||||
|
||||
UploadSettings(int intervalSec, boolean boostLowSoc, int lowSocPercent) {
|
||||
this.intervalSec = intervalSec;
|
||||
this.boostLowSoc = boostLowSoc;
|
||||
this.lowSocPercent = lowSocPercent;
|
||||
}
|
||||
|
||||
static UploadSettings from(SharedPreferences prefs) {
|
||||
return new UploadSettings(
|
||||
prefs.getInt(KEY_INTERVAL_SEC, DEFAULT_INTERVAL_SEC),
|
||||
prefs.getBoolean(KEY_BOOST_LOW_SOC, DEFAULT_BOOST_LOW_SOC),
|
||||
prefs.getInt(KEY_LOW_SOC_PERCENT, DEFAULT_LOW_SOC_PERCENT));
|
||||
}
|
||||
|
||||
static UploadSettings defaults() {
|
||||
return new UploadSettings(
|
||||
DEFAULT_INTERVAL_SEC, DEFAULT_BOOST_LOW_SOC, DEFAULT_LOW_SOC_PERCENT);
|
||||
}
|
||||
|
||||
long intervalMs() {
|
||||
return intervalSec * 1000L;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user