12-OBD-Speed: CAN logger page, shared SD mount, more PSRAM

- CAN log page: ELM327 monitor-mode survey/capture of broadcast frames with marks,
  written to /canlog on the SD card; serial "ls"/"get" commands to download logs
- sd_card: reference-counted SD_MMC mount shared by bg_store and the logger
- heap_caps_malloc_extmem_enable(64): internal RAM was down to ~10 KB, SD mounts
  failed with ESP_ERR_NO_MEM (DMA); now ~23 KB free, 13.8 KB DMA block
- docs/canlog: first test drive (Fiesta Mk8 2018) - no broadcast frames on the
  OBD port, only diagnostic replies (gateway)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
mangavalkandClaude Opus 5.5 committed 2026-11-08 19:14:07 +01:00
1 parent 21012adbec
commit 60cd7cf262
16 files changed
+1975 -47

No files matched your search

+12 -1
View File
@@ -80,7 +80,7 @@ Display color format is `RGB565_SWAPPED` (ST77916 byte order, set in `lv_conf.h`
| `2-Program Example/Demo_Arduino` | **Vendor only:** `library/` (3 libs), `lv_conf.h` (vendor original), `sd/` (SD listing example; its lv_conf.h has FATFS edits), `docs/` (setup screenshots + compile instructions). The vendor's original LVGL demo sketch no longer exists unmodified. |
| `tools` | `gif_to_360.py` — converts GIFs to 360×360 for the device (Pillow; scale to cover + center crop, keeps frame timing) |
| `shared` | **Shared code for all JC3636W518 projects:** `jc3636w518.ini` (PlatformIO base config), `include/lv_conf.h` (LVGL 9.6), `lib/JC3636W518` (board library). See its `README.md` |
| `12-OBD-Speed` | **The new program — working in the car (2026-10-23):** speed from the ELM327 over BLE as big number + arc gauge on a GIF background, battery-voltage arc in the bottom gap, idle/screen-off mode (both **verified by the user**); swipe left for the adapter menu (scan, select → remembered in NVS, auto-reconnect every 3 s), again for settings (rotation, idle/screen-off timeout), again for the background (GIF from SD `/gifs` copied into an 11.9 MB raw flash partition, own `partitions.csv`). See its `README.md` |
| `12-OBD-Speed` | (+ CAN logger page, 2026-11-02, see "User's car") **The new program — working in the car (2026-10-23):** speed from the ELM327 over BLE as big number + arc gauge on a GIF background, battery-voltage arc in the bottom gap, idle/screen-off mode (both **verified by the user**); swipe left for the adapter menu (scan, select → remembered in NVS, auto-reconnect every 3 s), again for settings (rotation, idle/screen-off timeout), again for the background (GIF from SD `/gifs` copied into an 11.9 MB raw flash partition, own `partitions.csv`). See its `README.md` |
| `13-Dash-Mount` | **3D-printed dashboard holder** (OpenSCAD, 2026-10-23; **base printed 2026-10-24, user: "perfect"**): snap-in cup with lip over the bezel + USB-C opening on the side, detent tilt hinge (36 face teeth = 10° steps, M3×20 bolt + captive nut + printed knob), flat foot for VHB tape. ASA. User's choices: adhesive base, detent hinge, M3, cable exits sideways, only a USB-C opening needed. OpenSCAD is installed (`C:\Program Files\OpenSCAD\openscad.exe`, use from bash for `-D part="..."` quoting). See its `README.md` |
| `10-GIF-Tests` | **GIF playback experiments** (was `10-OBD-Display-2024`): `display_gif_embedded`, `display_gif_sd`, `assets/gifs`. The 2024 bridge/ELMulator/WiFi speed sketch, the broken LVGL 9 archive and the BLE scanner tool (`11-BLE-Scanner`: on-screen scan, GATT listing, ELM test, LittleFS log) were removed 2026-10-23 — all in git history |
| `3-Specification` | Spec sheet (factory firmware features, interface photo) |
@@ -107,6 +107,17 @@ AliExpress "ELM327 Mini V2.1 Bluetooth OBD **Dual Mode** 5.1" — dual mode = Bl
- **Supported PIDs 01–20** (from `BE 3E A8 13`): 01 monitor status, 03 fuel system, 04 engine load, 05 coolant temp, 06/07 fuel trim B1, **0B intake manifold pressure (MAP)**, **0C RPM**, **0D speed**, 0E timing advance, 0F intake air temp, 11 throttle, 13 O2 sensors, 15 O2 sensor 2, 1C OBD standard, 1F run time, 20 → more PIDs in 21–40. **No 10 (MAF)** → speed-density engine.
- Adapter is powered from the car's OBD port (pin 16, 12 V).
## User's car
**Ford Fiesta Mk8, 2018 (pre-facelift), EcoBoost, automatic, EU**, radar ACC; dashboard shows speed signs (traffic sign recognition).
User wants (2026-11-02) ACC set speed + speed-limit sign on the puck. Choices: no direct CAN wiring (option C rejected),
FORScan possible but not preferred, over-limit warning = a setting (tolerance), items hidden when no data.
Plan: first a **CAN logger test drive** (built 2026-11-02 in `12-OBD-Speed`, last page; not yet flashed/tested) to see
whether the OBD port (HS-CAN, pins 6/14) carries the messages and the clone can keep up in `ATMA` mode.
Candidate IDs from opendbc `ford_lincoln_base_pt.dbc` (newer Fords, only ~40 % of the file read verbatim — re-check bits):
`0x165` `Veh_V_DsplyCcSet` 23|8 (+ `CcStat_D_Actl` 10|3), `0x202` `Veh_V_RqCcSet` 32|9 ×0.5 km/h,
`0x3D9` IPMA_Data2 `IsaVLim_D_Rq` 7|8 (254 = no data), `IsaVLimUnit_D_Rq` 15|2 (1 kph, 2 mph), cycle 1 s / on change.
Fallback if not on the OBD bus: UDS mode 22 requests to the camera module (IPMA) like FORScan.
## Gotchas / observations
- **LVGL 8 GIF bug (patched locally, only relevant if LVGL 8 is used again):** LVGL 8.3.11 `gifdec.c` (`gd_open_gif`) filled the canvas *opaque* with the GIF's background color. GIFs with a transparent background (e.g. `loligod.gif`, bg = RGB 28,29,49) showed that dark gray except where "restore to background" frames had cleared to transparent (→ screen black). **Patched** in the vendor copy `2-Program Example/Demo_Arduino/library/lvgl/src/extra/libs/gif/gifdec.c`: initial canvas alpha 0x00 (marked `LOCAL PATCH`). Re-apply if LVGL is ever replaced/upgraded.
- Most GIFs in `assets/gifs` are optimized (transparent unchanged pixels, disposal 1/2); `loligod.gif` has a fully transparent background (~84 % of each frame).