14 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
fc1e832c3d Expand vehicle compatibility: European Ford models, per-model Japanese/Korean tables
European Fords (Fiesta, Focus, Mondeo, Ka, Transit, etc.) use K-line,
not J1850 like US Fords. Added model-level detail for Honda, Toyota,
Nissan, Mazda, Subaru, Mitsubishi, Hyundai, Kia, Suzuki, and Chrysler.
Added muki01/OBD2_K-line_Reader reference.
2026-02-13 07:39:24 -07:00
7045d8b614 Add vehicle compatibility reference (BMW I/K-Bus + OBD-II K-line by make/model/year) 2026-02-13 07:28:32 -07:00
c32e62cf1d Add Starlight docs site for k-line.warehack.ing
Astro/Starlight documentation site with 8 content pages:
- Circuit design (SPICE validation, R2 sweep data, K-line compat)
- Firmware architecture (composition diagram, concurrency model)
- BMW I/K-Bus protocol (message format, module addresses)
- OBD-II K-line protocol (init sequences, PID decode formulas)
- Bill of materials
- Getting started guide
- Development journal (4-session engineering log)

Docker deployment: multi-stage build (Node builder + Caddy static),
caddy-docker-proxy labels, Makefile for management.
2026-02-13 07:06:52 -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
e639056ee8 Update library metadata and docs for AutoWire multi-protocol support
- library.json: renamed to AutoWire, added obd2/kline/iso9141/14230 keywords
- CLAUDE.md: documented composition architecture, OBD-II scanner build,
  updated project overview and roadmap for dual-protocol support
2026-02-13 05:49:34 -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
e6fc5ad4e9 K-line compatibility analysis: optocoupler vs 510 ohm pull-up
R2 sweep (47-470 ohm) and CTR grade sweep at ISO 9141 minimum
bus impedance. R2<=100 ohm works; BMW's R2=220 does not.
Confirms transistor design is better fit for OBD-II K-line.
2026-02-13 02:18:20 -07:00
e78976b979 Update docs: R2=220 fix, sweep netlists, corrected BOM and drain figures 2026-02-13 01:02:06 -07:00
52e8acf214 Fix 3.3V TX margin: R2 470->220 ohm (parameter sweep validated)
At 3.3V VCC the original R2=470 only drives 4.66mA through the
PC817 LED, giving marginal bus pull-down on loaded buses (V_LOW=2.5V
at 1k pull-up). Three parameter sweeps (R2, bus impedance, CTR grade)
identified R2=220 as the fix: LED current doubles to 9.71mA, bus LOW
drops to 0.27V even at 1k pull-up. Validated against PC817A typical
CTR with worst-case bus loading.
2026-02-13 00:56:03 -07:00
30ef51f26c SPICE simulation of PC817 optocoupler RX/TX paths (9600 baud)
Both signal paths validated with LTspice using built-in PC817
subcircuit model (Igain=1m). RX gives clean 0-3.13V at 3.3V VCC
with 5.8us rise time. TX confirms signal inversion and 0.17V bus
LOW with 4.66mA LED drive. 3.3V design works but is marginal vs
the original 5V Arduino circuit at worst-case CTR.
2026-02-13 00:04:55 -07:00
5d87dc2cac BMW I/K-Bus interface design brief (ESP32, optocoupler isolated)
Optocoupler-based design from muki01/I-K_Bus for BMW E-series
I-Bus/K-Bus communication. Includes protocol spec (9600 8E1,
XOR checksum, multi-master contention), module address map,
E46 command codes, IbusSerial library architecture, and
comparison with OBD-II K-line (Tucker project).
2026-02-12 22:39:54 -07:00