Compare commits

...
19 Commits
Author SHA1 Message Date
mangavalkandClaude Opus 5.5 970f6a3d64 12-OBD-Speed: watch mode for the unknown PCM DIDs
- After the DID scan, the log page reads the 327 PCM DIDs of unknown meaning
  round after round and logs every change ("W did data"), 3 per request if
  the PCM allows it (reply split with the lengths from the scan)
- tools/make_watch_dids.py generates src/watch_dids.h from the scan logs
- README/CLAUDE.md: scan results, test-drive plan, git remote

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-18 16:18:52 +01:00
mangavalkandClaude Opus 5.5 c9ad39c8ed 12-OBD-Speed: read-only UDS DID scan of the car's modules
- Log page now runs a diagnostic scan instead of CAN listening (the Fiesta's OBD
  port carries no broadcast traffic): unfiltered check, module discovery
  0x700-0x7EF (22F188, then 3E00 with 1 s timeout), all 65536 DIDs per module,
  progress in NVS, speed/voltage polled every 2 s in between
- Result (drives 2026-11-12..18): only the PCM 0x7E0 answers; 389 DIDs supported
  (logs in docs/canlog/scan, scan2)
- Reset scan button, BLE connection interval request, progress lines
- CLAUDE.md: screen-has-priority rule, web UI future idea, findings

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-18 16:06:31 +01:00
mangavalkandClaude Opus 5.5 60cd7cf262 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>
2026-11-08 19:14:07 +01:00
mangavalkandClaude Opus 5.5 21012adbec gif_to_360: --crop-x option for the horizontal crop position
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-24 17:31:05 +02:00
mangavalkandClaude Opus 5.5 b2f6a52902 gif_to_360: retry with sharp scaling when too large; add new GIF
Smooth upscaling blends pixels and dithers per-frame palettes, which
breaks GIF delta compression (7.2 MB source -> 24.9 MB). Nearest-
neighbour scaling keeps it at 7.2 MB, under the 11.5 MB flash limit.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-24 17:29:18 +02:00
mangavalkandClaude Opus 5.5 15b4ef5cef 13-Dash-Mount: dashboard holder (OpenSCAD + STLs), base printed
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-24 17:27:42 +02:00
mangavalkandClaude Opus 5.5 c22b98de76 Board library: fix 1 px offset in mirrored rotations
The panel's row mirror (MY) puts the image one line off, which left a
stray line at the edge when starting at 270 degrees. setRotation() now
sets a 1 px gap on the axis MY mirrors, and scr_lvgl_init() clears the
whole GRAM at rotation 0 so no random power-on pixels can show.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-24 17:08:02 +02:00
patriandClaude Opus 5.5 c9fb70ad10 12-OBD-Speed: choose the background GIF from the SD card
- background page (4th tile): built-in or any GIF in /gifs on the SD card
- chosen GIF is copied into a raw 11.9 MB 'bggif' flash partition (header
  written last) and played memory-mapped from flash; SD only needed when
  choosing or when the file changed (checked at boot in the background)
- own partitions.csv: 4 MB app + bggif + NVS
- tools/gif_to_360.py: convert GIFs to 360x360 keeping frame timing;
  converted output (12-OBD-Speed/sd/) is git-ignored

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-23 18:58:44 +02:00
patriandClaude Opus 5.5 9d5561be5a CLAUDE.md: voltage arc and idle mode verified
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-23 18:45:24 +02:00
patriandClaude Opus 5.5 be69bda4f1 12-OBD-Speed: battery voltage arc and idle/screen-off mode
- ATRV every 2 s; voltage arc in the bottom gap (11-15 V) + number,
  colored by state (low / weak / resting / charging / overcharge)
- idle after Off/2/5/10 min without speed data (settings page, NVS):
  screen off, GIF paused, OBD polling stopped, ATRV every 30 s;
  wakes on touch (swallowed by a top-layer overlay) or > 13.2 V
- status pill moved up to make room for the voltage

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-23 18:32:56 +02:00
patriandClaude Opus 5.5 0777db3498 CLAUDE.md: screen rotation verified at all angles
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-23 18:22:10 +02:00
patriandClaude Opus 5.5 4fc70f13d0 12-OBD-Speed: settings page with screen rotation (0/90/180/270)
- third tile (swipe left from the menu): rotation buttons, saved in NVS,
  applied at boot
- shared lib: setRotation() rotates only the panel and redraws; touch
  points are converted in touchpad_read() for the current rotation;
  getRotation() added

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-23 18:20:35 +02:00
patriandClaude Opus 5.5 733306a9c0 Cleanup: remove BLE scanner, rename 10-OBD-Display-2024 to 10-GIF-Tests
- 11-BLE-Scanner removed; its car-test log moved to 12-OBD-Speed/docs
- 10-OBD-Display-2024 -> 10-GIF-Tests (GIF playback experiments)
- the broken LVGL 9 archive was already deleted (unintentionally) in d6982ab
- READMEs and CLAUDE.md references updated; visual check of 80 MHz QSPI /
  RGB565_SWAPPED marked as confirmed

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-23 18:14:23 +02:00
patriandClaude Opus 5.5 66f70c0cc1 Add 12-OBD-Speed: ELM327 speed over BLE on a GIF background
- speed page: 120 px antialiased number (lv_font_conv) + 0-200 km/h arc
  gauge over ezgif-5-cb56986bc7.gif (embedded via board_build.embed_files)
- swipe-left menu: scan, OBD-like adapters first, tap to select; adapter
  remembered in NVS, auto-connect at boot and reconnect every 3 s
- ELM327 init ATZ/ATE0/ATL0/ATS0/ATH0/ATSP0/0100, then 010D polling
- shared ini: -DLV_LVGL_H_INCLUDE_SIMPLE for generated fonts

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-23 16:49:37 +02:00
patriandClaude Opus 5.5 9e9c0fac68 Remove 2024 BT-Classic bridge, ELMulator and WiFi speed sketch
The ELM327 is read directly over BLE now. Docs updated.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-23 16:38:15 +02:00
patriandClaude Opus 5.5 0bd6aef6b5 ELM327 BLE verified in the car: service FFF0, FFF1 notify/write, ELM327 v2.1
Scanner log saved in 11-BLE-Scanner/results; CLAUDE.md updated with the
adapter's GATT layout, replies and supported PIDs 01-20.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-23 14:21:44 +02:00
patriandClaude Opus 5.5 8a84b42a3b Add 11-BLE-Scanner: on-screen BLE scanner, inspector and ELM327 test
- NimBLE-Arduino 2.5.1, BLE work in a background task on core 0
- LVGL 9 UI for the round screen: device list (OBD-like devices in green),
  tap to list services/characteristics, ELM test (ATZ/ATE0/ATI/ATRV/0100)
- results saved to LittleFS /ble_log.txt; serial d/c/s commands
- shared lv_conf: Montserrat 16 and 20 enabled

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-23 01:54:36 +02:00
patriandClaude Opus 5.5 71d4bf7b58 display_gif_sd: load GIF from SD into PSRAM once, play from memory (9.8 -> 15.4 fps)
Also enable a 16 KB LVGL stdio read cache (no measurable effect for the GIF).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-23 01:43:31 +02:00
patriandClaude Opus 5.5 55e27b6572 Port display_gif_sd and display_speed_wifi to LVGL 9.6 + shared library
- both use shared/jc3636w518.ini, board library and perf monitor
- GIF decoded in the display color format, loop delay 1 ms,
  per-loop memory prints removed
- lv_conf: LVGL drive A: = SD card via LV_USE_FS_STDIO (/sdcard/)
- shared/README.md, CLAUDE.md and project README updated

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-23 01:37:29 +02:00
114 changed files with 87083 additions and 5853 deletions

No files matched your search

+3
View File
@@ -4,3 +4,6 @@
.vscode/c_cpp_properties.json .vscode/c_cpp_properties.json
.vscode/launch.json .vscode/launch.json
.vscode/ipch .vscode/ipch
# generated by tools/gif_to_360.py (copy to the SD card, regenerate any time)
12-OBD-Speed/sd/
+22
View File
@@ -0,0 +1,22 @@
# GIF tests
GIF playback experiments on the JC3636W518 (originally part of the 2024 OBD display attempt; renamed 2026-10-23).
Used to find the fastest GIF setup — results are in `../shared/README.md` and `../CLAUDE.md`.
## Projects (PlatformIO, LVGL 9.6.0, shared library in `../shared`)
| Folder | What it does |
|---|---|
| `display_gif_embedded/` | `loligod.gif` compiled into firmware (`src/loligod.c`, 2.2 MB GIF → 3.5 MB firmware, `default_16MB.csv`). Plays at full GIF speed (~23.8 fps, 53 % CPU). Starts without SD card. |
| `display_gif_sd/` | `wallpaper.gif` from the SD card, loaded into PSRAM once and played from memory (~15 fps for the current file). |
| `assets/gifs/` | GIF files (`dump/` = unused collection) |
## Build / upload
```
pio run -d display_gif_embedded -t upload # flash (COM21)
pio device monitor -d display_gif_embedded # serial: FPS / refresh / other / CPU once per second
```
(`pio` = `%USERPROFILE%\.platformio\penv\Scripts\pio.exe` if not on PATH.)
## Notes
- `display_gif_embedded/src/montserrat_100.c` (100 px digits font, 1 bpp) is present but not used.
- `display_gif_sd` returns early in `setup()` if the SD card fails to mount (black screen).
File renamed without changes.

Before

Width:  |  Height:  |  Size: 1.6 MiB

After

Width:  |  Height:  |  Size: 1.6 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.9 MiB

File renamed without changes.

Before

Width:  |  Height:  |  Size: 3.0 MiB

After

Width:  |  Height:  |  Size: 3.0 MiB

File renamed without changes.

Before

Width:  |  Height:  |  Size: 1.5 MiB

After

Width:  |  Height:  |  Size: 1.5 MiB

File renamed without changes.

Before

Width:  |  Height:  |  Size: 592 KiB

After

Width:  |  Height:  |  Size: 592 KiB

File renamed without changes.

Before

Width:  |  Height:  |  Size: 13 MiB

After

Width:  |  Height:  |  Size: 13 MiB

File renamed without changes.

Before

Width:  |  Height:  |  Size: 1.2 MiB

After

Width:  |  Height:  |  Size: 1.2 MiB

File renamed without changes.

Before

Width:  |  Height:  |  Size: 6.2 MiB

After

Width:  |  Height:  |  Size: 6.2 MiB

File renamed without changes.

Before

Width:  |  Height:  |  Size: 1.6 MiB

After

Width:  |  Height:  |  Size: 1.6 MiB

File renamed without changes.

Before

Width:  |  Height:  |  Size: 455 KiB

After

Width:  |  Height:  |  Size: 455 KiB

File renamed without changes.

Before

Width:  |  Height:  |  Size: 2.1 MiB

After

Width:  |  Height:  |  Size: 2.1 MiB

File renamed without changes.

Before

Width:  |  Height:  |  Size: 757 KiB

After

Width:  |  Height:  |  Size: 757 KiB

@@ -0,0 +1,10 @@
; GIF from the SD card (A:wallpaper.gif) — JC3636W518, common settings in shared/jc3636w518.ini
[platformio]
extra_configs = ../../shared/jc3636w518.ini
[shared]
dir = ../../shared
[env:jc3636w518]
extends = jc3636w518
@@ -1,5 +1,6 @@
#include <Arduino.h> #include <Arduino.h>
#include "scr_st77916.h" #include "jc3636w518.h"
#include "perf_monitor.h"
#include "SD_MMC.h" #include "SD_MMC.h"
void my_print(const char* buf) { void my_print(const char* buf) {
@@ -9,7 +10,10 @@ void my_print(const char* buf) {
void display_animation() { void display_animation() {
lv_obj_t* img; lv_obj_t* img;
img = lv_gif_create(lv_scr_act()); img = lv_gif_create(lv_screen_active());
// shown on a plain black screen: no transparency needed, so decode straight into the display's
// color format (no alpha blending, no conversion) to save CPU
lv_gif_set_color_format(img, lv_display_get_color_format(lv_display_get_default()));
Serial.print("Available Heap before: "); Serial.print("Available Heap before: ");
Serial.println(esp_get_free_heap_size()); Serial.println(esp_get_free_heap_size());
@@ -18,14 +22,26 @@ void display_animation() {
lv_mem_monitor(&mem_mon); lv_mem_monitor(&mem_mon);
printf("Free memory: %d bytes\n", mem_mon.free_size); printf("Free memory: %d bytes\n", mem_mon.free_size);
lv_fs_file_t file; // Load the whole GIF from the SD card into PSRAM once and play it from memory:
if (lv_fs_open(&file, "A:wallpaper.gif", LV_FS_MODE_RD) == LV_FS_RES_OK) { // no SD access while playing (faster, and kinder to flaky cards)
lv_fs_close(&file); // File exists, proceed with loading static lv_image_dsc_t gif_dsc;
lv_gif_set_src(img, "A:wallpaper.gif"); File f = SD_MMC.open("/wallpaper.gif");
Serial.println("GIF Loaded Successfully"); size_t size = f ? f.size() : 0;
uint8_t* data = size ? (uint8_t*)ps_malloc(size) : NULL;
if (data && f.read(data, size) == size) {
gif_dsc.header.magic = LV_IMAGE_HEADER_MAGIC;
gif_dsc.header.cf = LV_COLOR_FORMAT_RAW;
gif_dsc.header.w = data[6] | (data[7] << 8); // GIF logical screen size
gif_dsc.header.h = data[8] | (data[9] << 8);
gif_dsc.data_size = size;
gif_dsc.data = data;
lv_gif_set_src(img, &gif_dsc);
Serial.printf("GIF loaded into PSRAM: %u bytes, %u x %u\n", size, gif_dsc.header.w, gif_dsc.header.h);
} else { } else {
Serial.println("Failed to Load GIF: File not found or inaccessible"); Serial.println("Failed to load /wallpaper.gif from the SD card");
free(data);
} }
if (f) f.close();
Serial.print("Available Heap after: "); Serial.print("Available Heap after: ");
Serial.println(esp_get_free_heap_size()); Serial.println(esp_get_free_heap_size());
@@ -54,7 +70,7 @@ void display_text() {
// lv_style_set_shadow_ofs_x(&style_text, 0); // lv_style_set_shadow_ofs_x(&style_text, 0);
// lv_style_set_shadow_ofs_y(&style_text, 0); // lv_style_set_shadow_ofs_y(&style_text, 0);
lv_obj_t* label1 = lv_label_create(lv_scr_act()); lv_obj_t* label1 = lv_label_create(lv_screen_active());
// Apply the style to the label // Apply the style to the label
lv_obj_add_style(label1, &style_text, LV_PART_MAIN); lv_obj_add_style(label1, &style_text, LV_PART_MAIN);
@@ -70,14 +86,13 @@ void display_text() {
void setup() { void setup() {
delay(200); delay(200);
Serial.begin(115200); Serial.begin(115200);
scr_lvgl_init(); lv_display_t* disp = scr_lvgl_init();
perf_monitor_begin(disp);
lv_init();
//lv_log_register_print_cb(my_print); // Register print function for LVGL logs //lv_log_register_print_cb(my_print); // Register print function for LVGL logs
// Get the active screen (root object for the display) // Get the active screen (root object for the display)
lv_obj_t* screen = lv_scr_act(); lv_obj_t* screen = lv_screen_active();
// Set the background color of the entire screen to black // Set the background color of the entire screen to black
lv_obj_set_style_bg_color(screen, lv_color_black(), 0); // 0 is the part ID for the main part lv_obj_set_style_bg_color(screen, lv_color_black(), 0); // 0 is the part ID for the main part
@@ -105,13 +120,7 @@ void setup() {
} }
void loop() { void loop() {
lv_timer_handler(); perf_timer_handler();
vTaskDelay(5); vTaskDelay(1);
perf_monitor_print();
lv_mem_monitor_t mem_mon;
lv_mem_monitor(&mem_mon);
printf("Free memory: %d bytes\n", mem_mon.free_size);
Serial.print("Available Heap: ");
Serial.println(esp_get_free_heap_size());
} }
-44
View File
@@ -1,44 +0,0 @@
# OBD Display (2024 experiments)
Earlier attempt to show car speed from an ELM327 OBD-II adapter on the JC3636W518.
Because the ESP32-S3 has no Bluetooth Classic, the design used a second (classic) ESP32 as a bridge:
```
ELM327 --(BT Classic SPP)--> classic ESP32 (elm327_wifi_bridge) --(WiFi AP, HTTP /speed)--> JC3636W518 (display_speed_wifi)
```
Split out of `2-Program Example/Demo_Arduino/ST77916_LVGL_DEMO/` on 2026-10-22 and converted to PlatformIO. History is in git.
## Projects (all PlatformIO)
| Folder | Runs on | What it does | Was |
|---|---|---|---|
| `display_speed_wifi/` | JC3636W518 | GIF background from SD (`A:wallpaper.gif`) + joins AP `ESP32-Access-Point`, polls `http://192.168.4.1/speed`, shows it in a label | `ST77916_LVGL_DEMO/8.4/` |
| `display_gif_sd/` | JC3636W518 | GIF from SD (`A:wallpaper.gif`) + static text label | `ST77916_LVGL_DEMO/working version/` |
| `display_gif_embedded/` | JC3636W518 | GIF compiled into firmware (`src/loligod.c`, 2.2 MB GIF → 3.4 MB firmware, uses `default_16MB.csv` with 6.25 MB app slots). **LVGL 9.6.0**, plays at full GIF speed (~23.4 fps), prints FPS once per second. GIF starts without SD card. WiFi code commented out. | `ST77916_LVGL_DEMO/` (top level) |
| `elm327_wifi_bridge/` | **classic ESP32** (not S3) | BT Classic → ELM327 named `OBDII` (PIN 1234), WiFi AP `ESP32-Access-Point` / `123456789`, serves `/speed` (kph) | `ST77916_LVGL_DEMO/esp23_elm327_to_wifi/` |
| `elmulator/` | classic ESP32 | Fake ELM327 for testing without a car. Library in `lib/ELMulator`, envs `simple`, `custom`, `wifi` (BT name `OBDII`) | `ST77916_LVGL_DEMO/ELMulator-master/` |
| `assets/gifs/` | — | GIF files (`dump/` = unused collection) | `ST77916_LVGL_DEMO/gifs/` |
| `_archive/lvgl9_broken/` | — | Unfinished LVGL 9 port, does not compile, not converted | `ST77916_LVGL_DEMO/9.1/` |
## Build / upload
Open a project folder in VS Code with the PlatformIO extension, or from a terminal:
```
pio run -d display_speed_wifi # build
pio run -d display_speed_wifi -t upload # flash (COM21)
pio device monitor -d display_speed_wifi # serial monitor
pio run -d elmulator -e wifi -t upload --upload-port COMxx
```
(`pio` = `%USERPROFILE%\.platformio\penv\Scripts\pio.exe` if not on PATH.)
## Configuration
- **JC3636W518 projects:** pioarduino platform `51.03.05` (= Arduino core 3.0.5), board `esp32-s3-devkitc-1` with 16 MB QIO flash, OPI PSRAM, `huge_app.csv` (3 MB app), USB-CDC on boot, COM21.
Libraries come from the vendor folder via `lib_extra_dirs = ../../2-Program Example/Demo_Arduino/library`.
Each project uses its **own `include/lv_conf.h`** (`-DLV_CONF_INCLUDE_SIMPLE -Iinclude`):
- `display_speed_wifi`: LVGL heap 4 MB in PSRAM (`ps_malloc`)
- `display_gif_sd`: LVGL heap 7 MB in PSRAM
- **Classic ESP32 projects:** official `espressif32@6.10.0` (Arduino core 2.0.17), board `esp32dev`, `huge_app.csv`. Set `upload_port` to the classic ESP32's COM port.
Bridge libraries: `powerbroker2/ELMduino@3.4.1`, `esphome/ESPAsyncWebServer-esphome@3.4.0`.
## Notes
- `src/montserrat_100.c` (100 px digits font) is present but not referenced by any sketch yet.
- SD-based GIFs use LVGL drive `A:` = `LV_USE_FS_FATFS` (reads through ESP-IDF FatFS on the SD_MMC mount). Not yet verified on hardware.
Binary file not shown.

Before

Width:  |  Height:  |  Size: 17 KiB

@@ -1,713 +0,0 @@
/**
* @file lv_conf.h
* Configuration file for v8.3.0-dev
*/
/*
* Copy this file as `lv_conf.h`
* 1. simply next to the `lvgl` folder
* 2. or any other places and
* - define `LV_CONF_INCLUDE_SIMPLE`
* - add the path as include path
*/
/* clang-format off */
#if 1 /*Set it to "1" to enable content*/
#ifndef LV_CONF_H
#define LV_CONF_H
#include <stdint.h>
/*====================
COLOR SETTINGS
*====================*/
/*Color depth: 1 (1 byte per pixel), 8 (RGB332), 16 (RGB565), 32 (ARGB8888)*/
#define LV_COLOR_DEPTH 16
/*Swap the 2 bytes of RGB565 color. Useful if the display has an 8-bit interface (e.g. SPI)*/
#define LV_COLOR_16_SWAP 1
/*Enable more complex drawing routines to manage screens transparency.
*Can be used if the UI is above another layer, e.g. an OSD menu or video player.
*Requires `LV_COLOR_DEPTH = 32` colors and the screen's `bg_opa` should be set to non LV_OPA_COVER value*/
#define LV_COLOR_SCREEN_TRANSP 0
/* Adjust color mix functions rounding. GPUs might calculate color mix (blending) differently.
* 0: round down, 64: round up from x.75, 128: round up from half, 192: round up from x.25, 254: round up */
#define LV_COLOR_MIX_ROUND_OFS (LV_COLOR_DEPTH == 32 ? 0: 128)
/*Images pixels with this color will not be drawn if they are chroma keyed)*/
#define LV_COLOR_CHROMA_KEY lv_color_hex(0x00ff00) /*pure green*/
/*=========================
MEMORY SETTINGS
*=========================*/
/*1: use custom malloc/free, 0: use the built-in `lv_mem_alloc()` and `lv_mem_free()`*/
#define LV_MEM_CUSTOM 0
#if LV_MEM_CUSTOM == 0
/*Size of the memory available for `lv_mem_alloc()` in bytes (>= 2kB)*/
// #define LV_MEM_SIZE (48U * 1024U) /*[bytes]*/
#define LV_MEM_SIZE (1024U * 1024U * 7u) // 4 * 1 MB
/*Set an address for the memory pool instead of allocating it as a normal array. Can be in external SRAM too.*/
#define LV_MEM_ADR 0 /*0: unused*/
/*Instead of an address give a memory allocator that will be called to get a memory pool for LVGL. E.g. my_malloc*/
#if LV_MEM_ADR == 0
//#define LV_MEM_POOL_INCLUDE your_alloc_library /* Uncomment if using an external allocator*/
//#define LV_MEM_POOL_ALLOC your_alloc /* Uncomment if using an external allocator*/
#define LV_MEM_POOL_INCLUDE <esp32-hal-psram.h>
#define LV_MEM_POOL_ALLOC ps_malloc
#endif
#else /*LV_MEM_CUSTOM*/
// #define LV_MEM_CUSTOM_INCLUDE <stdlib.h> /*Header for the dynamic memory function*/
// #define LV_MEM_CUSTOM_ALLOC malloc
// #define LV_MEM_CUSTOM_FREE free
// #define LV_MEM_CUSTOM_REALLOC realloc
#define LV_MEM_CUSTOM_INCLUDE <esp32-hal-psram.h>
#define LV_MEM_CUSTOM_ALLOC ps_malloc
#define LV_MEM_CUSTOM_FREE free
#define LV_MEM_CUSTOM_REALLOC ps_realloc
#endif /*LV_MEM_CUSTOM*/
/*Number of the intermediate memory buffer used during rendering and other internal processing mechanisms.
*You will see an error log message if there wasn't enough buffers. */
// #define LV_MEM_BUF_MAX_NUM 16
#define LV_MEM_BUF_MAX_NUM 100
/*Use the standard `memcpy` and `memset` instead of LVGL's own functions. (Might or might not be faster).*/
#define LV_MEMCPY_MEMSET_STD 0
/*====================
HAL SETTINGS
*====================*/
/*Default display refresh period. LVG will redraw changed areas with this period time*/
#define LV_DISP_DEF_REFR_PERIOD 15 /*[ms]*/ //15
/*Input device read period in milliseconds*/
#define LV_INDEV_DEF_READ_PERIOD 30 /*[ms]*///30
/*Use a custom tick source that tells the elapsed time in milliseconds.
*It removes the need to manually update the tick with `lv_tick_inc()`)*/
#define LV_TICK_CUSTOM 1
#if LV_TICK_CUSTOM
#define LV_TICK_CUSTOM_INCLUDE "Arduino.h" /*Header for the system time function*/
#define LV_TICK_CUSTOM_SYS_TIME_EXPR (millis()) /*Expression evaluating to current system time in ms*/
#endif /*LV_TICK_CUSTOM*/
/*Default Dot Per Inch. Used to initialize default sizes such as widgets sized, style paddings.
*(Not so important, you can adjust it to modify default sizes and spaces)*/
#define LV_DPI_DEF 130 /*[px/inch]*/
/*=======================
* FEATURE CONFIGURATION
*=======================*/
/*-------------
* Drawing
*-----------*/
/*Enable complex draw engine.
*Required to draw shadow, gradient, rounded corners, circles, arc, skew lines, image transformations or any masks*/
#define LV_DRAW_COMPLEX 1
#if LV_DRAW_COMPLEX != 0
/*Allow buffering some shadow calculation.
*LV_SHADOW_CACHE_SIZE is the max. shadow size to buffer, where shadow size is `shadow_width + radius`
*Caching has LV_SHADOW_CACHE_SIZE^2 RAM cost*/
#define LV_SHADOW_CACHE_SIZE 0
/* Set number of maximally cached circle data.
* The circumference of 1/4 circle are saved for anti-aliasing
* radius * 4 bytes are used per circle (the most often used radiuses are saved)
* 0: to disable caching */
#define LV_CIRCLE_CACHE_SIZE 4
#endif /*LV_DRAW_COMPLEX*/
/*Default image cache size. Image caching keeps the images opened.
*If only the built-in image formats are used there is no real advantage of caching. (I.e. if no new image decoder is added)
*With complex image decoders (e.g. PNG or JPG) caching can save the continuous open/decode of images.
*However the opened images might consume additional RAM.
*0: to disable caching*/
#define LV_IMG_CACHE_DEF_SIZE 50
/*Number of stops allowed per gradient. Increase this to allow more stops.
*This adds (sizeof(lv_color_t) + 1) bytes per additional stop*/
#define LV_GRADIENT_MAX_STOPS 2
/*Default gradient buffer size.
*When LVGL calculates the gradient "maps" it can save them into a cache to avoid calculating them again.
*LV_GRAD_CACHE_DEF_SIZE sets the size of this cache in bytes.
*If the cache is too small the map will be allocated only while it's required for the drawing.
*0 mean no caching.*/
#define LV_GRAD_CACHE_DEF_SIZE 0
/*Allow dithering the gradients (to achieve visual smooth color gradients on limited color depth display)
*LV_DITHER_GRADIENT implies allocating one or two more lines of the object's rendering surface
*The increase in memory consumption is (32 bits * object width) plus 24 bits * object width if using error diffusion */
#define LV_DITHER_GRADIENT 0
#if LV_DITHER_GRADIENT
/*Add support for error diffusion dithering.
*Error diffusion dithering gets a much better visual result, but implies more CPU consumption and memory when drawing.
*The increase in memory consumption is (24 bits * object's width)*/
#define LV_DITHER_ERROR_DIFFUSION 0
#endif
/*Maximum buffer size to allocate for rotation.
*Only used if software rotation is enabled in the display driver.*/
#define LV_DISP_ROT_MAX_BUF (10*1024)
/*-------------
* GPU
*-----------*/
/*Use STM32's DMA2D (aka Chrom Art) GPU*/
#define LV_USE_GPU_STM32_DMA2D 0
#if LV_USE_GPU_STM32_DMA2D
/*Must be defined to include path of CMSIS header of target processor
e.g. "stm32f769xx.h" or "stm32f429xx.h"*/
#define LV_GPU_DMA2D_CMSIS_INCLUDE
#endif
/*Use NXP's PXP GPU iMX RTxxx platforms*/
#define LV_USE_GPU_NXP_PXP 0
#if LV_USE_GPU_NXP_PXP
/*1: Add default bare metal and FreeRTOS interrupt handling routines for PXP (lv_gpu_nxp_pxp_osa.c)
* and call lv_gpu_nxp_pxp_init() automatically during lv_init(). Note that symbol SDK_OS_FREE_RTOS
* has to be defined in order to use FreeRTOS OSA, otherwise bare-metal implementation is selected.
*0: lv_gpu_nxp_pxp_init() has to be called manually before lv_init()
*/
#define LV_USE_GPU_NXP_PXP_AUTO_INIT 0
#endif
/*Use NXP's VG-Lite GPU iMX RTxxx platforms*/
#define LV_USE_GPU_NXP_VG_LITE 0
/*Use SDL renderer API*/
#define LV_USE_GPU_SDL 0
#if LV_USE_GPU_SDL
#define LV_GPU_SDL_INCLUDE_PATH <SDL2/SDL.h>
/*Texture cache size, 8MB by default*/
#define LV_GPU_SDL_LRU_SIZE (1024 * 1024 * 8)
/*Custom blend mode for mask drawing, disable if you need to link with older SDL2 lib*/
#define LV_GPU_SDL_CUSTOM_BLEND_MODE (SDL_VERSION_ATLEAST(2, 0, 6))
#endif
/*-------------
* Logging
*-----------*/
/*Enable the log module*/
#define LV_USE_LOG 1
#if LV_USE_LOG
/*How important log should be added:
*LV_LOG_LEVEL_TRACE A lot of logs to give detailed information
*LV_LOG_LEVEL_INFO Log important events
*LV_LOG_LEVEL_WARN Log if something unwanted happened but didn't cause a problem
*LV_LOG_LEVEL_ERROR Only critical issue, when the system may fail
*LV_LOG_LEVEL_USER Only logs added by the user
*LV_LOG_LEVEL_NONE Do not log anything*/
#define LV_LOG_LEVEL LV_LOG_LEVEL_INFO
/*1: Print the log with 'printf';
*0: User need to register a callback with `lv_log_register_print_cb()`*/
#define LV_LOG_PRINTF 1
/*Enable/disable LV_LOG_TRACE in modules that produces a huge number of logs*/
#define LV_LOG_TRACE_MEM 1
#define LV_LOG_TRACE_TIMER 1
#define LV_LOG_TRACE_INDEV 1
#define LV_LOG_TRACE_DISP_REFR 1
#define LV_LOG_TRACE_EVENT 1
#define LV_LOG_TRACE_OBJ_CREATE 1
#define LV_LOG_TRACE_LAYOUT 1
#define LV_LOG_TRACE_ANIM 1
#endif /*LV_USE_LOG*/
/*-------------
* Asserts
*-----------*/
/*Enable asserts if an operation is failed or an invalid data is found.
*If LV_USE_LOG is enabled an error message will be printed on failure*/
#define LV_USE_ASSERT_NULL 1 /*Check if the parameter is NULL. (Very fast, recommended)*/
#define LV_USE_ASSERT_MALLOC 1 /*Checks is the memory is successfully allocated or no. (Very fast, recommended)*/
#define LV_USE_ASSERT_STYLE 0 /*Check if the styles are properly initialized. (Very fast, recommended)*/
#define LV_USE_ASSERT_MEM_INTEGRITY 0 /*Check the integrity of `lv_mem` after critical operations. (Slow)*/
#define LV_USE_ASSERT_OBJ 0 /*Check the object's type and existence (e.g. not deleted). (Slow)*/
/*Add a custom handler when assert happens e.g. to restart the MCU*/
#define LV_ASSERT_HANDLER_INCLUDE <stdint.h>
#define LV_ASSERT_HANDLER while(1); /*Halt by default*/
/*-------------
* Others
*-----------*/
/*1: Show CPU usage and FPS count*/
#define LV_USE_PERF_MONITOR 0
#if LV_USE_PERF_MONITOR
#define LV_USE_PERF_MONITOR_POS LV_ALIGN_BOTTOM_RIGHT
#endif
/*1: Show the used memory and the memory fragmentation
* Requires LV_MEM_CUSTOM = 0*/
#define LV_USE_MEM_MONITOR 0
#if LV_USE_MEM_MONITOR
#define LV_USE_MEM_MONITOR_POS LV_ALIGN_BOTTOM_LEFT
#endif
/*1: Draw random colored rectangles over the redrawn areas*/
#define LV_USE_REFR_DEBUG 0
/*Change the built in (v)snprintf functions*/
#define LV_SPRINTF_CUSTOM 0
#if LV_SPRINTF_CUSTOM
#define LV_SPRINTF_INCLUDE <stdio.h>
#define lv_snprintf snprintf
#define lv_vsnprintf vsnprintf
#else /*LV_SPRINTF_CUSTOM*/
#define LV_SPRINTF_USE_FLOAT 0
#endif /*LV_SPRINTF_CUSTOM*/
#define LV_USE_USER_DATA 1
/*Garbage Collector settings
*Used if lvgl is bound to higher level language and the memory is managed by that language*/
#define LV_ENABLE_GC 0
#if LV_ENABLE_GC != 0
#define LV_GC_INCLUDE "gc.h" /*Include Garbage Collector related things*/
#endif /*LV_ENABLE_GC*/
/*=====================
* COMPILER SETTINGS
*====================*/
/*For big endian systems set to 1*/
#define LV_BIG_ENDIAN_SYSTEM 0
/*Define a custom attribute to `lv_tick_inc` function*/
#define LV_ATTRIBUTE_TICK_INC
/*Define a custom attribute to `lv_timer_handler` function*/
#define LV_ATTRIBUTE_TIMER_HANDLER
/*Define a custom attribute to `lv_disp_flush_ready` function*/
#define LV_ATTRIBUTE_FLUSH_READY
/*Required alignment size for buffers*/
#define LV_ATTRIBUTE_MEM_ALIGN_SIZE 1
/*Will be added where memories needs to be aligned (with -Os data might not be aligned to boundary by default).
* E.g. __attribute__((aligned(4)))*/
#define LV_ATTRIBUTE_MEM_ALIGN
/*Attribute to mark large constant arrays for example font's bitmaps*/
#define LV_ATTRIBUTE_LARGE_CONST
/*Compiler prefix for a big array declaration in RAM*/
#define LV_ATTRIBUTE_LARGE_RAM_ARRAY
/*Place performance critical functions into a faster memory (e.g RAM)*/
#define LV_ATTRIBUTE_FAST_MEM
/*Prefix variables that are used in GPU accelerated operations, often these need to be placed in RAM sections that are DMA accessible*/
#define LV_ATTRIBUTE_DMA
/*Export integer constant to binding. This macro is used with constants in the form of LV_<CONST> that
*should also appear on LVGL binding API such as Micropython.*/
#define LV_EXPORT_CONST_INT(int_value) struct _silence_gcc_warning /*The default value just prevents GCC warning*/
/*Extend the default -32k..32k coordinate range to -4M..4M by using int32_t for coordinates instead of int16_t*/
#define LV_USE_LARGE_COORD 0
/*==================
* FONT USAGE
*===================*/
/*Montserrat fonts with ASCII range and some symbols using bpp = 4
*https://fonts.google.com/specimen/Montserrat*/
#define LV_FONT_MONTSERRAT_8 0
#define LV_FONT_MONTSERRAT_10 0
#define LV_FONT_MONTSERRAT_12 0
#define LV_FONT_MONTSERRAT_14 0
#define LV_FONT_MONTSERRAT_16 0
#define LV_FONT_MONTSERRAT_18 0
#define LV_FONT_MONTSERRAT_20 0
#define LV_FONT_MONTSERRAT_22 0
#define LV_FONT_MONTSERRAT_24 0
#define LV_FONT_MONTSERRAT_26 0
#define LV_FONT_MONTSERRAT_28 0
#define LV_FONT_MONTSERRAT_30 0
#define LV_FONT_MONTSERRAT_32 0
#define LV_FONT_MONTSERRAT_34 0
#define LV_FONT_MONTSERRAT_36 0
#define LV_FONT_MONTSERRAT_38 0
#define LV_FONT_MONTSERRAT_40 0
#define LV_FONT_MONTSERRAT_42 0
#define LV_FONT_MONTSERRAT_44 0
#define LV_FONT_MONTSERRAT_46 0
#define LV_FONT_MONTSERRAT_48 1
/*Demonstrate special features*/
#define LV_FONT_MONTSERRAT_12_SUBPX 0
#define LV_FONT_MONTSERRAT_28_COMPRESSED 0 /*bpp = 3*/
#define LV_FONT_DEJAVU_16_PERSIAN_HEBREW 0 /*Hebrew, Arabic, Persian letters and all their forms*/
#define LV_FONT_SIMSUN_16_CJK 0 /*1000 most common CJK radicals*/
/*Pixel perfect monospace fonts*/
#define LV_FONT_UNSCII_8 0
#define LV_FONT_UNSCII_16 0
/*Optionally declare custom fonts here.
*You can use these fonts as default font too and they will be available globally.
*E.g. #define LV_FONT_CUSTOM_DECLARE LV_FONT_DECLARE(my_font_1) LV_FONT_DECLARE(my_font_2)*/
#define LV_FONT_CUSTOM_DECLARE
/*Always set a default font*/
#define LV_FONT_DEFAULT &lv_font_montserrat_48
/*Enable handling large font and/or fonts with a lot of characters.
*The limit depends on the font size, font face and bpp.
*Compiler error will be triggered if a font needs it.*/
#define LV_FONT_FMT_TXT_LARGE 0
/*Enables/disables support for compressed fonts.*/
#define LV_USE_FONT_COMPRESSED 0
/*Enable subpixel rendering*/
#define LV_USE_FONT_SUBPX 0
#if LV_USE_FONT_SUBPX
/*Set the pixel order of the display. Physical order of RGB channels. Doesn't matter with "normal" fonts.*/
#define LV_FONT_SUBPX_BGR 0 /*0: RGB; 1:BGR order*/
#endif
/*=================
* TEXT SETTINGS
*=================*/
/**
* Select a character encoding for strings.
* Your IDE or editor should have the same character encoding
* - LV_TXT_ENC_UTF8
* - LV_TXT_ENC_ASCII
*/
#define LV_TXT_ENC LV_TXT_ENC_UTF8
/*Can break (wrap) texts on these chars*/
#define LV_TXT_BREAK_CHARS " ,.;:-_"
/*If a word is at least this long, will break wherever "prettiest"
*To disable, set to a value <= 0*/
#define LV_TXT_LINE_BREAK_LONG_LEN 0
/*Minimum number of characters in a long word to put on a line before a break.
*Depends on LV_TXT_LINE_BREAK_LONG_LEN.*/
#define LV_TXT_LINE_BREAK_LONG_PRE_MIN_LEN 3
/*Minimum number of characters in a long word to put on a line after a break.
*Depends on LV_TXT_LINE_BREAK_LONG_LEN.*/
#define LV_TXT_LINE_BREAK_LONG_POST_MIN_LEN 3
/*The control character to use for signalling text recoloring.*/
#define LV_TXT_COLOR_CMD "#"
/*Support bidirectional texts. Allows mixing Left-to-Right and Right-to-Left texts.
*The direction will be processed according to the Unicode Bidirectional Algorithm:
*https://www.w3.org/International/articles/inline-bidi-markup/uba-basics*/
#define LV_USE_BIDI 0
#if LV_USE_BIDI
/*Set the default direction. Supported values:
*`LV_BASE_DIR_LTR` Left-to-Right
*`LV_BASE_DIR_RTL` Right-to-Left
*`LV_BASE_DIR_AUTO` detect texts base direction*/
#define LV_BIDI_BASE_DIR_DEF LV_BASE_DIR_AUTO
#endif
/*Enable Arabic/Persian processing
*In these languages characters should be replaced with an other form based on their position in the text*/
#define LV_USE_ARABIC_PERSIAN_CHARS 0
/*==================
* WIDGET USAGE
*================*/
/*Documentation of the widgets: https://docs.lvgl.io/latest/en/html/widgets/index.html*/
#define LV_USE_ARC 1
#define LV_USE_ANIMIMG 1
#define LV_USE_BAR 1
#define LV_USE_BTN 1
#define LV_USE_BTNMATRIX 1
#define LV_USE_CANVAS 1
#define LV_USE_CHECKBOX 1
#define LV_USE_DROPDOWN 1 /*Requires: lv_label*/
#define LV_USE_IMG 1 /*Requires: lv_label*/
#define LV_USE_LABEL 1
#if LV_USE_LABEL
#define LV_LABEL_TEXT_SELECTION 1 /*Enable selecting text of the label*/
#define LV_LABEL_LONG_TXT_HINT 1 /*Store some extra info in labels to speed up drawing of very long texts*/
#endif
#define LV_USE_LINE 1
#define LV_USE_ROLLER 1 /*Requires: lv_label*/
#if LV_USE_ROLLER
#define LV_ROLLER_INF_PAGES 7 /*Number of extra "pages" when the roller is infinite*/
#endif
#define LV_USE_SLIDER 1 /*Requires: lv_bar*/
#define LV_USE_SWITCH 1
#define LV_USE_TEXTAREA 1 /*Requires: lv_label*/
#if LV_USE_TEXTAREA != 0
#define LV_TEXTAREA_DEF_PWD_SHOW_TIME 1500 /*ms*/
#endif
#define LV_USE_TABLE 1
/*==================
* EXTRA COMPONENTS
*==================*/
/*-----------
* Widgets
*----------*/
#define LV_USE_CALENDAR 1
#if LV_USE_CALENDAR
#define LV_CALENDAR_WEEK_STARTS_MONDAY 0
#if LV_CALENDAR_WEEK_STARTS_MONDAY
#define LV_CALENDAR_DEFAULT_DAY_NAMES {"Mo", "Tu", "We", "Th", "Fr", "Sa", "Su"}
#else
#define LV_CALENDAR_DEFAULT_DAY_NAMES {"Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"}
#endif
#define LV_CALENDAR_DEFAULT_MONTH_NAMES {"January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"}
#define LV_USE_CALENDAR_HEADER_ARROW 1
#define LV_USE_CALENDAR_HEADER_DROPDOWN 1
#endif /*LV_USE_CALENDAR*/
#define LV_USE_CHART 1
#define LV_USE_COLORWHEEL 1
#define LV_USE_IMGBTN 1
#define LV_USE_KEYBOARD 1
#define LV_USE_LED 1
#define LV_USE_LIST 1
#define LV_USE_MENU 1
#define LV_USE_METER 1
#define LV_USE_MSGBOX 1
#define LV_USE_SPINBOX 1
#define LV_USE_SPINNER 1
#define LV_USE_TABVIEW 1
#define LV_USE_TILEVIEW 1
#define LV_USE_WIN 1
#define LV_USE_SPAN 1
#if LV_USE_SPAN
/*A line text can contain maximum num of span descriptor */
#define LV_SPAN_SNIPPET_STACK_SIZE 64
#endif
/*-----------
* Themes
*----------*/
/*A simple, impressive and very complete theme*/
#define LV_USE_THEME_DEFAULT 1
#if LV_USE_THEME_DEFAULT
/*0: Light mode; 1: Dark mode*/
#define LV_THEME_DEFAULT_DARK 0
/*1: Enable grow on press*/
#define LV_THEME_DEFAULT_GROW 1
/*Default transition time in [ms]*/
#define LV_THEME_DEFAULT_TRANSITION_TIME 80
#endif /*LV_USE_THEME_DEFAULT*/
/*A very simple theme that is a good starting point for a custom theme*/
#define LV_USE_THEME_BASIC 1
/*A theme designed for monochrome displays*/
#define LV_USE_THEME_MONO 1
/*-----------
* Layouts
*----------*/
/*A layout similar to Flexbox in CSS.*/
#define LV_USE_FLEX 1
/*A layout similar to Grid in CSS.*/
#define LV_USE_GRID 1
/*---------------------
* 3rd party libraries
*--------------------*/
/*File system interfaces for common APIs */
/*API for fopen, fread, etc*/
#define LV_USE_FS_STDIO 0
#if LV_USE_FS_STDIO
#define LV_FS_STDIO_LETTER '\0' /*Set an upper cased letter on which the drive will accessible (e.g. 'A')*/
#define LV_FS_STDIO_PATH "" /*Set the working directory. File/directory paths will be appended to it.*/
#define LV_FS_STDIO_CACHE_SIZE 0 /*>0 to cache this number of bytes in lv_fs_read()*/
#endif
/*API for open, read, etc*/
#define LV_USE_FS_POSIX 0
#if LV_USE_FS_POSIX
#define LV_FS_POSIX_LETTER '\0' /*Set an upper cased letter on which the drive will accessible (e.g. 'A')*/
#define LV_FS_POSIX_PATH "" /*Set the working directory. File/directory paths will be appended to it.*/
#define LV_FS_POSIX_CACHE_SIZE 0 /*>0 to cache this number of bytes in lv_fs_read()*/
#endif
/*API for CreateFile, ReadFile, etc*/
#define LV_USE_FS_WIN32 0
#if LV_USE_FS_WIN32
#define LV_FS_WIN32_LETTER '\0' /*Set an upper cased letter on which the drive will accessible (e.g. 'A')*/
#define LV_FS_WIN32_PATH "" /*Set the working directory. File/directory paths will be appended to it.*/
#define LV_FS_WIN32_CACHE_SIZE 0 /*>0 to cache this number of bytes in lv_fs_read()*/
#endif
/*API for FATFS (needs to be added separately). Uses f_open, f_read, etc*/
#include <ff.h> // You can put this at the top of the header file
typedef FF_DIR DIR; // Add this line
#define LV_USE_FS_FATFS 1
#if LV_USE_FS_FATFS
#define LV_FS_FATFS_LETTER 'A' /*Set an upper cased letter on which the drive will accessible (e.g. 'A')*/
#define LV_FS_FATFS_CACHE_SIZE 0 /*>0 to cache this number of bytes in lv_fs_read()*/
#endif
/*PNG decoder library*/
#define LV_USE_PNG 1
/*BMP decoder library*/
#define LV_USE_BMP 1
/* JPG + split JPG decoder library.
* Split JPG is a custom format optimized for embedded systems. */
#define LV_USE_SJPG 1
/*GIF decoder library*/
#define LV_USE_GIF 1
/*QR code library*/
#define LV_USE_QRCODE 0
/*FreeType library*/
#define LV_USE_FREETYPE 0
#if LV_USE_FREETYPE
/*Memory used by FreeType to cache characters [bytes] (-1: no caching)*/
#define LV_FREETYPE_CACHE_SIZE (16 * 1024)
#if LV_FREETYPE_CACHE_SIZE >= 0
/* 1: bitmap cache use the sbit cache, 0:bitmap cache use the image cache. */
/* sbit cache:it is much more memory efficient for small bitmaps(font size < 256) */
/* if font size >= 256, must be configured as image cache */
#define LV_FREETYPE_SBIT_CACHE 0
/* Maximum number of opened FT_Face/FT_Size objects managed by this cache instance. */
/* (0:use system defaults) */
#define LV_FREETYPE_CACHE_FT_FACES 0
#define LV_FREETYPE_CACHE_FT_SIZES 0
#endif
#endif
/*Rlottie library*/
#define LV_USE_RLOTTIE 0
/*FFmpeg library for image decoding and playing videos
*Supports all major image formats so do not enable other image decoder with it*/
#define LV_USE_FFMPEG 0
#if LV_USE_FFMPEG
/*Dump input information to stderr*/
#define LV_FFMPEG_AV_DUMP_FORMAT 0
#endif
/*-----------
* Others
*----------*/
/*1: Enable API to take snapshot for object*/
#define LV_USE_SNAPSHOT 0
/*1: Enable Monkey test*/
#define LV_USE_MONKEY 0
/*1: Enable grid navigation*/
#define LV_USE_GRIDNAV 0
/*1: Enable lv_obj fragment*/
#define LV_USE_FRAGMENT 0
/*==================
* EXAMPLES
*==================*/
/*Enable the examples to be built with the library*/
#define LV_BUILD_EXAMPLES 0
/*===================
* DEMO USAGE
====================*/
/*Show some widget. It might be required to increase `LV_MEM_SIZE` */
#define LV_USE_DEMO_WIDGETS 0
#if LV_USE_DEMO_WIDGETS
#define LV_DEMO_WIDGETS_SLIDESHOW 0
#endif
/*Demonstrate the usage of encoder and keyboard*/
#define LV_USE_DEMO_KEYPAD_AND_ENCODER 0
/*Benchmark your system*/
#define LV_USE_DEMO_BENCHMARK 0
/*Stress test for LVGL*/
#define LV_USE_DEMO_STRESS 0
/*Music player demo*/
#define LV_USE_DEMO_MUSIC 0
#if LV_USE_DEMO_MUSIC
# define LV_DEMO_MUSIC_SQUARE 1
# define LV_DEMO_MUSIC_LANDSCAPE 1
# define LV_DEMO_MUSIC_ROUND 1
# define LV_DEMO_MUSIC_LARGE 1
# define LV_DEMO_MUSIC_AUTO_PLAY 1
#endif
/*--END OF LV_CONF_H--*/
#endif /*LV_CONF_H*/
#endif /*End of "Content enable"*/
@@ -1,38 +0,0 @@
#ifndef _PINCFG_H_
#define _PINCFG_H_
#define TFT_BLK 15
#define TFT_RST 47
#define TFT_CS 10
#define TFT_SCK 9
#define TFT_SDA0 11
#define TFT_SDA1 12
#define TFT_SDA2 13
#define TFT_SDA3 14
#define BTN_PIN 0
#define TOUCH_PIN_NUM_I2C_SCL 8
#define TOUCH_PIN_NUM_I2C_SDA 7
#define TOUCH_PIN_NUM_INT 41
#define TOUCH_PIN_NUM_RST 40
#define SD_MMC_D0_PIN 2
#define SD_MMC_D1_PIN 1
#define SD_MMC_D2_PIN 6
#define SD_MMC_D3_PIN 5
#define SD_MMC_CLK_PIN 3
#define SD_MMC_CMD_PIN 4
#define AUDIO_I2S_MCK_IO -1 // MCK
#define AUDIO_I2S_BCK_IO 18 // BCK
#define AUDIO_I2S_WS_IO 16 // LCK
#define AUDIO_I2S_DO_IO 17 // DIN
#define AUDIO_MUTE_PIN 48 // 低电平静音
#define MIC_I2S_WS 45
#define MIC_I2S_SD 46
#define MIC_I2S_SCK 42
#endif
@@ -1,439 +0,0 @@
#ifndef _SCR_ST77916_H_
#define _SCR_ST77916_H_
#include "pincfg.h"
#include <lvgl.h>
#include <ESP_IOExpander.h>
#include <ESP_Panel_Library.h>
#define SCREEN_RES_HOR 360
#define SCREEN_RES_VER 360
static lv_color_t *disp_draw_buf;
static lv_disp_draw_buf_t draw_buf;
static lv_disp_drv_t disp_drv;
static lv_indev_t *indev_touchpad;
static ESP_PanelBacklight *backlight = NULL;
static ESP_PanelLcd *lcd = NULL;
static ESP_PanelTouch *touch = NULL;
#define USE_CUSTOM_INIT_CMD 0 // 是否用自定义的初始化代码
#if TOUCH_PIN_NUM_INT >= 0
IRAM_ATTR bool onTouchInterruptCallback(void *user_data)
{
return false;
}
#endif
const esp_lcd_panel_vendor_init_cmd_t lcd_init_cmd[] = {
{0xF0, (uint8_t[]){0x08}, 1, 0},
{0xF2, (uint8_t[]){0x08}, 1, 0},
{0x9B, (uint8_t[]){0x51}, 1, 0},
{0x86, (uint8_t[]){0x53}, 1, 0},
{0xF2, (uint8_t[]){0x80}, 1, 0},
{0xF0, (uint8_t[]){0x00}, 1, 0},
{0xF0, (uint8_t[]){0x01}, 1, 0},
{0xF1, (uint8_t[]){0x01}, 1, 0},
{0xB0, (uint8_t[]){0x54}, 1, 0},
{0xB1, (uint8_t[]){0x3F}, 1, 0},
{0xB2, (uint8_t[]){0x2A}, 1, 0},
{0xB4, (uint8_t[]){0x46}, 1, 0},
{0xB5, (uint8_t[]){0x34}, 1, 0},
{0xB6, (uint8_t[]){0xD5}, 1, 0},
{0xB7, (uint8_t[]){0x30}, 1, 0},
{0xBA, (uint8_t[]){0x00}, 1, 0},
{0xBB, (uint8_t[]){0x08}, 1, 0},
{0xBC, (uint8_t[]){0x08}, 1, 0},
{0xBD, (uint8_t[]){0x00}, 1, 0},
{0xC0, (uint8_t[]){0x80}, 1, 0},
{0xC1, (uint8_t[]){0x10}, 1, 0},
{0xC2, (uint8_t[]){0x37}, 1, 0},
{0xC3, (uint8_t[]){0x80}, 1, 0},
{0xC4, (uint8_t[]){0x10}, 1, 0},
{0xC5, (uint8_t[]){0x37}, 1, 0},
{0xC6, (uint8_t[]){0xA9}, 1, 0},
{0xC7, (uint8_t[]){0x41}, 1, 0},
{0xC8, (uint8_t[]){0x51}, 1, 0},
{0xC9, (uint8_t[]){0xA9}, 1, 0},
{0xCA, (uint8_t[]){0x41}, 1, 0},
{0xCB, (uint8_t[]){0x51}, 1, 0},
{0xD0, (uint8_t[]){0x91}, 1, 0},
{0xD1, (uint8_t[]){0x68}, 1, 0},
{0xD2, (uint8_t[]){0x69}, 1, 0},
{0xF5, (uint8_t[]){0x00, 0xA5}, 2, 0},
{0xDD, (uint8_t[]){0x3F}, 1, 0},
{0xDE, (uint8_t[]){0x3F}, 1, 0},
{0xF1, (uint8_t[]){0x10}, 1, 0},
{0xF0, (uint8_t[]){0x00}, 1, 0},
{0xF0, (uint8_t[]){0x02}, 1, 0},
{0xE0, (uint8_t[]){0x70, 0x09, 0x12, 0x0C, 0x0B, 0x27, 0x38, 0x54, 0x4E, 0x19, 0x15, 0x15, 0x2C, 0x2F}, 14, 0},
{0xE1, (uint8_t[]){0x70, 0x08, 0x11, 0x0C, 0x0B, 0x27, 0x38, 0x43, 0x4C, 0x18, 0x14, 0x14, 0x2B, 0x2D}, 14, 0},
{0xF0, (uint8_t[]){0x10}, 1, 0},
{0xF3, (uint8_t[]){0x10}, 1, 0},
{0xE0, (uint8_t[]){0x08}, 1, 0},
{0xE1, (uint8_t[]){0x00}, 1, 0},
{0xE2, (uint8_t[]){0x00}, 1, 0},
{0xE3, (uint8_t[]){0x00}, 1, 0},
{0xE4, (uint8_t[]){0xE0}, 1, 0},
{0xE5, (uint8_t[]){0x06}, 1, 0},
{0xE6, (uint8_t[]){0x21}, 1, 0},
{0xE7, (uint8_t[]){0x00}, 1, 0},
{0xE8, (uint8_t[]){0x05}, 1, 0},
{0xE9, (uint8_t[]){0x82}, 1, 0},
{0xEA, (uint8_t[]){0xDF}, 1, 0},
{0xEB, (uint8_t[]){0x89}, 1, 0},
{0xEC, (uint8_t[]){0x20}, 1, 0},
{0xED, (uint8_t[]){0x14}, 1, 0},
{0xEE, (uint8_t[]){0xFF}, 1, 0},
{0xEF, (uint8_t[]){0x00}, 1, 0},
{0xF8, (uint8_t[]){0xFF}, 1, 0},
{0xF9, (uint8_t[]){0x00}, 1, 0},
{0xFA, (uint8_t[]){0x00}, 1, 0},
{0xFB, (uint8_t[]){0x30}, 1, 0},
{0xFC, (uint8_t[]){0x00}, 1, 0},
{0xFD, (uint8_t[]){0x00}, 1, 0},
{0xFE, (uint8_t[]){0x00}, 1, 0},
{0xFF, (uint8_t[]){0x00}, 1, 0},
{0x60, (uint8_t[]){0x42}, 1, 0},
{0x61, (uint8_t[]){0xE0}, 1, 0},
{0x62, (uint8_t[]){0x40}, 1, 0},
{0x63, (uint8_t[]){0x40}, 1, 0},
{0x64, (uint8_t[]){0x02}, 1, 0},
{0x65, (uint8_t[]){0x00}, 1, 0},
{0x66, (uint8_t[]){0x40}, 1, 0},
{0x67, (uint8_t[]){0x03}, 1, 0},
{0x68, (uint8_t[]){0x00}, 1, 0},
{0x69, (uint8_t[]){0x00}, 1, 0},
{0x6A, (uint8_t[]){0x00}, 1, 0},
{0x6B, (uint8_t[]){0x00}, 1, 0},
{0x70, (uint8_t[]){0x42}, 1, 0},
{0x71, (uint8_t[]){0xE0}, 1, 0},
{0x72, (uint8_t[]){0x40}, 1, 0},
{0x73, (uint8_t[]){0x40}, 1, 0},
{0x74, (uint8_t[]){0x02}, 1, 0},
{0x75, (uint8_t[]){0x00}, 1, 0},
{0x76, (uint8_t[]){0x40}, 1, 0},
{0x77, (uint8_t[]){0x03}, 1, 0},
{0x78, (uint8_t[]){0x00}, 1, 0},
{0x79, (uint8_t[]){0x00}, 1, 0},
{0x7A, (uint8_t[]){0x00}, 1, 0},
{0x7B, (uint8_t[]){0x00}, 1, 0},
{0x80, (uint8_t[]){0x48}, 1, 0},
{0x81, (uint8_t[]){0x00}, 1, 0},
{0x82, (uint8_t[]){0x05}, 1, 0},
{0x83, (uint8_t[]){0x02}, 1, 0},
{0x84, (uint8_t[]){0xDD}, 1, 0},
{0x85, (uint8_t[]){0x00}, 1, 0},
{0x86, (uint8_t[]){0x00}, 1, 0},
{0x87, (uint8_t[]){0x00}, 1, 0},
{0x88, (uint8_t[]){0x48}, 1, 0},
{0x89, (uint8_t[]){0x00}, 1, 0},
{0x8A, (uint8_t[]){0x07}, 1, 0},
{0x8B, (uint8_t[]){0x02}, 1, 0},
{0x8C, (uint8_t[]){0xDF}, 1, 0},
{0x8D, (uint8_t[]){0x00}, 1, 0},
{0x8E, (uint8_t[]){0x00}, 1, 0},
{0x8F, (uint8_t[]){0x00}, 1, 0},
{0x90, (uint8_t[]){0x48}, 1, 0},
{0x91, (uint8_t[]){0x00}, 1, 0},
{0x92, (uint8_t[]){0x09}, 1, 0},
{0x93, (uint8_t[]){0x02}, 1, 0},
{0x94, (uint8_t[]){0xE1}, 1, 0},
{0x95, (uint8_t[]){0x00}, 1, 0},
{0x96, (uint8_t[]){0x00}, 1, 0},
{0x97, (uint8_t[]){0x00}, 1, 0},
{0x98, (uint8_t[]){0x48}, 1, 0},
{0x99, (uint8_t[]){0x00}, 1, 0},
{0x9A, (uint8_t[]){0x0B}, 1, 0},
{0x9B, (uint8_t[]){0x02}, 1, 0},
{0x9C, (uint8_t[]){0xE3}, 1, 0},
{0x9D, (uint8_t[]){0x00}, 1, 0},
{0x9E, (uint8_t[]){0x00}, 1, 0},
{0x9F, (uint8_t[]){0x00}, 1, 0},
{0xA0, (uint8_t[]){0x48}, 1, 0},
{0xA1, (uint8_t[]){0x00}, 1, 0},
{0xA2, (uint8_t[]){0x04}, 1, 0},
{0xA3, (uint8_t[]){0x02}, 1, 0},
{0xA4, (uint8_t[]){0xDC}, 1, 0},
{0xA5, (uint8_t[]){0x00}, 1, 0},
{0xA6, (uint8_t[]){0x00}, 1, 0},
{0xA7, (uint8_t[]){0x00}, 1, 0},
{0xA8, (uint8_t[]){0x48}, 1, 0},
{0xA9, (uint8_t[]){0x00}, 1, 0},
{0xAA, (uint8_t[]){0x06}, 1, 0},
{0xAB, (uint8_t[]){0x02}, 1, 0},
{0xAC, (uint8_t[]){0xDE}, 1, 0},
{0xAD, (uint8_t[]){0x00}, 1, 0},
{0xAE, (uint8_t[]){0x00}, 1, 0},
{0xAF, (uint8_t[]){0x00}, 1, 0},
{0xB0, (uint8_t[]){0x48}, 1, 0},
{0xB1, (uint8_t[]){0x00}, 1, 0},
{0xB2, (uint8_t[]){0x08}, 1, 0},
{0xB3, (uint8_t[]){0x02}, 1, 0},
{0xB4, (uint8_t[]){0xE0}, 1, 0},
{0xB5, (uint8_t[]){0x00}, 1, 0},
{0xB6, (uint8_t[]){0x00}, 1, 0},
{0xB7, (uint8_t[]){0x00}, 1, 0},
{0xB8, (uint8_t[]){0x48}, 1, 0},
{0xB9, (uint8_t[]){0x00}, 1, 0},
{0xBA, (uint8_t[]){0x0A}, 1, 0},
{0xBB, (uint8_t[]){0x02}, 1, 0},
{0xBC, (uint8_t[]){0xE2}, 1, 0},
{0xBD, (uint8_t[]){0x00}, 1, 0},
{0xBE, (uint8_t[]){0x00}, 1, 0},
{0xBF, (uint8_t[]){0x00}, 1, 0},
{0xC0, (uint8_t[]){0x12}, 1, 0},
{0xC1, (uint8_t[]){0xAA}, 1, 0},
{0xC2, (uint8_t[]){0x65}, 1, 0},
{0xC3, (uint8_t[]){0x74}, 1, 0},
{0xC4, (uint8_t[]){0x47}, 1, 0},
{0xC5, (uint8_t[]){0x56}, 1, 0},
{0xC6, (uint8_t[]){0x00}, 1, 0},
{0xC7, (uint8_t[]){0x88}, 1, 0},
{0xC8, (uint8_t[]){0x99}, 1, 0},
{0xC9, (uint8_t[]){0x33}, 1, 0},
{0xD0, (uint8_t[]){0x21}, 1, 0},
{0xD1, (uint8_t[]){0xAA}, 1, 0},
{0xD2, (uint8_t[]){0x65}, 1, 0},
{0xD3, (uint8_t[]){0x74}, 1, 0},
{0xD4, (uint8_t[]){0x47}, 1, 0},
{0xD5, (uint8_t[]){0x56}, 1, 0},
{0xD6, (uint8_t[]){0x00}, 1, 0},
{0xD7, (uint8_t[]){0x88}, 1, 0},
{0xD8, (uint8_t[]){0x99}, 1, 0},
{0xD9, (uint8_t[]){0x33}, 1, 0},
{0xF3, (uint8_t[]){0x01}, 1, 0},
{0xF0, (uint8_t[]){0x00}, 1, 0},
{0xF0, (uint8_t[]){0x01}, 1, 0},
{0xF1, (uint8_t[]){0x01}, 1, 0},
{0xA0, (uint8_t[]){0x0B}, 1, 0},
{0xA3, (uint8_t[]){0x2A}, 1, 0},
{0xA5, (uint8_t[]){0xC3}, 1, 1},
{0xA3, (uint8_t[]){0x2B}, 1, 0},
{0xA5, (uint8_t[]){0xC3}, 1, 1},
{0xA3, (uint8_t[]){0x2C}, 1, 0},
{0xA5, (uint8_t[]){0xC3}, 1, 1},
{0xA3, (uint8_t[]){0x2D}, 1, 0},
{0xA5, (uint8_t[]){0xC3}, 1, 1},
{0xA3, (uint8_t[]){0x2E}, 1, 0},
{0xA5, (uint8_t[]){0xC3}, 1, 1},
{0xA3, (uint8_t[]){0x2F}, 1, 0},
{0xA5, (uint8_t[]){0xC3}, 1, 1},
{0xA3, (uint8_t[]){0x30}, 1, 0},
{0xA5, (uint8_t[]){0xC3}, 1, 1},
{0xA3, (uint8_t[]){0x31}, 1, 0},
{0xA5, (uint8_t[]){0xC3}, 1, 1},
{0xA3, (uint8_t[]){0x32}, 1, 0},
{0xA5, (uint8_t[]){0xC3}, 1, 1},
{0xA3, (uint8_t[]){0x33}, 1, 0},
{0xA5, (uint8_t[]){0xC3}, 1, 1},
{0xA0, (uint8_t[]){0x09}, 1, 0},
{0xF1, (uint8_t[]){0x10}, 1, 0},
{0xF0, (uint8_t[]){0x00}, 1, 0},
{0x2A, (uint8_t[]){0x00, 0x00, 0x01, 0x67}, 4, 0},
{0x2B, (uint8_t[]){0x01, 0x68, 0x01, 0x68}, 4, 0},
{0x4D, (uint8_t[]){0x00}, 1, 0},
{0x4E, (uint8_t[]){0x00}, 1, 0},
{0x4F, (uint8_t[]){0x00}, 1, 0},
{0x4C, (uint8_t[]){0x01}, 1, 10},
{0x4C, (uint8_t[]){0x00}, 1, 0},
{0x2A, (uint8_t[]){0x00, 0x00, 0x01, 0x67}, 4, 0},
{0x2B, (uint8_t[]){0x00, 0x00, 0x01, 0x67}, 4, 0},
{0x21, (uint8_t[]){0x00}, 1, 0},
//{0x3A, (uint8_t[]){0x55}, 1, 0}, // color=16
{0x11, (uint8_t[]){0x00}, 1, 120},
{0x29, (uint8_t[]){0x00}, 1, 0},
};
#define TFT_SPI_FREQ_HZ (50 * 1000 * 1000)
static void my_disp_flush(lv_disp_drv_t *disp, const lv_area_t *area, lv_color_t *color_p)
{
ESP_PanelLcd *lcd = (ESP_PanelLcd *)disp->user_data;
const int offsetx1 = area->x1;
const int offsetx2 = area->x2;
const int offsety1 = area->y1;
const int offsety2 = area->y2;
lcd->drawBitmap(offsetx1, offsety1, offsetx2 - offsetx1 + 1, offsety2 - offsety1 + 1, (const uint8_t *)color_p);
}
IRAM_ATTR bool onRefreshFinishCallback(void *user_data)
{
lv_disp_drv_t *drv = (lv_disp_drv_t *)user_data;
lv_disp_flush_ready(drv);
return false;
}
void setRotation(uint8_t rot)
{
if (rot > 3)
return;
if (lcd == NULL || touch == NULL)
return;
switch (rot)
{
case 1: // 顺时针90度
lcd->swapXY(true);
lcd->mirrorX(true);
lcd->mirrorY(false);
touch->swapXY(true);
touch->mirrorX(true);
touch->mirrorY(false);
break;
case 2:
lcd->swapXY(false);
lcd->mirrorX(true);
lcd->mirrorY(true);
touch->swapXY(false);
touch->mirrorX(true);
touch->mirrorY(true);
break;
case 3:
lcd->swapXY(true);
lcd->mirrorX(false);
lcd->mirrorY(true);
touch->swapXY(true);
touch->mirrorX(false);
touch->mirrorY(true);
break;
default:
lcd->swapXY(false);
lcd->mirrorX(false);
lcd->mirrorY(false);
touch->swapXY(false);
touch->mirrorX(false);
touch->mirrorY(false);
break;
}
}
void screen_switch(bool on)
{
if (NULL == backlight)
return;
if (on)
backlight->on();
else
backlight->off();
}
// 输入值为0-100
void set_brightness(uint8_t bri)
{
if (NULL == backlight)
return;
backlight->setBrightness(bri);
}
static void touchpad_read(lv_indev_drv_t *indev_drv, lv_indev_data_t *data)
{
ESP_PanelTouch *tp = (ESP_PanelTouch *)indev_drv->user_data;
ESP_PanelTouchPoint point;
int read_touch_result = tp->readPoints(&point, 1);
if (read_touch_result > 0)
{
data->point.x = point.x;
data->point.y = point.y;
data->state = LV_INDEV_STATE_PRESSED;
}
else
{
data->state = LV_INDEV_STATE_RELEASED;
}
}
static lv_indev_t *indev_init(ESP_PanelTouch *tp)
{
ESP_PANEL_CHECK_FALSE_RET(tp != nullptr, nullptr, "Invalid touch device");
ESP_PANEL_CHECK_FALSE_RET(tp->getHandle() != nullptr, nullptr, "Touch device is not initialized");
static lv_indev_drv_t indev_drv_tp;
lv_indev_drv_init(&indev_drv_tp);
indev_drv_tp.type = LV_INDEV_TYPE_POINTER;
indev_drv_tp.read_cb = touchpad_read;
indev_drv_tp.user_data = (void *)tp;
return lv_indev_drv_register(&indev_drv_tp);
}
void scr_lvgl_init()
{
ledc_timer_config_t ledc_timer = {
.speed_mode = LEDC_LOW_SPEED_MODE,
.duty_resolution = LEDC_TIMER_13_BIT,
.timer_num = LEDC_TIMER_0,
.freq_hz = 5000,
.clk_cfg = LEDC_AUTO_CLK};
ESP_ERROR_CHECK(ledc_timer_config(&ledc_timer));
ledc_channel_config_t ledc_channel = {
.gpio_num = (TFT_BLK),
.speed_mode = LEDC_LOW_SPEED_MODE,
.channel = LEDC_CHANNEL_0,
.intr_type = LEDC_INTR_DISABLE,
.timer_sel = LEDC_TIMER_0,
.duty = 0,
.hpoint = 0};
ESP_ERROR_CHECK(ledc_channel_config(&ledc_channel));
backlight = new ESP_PanelBacklight(ledc_timer, ledc_channel);
backlight->begin();
backlight->off();
ESP_PanelBus_I2C *touch_bus = new ESP_PanelBus_I2C(TOUCH_PIN_NUM_I2C_SCL, TOUCH_PIN_NUM_I2C_SDA, ESP_LCD_TOUCH_IO_I2C_CST816S_CONFIG());
touch_bus->configI2cFreqHz(400000);
touch_bus->begin();
touch = new ESP_PanelTouch_CST816S(touch_bus, SCREEN_RES_HOR, SCREEN_RES_VER, TOUCH_PIN_NUM_RST, TOUCH_PIN_NUM_INT);
touch->init();
touch->begin();
#if TOUCH_PIN_NUM_INT >= 0
touch->attachInterruptCallback(onTouchInterruptCallback, NULL);
#endif
ESP_PanelBus_QSPI *panel_bus = new ESP_PanelBus_QSPI(TFT_CS, TFT_SCK, TFT_SDA0, TFT_SDA1, TFT_SDA2, TFT_SDA3);
panel_bus->configQspiFreqHz(TFT_SPI_FREQ_HZ);
panel_bus->begin();
lcd = new ESP_PanelLcd_ST77916(panel_bus, 16, TFT_RST);
// 注意,初始化代码的设置必须在INIT之前
// lcd->configVendorCommands(lcd_init_cmd, sizeof(lcd_init_cmd) / sizeof(lcd_init_cmd[0]));
lcd->init();
lcd->reset();
lcd->begin();
lcd->invertColor(true);
// setRotation(0); //设置屏幕方向
lcd->displayOn();
screen_switch(true);
backlight->setBrightness(100); // 设置亮度
size_t lv_cache_rows = 72;
disp_draw_buf = (lv_color_t *)heap_caps_malloc(lv_cache_rows * SCREEN_RES_HOR * 2, MALLOC_CAP_INTERNAL | MALLOC_CAP_8BIT);
lv_init();
lv_disp_draw_buf_init(&draw_buf, disp_draw_buf, NULL, SCREEN_RES_HOR * lv_cache_rows);
lv_disp_drv_init(&disp_drv);
disp_drv.hor_res = SCREEN_RES_HOR;
disp_drv.ver_res = SCREEN_RES_VER;
disp_drv.flush_cb = my_disp_flush;
disp_drv.draw_buf = &draw_buf;
disp_drv.user_data = (void *)lcd;
lv_disp_t *disp = lv_disp_drv_register(&disp_drv);
if (lcd->getBus()->getType() != ESP_PANEL_BUS_TYPE_RGB)
{
lcd->attachRefreshFinishCallback(onRefreshFinishCallback, (void *)disp->driver);
}
indev_touchpad = indev_init(touch);
}
#endif
@@ -1,28 +0,0 @@
; JC3636W518 — ESP32-S3R8, 16 MB QIO flash, 8 MB OPI PSRAM, 360x360 ST77916 QSPI + CST816S
; Settings mirror the vendor Arduino IDE setup (2-Program Example/Demo_Arduino/docs/Arduino set up.png)
[env:jc3636w518]
; pioarduino = Arduino core 3.0.5 (ESP32_Display_Panel 0.1.4 needs core 3.x)
platform = https://github.com/pioarduino/platform-espressif32/releases/download/51.03.05/platform-espressif32.zip
board = esp32-s3-devkitc-1
framework = arduino
board_build.arduino.memory_type = qio_opi
board_build.flash_mode = qio
board_upload.flash_size = 16MB
board_build.partitions = huge_app.csv
build_flags =
-DBOARD_HAS_PSRAM
-DARDUINO_USB_CDC_ON_BOOT=1
; LVGL (also when compiled as a library) picks up include/lv_conf.h of this project
-DLV_CONF_INCLUDE_SIMPLE
-Iinclude
; vendor-bundled libraries: ESP32_Display_Panel 0.1.4, ESP32_IO_Expander 0.0.2, lvgl 8.3.11
lib_extra_dirs = ../../2-Program Example/Demo_Arduino/library
upload_port = COM21
monitor_port = COM21
monitor_speed = 115200
monitor_filters = esp32_exception_decoder
@@ -1,716 +0,0 @@
/**
* @file lv_conf.h
* Configuration file for v8.3.0-dev
*/
/*
* Copy this file as `lv_conf.h`
* 1. simply next to the `lvgl` folder
* 2. or any other places and
* - define `LV_CONF_INCLUDE_SIMPLE`
* - add the path as include path
*/
/* clang-format off */
#if 1 /*Set it to "1" to enable content*/
#ifndef LV_CONF_H
#define LV_CONF_H
#include <stdint.h>
/*====================
COLOR SETTINGS
*====================*/
/*Color depth: 1 (1 byte per pixel), 8 (RGB332), 16 (RGB565), 32 (ARGB8888)*/
#define LV_COLOR_DEPTH 16
/*Swap the 2 bytes of RGB565 color. Useful if the display has an 8-bit interface (e.g. SPI)*/
#define LV_COLOR_16_SWAP 1
/*Enable more complex drawing routines to manage screens transparency.
*Can be used if the UI is above another layer, e.g. an OSD menu or video player.
*Requires `LV_COLOR_DEPTH = 32` colors and the screen's `bg_opa` should be set to non LV_OPA_COVER value*/
#define LV_COLOR_SCREEN_TRANSP 0
/* Adjust color mix functions rounding. GPUs might calculate color mix (blending) differently.
* 0: round down, 64: round up from x.75, 128: round up from half, 192: round up from x.25, 254: round up */
#define LV_COLOR_MIX_ROUND_OFS (LV_COLOR_DEPTH == 32 ? 0: 128)
/*Images pixels with this color will not be drawn if they are chroma keyed)*/
#define LV_COLOR_CHROMA_KEY lv_color_hex(0x00ff00) /*pure green*/
/*=========================
MEMORY SETTINGS
*=========================*/
/*1: use custom malloc/free, 0: use the built-in `lv_mem_alloc()` and `lv_mem_free()`*/
#define LV_MEM_CUSTOM 1
#if LV_MEM_CUSTOM == 0
/*Size of the memory available for `lv_mem_alloc()` in bytes (>= 2kB)*/
// #define LV_MEM_SIZE (48U * 1024U) /*[bytes]*/
#define LV_MEM_SIZE (1024U * 1024U * 4u) // 4 * 1 MB
/*Set an address for the memory pool instead of allocating it as a normal array. Can be in external SRAM too.*/
#define LV_MEM_ADR 0 /*0: unused*/
/*Instead of an address give a memory allocator that will be called to get a memory pool for LVGL. E.g. my_malloc*/
#if LV_MEM_ADR == 0
//#define LV_MEM_POOL_INCLUDE your_alloc_library /* Uncomment if using an external allocator*/
//#define LV_MEM_POOL_ALLOC your_alloc /* Uncomment if using an external allocator*/
#define LV_MEM_POOL_INCLUDE <esp32-hal-psram.h>
#define LV_MEM_POOL_ALLOC ps_malloc
#endif
#else /*LV_MEM_CUSTOM*/
// #define LV_MEM_CUSTOM_INCLUDE <stdlib.h> /*Header for the dynamic memory function*/
// #define LV_MEM_CUSTOM_ALLOC malloc
// #define LV_MEM_CUSTOM_FREE free
// #define LV_MEM_CUSTOM_REALLOC realloc
#define LV_MEM_CUSTOM_INCLUDE <esp32-hal-psram.h>
#define LV_MEM_CUSTOM_ALLOC ps_malloc
#define LV_MEM_CUSTOM_FREE free
#define LV_MEM_CUSTOM_REALLOC ps_realloc
#endif /*LV_MEM_CUSTOM*/
/*Number of the intermediate memory buffer used during rendering and other internal processing mechanisms.
*You will see an error log message if there wasn't enough buffers. */
// #define LV_MEM_BUF_MAX_NUM 16
#define LV_MEM_BUF_MAX_NUM 32
/*Use the standard `memcpy` and `memset` instead of LVGL's own functions. (Might or might not be faster).*/
#define LV_MEMCPY_MEMSET_STD 0
/*====================
HAL SETTINGS
*====================*/
/*Default display refresh period. LVG will redraw changed areas with this period time*/
#define LV_DISP_DEF_REFR_PERIOD 15 /*[ms]*/ //15
/*Input device read period in milliseconds*/
#define LV_INDEV_DEF_READ_PERIOD 30 /*[ms]*///30
/*Use a custom tick source that tells the elapsed time in milliseconds.
*It removes the need to manually update the tick with `lv_tick_inc()`)*/
#define LV_TICK_CUSTOM 1
#if LV_TICK_CUSTOM
#define LV_TICK_CUSTOM_INCLUDE "Arduino.h" /*Header for the system time function*/
#define LV_TICK_CUSTOM_SYS_TIME_EXPR (millis()) /*Expression evaluating to current system time in ms*/
#endif /*LV_TICK_CUSTOM*/
/*Default Dot Per Inch. Used to initialize default sizes such as widgets sized, style paddings.
*(Not so important, you can adjust it to modify default sizes and spaces)*/
#define LV_DPI_DEF 130 /*[px/inch]*/
/*=======================
* FEATURE CONFIGURATION
*=======================*/
/*-------------
* Drawing
*-----------*/
/*Enable complex draw engine.
*Required to draw shadow, gradient, rounded corners, circles, arc, skew lines, image transformations or any masks*/
#define LV_DRAW_COMPLEX 1
#if LV_DRAW_COMPLEX != 0
/*Allow buffering some shadow calculation.
*LV_SHADOW_CACHE_SIZE is the max. shadow size to buffer, where shadow size is `shadow_width + radius`
*Caching has LV_SHADOW_CACHE_SIZE^2 RAM cost*/
#define LV_SHADOW_CACHE_SIZE 0
/* Set number of maximally cached circle data.
* The circumference of 1/4 circle are saved for anti-aliasing
* radius * 4 bytes are used per circle (the most often used radiuses are saved)
* 0: to disable caching */
#define LV_CIRCLE_CACHE_SIZE 4
#endif /*LV_DRAW_COMPLEX*/
/*Default image cache size. Image caching keeps the images opened.
*If only the built-in image formats are used there is no real advantage of caching. (I.e. if no new image decoder is added)
*With complex image decoders (e.g. PNG or JPG) caching can save the continuous open/decode of images.
*However the opened images might consume additional RAM.
*0: to disable caching*/
#define LV_IMG_CACHE_DEF_SIZE 50
/*Number of stops allowed per gradient. Increase this to allow more stops.
*This adds (sizeof(lv_color_t) + 1) bytes per additional stop*/
#define LV_GRADIENT_MAX_STOPS 2
/*Default gradient buffer size.
*When LVGL calculates the gradient "maps" it can save them into a cache to avoid calculating them again.
*LV_GRAD_CACHE_DEF_SIZE sets the size of this cache in bytes.
*If the cache is too small the map will be allocated only while it's required for the drawing.
*0 mean no caching.*/
#define LV_GRAD_CACHE_DEF_SIZE 0
/*Allow dithering the gradients (to achieve visual smooth color gradients on limited color depth display)
*LV_DITHER_GRADIENT implies allocating one or two more lines of the object's rendering surface
*The increase in memory consumption is (32 bits * object width) plus 24 bits * object width if using error diffusion */
#define LV_DITHER_GRADIENT 0
#if LV_DITHER_GRADIENT
/*Add support for error diffusion dithering.
*Error diffusion dithering gets a much better visual result, but implies more CPU consumption and memory when drawing.
*The increase in memory consumption is (24 bits * object's width)*/
#define LV_DITHER_ERROR_DIFFUSION 0
#endif
/*Maximum buffer size to allocate for rotation.
*Only used if software rotation is enabled in the display driver.*/
#define LV_DISP_ROT_MAX_BUF (10*1024)
/*-------------
* GPU
*-----------*/
/*Use STM32's DMA2D (aka Chrom Art) GPU*/
#define LV_USE_GPU_STM32_DMA2D 0
#if LV_USE_GPU_STM32_DMA2D
/*Must be defined to include path of CMSIS header of target processor
e.g. "stm32f769xx.h" or "stm32f429xx.h"*/
#define LV_GPU_DMA2D_CMSIS_INCLUDE
#endif
/*Use NXP's PXP GPU iMX RTxxx platforms*/
#define LV_USE_GPU_NXP_PXP 0
#if LV_USE_GPU_NXP_PXP
/*1: Add default bare metal and FreeRTOS interrupt handling routines for PXP (lv_gpu_nxp_pxp_osa.c)
* and call lv_gpu_nxp_pxp_init() automatically during lv_init(). Note that symbol SDK_OS_FREE_RTOS
* has to be defined in order to use FreeRTOS OSA, otherwise bare-metal implementation is selected.
*0: lv_gpu_nxp_pxp_init() has to be called manually before lv_init()
*/
#define LV_USE_GPU_NXP_PXP_AUTO_INIT 0
#endif
/*Use NXP's VG-Lite GPU iMX RTxxx platforms*/
#define LV_USE_GPU_NXP_VG_LITE 0
/*Use SDL renderer API*/
#define LV_USE_GPU_SDL 0
#if LV_USE_GPU_SDL
#define LV_GPU_SDL_INCLUDE_PATH <SDL2/SDL.h>
/*Texture cache size, 8MB by default*/
#define LV_GPU_SDL_LRU_SIZE (1024 * 1024 * 8)
/*Custom blend mode for mask drawing, disable if you need to link with older SDL2 lib*/
#define LV_GPU_SDL_CUSTOM_BLEND_MODE (SDL_VERSION_ATLEAST(2, 0, 6))
#endif
/*-------------
* Logging
*-----------*/
/*Enable the log module*/
#define LV_USE_LOG 1
#if LV_USE_LOG
/*How important log should be added:
*LV_LOG_LEVEL_TRACE A lot of logs to give detailed information
*LV_LOG_LEVEL_INFO Log important events
*LV_LOG_LEVEL_WARN Log if something unwanted happened but didn't cause a problem
*LV_LOG_LEVEL_ERROR Only critical issue, when the system may fail
*LV_LOG_LEVEL_USER Only logs added by the user
*LV_LOG_LEVEL_NONE Do not log anything*/
#define LV_LOG_LEVEL LV_LOG_LEVEL_INFO
/*1: Print the log with 'printf';
*0: User need to register a callback with `lv_log_register_print_cb()`*/
#define LV_LOG_PRINTF 1
/*Enable/disable LV_LOG_TRACE in modules that produces a huge number of logs*/
#define LV_LOG_TRACE_MEM 1
#define LV_LOG_TRACE_TIMER 1
#define LV_LOG_TRACE_INDEV 1
#define LV_LOG_TRACE_DISP_REFR 1
#define LV_LOG_TRACE_EVENT 1
#define LV_LOG_TRACE_OBJ_CREATE 1
#define LV_LOG_TRACE_LAYOUT 1
#define LV_LOG_TRACE_ANIM 1
#endif /*LV_USE_LOG*/
/*-------------
* Asserts
*-----------*/
/*Enable asserts if an operation is failed or an invalid data is found.
*If LV_USE_LOG is enabled an error message will be printed on failure*/
#define LV_USE_ASSERT_NULL 1 /*Check if the parameter is NULL. (Very fast, recommended)*/
#define LV_USE_ASSERT_MALLOC 1 /*Checks is the memory is successfully allocated or no. (Very fast, recommended)*/
#define LV_USE_ASSERT_STYLE 0 /*Check if the styles are properly initialized. (Very fast, recommended)*/
#define LV_USE_ASSERT_MEM_INTEGRITY 0 /*Check the integrity of `lv_mem` after critical operations. (Slow)*/
#define LV_USE_ASSERT_OBJ 0 /*Check the object's type and existence (e.g. not deleted). (Slow)*/
/*Add a custom handler when assert happens e.g. to restart the MCU*/
#define LV_ASSERT_HANDLER_INCLUDE <stdint.h>
#define LV_ASSERT_HANDLER while(1); /*Halt by default*/
/*-------------
* Others
*-----------*/
/*1: Show CPU usage and FPS count*/
#define LV_USE_PERF_MONITOR 0
#if LV_USE_PERF_MONITOR
#define LV_USE_PERF_MONITOR_POS LV_ALIGN_BOTTOM_RIGHT
#endif
/*1: Show the used memory and the memory fragmentation
* Requires LV_MEM_CUSTOM = 0*/
#define LV_USE_MEM_MONITOR 0
#if LV_USE_MEM_MONITOR
#define LV_USE_MEM_MONITOR_POS LV_ALIGN_BOTTOM_LEFT
#endif
/*1: Draw random colored rectangles over the redrawn areas*/
#define LV_USE_REFR_DEBUG 0
/*Change the built in (v)snprintf functions*/
#define LV_SPRINTF_CUSTOM 0
#if LV_SPRINTF_CUSTOM
#define LV_SPRINTF_INCLUDE <stdio.h>
#define lv_snprintf snprintf
#define lv_vsnprintf vsnprintf
#else /*LV_SPRINTF_CUSTOM*/
#define LV_SPRINTF_USE_FLOAT 0
#endif /*LV_SPRINTF_CUSTOM*/
#define LV_USE_USER_DATA 1
/*Garbage Collector settings
*Used if lvgl is bound to higher level language and the memory is managed by that language*/
#define LV_ENABLE_GC 0
#if LV_ENABLE_GC != 0
#define LV_GC_INCLUDE "gc.h" /*Include Garbage Collector related things*/
#endif /*LV_ENABLE_GC*/
/*=====================
* COMPILER SETTINGS
*====================*/
/*For big endian systems set to 1*/
#define LV_BIG_ENDIAN_SYSTEM 0
/*Define a custom attribute to `lv_tick_inc` function*/
#define LV_ATTRIBUTE_TICK_INC
/*Define a custom attribute to `lv_timer_handler` function*/
#define LV_ATTRIBUTE_TIMER_HANDLER
/*Define a custom attribute to `lv_disp_flush_ready` function*/
#define LV_ATTRIBUTE_FLUSH_READY
/*Required alignment size for buffers*/
#define LV_ATTRIBUTE_MEM_ALIGN_SIZE 1
/*Will be added where memories needs to be aligned (with -Os data might not be aligned to boundary by default).
* E.g. __attribute__((aligned(4)))*/
#define LV_ATTRIBUTE_MEM_ALIGN
/*Attribute to mark large constant arrays for example font's bitmaps*/
#define LV_ATTRIBUTE_LARGE_CONST
/*Compiler prefix for a big array declaration in RAM*/
#define LV_ATTRIBUTE_LARGE_RAM_ARRAY
/*Place performance critical functions into a faster memory (e.g RAM)*/
#define LV_ATTRIBUTE_FAST_MEM
/*Prefix variables that are used in GPU accelerated operations, often these need to be placed in RAM sections that are DMA accessible*/
#define LV_ATTRIBUTE_DMA
/*Export integer constant to binding. This macro is used with constants in the form of LV_<CONST> that
*should also appear on LVGL binding API such as Micropython.*/
#define LV_EXPORT_CONST_INT(int_value) struct _silence_gcc_warning /*The default value just prevents GCC warning*/
/*Extend the default -32k..32k coordinate range to -4M..4M by using int32_t for coordinates instead of int16_t*/
#define LV_USE_LARGE_COORD 0
/*==================
* FONT USAGE
*===================*/
/*Montserrat fonts with ASCII range and some symbols using bpp = 4
*https://fonts.google.com/specimen/Montserrat*/
#define LV_FONT_MONTSERRAT_8 0
#define LV_FONT_MONTSERRAT_10 0
#define LV_FONT_MONTSERRAT_12 0
#define LV_FONT_MONTSERRAT_14 0
#define LV_FONT_MONTSERRAT_16 0
#define LV_FONT_MONTSERRAT_18 0
#define LV_FONT_MONTSERRAT_20 0
#define LV_FONT_MONTSERRAT_22 0
#define LV_FONT_MONTSERRAT_24 0
#define LV_FONT_MONTSERRAT_26 0
#define LV_FONT_MONTSERRAT_28 0
#define LV_FONT_MONTSERRAT_30 0
#define LV_FONT_MONTSERRAT_32 0
#define LV_FONT_MONTSERRAT_34 0
#define LV_FONT_MONTSERRAT_36 0
#define LV_FONT_MONTSERRAT_38 0
#define LV_FONT_MONTSERRAT_40 0
#define LV_FONT_MONTSERRAT_42 0
#define LV_FONT_MONTSERRAT_44 0
#define LV_FONT_MONTSERRAT_46 0
#define LV_FONT_MONTSERRAT_48 1
/*Demonstrate special features*/
#define LV_FONT_MONTSERRAT_12_SUBPX 0
#define LV_FONT_MONTSERRAT_28_COMPRESSED 0 /*bpp = 3*/
#define LV_FONT_DEJAVU_16_PERSIAN_HEBREW 0 /*Hebrew, Arabic, Persian letters and all their forms*/
#define LV_FONT_SIMSUN_16_CJK 0 /*1000 most common CJK radicals*/
/*Pixel perfect monospace fonts*/
#define LV_FONT_UNSCII_8 0
#define LV_FONT_UNSCII_16 0
// #include "montserrat_100.c"
/*Optionally declare custom fonts here.
*You can use these fonts as default font too and they will be available globally.
*E.g. #define LV_FONT_CUSTOM_DECLARE LV_FONT_DECLARE(my_font_1) LV_FONT_DECLARE(my_font_2)*/
#define LV_FONT_DECLARE//(Montserrat);
/*Always set a default font*/
#define LV_FONT_DEFAULT &lv_font_montserrat_48
/*Enable handling large font and/or fonts with a lot of characters.
*The limit depends on the font size, font face and bpp.
*Compiler error will be triggered if a font needs it.*/
#define LV_FONT_FMT_TXT_LARGE 0
/*Enables/disables support for compressed fonts.*/
#define LV_USE_FONT_COMPRESSED 0
/*Enable subpixel rendering*/
#define LV_USE_FONT_SUBPX 0
#if LV_USE_FONT_SUBPX
/*Set the pixel order of the display. Physical order of RGB channels. Doesn't matter with "normal" fonts.*/
#define LV_FONT_SUBPX_BGR 0 /*0: RGB; 1:BGR order*/
#endif
/*=================
* TEXT SETTINGS
*=================*/
/**
* Select a character encoding for strings.
* Your IDE or editor should have the same character encoding
* - LV_TXT_ENC_UTF8
* - LV_TXT_ENC_ASCII
*/
#define LV_TXT_ENC LV_TXT_ENC_UTF8
/*Can break (wrap) texts on these chars*/
#define LV_TXT_BREAK_CHARS " ,.;:-_"
/*If a word is at least this long, will break wherever "prettiest"
*To disable, set to a value <= 0*/
#define LV_TXT_LINE_BREAK_LONG_LEN 0
/*Minimum number of characters in a long word to put on a line before a break.
*Depends on LV_TXT_LINE_BREAK_LONG_LEN.*/
#define LV_TXT_LINE_BREAK_LONG_PRE_MIN_LEN 3
/*Minimum number of characters in a long word to put on a line after a break.
*Depends on LV_TXT_LINE_BREAK_LONG_LEN.*/
#define LV_TXT_LINE_BREAK_LONG_POST_MIN_LEN 3
/*The control character to use for signalling text recoloring.*/
#define LV_TXT_COLOR_CMD "#"
/*Support bidirectional texts. Allows mixing Left-to-Right and Right-to-Left texts.
*The direction will be processed according to the Unicode Bidirectional Algorithm:
*https://www.w3.org/International/articles/inline-bidi-markup/uba-basics*/
#define LV_USE_BIDI 0
#if LV_USE_BIDI
/*Set the default direction. Supported values:
*`LV_BASE_DIR_LTR` Left-to-Right
*`LV_BASE_DIR_RTL` Right-to-Left
*`LV_BASE_DIR_AUTO` detect texts base direction*/
#define LV_BIDI_BASE_DIR_DEF LV_BASE_DIR_AUTO
#endif
/*Enable Arabic/Persian processing
*In these languages characters should be replaced with an other form based on their position in the text*/
#define LV_USE_ARABIC_PERSIAN_CHARS 0
/*==================
* WIDGET USAGE
*================*/
/*Documentation of the widgets: https://docs.lvgl.io/latest/en/html/widgets/index.html*/
#define LV_USE_ARC 1
#define LV_USE_ANIMIMG 1
#define LV_USE_BAR 1
#define LV_USE_BTN 1
#define LV_USE_BTNMATRIX 1
#define LV_USE_CANVAS 1
#define LV_USE_CHECKBOX 1
#define LV_USE_DROPDOWN 1 /*Requires: lv_label*/
#define LV_USE_IMG 1 /*Requires: lv_label*/
#define LV_USE_LABEL 1
#if LV_USE_LABEL
#define LV_LABEL_TEXT_SELECTION 1 /*Enable selecting text of the label*/
#define LV_LABEL_LONG_TXT_HINT 1 /*Store some extra info in labels to speed up drawing of very long texts*/
#endif
#define LV_USE_LINE 1
#define LV_USE_ROLLER 1 /*Requires: lv_label*/
#if LV_USE_ROLLER
#define LV_ROLLER_INF_PAGES 7 /*Number of extra "pages" when the roller is infinite*/
#endif
#define LV_USE_SLIDER 1 /*Requires: lv_bar*/
#define LV_USE_SWITCH 1
#define LV_USE_TEXTAREA 1 /*Requires: lv_label*/
#if LV_USE_TEXTAREA != 0
#define LV_TEXTAREA_DEF_PWD_SHOW_TIME 1500 /*ms*/
#endif
#define LV_USE_TABLE 1
/*==================
* EXTRA COMPONENTS
*==================*/
/*-----------
* Widgets
*----------*/
#define LV_USE_CALENDAR 1
#if LV_USE_CALENDAR
#define LV_CALENDAR_WEEK_STARTS_MONDAY 0
#if LV_CALENDAR_WEEK_STARTS_MONDAY
#define LV_CALENDAR_DEFAULT_DAY_NAMES {"Mo", "Tu", "We", "Th", "Fr", "Sa", "Su"}
#else
#define LV_CALENDAR_DEFAULT_DAY_NAMES {"Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"}
#endif
#define LV_CALENDAR_DEFAULT_MONTH_NAMES {"January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"}
#define LV_USE_CALENDAR_HEADER_ARROW 1
#define LV_USE_CALENDAR_HEADER_DROPDOWN 1
#endif /*LV_USE_CALENDAR*/
#define LV_USE_CHART 1
#define LV_USE_COLORWHEEL 1
#define LV_USE_IMGBTN 1
#define LV_USE_KEYBOARD 1
#define LV_USE_LED 1
#define LV_USE_LIST 1
#define LV_USE_MENU 1
#define LV_USE_METER 1
#define LV_USE_MSGBOX 1
#define LV_USE_SPINBOX 1
#define LV_USE_SPINNER 1
#define LV_USE_TABVIEW 1
#define LV_USE_TILEVIEW 1
#define LV_USE_WIN 1
#define LV_USE_SPAN 1
#if LV_USE_SPAN
/*A line text can contain maximum num of span descriptor */
#define LV_SPAN_SNIPPET_STACK_SIZE 64
#endif
/*-----------
* Themes
*----------*/
/*A simple, impressive and very complete theme*/
#define LV_USE_THEME_DEFAULT 1
#if LV_USE_THEME_DEFAULT
/*0: Light mode; 1: Dark mode*/
#define LV_THEME_DEFAULT_DARK 0
/*1: Enable grow on press*/
#define LV_THEME_DEFAULT_GROW 1
/*Default transition time in [ms]*/
#define LV_THEME_DEFAULT_TRANSITION_TIME 80
#endif /*LV_USE_THEME_DEFAULT*/
/*A very simple theme that is a good starting point for a custom theme*/
#define LV_USE_THEME_BASIC 1
/*A theme designed for monochrome displays*/
#define LV_USE_THEME_MONO 1
/*-----------
* Layouts
*----------*/
/*A layout similar to Flexbox in CSS.*/
#define LV_USE_FLEX 1
/*A layout similar to Grid in CSS.*/
#define LV_USE_GRID 1
/*---------------------
* 3rd party libraries
*--------------------*/
/*File system interfaces for common APIs */
/*API for fopen, fread, etc*/
#define LV_USE_FS_STDIO 0
#if LV_USE_FS_STDIO
#define LV_FS_STDIO_LETTER '\0' /*Set an upper cased letter on which the drive will accessible (e.g. 'A')*/
#define LV_FS_STDIO_PATH "" /*Set the working directory. File/directory paths will be appended to it.*/
#define LV_FS_STDIO_CACHE_SIZE 0 /*>0 to cache this number of bytes in lv_fs_read()*/
#endif
/*API for open, read, etc*/
#define LV_USE_FS_POSIX 0
#if LV_USE_FS_POSIX
#define LV_FS_POSIX_LETTER '\0' /*Set an upper cased letter on which the drive will accessible (e.g. 'A')*/
#define LV_FS_POSIX_PATH "" /*Set the working directory. File/directory paths will be appended to it.*/
#define LV_FS_POSIX_CACHE_SIZE 0 /*>0 to cache this number of bytes in lv_fs_read()*/
#endif
/*API for CreateFile, ReadFile, etc*/
#define LV_USE_FS_WIN32 0
#if LV_USE_FS_WIN32
#define LV_FS_WIN32_LETTER '\0' /*Set an upper cased letter on which the drive will accessible (e.g. 'A')*/
#define LV_FS_WIN32_PATH "" /*Set the working directory. File/directory paths will be appended to it.*/
#define LV_FS_WIN32_CACHE_SIZE 0 /*>0 to cache this number of bytes in lv_fs_read()*/
#endif
/*API for FATFS (needs to be added separately). Uses f_open, f_read, etc*/
#include <ff.h> // You can put this at the top of the header file
typedef FF_DIR DIR; // Add this line
#define LV_USE_FS_FATFS 1
#if LV_USE_FS_FATFS
#define LV_FS_FATFS_LETTER 'A' /*Set an upper cased letter on which the drive will accessible (e.g. 'A')*/
#define LV_FS_FATFS_CACHE_SIZE 0 /*>0 to cache this number of bytes in lv_fs_read()*/
#endif
/*PNG decoder library*/
#define LV_USE_PNG 1
/*BMP decoder library*/
#define LV_USE_BMP 1
/* JPG + split JPG decoder library.
* Split JPG is a custom format optimized for embedded systems. */
#define LV_USE_SJPG 1
/*GIF decoder library*/
#define LV_USE_GIF 1
/*QR code library*/
#define LV_USE_QRCODE 0
/*FreeType library*/
#define LV_USE_FREETYPE 0
#if LV_USE_FREETYPE
/*Memory used by FreeType to cache characters [bytes] (-1: no caching)*/
#define LV_FREETYPE_CACHE_SIZE (16 * 1024)
#if LV_FREETYPE_CACHE_SIZE >= 0
/* 1: bitmap cache use the sbit cache, 0:bitmap cache use the image cache. */
/* sbit cache:it is much more memory efficient for small bitmaps(font size < 256) */
/* if font size >= 256, must be configured as image cache */
#define LV_FREETYPE_SBIT_CACHE 0
/* Maximum number of opened FT_Face/FT_Size objects managed by this cache instance. */
/* (0:use system defaults) */
#define LV_FREETYPE_CACHE_FT_FACES 0
#define LV_FREETYPE_CACHE_FT_SIZES 0
#endif
#endif
/*Rlottie library*/
#define LV_USE_RLOTTIE 0
/*FFmpeg library for image decoding and playing videos
*Supports all major image formats so do not enable other image decoder with it*/
#define LV_USE_FFMPEG 0
#if LV_USE_FFMPEG
/*Dump input information to stderr*/
#define LV_FFMPEG_AV_DUMP_FORMAT 0
#endif
/*-----------
* Others
*----------*/
/*1: Enable API to take snapshot for object*/
#define LV_USE_SNAPSHOT 0
/*1: Enable Monkey test*/
#define LV_USE_MONKEY 0
/*1: Enable grid navigation*/
#define LV_USE_GRIDNAV 0
/*1: Enable lv_obj fragment*/
#define LV_USE_FRAGMENT 0
/*==================
* EXAMPLES
*==================*/
/*Enable the examples to be built with the library*/
#define LV_BUILD_EXAMPLES 0
/*===================
* DEMO USAGE
====================*/
/*Show some widget. It might be required to increase `LV_MEM_SIZE` */
#define LV_USE_DEMO_WIDGETS 0
#if LV_USE_DEMO_WIDGETS
#define LV_DEMO_WIDGETS_SLIDESHOW 0
#endif
/*Demonstrate the usage of encoder and keyboard*/
#define LV_USE_DEMO_KEYPAD_AND_ENCODER 0
/*Benchmark your system*/
#define LV_USE_DEMO_BENCHMARK 0
/*Stress test for LVGL*/
#define LV_USE_DEMO_STRESS 0
/*Music player demo*/
#define LV_USE_DEMO_MUSIC 0
#if LV_USE_DEMO_MUSIC
# define LV_DEMO_MUSIC_SQUARE 1
# define LV_DEMO_MUSIC_LANDSCAPE 1
# define LV_DEMO_MUSIC_ROUND 1
# define LV_DEMO_MUSIC_LARGE 1
# define LV_DEMO_MUSIC_AUTO_PLAY 1
#endif
/*--END OF LV_CONF_H--*/
#endif /*LV_CONF_H*/
#endif /*End of "Content enable"*/
@@ -1,38 +0,0 @@
#ifndef _PINCFG_H_
#define _PINCFG_H_
#define TFT_BLK 15
#define TFT_RST 47
#define TFT_CS 10
#define TFT_SCK 9
#define TFT_SDA0 11
#define TFT_SDA1 12
#define TFT_SDA2 13
#define TFT_SDA3 14
#define BTN_PIN 0
#define TOUCH_PIN_NUM_I2C_SCL 8
#define TOUCH_PIN_NUM_I2C_SDA 7
#define TOUCH_PIN_NUM_INT 41
#define TOUCH_PIN_NUM_RST 40
#define SD_MMC_D0_PIN 2
#define SD_MMC_D1_PIN 1
#define SD_MMC_D2_PIN 6
#define SD_MMC_D3_PIN 5
#define SD_MMC_CLK_PIN 3
#define SD_MMC_CMD_PIN 4
#define AUDIO_I2S_MCK_IO -1 // MCK
#define AUDIO_I2S_BCK_IO 18 // BCK
#define AUDIO_I2S_WS_IO 16 // LCK
#define AUDIO_I2S_DO_IO 17 // DIN
#define AUDIO_MUTE_PIN 48 // 低电平静音
#define MIC_I2S_WS 45
#define MIC_I2S_SD 46
#define MIC_I2S_SCK 42
#endif
@@ -1,439 +0,0 @@
#ifndef _SCR_ST77916_H_
#define _SCR_ST77916_H_
#include "pincfg.h"
#include <lvgl.h>
#include <ESP_IOExpander.h>
#include <ESP_Panel_Library.h>
#define SCREEN_RES_HOR 360
#define SCREEN_RES_VER 360
static lv_color_t *disp_draw_buf;
static lv_disp_draw_buf_t draw_buf;
static lv_disp_drv_t disp_drv;
static lv_indev_t *indev_touchpad;
static ESP_PanelBacklight *backlight = NULL;
static ESP_PanelLcd *lcd = NULL;
static ESP_PanelTouch *touch = NULL;
#define USE_CUSTOM_INIT_CMD 0 // 是否用自定义的初始化代码
#if TOUCH_PIN_NUM_INT >= 0
IRAM_ATTR bool onTouchInterruptCallback(void *user_data)
{
return false;
}
#endif
const esp_lcd_panel_vendor_init_cmd_t lcd_init_cmd[] = {
{0xF0, (uint8_t[]){0x08}, 1, 0},
{0xF2, (uint8_t[]){0x08}, 1, 0},
{0x9B, (uint8_t[]){0x51}, 1, 0},
{0x86, (uint8_t[]){0x53}, 1, 0},
{0xF2, (uint8_t[]){0x80}, 1, 0},
{0xF0, (uint8_t[]){0x00}, 1, 0},
{0xF0, (uint8_t[]){0x01}, 1, 0},
{0xF1, (uint8_t[]){0x01}, 1, 0},
{0xB0, (uint8_t[]){0x54}, 1, 0},
{0xB1, (uint8_t[]){0x3F}, 1, 0},
{0xB2, (uint8_t[]){0x2A}, 1, 0},
{0xB4, (uint8_t[]){0x46}, 1, 0},
{0xB5, (uint8_t[]){0x34}, 1, 0},
{0xB6, (uint8_t[]){0xD5}, 1, 0},
{0xB7, (uint8_t[]){0x30}, 1, 0},
{0xBA, (uint8_t[]){0x00}, 1, 0},
{0xBB, (uint8_t[]){0x08}, 1, 0},
{0xBC, (uint8_t[]){0x08}, 1, 0},
{0xBD, (uint8_t[]){0x00}, 1, 0},
{0xC0, (uint8_t[]){0x80}, 1, 0},
{0xC1, (uint8_t[]){0x10}, 1, 0},
{0xC2, (uint8_t[]){0x37}, 1, 0},
{0xC3, (uint8_t[]){0x80}, 1, 0},
{0xC4, (uint8_t[]){0x10}, 1, 0},
{0xC5, (uint8_t[]){0x37}, 1, 0},
{0xC6, (uint8_t[]){0xA9}, 1, 0},
{0xC7, (uint8_t[]){0x41}, 1, 0},
{0xC8, (uint8_t[]){0x51}, 1, 0},
{0xC9, (uint8_t[]){0xA9}, 1, 0},
{0xCA, (uint8_t[]){0x41}, 1, 0},
{0xCB, (uint8_t[]){0x51}, 1, 0},
{0xD0, (uint8_t[]){0x91}, 1, 0},
{0xD1, (uint8_t[]){0x68}, 1, 0},
{0xD2, (uint8_t[]){0x69}, 1, 0},
{0xF5, (uint8_t[]){0x00, 0xA5}, 2, 0},
{0xDD, (uint8_t[]){0x3F}, 1, 0},
{0xDE, (uint8_t[]){0x3F}, 1, 0},
{0xF1, (uint8_t[]){0x10}, 1, 0},
{0xF0, (uint8_t[]){0x00}, 1, 0},
{0xF0, (uint8_t[]){0x02}, 1, 0},
{0xE0, (uint8_t[]){0x70, 0x09, 0x12, 0x0C, 0x0B, 0x27, 0x38, 0x54, 0x4E, 0x19, 0x15, 0x15, 0x2C, 0x2F}, 14, 0},
{0xE1, (uint8_t[]){0x70, 0x08, 0x11, 0x0C, 0x0B, 0x27, 0x38, 0x43, 0x4C, 0x18, 0x14, 0x14, 0x2B, 0x2D}, 14, 0},
{0xF0, (uint8_t[]){0x10}, 1, 0},
{0xF3, (uint8_t[]){0x10}, 1, 0},
{0xE0, (uint8_t[]){0x08}, 1, 0},
{0xE1, (uint8_t[]){0x00}, 1, 0},
{0xE2, (uint8_t[]){0x00}, 1, 0},
{0xE3, (uint8_t[]){0x00}, 1, 0},
{0xE4, (uint8_t[]){0xE0}, 1, 0},
{0xE5, (uint8_t[]){0x06}, 1, 0},
{0xE6, (uint8_t[]){0x21}, 1, 0},
{0xE7, (uint8_t[]){0x00}, 1, 0},
{0xE8, (uint8_t[]){0x05}, 1, 0},
{0xE9, (uint8_t[]){0x82}, 1, 0},
{0xEA, (uint8_t[]){0xDF}, 1, 0},
{0xEB, (uint8_t[]){0x89}, 1, 0},
{0xEC, (uint8_t[]){0x20}, 1, 0},
{0xED, (uint8_t[]){0x14}, 1, 0},
{0xEE, (uint8_t[]){0xFF}, 1, 0},
{0xEF, (uint8_t[]){0x00}, 1, 0},
{0xF8, (uint8_t[]){0xFF}, 1, 0},
{0xF9, (uint8_t[]){0x00}, 1, 0},
{0xFA, (uint8_t[]){0x00}, 1, 0},
{0xFB, (uint8_t[]){0x30}, 1, 0},
{0xFC, (uint8_t[]){0x00}, 1, 0},
{0xFD, (uint8_t[]){0x00}, 1, 0},
{0xFE, (uint8_t[]){0x00}, 1, 0},
{0xFF, (uint8_t[]){0x00}, 1, 0},
{0x60, (uint8_t[]){0x42}, 1, 0},
{0x61, (uint8_t[]){0xE0}, 1, 0},
{0x62, (uint8_t[]){0x40}, 1, 0},
{0x63, (uint8_t[]){0x40}, 1, 0},
{0x64, (uint8_t[]){0x02}, 1, 0},
{0x65, (uint8_t[]){0x00}, 1, 0},
{0x66, (uint8_t[]){0x40}, 1, 0},
{0x67, (uint8_t[]){0x03}, 1, 0},
{0x68, (uint8_t[]){0x00}, 1, 0},
{0x69, (uint8_t[]){0x00}, 1, 0},
{0x6A, (uint8_t[]){0x00}, 1, 0},
{0x6B, (uint8_t[]){0x00}, 1, 0},
{0x70, (uint8_t[]){0x42}, 1, 0},
{0x71, (uint8_t[]){0xE0}, 1, 0},
{0x72, (uint8_t[]){0x40}, 1, 0},
{0x73, (uint8_t[]){0x40}, 1, 0},
{0x74, (uint8_t[]){0x02}, 1, 0},
{0x75, (uint8_t[]){0x00}, 1, 0},
{0x76, (uint8_t[]){0x40}, 1, 0},
{0x77, (uint8_t[]){0x03}, 1, 0},
{0x78, (uint8_t[]){0x00}, 1, 0},
{0x79, (uint8_t[]){0x00}, 1, 0},
{0x7A, (uint8_t[]){0x00}, 1, 0},
{0x7B, (uint8_t[]){0x00}, 1, 0},
{0x80, (uint8_t[]){0x48}, 1, 0},
{0x81, (uint8_t[]){0x00}, 1, 0},
{0x82, (uint8_t[]){0x05}, 1, 0},
{0x83, (uint8_t[]){0x02}, 1, 0},
{0x84, (uint8_t[]){0xDD}, 1, 0},
{0x85, (uint8_t[]){0x00}, 1, 0},
{0x86, (uint8_t[]){0x00}, 1, 0},
{0x87, (uint8_t[]){0x00}, 1, 0},
{0x88, (uint8_t[]){0x48}, 1, 0},
{0x89, (uint8_t[]){0x00}, 1, 0},
{0x8A, (uint8_t[]){0x07}, 1, 0},
{0x8B, (uint8_t[]){0x02}, 1, 0},
{0x8C, (uint8_t[]){0xDF}, 1, 0},
{0x8D, (uint8_t[]){0x00}, 1, 0},
{0x8E, (uint8_t[]){0x00}, 1, 0},
{0x8F, (uint8_t[]){0x00}, 1, 0},
{0x90, (uint8_t[]){0x48}, 1, 0},
{0x91, (uint8_t[]){0x00}, 1, 0},
{0x92, (uint8_t[]){0x09}, 1, 0},
{0x93, (uint8_t[]){0x02}, 1, 0},
{0x94, (uint8_t[]){0xE1}, 1, 0},
{0x95, (uint8_t[]){0x00}, 1, 0},
{0x96, (uint8_t[]){0x00}, 1, 0},
{0x97, (uint8_t[]){0x00}, 1, 0},
{0x98, (uint8_t[]){0x48}, 1, 0},
{0x99, (uint8_t[]){0x00}, 1, 0},
{0x9A, (uint8_t[]){0x0B}, 1, 0},
{0x9B, (uint8_t[]){0x02}, 1, 0},
{0x9C, (uint8_t[]){0xE3}, 1, 0},
{0x9D, (uint8_t[]){0x00}, 1, 0},
{0x9E, (uint8_t[]){0x00}, 1, 0},
{0x9F, (uint8_t[]){0x00}, 1, 0},
{0xA0, (uint8_t[]){0x48}, 1, 0},
{0xA1, (uint8_t[]){0x00}, 1, 0},
{0xA2, (uint8_t[]){0x04}, 1, 0},
{0xA3, (uint8_t[]){0x02}, 1, 0},
{0xA4, (uint8_t[]){0xDC}, 1, 0},
{0xA5, (uint8_t[]){0x00}, 1, 0},
{0xA6, (uint8_t[]){0x00}, 1, 0},
{0xA7, (uint8_t[]){0x00}, 1, 0},
{0xA8, (uint8_t[]){0x48}, 1, 0},
{0xA9, (uint8_t[]){0x00}, 1, 0},
{0xAA, (uint8_t[]){0x06}, 1, 0},
{0xAB, (uint8_t[]){0x02}, 1, 0},
{0xAC, (uint8_t[]){0xDE}, 1, 0},
{0xAD, (uint8_t[]){0x00}, 1, 0},
{0xAE, (uint8_t[]){0x00}, 1, 0},
{0xAF, (uint8_t[]){0x00}, 1, 0},
{0xB0, (uint8_t[]){0x48}, 1, 0},
{0xB1, (uint8_t[]){0x00}, 1, 0},
{0xB2, (uint8_t[]){0x08}, 1, 0},
{0xB3, (uint8_t[]){0x02}, 1, 0},
{0xB4, (uint8_t[]){0xE0}, 1, 0},
{0xB5, (uint8_t[]){0x00}, 1, 0},
{0xB6, (uint8_t[]){0x00}, 1, 0},
{0xB7, (uint8_t[]){0x00}, 1, 0},
{0xB8, (uint8_t[]){0x48}, 1, 0},
{0xB9, (uint8_t[]){0x00}, 1, 0},
{0xBA, (uint8_t[]){0x0A}, 1, 0},
{0xBB, (uint8_t[]){0x02}, 1, 0},
{0xBC, (uint8_t[]){0xE2}, 1, 0},
{0xBD, (uint8_t[]){0x00}, 1, 0},
{0xBE, (uint8_t[]){0x00}, 1, 0},
{0xBF, (uint8_t[]){0x00}, 1, 0},
{0xC0, (uint8_t[]){0x12}, 1, 0},
{0xC1, (uint8_t[]){0xAA}, 1, 0},
{0xC2, (uint8_t[]){0x65}, 1, 0},
{0xC3, (uint8_t[]){0x74}, 1, 0},
{0xC4, (uint8_t[]){0x47}, 1, 0},
{0xC5, (uint8_t[]){0x56}, 1, 0},
{0xC6, (uint8_t[]){0x00}, 1, 0},
{0xC7, (uint8_t[]){0x88}, 1, 0},
{0xC8, (uint8_t[]){0x99}, 1, 0},
{0xC9, (uint8_t[]){0x33}, 1, 0},
{0xD0, (uint8_t[]){0x21}, 1, 0},
{0xD1, (uint8_t[]){0xAA}, 1, 0},
{0xD2, (uint8_t[]){0x65}, 1, 0},
{0xD3, (uint8_t[]){0x74}, 1, 0},
{0xD4, (uint8_t[]){0x47}, 1, 0},
{0xD5, (uint8_t[]){0x56}, 1, 0},
{0xD6, (uint8_t[]){0x00}, 1, 0},
{0xD7, (uint8_t[]){0x88}, 1, 0},
{0xD8, (uint8_t[]){0x99}, 1, 0},
{0xD9, (uint8_t[]){0x33}, 1, 0},
{0xF3, (uint8_t[]){0x01}, 1, 0},
{0xF0, (uint8_t[]){0x00}, 1, 0},
{0xF0, (uint8_t[]){0x01}, 1, 0},
{0xF1, (uint8_t[]){0x01}, 1, 0},
{0xA0, (uint8_t[]){0x0B}, 1, 0},
{0xA3, (uint8_t[]){0x2A}, 1, 0},
{0xA5, (uint8_t[]){0xC3}, 1, 1},
{0xA3, (uint8_t[]){0x2B}, 1, 0},
{0xA5, (uint8_t[]){0xC3}, 1, 1},
{0xA3, (uint8_t[]){0x2C}, 1, 0},
{0xA5, (uint8_t[]){0xC3}, 1, 1},
{0xA3, (uint8_t[]){0x2D}, 1, 0},
{0xA5, (uint8_t[]){0xC3}, 1, 1},
{0xA3, (uint8_t[]){0x2E}, 1, 0},
{0xA5, (uint8_t[]){0xC3}, 1, 1},
{0xA3, (uint8_t[]){0x2F}, 1, 0},
{0xA5, (uint8_t[]){0xC3}, 1, 1},
{0xA3, (uint8_t[]){0x30}, 1, 0},
{0xA5, (uint8_t[]){0xC3}, 1, 1},
{0xA3, (uint8_t[]){0x31}, 1, 0},
{0xA5, (uint8_t[]){0xC3}, 1, 1},
{0xA3, (uint8_t[]){0x32}, 1, 0},
{0xA5, (uint8_t[]){0xC3}, 1, 1},
{0xA3, (uint8_t[]){0x33}, 1, 0},
{0xA5, (uint8_t[]){0xC3}, 1, 1},
{0xA0, (uint8_t[]){0x09}, 1, 0},
{0xF1, (uint8_t[]){0x10}, 1, 0},
{0xF0, (uint8_t[]){0x00}, 1, 0},
{0x2A, (uint8_t[]){0x00, 0x00, 0x01, 0x67}, 4, 0},
{0x2B, (uint8_t[]){0x01, 0x68, 0x01, 0x68}, 4, 0},
{0x4D, (uint8_t[]){0x00}, 1, 0},
{0x4E, (uint8_t[]){0x00}, 1, 0},
{0x4F, (uint8_t[]){0x00}, 1, 0},
{0x4C, (uint8_t[]){0x01}, 1, 10},
{0x4C, (uint8_t[]){0x00}, 1, 0},
{0x2A, (uint8_t[]){0x00, 0x00, 0x01, 0x67}, 4, 0},
{0x2B, (uint8_t[]){0x00, 0x00, 0x01, 0x67}, 4, 0},
{0x21, (uint8_t[]){0x00}, 1, 0},
//{0x3A, (uint8_t[]){0x55}, 1, 0}, // color=16
{0x11, (uint8_t[]){0x00}, 1, 120},
{0x29, (uint8_t[]){0x00}, 1, 0},
};
#define TFT_SPI_FREQ_HZ (50 * 1000 * 1000)
static void my_disp_flush(lv_disp_drv_t *disp, const lv_area_t *area, lv_color_t *color_p)
{
ESP_PanelLcd *lcd = (ESP_PanelLcd *)disp->user_data;
const int offsetx1 = area->x1;
const int offsetx2 = area->x2;
const int offsety1 = area->y1;
const int offsety2 = area->y2;
lcd->drawBitmap(offsetx1, offsety1, offsetx2 - offsetx1 + 1, offsety2 - offsety1 + 1, (const uint8_t *)color_p);
}
IRAM_ATTR bool onRefreshFinishCallback(void *user_data)
{
lv_disp_drv_t *drv = (lv_disp_drv_t *)user_data;
lv_disp_flush_ready(drv);
return false;
}
void setRotation(uint8_t rot)
{
if (rot > 3)
return;
if (lcd == NULL || touch == NULL)
return;
switch (rot)
{
case 1: // 顺时针90度
lcd->swapXY(true);
lcd->mirrorX(true);
lcd->mirrorY(false);
touch->swapXY(true);
touch->mirrorX(true);
touch->mirrorY(false);
break;
case 2:
lcd->swapXY(false);
lcd->mirrorX(true);
lcd->mirrorY(true);
touch->swapXY(false);
touch->mirrorX(true);
touch->mirrorY(true);
break;
case 3:
lcd->swapXY(true);
lcd->mirrorX(false);
lcd->mirrorY(true);
touch->swapXY(true);
touch->mirrorX(false);
touch->mirrorY(true);
break;
default:
lcd->swapXY(false);
lcd->mirrorX(false);
lcd->mirrorY(false);
touch->swapXY(false);
touch->mirrorX(false);
touch->mirrorY(false);
break;
}
}
void screen_switch(bool on)
{
if (NULL == backlight)
return;
if (on)
backlight->on();
else
backlight->off();
}
// 输入值为0-100
void set_brightness(uint8_t bri)
{
if (NULL == backlight)
return;
backlight->setBrightness(bri);
}
static void touchpad_read(lv_indev_drv_t *indev_drv, lv_indev_data_t *data)
{
ESP_PanelTouch *tp = (ESP_PanelTouch *)indev_drv->user_data;
ESP_PanelTouchPoint point;
int read_touch_result = tp->readPoints(&point, 1);
if (read_touch_result > 0)
{
data->point.x = point.x;
data->point.y = point.y;
data->state = LV_INDEV_STATE_PRESSED;
}
else
{
data->state = LV_INDEV_STATE_RELEASED;
}
}
static lv_indev_t *indev_init(ESP_PanelTouch *tp)
{
ESP_PANEL_CHECK_FALSE_RET(tp != nullptr, nullptr, "Invalid touch device");
ESP_PANEL_CHECK_FALSE_RET(tp->getHandle() != nullptr, nullptr, "Touch device is not initialized");
static lv_indev_drv_t indev_drv_tp;
lv_indev_drv_init(&indev_drv_tp);
indev_drv_tp.type = LV_INDEV_TYPE_POINTER;
indev_drv_tp.read_cb = touchpad_read;
indev_drv_tp.user_data = (void *)tp;
return lv_indev_drv_register(&indev_drv_tp);
}
void scr_lvgl_init()
{
ledc_timer_config_t ledc_timer = {
.speed_mode = LEDC_LOW_SPEED_MODE,
.duty_resolution = LEDC_TIMER_13_BIT,
.timer_num = LEDC_TIMER_0,
.freq_hz = 5000,
.clk_cfg = LEDC_AUTO_CLK};
ESP_ERROR_CHECK(ledc_timer_config(&ledc_timer));
ledc_channel_config_t ledc_channel = {
.gpio_num = (TFT_BLK),
.speed_mode = LEDC_LOW_SPEED_MODE,
.channel = LEDC_CHANNEL_0,
.intr_type = LEDC_INTR_DISABLE,
.timer_sel = LEDC_TIMER_0,
.duty = 0,
.hpoint = 0};
ESP_ERROR_CHECK(ledc_channel_config(&ledc_channel));
backlight = new ESP_PanelBacklight(ledc_timer, ledc_channel);
backlight->begin();
backlight->off();
ESP_PanelBus_I2C *touch_bus = new ESP_PanelBus_I2C(TOUCH_PIN_NUM_I2C_SCL, TOUCH_PIN_NUM_I2C_SDA, ESP_LCD_TOUCH_IO_I2C_CST816S_CONFIG());
touch_bus->configI2cFreqHz(400000);
touch_bus->begin();
touch = new ESP_PanelTouch_CST816S(touch_bus, SCREEN_RES_HOR, SCREEN_RES_VER, TOUCH_PIN_NUM_RST, TOUCH_PIN_NUM_INT);
touch->init();
touch->begin();
#if TOUCH_PIN_NUM_INT >= 0
touch->attachInterruptCallback(onTouchInterruptCallback, NULL);
#endif
ESP_PanelBus_QSPI *panel_bus = new ESP_PanelBus_QSPI(TFT_CS, TFT_SCK, TFT_SDA0, TFT_SDA1, TFT_SDA2, TFT_SDA3);
panel_bus->configQspiFreqHz(TFT_SPI_FREQ_HZ);
panel_bus->begin();
lcd = new ESP_PanelLcd_ST77916(panel_bus, 16, TFT_RST);
// 注意,初始化代码的设置必须在INIT之前
// lcd->configVendorCommands(lcd_init_cmd, sizeof(lcd_init_cmd) / sizeof(lcd_init_cmd[0]));
lcd->init();
lcd->reset();
lcd->begin();
lcd->invertColor(true);
// setRotation(0); //设置屏幕方向
lcd->displayOn();
screen_switch(true);
backlight->setBrightness(100); // 设置亮度
size_t lv_cache_rows = 72;
disp_draw_buf = (lv_color_t *)heap_caps_malloc(lv_cache_rows * SCREEN_RES_HOR * 2, MALLOC_CAP_INTERNAL | MALLOC_CAP_8BIT);
lv_init();
lv_disp_draw_buf_init(&draw_buf, disp_draw_buf, NULL, SCREEN_RES_HOR * lv_cache_rows);
lv_disp_drv_init(&disp_drv);
disp_drv.hor_res = SCREEN_RES_HOR;
disp_drv.ver_res = SCREEN_RES_VER;
disp_drv.flush_cb = my_disp_flush;
disp_drv.draw_buf = &draw_buf;
disp_drv.user_data = (void *)lcd;
lv_disp_t *disp = lv_disp_drv_register(&disp_drv);
if (lcd->getBus()->getType() != ESP_PANEL_BUS_TYPE_RGB)
{
lcd->attachRefreshFinishCallback(onRefreshFinishCallback, (void *)disp->driver);
}
indev_touchpad = indev_init(touch);
}
#endif
@@ -1,28 +0,0 @@
; JC3636W518 — ESP32-S3R8, 16 MB QIO flash, 8 MB OPI PSRAM, 360x360 ST77916 QSPI + CST816S
; Settings mirror the vendor Arduino IDE setup (2-Program Example/Demo_Arduino/docs/Arduino set up.png)
[env:jc3636w518]
; pioarduino = Arduino core 3.0.5 (ESP32_Display_Panel 0.1.4 needs core 3.x)
platform = https://github.com/pioarduino/platform-espressif32/releases/download/51.03.05/platform-espressif32.zip
board = esp32-s3-devkitc-1
framework = arduino
board_build.arduino.memory_type = qio_opi
board_build.flash_mode = qio
board_upload.flash_size = 16MB
board_build.partitions = huge_app.csv
build_flags =
-DBOARD_HAS_PSRAM
-DARDUINO_USB_CDC_ON_BOOT=1
; LVGL (also when compiled as a library) picks up include/lv_conf.h of this project
-DLV_CONF_INCLUDE_SIMPLE
-Iinclude
; vendor-bundled libraries: ESP32_Display_Panel 0.1.4, ESP32_IO_Expander 0.0.2, lvgl 8.3.11
lib_extra_dirs = ../../2-Program Example/Demo_Arduino/library
upload_port = COM21
monitor_port = COM21
monitor_speed = 115200
monitor_filters = esp32_exception_decoder
@@ -1,184 +0,0 @@
#include <Arduino.h>
#include "scr_st77916.h"
#include "SD_MMC.h"
// https://randomnerdtutorials.com/esp32-client-server-wi-fi/
#include <WiFi.h>
#include <HTTPClient.h>
const char* ssid = "ESP32-Access-Point";
const char* password = "123456789";
String httpGETRequest(const char* serverName);
void my_print(const char* buf) {
Serial.println(buf); // Print logs to the serial monitor
}
void display_animation() {
lv_obj_t* img;
img = lv_gif_create(lv_scr_act());
Serial.print("Available Heap before: ");
Serial.println(esp_get_free_heap_size());
lv_mem_monitor_t mem_mon;
lv_mem_monitor(&mem_mon);
printf("Free memory: %d bytes\n", mem_mon.free_size);
lv_fs_file_t file;
if (lv_fs_open(&file, "A:wallpaper.gif", LV_FS_MODE_RD) == LV_FS_RES_OK) {
lv_fs_close(&file); // File exists, proceed with loading
lv_gif_set_src(img, "A:wallpaper.gif");
Serial.println("GIF Loaded Successfully");
} else {
Serial.println("Failed to Load GIF: File not found or inaccessible");
}
Serial.print("Available Heap after: ");
Serial.println(esp_get_free_heap_size());
lv_mem_monitor(&mem_mon);
printf("Free memory: %d bytes\n", mem_mon.free_size);
lv_obj_align(img, LV_ALIGN_CENTER, 0, 0);
}
lv_obj_t* label1;
void display_text() {
// Create a style for the text
static lv_style_t style_text;
lv_style_init(&style_text);
// Set the text color to white
lv_style_set_text_color(&style_text, lv_color_white());
// // Set the shadow color to black (this will simulate the outline)
// lv_style_set_shadow_color(&style_text, lv_color_black());
// // Set the shadow width to create the outline effect
// lv_style_set_shadow_width(&style_text, 2); // Adjust for desired outline thickness
// // Set the shadow offset to 0 so it surrounds the text evenly
// lv_style_set_shadow_ofs_x(&style_text, 0);
// lv_style_set_shadow_ofs_y(&style_text, 0);
label1 = lv_label_create(lv_scr_act());
// Apply the style to the label
lv_obj_add_style(label1, &style_text, LV_PART_MAIN);
// lv_style_set_text_font(&label1, &Montserrat); /*Set a larger font*/
lv_label_set_long_mode(label1, LV_LABEL_LONG_WRAP); /*Break the long lines*/
lv_label_set_text(label1, "0");
lv_obj_set_width(label1, 150); /*Set smaller width to make the lines wrap*/
lv_obj_set_style_text_align(label1, LV_TEXT_ALIGN_CENTER, 0);
lv_obj_align(label1, LV_ALIGN_CENTER, 0, 0);
// lv_obj_set_style_transform_zoom(label1, 256 * 2, 0); // Zoom: 256 = 1x scale (default)
}
void connectToWifi() {
WiFi.begin(ssid, password);
Serial.println("Connecting");
while (WiFi.status() != WL_CONNECTED) {
delay(500);
Serial.print(".");
}
Serial.println("");
Serial.print("Connected to WiFi network with IP Address: ");
Serial.println(WiFi.localIP());
}
void setup() {
delay(200);
Serial.begin(115200);
scr_lvgl_init();
lv_init();
//lv_log_register_print_cb(my_print); // Register print function for LVGL logs
// Get the active screen (root object for the display)
lv_obj_t* screen = lv_scr_act();
// Set the background color of the entire screen to black
lv_obj_set_style_bg_color(screen, lv_color_black(), 0); // 0 is the part ID for the main part
lv_obj_set_style_bg_opa(screen, LV_OPA_COVER, 0); // Set opacity to fully opaque
// Configure the SDMMC host
SD_MMC.setPins(SD_MMC_CLK_PIN, SD_MMC_CMD_PIN, SD_MMC_D0_PIN, SD_MMC_D1_PIN, SD_MMC_D2_PIN, SD_MMC_D3_PIN);
if (!SD_MMC.begin()) {
Serial.println("Card Mount Failed");
return;
}
uint8_t cardType = SD_MMC.cardType();
if (cardType == CARD_NONE) {
Serial.println("No SD card attached");
return;
}
Serial.println("SD Card initialized successfully.");
connectToWifi();
display_animation();
display_text();
}
void loop() {
lv_timer_handler();
vTaskDelay(5);
lv_mem_monitor_t mem_mon;
lv_mem_monitor(&mem_mon);
printf("Free memory: %d bytes\n", mem_mon.free_size);
Serial.print("Available Heap: ");
Serial.println(esp_get_free_heap_size());
if (WiFi.status() == WL_CONNECTED) {
String speed = httpGETRequest("http://192.168.4.1/speed");
Serial.print("Speed: ");
Serial.println(speed);
lv_label_set_text(label1, speed.c_str());
} else {
Serial.println("WiFi Disconnected");
connectToWifi();
}
}
String httpGETRequest(const char* serverName) {
WiFiClient client;
HTTPClient http;
// Your Domain name with URL path or IP address with path
http.begin(client, serverName);
// Send HTTP POST request
int httpResponseCode = http.GET();
String payload = "--";
if (httpResponseCode > 0) {
Serial.print("HTTP Response code: ");
Serial.println(httpResponseCode);
payload = http.getString();
} else {
Serial.print("Error code: ");
Serial.println(httpResponseCode);
}
// Free resources
http.end();
return payload;
}
@@ -1,703 +0,0 @@
/*******************************************************************************
* Size: 100 px
* Bpp: 1
* Opts: --bpp 1 --size 100 --no-compress --font Montserrat-Regular.ttf --symbols 1234567890 --format lvgl -o montserrat_100.c
******************************************************************************/
#include "lvgl.h"
#ifndef MONTSERRAT_100
#define MONTSERRAT_100 1
#endif
#if MONTSERRAT_100
/*-----------------
* BITMAPS
*----------------*/
/*Store the image of the glyphs*/
static LV_ATTRIBUTE_LARGE_CONST const uint8_t glyph_bitmap[] = {
/* U+0030 "0" */
0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
0x0, 0x7, 0xff, 0xe0, 0x0, 0x0, 0x0, 0x0,
0x3f, 0xff, 0xfc, 0x0, 0x0, 0x0, 0x0, 0xff,
0xff, 0xff, 0x0, 0x0, 0x0, 0x3, 0xff, 0xff,
0xff, 0xc0, 0x0, 0x0, 0xf, 0xff, 0xff, 0xff,
0xe0, 0x0, 0x0, 0x1f, 0xff, 0xff, 0xff, 0xf8,
0x0, 0x0, 0x3f, 0xfc, 0x0, 0x3f, 0xfc, 0x0,
0x0, 0x7f, 0xe0, 0x0, 0x7, 0xfe, 0x0, 0x0,
0xff, 0xc0, 0x0, 0x3, 0xff, 0x0, 0x1, 0xff,
0x0, 0x0, 0x0, 0xff, 0x0, 0x1, 0xfe, 0x0,
0x0, 0x0, 0x7f, 0x80, 0x3, 0xfc, 0x0, 0x0,
0x0, 0x3f, 0xc0, 0x7, 0xf8, 0x0, 0x0, 0x0,
0x1f, 0xe0, 0x7, 0xf8, 0x0, 0x0, 0x0, 0x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x0, 0x0, 0x1f,
0xe0, 0x0, 0x0, 0x0, 0x0, 0x3, 0xfc, 0x0,
0x0, 0x0, 0x0, 0x0, 0x7f, 0xc0, 0x0, 0x0,
0x0, 0x0, 0xf, 0xf8, 0x0, 0x0, 0x0, 0x0,
0x1, 0xff, 0x0, 0x0, 0x0, 0x0, 0x0, 0x7f,
0xe0, 0x0, 0x38, 0x0, 0x0, 0x1f, 0xfc, 0x0,
0x3, 0xf0, 0x0, 0xf, 0xff, 0x80, 0x0, 0x7f,
0xff, 0xff, 0xff, 0xf0, 0x0, 0x7, 0xff, 0xff,
0xff, 0xfc, 0x0, 0x0, 0xff, 0xff, 0xff, 0xff,
0x80, 0x0, 0x7, 0xff, 0xff, 0xff, 0xe0, 0x0,
0x0, 0x1f, 0xff, 0xff, 0xf0, 0x0, 0x0, 0x0,
0x1f, 0xff, 0xf8, 0x0, 0x0, 0x0, 0x0, 0x1,
0x80, 0x0, 0x0, 0x0
};
/*---------------------
* GLYPH DESCRIPTION
*--------------------*/
static const lv_font_fmt_txt_glyph_dsc_t glyph_dsc[] = {
{.bitmap_index = 0, .adv_w = 0, .box_w = 0, .box_h = 0, .ofs_x = 0, .ofs_y = 0} /* id = 0 reserved */,
{.bitmap_index = 0, .adv_w = 1059, .box_w = 56, .box_h = 72, .ofs_x = 5, .ofs_y = -1},
{.bitmap_index = 504, .adv_w = 578, .box_w = 24, .box_h = 70, .ofs_x = 0, .ofs_y = 0},
{.bitmap_index = 714, .adv_w = 909, .box_w = 51, .box_h = 71, .ofs_x = 2, .ofs_y = 0},
{.bitmap_index = 1167, .adv_w = 902, .box_w = 51, .box_h = 71, .ofs_x = 1, .ofs_y = -1},
{.bitmap_index = 1620, .adv_w = 1058, .box_w = 61, .box_h = 70, .ofs_x = 3, .ofs_y = 0},
{.bitmap_index = 2154, .adv_w = 906, .box_w = 50, .box_h = 71, .ofs_x = 2, .ofs_y = -1},
{.bitmap_index = 2598, .adv_w = 974, .box_w = 53, .box_h = 72, .ofs_x = 5, .ofs_y = -1},
{.bitmap_index = 3075, .adv_w = 942, .box_w = 52, .box_h = 70, .ofs_x = 3, .ofs_y = 0},
{.bitmap_index = 3530, .adv_w = 1021, .box_w = 54, .box_h = 72, .ofs_x = 5, .ofs_y = -1},
{.bitmap_index = 4016, .adv_w = 974, .box_w = 52, .box_h = 72, .ofs_x = 3, .ofs_y = -1}
};
/*---------------------
* CHARACTER MAPPING
*--------------------*/
/*Collect the unicode lists and glyph_id offsets*/
static const lv_font_fmt_txt_cmap_t cmaps[] =
{
{
.range_start = 48, .range_length = 10, .glyph_id_start = 1,
.unicode_list = NULL, .glyph_id_ofs_list = NULL, .list_length = 0, .type = LV_FONT_FMT_TXT_CMAP_FORMAT0_TINY
}
};
/*--------------------
* ALL CUSTOM DATA
*--------------------*/
#if LVGL_VERSION_MAJOR == 8
/*Store all the custom data of the font*/
static lv_font_fmt_txt_glyph_cache_t cache;
#endif
#if LVGL_VERSION_MAJOR >= 8
static const lv_font_fmt_txt_dsc_t font_dsc = {
#else
static lv_font_fmt_txt_dsc_t font_dsc = {
#endif
.glyph_bitmap = glyph_bitmap,
.glyph_dsc = glyph_dsc,
.cmaps = cmaps,
.kern_dsc = NULL,
.kern_scale = 0,
.cmap_num = 1,
.bpp = 1,
.kern_classes = 0,
.bitmap_format = 0,
#if LVGL_VERSION_MAJOR == 8
.cache = &cache
#endif
};
/*-----------------
* PUBLIC FONT
*----------------*/
/*Initialize a public general font descriptor*/
#if LVGL_VERSION_MAJOR >= 8
const lv_font_t montserrat_100 = {
#else
lv_font_t montserrat_100 = {
#endif
.get_glyph_dsc = lv_font_get_glyph_dsc_fmt_txt, /*Function pointer to get glyph's data*/
.get_glyph_bitmap = lv_font_get_bitmap_fmt_txt, /*Function pointer to get glyph's bitmap*/
.line_height = 72, /*The maximum line height required by the font*/
.base_line = 1, /*Baseline measured from the bottom of the line*/
// #if !(LVGL_VERSION_MAJOR == 6 && LVGL_VERSION_MINOR == 0)
// .subpx = LV_FONT_SUBPX_NONE,
// #endif
// #if LV_VERSION_CHECK(7, 4, 0) || LVGL_VERSION_MAJOR >= 8
// .underline_position = -10,
// .underline_thickness = 5,
// #endif
.dsc = &font_dsc, /*The custom font data. Will be accessed by `get_glyph_bitmap/dsc` */
// #if LV_VERSION_CHECK(8, 2, 0) || LVGL_VERSION_MAJOR >= 9
// .fallback = NULL,
// #endif
.user_data = NULL,
};
#endif /*#if MONTSERRAT_100*/
@@ -1,18 +0,0 @@
; ELM327 -> WiFi bridge — runs on a CLASSIC ESP32 (needs Bluetooth Classic, which the ESP32-S3 lacks)
; Original note: "needs esp32 2.0.* in boards manager" -> official platform 6.10.0 = Arduino core 2.0.17
[env:esp32dev]
platform = espressif32@6.10.0
board = esp32dev
framework = arduino
; BluetoothSerial + WiFi + web server do not fit the default 1.2 MB app partition
board_build.partitions = huge_app.csv
lib_deps =
powerbroker2/ELMduino@3.4.1
esphome/ESPAsyncWebServer-esphome@3.4.0
; upload_port = COMxx ; set to the classic ESP32's port (COM21 is the JC3636W518)
monitor_speed = 115200
monitor_filters = esp32_exception_decoder
@@ -1,96 +0,0 @@
#include <Arduino.h>
// Import required libraries
#include "WiFi.h"
#include <ESPAsyncWebServer.h>
// needs esp32 2.0.* in boards manaager // https://forum.arduino.cc/t/libary-problem-with-esp32-web-server/1282583/6
// Set your access point network credentials
const char* ssid = "ESP32-Access-Point";
const char* password = "123456789";
#include "BluetoothSerial.h"
#include "ELMduino.h"
// Create AsyncWebServer object on port 80
AsyncWebServer server(80);
BluetoothSerial SerialBT;
#define ELM_PORT SerialBT
#define DEBUG_PORT Serial
ELM327 myELM327;
uint32_t kph = 0;
String readSpeed() {
if (ELM_PORT.isClosed()) {
return "0";
}
float tempkph = myELM327.kph();
if (myELM327.nb_rx_state == ELM_SUCCESS) {
kph = (uint32_t)tempkph;
Serial.print("kph: ");
Serial.println(kph);
} else if (myELM327.nb_rx_state != ELM_GETTING_MSG)
myELM327.printError();
return String(kph);
// return "123";
}
void connectElm() {
if (!ELM_PORT.connect("OBDII")) {
DEBUG_PORT.println("Couldn't connect to OBD scanner - Phase 1");
// while (1)
// ;
return;
}
if (!myELM327.begin(ELM_PORT, true, 2000)) {
Serial.println("Couldn't connect to OBD scanner - Phase 2");
// while (1)
// ;
return;
}
Serial.println("Connected to ELM327");
}
void setup() {
DEBUG_PORT.begin(115200);
SerialBT.setPin("1234");
ELM_PORT.begin("ArduHUD", true);
Serial.println("Starting ELM327 to wifi bridge");
//connectElm();
// Setting the ESP as an access point
Serial.print("Setting AP (Access Point)…");
// Remove the password parameter, if you want the AP (Access Point) to be open
WiFi.softAP(ssid, password);
IPAddress IP = WiFi.softAPIP();
Serial.print("AP IP address: ");
Serial.println(IP);
server.on("/speed", HTTP_GET, [](AsyncWebServerRequest* request) {
request->send_P(200, "text/plain", readSpeed().c_str());
});
// Start server
server.begin();
}
void loop() {
if (ELM_PORT.isClosed()) {
Serial.println("Trying to reconnect to ELM327");
connectElm();
}
}
-7
View File
@@ -1,7 +0,0 @@
.pio
.vscode/.browse.c_cpp.db*
.vscode/c_cpp_properties.json
.vscode/launch.json
.vscode/ipch
.vscode/extensions.json
-260
View File
@@ -1,260 +0,0 @@
# ELMulator
## ODBII & ELM327 Emulation library
This is a fork of the [GTTurboEcu library by TheBigBadWolfClub](https://github.com/TheBigBadWolfClub/GTTurboEcu) which is no longer being maintained.
I have updated the library with the following changes:
- included fixes submitted to the upstream fork but never merged
- updated the library to work with Bluetooth serial devices (like esp32)
- added support for connecting via WiFi (default port 30000)
- added additional functions to the emulator
- optimized the use of String class for lower memory requirements
- fixed a few bugs from earlier version
- refactored many methods to simplify use of the library
- made it easier to add your own new functions with sample/test data
- implemented a simple emulation mode that can be easily configured with just a few lines of code
- added new example programs to demonstrate use of the library
This library allows you to program a microcontroller device to emulate an ELM327 OBDII adapter connected to an ECU. The emulator can work with any of the huge number of ODBII apps that are compatible with the ELM327-standard adapters, like Torque or CarScanner.
There are two main use cases for this library:
1. It is ideal for use in developing OBDII applications using the [ELMduino](https://github.com/PowerBroker2/ELMduino) library. You can build the example program, upload it to a $10 ESP32 device with builtin Bluetooth and use it for your testing and development, avoiding the need to be communicating with an actual ELM327 device plugged into a vehicle. (Doing app development sitting on a folding chair in the garage gets old pretty quickly...).
2. This library can be used to as the building block for creating your own ELM327 compatible device that can read values from various custom sensors and allow you to monitor
those sensors with your own software or one of the many OBDII client applcations that are compatible with the ELM327 specification. No connection to an actual OBDII port is needed.
## Platforms
ELMulator is built and tested using the Arduino framework on a variety of ESP32 dev boards. The ESP32 platform is ideal as it has Bluetooth, Wifi and serial capability included and is very inexpensive. The library should work with any Arduino compatible device with the use of additional hardware like the [HC05 Bluetooth Module](https://components101.com/wireless/hc-05-bluetooth-module) to provide Bluetooth capability.
## Using ELMulator
In order to take best advantage of this library, you should be familiar with two specifications:
- The [OBDII protocol](https://en.wikipedia.org/wiki/OBD-II_PIDs)
- The [ELM327 datasheet](https://www.elmelectronics.com/DSheets/ELM327DSH.pdf)
You need to understand what a PID is and how it is defined (mode, pid, number of bytes, conversion formulas ...) and how to send/receive PID info from the ELM327 device.
### Easily create an ELM327 emulator with just a few lines of code:
```C
#include "ESP32_Simple_ELMulator.h"
/**
* This example demonstrates a very simple implementation of ELMulator.
* It handles all AT Commands, SUPPORTED_PIDS queries, etc. and rejectss unsupported requests.
* All Mode 01 PID requests are provided a response of the correct data size with mock data values.
* Typical use case is for testing custom applications to work with ELM327 devices.
*/
const String deviceName = "ELMULATOR"; // Bluetooth device name to use (no pin)
ELMulator ELMulator;
void setup()
{
Serial.begin(115200);
Serial.println("Starting ELMulator...");
ELMulator.init(deviceName, true); // Initialize with support for all PIDs 0x00 to 0x65, providing mock data
ELMulator.begin(); // ELMulator will run continuously, listening for and respondng to requests
}
void loop() {}
```
That's it. Complile and install the program on an inexpensive ESP32 dev board and you can be running in a couple of minutes. You can connect your app or device to the Bluetooth device "ELMULATOR" and query it as though it were an ELM327 adapter connected to a vehicle. Very handy for testing, without the need to install and configure a physical adapter attached to an actual vehicle.
### Custom ELM327-compatible programs/devices
You can also use ELMulator to provide custom responses to specific queries or as the basis for your own device that reads physical sensors and provides sensor data via the OBDII / ELM327 protocols. This example code shows responding to PID requests with hardcoded values, custom sensor data and mock sensor values to demonstrate some of the possibilities for creating your ELM327 compatible application or device.
```C
#include "ESP32_Custom_ELMulator.h"
const String deviceName = "ELMULATOR"; // Bluetooth device name to use (no pin)
// Set up hardcoded responses to non-standard PID requests for MIL, DTC, ODO data
const String milResponse = "4101830000"; // MIL response code indicating 3 current DTC
const String dtcResponse = "43010341\r\n43010123\r\n43010420"; // DTC response returning 3 DTC codes (multiline response)
const uint32_t odoResponse = 1234567; // Hardcode an odometer reading of 1234567
ELMulator ELMulator;
void setup()
{
Serial.begin(115200);
Serial.println("Starting ELMulator...");
ELMulator.init(deviceName);
// Register the specific PIDs we are going to handle.
// ELMulator will respond to SUPPORTED_PIDS request ("0101") with the appropriate value
// indicating which PIDs it can respond to.
ELMulator.registerMode01Pid(ODOMETER);
ELMulator.registerMode01Pid(ENGINE_COOLANT_TEMP);
ELMulator.registerMode01Pid(ENGINE_RPM);
ELMulator.registerMode01Pid(MONITOR_STATUS_SINCE_DTC_CLEARED);
ELMulator.registerMode01Pid(INTAKE_MANIFOLD_ABS_PRESSURE);
ELMulator.registerMode01Pid(ENGINE_LOAD);
ELMulator.registerMode01Pid(VEHICLE_SPEED);
ELMulator.registerMode01Pid(INTAKE_AIR_TEMP);
ELMulator.registerMode01Pid(THROTTLE_POSITION);
}
void loop()
{
/**
* Waits for a new request from an ELM client and does some pre-processing to validate the PID and request.
* Non-PID requests like AT commands and SUPPORTED_PIDS queries will be handled by ELMulator automatically.
* PID requests will be verified as supported (registered); unsupported PIDs responded to with NO DATA response.
* Returns true if the request is for one of the PIDS we have registered above so we can respond to it.
*/
if (ELMulator.readELMRequest())
{
handlePIDRequest(ELMulator.elmRequest);
}
}
/**
* After receiving a supported PID(sensor) request, we prepare the response here.
* Response can come from a hardcoded value, a real hardware sensor, or a mock value.
* Default response is a mock value if no other handling is provided.
*/
void handlePIDRequest(const String &request)
{
// Handle special case requests like MIL and DTC checks
if (ELMulator.isMode03(request)) // Mode 03 request == Returns (hardcoded) list current DTC codes
{
if (dtcResponse.length())
{
ELMulator.writeResponse(dtcResponse);
return;
}
else
{
DEBUG("DTC response is empty.");
ELMulator.writePidNotSupported();
return;
}
}
else if (ELMulator.isMode01MIL(request)) // Mode 0101 MIL request == Returns (hardcoded) number of current DTC codes
{
if (milResponse.length())
{
ELMulator.writeResponse(milResponse);
return;
}
else
{
DEBUG("MIL response is empty.");
ELMulator.writePidNotSupported();
return;
}
}
else // Handle any other supported PID request
{
uint8_t pidCode = ELMulator.getPidCode(request); // Extract the specific PID code from the request
// Example response for 0x05 (Engine Coolant Temp) - returning a mock data value
if (pidCode == ENGINE_COOLANT_TEMP)
{
uint32_t sensorValue = ELMulator.getMockSensorValue();
/**
* Response parameters:
* request - specifies the original PID request being responded to.
* numberOfBytes - the number of bytes this PID value returns (per OBDII spec), using lookup table responseBytes.
* sensorValue - the value to return in our response; a mock value in this example.
*/
ELMulator.writePidResponse(request, responseBytes[pidCode], sensorValue);
return;
}
// Example response for PID 0x0C (Engine RPM) - returns a modified mock sensor value
else if (pidCode == ENGINE_RPM)
{
uint16_t rpmValue = ELMulator.getMockSensorValue() * 100; // Here we multiply the mock value provided, for a more realistic RPM number
ELMulator.writePidResponse(request, responseBytes[pidCode], rpmValue);
return;
}
// Example response for PID 0xA6 (Odometer) - returns our hardcoded odometer response string
else if (pidCode == ODOMETER)
{
ELMulator.writePidResponse(request, responseBytes[pidCode], odoResponse);
return;
}
// // Example response for PID 0xOD (Vehicle speed) - returns a value from external GPS
// else if (pidCode == VEHICLE_SPEED)
// {
// uint32_t gpsSpeed = myGPS.speed();
// ELMulator.writePidResponse(request, responseBytes[pidCode], gpsSpeed);
// return;
// }
// Default response for any other supported PID request - returns an unmodified mock sensor value
else
{
ELMulator.writePidResponse(request, responseBytes[pidCode], ELMulator.getMockSensorValue());
return;
}
}
}
```
## Using ELMulator with an addon Bluetooth module (GPIO)
By default, ELMulator will work on an EPS32 with builtin Bluetooth, but you can configure another device type for use with a bluetooth module like the [HC05 Bluetooth Module](https://components101.com/wireless/hc-05-bluetooth-module) connected via GPIO and using SoftwareSerial.h library. To do so, the following two changes need to be made:
1. Update definitions.h file and undefine or set to false "BLUETOOTH_BUILTIN":
```
// true == We are using hardware that has builtin Bluetooth
// false == We are using hardware with a Bluetooth module attached via GPIO pins
#define BLUETOOTH_BUILTIN true
```
2. Provide the serial baud rate, Rx and Tx pin numbers when creating your ELMulator instance:
```
/**
* When creating a new instance of ELMulator with an attached
* BT module, we need to set the Bluetooth serial parameters
*
* @param baudRate - rate for bluetooth serial port (normally 9600)
* @param rxPin - the Arduino RX pin for the Bluetooth module (serial port)
* @param txPin - the Arduino TX pin for the Bluetooth module (serial port)
* @return
*/
ELMulator(uint32_t baudRate, uint8_t rxPin, uint8_t txPin);
```
Other than that, use of the ELMulator library is the same as when using builtin Bluetooth.
## License
The MIT License (MIT)
Copyright (c) 2023 Jim Whitelaw
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
Whitespace-only changes.
@@ -1,9 +0,0 @@
name=ELMulator
version=1.0.0
author=jimwhitelaw
maintainer=jimwhitelaw@gmail.com
sentence=Arduino ODBII ELM327 Emulator - Allows Arduino to act as a ECU and a OBD2 ELM327 device and response to PID requests, from any given ODBII app (ex: android::torque).
paragraph=Using Arduino and Bluetooth shield to act as an ELM237. Connect sensors to arduino define their PID code and it's possible to see them in an app like Torque.
category=Communication
url=https://github.com/jimwhitelaw/ELMulator
architectures=*
@@ -1,162 +0,0 @@
#include "ATCommands.h"
#include "definitions.h"
#if USE_WIFI
ATCommands::ATCommands(OBDWiFiComm *connection) {
this->connection = connection;
}
#else
ATCommands::ATCommands(OBDSerialComm *connection) {
this->connection = connection;
}
#endif
ATCommands::~ATCommands() {
operator delete(this->connection);
}
bool ATCommands::process(const String& command) {
bool processed = false;
if (isATCommand(command)) {
processed = true;
processCommand(command);
DEBUG("RX AT: " + command);
}
return processed;
}
void ATCommands::processCommand(const String& command) {
// if space is enabled (ex: AT H[charPosition])
uint8_t offset = 2;
if (command.charAt(2) == 0x20) {
offset = 3;
}
// refer to ELM327 specs
String specificCommand = command.substring(offset, command.length());
if (specificCommand.startsWith("D",offset)) {
ATCommands::ATD();
} else if (specificCommand.startsWith("Z")) {
ATCommands::ATZ();
} else if (specificCommand.startsWith("I")) {
ATCommands::ATI();
} else if (specificCommand.startsWith("E")) {
ATCommands::ATEx(specificCommand);
} else if (specificCommand.startsWith("L")) {
ATCommands::ATLx(specificCommand);
} else if (specificCommand.startsWith("M")) {
ATCommands::ATMx(specificCommand);
} else if (specificCommand.startsWith("S")) {
if (specificCommand.startsWith("SP")) {
ATCommands::ATSPx(specificCommand);
} else {
ATCommands::ATSx(specificCommand);
}
} else if (specificCommand.startsWith("H")) {
ATCommands::ATHx(specificCommand);
} else if (specificCommand.startsWith("AT")) {
ATCommands::ATATx(specificCommand);
} else if (specificCommand.startsWith("DPN")) {
ATCommands::ATDPN();
} else if (specificCommand.startsWith("DESC") || specificCommand.startsWith("@1")) {
ATCommands::ATDESC();
} else if (specificCommand.startsWith("PC")) {
ATCommands::ATPC();
} else if (specificCommand.startsWith("RV")){
ATCommands::ATRV();
} else {
// lets assume we process any at command
connection->writeEndOK();
}
}
// set all to defaults
void ATCommands::ATD() {
connection->setToDefaults();
connection->writeEndOK();
}
// reset all
void ATCommands::ATZ() {
connection->setToDefaults();
connection->writeTo(ID);
connection->writeEndOK();
}
// Print the version ID
void ATCommands::ATI() {
connection->writeTo(ID);
connection->writeEndOK();
}
// send description
void ATCommands::ATDESC() {
connection->writeTo(DESC);
connection->writeEndOK();
}
// set echoEnable 0=off 1=on
void ATCommands::ATEx(String& cmd) {
connection->setEcho(cmd.equals("E0") ? false : true);
connection->writeEndOK();
}
// set memory off=0 on=1
void ATCommands::ATMx(String& cmd) {
connection->setMemory(cmd.equals("M0") ? false : true);
connection->writeEndOK();
}
// line feeds off=0 on=1
void ATCommands::ATLx(String& cmd) {
connection->setLineFeeds(cmd.equals("L0") ? false : true);
connection->writeEndOK();
}
// ATSx printing spaces off=0 on=1
void ATCommands::ATSx(String& cmd) {
connection->setWhiteSpaces(cmd.equals("S0") ? false : true);
connection->writeEndOK();
}
// Headers off=0 on=1
void ATCommands::ATHx(String& cmd) {
connection->setHeaders(cmd.equals("H0") ? false : true);
connection->writeEndOK();
}
// ATSPx Define protocol 0=auto
void ATCommands::ATSPx(String& cmd) {
connection->writeEndOK();
}
// set protocol
void ATCommands::ATDPN() {
connection->writeTo(PROTOCOL);
connection->writeEndOK();
}
// AT AT2 adaptative time control
void ATCommands::ATATx(String& cmd) {
connection->writeEndOK();
}
// Terminates current diagnostic session. Protocol close
void ATCommands::ATPC() {
connection->writeEndOK();
}
void ATCommands::ATRV() {
connection->writeTo("AT RV\r13.5V");
connection->writeEnd();
}
// return true ir connectionand is AT
bool ATCommands::isATCommand(const String& command) {
toUpperCase(command.charAt(0));
return command.startsWith("AT") ? true : false;
}
@@ -1,65 +0,0 @@
#ifndef ELMulator_ATCommands_h
#define ELMulator_ATCommands_h
#include <Arduino.h>
#include "definitions.h"
#if USE_WIFI
#include "OBDWiFiComm.h"
#else
#include "OBDSerialComm.h"
#endif
class ATCommands
{
public:
#if USE_WIFI
ATCommands(OBDWiFiComm *connection);
#else
ATCommands(OBDSerialComm *connection);
#endif
~ATCommands();
bool process(const String &string);
private:
// Variables
#if USE_WIFI
OBDWiFiComm *connection;
#else
OBDSerialComm *connection;
#endif
void ATD();
void ATZ();
void ATI();
void ATEx(String &x);
void ATMx(String &x);
void ATLx(String &x);
void ATSx(String &x);
void ATHx(String &x);
void ATSPx(String &x);
void ATATx(String &cmd);
void ATPC();
void ATDPN();
void ATDESC();
void ATRV();
void processCommand(const String &command);
bool isATCommand(const String &command);
};
#endif
@@ -1,218 +0,0 @@
#include "ELMulator.h"
#if USE_WIFI
ELMulator::ELMulator()
{
_connection = new OBDWiFiComm();
_atProcessor = new ATCommands(_connection);
_pidProcessor = new PidProcessor(_connection);
_lastCommand = "";
elmRequest.reserve(MAX_REQUEST_SIZE);
elmRequest = "";
}
#else
ELMulator::ELMulator()
{
_connection = new OBDSerialComm();
_atProcessor = new ATCommands(_connection);
_pidProcessor = new PidProcessor(_connection);
_lastCommand = "";
elmRequest.reserve(MAX_REQUEST_SIZE);
elmRequest = "";
}
#endif
ELMulator::~ELMulator() {}
void ELMulator::init(const String &deviceName, bool registerPids)
{
_connection->init(deviceName);
if (registerPids)
{
registerAllMode01Pids();
}
}
void ELMulator::registerAllMode01Pids()
{
// Set up PIDs 0x00 to 0x65
// Will be provided a response with mock data value if no special handling is performed.
// Requests for PID > 0x65 are not currently supported - will return "NO DATA"
for (int i = 0; i < 0x66; i++)
{
_pidProcessor->registerMode01Pid(i);
}
}
bool ELMulator::readELMRequest()
{
do
{
elmRequest.clear(); // clear buffer from previous requests
_connection->readData(elmRequest);
elmRequest.toUpperCase();
// TODO ignore spaces, and all control chars (tab, etc)
// TODO accept single carriage return as repeat last command at or pid
// ignore null i.e 00
} while (processRequest(elmRequest)); // processRequest handles all non PID requests (AT commands, errors etc)
return true; // We have received a valid PID request we need to respond to
}
void ELMulator::sendELMResponse()
{
// Respond to any mode 01 request with a mock sensor value
if (isMode01(elmRequest))
{
uint8_t pidCode = getPidCode(elmRequest);
writePidResponse(elmRequest, responseBytes[pidCode], getMockSensorValue());
return;
}
// Not a mode 01 PID request. Report it as not supported (ie, "NO DATA");
else
{
writePidNotSupported();
}
}
void ELMulator::begin()
{
while (readELMRequest())
{
sendELMResponse();
}
}
uint8_t ELMulator::getPidCode(const String &request)
{
return _pidProcessor->getPidCodeFromRequest(request);
}
bool ELMulator::registerMode01Pid(uint32_t pid)
{
return _pidProcessor->registerMode01Pid(pid);
}
bool ELMulator::registerMode01MILResponse(const String &response)
{
return _pidProcessor->registerMode01MILResponse(response);
}
bool ELMulator::registerMode03Response(const String &response)
{
return _pidProcessor->registerMode03Response(response);
}
void ELMulator::writePidNotSupported()
{
_connection->writeEndNoData();
}
void ELMulator::writePidResponse(const String &requestPid, uint8_t numberOfBytes, uint32_t value)
{
_pidProcessor->writePidResponse(requestPid, numberOfBytes, value);
}
void ELMulator::writeResponse(const String &response)
{
_connection->writeTo(response.c_str());
_connection->writeEnd();
}
bool ELMulator::processRequest(String &command)
{
// TODO: check for no 0X0D char in command, return ? and >
// TODO: receive only <cr>, repeat last command
// carriage return, means repeat last command
if (command == "\n")
{
command = _lastCommand;
}
// empty command, do not send to user
if (command.length() == 0)
{
return true;
}
// Check for AT command
if (_atProcessor->process(command))
{
_lastCommand = command;
return true;
}
// Check for a valid hex string, return error if false
if (!isValidHex(command.c_str()))
{
_connection->writeEndUnknown();
DEBUG("Invalid HEX command: " + command);
return true;
}
// Check for a valid PID request
if (_pidProcessor->process(command))
{
_lastCommand = command;
return true;
}
return false;
}
bool ELMulator::isValidHex(const char *pid)
{
return (pid[strspn(pid, "0123456789abcdefABCDEF")] == 0);
}
bool ELMulator::isMode01(const String &command)
{
return _pidProcessor->isMode01(command);
}
bool ELMulator::isMode22(const String &command)
{
return _pidProcessor->isMode22(command);
}
bool ELMulator::isMode03(const String &command)
{
return _pidProcessor->isMode03(command);
}
bool ELMulator::isMode01MIL(const String &command)
{
return _pidProcessor->isMode01MIL(command);
}
/**
* Fake some data
* start counter = 0
* every call to getFakeSensorData, will increment the counter to a max of 255 (0xff)
* When 0xff is reached the cycle is reverted
* and the counter will decrement by one until 0 is reached
*/
uint32_t ELMulator::getMockSensorValue()
{
if (isCycleUp)
{
cycle++;
if (cycle == 0xff)
{
isCycleUp = false;
}
}
else
{
cycle--;
if (cycle == 0)
{
isCycleUp = true;
}
}
return cycle;
}
@@ -1,138 +0,0 @@
#ifndef ELMulator_ELMulator_h
#define ELMulator_ELMulator_h
#include <Arduino.h>
#include "definitions.h"
#if USE_WIFI
#include "OBDWiFiComm.h"
#else
#include "OBDSerialComm.h"
#endif
#include "ATCommands.h"
#include "PidProcessor.h"
#include "definitions.h"
class ELMulator
{
public:
/**
* When creating a new instance of ELMulator with an attached
* BT module, we need to set the Bluetooth serial parameters
*
* @param baudRate - rate for bluetooth serial port (normally 9600)
* @param rxPin - the Arduino RX pin for the Bluetooth module (serial port)
* @param txPin - the Arduino TX pin for the Bluetooth module (serial port)
* @return
*/
ELMulator(uint32_t baudRate, uint8_t rxPin, uint8_t txPin);
ELMulator();
~ELMulator();
void init(const String &deviceName, const bool registerPids = false);
/**
* Waits and Reads a request from OBD client software (example: torque)
*
* It will only return if the OBD client software
* request's one of the previous registred PID (see: registerMode01Pid())
*
* Any other request will be automaticly handle or it will be rejected.
*
* ELMulator lib will automaticly handle:
* - any AT command
* - PID's support request like 0100, 0120, 0140, 0160, ...
*
* @return the request PID (Vehicle speed ex: 010D )
*/
bool readELMRequest();
void sendELMResponse();
void begin();
/**
* Registry the PID's (sensors) your arduino will support.
* Currently ELMulator lib only supports MODE 01 PID's
*
* In OBDII MODE 01 PID's, are request
* to Show current data for a given sensor identified by a PID
*
* List of MODE 01 PID's: https://en.wikipedia.org/wiki/OBD-II_PIDs#Mode_01
*
* Example, for Vehicle speed, where OBDII PID code is 0D:
*
* registerMode01Pid(0x0D)
*
* @param pidHexId
* @return returns true if the entered ID is in the valide range [0x00, 0xFF]
*/
bool registerMode01Pid(uint32_t pidHexId);
bool registerMode01MILResponse(const String &response);
bool registerMode03Response(const String &response);
uint8_t getPidCodeOnly(uint16_t hexCommand);
/**
* Used to informe the OBD client that the PID,
* it has requested is not supported
*
* In normal conditions, you will only receive,
* request for the PID you have registred
* All other request is automaticly handle by GTTuboEcu lib
*/
void writePidNotSupported();
/**
* Respond to a given PID request from OBDII client (ex: torque)
*
* @param requestPid - the received pid
* @param numberOfBytes - number of bytes this PID response VALUE is supposed to have
* @param value - sensor value for this PID,
* lib will convert it to HEX
* with the appropriated number of HEX chars (numberOfChars)
*/
void writePidResponse(const String &requestPid, uint8_t numberOfBytes, uint32_t value);
// Write the response back to the requestor without PID formatting, etc
// Just pass the response string on. Useful for testing with a specific response
// that has been pre-configured.
void writeResponse(const String &response);
bool isMode01(const String &command);
bool isMode03(const String &command);
bool isMode01MIL(const String &command);
bool isMode22(const String &command);
uint8_t getPidCode(const String &request);
void registerAllMode01Pids();
uint32_t getMockSensorValue();
String elmRequest;
private:
#if USE_WIFI
OBDWiFiComm *_connection;
#else
OBDSerialComm *_connection;
#endif
ATCommands *_atProcessor;
PidProcessor *_pidProcessor;
String _lastCommand;
bool isCycleUp = true;
uint32_t cycle = 0;
bool processRequest(String &command);
bool isValidHex(const char *pid);
};
#endif
@@ -1,145 +0,0 @@
#include "OBDSerialComm.h"
#include "definitions.h"
OBDSerialComm::OBDSerialComm() {
}
OBDSerialComm::~OBDSerialComm() {
operator delete(serial);
}
void OBDSerialComm::init(const String& deviceName) {
Serial.println("Starting BT . . .");
serial = new BluetoothSerial();
//delay(2000);
serial->begin(deviceName, false);
setToDefaults();
}
void OBDSerialComm::writeEnd() {
// 1 - write carriage return
writeTo("\r");
// 2- (optional ) write linefeed
if (lineFeedEnable) {
writeTo("\n");
}
// 3 - Write prompt
writeTo(">");
serial->flush();
};
void OBDSerialComm::writeEndOK() {
writeTo("OK");
writeEnd();
}
void OBDSerialComm::writeEndERROR() {
writeTo("ERROR");
writeEnd();
}
void OBDSerialComm::writeEndNoData() {
writeTo("NO DATA");
writeEnd();
}
void OBDSerialComm::writeEndUnknown() {
writeTo("?");
writeEnd();
}
void OBDSerialComm::setToDefaults() {
setEcho(true);
setStatus(READY);
setWhiteSpaces(true);
setHeaders(false);
setLineFeeds(true);
setMemory(false);
}
void OBDSerialComm::writeTo(char const *response) {
serial->print(response);
}
void OBDSerialComm::writeTo(uint8_t cChar) {
serial->print(cChar);
}
void OBDSerialComm::writeEndPidTo(char const *response) {
if (whiteSpacesEnabled) {
uint8_t len = strlen(response);
char spacedResponse[len + len / 2 + 1];
addSpacesToResponse(response, spacedResponse);
writeTo(spacedResponse);
} else {
writeTo(response);
}
writeEnd();
}
void OBDSerialComm::readData(String& rxData) {
serial->flush(); // temp remove this
rxData = serial->readStringUntil(SERIAL_END_CHAR);
if (isEchoEnable()) {
writeTo(rxData.c_str());
}
//return rxData;
}
void OBDSerialComm::setBaudRate(uint32_t rate) {
this->baudRate = rate;
}
long OBDSerialComm::getBaudRate() {
return this->baudRate;
}
bool OBDSerialComm::isEchoEnable() {
return this->echoEnable;
}
void OBDSerialComm::setEcho(bool echo) {
this->echoEnable = echo;
}
void OBDSerialComm::setStatus(STATUS status) {
this->status = status;
}
void OBDSerialComm::setLineFeeds(bool status) {
this->lineFeedEnable = status;
}
void OBDSerialComm::setMemory(bool status) {
this->memoryEnabled = status;
}
void OBDSerialComm::setWhiteSpaces(bool status) {
this->whiteSpacesEnabled = status;
}
void OBDSerialComm::setHeaders(bool status) {
this->headersEnabled = status;
}
void OBDSerialComm::addSpacesToResponse(const char *response, char spacedRes[]) {
uint8_t len = strlen(response);
int j = 0;
for (int i = 0; i < len;) {
*(spacedRes + j++) = *(response + i++);
*(spacedRes + j++) = *(response + i++);
if (i < len) {
*(spacedRes + j++) = 0x20;
}
}
*(spacedRes + j) = '\0';
}
@@ -1,90 +0,0 @@
#ifndef ELMulator_OBDSerialComm_h
#define ELMulator_OBDSerialComm_h
#include <Arduino.h>
#include "definitions.h"
#include <BluetoothSerial.h>
class OBDSerialComm
{
public:
enum STATUS
{
IDLE = 0,
READY = 1
};
// // Bluetooth is not built in, we are using a BT module via GPIO
// OBDSerialComm(uint32_t baudRate, uint8_t rxPin, uint8_t txPin);
OBDSerialComm();
~OBDSerialComm();
void init(const String &deviceName);
void writeEndOK();
void writeEndERROR();
/**
* Response for unsupported PID command or missing sensor, respond "NO DATA".
*/
void writeEndNoData();
/**
* Response for invalid AT command, or invalid PID or other bad input, respond "?"
*/
void writeEndUnknown();
void setToDefaults();
void readData(String &rxData);
void writeTo(uint8_t cChar);
void writeTo(char const *string);
void setEcho(bool echo);
void writeEnd();
bool isEchoEnable();
void setLineFeeds(bool status);
void setMemory(bool status);
void setWhiteSpaces(bool status);
void setHeaders(bool status);
void setStatus(STATUS status);
void writeEndPidTo(char const *string);
private:
uint32_t baudRate; // Serial Baud Rate
STATUS status; // Operation status
bool echoEnable; // echoEnable command after received
bool lineFeedEnable;
bool memoryEnabled;
bool whiteSpacesEnabled;
bool headersEnabled;
void setBaudRate(uint32_t rate);
long getBaudRate();
void addSpacesToResponse(const char *response, char string[]);
#ifndef BLUETOOTH_BUILTIN
HardwareSerial *serial; // lib to communicate with bluetooth
#else
BluetoothSerial *serial;
#endif
};
#endif
@@ -1,151 +0,0 @@
#include "OBDWiFiComm.h"
#include "definitions.h"
WiFiServer server(35000);
IPAddress localIP = IPAddress(192, 168, 0, 10);
IPAddress gateway = IPAddress(192, 168, 0, 10);
IPAddress subnet = IPAddress(255,255,255,0);
OBDWiFiComm::OBDWiFiComm() {
}
OBDWiFiComm::~OBDWiFiComm() {
}
void OBDWiFiComm::init(const String& deviceName) {
Serial.println("Starting AP . . .");
WiFi.softAPConfig(localIP, gateway, subnet);
WiFi.softAP(deviceName);
IPAddress myIP = WiFi.softAPIP();
Serial.print("AP IP address: ");
Serial.println(myIP);
Serial.print("AP SSID: ");
Serial.println(deviceName);
server.begin();
setToDefaults();
}
void OBDWiFiComm::writeEnd() {
// 1 - write carriage return
writeTo("\r");
// 2- (optional ) write linefeed
if (lineFeedEnable) {
writeTo("\n");
}
// 3 - Write prompt
writeTo(">");
};
void OBDWiFiComm::writeEndOK() {
writeTo("OK");
writeEnd();
}
void OBDWiFiComm::writeEndERROR() {
writeTo("ERROR");
writeEnd();
}
void OBDWiFiComm::writeEndNoData() {
writeTo("NO DATA");
writeEnd();
}
void OBDWiFiComm::writeEndUnknown() {
writeTo("?");
writeEnd();
}
void OBDWiFiComm::setToDefaults() {
setEcho(true);
setStatus(READY);
setWhiteSpaces(true);
setHeaders(false);
setLineFeeds(true);
setMemory(false);
}
void OBDWiFiComm::writeTo(char const *response) {
client.print(response);
}
void OBDWiFiComm::writeTo(uint8_t cChar) {
client.print(cChar);
}
void OBDWiFiComm::writeEndPidTo(char const *response) {
if (this->whiteSpacesEnabled) {
uint8_t len = strlen(response);
char spacedResponse[len + len / 2 + 1];
addSpacesToResponse(response, spacedResponse);
writeTo(spacedResponse);
} else {
writeTo(response);
}
writeEnd();
}
void OBDWiFiComm::readData(String& rxData) {
if (!client.connected()) {
client = server.available();
}
if(client)
{
rxData
= client.readStringUntil(SERIAL_END_CHAR);
if (isEchoEnable())
{
writeTo(rxData.c_str());
}
}
}
bool OBDWiFiComm::isEchoEnable() {
return this->echoEnable;
}
void OBDWiFiComm::setEcho(bool echo) {
this->echoEnable = echo;
}
void OBDWiFiComm::setStatus(STATUS status) {
this->status = status;
}
void OBDWiFiComm::setLineFeeds(bool status) {
this->lineFeedEnable = status;
}
void OBDWiFiComm::setMemory(bool status) {
this->memoryEnabled = status;
}
void OBDWiFiComm::setWhiteSpaces(bool status) {
this->whiteSpacesEnabled = status;
}
void OBDWiFiComm::setHeaders(bool status) {
this->headersEnabled = status;
}
void OBDWiFiComm::addSpacesToResponse(const char *response, char spacedRes[]) {
uint8_t len = strlen(response);
int j = 0;
for (int i = 0; i < len;) {
*(spacedRes + j++) = *(response + i++);
*(spacedRes + j++) = *(response + i++);
if (i < len) {
*(spacedRes + j++) = 0x20;
}
}
*(spacedRes + j) = '\0';
}
@@ -1,78 +0,0 @@
#ifndef ELMulator_OBDWiFiComm_h
#define ELMulator_OBDWiFiComm_h
#include <Arduino.h>
#include <WiFi.h>
#include <WiFiServer.h>
#include "definitions.h"
class OBDWiFiComm
{
public:
enum STATUS
{
IDLE = 0,
READY = 1
};
OBDWiFiComm();
~OBDWiFiComm();
void init(const String &deviceName);
void writeEndOK();
void writeEndERROR();
/**
* Response for unsupported PID command or missing sensor, respond "NO DATA".
*/
void writeEndNoData();
/**
* Response for invalid AT command, or invalid PID or other bad input, respond "?"
*/
void writeEndUnknown();
void setToDefaults();
void readData(String &rxData);
void writeTo(uint8_t cChar);
void writeTo(char const *string);
void setEcho(bool echo);
void writeEnd();
bool isEchoEnable();
void setLineFeeds(bool status);
void setMemory(bool status);
void setWhiteSpaces(bool status);
void setHeaders(bool status);
void setStatus(STATUS status);
void writeEndPidTo(char const *string);
private:
STATUS status; // Operation status
bool echoEnable; // echoEnable command after received
bool lineFeedEnable;
bool memoryEnabled;
bool whiteSpacesEnabled;
bool headersEnabled;
void addSpacesToResponse(const char *response, char string[]);
WiFiClient client;
};
#endif
@@ -1,195 +0,0 @@
#include "PidProcessor.h"
#if USE_WIFI
PidProcessor::PidProcessor(OBDWiFiComm *connection) {
_connection = connection;
resetPidMode01Array();
};
#else
PidProcessor::PidProcessor(OBDSerialComm *connection) {
_connection = connection;
resetPidMode01Array();
};
#endif
bool PidProcessor::process(String& command) {
bool processed = false;
if (command.length() > 4)
{
command = command.substring(0, 4); // remove num_responses value if present; lib only handles single responses
}
if (!isMode01(command) & !isMode22(command))
{
_connection->writeEndNoData();
return false;
}
uint16_t hexCommand = strtoul(command.c_str(), NULL, HEX);
uint8_t pid = getPidCodeFromHex(hexCommand);
if (isSupportedPidRequest(pid)) { //reqeust to return a list of valid PIDs we can respond to
processed = true;
uint32_t supportedPids = getSupportedPids(pid);
writePidResponse(command, 4, supportedPids);
}
return processed;
}
void PidProcessor::writePidResponse(const String& requestPid, uint8_t numberOfBytes, uint32_t value) {
uint8_t nHexChars = PID_N_BYTES * N_CHARS_IN_BYTE + numberOfBytes * N_CHARS_IN_BYTE ;
char responseArray[nHexChars + 1]; // one more for termination char
getFormattedResponse(responseArray, nHexChars, requestPid, value);
_connection->writeEndPidTo(responseArray);
}
/**
* adds a supported pid, so it can answer to pid support request, ex 0100, 0120, ...
*/
bool PidProcessor::registerMode01Pid(uint32_t pid) {
// pid must be off type 01
if (pid > 0x00 && pid < 0x0200) {
// remove PidMode, only use pid code
pid = getPidCodeFromHex(pid);
setPidBit(pid);
char buffer[4];
sprintf(buffer, "%02X", pid);
DEBUG("Registered PID: " + String(buffer ));
return true;
}
return false;
}
bool PidProcessor::isMode01(const String& command)
{
return command.startsWith("01") ? true : false;
}
bool PidProcessor::isMode01MIL(const String& command)
{
return command.startsWith("0101") ? true : false;
}
bool PidProcessor::isMode03(const String& command)
{
return command.startsWith("03") ? true : false;
}
bool PidProcessor::isMode22(const String& command)
{
return command.startsWith("22") ? true : false;
}
/**
* return true if:
* - 1000
* - 1020
* - 1040
* - 1060
* ....
*/
bool PidProcessor::isSupportedPidRequest(uint8_t pid) {
return pid == getPidIntervalId(pid);
}
/**
* returns the interval RANGEID for the given pid (ex: 00, 20, 40, ...)
*/
uint8_t PidProcessor::getPidIntervalId(uint8_t pidcode) {
return getPidIntervalIndex(pidcode) * PID_INTERVAL_OFFSET;
}
/**
* returns the interval INDEX for the given pid (0,1,2,3,4,...)
*/
uint8_t PidProcessor::getPidIntervalIndex(uint8_t pidcode) {
return pidcode / PID_INTERVAL_OFFSET;
}
/**
* Receives a mode pid ex 010C ,
* returns only the pid ex 0C
*/
uint8_t PidProcessor::getPidCodeFromHex(uint16_t hexCommand) {
if (hexCommand >= 0x0100) {
hexCommand -= 0x100;
}
return (uint8_t) hexCommand; // return only the lower 8 bits (trim off num_messages or other extra bytes if present)
}
/**
* Receives a complete PID request,
* returns only the pid ex 0C
*/
uint8_t PidProcessor::getPidCodeFromRequest(const String& request) {
uint16_t hexCommand = strtoul(request.c_str(), NULL, HEX);
return getPidCodeFromHex(hexCommand);
}
void PidProcessor::setPidBit(uint8_t pid) {
uint8_t arrayIndex = getPidIntervalIndex(pid);
if(isSupportedPidRequest(pid)) {
arrayIndex -= 1;
}
uint8_t bitPosition = getPidBitPosition(pid);
bitWrite(pidMode01Supported[arrayIndex], bitPosition, 1);
// mark available intervals
for (int i = 0; i < arrayIndex; i++) {
bitWrite(pidMode01Supported[i], 0, 1);
}
}
uint8_t PidProcessor::getPidBitPosition(uint8_t pid) {
uint8_t intervalId = getPidIntervalId(pid) ;
if(isSupportedPidRequest(pid)) {
intervalId -= PID_INTERVAL_OFFSET;
}
uint16_t pos = pid - intervalId;
pos = PID_INTERVAL_OFFSET - pos;
return pos;
}
uint32_t PidProcessor:: getSupportedPids(uint8_t pid) {
uint8_t index = getPidIntervalIndex(pid);
return pidMode01Supported[index];
}
void PidProcessor::getFormattedResponse(char *response, uint8_t totalNumberOfChars, const String& pid, uint32_t value) {
uint8_t nValueChars = totalNumberOfChars - PID_N_BYTES * N_CHARS_IN_BYTE;
char cValue[3] = {0};
itoa(nValueChars, cValue, DEC);
String mask = "%s%0";
mask.concat(cValue);
mask.concat("lX\0");
String pidResponse = convertToPidResponse(pid);
sprintf(response, mask.c_str(), pidResponse.c_str(), value);
DEBUG("RX PID: " + pid + " - TX: " + String(response));
}
String PidProcessor::convertToPidResponse(String pid) {
String x = "4";
x.concat(pid.substring(1, pid.length()));
return x;
}
void PidProcessor::resetPidMode01Array() {
for(uint8_t i = 0; i < N_MODE01_INTERVALS; i++ ) {
pidMode01Supported[i] = 0x0;
}
}
@@ -1,62 +0,0 @@
#ifndef ELMulator_PIDPROCESSOR_H
#define ELMulator_PIDPROCESSOR_H
#include "definitions.h"
#include <Arduino.h>
#include <WString.h>
#include <Print.h>
#include "OBDWiFiComm.h"
#include "OBDSerialComm.h"
class PidProcessor
{
public:
PidProcessor(OBDWiFiComm *connection);
PidProcessor(OBDSerialComm *connection);
bool process(String &string);
bool registerMode01Pid(uint32_t pid);
bool registerMode01MILResponse(const String &response);
bool registerMode03Response(const String &response);
void writePidResponse(const String &requestPid, uint8_t numberOfBytes, uint32_t value);
uint8_t getPidCodeFromHex(uint16_t hexCommand);
uint8_t getPidCodeFromRequest(const String &command);
bool isMode01(const String &command);
bool isMode01MIL(const String &command);
bool isMode03(const String &command);
bool isMode22(const String &command);
private:
#if USE_WIFI
OBDWiFiComm *_connection;
#else
OBDSerialComm *_connection;
#endif
uint32_t pidMode01Supported[N_MODE01_INTERVALS];
bool isSupportedPidRequest(uint8_t pid);
uint32_t getSupportedPids(uint8_t pidcode);
uint8_t getPidIntervalId(uint8_t pidcode);
uint8_t getPidIntervalIndex(uint8_t pidcode);
void setPidBit(uint8_t pid);
uint8_t getPidBitPosition(uint8_t pidcode);
String convertToPidResponse(String pid);
void getFormattedResponse(char *response, uint8_t totalNumberOfChars, const String &pid, uint32_t value);
void resetPidMode01Array();
};
#endif // ELMulator_PIDPROCESSOR_H
@@ -1,294 +0,0 @@
#ifndef ELMulator_DEFINITIONS_H
#define ELMulator_DEFINITIONS_H
#include <stdint.h>
// true == We are running on hardware that has builtin Bluetooth
// false == We are using hardware that has BT module attached via GPIO pins
#define BLUETOOTH_BUILTIN true
#define USE_WIFI false
#define DO_DEBUG true
#define DEBUG(x) do {if (DO_DEBUG) { Serial.println(x); } } while (0)
#define xtoc(x) ((x < 10) ? ('0' + x) : ('A' - 10 + x))
#define getNumOfHexChars(nBytes) (nBytes * 2)
#define PID_N_BYTES 2
#define N_CHARS_IN_BYTE 2
// Device ID
#define ID "ELM327 / ELMulator V1.3.0"
#define DESC "ELMulator OBD2 Arduino library, based on ELM327 protocol"
#define PROTOCOL "6" // canbus 500k 11 bit protocol id for elm.
// Char representing end of serial string
#define SERIAL_END_CHAR 0x0D
#define SERIAL_READ_TIMEOUT 20000L
#define WIFI_END_CHAR 0x0A
const uint8_t maxPid = 0xFF;
const uint8_t N_MODE01_INTERVALS = 7;
const uint8_t PID_INTERVAL_OFFSET = 0x20;
const uint8_t MAX_REQUEST_SIZE = 40;
//-------------------------------------------------------------------------------------//
// Protocol IDs
//-------------------------------------------------------------------------------------//
const char AUTOMATIC = '0';
const char SAE_J1850_PWM_41_KBAUD = '1';
const char SAE_J1850_PWM_10_KBAUD = '2';
const char ISO_9141_5_BAUD_INIT = '3';
const char ISO_14230_5_BAUD_INIT = '4';
const char ISO_14230_FAST_INIT = '5';
const char ISO_15765_11_BIT_500_KBAUD = '6';
const char ISO_15765_29_BIT_500_KBAUD = '7';
const char ISO_15765_11_BIT_250_KBAUD = '8';
const char ISO_15765_29_BIT_250_KBAUD = '9';
const char SAE_J1939_29_BIT_250_KBAUD = 'A';
const char USER_1_CAN = 'B';
const char USER_2_CAN = 'C';
//-------------------------------------------------------------------------------------//
// PIDs (https://en.wikipedia.org/wiki/OBD-II_PIDs)
//-------------------------------------------------------------------------------------//
const uint8_t SUPPORTED_PIDS_1_20 = 0; // 0x00 - bit encoded
const uint8_t MONITOR_STATUS_SINCE_DTC_CLEARED = 1; // 0x01 - bit encoded
const uint8_t FREEZE_DTC = 2; // 0x02 -
const uint8_t FUEL_SYSTEM_STATUS = 3; // 0x03 - bit encoded
const uint8_t ENGINE_LOAD = 4; // 0x04 - %
const uint8_t ENGINE_COOLANT_TEMP = 5; // 0x05 - °C
const uint8_t SHORT_TERM_FUEL_TRIM_BANK_1 = 6; // 0x06 - %
const uint8_t LONG_TERM_FUEL_TRIM_BANK_1 = 7; // 0x07 - %
const uint8_t SHORT_TERM_FUEL_TRIM_BANK_2 = 8; // 0x08 - %
const uint8_t LONG_TERM_FUEL_TRIM_BANK_2 = 9; // 0x09 - %
const uint8_t FUEL_PRESSURE = 10; // 0x0A - kPa
const uint8_t INTAKE_MANIFOLD_ABS_PRESSURE = 11; // 0x0B - kPa
const uint8_t ENGINE_RPM = 12; // 0x0C - rpm
const uint8_t VEHICLE_SPEED = 13; // 0x0D - km/h
const uint8_t TIMING_ADVANCE = 14; // 0x0E - ° before TDC
const uint8_t INTAKE_AIR_TEMP = 15; // 0x0F - °C
const uint8_t MAF_FLOW_RATE = 16; // 0x10 - g/s
const uint8_t THROTTLE_POSITION = 17; // 0x11 - %
const uint8_t COMMANDED_SECONDARY_AIR_STATUS = 18; // 0x12 - bit encoded
const uint8_t OXYGEN_SENSORS_PRESENT_2_BANKS = 19; // 0x13 - bit encoded
const uint8_t OXYGEN_SENSOR_1_A = 20; // 0x14 - V %
const uint8_t OXYGEN_SENSOR_2_A = 21; // 0x15 - V %
const uint8_t OXYGEN_SENSOR_3_A = 22; // 0x16 - V %
const uint8_t OXYGEN_SENSOR_4_A = 23; // 0x17 - V %
const uint8_t OXYGEN_SENSOR_5_A = 24; // 0x18 - V %
const uint8_t OXYGEN_SENSOR_6_A = 25; // 0x19 - V %
const uint8_t OXYGEN_SENSOR_7_A = 26; // 0x1A - V %
const uint8_t OXYGEN_SENSOR_8_A = 27; // 0x1B - V %
const uint8_t OBD_STANDARDS = 28; // 0x1C - bit encoded
const uint8_t OXYGEN_SENSORS_PRESENT_4_BANKS = 29; // 0x1D - bit encoded
const uint8_t AUX_INPUT_STATUS = 30; // 0x1E - bit encoded
const uint8_t RUN_TIME_SINCE_ENGINE_START = 31; // 0x1F - sec
const uint8_t SUPPORTED_PIDS_21_40 = 32; // 0x20 - bit encoded
const uint8_t DISTANCE_TRAVELED_WITH_MIL_ON = 33; // 0x21 - km
const uint8_t FUEL_RAIL_PRESSURE = 34; // 0x22 - kPa
const uint8_t FUEL_RAIL_GUAGE_PRESSURE = 35; // 0x23 - kPa
const uint8_t OXYGEN_SENSOR_1_B = 36; // 0x24 - ratio V
const uint8_t OXYGEN_SENSOR_2_B = 37; // 0x25 - ratio V
const uint8_t OXYGEN_SENSOR_3_B = 38; // 0x26 - ratio V
const uint8_t OXYGEN_SENSOR_4_B = 39; // 0x27 - ratio V
const uint8_t OXYGEN_SENSOR_5_B = 40; // 0x28 - ratio V
const uint8_t OXYGEN_SENSOR_6_B = 41; // 0x29 - ratio V
const uint8_t OXYGEN_SENSOR_7_B = 42; // 0x2A - ratio V
const uint8_t OXYGEN_SENSOR_8_B = 43; // 0x2B - ratio V
const uint8_t COMMANDED_EGR = 44; // 0x2C - %
const uint8_t EGR_ERROR = 45; // 0x2D - %
const uint8_t COMMANDED_EVAPORATIVE_PURGE = 46; // 0x2E - %
const uint8_t FUEL_TANK_LEVEL_INPUT = 47; // 0x2F - %
const uint8_t WARM_UPS_SINCE_CODES_CLEARED = 48; // 0x30 - count
const uint8_t DIST_TRAV_SINCE_CODES_CLEARED = 49; // 0x31 - km
const uint8_t EVAP_SYSTEM_VAPOR_PRESSURE = 50; // 0x32 - Pa
const uint8_t ABS_BAROMETRIC_PRESSURE = 51; // 0x33 - kPa
const uint8_t OXYGEN_SENSOR_1_C = 52; // 0x34 - ratio mA
const uint8_t OXYGEN_SENSOR_2_C = 53; // 0x35 - ratio mA
const uint8_t OXYGEN_SENSOR_3_C = 54; // 0x36 - ratio mA
const uint8_t OXYGEN_SENSOR_4_C = 55; // 0x37 - ratio mA
const uint8_t OXYGEN_SENSOR_5_C = 56; // 0x38 - ratio mA
const uint8_t OXYGEN_SENSOR_6_C = 57; // 0x39 - ratio mA
const uint8_t OXYGEN_SENSOR_7_C = 58; // 0x3A - ratio mA
const uint8_t OXYGEN_SENSOR_8_C = 59; // 0x3B - ratio mA
const uint8_t CATALYST_TEMP_BANK_1_SENSOR_1 = 60; // 0x3C - °C
const uint8_t CATALYST_TEMP_BANK_2_SENSOR_1 = 61; // 0x3D - °C
const uint8_t CATALYST_TEMP_BANK_1_SENSOR_2 = 62; // 0x3E - °C
const uint8_t CATALYST_TEMP_BANK_2_SENSOR_2 = 63; // 0x3F - °C
const uint8_t SUPPORTED_PIDS_41_60 = 64; // 0x40 - bit encoded
const uint8_t MONITOR_STATUS_THIS_DRIVE_CYCLE = 65; // 0x41 - bit encoded
const uint8_t CONTROL_MODULE_VOLTAGE = 66; // 0x42 - V
const uint8_t ABS_LOAD_VALUE = 67; // 0x43 - %
const uint8_t FUEL_AIR_COMMANDED_EQUIV_RATIO = 68; // 0x44 - ratio
const uint8_t RELATIVE_THROTTLE_POSITION = 69; // 0x45 - %
const uint8_t AMBIENT_AIR_TEMP = 70; // 0x46 - °C
const uint8_t ABS_THROTTLE_POSITION_B = 71; // 0x47 - %
const uint8_t ABS_THROTTLE_POSITION_C = 72; // 0x48 - %
const uint8_t ABS_THROTTLE_POSITION_D = 73; // 0x49 - %
const uint8_t ABS_THROTTLE_POSITION_E = 74; // 0x4A - %
const uint8_t ABS_THROTTLE_POSITION_F = 75; // 0x4B - %
const uint8_t COMMANDED_THROTTLE_ACTUATOR = 76; // 0x4C - %
const uint8_t TIME_RUN_WITH_MIL_ON = 77; // 0x4D - min
const uint8_t TIME_SINCE_CODES_CLEARED = 78; // 0x4E - min
const uint8_t MAX_VALUES_EQUIV_V_I_PRESSURE = 79; // 0x4F - ratio V mA kPa
const uint8_t MAX_MAF_RATE = 80; // 0x50 - g/s
const uint8_t FUEL_TYPE = 81; // 0x51 - ref table
const uint8_t ETHANOL_FUEL_PERCENT = 82; // 0x52 - %
const uint8_t ABS_EVAP_SYS_VAPOR_PRESSURE = 83; // 0x53 - kPa
const uint8_t EVAP_SYS_VAPOR_PRESSURE = 84; // 0x54 - Pa
const uint8_t SHORT_TERM_SEC_OXY_SENS_TRIM_1_3 = 85; // 0x55 - %
const uint8_t LONG_TERM_SEC_OXY_SENS_TRIM_1_3 = 86; // 0x56 - %
const uint8_t SHORT_TERM_SEC_OXY_SENS_TRIM_2_4 = 87; // 0x57 - %
const uint8_t LONG_TERM_SEC_OXY_SENS_TRIM_2_4 = 88; // 0x58 - %
const uint8_t FUEL_RAIL_ABS_PRESSURE = 89; // 0x59 - kPa
const uint8_t RELATIVE_ACCELERATOR_PEDAL_POS = 90; // 0x5A - %
const uint8_t HYBRID_BATTERY_REMAINING_LIFE = 91; // 0x5B - %
const uint8_t ENGINE_OIL_TEMP = 92; // 0x5C - °C
const uint8_t FUEL_INJECTION_TIMING = 93; // 0x5D - °
const uint8_t ENGINE_FUEL_RATE = 94; // 0x5E - L/h
const uint8_t EMISSION_REQUIREMENTS = 95; // 0x5F - bit encoded
const uint8_t SUPPORTED_PIDS_61_80 = 96; // 0x60 - bit encoded
const uint8_t DEMANDED_ENGINE_PERCENT_TORQUE = 97; // 0x61 - %
const uint8_t ACTUAL_ENGINE_TORQUE = 98; // 0x62 - %
const uint8_t ENGINE_REFERENCE_TORQUE = 99; // 0x63 - Nm
const uint8_t ENGINE_PERCENT_TORQUE_DATA = 100; // 0x64 - %
const uint8_t AUX_INPUT_OUTPUT_SUPPORTED = 101; // 0x65 - bit encoded
const uint8_t ODOMETER = 166; // 0xA6 - km * 10
const uint8_t SERVICE_01 = 1;
const uint8_t SERVICE_02 = 2;
const uint8_t SERVICE_03 = 3;
//-------------------------------------------------------------------------------------//
// AT commands (https://www.sparkfun.com/datasheets/Widgets/ELM327_AT_Commands.pdf)
//-------------------------------------------------------------------------------------//
const char * const DISP_DEVICE_DESCRIPT = "AT @1"; // General
const char * const DISP_DEVICE_ID = "AT @2"; // General
const char * const STORE_DEVICE_ID = "AT @3 %s"; // General
const char * const REPEAT_LAST_COMMAND = "AT \r"; // General
const char * const ALLOW_LONG_MESSAGES = "AT AL"; // General
const char * const AUTOMATIC_RECEIVE = "AT AR"; // OBD
const char * const ADAPTIVE_TIMING_OFF = "AT AT0"; // OBD
const char * const ADAPTIVE_TIMING_AUTO_1 = "AT AT1"; // OBD
const char * const ADAPTIVE_TIMING_AUTO_2 = "AT AT2"; // OBD
const char * const DUMP_BUFFER = "AT BD"; // OBD
const char * const BYPASS_INIT_SEQUENCE = "AT BI"; // OBD
const char * const TRY_BAUD_DIVISOR = "AT BRD %02d"; // General
const char * const SET_HANDSHAKE_TIMEOUT = "AT BRT %02d"; // General
const char * const CAN_AUTO_FORMAT_OFF = "AT CAF0"; // CAN
const char * const CAN_AUTO_FORMAT_ON = "AT CAF1"; // CAN
const char * const CAN_EXTENDED_ADDRESS_OFF = "AT CEA"; // CAN
const char * const USE_CAN_EXTENDED_ADDRESS = "AT CEA %02d"; // CAN
const char * const SET_ID_FILTER = "AT CF %s"; // CAN
const char * const CAN_FLOW_CONTROL_OFF = "AT CFC0"; // CAN
const char * const CAN_FLOW_CONTROL_ON = "AT CFC1"; // CAN
const char * const SET_ID_MASK = "AT CM %s"; // CAN
const char * const SET_CAN_PRIORITY = "AT CP %02d"; // CAN
const char * const SHOW_CAN_STATUS = "AT CS"; // CAN
const char * const CAN_SILENT_MODE_OFF = "AT CSM0"; // CAN
const char * const CAN_SILENT_MODE_ON = "AT CSM1"; // CAN
const char * const CALIBRATE_VOLTAGE_CUSTOM = "AT CV %04d"; // Volts
const char * const RESTORE_CV_TO_FACTORY = "AT CV 0000"; // Volts
const char * const SET_ALL_TO_DEFAULTS = "AT D"; // General
const char * const DISP_DLC_OFF = "AT D0"; // CAN
const char * const DISP_DLC_ON = "AT D1"; // CAN
const char * const MONITOR_FOR_DM1_MESSAGES = "AT DM1"; // J1939
const char * const DISP_CURRENT_PROTOCOL = "AT DP"; // OBD
const char * const DISP_CURRENT_PROTOCOL_NUM = "AT DPN"; // OBD
const char * const ECHO_OFF = "AT E0"; // General
const char * const ECHO_ON = "AT E1"; // General
const char * const FLOW_CONTROL_SET_DATA_TO = "AT FC SD %s"; // CAN
const char * const FLOW_CONTROL_SET_HEAD_TO = "AT FC SH %s"; // CAN
const char * const FLOW_CONTROL_SET_MODE_TO = "AT FC SM %c"; // CAN
const char * const FORGE_EVENTS = "AT FE"; // General
const char * const PERFORM_FAST_INIT = "AT FI"; // ISO
const char * const HEADERS_OFF = "AT H0"; // OBD
const char * const HEADERS_ON = "AT H1"; // OBD
const char * const DISP_ID = "AT I"; // General
const char * const SET_ISO_BAUD_10400 = "AT IB 10"; // ISO
const char * const SET_ISO_BAUD_4800 = "AT IB 48"; // ISO
const char * const SET_ISO_BAUD_9600 = "AT IB 96"; // ISO
const char * const IFR_VAL_FROM_HEADER = "AT IFR H"; // J1850
const char * const IFR_VAL_FROM_SOURCE = "AT IFR S"; // J1850
const char * const IFRS_OFF = "AT IFR0"; // J1850
const char * const IFRS_AUTO = "AT IFR1"; // J1850
const char * const IFRS_ON = "AT IFR2"; // J1850
const char * const IREAD_IGNMON_INPUT_LEVEL = "AT IGN"; // Other
const char * const SET_ISO_SLOW_INIT_ADDRESS = "AT IIA %02d"; // ISO
const char * const USE_J1939_ELM_DATA_FORMAT = "AT JE"; // J1850
const char * const J1939_HEAD_FORMAT_OFF = "AT JHF0"; // J1850
const char * const J1939_HEAD_FORMAT_ON = "AT JHF1"; // J1850
const char * const USE_J1939_SAE_DATA_FORMAT = "AT JS"; // J1850
const char * const SET_J1939_TIMER_X_TO_1X = "AT JTM1"; // J1850
const char * const SET_J1939_TIMER_X_TO_5X = "AT JTM5"; // J1850
const char * const DISP_KEY_WORDS = "AT KW"; // ISO
const char * const KEY_WORD_CHECKING_OFF = "AT KW0"; // ISO
const char * const KEY_WORD_CHECKING_ON = "AT KW1"; // ISO
const char * const LINEFEEDS_OFF = "AT L0"; // General
const char * const LINEFEEDS_ON = "AT L1"; // General
const char * const LOW_POWER_MODE = "AT LP"; // General
const char * const MEMORY_OFF = "AT M0"; // General
const char * const MEMORY_ON = "AT M1"; // General
const char * const MONITOR_ALL = "AT MA"; // OBD
const char * const MONITOR_FOR_PGN = "AT MP %s"; // J1939
const char * const MONITOR_FOR_RECEIVER = "AT MR %02d"; // OBD
const char * const MONITOR_FOR_TRANSMITTER = "AT MT %02d"; // OBD
const char * const NORMAL_LENGTH_MESSAGES = "AT NL"; // OBD
const char * const SET_PROTO_OPTIONS_AND_BAUD = "AT PB %s"; // OBD
const char * const PROTOCOL_CLOSE = "AT PC"; // OBD
const char * const ALL_PROG_PARAMS_OFF = "AT PP FF OFF";// PPs
const char * const ALL_PROG_PARAMS_ON = "AT PP FF ON"; // PPs
const char * const SET_PROG_PARAM_OFF = "AT PP %s OFF";// PPs
const char * const SET_PROG_PARAM_ON = "AT PP %s ON"; // PPs
const char * const SET_PROG_PARAM_VAL = "AT PP %s SV %s"; // PPs
const char * const DISP_PP_SUMMARY = "AT PPS"; // PPs
const char * const RESPONSES_OFF = "AT R0"; // OBD
const char * const RESPONSES_ON = "AT R1"; // OBD
const char * const SET_RECEIVE_ADDRESS_TO = "AT RA %02d"; // OBD
const char * const READ_STORED_DATA = "AT RD"; // General
const char * const SEND_RTR_MESSAGE = "AT RTR"; // CAN
const char * const READ_VOLTAGE = "AT RV"; // Volts
const char * const PRINTING_SPACES_OFF = "AT S0"; // OBD
const char * const PRINTING_SPACES_ON = "AT S1"; // OBD
const char * const STORE_DATA_BYTE = "AT SD "; // General
const char * const SET_HEADER = "AT SH %s"; // OBD
const char * const PERFORM_SLOW_INIT = "AT SI"; // ISO
const char * const SET_PROTOCOL_TO_AUTO_H_SAVE = "AT SP A%c"; // OBD
const char * const SET_PROTOCOL_TO_H_SAVE = "AT SP %c"; // OBD
const char * const SET_PROTOCOL_TO_AUTO_SAVE = "AT SP 00"; // OBD
const char * const SET_REC_ADDRESS = "AT SR %02d"; // OBD
const char * const SET_STANDARD_SEARCH_ORDER = "AT SS"; // OBD
const char * const SET_TIMEOUT_TO_H_X_4MS = "AT ST %02d"; // OBD
const char * const SET_WAKEUP_TO_H_X_20MS = "AT SW %02d"; // ISO
const char * const SET_TESTER_ADDRESS_TO = "AT TA %02d"; // OBD
const char * const TRY_PROT_H_AUTO_SEARCH = "AT TP A%c"; // OBD
const char * const TRY_PROT_H = "AT TP %c"; // OBD
const char * const VARIABLE_DLC_OFF = "AT V0"; // CAN
const char * const VARIABLE_DLC_ON = "AT V1"; // CAN
const char * const SET_WAKEUP_MESSAGE = "AT WM"; // ISO
const char * const WARM_START = "AT WS"; // General
const char * const RESET_ALL = "AT Z"; // General
const uint8_t responseBytes[0xA9] =
{
4, 4, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, 1, 2, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 1, 1, 1, 2,
4, 2, 2, 2, 4, 4, 4, 4, 4, 4, 4, 4, 4, 1, 1, 1, 1, 1, 2, 2, 4, 4, 4, 4, 4, 4, 4, 4, 2, 2, 2, 2,
4, 4, 2, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 4, 4, 1, 1, 2, 2, 2, 2, 2, 2, 2, 1, 1, 1, 2, 2, 1,
4, 1, 1, 2, 5, 2, 5, 3, 3, 7, 5, 5, 5, 11, 9, 3, 10, 6, 5, 5, 5, 7, 7, 5, 9, 9, 7, 7, 9, 1, 1, 13,
4, 41, 41, 9, 1, 10, 5, 5, 13, 41, 41, 7, 17, 1, 1, 7, 3, 5, 2, 3, 12, 9, 9, 6, 4, 17, 4, 2, 9
};
#endif //ELMulator_DEFINITIONS_H
-21
View File
@@ -1,21 +0,0 @@
The MIT License (MIT)
Copyright (c) 2023 Jim Whitelaw
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
@@ -1,27 +0,0 @@
; ELMulator — fake ELM327 OBD-II adapter for testing without a car.
; Runs on a CLASSIC ESP32 (Bluetooth Classic SPP). Library lives in lib/ELMulator.
; One env per example: pio run -e simple | custom | wifi
[platformio]
default_envs = simple
[env]
platform = espressif32@6.10.0
board = esp32dev
framework = arduino
board_build.partitions = huge_app.csv
; upload_port = COMxx ; the classic ESP32's port (COM21 is the JC3636W518)
monitor_speed = 115200
monitor_filters = esp32_exception_decoder
; all Mode 01 PIDs answered with mock data, BT name "ELMULATOR"
[env:simple]
build_src_filter = +<simple/>
; custom PID handler + DTC response, BT name "ELMULATOR"
[env:custom]
build_src_filter = +<custom/>
; custom handler, BT name "OBDII" (matches what elm327_wifi_bridge connects to)
[env:wifi]
build_src_filter = +<wifi/>
@@ -1,6 +0,0 @@
#pragma once
#include <Arduino.h>
#include <ELMulator.h>
#include <definitions.h>
void handlePIDRequest(const String& pidRequest);
@@ -1,172 +0,0 @@
#include "ESP32_Custom_ELMulator.h"
const String deviceName = "ELMULATOR"; // Bluetooth device name to use (no pin)
// Set up hardcoded responses to non-standard PID requests for MIL, DTC, ODO data
const String milResponse = "4101830000"; // MIL response code indicating 3 current DTC
const String dtcResponse = "43010341\r\n43010123\r\n43010420"; // DTC response returning 3 DTC codes (multiline response)
const uint32_t odoResponse = 1234567; // Hardcode an odometer reading of 1234567
const String ethPercentResponse = "620052C6";
const String dpfCloggingResponse = "6218E4C6";
ELMulator ELMulator;
void setup()
{
Serial.begin(115200);
Serial.println("Starting ELMulator...");
ELMulator.init(deviceName);
// Register the specific PIDs we are going to handle.
// ELMulator will respond to SUPPORTED_PIDS request ("0101") with the appropriate value
// indicating which PIDs it can respond to.
ELMulator.registerMode01Pid(ODOMETER);
ELMulator.registerMode01Pid(ENGINE_COOLANT_TEMP);
ELMulator.registerMode01Pid(ENGINE_RPM);
ELMulator.registerMode01Pid(MONITOR_STATUS_SINCE_DTC_CLEARED);
ELMulator.registerMode01Pid(INTAKE_MANIFOLD_ABS_PRESSURE);
ELMulator.registerMode01Pid(ENGINE_LOAD);
ELMulator.registerMode01Pid(VEHICLE_SPEED);
ELMulator.registerMode01Pid(INTAKE_AIR_TEMP);
ELMulator.registerMode01Pid(THROTTLE_POSITION);
}
void loop()
{
/**
* Waits for a new request from an ELM client and does some pre-processing to validate the PID and request.
* Non-PID requests like AT commands and SUPPORTED_PIDS queries will be handled by ELMulator automatically.
* PID requests will be verified as supported (registered); unsupported PIDs responded to with NO DATA response.
* Returns true if the request is for one of the PIDS we have registered above so we can respond to it.
*/
if (ELMulator.readELMRequest())
{
handlePIDRequest(ELMulator.elmRequest);
}
}
/**
* After receiving a supported PID(sensor) request, we prepare the response here.
* Response can come from a hardcoded value, a real hardware sensor, or a mock value.
* Default response is a mock value if no other handling is provided.
*/
void handlePIDRequest(const String &request)
{
// Handle special case requests like MIL and DTC checks
if (ELMulator.isMode03(request)) // Mode 03 request == Returns (hardcoded) list current DTC codes
{
if (dtcResponse.length())
{
ELMulator.writeResponse(dtcResponse);
return;
}
else
{
DEBUG("DTC response is empty.");
ELMulator.writePidNotSupported();
return;
}
}
else if (ELMulator.isMode01MIL(request)) // Mode 0101 MIL request == Returns (hardcoded) number of current DTC codes
{
if (milResponse.length())
{
ELMulator.writeResponse(milResponse);
return;
}
else
{
DEBUG("MIL response is empty.");
ELMulator.writePidNotSupported();
return;
}
}
else if (ELMulator.isMode22(request)) // Mode 0x22 (extended info) service - Mfg-dependent and not defined in OBDII spec
{
Serial.print("Mode 22 PID: "); Serial.println(request.substring(2));
if (request.substring(2).compareTo("52") == 0) // Ethanol percent
{
if (ethPercentResponse.length())
{
ELMulator.writeResponse(ethPercentResponse);
return;
}
else
{
DEBUG("ETH % response is empty.");
ELMulator.writePidNotSupported();
return;
}
}
if (request.substring(2).compareTo("18E4") == 0) // DPF Clogging A-R Giulia
{
if (dpfCloggingResponse.length())
{
ELMulator.writeResponse(dpfCloggingResponse);
return;
}
else
{
DEBUG("DPF Clogging response is empty.");
ELMulator.writePidNotSupported();
return;
}
}
ELMulator.writePidNotSupported();
return;
}
else // Handle any other supported PID request
{
uint8_t pidCode = ELMulator.getPidCode(request); // Extract the specific PID code from the request
// Example response for 0x05 (Engine Coolant Temp) - returning a mock data value
if (pidCode == ENGINE_COOLANT_TEMP)
{
uint32_t sensorValue = ELMulator.getMockSensorValue();
/**
* Response parameters:
* request - specifies the original PID request being responded to.
* numberOfBytes - the number of bytes this PID value returns (per OBDII spec), using lookup table responseBytes.
* sensorValue - the value to return in our response; a mock value in this example.
*/
ELMulator.writePidResponse(request, responseBytes[pidCode], sensorValue);
return;
}
// Example response for PID 0x0C (Engine RPM) - returns a modified mock sensor value
else if (pidCode == ENGINE_RPM)
{
uint16_t rpmValue = ELMulator.getMockSensorValue() * 100; // Here we multiply the mock value provided, for a more realistic RPM number
ELMulator.writePidResponse(request, responseBytes[pidCode], rpmValue);
return;
}
// Example response for PID 0xA6 (Odometer) - returns our hardcoded odometer response string
else if (pidCode == ODOMETER)
{
ELMulator.writePidResponse(request, responseBytes[pidCode], odoResponse);
return;
}
// // Example response for PID 0xOD (Vehicle speed) - returns a value from external GPS
// else if (pidCode == VEHICLE_SPEED)
// {
// uint32_t gpsSpeed = myGPS.speed();
// ELMulator.writePidResponse(request, responseBytes[pidCode], gpsSpeed);
// return;
// }
// Default response for any other supported PID request - returns an unmodified mock sensor value
else
{
ELMulator.writePidResponse(request, responseBytes[pidCode], ELMulator.getMockSensorValue());
return;
}
}
}
@@ -1,6 +0,0 @@
#pragma once
#include <Arduino.h>
#include <ELMulator.h>
#include <definitions.h>
void handlePIDRequest(const String& pidRequest);
@@ -1,21 +0,0 @@
#include "ESP32_Simple_ELMulator.h"
/**
* This example demonstrates a very simple implementation of ELMulator.
* It handles all AT Commands, SUPPORTED_PIDS queries, etc. and rejectss unsupported requests.
* All Mode 01 PID requests are provided a response of the correct data size with mock data values.
* Typical use case is for testing custom applications to work with ELM327 devices.
*/
const String deviceName = "ELMULATOR"; // Bluetooth device name to use (no pin)
ELMulator ELMulator;
void setup()
{
Serial.begin(115200);
Serial.println("Starting ELMulator...");
ELMulator.init(deviceName, true); // Initialize with support for all PIDs 0x00 to 0x65, providing mock data
ELMulator.begin(); // ELMulator will run continuously, listening for and respondng to requests
}
void loop() {}
@@ -1,6 +0,0 @@
#pragma once
#include <Arduino.h>
#include <ELMulator.h>
#include <definitions.h>
void handlePIDRequest(const String& pidRequest);
@@ -1,172 +0,0 @@
#include "ESP32_WiFi_Custom_ELMulator.h"
const String deviceName = "OBDII";
// Set up hardcoded responses to non-standard PID requests for MIL, DTC, ODO data
const String milResponse = "4101830000"; // MIL response code indicating 3 current DTC
const String dtcResponse = "43010341\r\n43010123\r\n43010420"; // DTC response returning 3 DTC codes (multiline response)
const uint32_t odoResponse = 1234567; // Hardcode an odometer reading of 1234567
const String ethPercentResponse = "620052C6";
const String dpfCloggingResponse = "6218E4C6";
ELMulator ELMulator;
void setup()
{
Serial.begin(115200);
Serial.println("Starting ELMulator...");
ELMulator.init(deviceName);
// Register the specific PIDs we are going to handle.
// ELMulator will respond to SUPPORTED_PIDS request ("0101") with the appropriate value
// indicating which PIDs it can respond to.
ELMulator.registerMode01Pid(ODOMETER);
ELMulator.registerMode01Pid(ENGINE_COOLANT_TEMP);
ELMulator.registerMode01Pid(ENGINE_RPM);
ELMulator.registerMode01Pid(MONITOR_STATUS_SINCE_DTC_CLEARED);
ELMulator.registerMode01Pid(INTAKE_MANIFOLD_ABS_PRESSURE);
ELMulator.registerMode01Pid(ENGINE_LOAD);
ELMulator.registerMode01Pid(VEHICLE_SPEED);
ELMulator.registerMode01Pid(INTAKE_AIR_TEMP);
ELMulator.registerMode01Pid(THROTTLE_POSITION);
}
void loop()
{
/**
* Waits for a new request from an ELM client and does some pre-processing to validate the PID and request.
* Non-PID requests like AT commands and SUPPORTED_PIDS queries will be handled by ELMulator automatically.
* PID requests will be verified as supported (registered); unsupported PIDs responded to with NO DATA response.
* Returns true if the request is for one of the PIDS we have registered above so we can respond to it.
*/
if (ELMulator.readELMRequest())
{
handlePIDRequest(ELMulator.elmRequest);
}
}
/**
* After receiving a supported PID(sensor) request, we prepare the response here.
* Response can come from a hardcoded value, a real hardware sensor, or a mock value.
* Default response is a mock value if no other handling is provided.
*/
void handlePIDRequest(const String &request)
{
// Handle special case requests like MIL and DTC checks
if (ELMulator.isMode03(request)) // Mode 03 request == Returns (hardcoded) list current DTC codes
{
if (dtcResponse.length())
{
ELMulator.writeResponse(dtcResponse);
return;
}
else
{
DEBUG("DTC response is empty.");
ELMulator.writePidNotSupported();
return;
}
}
else if (ELMulator.isMode01MIL(request)) // Mode 0101 MIL request == Returns (hardcoded) number of current DTC codes
{
if (milResponse.length())
{
ELMulator.writeResponse(milResponse);
return;
}
else
{
DEBUG("MIL response is empty.");
ELMulator.writePidNotSupported();
return;
}
}
else if (ELMulator.isMode22(request)) // Mode 0x22 (extended info) service - Mfg-dependent and not defined in OBDII spec
{
Serial.print("Mode 22 PID: "); Serial.println(request.substring(2));
if (request.substring(2).compareTo("52") == 0) // Ethanol percent
{
if (ethPercentResponse.length())
{
ELMulator.writeResponse(ethPercentResponse);
return;
}
else
{
DEBUG("ETH % response is empty.");
ELMulator.writePidNotSupported();
return;
}
}
if (request.substring(2).compareTo("18E4") == 0) // DPF Clogging A-R Giulia
{
if (dpfCloggingResponse.length())
{
ELMulator.writeResponse(dpfCloggingResponse);
return;
}
else
{
DEBUG("DPF Clogging response is empty.");
ELMulator.writePidNotSupported();
return;
}
}
ELMulator.writePidNotSupported();
return;
}
else // Handle any other supported PID request
{
uint8_t pidCode = ELMulator.getPidCode(request); // Extract the specific PID code from the request
// Example response for 0x05 (Engine Coolant Temp) - returning a mock data value
if (pidCode == ENGINE_COOLANT_TEMP)
{
uint32_t sensorValue = ELMulator.getMockSensorValue();
/**
* Response parameters:
* request - specifies the original PID request being responded to.
* numberOfBytes - the number of bytes this PID value returns (per OBDII spec), using lookup table responseBytes.
* sensorValue - the value to return in our response; a mock value in this example.
*/
ELMulator.writePidResponse(request, responseBytes[pidCode], sensorValue);
return;
}
// Example response for PID 0x0C (Engine RPM) - returns a modified mock sensor value
else if (pidCode == ENGINE_RPM)
{
uint16_t rpmValue = ELMulator.getMockSensorValue() * 100; // Here we multiply the mock value provided, for a more realistic RPM number
ELMulator.writePidResponse(request, responseBytes[pidCode], rpmValue);
return;
}
// Example response for PID 0xA6 (Odometer) - returns our hardcoded odometer response string
else if (pidCode == ODOMETER)
{
ELMulator.writePidResponse(request, responseBytes[pidCode], odoResponse);
return;
}
// // Example response for PID 0xOD (Vehicle speed) - returns a value from external GPS
// else if (pidCode == VEHICLE_SPEED)
// {
// uint32_t gpsSpeed = myGPS.speed();
// ELMulator.writePidResponse(request, responseBytes[pidCode], gpsSpeed);
// return;
// }
// Default response for any other supported PID request - returns an unmodified mock sensor value
else
{
ELMulator.writePidResponse(request, responseBytes[pidCode], ELMulator.getMockSensorValue());
return;
}
}
}
+100
View File
@@ -0,0 +1,100 @@
# OBD Speed (JC3636W518)
Vehicle speed from an ELM327 over BLE, shown as a big number + arc gauge on top of an animated GIF.
Uses the shared board library and LVGL 9.6 (`../shared`), NimBLE-Arduino 2.5.1.
## Use
- **Speed page** — speed in km/h (`--` = no data: not connected, or ignition off), arc gauge 0–200 km/h,
status pill below the number (adapter name when running, otherwise what it is doing).
**Battery voltage** (`ATRV`, every 2 s) as a small arc in the bottom gap (11–15 V) + number; color:
red < 11.8 V, orange < 12.2 V, green < 13.0 V (resting OK), blue ≤ 14.8 V (charging), red above (overcharge).
- **Swipe left → adapter menu** — scans while open. OBD-like adapters (name OBD/ELM/…, or service FFF0/FFE0/18F0)
are listed first in green. **Tap one** to select it: it is remembered (NVS) and connected immediately.
**Forget** clears the remembered adapter, **Done** (or swipe right) returns to the speed page.
- **Swipe left again → settings** — screen rotation 0 / 90 / 180 / 270 degrees, and **screen off without data** Off / 2 / 5 / 10 min (default 2). Both remembered in NVS.
- **Swipe left once more → background** — `Built-in` plus every GIF in `/gifs` on the SD card (size and
dimensions shown; not 360×360 in orange). Tap one: it is copied into the device's flash (progress shown) and
played from there, so the SD card is not needed afterwards. At boot the device checks (in the background)
whether the chosen file on the SD card changed (size/date) and re-copies it. **Rescan** re-reads the card.
- **Swipe left once more → CAN log** (temporary: diagnostic scan to find the cruise/ACC set speed and speed limit, see below).
**Start/Stop** (remembered: logging resumes by itself after power-up), **Mark**, scan progress, **Reset scan**,
and the file on the SD card. While logging, the speed page shows a red `REC <marks>` pill and
**a tap on the speed page adds a mark** (pill flashes `MARK n`).
- **Idle** — after that time without speed data (ignition off, adapter gone) the screen goes dark, the GIF pauses and
OBD polling stops; only `ATRV` every 30 s (answered by the adapter itself, doesn't wake the car's bus).
Wakes on a touch (the touch is swallowed) or by itself when the voltage rises above 13.2 V (engine started).
Not used while no adapter is chosen.
- On power-up the remembered adapter is connected automatically; if the link drops or the adapter is not
there (car off), it retries every 3 s. With no adapter remembered, the device starts on the menu page.
## How it talks to the ELM327
Service `FFF0`, notifications + commands on `FFF1` (verified with the user's "OBDII" adapter, see
`docs/2026-10-23_ble_scanner_car_test.txt`, made with the BLE scanner tool that was removed afterwards — in git history); other adapters: first notify+write pair.
Init: `ATZ`, `ATE0`, `ATL0`, `ATS0`, `ATH0`, `ATSP0`, `0100`; then `010D` (speed) is polled continuously.
Serial (115200) prints status changes as `[obd] ...`.
## Log page: diagnostic scan (finding ACC set speed / speed sign)
Neither value is a standard OBD PID. **First test drive (2026-11-02, `docs/canlog`)**: listening on the OBD port
(ELM327 `ATMA`, ID survey with wildcard filters) saw **no broadcast frames at all**, only diagnostic replies: the
Fiesta Mk8's gateway passes only diagnostics to the OBD socket. (Broadcast candidates from opendbc for newer Fords,
for reference: `0x165` `Veh_V_DsplyCcSet`, `0x202` `Veh_V_RqCcSet`, `0x3D9` `IsaVLim_D_Rq`; the Mk7.5 Fiesta sheet in
github.com/consp/ford-can-stuff lists `0x3CD` "Traffic Recognition Data" on the infotainment bus.)
So the values have to be asked from the modules. While logging is on, the OBD task runs a **read-only scan**
(only UDS `22` ReadDataByIdentifier in the default session; nothing in the car is changed), progress kept in NVS
(namespace `scan`) so it continues on every drive:
1. **Unfiltered listen check** (once): 2 × 5 s `ATMA` without filter, CAF off and on.
2. **Module discovery**: `22F188` (software number) to every address 0x700..0x7EF (`ATSH` + `ATCRA` addr+8,
`ATST19` = 100 ms timeout). Logged as `D <addr> <reply>`, list as `I`. Repeated if the PCM (0x7E0) didn't answer.
3. **DID scan**: all 65536 DIDs of each module, order 0x706 (IPMA camera), 0x764 (CCM radar), 0x720 (IPC), 0x7E0 (PCM),
then the other modules found; per module the DID ranges D000-DFFF, 4000-4FFF, 0000-3FFF, 5000-CFFF, E000-FFFF.
Positive replies `S <addr> <did> <data>`, other negative responses than 0x31 `R <addr> <did> <nrc>`. A module
without service 22 (NRC 0x11) is skipped; 20 requests without a reply = module asleep: back up and wait.
The `<request>1` suffix (return after the first reply) is used when the adapter supports it.
**Probe** (once, after drive 2 found only the PCM): `3E00` TesterPresent with a 1 s timeout to every address not
found yet. DIDs are asked **3 per request** (`22 D000 D001 D002`, one CAN frame; the module returns only the
supported ones) when the module passes the test `22F1FFF188F1FE`; a hit is re-asked one DID at a time.
`E progress` every 512 DIDs (with ms/DID).
4. Every 2 s `ATSH 7DF` / `ATAR` + `010D` (speed, so the display keeps working, a bit laggy) and `ATRV`.
5. **Watch** (once the scan is done): the 327 PCM DIDs of unknown meaning in `src/watch_dids.h` (generated by
`../tools/make_watch_dids.py` from the scan logs; leaves out F1xx identification, F4xx = mode 01 copies, DExx
tables, D01A text, DD00 clock, DD01 odometer) are read round after round; every change is logged as
`W <did> <data>`, each round as `E round N done, s, changes`. 3 DIDs per request if the PCM allows it
(tested with `22D100D134D137`), the reply is split with the lengths from the scan.
**Scan result (2026-11-12..18, logs `docs/canlog/scan`, `scan2`)**: only the PCM 0x7E0 answers (also with `3E00` and a 1 s
timeout); **389 supported DIDs**, ~175 ms per request, the multi-DID test `22F1FFF188F1FE` timed out (single requests).
Known: F190 VIN, F188 `JB2B-14C204-ADA`, DD01 odometer (0x021676 = 136 822 km), F4xx = mode 01 PIDs.
Page: Start/Stop (remembered), Mark, progress (module, DID, %), modules found, DIDs found, last positive reply,
**Reset scan** (starts over the next time logging runs). While logging the speed page shows `REC <marks>`; a tap on
it adds a mark.
Log: `/canlog/log_NNN.txt` (new file per session, appended every 2 s; kept in RAM while the card is missing).
Lines `<ms> <type> <data>`: `C` adapter, `P` protocol, `V` speed, `B` voltage, `M` mark, `D`/`I` modules,
`S`/`R` DID replies, `F` raw frame, `E` adapter message/note.
**Download over USB** (no card reader needed): serial commands `ls` and `get <file>` (115200 baud).
## Files
| File | What |
|---|---|
| `src/main.cpp` | LVGL UI (tileview: speed, adapter menu, settings, background, CAN log) |
| `src/obd_link.cpp/.h` | BLE scan, connect/reconnect, ELM327 init and speed polling, diagnostic scan steps (background task on core 0) |
| `src/font_speed_120.c` | Montserrat Medium 120 px, digits and `-`, 4 bpp (generated with `lv_font_conv`, see header) |
| `src/can_log.cpp/.h` | Log buffer + SD writer (background task), marks, info shown on the log page, serial `ls`/`get` |
| `src/sd_card.cpp/.h` | Shared, reference-counted SD_MMC mount (background store + logger) |
| `src/bg_store.cpp/.h` | Background GIF from the SD card: list `/gifs`, copy into the `bggif` flash partition (header written last), mmap for playback, change check at boot (background task) |
| `partitions.csv` | 4 MB app (no OTA) + 11.9 MB `bggif` raw area + NVS |
| `docs/canlog/` | Logs of the test drives |
| `data/bg.gif` | Built-in background (`ezgif-5-cb56986bc7.gif`, 360×360), linked into the firmware via `board_build.embed_files` |
| `sd/gifs/` | (not in git) GIFs converted with `../tools/gif_to_360.py`, ready to copy to the SD card |
## GIFs for the SD card
Convert any GIF to 360×360 (scale to cover, center crop, frame timing kept) with
```
pip install pillow
python ../tools/gif_to_360.py <gif files or folders> -o sd/gifs
```
and copy the files into a folder `gifs` on the SD card. Max ~11.5 MB per GIF. GIFs are played from flash at their own
frame rate (360×360: ~10–12 ms decode per frame).
Replace `data/bg.gif` to change the built-in background.
Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 MiB

@@ -0,0 +1,121 @@
===== Inspect 61:69:aa:93:64:c9 (t=154s since boot) =====
(no name)
connect failed, error 13
===== Scan list (t=9s since boot) =====
d8:a7:77:62:cf:2b -87 dBm (no name) [not connectable]
6a:0b:59:2f:28:34 -78 dBm (no name)
02:04:bd:fc:cf:71 -88 dBm (no name) [not connectable]
1e:f4:be:9f:3b:ec -81 dBm (no name) [not connectable]
48:db:b1:48:1c:ba -92 dBm (no name)
71:e4:11:0c:69:31 -92 dBm (no name)
d7:03:e0:21:ae:2c -82 dBm (no name) [not connectable]
c8:49:09:05:72:65 -92 dBm (no name) [not connectable]
50:ed:64:42:4e:1f -93 dBm (no name) [not connectable]
===== Inspect 71:e4:11:0c:69:31 (t=9s since boot) =====
(no name) -92 dBm
SVC 0x1800
0x2a00 [R]
0x2a01 [R]
SVC 0x1801
0x2a05 [I]
SVC 0x180a
0x2a29 [R]
0x2a24 [R]
SVC d0611e78-bbb4-4591-a5f8-487910ae4366
8667556c-9a37-4c91-84ed-54ee27d90049 [W N]
SVC 9fa480e0-4967-4542-9390-d343dc5d04ae
af0badb1-5b99-43cd-917a-a77bc549e3cc [W N]
SVC 0x180f
0x2a19 [R N]
SVC 0x1805
0x2a2b [R N]
0x2a0f [R]
SVC 7905f431-b5ce-4e99-a40f-4b1e122d00d0
69d1d8f3-45e1-49a8-9821-9bbdfdaad9d9 [W]
9fbf120d-6301-42d9-8c58-25e699a21dbd [N]
22eac6e9-24d6-4bb5-be44-b36ace7c7bfb [N]
SVC 89d3502b-0f36-433a-8ef4-c502ad55f8dc
9b3c81d8-57b1-4a8a-b8df-0e56f7ca51c2 [W N]
2f7cabce-808d-411f-9a0c-bb92ba96c102 [W N]
c6b2f38c-23ab-46d8-a6ab-a3a870bbd5d7 [R W]
ELM candidate:
write 8667556c-9a37-4c91-84ed-54ee27d90049
notify 8667556c-9a37-4c91-84ed-54ee27d90049
===== Scan list (t=43s since boot) =====
be:67:00:63:4a:bb -69 dBm ELK-BLEDOM0B
57:d8:bc:03:00:d2 -86 dBm (no name)
11:23:d0:d0:94:76 -87 dBm (no name) [not connectable]
b8:ab:62:f5:df:63 -74 dBm BlackVue970X-EA0D41
58:4b:32:d8:a0:00 -59 dBm (no name) svc: 0xfd5a
5f:20:5f:9e:52:29 -97 dBm (no name) [not connectable]
5c:a0:49:f2:3d:63 -93 dBm (no name) [not connectable]
e3:8d:69:a0:80:9d -90 dBm (no name)
5c:13:59:55:ef:8e -61 dBm (no name) svc: 0xfd5a
6f:9a:f3:43:9e:69 -93 dBm (no name)
65:03:4a:ef:35:58 -59 dBm (no name) svc: 0xfd5a
c6:f4:05:9e:ef:46 -95 dBm (no name) [not connectable]
1c:a1:35:69:8d:c5 -77 dBm OBDII [OBD?] svc: 0xfff0
74:64:f9:df:4c:8e -69 dBm (no name) svc: 0xfd69
53:61:36:06:da:f6 -66 dBm (no name) svc: 0xfd69
===== Inspect 1c:a1:35:69:8d:c5 (t=43s since boot) =====
OBDII -77 dBm
SVC 0x1800
0x2a00 [R]
SVC 0x1801
0x2a05 [I]
SVC 0xfff0
0xfff1 [W WnR N]
0xfff2 [W WnR]
ELM candidate:
write 0xfff1
notify 0xfff1
===== ELM test 1c:a1:35:69:8d:c5 (t=50s since boot) =====
> ATZ (reset)
ATZ
ELM327 v2.1
> ATE0 (echo off)
ATE0
OK
> ATI (version)
ELM327 v2.1
> ATRV (battery voltage)
12.9V
> 0100 (supported PIDs (needs ignition on))
41 00 BE 3E A8 13
===== Scan list (saved by button) (t=54s since boot) =====
be:67:00:63:4a:bb -69 dBm ELK-BLEDOM0B
57:d8:bc:03:00:d2 -87 dBm (no name)
11:23:d0:d0:94:76 -87 dBm (no name) [not connectable]
b8:ab:62:f5:df:63 -71 dBm BlackVue970X-EA0D41
58:4b:32:d8:a0:00 -59 dBm (no name) svc: 0xfd5a
5f:20:5f:9e:52:29 -95 dBm (no name) [not connectable]
5c:a0:49:f2:3d:63 -93 dBm (no name) [not connectable]
e3:8d:69:a0:80:9d -90 dBm (no name)
5c:13:59:55:ef:8e -61 dBm (no name) svc: 0xfd5a
6f:9a:f3:43:9e:69 -93 dBm (no name)
65:03:4a:ef:35:58 -59 dBm (no name) svc: 0xfd5a
c6:f4:05:9e:ef:46 -95 dBm (no name) [not connectable]
1c:a1:35:69:8d:c5 -81 dBm OBDII [OBD?] svc: 0xfff0
74:64:f9:df:4c:8e -69 dBm (no name) svc: 0xfd69
53:61:36:06:da:f6 -66 dBm (no name) svc: 0xfd69
+2
View File
@@ -0,0 +1,2 @@
# 12-OBD-Speed CAN log (t = ms since boot)
# C adapter, P protocol, V speed km/h, B battery V, M mark, F id data, N id (no frame), I survey IDs, E note
+3
View File
@@ -0,0 +1,3 @@
# 12-OBD-Speed CAN log (t = ms since boot)
# C adapter, P protocol, V speed km/h, B battery V, M mark, F id data, N id (no frame), I survey IDs, E note
71136 M 1
+353
View File
@@ -0,0 +1,353 @@
# 12-OBD-Speed CAN log (t = ms since boot)
# C adapter, P protocol, V speed km/h, B battery V, M mark, F id data, N id (no frame), I survey IDs, E note
7304 C OBDII ELM327 v2.1
7404 P A6
7504 E ATCSM1 OK
8305 V 0
8455 B 13.0
8905 E NO DATA
10505 E NO DATA
11105 V 0
11205 B 12.9
11655 E NO DATA
13206 E NO DATA
13856 V 0
13956 B 13.0
14406 E NO DATA
14869 M 1
15956 E NO DATA
16556 V 0
16656 B 13.0
17106 E NO DATA
18657 E NO DATA
19257 V 0
19357 B 13.0
19457 I
19803 E NO DATA
21404 E NO DATA
22954 E NO DATA
23555 V 0
23655 B 12.9
24106 E NO DATA
25656 E NO DATA
27256 E NO DATA
27956 V 0
28056 B 13.1
28506 E NO DATA
30057 E NO DATA
31607 E NO DATA
32207 V 0
32307 B 12.9
32757 E NO DATA
34357 E NO DATA
35957 E NO DATA
36553 V 1
36653 B 12.9
37153 E NO DATA
38753 E NO DATA
40354 E NO DATA
40954 V 3
41054 B 12.9
41506 E NO DATA
43057 E NO DATA
44657 E NO DATA
45357 V 5
45507 B 12.9
45957 E NO DATA
47507 E NO DATA
49057 E NO DATA
49707 V 9
49857 B 12.9
50307 E NO DATA
51903 E NO DATA
53503 E NO DATA
54155 V 8
54206 B 12.9
54357 E OK
54707 E NO DATA
56307 E NO DATA
57153 V 6
57253 B 12.9
57855 E NO DATA
59556 E NO DATA
61106 E NO DATA
61706 V 11
61806 B 12.9
62256 E NO DATA
63856 E NO DATA
65406 E NO DATA
66056 V 24
66156 B 12.9
66607 E NO DATA
68153 E NO DATA
69703 E NO DATA
70305 V 31
70405 B 12.9
70856 E NO DATA
72406 E NO DATA
73956 E NO DATA
74556 V 32
74656 B 12.9
75106 E NO DATA
76657 E NO DATA
78207 E NO DATA
78807 V 33
78907 B 12.9
79357 E NO DATA
80907 E NO DATA
82453 E NO DATA
83053 V 31
83153 B 12.9
83603 E NO DATA
85153 E NO DATA
86703 E NO DATA
87303 V 36
87403 B 12.9
87853 E NO DATA
89403 E NO DATA
90953 E NO DATA
91554 V 38
91654 B 12.9
92106 E NO DATA
93657 E NO DATA
95207 E NO DATA
95807 V 34
96007 B 12.9
96454 E NO DATA
98004 E NO DATA
99654 E NO DATA
100355 V 24
100505 B 12.9
100955 E NO DATA
102506 E NO DATA
104057 E NO DATA
104654 V 34
104754 B 12.9
105204 E NO DATA
106755 E NO DATA
108306 E NO DATA
108906 V 41
109006 B 12.9
117817 E disconnected
123303 C OBDII ELM327 v2.1
123403 P A6
123503 E ATCSM1 OK
124203 V 46
124303 B 12.9
124755 E NO DATA
126305 E NO DATA
126906 V 45
127006 B 12.9
127456 E NO DATA
129006 E NO DATA
129607 V 43
129757 B 12.9
130207 E NO DATA
131757 E NO DATA
132357 V 41
132457 B 12.9
132907 E NO DATA
134457 E NO DATA
135057 V 39
135157 B 12.9
135303 I
135604 E NO DATA
137154 E NO DATA
138704 E NO DATA
139304 V 22
139404 B 12.9
139854 E NO DATA
141423 M 2
141454 E NO DATA
143004 E NO DATA
143605 V 7
143705 B 13.0
144155 E NO DATA
145706 E NO DATA
147256 E NO DATA
147856 V 28
147956 B 12.9
148407 E NO DATA
149957 E NO DATA
151507 E NO DATA
152107 V 43
152207 B 12.9
152657 E NO DATA
154207 E NO DATA
155753 E NO DATA
156353 V 51
156453 B 13.0
156904 E NO DATA
158455 E NO DATA
160005 E NO DATA
160605 V 51
160705 B 12.9
161155 E NO DATA
162705 E NO DATA
164255 E NO DATA
164856 V 53
164956 B 12.9
165407 E NO DATA
166953 E NO DATA
168508 E NO DATA
169103 V 46
169253 B 12.9
169703 E NO DATA
171254 E NO DATA
172805 E NO DATA
173406 V 19
173506 B 12.9
173956 E NO DATA
175506 E NO DATA
177056 E NO DATA
177656 V 3
177756 B 12.9
178206 E NO DATA
179806 E NO DATA
181357 E NO DATA
181957 V 8
182057 B 12.9
182507 E NO DATA
184057 E NO DATA
185603 E NO DATA
186203 V 31
186304 B 12.9
186756 E NO DATA
188307 E NO DATA
189857 E NO DATA
190457 V 45
190557 B 13.0
191007 E NO DATA
192603 E NO DATA
194154 E NO DATA
194754 V 49
194854 B 12.9
195304 E NO DATA
196855 E NO DATA
198406 E NO DATA
199006 V 49
199106 B 12.9
199556 E NO DATA
201106 E NO DATA
202656 E NO DATA
203257 V 50
203357 B 12.9
203807 E NO DATA
205353 E NO DATA
206903 E NO DATA
207504 V 50
207604 B 12.9
208054 E NO DATA
209604 E NO DATA
211155 E NO DATA
211755 V 50
211855 B 12.9
212305 E NO DATA
213855 E NO DATA
215405 E NO DATA
216005 V 50
216105 B 12.9
216555 E NO DATA
218105 E NO DATA
219656 E NO DATA
220256 V 49
220356 B 12.9
220806 E NO DATA
222357 E NO DATA
223903 E NO DATA
224503 V 51
224603 B 12.9
225055 E NO DATA
226655 E NO DATA
228206 E NO DATA
228806 V 46
228906 B 12.9
229356 E NO DATA
230906 E NO DATA
232456 E NO DATA
233057 V 24
233157 B 12.9
233603 E NO DATA
235153 E NO DATA
236703 E NO DATA
237303 V 5
237403 B 12.9
237853 E NO DATA
239403 E NO DATA
240953 E NO DATA
241553 V 0
241653 B 12.9
242103 E NO DATA
243653 E NO DATA
245203 E NO DATA
245804 V 0
245904 B 12.9
246355 E NO DATA
247906 E NO DATA
249456 E NO DATA
250056 V 16
250156 B 13.0
250606 E NO DATA
252156 E NO DATA
253706 E NO DATA
254307 V 37
254407 B 12.9
254857 E NO DATA
256407 E NO DATA
257957 E NO DATA
258557 V 47
258657 B 13.0
259107 E NO DATA
260653 E NO DATA
262203 E NO DATA
262805 V 45
262905 B 12.9
263356 E NO DATA
264906 E NO DATA
266456 E NO DATA
267056 V 44
267156 B 13.0
267607 E NO DATA
269157 E NO DATA
270707 E NO DATA
271307 V 45
271457 B 12.9
271907 E NO DATA
273457 E NO DATA
275007 E NO DATA
275607 V 48
275707 B 12.9
276157 E NO DATA
277757 E NO DATA
279307 E NO DATA
279907 V 47
280007 B 12.9
280457 E NO DATA
282007 E NO DATA
283557 E NO DATA
284157 V 32
284257 B 13.0
284707 E NO DATA
286457 E NO DATA
288003 E NO DATA
288653 V 12
288753 B 13.0
289255 E NO DATA
290805 E NO DATA
292355 E NO DATA
292956 V 13
293056 B 13.0
293507 E NO DATA
295057 E NO DATA
296607 E NO DATA
297257 V 8
297357 B 13.0
297804 E NO DATA
299404 E NO DATA
301054 E NO DATA
301705 V 3
301805 B 13.0
302255 E NO DATA
303805 E NO DATA
305355 E NO DATA
305906 V -1
+210
View File
@@ -0,0 +1,210 @@
# 12-OBD-Speed CAN log (t = ms since boot)
# C adapter, P protocol, V speed km/h, B battery V, M mark, F id data, N id (no frame), I survey IDs, E note
7003 C OBDII ELM327 v2.1
7153 P A6
7303 E ATCSM1 OK
8253 V 0
8354 B 13.0
8804 E NO DATA
10504 E NO DATA
11205 V 4
11455 B 12.9
12006 E NO DATA
13806 E NO DATA
14457 V 5
14557 B 13.0
15007 E NO DATA
16557 E NO DATA
17157 V 5
17357 B 13.0
19257 E NO DATA
19907 V 6
20057 B 13.0
20507 E NO DATA
20507 I
22157 E NO DATA
23757 E NO DATA
25503 E NO DATA
26208 V 7
26253 B 13.0
26508 E OK
26908 E OK
26908 E >NO DATA
27053 E OK
28604 E NO DATA
30204 E NO DATA
31755 E NO DATA
32355 V 6
32455 B 12.9
32956 E NO DATA
34506 E NO DATA
36106 E NO DATA
36706 V 23
36806 B 13.0
37356 E NO DATA
38956 E NO DATA
40506 E NO DATA
41106 V 41
41206 B 12.9
41657 E NO DATA
43207 E NO DATA
44753 E NO DATA
45353 V 41
45454 B 12.9
45904 E NO DATA
47455 E NO DATA
49005 E NO DATA
49605 V 34
49705 B 12.9
50156 E NO DATA
51706 E NO DATA
53256 E NO DATA
53857 V 28
53957 B 12.9
54457 E NO DATA
54607 N 202
56157 E NO DATA
56753 V 33
56854 B 12.9
57304 E NO DATA
58904 E NO DATA
60455 E NO DATA
61055 V 36
61155 B 12.9
61606 E NO DATA
63256 E NO DATA
64807 E NO DATA
65407 V 40
65557 B 12.9
66007 E NO DATA
67557 E NO DATA
69153 E NO DATA
69753 V 43
69903 B 12.9
70354 E NO DATA
71904 E NO DATA
73504 E NO DATA
74255 V 43
74355 B 12.9
74856 E NO DATA
76456 E NO DATA
78106 E NO DATA
78756 V 42
78856 B 12.9
79306 E NO DATA
80856 E NO DATA
82406 E NO DATA
83006 V 40
83106 B 12.9
83556 E NO DATA
85107 E NO DATA
86653 E NO DATA
87253 V 35
87403 B 12.9
87853 E NO DATA
89454 E NO DATA
91004 E NO DATA
91605 V 26
91705 B 12.9
92156 E NO DATA
93706 E NO DATA
95256 E NO DATA
95856 V 6
95956 B 12.9
96406 E NO DATA
97957 E NO DATA
99507 E NO DATA
100103 V 0
100203 B 12.9
100653 E NO DATA
102254 E NO DATA
103854 E NO DATA
104505 V 15
104705 B 12.9
105156 E NO DATA
106706 E NO DATA
108256 E NO DATA
108857 V 32
108957 B 12.9
109507 E NO DATA
111057 E NO DATA
112603 E NO DATA
113203 V 42
113303 B 13.0
113754 E NO DATA
115354 E NO DATA
116904 E NO DATA
117556 V 42
117656 B 12.9
118107 E NO DATA
119657 E NO DATA
121257 E NO DATA
121907 V 39
122007 B 12.9
122457 E NO DATA
124057 E NO DATA
125603 E NO DATA
126253 V 34
126353 B 12.9
126803 E NO DATA
128353 E NO DATA
129953 E NO DATA
130653 V 29
130753 B 12.9
131204 E NO DATA
132904 E NO DATA
134554 E NO DATA
135155 V 21
135255 B 13.0
135705 E NO DATA
137255 E NO DATA
138856 E NO DATA
139556 V 16
139656 B 12.9
140156 E NO DATA
141756 E NO DATA
143306 E NO DATA
144006 V 10
144106 B 12.9
144556 E NO DATA
146156 E NO DATA
147706 E NO DATA
148306 V 12
148456 B 12.9
148956 E NO DATA
150506 E NO DATA
152156 E NO DATA
152806 V 3
152906 B 12.9
153357 E NO DATA
154907 E NO DATA
156453 E NO DATA
157153 V 4
157353 B 12.9
157804 E NO DATA
159404 E NO DATA
161005 E NO DATA
161606 V 0
161756 B 12.8
162207 E NO DATA
163807 E NO DATA
165503 E NO DATA
166204 V 1
166404 B 12.9
168455 E NO DATA
170106 E NO DATA
171706 E NO DATA
172306 V 0
172506 B 12.9
173007 E NO DATA
174653 E NO DATA
176204 E NO DATA
176804 V 0
176904 B 12.9
177355 E NO DATA
178905 E NO DATA
180455 E NO DATA
181055 V 0
181205 B 12.9
181656 E NO DATA
183206 E NO DATA
+473
View File
@@ -0,0 +1,473 @@
# 12-OBD-Speed CAN log (t = ms since boot)
# C adapter, P protocol, V speed km/h, B battery V, M mark, F id data, N id (no frame), I survey IDs, E note
7103 C OBDII ELM327 v2.1
7203 P A6
7303 E ATCSM1 OK
8003 V 0
8103 B 12.9
8555 E NO DATA
10155 E NO DATA
10755 V 0
10855 B 12.9
11405 E NO DATA
12956 E NO DATA
13556 V 0
13656 B 12.9
14156 E NO DATA
15706 E NO DATA
16306 V 0
16406 B 12.9
16856 E NO DATA
18406 E NO DATA
19006 V 0
19106 B 12.9
19206 I
19606 E NO DATA
21156 E NO DATA
22706 E NO DATA
23356 V 1
23506 B 12.9
23957 E NO DATA
25557 E NO DATA
27107 E NO DATA
27753 V 4
27853 B 12.9
28354 E NO DATA
29904 E NO DATA
31505 E NO DATA
32106 V 5
32206 B 12.7
32656 E NO DATA
34206 E NO DATA
35757 E NO DATA
36357 V 7
36457 B 12.9
36903 E NO DATA
38453 E NO DATA
40053 E NO DATA
40703 V 14
40803 B 12.9
41303 E NO DATA
42853 E NO DATA
44404 E NO DATA
45204 V 11
45304 B 12.9
45804 E NO DATA
47354 E NO DATA
48954 E NO DATA
49555 V 22
49655 B 12.9
50106 E NO DATA
51657 E NO DATA
53353 E NO DATA
53954 V 32
54054 B 12.9
54505 E NO DATA
56055 E NO DATA
57605 E NO DATA
58205 V 35
58305 B 12.9
58805 E NO DATA
60405 E NO DATA
61955 E NO DATA
62555 V 42
62655 B 12.9
63106 E NO DATA
64656 E NO DATA
66207 E NO DATA
66807 V 46
66907 B 12.9
67357 E NO DATA
68903 E NO DATA
70453 E NO DATA
71053 V 37
71153 B 12.9
71603 E NO DATA
73154 E NO DATA
74855 E NO DATA
75455 V 30
75555 B 12.8
76055 E NO DATA
77656 E NO DATA
79206 E NO DATA
79906 V 23
80106 B 12.9
80657 E NO DATA
82207 E NO DATA
83753 E NO DATA
84353 V 37
84453 B 12.9
84903 E NO DATA
86454 E NO DATA
88005 E NO DATA
88606 V 45
88706 B 12.9
89156 E NO DATA
90706 E NO DATA
92256 E NO DATA
92856 V 49
92956 B 12.9
93406 E NO DATA
94956 E NO DATA
96506 E NO DATA
97106 V 51
97206 B 12.8
97656 E NO DATA
99206 E NO DATA
100756 E NO DATA
101356 V 51
101456 B 12.9
101906 E NO DATA
103456 E NO DATA
105006 E NO DATA
105606 V 51
105706 B 12.9
106153 E NO DATA
107703 E NO DATA
109253 E NO DATA
109853 V 50
109953 B 12.8
110405 E NO DATA
111955 E NO DATA
113505 E NO DATA
114105 V 50
114205 B 12.9
114655 E NO DATA
116205 E NO DATA
117755 E NO DATA
118355 V 50
118455 B 12.9
118906 E NO DATA
120457 E NO DATA
122007 E NO DATA
122607 V 50
122707 B 12.9
123154 E NO DATA
124704 E NO DATA
126254 E NO DATA
126854 V 50
126954 B 12.9
127404 E NO DATA
128954 E NO DATA
130505 E NO DATA
131106 V 50
131206 B 12.9
140012 E disconnected
145303 C OBDII ELM327 v2.1
145403 P A6
145503 E ATCSM1 OK
146203 V 50
146303 B 12.9
146753 E NO DATA
148303 E NO DATA
148904 V 50
149004 B 12.8
149454 E NO DATA
151005 E NO DATA
151605 V 50
151705 B 12.9
152155 E NO DATA
153705 E NO DATA
154306 V 51
154406 B 12.8
154857 E NO DATA
156407 E NO DATA
157007 V 50
157157 B 12.9
157257 I
157607 E NO DATA
159157 E NO DATA
160753 E NO DATA
161353 V 50
161453 B 12.9
161905 E NO DATA
163456 E NO DATA
165006 E NO DATA
165606 V 50
165706 B 12.9
166156 E NO DATA
167707 E NO DATA
169253 E NO DATA
169854 V 50
169954 B 12.9
170405 E NO DATA
171955 E NO DATA
173506 E NO DATA
174106 V 51
174206 B 12.8
174657 E NO DATA
176203 E NO DATA
177753 E NO DATA
178453 V 48
178553 B 12.9
179003 E NO DATA
180654 E NO DATA
182354 E NO DATA
182954 V 32
183104 B 12.9
183604 E NO DATA
183755 E OK
185356 E NO DATA
185957 V 10
186057 B 12.9
186507 E NO DATA
188057 E NO DATA
189757 E NO DATA
190403 V 2
190503 B 12.9
190953 E NO DATA
192503 E NO DATA
194053 E NO DATA
194653 V 24
194803 B 12.8
195254 E NO DATA
196805 E NO DATA
198355 E NO DATA
198955 V 41
199055 B 12.8
199506 E NO DATA
201057 E NO DATA
202607 E NO DATA
203207 V 44
203307 B 12.9
203754 E NO DATA
205304 E NO DATA
206854 E NO DATA
207454 V 46
207554 B 12.9
208004 E NO DATA
209555 E NO DATA
211105 E NO DATA
211705 V 44
211805 B 12.9
212256 E NO DATA
213806 E NO DATA
215356 E NO DATA
215956 V 37
216056 B 12.9
216506 E NO DATA
218106 E NO DATA
219706 E NO DATA
220306 V 29
220406 B 12.9
220856 E NO DATA
222406 E NO DATA
223957 E NO DATA
224557 V 37
224657 B 12.9
225103 E NO DATA
226653 E NO DATA
228203 E NO DATA
228803 V 41
228903 B 12.9
229353 E NO DATA
230903 E NO DATA
232453 E NO DATA
233054 V 41
233154 B 12.9
233606 E NO DATA
235156 E NO DATA
236706 E NO DATA
237306 V 41
237406 B 12.9
237856 E NO DATA
239407 E NO DATA
240957 E NO DATA
241557 V 38
241657 B 12.9
242107 E NO DATA
243657 E NO DATA
245207 E NO DATA
245804 V 38
245904 B 12.9
246355 E NO DATA
247905 E NO DATA
249455 E NO DATA
250056 V 37
250156 B 12.9
250606 E NO DATA
252156 E NO DATA
253707 E NO DATA
254307 V 37
254407 B 12.8
254854 E NO DATA
256405 E NO DATA
257955 E NO DATA
258605 V 38
258705 B 12.9
259155 E NO DATA
260705 E NO DATA
262255 E NO DATA
262905 V 39
263005 B 12.8
263456 E NO DATA
265006 E NO DATA
266556 E NO DATA
267156 V 40
267256 B 12.9
267707 E NO DATA
269257 E NO DATA
270803 E NO DATA
271403 V 41
271503 B 12.9
271954 E NO DATA
273505 E NO DATA
275055 E NO DATA
275655 V 42
275755 B 12.9
276206 E NO DATA
277757 E NO DATA
279303 E NO DATA
279904 V 45
280004 B 12.9
280454 E NO DATA
282004 E NO DATA
283555 E NO DATA
284155 V 47
284255 B 12.9
284705 E NO DATA
286255 E NO DATA
287805 E NO DATA
288406 V 45
288506 B 12.9
288956 E NO DATA
290506 E NO DATA
292056 E NO DATA
292656 V 43
292756 B 12.9
293203 E NO DATA
294804 E NO DATA
296354 E NO DATA
297005 V 37
297105 B 12.9
297555 E NO DATA
299105 E NO DATA
300755 E NO DATA
301355 V 31
301505 B 12.9
301955 E NO DATA
303505 E NO DATA
305055 E NO DATA
305656 V 34
305756 B 12.9
306206 E NO DATA
307756 E NO DATA
309306 E NO DATA
309906 V 39
310006 B 12.9
310507 E NO DATA
312053 E NO DATA
313603 E NO DATA
314203 V 34
314303 B 12.9
314754 E NO DATA
316304 E NO DATA
317854 E NO DATA
318454 V 35
318554 B 12.9
319006 E NO DATA
320556 E NO DATA
322106 E NO DATA
322706 V 41
322806 B 12.9
323256 E NO DATA
324807 E NO DATA
326353 E NO DATA
327004 V 39
327104 B 12.9
327555 E NO DATA
329106 E NO DATA
330656 E NO DATA
331256 V 22
331356 B 12.9
331807 E NO DATA
333407 E NO DATA
335053 E NO DATA
335653 V 13
335753 B 12.9
337953 E NO DATA
339503 E NO DATA
341053 E NO DATA
341654 V 10
341754 B 12.9
342254 E NO DATA
343904 E NO DATA
345654 E NO DATA
346404 V 17
346554 B 12.9
347004 E NO DATA
348554 E NO DATA
350155 E NO DATA
350855 V 13
350905 B 12.9
351105 E NG...
351105 E OK
351556 E NO DATA
353156 E NO DATA
353856 V 19
354056 B 12.9
354503 E NO DATA
356053 E NO DATA
357603 E NO DATA
358203 V 20
358303 B 12.9
358754 E NO DATA
360354 E NO DATA
361904 E NO DATA
362554 V 16
362654 B 12.9
363104 E NO DATA
364704 E NO DATA
366255 E NO DATA
366856 V 12
367006 B 12.9
367456 E NO DATA
369007 E NO DATA
370657 E NO DATA
371458 V -1
372104 B 12.9
372654 E NO DATA
374205 E NO DATA
375756 E NO DATA
376457 V 12
376607 B 12.9
377053 E NO DATA
378703 E NO DATA
380303 E NO DATA
380903 V 12
381003 B 12.9
381453 E NO DATA
383004 E NO DATA
384554 E NO DATA
385204 V 12
385304 B 12.9
385754 E NO DATA
387304 E NO DATA
388954 E NO DATA
389655 V 6
389755 B 12.9
390355 E NO DATA
392005 E NO DATA
393855 E NO DATA
394455 V 0
394555 B 12.5
395006 E NO DATA
396556 E NO DATA
398207 E NO DATA
398857 V 3
398957 B 12.9
399407 E NO DATA
401007 E NO DATA
402707 E NO DATA
403407 V 1
403657 B 12.8
404105 E NO DATA
405806 E NO DATA
407506 E NO DATA
408206 V -1
408806 B 12.9
409306 E NO DATA
410907 E NO DATA
412553 E NO DATA
413153 V 0
413303 B 12.9
+3
View File
@@ -0,0 +1,3 @@
# 12-OBD-Speed CAN log (t = ms since boot)
# C adapter, P protocol, V speed km/h, B battery V, M mark, F id data, N id (no frame), I survey IDs, E note
124606 E idle
+2
View File
@@ -0,0 +1,2 @@
# 12-OBD-Speed CAN log (t = ms since boot)
# C adapter, P protocol, V speed km/h, B battery V, M mark, F id data, N id (no frame), I survey IDs, E note
@@ -0,0 +1,3 @@
# 12-OBD-Speed CAN log (t = ms since boot)
# C adapter, P protocol, V speed km/h, B battery V, M mark, F id data, N id (no frame), I survey IDs, E note
121608 E idle
@@ -0,0 +1,2 @@
# 12-OBD-Speed CAN log (t = ms since boot)
# C adapter, P protocol, V speed km/h, B battery V, M mark, F id data, N id (no frame), I survey IDs, E note
@@ -0,0 +1,4 @@
# 12-OBD-Speed CAN log (t = ms since boot)
# C adapter, P protocol, V speed km/h, B battery V, M mark, F raw line, D module found, I module list,
# S addr did data (DID supported), R addr did nrc (negative response), E note
121608 E idle
+349
View File
@@ -0,0 +1,349 @@
# 12-OBD-Speed CAN log (t = ms since boot)
# C adapter, P protocol, V speed km/h, B battery V, M mark, F raw line, D module found, I module list,
# S addr did data (DID supported), R addr did nrc (negative response), E note
4558 C OBDII ELM327 v2.1
4658 P A6
5008 E count suffix yes, scan step 0, module 0, pos 0
5258 V 0
5358 B 13.0
6008 F NO DATA
6608 F 7E8064100BE3EA813
6608 E raw check: 1 lines
7107 M 1
7544 M 2
7757 V 0
7857 B 13.0
10158 V 0
10309 B 13.0
12257 V 0
12407 B 12.3
12811 E scan reset
13360 F NO DATA
13960 F 7E8064100BE3EA813
13960 E raw check: 1 lines
14458 V 0
14608 B 13.0
16758 V 0
16858 B 12.9
18909 V 0
19010 B 12.9
21010 V 0
21110 B 12.9
23460 V 0
23560 B 12.9
25660 V 0
25760 B 12.9
27906 V 0
28006 B 12.9
30156 V 0
30256 B 12.9
32457 V 0
32557 B 12.8
34708 V 0
34808 B 12.8
36908 V 0
37008 B 12.9
38859 V 0
41010 V 0
41110 B 12.9
43360 V 0
43460 B 12.8
45456 V 0
45556 B 12.9
47557 V 0
47657 B 12.8
49857 V 0
49957 B 12.9
52058 V 0
52158 B 12.9
54309 V 0
54409 B 12.9
56359 V 0
56509 B 12.9
58359 V 0
58459 B 12.9
60659 V 0
60759 B 12.8
63010 V 0
63110 B 12.9
64960 V 0
67210 V 0
67310 B 12.9
69255 V 0
69360 B 12.9
71610 V 0
71710 B 12.8
73906 V 0
74010 B 12.9
76260 V 0
76360 B 12.9
78556 V 0
78656 B 12.9
80907 V 0
81007 B 12.9
82958 V 0
83108 B 12.9
85208 V 0
85308 B 12.9
87458 V 0
87558 B 12.9
89459 V 0
89559 B 12.8
91709 V 0
91809 B 12.9
93960 V 0
94060 B 12.8
96206 V 0
96306 B 12.9
98506 V 0
98607 B 12.9
100457 V 0
102607 V 0
102707 B 12.8
104957 V 0
105057 B 12.9
107207 V 0
107307 B 12.9
109208 V 0
109308 B 12.9
111309 V 0
111410 B 12.9
113560 V 0
113660 B 12.9
115810 V 0
115910 B 12.9
118060 V 0
118160 B 12.9
120306 V 0
120406 B 12.8
122257 D 7E0 62F1884A3142312D3134433230342D414441000000000000000000
122657 V 0
122757 B 12.9
124908 V 0
125008 B 12.9
127158 V 0
127258 B 12.8
129408 V 0
129508 B 12.9
129509 I 7E0
130309 S 7E0 D002 1FFE
130510 S 7E0 D003 80000000
130960 S 7E0 D005 00000000
131161 S 7E0 D006 00000000
131560 V 0
131660 B 12.9
133756 V 0
133910 B 12.9
135806 V 0
135906 B 12.9
136507 S 7E0 D014 00000000
136707 S 7E0 D015 87F840F8
137906 V 0
138056 B 12.9
138607 S 7E0 D01A 22554E4B4E4F574E22000000000000000000000000000000
140007 V 0
140108 B 12.9
142158 V 0
142258 B 12.9
144108 V 0
146208 V 0
146308 B 12.9
148159 V 0
150208 V 0
150308 B 12.9
152308 V 0
152408 B 12.9
154458 V 0
154558 B 12.9
156608 V 0
156708 B 12.9
158809 V 0
158909 B 12.9
160958 V 0
161059 B 12.8
162909 V 0
164959 V 1
165059 B 12.9
167058 V 3
167159 B 12.8
169207 V 6
169307 B 12.8
171308 V 9
171409 B 12.8
173406 V 15
173506 B 12.9
175506 V 19
175606 B 12.9
177610 V 18
177710 B 12.9
179758 V 15
179858 B 13.0
181856 V 13
181956 B 12.9
183958 V 15
184058 B 12.9
186106 V 19
186207 B 12.9
188208 V 21
188308 B 12.9
190309 V 22
190410 B 12.9
192456 V 20
192557 B 13.0
194560 V 16
194660 B 12.9
196658 V 17
196758 B 12.9
198807 V 20
198907 B 12.9
200756 V 23
202957 V 23
203057 B 12.9
205059 V 20
205209 B 12.9
207058 V 12
208559 S 7E0 D100 01
209158 V 5
209258 B 12.9
211308 V 0
211408 B 12.9
213407 V 6
213507 B 12.9
215506 V 15
215606 B 12.9
217609 V 25
217709 B 12.9
219707 V 31
219807 B 12.9
220610 S 7E0 D127 140E
221807 V 31
221908 B 12.9
223906 V 29
224006 B 12.9
224609 S 7E0 D134 00
225211 S 7E0 D137 00
226008 V 26
226109 B 12.9
228106 V 23
228207 B 12.9
230208 V 24
230309 B 12.9
232306 V 22
232406 B 12.9
234409 V 24
234510 B 12.9
236507 V 27
236608 B 12.9
238609 V 24
238710 B 12.9
240707 V 23
240807 B 12.9
242806 V 30
242907 B 13.0
244909 V 30
245009 B 13.0
247006 V 36
247107 B 12.9
249156 V 40
249256 B 12.9
251257 V 43
251357 B 12.9
253357 V 44
253457 B 12.9
255459 V 45
255560 B 12.9
256882 M 3
257560 V 46
257660 B 12.9
259658 V 46
259758 B 13.0
261760 V 44
261860 B 13.0
263857 V 42
263957 B 13.0
265959 V 39
266060 B 12.9
268056 V 37
268157 B 13.0
270159 V 35
270259 B 12.9
272306 V 31
272407 B 13.0
274309 V 22
274409 B 13.0
276408 V 20
276508 B 12.9
278556 V 24
278656 B 12.9
280707 V 23
280807 B 13.0
282808 V 24
282908 B 13.0
284906 V 25
285057 B 13.0
287059 V 22
287209 B 13.0
289207 V 19
289308 B 13.0
291309 V 18
291410 B 12.9
293406 V 18
293507 B 12.9
295607 V 16
295708 B 13.0
297559 V 12
299556 V 12
299656 B 12.9
301658 V 11
301758 B 12.9
303806 V 8
303906 B 12.9
305908 V 14
306008 B 12.9
308009 V 16
308109 B 13.0
310107 V 21
310207 B 12.9
312208 V 24
312308 B 13.0
314209 V 17
314359 B 13.0
316357 V 12
316457 B 12.9
318558 V 11
318658 B 12.9
320459 V 10
322657 V 11
322758 B 12.9
324758 V 10
324858 B 12.9
326856 V 9
326956 B 12.9
329009 V 8
329109 B 13.0
331107 V 7
331208 B 13.0
333206 V 9
333356 B 13.0
335457 V 6
335557 B 13.0
337356 V 4
339407 V 0
339507 B 13.0
341406 V 0
343609 V 2
343710 B 12.9
345707 V 2
345807 B 13.0
347857 V 2
347957 B 13.0
349957 V 2
350057 B 12.9
352109 V 1
352210 B 12.2
354258 V 1
354359 B 13.0
356457 V 0
356557 B 12.9
358358 V -1
358959 B 11.9
+202
View File
@@ -0,0 +1,202 @@
# 12-OBD-Speed CAN log (t = ms since boot)
# C adapter, P protocol, V speed km/h, B battery V, M mark, F raw line, D module found, I module list,
# S addr did data (DID supported), R addr did nrc (negative response), E note
3810 C OBDII ELM327 v2.1
3910 P A6
4210 E count suffix yes, scan step 2, module 0, pos 704
4410 V 0
4510 B 12.5
6710 V 0
6810 B 11.2
8859 V 3
8959 B 12.8
11061 V 4
11162 B 13.0
13010 V 3
15208 V 2
15308 B 12.9
17311 V 3
17412 B 13.0
19410 V 6
19510 B 13.0
21508 V 6
21608 B 12.9
23561 V 8
23661 B 12.9
25658 V 9
25758 B 12.9
27758 V 12
27859 B 13.0
29858 V 15
29958 B 13.0
31960 V 17
32060 B 12.9
34060 V 16
34161 B 13.0
36158 V 16
36258 B 12.9
38261 V 21
38362 B 12.9
40361 V 23
40462 B 12.9
42460 V 20
42560 B 12.9
44610 V 17
44711 B 13.0
46661 V 7
46761 B 12.9
48809 V 6
48909 B 12.9
50961 V 5
51061 B 12.9
53111 V 1
53211 B 12.9
55211 V 14
55312 B 12.9
57308 V 24
57408 B 12.9
59411 V 31
59511 B 12.9
61508 V 33
61609 B 12.9
63027 M 1
63610 V 32
63710 B 12.9
65709 V 28
65809 B 12.9
67811 V 28
67912 B 12.9
69958 V 26
70058 B 12.9
72061 V 15
72161 B 12.9
74208 V 10
74309 B 13.0
76310 V 15
76410 B 12.9
78408 V 20
78509 B 12.9
80510 V 21
80610 B 12.9
82610 V 25
82711 B 13.0
84708 V 31
84809 B 12.9
86809 V 31
86909 B 12.9
88908 V 32
89008 B 13.0
91011 V 36
91111 B 12.9
93110 V 41
93210 B 12.9
93839 M 2
94467 M 3
95259 V 41
95359 B 12.9
95389 M 4
97508 V 41
97659 B 12.9
99508 V 41
99608 B 12.9
101609 V 44
101709 B 12.9
101748 M 5
103758 V 47
103859 B 12.9
105858 V 46
105958 B 12.9
107959 V 46
108060 B 12.9
110059 V 42
110159 B 13.0
112160 V 38
112261 B 12.9
114358 V 34
114458 B 13.0
116510 V 27
116611 B 12.9
118661 V 24
118761 B 12.9
120759 V 25
120860 B 12.9
122860 V 23
122960 B 12.9
124958 V 25
125059 B 12.9
127061 V 30
127162 B 12.9
129158 V 33
129309 B 12.9
131211 V 27
131311 B 12.9
133308 V 19
133409 B 12.9
135410 V 14
135510 B 13.0
137511 V 16
137611 B 12.9
139610 V 26
139711 B 12.9
141710 V 25
141812 B 12.9
143959 V 22
144059 B 12.9
145961 V 16
146061 B 13.0
148058 V 13
148159 B 12.9
150159 V 17
150259 B 12.9
152260 V 23
152361 B 12.9
154361 V 25
154461 B 12.9
156608 V 21
156708 B 12.9
158658 V 18
158758 B 13.0
160560 V 15
162758 V 18
162859 B 12.9
164908 V 23
165008 B 12.9
167010 V 23
167110 B 12.9
169161 V 20
169261 B 13.0
171261 V 17
171361 B 13.0
173360 V 13
173460 B 13.0
175509 V 8
175610 B 13.0
177660 V 3
177761 B 13.0
179808 V 0
179909 B 13.0
181759 V 1
183958 V 2
184058 B 13.0
186061 V 3
186161 B 12.9
188211 V 2
188311 B 13.0
190361 V 0
190461 B 12.9
192458 V 2
192559 B 12.9
194608 V 0
194708 B 13.0
196560 V 2
198661 V 2
198761 B 13.0
200809 V 1
200910 B 12.9
202861 V 0
202961 B 13.0
204961 V 0
205061 B 13.0
207109 V -1
207710 B 11.9
209061 V -1
@@ -0,0 +1,4 @@
# 12-OBD-Speed CAN log (t = ms since boot)
# C adapter, P protocol, V speed km/h, B battery V, M mark, F raw line, D module found, I module list,
# S addr did data (DID supported), R addr did nrc (negative response), E note
121608 E idle
@@ -0,0 +1,4 @@
# 12-OBD-Speed CAN log (t = ms since boot)
# C adapter, P protocol, V speed km/h, B battery V, M mark, F raw line, D module found, I module list,
# S addr did data (DID supported), R addr did nrc (negative response), E note
121613 E idle
@@ -0,0 +1,4 @@
# 12-OBD-Speed CAN log (t = ms since boot)
# C adapter, P protocol, V speed km/h, B battery V, M mark, F raw line, D module found, I module list,
# S addr did data (DID supported), R addr did nrc (negative response), E note
121608 E idle
+248
View File
@@ -0,0 +1,248 @@
# 12-OBD-Speed CAN log (t = ms since boot)
# C adapter, P protocol, V speed km/h, B battery V, M mark, F raw line, D module found, I module list,
# S addr did data (DID supported), R addr did nrc (negative response), E note
3826 C OBDII ELM327 v2.1
3856 P A6
4036 E count suffix yes, scan step 2, module 0, pos 1344
4186 V 0
4216 B 12.9
6315 V 0
6345 B 12.9
8415 V 0
8445 B 12.9
10604 V 0
10634 B 12.9
12676 V 0
12706 B 12.9
14744 V 0
14774 B 12.9
16847 V 0
16877 B 12.9
19038 V 0
19068 B 12.9
21168 V 0
21198 B 12.9
23234 V 0
23264 B 12.9
25334 V 0
25364 B 12.9
27404 V 0
27434 B 12.9
29445 V 0
29475 B 12.9
31517 V 0
31547 B 12.9
33587 V 0
33617 B 12.9
35628 V 1
35658 B 12.9
37664 V 1
37694 B 12.9
39675 V 1
39705 B 12.9
41716 V 2
41746 B 12.9
43757 V 3
43787 B 12.9
45797 V 4
45827 B 12.9
47897 V 4
47927 B 12.9
50027 V 7
50057 B 12.9
50253 I probe, 0 new: 7E0
51811 E multi-DID 7E0: no (?TIMEOUT)
52201 V 11
52231 B 12.9
54167 V 17
56267 V 19
56297 B 12.9
58397 V 19
58427 B 12.9
60497 V 16
60527 B 12.9
62657 V 13
62687 B 12.9
64666 V 12
64711 B 12.9
66767 V 13
66797 B 12.9
68867 V 17
68927 B 12.9
70877 V 20
70907 B 12.9
73008 V 19
73038 B 12.9
75108 V 18
75138 B 12.9
77208 V 16
77238 B 12.9
79308 V 9
79338 B 12.9
81378 V 13
81408 B 12.9
83508 V 15
83538 B 12.9
85634 V 20
85664 B 12.9
86178 E progress 7E0 D5FF pos 1536, 11 found, 160 ms/DID
87768 V 23
87798 B 12.9
89864 V 22
89894 B 13.0
91965 V 17
91995 B 12.9
94066 V 7
94096 B 12.9
96166 V 5
96196 B 12.9
98266 V 0
98296 B 12.9
100366 V 0
100396 B 12.9
102466 V 1
102496 B 13.0
104567 V 0
104597 B 13.0
106667 V 2
106697 B 12.9
108766 V 11
108796 B 12.9
110867 V 21
110897 B 12.8
112922 V 29
112952 B 12.9
114992 V 35
115022 B 12.9
117017 V 33
117047 B 12.9
119133 V 28
119163 B 12.9
121218 V 25
121248 B 12.9
123315 V 25
123345 B 12.9
125415 V 23
125445 B 13.2
127516 V 24
127546 B 13.0
129617 V 31
129647 B 12.9
131717 V 37
131747 B 12.9
133817 V 40
133847 B 12.9
135918 V 43
135948 B 12.9
138014 V 42
138044 B 12.9
140115 V 42
140145 B 12.9
142216 V 42
142246 B 13.0
144316 V 41
144346 B 12.9
146416 V 41
146446 B 12.9
148517 V 43
148547 B 12.9
150618 V 43
150648 B 12.9
152714 V 41
152744 B 12.9
154844 V 39
154874 B 12.9
156945 V 41
156990 B 12.9
159075 V 44
159105 B 13.0
161176 V 43
161206 B 12.9
163277 V 38
163307 B 12.9
165377 V 35
165407 B 12.9
167478 V 29
167508 B 12.9
169578 V 31
169608 B 12.9
171674 V 35
171704 B 13.0
173775 V 33
173805 B 13.0
175875 V 27
175905 B 12.9
176270 E progress 7E0 D7FF pos 2048, 11 found, 175 ms/DID
177975 V 15
178005 B 13.1
180076 V 8
180106 B 13.0
182178 V 9
182208 B 12.9
184289 V 11
184319 B 12.9
186374 V 19
186404 B 12.9
188474 V 19
188504 B 12.9
190575 V 17
190605 B 12.9
192676 V 16
192706 B 12.9
194777 V 18
194807 B 12.9
196878 V 16
196908 B 13.2
198978 V 13
199008 B 13.2
201074 V 11
201104 B 12.9
203175 V 10
203205 B 12.9
205276 V 14
205306 B 12.9
207378 V 14
207408 B 12.9
209478 V 11
209508 B 13.0
211578 V 8
211608 B 12.9
213674 V 9
213704 B 13.1
215775 V 7
215805 B 13.0
217875 V 4
217905 B 12.9
219976 V 3
220006 B 13.0
222076 V 2
222106 B 12.9
224177 V 0
224207 B 12.9
226278 V 1
226308 B 12.9
228374 V 2
228404 B 13.0
230475 V 1
230505 B 13.0
232575 V 2
232605 B 13.1
234676 V 1
234706 B 13.3
236777 V 1
236807 B 12.9
238878 V 1
238908 B 12.9
240978 V 1
241008 B 12.9
243078 V 0
243108 B 12.5
243618 S 7E0 D980 ADFF9E80
245174 V 0
245204 B 12.9
247275 V 0
247305 B 13.0
249375 V 0
249405 B 13.0
251476 V 0
251506 B 13.3
+345
View File
@@ -0,0 +1,345 @@
# 12-OBD-Speed CAN log (t = ms since boot)
# C adapter, P protocol, V speed km/h, B battery V, M mark, F raw line, D module found, I module list,
# S addr did data (DID supported), R addr did nrc (negative response), E note
3266 C OBDII ELM327 v2.1
3296 P A6
3476 E count suffix yes, scan step 2, module 0, pos 2496
3627 V 0
3657 B 12.0
5218 E multi-DID 7E0: no (?TIMEOUT)
5728 V 0
5758 B 12.7
7824 V 0
7854 B 12.9
9911 V 0
9941 B 12.9
12012 V 0
12042 B 13.0
14113 V 0
14143 B 13.0
16239 V 0
16269 B 13.0
16634 E progress 7E0 D9FF pos 2560, 12 found, 25 ms/DID
18339 V 0
18369 B 13.0
20485 V 0
20515 B 12.9
22586 V 0
22616 B 12.9
24687 V 0
24717 B 12.9
26788 V 0
26818 B 13.0
28888 V 0
28918 B 12.9
30969 V 0
30999 B 12.9
33070 V 0
33100 B 12.9
35171 V 0
35201 B 13.0
37287 V 1
37317 B 12.9
39387 V 0
39417 B 12.9
41488 V 0
41518 B 12.9
43584 V 0
43614 B 12.9
45670 V 1
45700 B 12.8
47846 V 3
47876 B 12.9
49917 V 4
49947 B 12.8
52001 V 4
52031 B 13.0
54146 V 6
54176 B 12.9
56247 V 4
56277 B 12.9
58257 V 5
58287 B 12.9
60357 V 8
60387 B 12.9
62456 V 10
62486 B 12.9
64586 V 9
64616 B 12.9
66672 V 9
66702 B 12.9
68773 V 12
68803 B 12.9
70884 V 11
70914 B 12.9
72984 V 15
73014 B 12.9
75115 V 19
75145 B 12.9
77095 V 22
79195 V 20
79225 B 12.9
81295 V 17
81325 B 12.9
83395 V 15
83425 B 12.9
85494 V 12
85524 B 12.9
87594 V 10
87624 B 12.9
89694 V 7
89724 B 12.9
91794 V 5
91824 B 12.9
93924 V 8
93954 B 12.9
96084 V 14
96134 B 12.9
98095 V 21
98125 B 12.9
100195 V 26
100225 B 12.9
102295 V 29
102325 B 12.9
104395 V 29
104425 B 12.9
106259 E progress 7E0 DBFF pos 3072, 12 found, 175 ms/DID
106464 V 25
106494 B 12.9
108565 V 23
108595 B 12.9
110697 V 27
110727 B 12.9
112677 V 32
114747 V 37
114777 B 13.0
116847 V 37
116877 B 13.1
118946 V 38
118976 B 12.8
121046 V 38
121076 B 12.9
123146 V 37
123176 B 12.9
125261 V 37
125291 B 12.9
127347 V 39
127377 B 12.8
129446 V 40
129476 B 12.9
131546 V 38
131576 B 12.9
133646 V 38
133676 B 13.1
135746 V 36
135776 B 13.1
137846 V 36
137876 B 12.9
139946 V 37
139976 B 12.8
142045 V 37
142075 B 12.9
144145 V 37
144175 B 12.9
146275 V 35
146305 B 12.9
148377 V 32
148407 B 12.9
150478 V 28
150508 B 13.0
151617 S 7E0 DD00 A427F506
151768 S 7E0 DD01 021676
152574 V 23
152604 B 13.1
154675 V 20
154705 B 12.9
156776 V 23
156806 B 12.8
158877 V 23
158907 B 12.9
161008 V 22
161038 B 12.9
163104 V 22
163134 B 12.8
165204 V 27
165234 B 12.9
167305 V 30
167335 B 12.9
169406 V 27
169436 B 13.0
171506 V 19
171536 B 12.9
173606 V 12
173636 B 12.9
175706 V 15
175736 B 12.9
177807 V 10
177837 B 12.9
179907 V 9
179937 B 12.9
182007 V 10
182037 B 12.9
184107 V 11
184137 B 12.9
186206 V 14
186236 B 12.9
188307 V 14
188352 B 12.9
190407 V 12
190437 B 12.9
192508 V 13
192538 B 12.9
194604 V 12
194634 B 12.9
196198 E progress 7E0 DDFF pos 3584, 14 found, 175 ms/DID
197249 S 7E0 DE00 FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF2AFFFFFFFFFFFFFFFFFFFFFFFF0FFF2FFFFF2F0FF2FFFFFFFF2FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF10FFFFFFFFFFFFFF11FFFFFFFFFFFFFF12FFFFFFFFFFFFFF13FFFFFFFFFFFFFF14FFFFFFFFFFFFFF15FF0A59FFFFFFFF16FFFFFFFFFFFFFF17FFFFFFFFFFFFFF18FFFF7797FFFF00
197454 V 10
197484 B 12.9
198596 S 7E0 DE01 0707030302090E131717F4EDF1F4F8FA0107090802EEEEECF3F4F8FDFE011F180F070509090C100FF7F0EFF2F3F5F6F8F9F90403FAFAFBFBFF04070711371E22174810364250203730301130204D422020201220203431323541133137333132313114303534342020201520202031373330163445303032320017F5240901239802180106030053C200
199497 S 7E0 DE02 9EFF7F3FD11A803FC0CA7F3F0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000000000000110000000000000012FE7F0100010100130000000000000014303534342020201520202031373330163445303032320017F5240901239802180106030053C200
199707 V 12
199737 B 12.9
201808 V 12
201838 B 12.9
203904 V 14
203934 B 13.1
206004 V 20
206034 B 13.1
208105 V 18
208135 B 12.9
210206 V 16
210236 B 12.9
212307 V 15
212337 B 12.9
214407 V 13
214437 B 12.9
216507 V 12
216537 B 12.9
218608 V 10
218638 B 12.9
220708 V 13
220738 B 13.1
222807 V 14
222837 B 13.1
224907 V 14
224937 B 12.8
227007 V 15
227037 B 12.8
229108 V 14
229138 B 12.8
230545 S 7E0 DEAC 0100010173E8414C180001D54A000075300D92910B0087FA0C4C8596824C0001A2AD00013DE40C60D24C09D9937F00001231409D054800001F4000001231000000B210B48BE445E302BE11428171B242409D12054819B4A746011300000000000000140045BD7246C20D15E6460000000000160000000000000017000000000000001800000000000000190000000000000020000000000000002100000000000000
231205 V 12
231235 B 12.8
233306 V 11
233336 B 12.9
235407 V 5
235437 B 12.8
237507 V 0
237537 B 12.9
239608 V 4
239638 B 12.8
241708 V 7
241738 B 12.9
243808 V 7
243838 B 12.9
245904 V 3
245934 B 12.8
248004 V 0
248034 B 12.8
250105 V 0
250135 B 12.8
252206 V 0
252236 B 12.8
254307 V 0
254337 B 12.8
256406 V 0
256436 B 13.0
258506 V 1
258536 B 12.8
260607 V 2
260637 B 12.9
262708 V 3
262738 B 12.9
264808 V 4
264838 B 12.8
266905 V 5
266935 B 12.8
269005 V 6
269035 B 12.8
271105 V 6
271135 B 12.8
273206 V 6
273236 B 13.1
275307 V 6
275337 B 13.1
277407 V 6
277437 B 12.9
279521 V 6
279551 B 12.9
281606 V 6
281636 B 12.7
283706 V 6
283736 B 12.8
285807 V 6
285837 B 12.8
287907 V 5
287937 B 12.8
289801 E progress 7E0 DFFF pos 4096, 18 found, 182 ms/DID
290007 V 4
290037 B 12.7
292108 V 4
292138 B 13.0
294208 V 3
294238 B 13.1
296308 V 1
296338 B 12.9
298405 V 1
298435 B 12.8
300506 V 0
300536 B 12.9
302606 V 0
302636 B 12.9
304707 V 0
304737 B 12.9
306808 V 0
306838 B 12.9
308905 V 0
308935 B 13.0
311005 V 0
311035 B 13.1
313104 V 0
313134 B 12.9
315205 V 0
315235 B 12.8
317306 V 0
317336 B 12.8
319407 V 0
319437 B 12.9
321507 V 0
321537 B 12.8
323607 V 0
323637 B 12.8
325708 V 0
325738 B 12.9
327804 V 0
327834 B 13.1
329905 V 0
329935 B 13.1
332005 V 0
332035 B 12.9
334105 V 0
334135 B 12.9
336204 V 0
336234 B 12.9
338304 V 0
338349 B 12.8
340434 V 0
340464 B 12.9
342534 V 0
342564 B 12.8
344634 V 0
344664 B 13.0
346738 V 0
346768 B 13.1
348838 V 0
348868 B 12.8
+352
View File
@@ -0,0 +1,352 @@
# 12-OBD-Speed CAN log (t = ms since boot)
# C adapter, P protocol, V speed km/h, B battery V, M mark, F raw line, D module found, I module list,
# S addr did data (DID supported), R addr did nrc (negative response), E note
3221 C OBDII ELM327 v2.1
3251 P A6
3431 E count suffix yes, scan step 2, module 0, pos 4416
3581 V 0
3612 B 12.1
5177 E multi-DID 7E0: no (?TIMEOUT)
5694 V 0
5724 B 12.9
7797 V 0
7827 B 12.9
9898 V 0
9928 B 13.0
11979 V 0
12009 B 12.9
14080 V 0
14110 B 13.0
16196 V 0
16226 B 12.9
18296 V 0
18326 B 12.9
20411 V 1
20441 B 12.9
22511 V 4
22541 B 13.0
24626 V 6
24656 B 12.9
26756 V 12
26786 B 12.9
28856 V 14
28886 B 12.9
30957 V 12
30987 B 12.9
33088 V 13
33118 B 12.9
35169 V 15
35199 B 12.9
37270 V 20
37300 B 13.0
38879 E progress 7E0 41FF pos 4608, 18 found, 69 ms/DID
39369 V 20
39399 B 12.9
41485 V 18
41515 B 12.9
43585 V 16
43615 B 12.9
45685 V 13
45715 B 12.8
47770 V 15
47800 B 13.0
49840 V 19
49870 B 12.9
51864 V 25
51894 B 12.9
53889 V 25
53919 B 13.0
55989 V 23
56019 B 13.0
58104 V 14
58134 B 12.9
60204 V 6
60234 B 12.9
62338 V 8
62368 B 12.9
64438 V 17
64468 B 12.9
66534 V 25
66564 B 12.9
68635 V 31
68665 B 12.9
70736 V 31
70766 B 12.9
72791 V 30
72821 B 13.0
74892 V 26
74922 B 13.1
77008 V 26
77038 B 12.9
79164 V 25
79194 B 12.9
81265 V 25
81295 B 12.9
83365 V 29
83395 B 12.9
85464 V 34
85494 B 12.9
87564 V 38
87594 B 12.9
89664 V 41
89694 B 12.9
91749 V 44
91779 B 13.0
93864 V 46
93894 B 12.9
95968 V 45
95998 B 12.9
98068 V 44
98098 B 12.8
100168 V 44
100198 B 12.9
102283 V 44
102313 B 12.9
104424 V 43
104454 B 12.9
106588 V 41
106618 B 12.9
108564 V 39
110619 V 38
110649 B 13.1
112735 V 38
112765 B 12.9
114866 V 35
114896 B 12.9
116996 V 25
117026 B 12.9
119097 V 12
119127 B 12.9
121198 V 8
121228 B 12.9
123298 V 6
123328 B 13.0
125394 V 9
125424 B 12.9
127495 V 13
127525 B 12.9
128490 E progress 7E0 43FF pos 5120, 18 found, 175 ms/DID
129596 V 16
129626 B 12.9
131697 V 15
131727 B 12.9
133828 V 13
133858 B 12.9
135924 V 14
135954 B 12.9
138025 V 13
138055 B 12.9
140124 V 15
140154 B 12.9
142225 V 16
142255 B 12.9
144326 V 14
144356 B 12.9
146397 V 12
146427 B 12.9
148498 V 11
148528 B 12.9
150594 V 6
150624 B 12.9
152694 V 7
152724 B 12.9
154796 V 9
154826 B 12.9
156926 V 18
156956 B 12.9
159026 V 19
159056 B 12.9
161127 V 14
161157 B 12.9
163226 V 9
163256 B 12.9
165326 V 9
165356 B 12.9
167426 V 11
167456 B 12.9
169526 V 11
169556 B 12.9
171626 V 9
171656 B 12.9
173725 V 13
173755 B 12.9
175856 V 13
175886 B 12.9
177987 V 11
178017 B 12.9
180087 V 9
180117 B 12.9
182188 V 9
182218 B 12.9
184284 V 9
184314 B 12.9
186384 V 11
186414 B 12.9
188485 V 9
188515 B 12.9
190615 V 6
190645 B 12.9
192715 V 6
192745 B 12.9
194815 V 7
194845 B 12.9
196914 V 6
196944 B 12.9
199014 V 8
199044 B 12.9
201114 V 10
201144 B 12.9
203214 V 9
203244 B 12.9
205314 V 11
205344 B 12.9
207414 V 10
207444 B 12.9
209514 V 9
209544 B 12.9
211614 V 8
211644 B 12.9
213714 V 11
213744 B 12.9
215814 V 12
215844 B 12.9
217915 V 11
217945 B 12.9
218309 E progress 7E0 45FF pos 5632, 18 found, 175 ms/DID
220014 V 10
220044 B 12.9
222114 V 8
222144 B 12.9
224214 V 6
224244 B 12.9
226314 V 4
226344 B 12.9
228415 V 3
228445 B 13.0
230514 V 2
230544 B 12.9
232614 V 4
232644 B 12.9
234714 V 2
234744 B 13.0
236814 V 1
236844 B 12.9
238944 V 1
238974 B 13.0
241044 V 0
241074 B 13.0
243145 V 0
243175 B 13.0
245246 V 0
245276 B 13.1
247347 V 1
247377 B 12.9
249477 V 0
249507 B 12.9
251577 V 4
251607 B 12.9
253618 V 5
253648 B 12.8
255718 V 5
255748 B 12.9
257818 V 4
257848 B 12.9
259918 V 3
259948 B 12.9
262018 V 2
262048 B 13.1
264117 V 2
264162 B 13.1
266218 V 1
266248 B 12.9
268318 V 0
268348 B 12.9
270418 V 1
270448 B 12.9
272518 V 1
272548 B 12.8
274617 V 1
274647 B 12.9
276717 V 1
276747 B 12.9
278817 V 0
278847 B 13.0
280917 V 0
280947 B 13.0
283017 V 0
283047 B 12.9
285118 V 1
285148 B 12.9
287217 V 1
287247 B 12.9
289317 V 0
289347 B 12.3
291417 V 0
291447 B 12.9
293517 V 1
293547 B 12.8
295618 V 0
295648 B 12.8
297717 V 0
297747 B 12.8
299817 V 0
299847 B 13.0
301917 V 1
301947 B 12.9
304017 V 1
304047 B 12.9
306118 V 0
306148 B 12.2
307862 E progress 7E0 47FF pos 6144, 18 found, 174 ms/DID
308218 V 0
308248 B 12.9
310318 V 0
310348 B 12.9
312418 V 0
312448 B 12.9
314518 V 0
314548 B 12.9
316618 V 0
316648 B 12.8
318718 V 0
318748 B 12.1
320817 V 1
320847 B 12.9
322917 V 2
322947 B 12.9
325017 V 0
325047 B 12.8
327118 V 0
327148 B 12.9
329218 V 1
329248 B 12.8
331317 V 0
331347 B 13.0
333417 V 7
333447 B 13.1
335517 V 8
335547 B 12.8
337618 V 9
337648 B 12.9
339718 V 6
339748 B 12.8
341817 V 3
341847 B 12.9
343917 V 1
343947 B 12.8
346017 V 0
346047 B 12.7
348118 V 3
348148 B 12.9
350218 V 2
350248 B 12.9
352318 V 2
352348 B 12.8
354417 V 2
354462 B 12.9
356518 V 1
356548 B 12.8
358618 V 0
358648 B 12.9
360714 V 0
360744 B 12.9
File diff suppressed because it is too large. Load diff
+698
View File
@@ -0,0 +1,698 @@
# 12-OBD-Speed CAN log (t = ms since boot)
# C adapter, P protocol, V speed km/h, B battery V, M mark, F raw line, D module found, I module list,
# S addr did data (DID supported), R addr did nrc (negative response), E note
3701 C OBDII ELM327 v2.1
3731 P A6
3911 E count suffix yes, scan step 2, module 0, pos 14976
4061 V 0
4091 B 12.1
5652 E multi-DID 7E0: no (?TIMEOUT)
6162 V 0
6222 B 13.0
8291 V 0
8321 B 13.0
10392 V 0
10422 B 12.8
12493 V 0
12523 B 12.8
14590 V 0
14636 B 12.8
15638 M 1
16691 V 0
16721 B 12.8
18839 V 0
18869 B 12.8
20832 V 0
22903 V 0
22933 B 12.9
25032 V 0
25062 B 13.0
27146 V 0
27266 B 12.7
29171 V 0
29201 B 12.7
31274 V 0
31304 B 12.8
33374 V 0
33404 B 12.7
35473 V 0
35503 B 12.8
37572 V 0
37602 B 12.8
39671 V 0
39701 B 12.8
41771 V 0
41801 B 12.8
43871 V 0
43901 B 12.9
45971 V 0
46001 B 12.8
48073 V 0
48103 B 12.7
50171 V 0
50201 B 12.7
52273 V 0
52303 B 12.8
54371 V 0
54401 B 12.8
56471 V 0
56501 B 12.8
58570 V 0
58600 B 12.8
60671 V 0
60701 B 12.8
62770 V 0
62800 B 12.8
64870 V 0
64900 B 12.8
66970 V 0
67000 B 12.8
69072 V 0
69102 B 12.8
71170 V 0
71200 B 12.8
73064 E progress 7E0 1BFF pos 15360, 203 found, 135 ms/DID
73274 V 0
73304 B 12.8
75373 V 0
75403 B 12.8
77472 V 0
77502 B 12.8
79572 V 0
79602 B 12.9
81674 V 0
81700 B 12.8
83802 V 0
83847 B 12.8
85781 V 0
87851 V 0
87881 B 12.8
89950 V 0
89980 B 12.8
92052 V 0
92082 B 12.8
94152 V 0
94182 B 12.9
96252 V 0
96282 B 12.8
98350 V 0
98380 B 12.8
100453 V 0
100483 B 12.8
102554 V 0
102584 B 12.8
104654 V 0
104684 B 12.7
106753 V 0
106783 B 12.8
108850 V 0
108880 B 12.8
110950 V 0
110980 B 12.8
113053 V 0
113083 B 12.8
115154 V 0
115184 B 12.8
117254 V 0
117284 B 12.8
119351 V 0
119381 B 12.8
121450 V 0
121480 B 12.8
123552 V 0
123582 B 12.8
125652 V 0
125682 B 12.3
127752 V 0
127782 B 12.8
129850 V 0
129880 B 12.8
131950 V 0
131980 B 12.5
134050 V 0
134080 B 12.7
136150 V 0
136180 B 12.8
138250 V 0
138280 B 12.2
140354 V 0
140384 B 12.9
142452 V 0
142482 B 12.8
144552 V 0
144582 B 12.8
146652 V 0
146682 B 12.8
148753 V 0
148783 B 12.8
150852 V 0
150882 B 12.8
152952 V 0
152982 B 12.7
155053 V 0
155083 B 12.8
157154 V 0
157184 B 12.8
159251 V 0
159281 B 12.5
161350 V 0
161380 B 12.8
162796 E progress 7E0 1DFF pos 15872, 203 found, 175 ms/DID
163092 S 7E0 1E01 00000000
163452 V 0
163482 B 12.8
163843 S 7E0 1E04 0A000000
164590 S 7E0 1E09 8000
164741 S 7E0 1E0A 0037
165042 S 7E0 1E0C 00
165193 S 7E0 1E0D 00
165344 S 7E0 1E0E 00
165550 V 0
165580 B 12.5
165792 S 7E0 1E0F 00
165943 S 7E0 1E10 00
166094 S 7E0 1E11 0283
166240 S 7E0 1E12 01
166390 S 7E0 1E13 0E78
166541 S 7E0 1E14 0066
166692 S 7E0 1E15 0F7C
166842 S 7E0 1E16 5000
166993 S 7E0 1E17 00
167143 S 7E0 1E18 00030000
167294 S 7E0 1E19 4958
167440 S 7E0 1E1A 0158
167651 V 0
167681 B 12.8
167892 S 7E0 1E1B 0000
168043 S 7E0 1E1C 029E
168193 S 7E0 1E1D 0898
169090 S 7E0 1E23 46
169751 V 0
169781 B 12.8
170142 S 7E0 1E28 00
170293 S 7E0 1E29 0000
170444 S 7E0 1E2A 0000
170590 S 7E0 1E2B 0000
170892 S 7E0 1E2D 0000
171043 S 7E0 1E2E 00
171850 V 0
171880 B 12.8
172091 S 7E0 1E33 0000
172392 S 7E0 1E35 0FF0
172543 S 7E0 1E36 0011
172694 S 7E0 1E37 0000
172991 S 7E0 1E39 80038E30
173142 S 7E0 1E3A 0067
173444 S 7E0 1E3C 0000
173590 S 7E0 1E3D 1902
173951 V 0
173981 B 12.8
175243 S 7E0 1E46 00
176051 V 0
176081 B 12.8
176591 S 7E0 1E4D 4088
177494 S 7E0 1E53 0033
177640 S 7E0 1E54 02EF
177791 S 7E0 1E55 0033
177957 S 7E0 1E56 0210
178182 V 0
178212 B 12.7
178722 S 7E0 1E59 0033
179473 S 7E0 1E5E 13
179774 S 7E0 1E60 00
180280 V 0
180310 B 12.8
182380 V 0
182410 B 12.8
184480 V 0
184510 B 12.7
186582 V 0
186612 B 12.7
188680 V 0
188710 B 12.8
190784 V 0
190814 B 12.8
192880 V 0
192910 B 12.8
194981 V 0
195011 B 12.8
197081 V 0
197111 B 12.8
199184 V 0
199214 B 12.8
201283 V 0
201313 B 12.8
203382 V 0
203412 B 12.8
205482 V 0
205512 B 12.8
206473 S 7E0 1EF8 0969
206624 S 7E0 1EF9 5F75
206774 S 7E0 1EFA 1E00
207581 V 0
207611 B 12.8
209681 V 0
209711 B 12.8
211797 V 0
211827 B 12.8
213882 V 0
213912 B 12.8
215983 V 0
216013 B 12.8
218083 V 0
218113 B 12.8
220181 V 0
220211 B 12.8
222280 V 0
222310 B 12.8
224382 V 0
224412 B 12.8
226480 V 0
226510 B 12.8
228584 V 0
228614 B 12.8
230680 V 0
230710 B 12.8
232783 V 0
232813 B 12.8
234880 V 0
234910 B 12.8
236982 V 0
237012 B 12.8
239083 V 0
239113 B 12.8
241181 V 0
241211 B 12.8
243281 V 0
243311 B 12.8
245381 V 0
245411 B 12.8
247480 V 0
247510 B 12.8
249584 V 0
249614 B 12.8
251684 V 0
251714 B 12.8
252524 E progress 7E0 1FFF pos 16384, 252 found, 175 ms/DID
253780 V 0
253810 B 12.8
255884 V 0
255914 B 12.8
257984 V 0
258014 B 12.8
259572 S 7E0 2028 2BE5
259723 S 7E0 2029 03FF
260084 V 0
260114 B 12.8
262181 V 0
262211 B 12.8
264280 V 0
264310 B 12.8
266381 V 0
266411 B 12.8
268482 V 0
268512 B 12.8
270583 V 0
270613 B 12.8
272681 V 0
272711 B 12.8
274781 V 0
274811 B 12.8
276884 V 0
276914 B 12.8
278983 V 0
279013 B 12.8
281082 V 0
281112 B 12.8
283184 V 0
283214 B 12.8
285280 V 0
285310 B 12.8
287382 V 0
287412 B 12.8
289483 V 0
289513 B 12.8
291584 V 0
291614 B 12.8
293680 V 0
293710 B 12.8
295780 V 0
295810 B 12.8
297880 V 0
297910 B 12.8
299984 V 0
300014 B 12.8
302083 V 0
302113 B 12.8
304182 V 0
304212 B 12.8
306280 V 0
306310 B 12.9
308381 V 0
308411 B 12.8
310480 V 0
310510 B 12.8
312583 V 0
312613 B 12.8
314683 V 0
314713 B 12.8
316782 V 0
316813 B 12.8
318883 V 0
318913 B 12.8
320981 V 0
321011 B 12.8
323081 V 0
323111 B 12.8
325182 V 0
325212 B 12.8
327282 V 0
327312 B 12.4
329382 V 0
329412 B 12.8
331482 V 0
331512 B 12.8
333582 V 0
333612 B 12.8
335680 V 0
335710 B 12.8
337781 V 0
337811 B 12.8
339882 V 0
339912 B 12.9
341982 V 0
342012 B 12.9
342242 E progress 7E0 21FF pos 16896, 254 found, 175 ms/DID
344080 V 0
344110 B 12.8
346184 V 0
346214 B 12.8
348282 V 0
348312 B 12.8
350383 V 0
350413 B 12.8
352482 V 0
352512 B 12.8
354584 V 0
354614 B 12.8
356684 V 0
356714 B 12.8
358783 V 0
358813 B 12.8
360899 V 0
360929 B 12.8
362999 V 0
363029 B 12.8
365009 V 0
365039 B 12.8
367108 V 0
367138 B 12.8
369190 V 0
369220 B 12.8
371291 V 0
371321 B 12.8
373390 V 0
373420 B 12.9
375490 V 0
375520 B 12.9
377607 V 0
377638 B 12.8
379707 V 0
379737 B 12.8
381805 V 0
381835 B 12.8
383905 V 0
383935 B 12.8
386009 V 0
386039 B 12.8
388108 V 0
388138 B 12.8
390194 V 0
390224 B 12.8
392294 V 0
392324 B 12.8
394390 V 0
394420 B 12.9
396505 V 0
396535 B 12.8
398608 V 0
398638 B 12.8
400705 V 0
400735 B 12.8
402809 V 0
402839 B 12.8
404908 V 0
404938 B 12.8
406931 V 0
406961 B 12.8
408986 V 0
409016 B 12.8
411013 V 0
411043 B 12.9
413157 V 0
413187 B 12.8
415256 V 0
415286 B 12.8
417356 V 0
417386 B 12.8
419456 V 0
419486 B 12.8
421558 V 0
421588 B 12.8
423656 V 0
423686 B 12.8
425755 V 0
425785 B 12.7
427858 V 0
427888 B 12.8
429880 V 0
429910 B 12.9
431399 E progress 7E0 23FF pos 17408, 254 found, 174 ms/DID
431905 V 0
431935 B 12.8
434035 V 0
434065 B 12.8
436139 V 0
436169 B 12.8
438237 V 0
438267 B 12.8
440336 V 0
440366 B 12.8
442439 V 0
442469 B 12.8
444538 V 0
444568 B 12.8
446637 V 0
446667 B 12.8
448739 V 0
448769 B 12.8
450838 V 0
450868 B 12.8
452937 V 0
452967 B 12.8
455036 V 0
455066 B 12.8
457135 V 0
457165 B 13.0
459235 V 0
459265 B 13.0
461339 V 0
461369 B 12.7
463436 V 0
463466 B 12.8
465539 V 0
465569 B 12.8
467635 V 0
467665 B 12.8
469735 V 0
469765 B 12.8
471835 V 0
471865 B 12.8
473935 V 0
473965 B 12.9
476038 V 0
476068 B 13.0
478137 V 0
478167 B 12.8
480236 V 0
480266 B 12.8
482336 V 0
482366 B 12.8
484437 V 0
484467 B 12.7
486536 V 0
486566 B 12.8
488635 V 0
488665 B 12.8
490735 V 0
490765 B 12.8
492835 V 0
492865 B 13.0
494939 V 0
494969 B 13.0
497037 V 0
497067 B 12.8
499139 V 0
499169 B 12.8
501235 V 0
501265 B 12.8
503335 V 0
503365 B 12.8
505436 V 0
505466 B 12.8
507537 V 0
507567 B 12.8
509637 V 0
509667 B 12.8
511735 V 0
511765 B 12.8
513836 V 0
513866 B 12.8
515937 V 0
515967 B 12.8
518037 V 0
518067 B 12.7
520135 V 0
520165 B 12.8
521132 E progress 7E0 25FF pos 17920, 254 found, 175 ms/DID
522236 V 0
522266 B 12.7
524339 V 0
524369 B 12.8
526438 V 0
526468 B 12.8
528537 V 0
528568 B 12.8
530637 V 0
530667 B 12.8
532739 V 0
532769 B 12.7
534835 V 0
534865 B 12.8
536939 V 0
536969 B 12.8
539039 V 0
539069 B 12.8
541135 V 0
541165 B 12.8
543236 V 0
543266 B 12.8
545338 V 0
545368 B 12.9
547437 V 0
547467 B 13.0
549536 V 0
549566 B 12.7
551638 V 0
551668 B 12.8
553735 V 0
553765 B 12.8
555835 V 0
555865 B 12.8
557938 V 0
557968 B 12.8
560037 V 0
560067 B 12.8
562137 V 0
562167 B 12.8
564235 V 0
564265 B 12.8
566336 V 0
566366 B 12.8
568436 V 0
568466 B 12.8
570536 V 0
570566 B 12.4
572638 V 0
572668 B 12.4
574739 V 0
574769 B 12.8
576835 V 0
576865 B 12.5
578935 V 0
578965 B 12.8
581036 V 0
581066 B 13.0
583136 V 0
583166 B 13.0
585235 V 0
585265 B 12.8
587339 V 0
587369 B 12.8
589438 V 0
589468 B 12.8
591535 V 0
591565 B 12.8
593639 V 0
593669 B 12.8
595739 V 0
595769 B 12.8
597835 V 0
597865 B 12.9
599937 V 0
599968 B 13.0
602038 V 0
602068 B 12.8
604138 V 0
604168 B 12.8
606237 V 0
606267 B 12.8
608336 V 0
608366 B 12.8
610435 V 0
610465 B 12.8
610831 E progress 7E0 27FF pos 18432, 254 found, 175 ms/DID
612535 V 0
612565 B 12.8
614639 V 0
614669 B 12.8
616739 V 0
616769 B 12.9
618838 V 0
618868 B 13.0
620935 V 0
620965 B 12.8
623035 V 0
623065 B 12.7
625135 V 0
625165 B 12.8
627115 V -1
627640 B 11.7
629125 V -1
629650 B 11.7
630027 E 7E0 not answering at 286D
635202 V -1
635727 B 11.8
637272 V -1
637797 B 11.6
638714 E 7E0 not answering at 286D
643874 V -1
644399 B 11.4
645883 V -1
646408 B 11.4
647306 E 7E0 not answering at 286D
652465 V -1
652990 B 11.4
654479 V -1
655004 B 11.4
655902 E 7E0 not answering at 286D
661062 V -1
661587 B 11.4
663071 V -1
663596 B 11.4
664525 E 7E0 not answering at 286D
669685 V -1
670225 B 11.4
671713 V -1
672238 B 11.4
673135 E 7E0 not answering at 286D
678295 V -1
678820 B 11.6
680308 V -1
680833 B 11.4
681775 E 7E0 not answering at 286D
686935 V -1
687460 B 11.4
688976 V -1
689501 B 11.4
690434 E 7E0 not answering at 286D
File diff suppressed because it is too large. Load diff
File diff suppressed because it is too large. Load diff
File diff suppressed because it is too large. Load diff
File diff suppressed because it is too large. Load diff
File diff suppressed because it is too large. Load diff
File diff suppressed because it is too large. Load diff
@@ -0,0 +1,3 @@
# 12-OBD-Speed CAN log (t = ms since boot)
# C adapter, P protocol, V speed km/h, B battery V, M mark, F raw line, D module found, I module list,
# S addr did data (DID supported), R addr did nrc (negative response), E note
+6
View File
@@ -0,0 +1,6 @@
# JC3636W518 OBD speed: one 4 MB app (no OTA) + 11.9 MB raw area for the background GIF (written/mmapped by bg_store.cpp)
# Name, Type, SubType, Offset, Size
nvs, data, nvs, 0x9000, 0x6000,
app0, app, factory, 0x10000, 0x400000,
bggif, data, 0x40, 0x410000, 0xBE0000,
coredump, data, coredump, 0xFF0000, 0x10000,
1 # JC3636W518 OBD speed: one 4 MB app (no OTA) + 11.9 MB raw area for the background GIF (written/mmapped by bg_store.cpp)
2 # Name, Type, SubType, Offset, Size
3 nvs, data, nvs, 0x9000, 0x6000,
4 app0, app, factory, 0x10000, 0x400000,
5 bggif, data, 0x40, 0x410000, 0xBE0000,
6 coredump, data, coredump, 0xFF0000, 0x10000,
+18
View File
@@ -0,0 +1,18 @@
; OBD speed display: ELM327 over BLE, GIF background, swipe-left menu to pick/remember the adapter.
; JC3636W518, common settings in shared/jc3636w518.ini
[platformio]
extra_configs = ../shared/jc3636w518.ini
[shared]
dir = ../shared
[env:jc3636w518]
extends = jc3636w518
; 4 MB app (no OTA) + 11.9 MB raw 'bggif' area for the background GIF chosen from the SD card
board_build.partitions = partitions.csv
; background GIF linked into the firmware as-is (symbols _binary_data_bg_gif_start/_end)
board_build.embed_files = data/bg.gif
lib_deps =
${jc3636w518.lib_deps}
h2zero/NimBLE-Arduino@2.5.1
+348
View File
@@ -0,0 +1,348 @@
#include "bg_store.h"
#include <FS.h>
#include <Preferences.h>
#include <SD_MMC.h>
#include <esp_partition.h>
#include "sd_card.h"
#define BG_MAGIC 0x46494742 // "BGIF"
#define BG_DATA_OFFSET 4096 // header in the first sector, GIF data after it
#define COPY_CHUNK (32 * 1024)
struct BgHeader
{
uint32_t magic;
uint32_t size;
uint32_t mtime;
char name[64];
};
// ---------- shared state (protected by `mtx`) ----------
static SemaphoreHandle_t mtx;
static String selected; // "" = built-in
static String status = "";
static std::vector<BgFile> files;
static uint32_t files_version = 1;
static volatile uint32_t source_version = 1;
static volatile bool busy = false;
// stored GIF (worker writes, UI reads after source_version changes)
static const esp_partition_t *part = nullptr;
static esp_partition_mmap_handle_t map_handle;
static const uint8_t *map_ptr = nullptr;
static volatile bool map_valid = false;
static BgHeader header;
// requests / handshake
static volatile bool req_list = false, req_select = false, req_boot_check = false;
static String req_name;
static volatile bool release_req = false, release_ack = false;
static void lock() { xSemaphoreTake(mtx, portMAX_DELAY); }
static void unlock() { xSemaphoreGive(mtx); }
static void set_status(const String &s)
{
lock();
status = s;
unlock();
Serial.println("[bg] " + s);
}
// ---------- flash partition ----------
static void map_partition()
{
map_valid = false;
map_ptr = nullptr;
if (!part)
return;
const void *ptr;
if (esp_partition_mmap(part, 0, part->size, ESP_PARTITION_MMAP_DATA, &ptr, &map_handle) != ESP_OK)
{
Serial.println("[bg] mmap failed");
return;
}
map_ptr = (const uint8_t *)ptr;
memcpy(&header, map_ptr, sizeof(header));
header.name[sizeof(header.name) - 1] = 0;
map_valid = header.magic == BG_MAGIC && header.size > 0 && header.size <= part->size - BG_DATA_OFFSET;
}
static void unmap_partition()
{
if (map_ptr)
esp_partition_munmap(map_handle);
map_ptr = nullptr;
map_valid = false;
}
// ---------- SD card (shared with the CAN logger) ----------
static bool sd_mount() { return sd_acquire(); }
static void sd_unmount() { sd_release(); }
static void do_list()
{
set_status("Reading SD card...");
if (!sd_mount())
{
set_status("SD card not found");
return;
}
std::vector<BgFile> found;
File dir = SD_MMC.open(BG_SD_FOLDER);
if (dir && dir.isDirectory())
{
for (File f = dir.openNextFile(); f; f = dir.openNextFile())
{
String n = f.name();
String lower = n;
lower.toLowerCase();
if (f.isDirectory() || !lower.endsWith(".gif") || n.startsWith("."))
continue;
BgFile b;
b.name = n;
b.size = f.size();
uint8_t hdr[10] = {0};
f.read(hdr, sizeof(hdr));
b.w = hdr[6] | (hdr[7] << 8);
b.h = hdr[8] | (hdr[9] << 8);
found.push_back(b);
}
}
sd_unmount();
lock();
files = found;
files_version++;
unlock();
set_status(dir ? String(found.size()) + " GIFs on the SD card" : String("No " BG_SD_FOLDER " folder on the SD card"));
}
// Copies /gifs/<name> into the flash partition (SD must be mounted). Returns true on success.
static bool copy_to_flash(const String &name, File &f)
{
uint32_t size = f.size();
if (size + BG_DATA_OFFSET > part->size)
{
set_status("Too large: " + String(size / 1048576.0f, 1) + " MB");
return false;
}
// the UI is playing the stored GIF straight from this flash: make it switch to the built-in one first
release_ack = false;
release_req = true;
while (!release_ack)
vTaskDelay(pdMS_TO_TICKS(10));
release_req = false;
unmap_partition();
set_status("Erasing flash...");
uint32_t erase_size = (BG_DATA_OFFSET + size + 0xFFFF) & ~0xFFFF; // whole 64 KB blocks (fast erase)
if (erase_size > part->size)
erase_size = part->size;
if (esp_partition_erase_range(part, 0, erase_size) != ESP_OK)
{
set_status("Flash erase failed");
map_partition();
return false;
}
uint8_t *buf = (uint8_t *)heap_caps_malloc(COPY_CHUNK, MALLOC_CAP_INTERNAL | MALLOC_CAP_8BIT);
uint32_t done = 0;
bool ok = buf != nullptr;
int last_pct = -1;
while (ok && done < size)
{
size_t n = f.read(buf, min((uint32_t)COPY_CHUNK, size - done));
if (n == 0 || esp_partition_write(part, BG_DATA_OFFSET + done, buf, n) != ESP_OK)
ok = false;
done += n;
int pct = done * 100 / size;
if (pct / 5 != last_pct / 5)
{
last_pct = pct;
set_status("Copying " + String(pct) + " %");
}
}
free(buf);
if (ok)
{
// header last: an interrupted copy never looks valid
BgHeader h = {};
h.magic = BG_MAGIC;
h.size = size;
h.mtime = (uint32_t)f.getLastWrite();
strncpy(h.name, name.c_str(), sizeof(h.name) - 1);
ok = esp_partition_write(part, 0, &h, sizeof(h)) == ESP_OK;
}
map_partition();
set_status(ok ? "Stored: " + name : String("Copy failed"));
return ok && map_valid;
}
// Makes sure the flash holds the current version of /gifs/<name>. Returns false if it could not.
static bool sync_file(const String &name, bool quiet)
{
if (!quiet)
set_status("Reading SD card...");
if (!sd_mount())
{
set_status(map_valid && name == header.name ? "SD card not found, using stored copy" : "SD card not found");
return map_valid && name == header.name;
}
bool ok;
File f = SD_MMC.open(String(BG_SD_FOLDER) + "/" + name);
if (!f)
{
set_status(map_valid && name == header.name ? "File gone from SD, using stored copy" : "File not found");
ok = map_valid && name == header.name;
}
else if (map_valid && name == header.name && f.size() == header.size && (uint32_t)f.getLastWrite() == header.mtime)
{
if (!quiet)
set_status("Up to date: " + name);
ok = true;
}
else
{
ok = copy_to_flash(name, f);
}
if (f)
f.close();
sd_unmount();
return ok;
}
static void save_selected(const String &name)
{
Preferences p;
p.begin("ui", false);
p.putString("bg", name);
p.end();
lock();
selected = name;
unlock();
source_version++;
}
static void worker_task(void *)
{
for (;;)
{
if (req_boot_check)
{
req_boot_check = false;
busy = true;
String name = bg_selected();
if (name.length())
{
uint32_t before = header.size ^ header.mtime;
sync_file(name, true);
if ((header.size ^ header.mtime) != before)
source_version++;
}
busy = false;
}
if (req_select)
{
req_select = false;
busy = true;
String name = req_name;
if (name.length() == 0 || sync_file(name, false))
{
save_selected(name);
if (name.length() == 0)
set_status("Built-in background");
}
busy = false;
}
if (req_list)
{
req_list = false;
busy = true;
do_list();
busy = false;
}
vTaskDelay(pdMS_TO_TICKS(50));
}
}
// ---------- public API ----------
void bg_begin()
{
mtx = xSemaphoreCreateMutex();
Preferences p;
p.begin("ui", true);
selected = p.getString("bg", "");
p.end();
part = esp_partition_find_first(ESP_PARTITION_TYPE_DATA, (esp_partition_subtype_t)0x40, "bggif");
if (!part)
Serial.println("[bg] partition 'bggif' not found");
map_partition();
Serial.printf("[bg] selected '%s', stored '%s' (%s)\n", selected.c_str(), map_valid ? header.name : "",
map_valid ? "valid" : "none");
req_boot_check = true; // look for an updated version on the SD card in the background
xTaskCreatePinnedToCore(worker_task, "bg_store", 6144, nullptr, 1, nullptr, 0);
}
String bg_selected()
{
lock();
String s = selected;
unlock();
return s;
}
const uint8_t *bg_stored_data(uint32_t *size)
{
if (!map_valid)
return nullptr;
*size = header.size;
return map_ptr + BG_DATA_OFFSET;
}
String bg_stored_name() { return map_valid ? String(header.name) : String(); }
void bg_request_list() { req_list = true; }
bool bg_get_list(std::vector<BgFile> &out, uint32_t &version)
{
lock();
bool changed = version != files_version;
if (changed)
{
out = files;
version = files_version;
}
unlock();
return changed;
}
void bg_request_select(const String &name)
{
req_name = name;
req_select = true;
}
String bg_status()
{
lock();
String s = status;
unlock();
return s;
}
bool bg_busy() { return busy || req_select || req_list; }
bool bg_release_requested() { return release_req && !release_ack; }
void bg_release_done() { release_ack = true; }
bool bg_source_changed(uint32_t &version)
{
if (version == source_version)
return false;
version = source_version;
return true;
}
+38
View File
@@ -0,0 +1,38 @@
// Background GIF storage: GIFs from the SD card (/gifs) are copied into a raw flash partition ("bggif")
// and played straight from flash (memory-mapped), so the SD card is only needed when choosing / updating.
// SD and flash work runs in a background task; all functions are safe to call from the UI (loop) task.
#pragma once
#include <Arduino.h>
#include <vector>
#define BG_SD_FOLDER "/gifs"
struct BgFile
{
String name; // file name in /gifs
uint32_t size; // bytes
uint16_t w, h; // GIF logical screen size
};
void bg_begin(); // maps the stored GIF and checks the SD card for an updated version
// Currently selected background: "" = built-in, otherwise a file name from /gifs
String bg_selected();
// Stored GIF in flash, nullptr if none. Only valid for bg_selected() when bg_stored_name() matches.
const uint8_t *bg_stored_data(uint32_t *size);
String bg_stored_name();
// Menu
void bg_request_list(); // mount SD and list /gifs
bool bg_get_list(std::vector<BgFile> &out, uint32_t &version);
void bg_request_select(const String &name); // "" = built-in; copies to flash if needed
String bg_status(); // "Copying 45 %", "SD card not found", ...
bool bg_busy();
// UI handshake: the UI must stop using the stored GIF before it is overwritten,
// and reload the background when the source changed.
bool bg_release_requested();
void bg_release_done();
bool bg_source_changed(uint32_t &version);
+291
View File
@@ -0,0 +1,291 @@
#include "can_log.h"
#include <FS.h>
#include <Preferences.h>
#include <SD_MMC.h>
#include "sd_card.h"
#define FLUSH_INTERVAL_MS 2000
#define SD_RETRY_MS 10000
#define MAX_BUFFER (256 * 1024) // kept in RAM while the SD card is missing; beyond that lines are dropped
// ---------- shared state (protected by `mtx`) ----------
static SemaphoreHandle_t mtx;
static volatile bool enabled = false;
static String buffer;
static uint32_t dropped = 0;
static int marks = 0;
static String status = "Off";
static String phase;
static String frames[CANLOG_SLOTS];
// ---------- writer-owned ----------
static bool file_open = false;
static String path;
static uint32_t written = 0;
static void lock() { xSemaphoreTake(mtx, portMAX_DELAY); }
static void unlock() { xSemaphoreGive(mtx); }
static void set_status(const String &s)
{
lock();
status = s;
unlock();
}
static void update_status()
{
set_status(path.substring(path.lastIndexOf('/') + 1) + " " + String((written + 512) / 1024) + " KB" +
(dropped ? " dropped " + String(dropped) : String()));
}
// New file /canlog/log_NNN.txt with a header describing the format
static void open_session()
{
if (!sd_acquire())
{
set_status("SD card not found");
return;
}
SD_MMC.mkdir(CANLOG_FOLDER);
char name[40];
for (int i = 1; i <= 999; i++)
{
snprintf(name, sizeof(name), CANLOG_FOLDER "/log_%03d.txt", i);
if (!SD_MMC.exists(name))
break;
}
File f = SD_MMC.open(name, FILE_WRITE);
if (!f)
{
set_status("Can't create log file");
sd_release();
return;
}
f.print("# 12-OBD-Speed CAN log (t = ms since boot)\n"
"# C adapter, P protocol, V speed km/h, B battery V, M mark, F raw line, D module found, I module list,\n"
"# S addr did data (DID supported), R addr did nrc (negative response), E note\n");
f.close();
path = name;
written = 0;
file_open = true;
Serial.println("[log] " + path);
update_status();
}
static void flush()
{
lock();
String chunk = std::move(buffer);
buffer = String();
unlock();
if (chunk.length() == 0)
return;
File f = SD_MMC.open(path, FILE_APPEND);
size_t n = f ? f.print(chunk) : 0;
if (f)
f.close();
if (n != chunk.length())
{
// card gone or full: start over with a new file once it works again
file_open = false;
sd_release();
set_status("SD write failed");
return;
}
written += n;
update_status();
}
static void writer_task(void *)
{
uint32_t next_try = 0;
for (;;)
{
vTaskDelay(pdMS_TO_TICKS(FLUSH_INTERVAL_MS));
if (enabled && !file_open && (int32_t)(millis() - next_try) >= 0)
{
open_session();
next_try = millis() + SD_RETRY_MS;
}
if (file_open)
flush();
if (!enabled && file_open)
{
file_open = false;
sd_release();
set_status("Stopped, saved " + path.substring(path.lastIndexOf('/') + 1));
}
}
}
// ---------- public API ----------
void can_log_begin()
{
mtx = xSemaphoreCreateMutex();
Preferences p;
p.begin("canlog", true);
enabled = p.getBool("on", false);
p.end();
if (enabled)
status = "Waiting for SD card";
xTaskCreatePinnedToCore(writer_task, "can_log", 6144, nullptr, 1, nullptr, 0);
}
bool can_log_enabled() { return enabled; }
void can_log_set_enabled(bool on)
{
if (on == enabled)
return;
Preferences p;
p.begin("canlog", false);
p.putBool("on", on);
p.end();
lock();
if (on)
{
marks = 0;
dropped = 0;
status = "Waiting for SD card";
}
else if (!file_open)
{
buffer = ""; // never got a file: nothing to save
status = "Off";
}
unlock();
enabled = on;
}
void can_log_line(const String &text)
{
if (!enabled)
return;
String line = String(millis()) + " " + text + "\n";
lock();
if (buffer.length() + line.length() <= MAX_BUFFER)
buffer += line;
else
dropped++;
unlock();
}
int can_log_mark()
{
lock();
int n = ++marks;
unlock();
can_log_line("M " + String(n));
Serial.printf("[log] mark %d\n", n);
return n;
}
int can_log_marks()
{
lock();
int n = marks;
unlock();
return n;
}
String can_log_status()
{
lock();
String s = status;
unlock();
return s;
}
static void serial_command(String cmd)
{
cmd.trim();
if (cmd != "ls" && !cmd.startsWith("get "))
return;
if (!sd_acquire())
{
Serial.println("<<<ERROR SD card not found>>>");
return;
}
if (cmd == "ls")
{
Serial.println("<<<LS>>>");
File dir = SD_MMC.open(CANLOG_FOLDER);
if (dir && dir.isDirectory())
for (File f = dir.openNextFile(); f; f = dir.openNextFile())
Serial.printf("%s %u\n", f.name(), (unsigned)f.size());
Serial.println("<<<END>>>");
}
else
{
String name = cmd.substring(4);
name.trim();
File f = SD_MMC.open(String(CANLOG_FOLDER) + "/" + name);
if (!f)
Serial.println("<<<ERROR not found>>>");
else
{
Serial.printf("<<<BEGIN %s %u>>>\n", name.c_str(), (unsigned)f.size());
static uint8_t buf[1024];
int n;
while ((n = f.read(buf, sizeof(buf))) > 0)
Serial.write(buf, n);
f.close();
Serial.println("\n<<<END>>>");
}
}
sd_release();
}
void can_log_serial_poll()
{
static String line;
while (Serial.available())
{
char c = Serial.read();
if (c == '\n' || c == '\r')
{
if (line.length())
serial_command(line);
line = "";
}
else if (line.length() < 80)
line += c;
}
}
void can_log_set_phase(const String &s)
{
lock();
phase = s;
unlock();
}
String can_log_phase()
{
lock();
String s = phase;
unlock();
return s;
}
void can_log_set_frame(int slot, const String &s)
{
if (slot < 0 || slot >= CANLOG_SLOTS)
return;
lock();
frames[slot] = s;
unlock();
}
String can_log_frame(int slot)
{
if (slot < 0 || slot >= CANLOG_SLOTS)
return String();
lock();
String s = frames[slot];
unlock();
return s;
}
+34
View File
@@ -0,0 +1,34 @@
// CAN logger, to find the Ford cruise/ACC set speed and speed-sign messages: the OBD task records broadcast
// CAN frames (ELM327 monitor mode), speed and voltage; the UI adds marks. Lines are appended to
// /canlog/log_NNN.txt on the SD card every 2 s (new file per session). All functions are thread-safe.
//
// Line format: "<ms since boot> <type> <data>"
// C adapter info P protocol (ATDPN) V speed km/h (010D) B battery V M mark number
// F <line> raw monitor line D <addr> <reply> module found I <addrs> module list
// S <addr> <did> <data> DID supported R <addr> <did> <nrc> other negative response
// E <text> adapter message / note
#pragma once
#include <Arduino.h>
#define CANLOG_FOLDER "/canlog"
#define CANLOG_SLOTS 3 // info lines shown on the log page (modules, DIDs found, last reply)
void can_log_begin();
bool can_log_enabled();
void can_log_set_enabled(bool on); // remembered in NVS
void can_log_line(const String &text); // adds the timestamp; ignored while logging is off
int can_log_mark(); // logs a mark, returns its number
int can_log_marks();
String can_log_status(); // file + size, or what is wrong
// Serial commands for reading the logs on the PC (call from loop()):
// "ls" -> one line per file in /canlog: "<name> <size>"
// "get <name>" -> "<<<BEGIN <name> <size>>>>", the file, "<<<END>>>"
void can_log_serial_poll();
// Shown on the log page, set by the OBD task
void can_log_set_phase(const String &s);
String can_log_phase();
void can_log_set_frame(int slot, const String &s);
String can_log_frame(int slot);
File diff suppressed because it is too large. Load diff
+803
View File
@@ -0,0 +1,803 @@
// OBD speed display for the JC3636W518: vehicle speed from an ELM327 over BLE on top of an animated GIF.
// Swipe left for the adapter menu (scan, select, forget); the selected adapter is remembered and reconnected.
// Swipe left again for settings (screen rotation, idle timeout; remembered), and once more for the
// background page (built-in GIF or one from /gifs on the SD card, copied into flash).
// Battery voltage is shown as a small arc in the bottom gap; after a while without speed data the
// screen goes dark (idle) and wakes on touch or when the engine starts.
// Last page: CAN logger (to find the cruise set speed / speed-sign messages); while logging, a tap on
// the speed page adds a mark.
#include <Arduino.h>
#include <Preferences.h>
#include "jc3636w518.h"
#include "obd_link.h"
#include "bg_store.h"
#include "can_log.h"
#define SPEED_MAX 200
#define VOLT_MIN_X10 110 // voltage arc range 11.0 .. 15.0 V
#define VOLT_MAX_X10 150
#define MAX_MENU_ITEMS 30
#define MAX_BG_ITEMS 40
LV_FONT_DECLARE(font_speed_120);
// background GIF linked into the firmware (board_build.embed_files = data/bg.gif)
extern const uint8_t bg_gif_start[] asm("_binary_data_bg_gif_start");
extern const uint8_t bg_gif_end[] asm("_binary_data_bg_gif_end");
static const lv_color_t COLOR_TEXT = lv_color_hex(0xFFFFFF);
static const lv_color_t COLOR_DIM = lv_color_hex(0x9AA3AD);
static const lv_color_t COLOR_ARC = lv_color_hex(0x00C8FF);
static const lv_color_t COLOR_OBD = lv_color_hex(0x4CD964);
static const lv_color_t COLOR_PANEL = lv_color_hex(0x161C22);
static lv_obj_t *tileview, *tile_speed, *tile_menu, *tile_settings, *tile_bg, *tile_log;
static lv_obj_t *rec_label, *log_status_label, *log_phase_label, *log_frames_label, *log_toggle_label;
static uint32_t mark_shown_until = 0;
static lv_obj_t *bg_status_label, *bg_list;
static std::vector<BgFile> bg_files;
static uint32_t bg_list_version = 0, bg_source_version = 0;
static String bg_list_key; // files + selection currently shown in the list
static lv_image_dsc_t builtin_dsc, stored_dsc;
static lv_obj_t *rot_buttons[4], *idle_buttons[4];
static const uint8_t IDLE_MINUTES[4] = {0, 2, 5, 10}; // 0 = never
static lv_obj_t *speed_arc, *speed_label, *speed_shadow, *status_label;
static lv_obj_t *volt_arc, *volt_label, *bg_gif, *idle_overlay;
static lv_obj_t *menu_saved, *menu_status, *menu_list;
static lv_obj_t *menu_items[MAX_MENU_ITEMS];
static int menu_item_count = 0;
static std::vector<ObdDevInfo> scan_devs; // as received from obd_link
static std::vector<ObdDevInfo> menu_devs; // display order: OBD-like first
static uint32_t scan_version = 0;
static String menu_order; // addresses in display order (detects reordering)
// ---------- helpers ----------
static lv_obj_t *make_button(lv_obj_t *parent, const char *text, int x, int y, int w, lv_event_cb_t cb)
{
lv_obj_t *b = lv_button_create(parent);
lv_obj_set_size(b, w, 34);
lv_obj_align(b, LV_ALIGN_TOP_MID, x, y);
lv_obj_add_event_cb(b, cb, LV_EVENT_CLICKED, NULL);
lv_obj_t *l = lv_label_create(b);
lv_label_set_text(l, text);
lv_obj_set_style_text_font(l, &lv_font_montserrat_16, 0);
lv_obj_center(l);
return b;
}
static void show_tile(lv_obj_t *tile)
{
lv_tileview_set_tile(tileview, tile, LV_ANIM_ON);
}
static bool menu_visible()
{
return lv_tileview_get_tile_active(tileview) == tile_menu;
}
// ---------- events ----------
static void on_tile_changed(lv_event_t *e)
{
obd_scan_enable(menu_visible()); // scan only while the menu is open
if (lv_tileview_get_tile_active(tileview) == tile_bg)
bg_request_list();
}
static void on_device_clicked(lv_event_t *e)
{
int idx = (int)(intptr_t)lv_event_get_user_data(e);
if (idx < 0 || idx >= (int)menu_devs.size())
return;
obd_select_device(menu_devs[idx]);
show_tile(tile_speed);
}
static void on_forget_clicked(lv_event_t *e)
{
obd_forget_device();
}
static void on_done_clicked(lv_event_t *e)
{
show_tile(tile_speed);
}
// ---------- settings: screen rotation ----------
static uint8_t load_rotation()
{
Preferences p;
p.begin("ui", true);
uint8_t r = p.getUChar("rot", 0);
p.end();
return r > 3 ? 0 : r;
}
static void highlight_rotation(uint8_t rot)
{
for (int i = 0; i < 4; i++)
lv_obj_set_style_bg_color(rot_buttons[i], i == rot ? COLOR_ARC : lv_color_hex(0x222A33), 0);
}
static void on_rotation_clicked(lv_event_t *e)
{
uint8_t rot = (uint8_t)(intptr_t)lv_event_get_user_data(e);
setRotation(rot);
highlight_rotation(rot);
Preferences p;
p.begin("ui", false);
p.putUChar("rot", rot);
p.end();
}
// ---------- settings: idle timeout ----------
static uint8_t load_idle_minutes()
{
Preferences p;
p.begin("ui", true);
uint8_t m = p.getUChar("idle", 2);
p.end();
return m;
}
static void highlight_idle(uint8_t minutes)
{
for (int i = 0; i < 4; i++)
lv_obj_set_style_bg_color(idle_buttons[i], IDLE_MINUTES[i] == minutes ? COLOR_ARC : lv_color_hex(0x222A33), 0);
}
static void on_idle_clicked(lv_event_t *e)
{
uint8_t minutes = IDLE_MINUTES[(int)(intptr_t)lv_event_get_user_data(e)];
obd_set_idle_timeout(minutes);
highlight_idle(minutes);
Preferences p;
p.begin("ui", false);
p.putUChar("idle", minutes);
p.end();
}
static void on_idle_overlay_pressed(lv_event_t *e)
{
obd_wake(); // touch while the screen is dark: wake up (the touch itself is swallowed)
}
// ---------- background ----------
static void fill_gif_dsc(lv_image_dsc_t *dsc, const uint8_t *data, uint32_t size)
{
dsc->header.magic = LV_IMAGE_HEADER_MAGIC;
dsc->header.cf = LV_COLOR_FORMAT_RAW;
dsc->header.w = data[6] | (data[7] << 8); // GIF logical screen size
dsc->header.h = data[8] | (data[9] << 8);
dsc->data_size = size;
dsc->data = data;
}
static void set_gif_source(const lv_image_dsc_t *dsc)
{
lv_gif_set_src(bg_gif, dsc);
if (obd_is_idle())
lv_gif_pause(bg_gif); // keep the animation stopped while the screen is dark
}
// Selected GIF from flash if it is stored there, otherwise the built-in one
static void apply_background()
{
String sel = bg_selected();
uint32_t size;
const uint8_t *data = bg_stored_data(&size);
if (sel.length() && data && bg_stored_name() == sel)
{
fill_gif_dsc(&stored_dsc, data, size);
set_gif_source(&stored_dsc);
}
else
{
set_gif_source(&builtin_dsc);
}
}
static void on_bg_item_clicked(lv_event_t *e)
{
if (bg_busy())
return;
int idx = (int)(intptr_t)lv_event_get_user_data(e); // -1 = built-in
if (idx < 0)
bg_request_select("");
else if (idx < (int)bg_files.size())
bg_request_select(bg_files[idx].name);
}
static void on_bg_rescan_clicked(lv_event_t *e)
{
if (!bg_busy())
bg_request_list();
}
// ---------- CAN log ----------
static void add_mark()
{
if (!can_log_enabled())
return;
can_log_mark();
mark_shown_until = millis() + 1500;
}
static void on_speed_tapped(lv_event_t *e) { add_mark(); }
static void on_mark_clicked(lv_event_t *e) { add_mark(); }
static void on_log_toggle_clicked(lv_event_t *e) { can_log_set_enabled(!can_log_enabled()); }
static void on_scan_reset_clicked(lv_event_t *e) { obd_scan_reset(); }
// ---------- speed page ----------
static void build_speed_tile()
{
// background GIF (built-in until apply_background() picks the stored one),
// decoded straight into the display format (no transparency needed on black)
fill_gif_dsc(&builtin_dsc, bg_gif_start, bg_gif_end - bg_gif_start);
bg_gif = lv_gif_create(tile_speed);
lv_gif_set_color_format(bg_gif, lv_display_get_color_format(lv_display_get_default()));
lv_gif_set_src(bg_gif, &builtin_dsc);
lv_obj_center(bg_gif);
// arc gauge along the round edge: 270° sweep, gap at the bottom
speed_arc = lv_arc_create(tile_speed);
lv_obj_set_size(speed_arc, 344, 344);
lv_obj_center(speed_arc);
lv_arc_set_rotation(speed_arc, 135);
lv_arc_set_bg_angles(speed_arc, 0, 270);
lv_arc_set_range(speed_arc, 0, SPEED_MAX);
lv_arc_set_value(speed_arc, 0);
lv_obj_remove_style(speed_arc, NULL, LV_PART_KNOB);
lv_obj_remove_flag(speed_arc, LV_OBJ_FLAG_CLICKABLE); // let swipes reach the tileview
lv_obj_set_style_arc_width(speed_arc, 12, LV_PART_MAIN);
lv_obj_set_style_arc_width(speed_arc, 12, LV_PART_INDICATOR);
lv_obj_set_style_arc_color(speed_arc, lv_color_hex(0xFFFFFF), LV_PART_MAIN);
lv_obj_set_style_arc_opa(speed_arc, LV_OPA_30, LV_PART_MAIN);
lv_obj_set_style_arc_color(speed_arc, COLOR_ARC, LV_PART_INDICATOR);
// battery voltage arc in the bottom gap of the speed arc, filling left to right
volt_arc = lv_arc_create(tile_speed);
lv_obj_set_size(volt_arc, 344, 344);
lv_obj_center(volt_arc);
lv_arc_set_rotation(volt_arc, 45);
lv_arc_set_bg_angles(volt_arc, 8, 82); // small margin to the speed arc ends
lv_arc_set_mode(volt_arc, LV_ARC_MODE_REVERSE); // starts at the left end (bottom-left)
lv_arc_set_range(volt_arc, VOLT_MIN_X10, VOLT_MAX_X10);
lv_arc_set_value(volt_arc, VOLT_MIN_X10);
lv_obj_remove_style(volt_arc, NULL, LV_PART_KNOB);
lv_obj_remove_flag(volt_arc, LV_OBJ_FLAG_CLICKABLE);
lv_obj_set_style_arc_width(volt_arc, 12, LV_PART_MAIN);
lv_obj_set_style_arc_width(volt_arc, 12, LV_PART_INDICATOR);
lv_obj_set_style_arc_color(volt_arc, lv_color_hex(0xFFFFFF), LV_PART_MAIN);
lv_obj_set_style_arc_opa(volt_arc, LV_OPA_30, LV_PART_MAIN);
volt_label = lv_label_create(tile_speed);
lv_obj_set_style_text_font(volt_label, &lv_font_montserrat_16, 0);
lv_obj_set_style_text_color(volt_label, COLOR_DIM, 0);
lv_label_set_text(volt_label, "-- V");
lv_obj_align(volt_label, LV_ALIGN_BOTTOM_MID, 0, -30);
// speed number with a soft drop shadow so it stays readable on the GIF
speed_shadow = lv_label_create(tile_speed);
lv_obj_set_style_text_font(speed_shadow, &font_speed_120, 0);
lv_obj_set_style_text_color(speed_shadow, lv_color_hex(0x000000), 0);
lv_obj_set_style_text_opa(speed_shadow, LV_OPA_70, 0);
lv_label_set_text(speed_shadow, "--");
lv_obj_align(speed_shadow, LV_ALIGN_CENTER, 4, -6);
speed_label = lv_label_create(tile_speed);
lv_obj_set_style_text_font(speed_label, &font_speed_120, 0);
lv_obj_set_style_text_color(speed_label, COLOR_TEXT, 0);
lv_label_set_text(speed_label, "--");
lv_obj_align(speed_label, LV_ALIGN_CENTER, 0, -10);
lv_obj_t *unit = lv_label_create(tile_speed);
lv_obj_set_style_text_font(unit, &lv_font_montserrat_20, 0);
lv_obj_set_style_text_color(unit, COLOR_TEXT, 0);
lv_label_set_text(unit, "km/h");
lv_obj_align(unit, LV_ALIGN_CENTER, 0, 62);
// status pill at the bottom
status_label = lv_label_create(tile_speed);
lv_obj_set_style_text_font(status_label, &lv_font_montserrat_14, 0);
lv_obj_set_style_text_color(status_label, COLOR_TEXT, 0);
lv_obj_set_style_bg_color(status_label, lv_color_hex(0x000000), 0);
lv_obj_set_style_bg_opa(status_label, LV_OPA_50, 0);
lv_obj_set_style_radius(status_label, 12, 0);
lv_obj_set_style_pad_hor(status_label, 10, 0);
lv_obj_set_style_pad_ver(status_label, 3, 0);
lv_label_set_text(status_label, "");
lv_obj_align(status_label, LV_ALIGN_CENTER, 0, 100);
// shown while the CAN logger runs; a tap on the page adds a mark
rec_label = lv_label_create(tile_speed);
lv_obj_set_style_text_font(rec_label, &lv_font_montserrat_16, 0);
lv_obj_set_style_text_color(rec_label, COLOR_TEXT, 0);
lv_obj_set_style_bg_color(rec_label, lv_color_hex(0xFF3B30), 0);
lv_obj_set_style_bg_opa(rec_label, LV_OPA_80, 0);
lv_obj_set_style_radius(rec_label, 12, 0);
lv_obj_set_style_pad_hor(rec_label, 10, 0);
lv_obj_set_style_pad_ver(rec_label, 3, 0);
lv_obj_align(rec_label, LV_ALIGN_TOP_MID, 0, 44);
lv_obj_add_flag(rec_label, LV_OBJ_FLAG_HIDDEN);
lv_obj_add_event_cb(tile_speed, on_speed_tapped, LV_EVENT_SHORT_CLICKED, NULL);
}
// ---------- menu page ----------
static void build_menu_tile()
{
lv_obj_t *title = lv_label_create(tile_menu);
lv_obj_set_style_text_font(title, &lv_font_montserrat_20, 0);
lv_obj_set_style_text_color(title, COLOR_TEXT, 0);
lv_label_set_text(title, "OBD adapter");
lv_obj_align(title, LV_ALIGN_TOP_MID, 0, 20);
menu_saved = lv_label_create(tile_menu);
lv_obj_set_style_text_color(menu_saved, COLOR_TEXT, 0);
lv_obj_set_width(menu_saved, 240);
lv_label_set_long_mode(menu_saved, LV_LABEL_LONG_MODE_DOTS);
lv_obj_set_style_text_align(menu_saved, LV_TEXT_ALIGN_CENTER, 0);
lv_obj_align(menu_saved, LV_ALIGN_TOP_MID, 0, 48);
menu_status = lv_label_create(tile_menu);
lv_obj_set_style_text_color(menu_status, COLOR_DIM, 0);
lv_obj_set_width(menu_status, 260);
lv_label_set_long_mode(menu_status, LV_LABEL_LONG_MODE_DOTS);
lv_obj_set_style_text_align(menu_status, LV_TEXT_ALIGN_CENTER, 0);
lv_obj_align(menu_status, LV_ALIGN_TOP_MID, 0, 68);
menu_list = lv_list_create(tile_menu);
lv_obj_set_size(menu_list, 276, 196);
lv_obj_align(menu_list, LV_ALIGN_TOP_MID, 0, 92);
lv_obj_set_style_bg_color(menu_list, COLOR_PANEL, 0);
lv_obj_set_style_border_width(menu_list, 0, 0);
lv_obj_set_style_pad_all(menu_list, 4, 0);
make_button(tile_menu, "Forget", -50, 296, 92, on_forget_clicked);
make_button(tile_menu, "Done", 50, 296, 92, on_done_clicked);
}
static void build_settings_tile()
{
lv_obj_t *title = lv_label_create(tile_settings);
lv_obj_set_style_text_font(title, &lv_font_montserrat_20, 0);
lv_obj_set_style_text_color(title, COLOR_TEXT, 0);
lv_label_set_text(title, "Settings");
lv_obj_align(title, LV_ALIGN_TOP_MID, 0, 20);
lv_obj_t *label = lv_label_create(tile_settings);
lv_obj_set_style_text_font(label, &lv_font_montserrat_16, 0);
lv_obj_set_style_text_color(label, COLOR_DIM, 0);
lv_label_set_text(label, "Screen rotation (degrees)");
lv_obj_align(label, LV_ALIGN_TOP_MID, 0, 54);
static const char *names[4] = {"0", "90", "180", "270"};
for (int i = 0; i < 4; i++)
{
lv_obj_t *b = lv_button_create(tile_settings);
lv_obj_set_size(b, 96, 40);
lv_obj_align(b, LV_ALIGN_TOP_MID, (i % 2) ? 52 : -52, 80 + (i / 2) * 46);
lv_obj_add_event_cb(b, on_rotation_clicked, LV_EVENT_CLICKED, (void *)(intptr_t)i);
lv_obj_t *l = lv_label_create(b);
lv_label_set_text(l, names[i]);
lv_obj_set_style_text_font(l, &lv_font_montserrat_20, 0);
lv_obj_center(l);
rot_buttons[i] = b;
}
highlight_rotation(getRotation());
lv_obj_t *idle_label = lv_label_create(tile_settings);
lv_obj_set_style_text_font(idle_label, &lv_font_montserrat_16, 0);
lv_obj_set_style_text_color(idle_label, COLOR_DIM, 0);
lv_label_set_text(idle_label, "Screen off without data (min)");
lv_obj_align(idle_label, LV_ALIGN_TOP_MID, 0, 180);
static const char *idle_names[4] = {"Off", "2", "5", "10"};
for (int i = 0; i < 4; i++)
{
lv_obj_t *b = lv_button_create(tile_settings);
lv_obj_set_size(b, 58, 40);
lv_obj_align(b, LV_ALIGN_TOP_MID, -99 + i * 66, 206);
lv_obj_add_event_cb(b, on_idle_clicked, LV_EVENT_CLICKED, (void *)(intptr_t)i);
lv_obj_t *l = lv_label_create(b);
lv_label_set_text(l, idle_names[i]);
lv_obj_set_style_text_font(l, &lv_font_montserrat_16, 0);
lv_obj_center(l);
idle_buttons[i] = b;
}
highlight_idle(load_idle_minutes());
make_button(tile_settings, "Done", 0, 296, 110, on_done_clicked);
}
static void build_bg_tile()
{
lv_obj_t *title = lv_label_create(tile_bg);
lv_obj_set_style_text_font(title, &lv_font_montserrat_20, 0);
lv_obj_set_style_text_color(title, COLOR_TEXT, 0);
lv_label_set_text(title, "Background");
lv_obj_align(title, LV_ALIGN_TOP_MID, 0, 20);
bg_status_label = lv_label_create(tile_bg);
lv_obj_set_style_text_color(bg_status_label, COLOR_DIM, 0);
lv_obj_set_width(bg_status_label, 260);
lv_label_set_long_mode(bg_status_label, LV_LABEL_LONG_MODE_DOTS);
lv_obj_set_style_text_align(bg_status_label, LV_TEXT_ALIGN_CENTER, 0);
lv_label_set_text(bg_status_label, "");
lv_obj_align(bg_status_label, LV_ALIGN_TOP_MID, 0, 48);
bg_list = lv_list_create(tile_bg);
lv_obj_set_size(bg_list, 276, 214);
lv_obj_align(bg_list, LV_ALIGN_TOP_MID, 0, 74);
lv_obj_set_style_bg_color(bg_list, COLOR_PANEL, 0);
lv_obj_set_style_border_width(bg_list, 0, 0);
lv_obj_set_style_pad_all(bg_list, 4, 0);
make_button(tile_bg, "Rescan", -50, 296, 92, on_bg_rescan_clicked);
make_button(tile_bg, "Done", 50, 296, 92, on_done_clicked);
}
static void build_log_tile()
{
lv_obj_t *title = lv_label_create(tile_log);
lv_obj_set_style_text_font(title, &lv_font_montserrat_20, 0);
lv_obj_set_style_text_color(title, COLOR_TEXT, 0);
lv_label_set_text(title, "CAN log");
lv_obj_align(title, LV_ALIGN_TOP_MID, 0, 20);
log_status_label = lv_label_create(tile_log);
lv_obj_set_style_text_color(log_status_label, COLOR_TEXT, 0);
lv_obj_set_width(log_status_label, 260);
lv_label_set_long_mode(log_status_label, LV_LABEL_LONG_MODE_DOTS);
lv_obj_set_style_text_align(log_status_label, LV_TEXT_ALIGN_CENTER, 0);
lv_label_set_text(log_status_label, "");
lv_obj_align(log_status_label, LV_ALIGN_TOP_MID, 0, 48);
log_phase_label = lv_label_create(tile_log);
lv_obj_set_style_text_color(log_phase_label, COLOR_DIM, 0);
lv_obj_set_width(log_phase_label, 290);
lv_label_set_long_mode(log_phase_label, LV_LABEL_LONG_MODE_DOTS);
lv_obj_set_style_text_align(log_phase_label, LV_TEXT_ALIGN_CENTER, 0);
lv_label_set_text(log_phase_label, "");
lv_obj_align(log_phase_label, LV_ALIGN_TOP_MID, 0, 68);
// scan info: modules found, DIDs found, last positive reply
log_frames_label = lv_label_create(tile_log);
lv_obj_set_size(log_frames_label, 290, 66);
lv_label_set_long_mode(log_frames_label, LV_LABEL_LONG_MODE_DOTS);
lv_obj_set_style_text_color(log_frames_label, COLOR_TEXT, 0);
lv_obj_set_style_text_font(log_frames_label, &lv_font_montserrat_14, 0);
lv_obj_set_style_text_align(log_frames_label, LV_TEXT_ALIGN_CENTER, 0);
lv_label_set_text(log_frames_label, "");
lv_obj_align(log_frames_label, LV_ALIGN_TOP_MID, 0, 94);
lv_obj_t *toggle = make_button(tile_log, "", -62, 164, 112, on_log_toggle_clicked);
log_toggle_label = lv_obj_get_child(toggle, 0);
lv_obj_t *mark = lv_button_create(tile_log);
lv_obj_set_size(mark, 112, 34);
lv_obj_align(mark, LV_ALIGN_TOP_MID, 62, 164);
lv_obj_set_style_bg_color(mark, lv_color_hex(0xFF9500), 0);
lv_obj_add_event_cb(mark, on_mark_clicked, LV_EVENT_CLICKED, NULL);
lv_obj_t *l = lv_label_create(mark);
lv_label_set_text(l, "Mark");
lv_obj_set_style_text_font(l, &lv_font_montserrat_16, 0);
lv_obj_center(l);
lv_obj_t *hint = lv_label_create(tile_log);
lv_obj_set_style_text_color(hint, COLOR_DIM, 0);
lv_obj_set_style_text_align(hint, LV_TEXT_ALIGN_CENTER, 0);
lv_label_set_text(hint, "While logging: tap the speed page\nto add a mark (sign passed,\nset speed changed). Log files in\n" CANLOG_FOLDER " on the SD card.");
lv_obj_align(hint, LV_ALIGN_TOP_MID, 0, 208);
make_button(tile_log, "Reset scan", -56, 296, 104, on_scan_reset_clicked);
make_button(tile_log, "Done", 56, 296, 92, on_done_clicked);
}
static void build_ui()
{
lv_obj_set_style_bg_color(lv_screen_active(), lv_color_hex(0x000000), 0);
tileview = lv_tileview_create(lv_screen_active());
lv_obj_set_style_bg_color(tileview, lv_color_hex(0x000000), 0);
lv_obj_set_scrollbar_mode(tileview, LV_SCROLLBAR_MODE_OFF);
tile_speed = lv_tileview_add_tile(tileview, 0, 0, LV_DIR_RIGHT);
tile_menu = lv_tileview_add_tile(tileview, 1, 0, (lv_dir_t)(LV_DIR_LEFT | LV_DIR_RIGHT));
tile_settings = lv_tileview_add_tile(tileview, 2, 0, (lv_dir_t)(LV_DIR_LEFT | LV_DIR_RIGHT));
tile_bg = lv_tileview_add_tile(tileview, 3, 0, (lv_dir_t)(LV_DIR_LEFT | LV_DIR_RIGHT));
tile_log = lv_tileview_add_tile(tileview, 4, 0, LV_DIR_LEFT);
lv_obj_add_event_cb(tileview, on_tile_changed, LV_EVENT_VALUE_CHANGED, NULL);
build_speed_tile();
build_menu_tile();
build_settings_tile();
build_bg_tile();
build_log_tile();
idle_overlay = lv_obj_create(lv_layer_top());
lv_obj_remove_style_all(idle_overlay);
lv_obj_set_size(idle_overlay, SCREEN_RES_HOR, SCREEN_RES_VER);
lv_obj_add_flag(idle_overlay, LV_OBJ_FLAG_CLICKABLE);
lv_obj_add_event_cb(idle_overlay, on_idle_overlay_pressed, LV_EVENT_PRESSED, NULL);
lv_obj_add_flag(idle_overlay, LV_OBJ_FLAG_HIDDEN);
}
// ---------- periodic updates ----------
static lv_color_t voltage_color(float v)
{
if (v < 0)
return COLOR_DIM;
if (v < 11.8f)
return lv_color_hex(0xFF3B30); // red: battery low
if (v < 12.2f)
return lv_color_hex(0xFF9500); // orange: getting weak
if (v < 13.0f)
return lv_color_hex(0x4CD964); // green: resting, OK
if (v <= 14.8f)
return lv_color_hex(0x0A84FF); // blue: charging (engine running)
return lv_color_hex(0xFF3B30); // red: overcharging
}
static void update_voltage()
{
static int shown_x10 = -2;
float v = obd_voltage();
int x10 = v < 0 ? -1 : (int)(v * 10 + 0.5f);
if (x10 == shown_x10)
return;
shown_x10 = x10;
lv_color_t c = voltage_color(v);
lv_arc_set_value(volt_arc, x10 < 0 ? VOLT_MIN_X10 : constrain(x10, VOLT_MIN_X10, VOLT_MAX_X10));
lv_obj_set_style_arc_color(volt_arc, c, LV_PART_INDICATOR);
char buf[12];
if (x10 < 0)
strcpy(buf, "-- V");
else
snprintf(buf, sizeof(buf), "%d.%d V", x10 / 10, x10 % 10);
lv_label_set_text(volt_label, buf);
lv_obj_set_style_text_color(volt_label, c, 0);
}
static void update_idle()
{
static bool shown_idle = false;
bool idle = obd_is_idle();
if (idle == shown_idle)
return;
shown_idle = idle;
if (idle)
{
// screen off, animation paused, touches only wake up
lv_tileview_set_tile(tileview, tile_speed, LV_ANIM_OFF);
lv_gif_pause(bg_gif);
lv_obj_remove_flag(idle_overlay, LV_OBJ_FLAG_HIDDEN);
screen_switch(false);
}
else
{
lv_gif_resume(bg_gif);
lv_obj_add_flag(idle_overlay, LV_OBJ_FLAG_HIDDEN);
screen_switch(true);
}
}
static void update_speed()
{
static int shown = -2;
static String shown_status;
int v = obd_speed();
if (v != shown)
{
shown = v;
char buf[8];
if (v < 0)
strcpy(buf, "--");
else
snprintf(buf, sizeof(buf), "%d", v);
lv_label_set_text(speed_label, buf);
lv_label_set_text(speed_shadow, buf);
lv_arc_set_value(speed_arc, v < 0 ? 0 : min(v, SPEED_MAX));
}
String st = obd_status_text();
if (st != shown_status)
{
shown_status = st;
lv_label_set_text(status_label, st.c_str());
}
}
static void set_label(lv_obj_t *label, const String &text)
{
if (text != lv_label_get_text(label))
lv_label_set_text(label, text.c_str());
}
static void update_log()
{
bool on = can_log_enabled();
if (on == lv_obj_has_flag(rec_label, LV_OBJ_FLAG_HIDDEN))
{
if (on)
lv_obj_remove_flag(rec_label, LV_OBJ_FLAG_HIDDEN);
else
lv_obj_add_flag(rec_label, LV_OBJ_FLAG_HIDDEN);
}
if (on)
{
bool flash = (int32_t)(millis() - mark_shown_until) < 0;
set_label(rec_label, flash ? "MARK " + String(can_log_marks()) : "REC " + String(can_log_marks()));
lv_obj_set_style_bg_color(rec_label, flash ? lv_color_hex(0xFF9500) : lv_color_hex(0xFF3B30), 0);
}
if (lv_tileview_get_tile_active(tileview) != tile_log)
return;
set_label(log_toggle_label, on ? "Stop" : "Start");
set_label(log_status_label, can_log_status() + (on ? " marks " + String(can_log_marks()) : String()));
set_label(log_phase_label, on ? can_log_phase() : String());
String frames;
for (int i = 0; i < CANLOG_SLOTS; i++)
{
String f = can_log_frame(i);
if (f.length())
frames += (frames.length() ? "\n" : "") + f;
}
set_label(log_frames_label, frames);
}
static lv_obj_t *add_bg_item(const String &text, lv_color_t color, int idx)
{
lv_obj_t *btn = lv_list_add_button(bg_list, NULL, text.c_str());
lv_obj_add_event_cb(btn, on_bg_item_clicked, LV_EVENT_CLICKED, (void *)(intptr_t)idx);
lv_obj_set_style_bg_color(btn, lv_color_hex(0x222A33), 0);
lv_obj_set_style_pad_ver(btn, 6, 0);
lv_obj_set_style_text_color(btn, color, 0);
return btn;
}
static void update_bg_page()
{
String st = bg_status();
if (st != lv_label_get_text(bg_status_label))
lv_label_set_text(bg_status_label, st.c_str());
bg_get_list(bg_files, bg_list_version);
String sel = bg_selected();
String key = sel + "|" + bg_list_version;
if (key == bg_list_key)
return;
bg_list_key = key;
lv_obj_clean(bg_list);
add_bg_item(String("Built-in") + (sel.length() == 0 ? " (active)" : ""), sel.length() == 0 ? COLOR_ARC : COLOR_TEXT, -1);
for (int i = 0; i < (int)bg_files.size() && i < MAX_BG_ITEMS; i++)
{
const BgFile &f = bg_files[i];
bool active = f.name == sel;
String text = f.name + (active ? " (active)" : "") + "\n" + String(f.size / 1048576.0f, 2) + " MB " + f.w + "x" + f.h;
lv_color_t c = active ? COLOR_ARC : COLOR_TEXT;
if (f.w > 480)
{
text += " too wide";
c = COLOR_DIM;
}
else if (f.w != 360 || f.h != 360)
{
text += " not 360x360";
c = lv_color_hex(0xFF9500);
}
add_bg_item(text, c, i);
}
}
static void update_bg_source()
{
if (bg_release_requested())
{
// the stored GIF in flash is about to be overwritten: play the built-in one meanwhile
set_gif_source(&builtin_dsc);
bg_release_done();
}
if (bg_source_changed(bg_source_version))
apply_background();
}
static void update_menu()
{
String saved = obd_saved_name();
String addr = obd_saved_address();
String line = addr.length() ? "Saved: " + (saved.length() ? saved : String("(no name)")) + " " + addr
: String("No adapter saved - tap one below");
if (line != lv_label_get_text(menu_saved))
lv_label_set_text(menu_saved, line.c_str());
String st = obd_status_text();
if (st != lv_label_get_text(menu_status))
lv_label_set_text(menu_status, st.c_str());
if (!obd_get_devices(scan_devs, scan_version))
return;
// display order: OBD-like adapters first, then the rest (each in first-seen order)
menu_devs.clear();
for (auto &d : scan_devs)
if (d.obd_hint)
menu_devs.push_back(d);
for (auto &d : scan_devs)
if (!d.obd_hint)
menu_devs.push_back(d);
if ((int)menu_devs.size() > MAX_MENU_ITEMS)
menu_devs.resize(MAX_MENU_ITEMS);
String order;
for (auto &d : menu_devs)
order += d.address;
if (order != menu_order)
{
// order changed (new device or new OBD hint): rebuild the list
menu_order = order;
lv_obj_clean(menu_list);
menu_item_count = 0;
for (int i = 0; i < (int)menu_devs.size(); i++)
{
lv_obj_t *btn = lv_list_add_button(menu_list, NULL, "");
lv_obj_add_event_cb(btn, on_device_clicked, LV_EVENT_CLICKED, (void *)(intptr_t)i);
lv_obj_set_style_bg_color(btn, lv_color_hex(0x222A33), 0);
lv_obj_set_style_pad_ver(btn, 6, 0);
menu_items[i] = btn;
menu_item_count = i + 1;
}
}
for (int i = 0; i < menu_item_count; i++)
{
const ObdDevInfo &d = menu_devs[i];
lv_obj_t *label = lv_obj_get_child_by_type(menu_items[i], 0, &lv_label_class);
String text = (d.name.length() ? d.name : String("(no name)")) + "\n" + d.address + " " + d.rssi + " dBm";
if (text != lv_label_get_text(label))
{
lv_label_set_text(label, text.c_str());
lv_obj_set_style_text_color(label, d.obd_hint ? COLOR_OBD : COLOR_TEXT, 0);
}
}
}
void setup()
{
delay(200);
Serial.begin(115200);
// internal RAM is tight (draw buffers + BLE); put even small malloc blocks (LVGL objects, Strings) into
// PSRAM so the SD driver keeps enough DMA-capable memory. Explicit heap_caps allocations are not affected.
heap_caps_malloc_extmem_enable(64);
scr_lvgl_init();
setRotation(load_rotation());
build_ui();
obd_set_idle_timeout(load_idle_minutes());
can_log_begin();
obd_begin();
bg_begin();
apply_background();
if (obd_saved_address().length() == 0)
{
// first start: go straight to the adapter menu
lv_tileview_set_tile(tileview, tile_menu, LV_ANIM_OFF);
obd_scan_enable(true);
}
}
void loop()
{
static uint32_t last_speed = 0, last_menu = 0;
lv_timer_handler();
uint32_t now = millis();
if (now - last_speed >= 100)
{
last_speed = now;
update_speed();
update_voltage();
update_idle();
update_bg_source();
update_log();
if (lv_tileview_get_tile_active(tileview) == tile_bg)
update_bg_page();
}
can_log_serial_poll();
if (now - last_menu >= 500 && menu_visible())
{
last_menu = now;
update_menu();
}
vTaskDelay(1);
}
File diff suppressed because it is too large. Load diff
+51
View File
@@ -0,0 +1,51 @@
// ELM327-over-BLE link: remembers the selected adapter, auto-connects/reconnects and polls the vehicle speed.
// Runs in a background task; all functions are safe to call from the UI (loop) task.
#pragma once
#include <Arduino.h>
#include <vector>
enum class ObdState
{
NoDevice, // no adapter selected yet
Connecting, // BLE connect in progress
Initializing, // ELM327 init (ATZ, protocol search)
Running, // polling speed
Waiting, // connect/init failed or link lost; retrying shortly
};
struct ObdDevInfo
{
String address;
uint8_t addr_type;
String name;
int rssi;
bool obd_hint; // looks like an OBD adapter (name or service FFF0/FFE0/18F0)
};
void obd_begin();
ObdState obd_state();
int obd_speed(); // km/h, -1 = no data (ignition off / not connected)
String obd_status_text(); // short human-readable status line
float obd_voltage(); // battery voltage from ATRV (V), -1 = unknown
// Idle: after `minutes` without speed data (0 = never) polling stops; only ATRV every 30 s.
// Leaves idle by itself when the voltage shows the engine running (> 13.2 V), or via obd_wake().
void obd_set_idle_timeout(uint32_t minutes);
bool obd_is_idle();
void obd_wake();
String obd_saved_name(); // "" if none
String obd_saved_address();
// While logging is on (can_log.h) the link runs a read-only diagnostic scan of the car's modules;
// its progress survives restarts. This starts it over (applied the next time logging runs).
void obd_scan_reset();
// Menu: scan for adapters while the menu is open
void obd_scan_enable(bool on);
bool obd_get_devices(std::vector<ObdDevInfo> &out, uint32_t &version);
// Select (and remember) an adapter, or forget the remembered one
void obd_select_device(const ObdDevInfo &dev);
void obd_forget_device();
+42
View File
@@ -0,0 +1,42 @@
#include "sd_card.h"
#include <Arduino.h>
#include <SD_MMC.h>
#include "pincfg.h"
static int users = 0;
static SemaphoreHandle_t mutex()
{
static SemaphoreHandle_t m = xSemaphoreCreateMutex();
return m;
}
bool sd_acquire()
{
xSemaphoreTake(mutex(), portMAX_DELAY);
bool ok = true;
if (users == 0)
{
SD_MMC.setPins(SD_MMC_CLK_PIN, SD_MMC_CMD_PIN, SD_MMC_D0_PIN, SD_MMC_D1_PIN, SD_MMC_D2_PIN, SD_MMC_D3_PIN);
ok = SD_MMC.begin() && SD_MMC.cardType() != CARD_NONE;
if (!ok)
SD_MMC.end();
Serial.printf("[sd] mount %s, internal free %u largest %u, dma free %u largest %u\n", ok ? "ok" : "FAILED",
heap_caps_get_free_size(MALLOC_CAP_INTERNAL), heap_caps_get_largest_free_block(MALLOC_CAP_INTERNAL),
heap_caps_get_free_size(MALLOC_CAP_DMA), heap_caps_get_largest_free_block(MALLOC_CAP_DMA));
}
if (ok)
users++;
xSemaphoreGive(mutex());
return ok;
}
void sd_release()
{
xSemaphoreTake(mutex(), portMAX_DELAY);
if (users > 0 && --users == 0)
SD_MMC.end();
xSemaphoreGive(mutex());
}
+6
View File
@@ -0,0 +1,6 @@
// Shared SD card mount (SD_MMC, 4-bit), reference-counted so the background store and the CAN logger
// can use the card at the same time. Thread-safe.
#pragma once
bool sd_acquire(); // mounts the card on first use; false if there is no (working) card
void sd_release(); // unmounts when the last user is done
+69
View File
@@ -0,0 +1,69 @@
// Generated by tools/make_watch_dids.py from the DID scan logs (docs/canlog) - do not edit.
// PCM (0x7E0) DIDs with unknown meaning that are watched for changes: 327 of 389 supported.
#pragma once
#include <stdint.h>
struct WatchDid
{
uint16_t did;
uint8_t len; // reply data bytes (from the scan)
};
static const WatchDid WATCH_DIDS[] = {
{0x0117, 1}, {0x0118, 2}, {0x0119, 1}, {0x0202, 1}, {0x0300, 4}, {0x0301, 2},
{0x0302, 4}, {0x0303, 4}, {0x0304, 2}, {0x0307, 2}, {0x0308, 2}, {0x0309, 1},
{0x030A, 2}, {0x030B, 1}, {0x0310, 1}, {0x0311, 1}, {0x0315, 2}, {0x0316, 2},
{0x0317, 2}, {0x0318, 2}, {0x0319, 2}, {0x031A, 2}, {0x031B, 2}, {0x031E, 2},
{0x0320, 1}, {0x0324, 2}, {0x032B, 1}, {0x0334, 2}, {0x0338, 2}, {0x033C, 2},
{0x033E, 2}, {0x033F, 2}, {0x0345, 4}, {0x0348, 2}, {0x034E, 2}, {0x0353, 2},
{0x0355, 2}, {0x0356, 2}, {0x0357, 2}, {0x035A, 2}, {0x035D, 4}, {0x035F, 2},
{0x0371, 4}, {0x0382, 1}, {0x0388, 1}, {0x0389, 4}, {0x038A, 1}, {0x038E, 2},
{0x038F, 2}, {0x0390, 4}, {0x0391, 4}, {0x0393, 2}, {0x0394, 4}, {0x03A0, 2},
{0x03A1, 1}, {0x03A7, 1}, {0x03A8, 4}, {0x03A9, 4}, {0x03AA, 4}, {0x03AC, 2},
{0x03AD, 4}, {0x03AF, 1}, {0x03B1, 2}, {0x03B3, 1}, {0x03B5, 2}, {0x03BA, 2},
{0x03BB, 2}, {0x03BC, 2}, {0x03BD, 2}, {0x03C0, 1}, {0x03C7, 2}, {0x03C9, 2},
{0x03CA, 1}, {0x03CD, 1}, {0x03CF, 1}, {0x03D1, 2}, {0x03D3, 2}, {0x03D4, 2},
{0x03D7, 2}, {0x03D8, 2}, {0x03D9, 2}, {0x03DA, 2}, {0x03DC, 2}, {0x03E8, 2},
{0x03EC, 2}, {0x03EF, 2}, {0x03FD, 2}, {0x0403, 2}, {0x0409, 1}, {0x0414, 4},
{0x0416, 4}, {0x0418, 2}, {0x0427, 1}, {0x0429, 2}, {0x045C, 4}, {0x0461, 2},
{0x0462, 2}, {0x0464, 1}, {0x0465, 1}, {0x0466, 2}, {0x046D, 2}, {0x046F, 1},
{0x0470, 1}, {0x0474, 1}, {0x04A9, 4}, {0x04F7, 2}, {0x051B, 2}, {0x0546, 4},
{0x0547, 1}, {0x054B, 1}, {0x054F, 2}, {0x0551, 2}, {0x0552, 2}, {0x0554, 2},
{0x057D, 1}, {0x057E, 1}, {0x0580, 1}, {0x0590, 4}, {0x0591, 4}, {0x0594, 2},
{0x0598, 2}, {0x0599, 1}, {0x059A, 1}, {0x05AB, 2}, {0x05AC, 1}, {0x05AD, 1},
{0x05AE, 1}, {0x05B7, 4}, {0x05B8, 2}, {0x05BB, 4}, {0x05CB, 1}, {0x05E1, 4},
{0x05E2, 1}, {0x05E3, 1}, {0x05E4, 1}, {0x05E5, 4}, {0x05E6, 4}, {0x05E7, 4},
{0x05E8, 4}, {0x05E9, 4}, {0x05FB, 4}, {0x05FC, 2}, {0x05FD, 2}, {0x061B, 2},
{0x0629, 2}, {0x062A, 2}, {0x062E, 2}, {0x062F, 1}, {0x0630, 1}, {0x0639, 2},
{0x063B, 2}, {0x063C, 2}, {0x063D, 2}, {0x063E, 2}, {0x0651, 1}, {0x0654, 1},
{0x0655, 2}, {0x0700, 4}, {0x0703, 4}, {0x0707, 1}, {0x0914, 2}, {0x0915, 2},
{0x0917, 2}, {0x0918, 2}, {0x091A, 2}, {0x091B, 1}, {0x093C, 2}, {0x099B, 2},
{0x09CD, 1}, {0x1126, 1}, {0x1166, 2}, {0x1167, 2}, {0x116B, 2}, {0x1279, 2},
{0x1505, 2}, {0x16D3, 2}, {0x16D4, 2}, {0x16D7, 2}, {0x16D8, 1}, {0x16DC, 2},
{0x1E01, 4}, {0x1E04, 4}, {0x1E09, 2}, {0x1E0A, 2}, {0x1E0C, 1}, {0x1E0D, 1},
{0x1E0E, 1}, {0x1E0F, 1}, {0x1E10, 1}, {0x1E11, 2}, {0x1E12, 1}, {0x1E13, 2},
{0x1E14, 2}, {0x1E15, 2}, {0x1E16, 2}, {0x1E17, 1}, {0x1E18, 4}, {0x1E19, 2},
{0x1E1A, 2}, {0x1E1B, 2}, {0x1E1C, 2}, {0x1E1D, 2}, {0x1E23, 1}, {0x1E28, 1},
{0x1E29, 2}, {0x1E2A, 2}, {0x1E2B, 2}, {0x1E2D, 2}, {0x1E2E, 1}, {0x1E33, 2},
{0x1E35, 2}, {0x1E36, 2}, {0x1E37, 2}, {0x1E39, 4}, {0x1E3A, 2}, {0x1E3C, 2},
{0x1E3D, 2}, {0x1E46, 1}, {0x1E4D, 2}, {0x1E53, 2}, {0x1E54, 2}, {0x1E55, 2},
{0x1E56, 2}, {0x1E59, 2}, {0x1E5E, 1}, {0x1E60, 1}, {0x1EF8, 2}, {0x1EF9, 2},
{0x1EFA, 2}, {0x2028, 2}, {0x2029, 2}, {0x2872, 2}, {0x2873, 2}, {0x2874, 1},
{0x2B00, 4}, {0x3B40, 4}, {0x9800, 2}, {0x9801, 4}, {0x9863, 1}, {0x9864, 2},
{0x986B, 4}, {0xA45F, 4}, {0xC011, 4}, {0xC012, 4}, {0xC1A3, 4}, {0xD002, 2},
{0xD003, 4}, {0xD005, 4}, {0xD006, 4}, {0xD014, 4}, {0xD015, 4}, {0xD100, 1},
{0xD127, 2}, {0xD134, 1}, {0xD137, 1}, {0xD980, 4}, {0xFD00, 2}, {0xFD01, 2},
{0xFD02, 2}, {0xFD03, 2}, {0xFD04, 2}, {0xFD05, 2}, {0xFD06, 2}, {0xFD07, 2},
{0xFD08, 2}, {0xFD09, 2}, {0xFD0A, 2}, {0xFD0B, 2}, {0xFD0C, 2}, {0xFD0D, 2},
{0xFD10, 2}, {0xFD11, 2}, {0xFD12, 2}, {0xFD13, 2}, {0xFD14, 2}, {0xFD15, 2},
{0xFD16, 2}, {0xFD17, 4}, {0xFD18, 4}, {0xFD19, 2}, {0xFD1A, 2}, {0xFD1B, 2},
{0xFD1C, 2}, {0xFD1D, 2}, {0xFD1E, 2}, {0xFD1F, 2}, {0xFD20, 2}, {0xFD21, 2},
{0xFD22, 2}, {0xFD23, 2}, {0xFD24, 2}, {0xFD25, 2}, {0xFD26, 2}, {0xFD27, 2},
{0xFD28, 2}, {0xFD29, 2}, {0xFD2A, 2}, {0xFD2B, 2}, {0xFD2C, 2}, {0xFD2D, 2},
{0xFD2E, 2}, {0xFD2F, 1}, {0xFD33, 2}, {0xFD34, 2}, {0xFD35, 2}, {0xFD36, 2},
{0xFD37, 2}, {0xFD38, 2}, {0xFD39, 4}, {0xFD3A, 4}, {0xFD40, 2}, {0xFD41, 2},
{0xFD4A, 2}, {0xFD4B, 2}, {0xFD4C, 2}, {0xFD4D, 2}, {0xFD5D, 2}, {0xFD5E, 2},
{0xFD5F, 2}, {0xFD60, 2}, {0xFD61, 2}, {0xFD62, 1}, {0xFD63, 2}, {0xFD64, 4},
{0xFD66, 4}, {0xFE24, 2}, {0xFE25, 2},
};
static const uint16_t WATCH_COUNT = sizeof(WATCH_DIDS) / sizeof(WATCH_DIDS[0]);
Loaded 100 of 114 files, more files were not shown because too many files have changed in this diff. Show more