App 2.31.1: log the cruise control while driving, with every assist value

The 2.27.3 log wrote a line only when the target speed changed, so the
car showed one line at the start. Now a line is written on any change of
a mode or the target and every 2 s while driving, with the raw
driver-assistance properties (target speed, assist and speed-assist
modes, the followed object) and the reason for any unread value. The
last 600 lines are kept in an appended file; the Logs tab shows 150.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LhzAVaUyqcw5PkGjz4mWW6
This commit is contained in:
2026-10-25 09:33:17 +01:00
co-authored by Claude Opus 5.5
parent 4cd5f7a7ba
commit 36cc417638
10 changed files with 246 additions and 56 deletions
@@ -1503,6 +1503,9 @@ public class MainActivity extends AppCompatActivity {
* About twenty calls into the car's services: on a background thread, so the screen never
* waits for them; the values are shown on the main thread once they are in.
*/
/** Counts readings on the reader thread, for the once-a-second cruise control log. */
private int accDebugTick;
private void readVehicle() {
if (!reading.compareAndSet(false, true)) return;
try {
@@ -1514,6 +1517,14 @@ public class MainActivity extends AppCompatActivity {
// The timestamp is passed explicitly: its Kotlin default is not visible from Java.
EnergySnapshot s = vehicleReader.read(System.currentTimeMillis());
latestSnapshot = s;
// The cruise control debug log, once a second: about eight more calls.
if (accDebugTick++ % 5 == 0) {
java.util.List<String[]> acc = new java.util.ArrayList<>();
for (kotlin.Pair<String, String> r : com.evsuite.hardware.EVHardware.INSTANCE.readAccDebug()) {
acc.add(new String[] { r.getFirst(), r.getSecond() });
}
CruiseLog.note(getApplicationContext(), acc, s.getSpeedKmh(), s.getGearRaw());
}
runOnUiThread(() -> {
if (!isDestroyed()) showVehicle(s);
});
@@ -1797,7 +1808,6 @@ public class MainActivity extends AppCompatActivity {
vehTireFr.setText(unit.format(s.getTirePressures().getFrontRightKpa()));
vehTireRl.setText(unit.format(s.getTirePressures().getRearLeftKpa()));
vehTireRr.setText(unit.format(s.getTirePressures().getRearRightKpa()));
CruiseLog.note(this, s.getCruiseTargetSpeedRaw(), s.getSpeedKmh(), s.getGearRaw());
showGauges(s);
showCockpit(s);
showDrawnStyles(s);