; K-Line — Multi-protocol automotive bus interface (ESP32) ; BMW I/K-Bus (optocoupler) + OBD-II K-line (transistor/optocoupler) ; Based on muki01/I-K_Bus (MIT), ported for ESP32 with R2=220 fix [platformio] default_envs = esp32dev [env] platform = espressif32 framework = arduino monitor_speed = 115200 upload_speed = 921600 lib_deps = build_flags = -DIBUS_DEBUG -DIBUS_RX_BUFFER_SIZE=256 -DIBUS_TX_BUFFER_SIZE=128 -DIBUS_IDLE_TIMEOUT_US=1500 -DIBUS_PACKET_GAP_MS=10 ; =================================================================== ; BMW I/K-Bus sniffer environments (main.cpp) ; =================================================================== ; --- ESP32 (classic, dual-core) --- ; GPIO 16/17 are UART2 defaults, free on most devkits [env:esp32dev] board = esp32dev build_src_filter = + build_flags = ${env.build_flags} -DIBUS_RX_PIN=16 -DIBUS_TX_PIN=17 -DIBUS_LED_PIN=2 -DIBUS_UART_NUM=1 ; --- ESP32-C3 (single-core RISC-V) --- ; GPIO 4/5 are general-purpose; GPIO 8 is onboard LED on most C3 devkits [env:esp32-c3] board = esp32-c3-devkitm-1 build_src_filter = + build_flags = ${env.build_flags} -DIBUS_RX_PIN=4 -DIBUS_TX_PIN=5 -DIBUS_LED_PIN=8 -DIBUS_UART_NUM=1 ; --- ESP32-S3 (dual-core, USB native) --- ; GPIO 15/16 free on S3-DevKitM; GPIO 48 is RGB LED [env:esp32-s3] board = esp32-s3-devkitm-1 build_src_filter = + build_flags = ${env.build_flags} -DIBUS_RX_PIN=15 -DIBUS_TX_PIN=16 -DIBUS_LED_PIN=48 -DIBUS_UART_NUM=1 ; =================================================================== ; OBD-II K-line scanner environment (obd2_scanner.cpp) ; =================================================================== ; Uses same ESP32 devkit — different sketch and protocol config. ; KLINE_TX_INVERT=0 for transistor circuit (Tucker k-line-board). ; Set to 1 if using PC817 optocoupler interface. [env:obd2-scanner] board = esp32dev build_src_filter = + build_flags = ${env.build_flags} -DIBUS_RX_PIN=16 -DIBUS_TX_PIN=17 -DIBUS_LED_PIN=2 -DIBUS_UART_NUM=1 -DKLINE_TX_INVERT=0