5 Commits

Author SHA1 Message Date
2aaa6e32a5 Rename library from AutoWire to K-Line
Library dir: lib/AutoWire/ -> lib/KLine/
Site title, docs, CLAUDE.md, platformio.ini all updated.
All 4 firmware environments build clean.
2026-02-13 08:31:34 -07:00
6d40c9e30b Add project docs: development journal, architecture, circuit design
Three reference documents built from conversation history and codebase:
- development-journal.md: chronological engineering log across 4 sessions
  (SPICE validation, R2 fix, ESP32 port, multi-protocol refactor, hardening)
- architecture.md: AutoWire composition pattern, concurrency model,
  protocol comparison, defensive design
- circuit-design.md: PC817 optocoupler RX/TX paths, R2 sweep data,
  K-line compatibility analysis, SPICE netlist inventory

Also updates CLAUDE.md with OBD-II hardening notes from code review.
2026-02-13 06:25:19 -07:00
a2dcd6d58d Harden OBD-II K-line handler (code review findings)
Fix UART pin detach: pinMatrixOutDetach() instead of no-op
uart_set_pin(ALL_NO_CHANGE). Fix timeout underflow in
readResponse() with remainingMs() helper. Add checksum
validation on received frames. Echo verification in clearEcho()
detects bus contention. Flush RX buffers after init sequences.
Structural ISO 14230 frame parsing replaces byte-scanning.
TesterPresent keepalive prevents P3 session timeout. Scanner
re-initializes after consecutive failures.
2026-02-13 06:02:25 -07:00
8ba53630c0 Add OBD-II K-line support (ISO 9141/14230) with scanner example
New protocol handler alongside BMW I/K-Bus:
- KLineObd2: 5-baud slow init, fast init (TiniPulse), request/response
  with half-duplex echo clearing, PID convenience wrapper
- Obd2Pids.h: ~20 common PIDs with SAE J1979 decode helpers
- obd2_scanner.cpp: polls RPM, speed, coolant, throttle, voltage

Build config changes:
- config.h: KLINE_* defaults (10400/8N1/MOD256/no idle detect)
- platformio.ini: build_src_filter separates sketches, new
  [env:obd2-scanner] environment with KLINE_TX_INVERT=0
2026-02-13 05:46:07 -07:00
1464fcabe6 Refactor: extract KLineTransport and IbusHandler from IbusEsp32
Split the monolithic IbusEsp32 class into composable layers:
- KLineTransport: UART, GPIO ISR, ring buffers, idle detection
- IbusHandler: BMW I/K-Bus FSM, source filtering, packet callback
- IbusEsp32: thin facade preserving the original API

Library renamed from IbusEsp32 to AutoWire. Existing sniffer
sketch (main.cpp) requires zero changes. All 3 ESP32 environments
build cleanly (esp32dev, esp32-c3, esp32-s3).
2026-02-13 05:41:39 -07:00