feat: developer tools page, auto-test orchestrator, BIP display, tests redesign

Bundles several feature streams that have been iterating on the working tree:

- Developer Tools page (Debug-only via DEVELOPER_TOOLS symbol): hosts the
  identification card, manual KWP write + transaction log, ROM/EEPROM dump
  card with progress banner and completion message, persisted custom-commands
  library, persisted EEPROM passwords library. New service primitives:
  IKwpService.SendRawCustomAsync / ReadEepromAsync / ReadRomEepromAsync.
  Persistence mirrors the Clients XML pattern in two new files
  (custom_commands.xml, eeprom_passwords.xml).
- Auto-test orchestrator (IAutoTestOrchestrator + AutoTestState): linear
  K-Line read -> unlock -> bench-on -> test sequence with snackbar UI and
  progress dialog VM, gated on dashboard alarms.
- BIP-STATUS display: BipDisplayViewModel + BipDisplayView, RAM read at
  0x0106 via IKwpService.ReadBipStatusAsync; status definitions in
  BipStatusDefinition.
- Tests page redesign: TestSectionCard + PhaseTileView replacing the old
  TestPlanView/TestRunningView/TestDoneView/TestPreconditionsView/
  TestSectionView controls and their VMs.
- Pump command sliders: Fluent thick-track style with overhang thumb,
  click-anywhere-and-drag, mouse-wheel adjustment.
- Window startup: app.manifest declares PerMonitorV2 DPI awareness,
  MainWindow installs a WM_GETMINMAXINFO hook in OnSourceInitialized and
  maximizes there (after the hook is in place) so the app fits the work
  area exactly on any display configuration.
- Misc: PercentToPixelsConverter, seed_aliases.py one-shot pump-alias
  importer, tools/Import-BipStatus.ps1, kline_eeprom_spec.md and
  dump-functions reference docs.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-05-07 13:59:50 +02:00
parent da0581967b
commit 827b811b39
102 changed files with 7522 additions and 1798 deletions

View File

@@ -37,8 +37,16 @@ namespace HC_APTBS.ViewModels.Dialogs
_elapsedTime = "00:00";
_isCancellable = true;
_unlockService.StatusChanged += OnStatusChanged;
_unlockService.UnlockCompleted += OnUnlockCompleted;
_unlockService.StatusChanged += OnStatusChanged;
_unlockService.UnlockCompleted += OnUnlockCompleted;
_unlockService.PumpRelocked += OnPumpRelocked;
// PumpUnlocked fires as soon as the CAN TestUnlock parameter flips —
// regardless of which code path caused the unlock (fast unlock, Phase 1
// flood finishing, external manual unlock). This lets the dialog flip
// to its success state the instant the hardware confirms unlock, rather
// than waiting for UnlockService.UnlockAsync to reach its final
// verification step.
_unlockService.PumpUnlocked += OnPumpUnlocked;
}
// ── Observable properties ────────────────────────────────────────────────
@@ -69,6 +77,10 @@ namespace HC_APTBS.ViewModels.Dialogs
/// <summary>Tri-state result: null = in progress, true = success, false = failure.</summary>
[ObservableProperty] private bool? _isSuccess;
/// <summary>True when the pump is currently LOCKED and the operator can retry the unlock.</summary>
[NotifyCanExecuteChangedFor(nameof(RetryCommand))]
[ObservableProperty] private bool _canRetry;
// ── Commands ─────────────────────────────────────────────────────────────
/// <summary>Cancels the unlock sequence (only available during Phase 1).</summary>
@@ -89,11 +101,22 @@ namespace HC_APTBS.ViewModels.Dialogs
RequestClose?.Invoke();
}
/// <summary>Requests a new unlock attempt (only available when complete and pump is LOCKED).</summary>
[RelayCommand(CanExecute = nameof(CanRetry))]
private void Retry()
{
CanRetry = false;
RequestRetry?.Invoke();
}
// ── Events ───────────────────────────────────────────────────────────────
/// <summary>Raised when the dialog should close itself.</summary>
public event Action? RequestClose;
/// <summary>Raised when the operator presses Retry — parent should restart the unlock sequence.</summary>
public event Action? RequestRetry;
// ── Service event handlers ───────────────────────────────────────────────
private void OnStatusChanged(string msg)
@@ -137,6 +160,43 @@ namespace HC_APTBS.ViewModels.Dialogs
IsCancellable = false;
IsSuccess = success;
ResultText = success ? _loc.GetString("Dialog.Unlock.Unlocked") : _loc.GetString("Dialog.Unlock.Failed");
// Enable Retry when the unlock finished but the pump is still LOCKED.
CanRetry = !_unlockService.IsPumpUnlocked;
});
}
/// <summary>
/// Observer says the pump is now unlocked. Flip the dialog to the
/// success state immediately so the operator sees a responsive UI; the
/// later UnlockCompleted(true) event is idempotent and leaves this state
/// intact. If UnlockCompleted later arrives with failure=false, that
/// would overwrite — but that combination (observer unlocks then service
/// reports failure) is not a real scenario in the current state machine.
/// </summary>
private void OnPumpUnlocked()
{
Application.Current?.Dispatcher?.Invoke(() =>
{
if (IsComplete) return;
IsComplete = true;
IsCancellable = false;
IsSuccess = true;
CanRetry = false;
ResultText = _loc.GetString("Dialog.Unlock.Unlocked");
});
}
/// <summary>
/// Observer says the pump re-locked after a previously successful unlock.
/// If the snackbar is still visible (not dismissed), light up the Retry button
/// so the operator has a manual fallback without needing to reselect the pump.
/// </summary>
private void OnPumpRelocked()
{
Application.Current?.Dispatcher?.Invoke(() =>
{
if (IsComplete)
CanRetry = true;
});
}
@@ -145,8 +205,10 @@ namespace HC_APTBS.ViewModels.Dialogs
/// <summary>Unsubscribes from service events to prevent leaks.</summary>
public void Dispose()
{
_unlockService.StatusChanged -= OnStatusChanged;
_unlockService.StatusChanged -= OnStatusChanged;
_unlockService.UnlockCompleted -= OnUnlockCompleted;
_unlockService.PumpUnlocked -= OnPumpUnlocked;
_unlockService.PumpRelocked -= OnPumpRelocked;
}
}
}