initial commit

This commit is contained in:
2026-04-11 12:45:18 +02:00
commit 6e1b929e2f
1246 changed files with 177580 additions and 0 deletions

64
CLAUDE.md Normal file
View File

@@ -0,0 +1,64 @@
# HC_APTBS
## What this is
WPF desktop application (.NET 10 / x64) that controls a VP44 diesel injection pump test bench.
- Reads/writes bench sensors (temperature, RPM, flow) via CAN bus (PCAN-Basic, 500 kbps)
- Communicates with the pump ECU via K-Line/KWP2000 (FTDI USB adapter, 9600 bps)
- Runs automated multi-phase test sequences with PID temperature control
- Generates PDF test reports (QuestPDF)
## Build
Windows only, .NET 10 x64. `dotnet build -r win-x64` from solution root. SDK pinned in `global.json`. No WSL/Linux — native DLLs (`PCANBasic.dll`, `ftd2xx.dll`) are x64 Windows binaries. No test project; validation is code review + manual hardware testing.
## Stack
- C# / .NET 10, WPF, XAML
- CommunityToolkit.Mvvm: `[ObservableProperty]`, `[RelayCommand]`
- Microsoft.Extensions.DependencyInjection for bootstrap
- QuestPDF 2025.3.2 (requires `LicenseType.Community` in constructor)
- Native DLLs in output: `PCANBasic.dll`, `ftd2xx.dll` (x64 only)
## Architecture
```
Infrastructure/
Pcan/PcanBasic.cs — Vendor P/Invoke file. NEVER modify.
Pcan/PcanAdapter.cs — CAN read thread, OEM legitimation, frame decode, IIR filter
Kwp/FtdiInterface.cs — FTDI D2XX wrapper (manual LoadLibrary, not NativeLibrary.Load)
Kwp/KwpCommon.cs — 5-baud slow-init, complement-ACK byte I/O
Kwp/KW1281Connection.cs — KWP/KW1281 protocol state machine
Logging/AppLogger.cs — Daily rotating log files
Services/Impl/
BenchService.cs — Test orchestration, temperature PID, relay control (background Task)
KwpService.cs — All KWP operations; one FtdiInterface open/close per call
ConfigurationService.cs — XML persistence for pump definitions, bench config, client list
PdfService.cs — Report generation
ViewModels/ — [ObservableProperty] / [RelayCommand], no UI logic
Views/ — Pure XAML; no code-behind except DI constructors
```
## Rules for all edits
**Always:**
- Read the file before editing it
- Keep XML doc comments on all public types and members
- Use `BenchParameterNames` / `PumpParameterNames` / `KlineKeys` constants — no magic strings
- Marshal to the UI thread when consuming `IBenchService` or `IKwpService` events (they fire on background threads)
**Never:**
- Modify `Infrastructure/Pcan/PcanBasic.cs` (vendor file, intentionally untouched)
- Modify anything under `old_source/` (archived reference only)
- Add logic to View code-behind files
- Add `Thread.Sleep`, allocations, or logging inside the per-byte K-Line loops in `KwpCommon`/`KW1281Connection`
## Protocol constants
Do not change without knowing why. Use `/protocol-ref` skill for full reference including DFI encoding, IIR filter, OEM legitimation, and K-Line timing.
## Conventions
- ViewModels in `/ViewModels`, Views in `/Views`, Models in `/Models`
- Async methods use `Async` suffix
- Commit format: `feat:`, `fix:`, `refactor:` (conventional commits)
- Git remote: self-hosted Gitea at 192.168.8.130
## Known debt
Do not worsen before addressing deliberately. See memory file `project_known_debt.md` for details.