5fe313b7fa
- protocol header v2 copied byte-identical from the 5B repo - uart_receiver: processFrame() shared by the UART framing task and ESP-NOW, version check, dedupe on packet_id+timestamp, per-transport liveness, CONFIG cache with sequence number - espnow_receiver: STA mode, channel hopping while silent, locks on frames - gauge_outputs: tach on IO7 (LEDC ch2, 14-bit), coolant PWM on IO8 (LEDC ch4, 8-bit), config cached in NVS, overrides applied but not saved - main: gear label from lever + engaged/target (pulses while shifting, red on mismatch), icons driven by A's alert bits, gauge update at 5 Hz, link stats - wiki: temp_stage.cfd (user's old CANNY program) decoded as prior art; controller-link, link-redundancy, patrol-gauge-outputs, open-questions updated with the bench-verified v2 results and calibration procedure Co-Authored-By: Claude <noreply@anthropic.com>
56 lines
8.6 KiB
Markdown
56 lines
8.6 KiB
Markdown
# Log
|
||
|
||
Append-only. `grep "^## \[" log.md | tail -5` for recent activity.
|
||
|
||
## [2026-09-21] setup | Wiki instantiated
|
||
|
||
Created schema (`CLAUDE.md`, modelled on the sibling 5B wiki with a sibling-reference convention and a no-files-outside-this-repo directive), `index.md`, `log.md`, and four seed pages from repo knowledge plus the day's investigation: [[esp32-s3-lcd-1-3]], [[controller-link]], [[link-redundancy]], [[patrol-gauge-outputs]], [[open-questions]]. Two sources: [[pinout-photo-details-7]] (photo copied from `.docs/` into `raw/`) and [[waveshare-wiki-esp32-s3-lcd-1-3]] (condensed web fetch, flagged for a verbatim re-clip). Deleted Obsidian's default `Welcome.md`.
|
||
|
||
Findings recorded during setup:
|
||
- Header pinout verified from the photo: IO1–5 and IO7–14, 13 free-function GPIOs; the wiring guide's IO35–42 table is wrong.
|
||
- Controller A cannot drive the Patrol gauges (no free native GPIO; DO terminals are I2C-expander + optocoupler). B can, via LEDC on IO7/IO8 — proposal only.
|
||
- A transmits on GPIO 44 (code), not 43 (two stale docs). GPIO 44 leaves the 5B only as an RS485 A/B pair — how that reaches B's IO1 is unknown and is now open question #1.
|
||
- The two repos' `gear_position_t` enums have drifted (Sport/Manual vs M1–M6 at values 4+). Open question #2.
|
||
- The packet has no RPM field; A has RPM verified from CAN 0x0AA. `engine_oil_temp` has no real source on this engine.
|
||
- Redundancy design space captured (RS485 / BLE GATT / ESP-NOW; failover on B; A transmits on both paths always). Nothing decided.
|
||
|
||
## [2026-09-21] update | .docs folder retired; root CLAUDE.md created
|
||
|
||
The repo's `.docs/` folder (14 files) was deleted (user decision). Its still-true content — verified display pins, brightness API, SquareLine export rules, CH343 serial notes, link facts — was distilled into a new root `CLAUDE.md`; the stale parts (backlight on GPIO 2/15, SPI on 10/11, native USB-CDC, the IO35–IO42 header table, the phase roadmap, the pin-hunting guides) were dropped. `UART_PROTOCOL.md` now exists only in the 5B repo at `docs/UART_PROTOCOL.md`. `README.md` repointed to `CLAUDE.md` and `wiki/`. Wiki citations that named `.docs/` files were reworded to "former … (deleted 2026-09-21)"; [[open-questions]] wishlist gained the Waveshare schematic and demo-zip URLs recovered from the old troubleshooting doc. No page content changed otherwise.
|
||
|
||
## [2026-09-21] update | Tach = 4 pulses/rev (user); coolant gauge characterisation procedure
|
||
|
||
User states the Patrol cluster's tachometer expects **4 pulses per revolution** (recorded as user-stated, not bench-verified). Clarified that the coolant gauge is a current/resistance meter with no pulse count; added a bench procedure (pot sweep for the resistance → needle curve, sender-wire voltage to tell bimetal/regulated from series coil, series current for MOSFET sizing, PWM 500 Hz–2 kHz clear of any instrument-voltage-regulator chopper, empirical °C → duty lookup, tach pull-up check and two-frequency verification) to [[patrol-gauge-outputs]]. [[open-questions]] #3 and #7 reworded accordingly.
|
||
|
||
## [2026-09-21] ingest | temp_stage.cfd — the user's old CANNY 5.3 pico temp-gauge program decoded
|
||
|
||
`raw/temp_stage.cfd` (CannyLab, proprietary binary) walked as 165 `[type][len][payload]` records; block names, constants, wiring and an Albanian comment recovered → [[temp-stage-cfd]]. Result: CAN 500k, filter 0x1D0, low byte of D1:D0 minus 48 = °C (matches the 5B's verified decode), **duty = ((T − 40)·15 + 1100)/10 = 1.5·T + 50 on a 0–255 PWM period**, output enabled above a minimum temperature, push-pull pin with PWM pull-up. Not in the file: PWM base clock and the external drive circuit. [[patrol-gauge-outputs]] gained a prior-art section and a starting LEDC law; [[open-questions]] #7 partly answered, #13 added; index updated.
|
||
|
||
## [2026-09-21] update | Calibration parameters to live on A; ESP32 as frequency meter for the CANNY
|
||
|
||
User has the CANNY unit but no scope, and wants tunable variables on the 5B for both gauges. Recorded on [[patrol-gauge-outputs]]: the proposed `gauge_calibration_t` (tach ppr/trim/clamps; temp PWM Hz, slope/offset, min-temp gate, clamp; enables; calibration override) pushed A → B in a v2 config packet, and the plan to measure the CANNY's PWM frequency/duty with a 1.3 header GPIO + pulse counter instead of a scope. Suggested order: counter sketch → v2 header → A NVS/config TX/serial tuning → B RX + LEDC → A settings UI.
|
||
|
||
## [2026-09-21] update | Frequency-counter sketch demoted to fallback
|
||
|
||
User decision: do not measure the CANNY's PWM first; implement the v2 protocol and B's LEDC outputs directly, and only feed the CANNY's PWM pin into a free 1.3 header GPIO for troubleshooting if the gauges misbehave. Coolant PWM frequency will default to 1 kHz (tunable from A) in the absence of a measurement. Proposed implementation defaults awaiting the user's go: split gear bytes (lever + target/engaged nibbles), A-side alert bitmap (coolant ≥ 100 °C, gearbox ≥ 130 °C, gearbox cooling demand, battery < 11.0 V, gear mismatch), 16-bit rpm, config packet from A's NVS via serial console first, B outputs tach IO7 / temp IO8 on separate LEDC timers, off when link down or value invalid.
|
||
|
||
## [2026-09-21] update | Bench wiring for the A→B link specified
|
||
|
||
Added a bench-wiring section to [[controller-link]]: 3.3 V RS485→TTL module on B (MAX3485/SP3485), 5B `485_A`/`485_B`/GND → module → RO to IO1, VCC from 3V3, DE/RE low; termination note (shared CAN/RS485 switch, OFF before the car); the bare-A-line shortcut flagged as unreliable; a v1 baseline check (CAN toggle ON → default packets at 5 Hz → B reports established, zero errors) to run before the v2 protocol work. Running this check answers open question #1.
|
||
|
||
## [2026-09-21] update | No RS485 module on hand — zero-parts bench options
|
||
|
||
User has no RS485→TTL module. Re-assessed the bare `485_A` → IO1 shortcut against the 5B schematic: SP3485 at 3.3 V, auto-direction drives only zeros, 4.7 kΩ bias holds A high → effectively a 3.3 V UART signal when unterminated; recorded on [[controller-link]] as the bench-only first try (unverified). Wireless leg (ESP-NOW first, BLE later) to be built alongside the v2 protocol regardless; B-as-I2C-slave noted and not pursued.
|
||
|
||
## [2026-09-21] update | Bench link VERIFIED on the bare A line; both boards reflashed
|
||
|
||
Both boards flashed from current sources (5B → COM11, 1.3 → COM10). Bench check with `485_A` → IO1 + GND, no transceiver on B, 120 Ω OFF: B reports connection established, 38 packets / 10 s, 0 checksum / 0 framing errors, valid flags 0x3F, debug flag mirrored; A logs 23-byte packets on GPIO 44 every 200 ms (UART auto-started from NVS). Open question #1 answered for the bench and re-scoped to "will it survive the car". [[controller-link]] updated. Note: opening the 5B's USB-CDC port from the PC resets the board.
|
||
|
||
## [2026-09-21] update | Protocol v2 + ESP-NOW + gauge outputs implemented and bench-verified
|
||
|
||
Implemented in both repos (not yet committed): shared header v2 (typed DATA/CONFIG frames, `gear_lever` + target/engaged nibbles, `engine_rpm`, `alerts` bitmap, `link_config_t`); A: `Tunables` (NVS + `cfg` serial console), `EspNowLink` (broadcast leg, radio held in STA), UART manager sends every frame on both paths, CAN driver publishes gear pieces + evaluates alerts; B: `UARTReceiver::processFrame()` shared by the UART framing task and the new `EspNowReceiver` (channel hopping), dedupe on packet_id, CONFIG cache in NVS, `GaugeOutputs` (tach IO7 14-bit LEDC, coolant IO8 8-bit PWM), gear label pulses while target != engaged and turns red on mismatch, icons driven by A's alert bits. Bench: 42/42/42 frames applied/uart/espnow with 42 duplicates and 0 errors; ESP-NOW locked on ch 1; CONFIG on both paths; `cfg override rpm 2000` -> 133.3 Hz on IO7; coolant 89 C -> duty 183. Two bench-found fixes: tach needs 14-bit LEDC resolution (8-bit cannot reach 100 Hz) and the shared temperature formatter must not emit a degree sign (B's font lacks the glyph). Pages updated: [[controller-link]], [[link-redundancy]], [[patrol-gauge-outputs]], [[open-questions]] (#2, #4, BLE-vs-ESP-NOW and tunables-location moved to Answered; #5/#5b reworded); index updated.
|
||
|
||
## [2026-09-21] update | Gauge Tuning touchscreen page on A; calibration procedure filed
|
||
|
||
A gained a hand-coded LVGL Gauge Tuning screen (Home → right → Driveline → right): −/+ rows for every `link_config_t` field, enable switches, and an override panel with RPM/duty sliders; changes go through `Tunables` (saved + pushed), overrides never persisted (A's NVS save strips them). Built and flashed. Step-by-step needle calibration procedure added to [[patrol-gauge-outputs]].
|