# Changelog This file records the changes ESCargot Express makes relative to upstream VESC® Express (vedderb/vesc_express), starting from the last merged upstream commit 8d89cd7d2 (previously 8529f16c6). The "Merged from upstream" section lists what that merge brought in. Upstream keeps no changelog of its own. VESC® is a registered trademark of Benjamin Vedder, and this project is not affiliated with or endorsed by him; see [TRADEMARKS.md](TRADEMARKS.md). ### ESCargot #### Unreleased * Release firmware: * ESCargot releases ship firmware for VESC Express T, Rmcore, S3 N16R8, P4 NRW32N16, P4 NRW32N16C6, WS S3 Touch LCD 4, WS P4 Touch LCD 4.3 and WS S3 SIM7670G (the LTE board: cellular, camera, CAN bridge), listed in tests/release/boards.txt and built by tests/release/build.sh in the .#idf shell. ESCargot Tool downloads them with its controller firmware; its Firmware page lists and updates any of them, P4 boards included, and its ESP programmer page flashes any of them over serial. Other boards build from source. * ESP32-C3 builds compile the ESP-IDF components that do not run against a deadline for size: the NimBLE host, the WiFi supplicant, FAT, SD, NAND and NVS storage, the SPI, I2C, LEDC and ADC drivers, the LCD glue, the netif, esp-tls, event and VFS layers, core dumps, eFuse, OTA and partitions. VESC Express T has 54,800 bytes of its app partition free instead of 64, Rmcore 83,248 instead of 29,088, and the Lua build of the T 223,584 instead of 172,816. FreeRTOS, the heap, lwIP, the WiFi glue, the UART, USB-serial, TWAI, GPIO and RMT drivers stay at -O2. * Release and CI builds fail an image that leaves less of its app partition free than its floor in tests/release/margins.txt: 16 kB for VESC Express T and Rmcore, each engine. CI builds Rmcore as well. * Upgrading: * Built on ESP-IDF 6.1 instead of 5.5.4, following upstream. Update over serial where possible, writing bootloader, partition table and application together. An application built on 6.1 booted by a 5.5.4 bootloader, which is what an over-the-air update produces, has not been tested on any board here. * Bluetooth is now NimBLE rather than Bluedroid. Bonds made under Bluedroid are not carried over: a phone or VESC® Tool paired before the update has to forget the device and pair again. * Upstream split the BLE setting into a comm link mode and a scripting mode, which changes main_config_t and MAIN_CONFIG_T_SIGNATURE (now 1939098293). The app configuration is reset to defaults on the first boot after the update. The CAN ID and baud rate are kept, through upstream's fix for reading a stored configuration of a different size. * The firmware reports upstream's version, 7.00. ESCargot Tool lists 7.00 among the versions its parameter set supports, so the device is not put in limited mode. * Several targets change partition table to make room for core dumps. A partition table cannot be written by a firmware upload over the comm link, only over serial, so a board updated over the air keeps its old table and runs without core dumps until it is reflashed over serial. * ESP32-C3 boards move from partition_ota_4mb.csv to partition_ota_4mb_coredump.csv. The coredump (64 kB) and crashlog (64 kB) partitions use flash that was unallocated, so no existing offset moves and the configuration and uploaded script survive the change. * S3 N16R8, P4 NRW32N16 and P4 NRW32N16C6 move from partition_ota_16mb.csv to partition_ota_16mb_coredump.csv. Offsets before storage are unchanged, but storage shrinks from 4096 kB to 3776 kB to make room for coredump (64 kB) and crashlog (256 kB, four archived dumps). Expect the storage filesystem to need reformatting. * The 4 MB S3 targets (Devkit S3 FH4, Avaspark RGB V3, rESCue S3, S3 FH4R2) and the C6 devkits keep their tables and do not have core dumps enabled. * OTA rollback (sdkconfig.hub_mtls only) needs a bootloader built with CONFIG_BOOTLOADER_APP_ROLLBACK_ENABLE, which also has to be written over serial. Until then the rollback is inactive, with no reboot-loop risk. * The mutual-TLS hub keeps its credentials in a separate NVS namespace, so it does not touch main_config_t itself. Existing hub identities and paired tools are expected to survive the update to IDF 6.1, because the stored formats (DER key, PEM certificate, raw rendezvous secret) did not change. That has not been checked on a device yet. * Script sockets: * TLS for tcp-connect: an optional third argument verifies the server by a CA certificate (PEM) or pins its certificate's SHA-256 fingerprint, or says "insecure"; an optional fourth gives the name to verify and send as SNI. Leaving it out is plain TCP, as before. At most two TLS sockets at once; on the ESP32-C3 the server is asked for 1 kB records (max fragment length), and the session uses TLS 1.2. * Lua bindings vesc.tcp_connect, tcp_send, tcp_recv, tcp_recv_to_char, tcp_status and tcp_close, over the same socket registry as the LispBM tcp-* extensions, with the same socket numbers and TLS argument. Also vesc.get_mac_addr, can_local_id, sysinfo, gnss_lat_lon, gnss_hdop and gnss_age. * tcp-send, tcp-recv and tcp-recv-to-char only act on sockets the script opened with tcp-connect; upstream's used any descriptor number given to them. Closing a socket while a tcp-recv waits on it is safe. * tcp-connect reaches hosts that have only an IPv6 address, and works on an IPv6-only network: it asks for IPv4, then IPv6, and connects to each in turn. Builds without IPv6 resolve IPv4 as before. * tcp-connect gives up after 3 s. Upstream's waited out the network stack's retries, about 20 s against an address nobody answers from, and held every script on the board meanwhile. * tcp-send on a plain socket gives up after 10 s with nothing taken, as a TLS one already did. Upstream's waited for as long as the peer took, holding every script on the board meanwhile: minutes, for a peer gone out of WiFi range. * A TLS pin may name an intermediate certificate in the chain the server sends rather than the server's own. A server certificate renewed every 60 to 90 days then keeps matching for as long as its intermediate lives, about a year. Everything below a pinned intermediate must verify -- each certificate signed by the one above, in date, and the server's for the host dialled -- since anyone can send a public intermediate. A pin on the server's own certificate means what it did. * The Waveshare ESP32-S3-SIM7670G has full-size TLS records (16 kB in, 4 kB out), which a broker with an RSA-4096 certificate chain needs; other C3-sized builds keep 1 kB. * ESP32-C3 builds drop the SECP521R1, SECP256K1 and Brainpool curves, TLS renegotiation and ALPN from mbedTLS to make room. * Lua script engine: * Lua 5.4.7 in 32-bit mode as an alternative to LispBM, selected at build time with -DSCRIPT_ENGINE=lua. LispBM remains the default, and a build contains one engine or the other. * Uses the existing script container and COMM_LISP_* packets. Bit 0 of the container's previously unused flags word records the language, so VESC® Tool's upload, erase, run/stop, stats and REPL work unchanged. A container in the other language is refused with an explanation. * The engine core (script_lua.c, script_pack.c, script_event.h) is shared byte-for-byte with the ESCargot controller firmware and has no firmware dependencies. The host supplies print, the stop poll, the tick and optionally the allocator through a config struct. * Sandboxed: io, os, package, debug and utf8 are not compiled in, and dofile, loadfile, load and collectgarbage are removed. Scripts are interruptible through an instruction-count hook, and memory is capped in the allocator, so a runaway script fails its own allocation. The ceiling is 1 MB on boards with PSRAM and 192 kB otherwise. * The container's size and CRC are validated before it is trusted, and import offsets are bounded by the container rather than by the partition. * Event handlers vesc.on_can, vesc.on_app_data, vesc.on_timer and vesc.on_touch, delivered through a non-blocking queue drained by the engine task. A full queue drops the event and counts it (vesc.events_dropped()); a handler that raises is reported and stays registered. * Bindings for system, GPIO, ADC, EEPROM (same slot numbering as LispBM), CAN status getters and setters, UART, I2C, BMS, WiFi, PWM, configuration (conf_get/set/store/keys), colours, drawing, panel loading for twelve display controllers, all six touch controllers, prepared-font text rendering, the log ring and touch statistics. canget_* return nil for an id that has not reported, and canset_* validate the id instead of letting it wrap to another unit. * Binary assets can be packed into the container and read with vesc.asset(name), which is how fonts travel with a script. * Text measurement and glyph placement truncate the way LispBM's ttf-text-dims does, so a view ported from LispBM renders at the same positions. * The REPL runs on the engine task rather than the comm task, and tries the input as an expression first. * The REPL has :help, :info, :reset and :stop, as the LispBM REPL and the controller's Lua REPL have. * vesc.f_read (binary) and vesc.f_readline read files on the SD card, and vesc.can_cmd sends a command to a controller over CAN, which is what a Lua script needs to play tunes from the card. * vesc.on_bms_cmd: VESC Tool's BMS commands (charge allowed, force balance and the rest) reach a script that plays the part of a BMS, as event-bms-* does in LispBM. Shared with the controller firmware. * The WS S3 Touch LCD 4 builds with Lua, its board functions (display, touch pins, backlight) in both engines. * tools/luapack.py packs Lua (following require) and LispBM projects (following import) into the container byte-for-byte as VESC® Tool does, with --asset and --import-root. The API is documented in doc/lua.md, and examples/lua/dash.lua is a working dash page. * Display stack and drivers: * ST7701 over parallel RGB with 3-wire SPI configuration on the ESP32-S3 (disp-load-st7701-rgb), alongside the existing MIPI-DSI ST7701 driver. * An engine-neutral display registry, so both engines know which panel is loaded. The panel drivers no longer depend on LispBM; only their LispBM extension wrappers do. * Prepared-font readers (main/display/ttf_font.c), colour arithmetic (main/display/color_core.c) and the touch driver core (main/touch/touch_core.c) are factored out of the LispBM extensions and shared by both engines. LispBM touch-read and touch-read-all now build their lists after releasing the touch lock. * The MIPI-DSI ST7701 driver reports an initialisation failure to the caller instead of aborting the firmware, and keeps one scratch buffer instead of allocating up to 750 kB twice per render. * The RGB render path converts and pushes an image a band at a time, so full-width images taller than the scratch buffer are no longer silently dropped. Buffers handed to the panel are 64-byte aligned. * The GT911 initialiser probes both of the part's I2C addresses (0x5D and 0x14). * Added disp-cmd, which writes a panel register at runtime, and disp-bl, which sets the backlight. * Fixed touch-load-xpt2046 not compiling on targets with two SPI peripherals, which broke every C3 build, and the RGB panel header failing to compile on C3 and C6. * Clay layout: * clay-layout takes a screen description as data and returns positioned rect and text drawing commands, so one description fits panels of different sizes. Clay is vendored unmodified at e6cc3694 (zlib licence). * Sizing by grow, fit, fixed and percentage (pct), with padding, per-axis padx/pady, gaps, alignment, borders and clipping. * An element given (id N) tags every command it and its children produce, for hit testing and repainting single elements. * Built only for ESP32-S3 and ESP32-P4 (HW_USE_CLAY), since it costs about 80 kB of flash. On those targets the LispBM evaluator stack grows from 3072 to 16384 bytes, which Clay's recursive layout needs. * Clay's property symbols are interned when the extension is registered. Interning them on first layout failed once the image was sealed, and every clay-layout call then returned eval_error. * LispBM lbm_ttf_measure exposes text measurement to C; ttf-text-dims output is unchanged. * Crash dumps and diagnostics: * ELF core dumps to flash are on by default for ESP32-C3, the 16 MB S3 and P4 targets and the WS P4 Touch LCD 4.3. Three C3 boards opt out because the code does not fit their application partition: BMS RB, VBMS16 and VBMS-INF-SAT. They keep the coredump partition, so enabling dumps later needs no table change. * Terminal commands crash (summary with task, pc, trap registers and the application SHA256; on Xtensa a device-generated backtrace), crash erase and crash test. * COMM_CRASH_DUMP (161) reads a dump over whichever link is connected, with LIST, INFO, READ and ERASE. INFO reports the crashed build's ELF SHA256 so a client can find the matching symbols. Reading never erases. * Older dumps are archived at boot into a crashlog ring partition (one slot on 4 MB boards, four on 16 MB), deduplicated by CRC. Index 0 is the live dump, 1 upwards are archived dumps, newest first. * The Express asks each controller on the CAN bus for its crash report and keeps it in NVS, so it outlives the controller losing power (CONFIG_VESC_CRASH_COLLECT). Only controllers are asked, not other Express boards. Collected reports are listed, read and erased with COMM_CRASH_COLLECTED (163) and the crash_can terminal command. * Crash reports and archived core dumps are sealed to an owner list of up to four public keys, using ECDH on P-256, HKDF-SHA256 and AES-256-GCM (CONFIG_VESC_CRASH_SEAL). The firmware cannot reopen what it stored. Owners are managed with crash_owner or provisioned over the hub. With no owner provisioned, reports are stored in clear and the log says so. * main/log_ring.c keeps the last 64 log lines from commands_printf, the ESP-IDF log and script print, including lines printed before commands_init. Read them with the log terminal command, (log-lines), (log-dropped), (log-add) or vesc.log_lines(). * The reset reason is reported at boot, and the hub's dial and handshake paths report heap figures and the step that failed. * Terminal commands clay_diag and lisp_mem, which shows the LispBM image and const heap. * LispBM runtime extensions (mem-size, mem-num-free, mem-longest-free, symtab-size, lbm-heap-state) are registered on the S3 and P4 targets. * (touch-stats) and vesc.touch_stats report touch read counts and failures, since a failed read otherwise looks the same as no touch. * Hub access over mutual TLS: * An end-to-end encrypted alternative to the plaintext hub protocol, which sent a reusable password in the clear. The device generates its own P-256 keypair and self-signed certificate, and the private key never leaves it. * The device is the TLS server. It dials a relay that pairs two TCP connections by an HKDF-derived rendezvous token using the magic-wormhole transit format, so the relay operator holds no key and sees no plaintext. * Trust is pinning: the device keeps an allowlist of paired VESC® Tool certificates. * Provisioned over COMM_HUB_PROVISION (160), with STATUS, KEYGEN, GET_DEV_CRT, SET_HUB_CRT, ADD_TOOL, CLEAR_TOOLS, GET_RENDEZVOUS, ADD_OWNER, LIST_OWNERS and ERASE. ERASE also clears the crash-report owner list. * A board uses the TLS path once it has credentials; boards without them keep the plaintext protocol. * The parked relay connection uses TCP keepalive. Without it, NAT reaped the idle connection, and the redial churn made firmware uploads fail part way. The hub waits for the station to associate before dialling, and backs off from 1 s to 30 s. * Pairing fits on a C3. Keygen runs on its own 5 kB task and writes the key as DER, and a keygen that fails after its first write erases the partial identity. Provisioning cannot run while the hub client holds its TLS session; the error says to disable use_tcp_hub, reboot, pair and re-enable it. * When use_tcp_hub is set, LispBM no longer expands its heap into memory freed by a disabled radio, which had left about 7 kB of internal heap and made every TLS handshake fail. * sdkconfig.hub_mtls trims mbedTLS to the one cipher suite family and curve used, and enables OTA rollback: a new image is confirmed once the station gets an IP address, and reverted after three minutes otherwise. * Friends: a paired tool is an owner or a friend. A friend's hub session may read everything, change settings and drive the motor, but not install or run code (firmware, bootloaders, scripts, QML, the terminal, raw CAN, file writes) or change who may connect. Every packet ID has a class, an unclassified one is refused, and a forwarded packet is judged by what it carries. A session that cannot be identified is held to the friends' rules. * Friends are a second allowlist, joined to the owners' for TLS and told apart afterwards by the SHA-256 of the client certificate. Firmware without them ignores that list, so a downgrade locks friends out rather than promoting them. * New provisioning sub-commands: ADD_FRIEND, LIST_TOOLS and REMOVE_TOOL, which revokes one tool by fingerprint. The last owner cannot be removed or made a friend. A removal takes effect at once: the allowlist is reread when a peer joins, and a removed tool's hub session is ended. * A certificate is parsed when it arrives, on a task of its own, so junk is refused when sent rather than at the next handshake. Fingerprints are computed from the decoded DER without parsing, which pairing over USB needs: on IDF 6.1 a parse overflowed the 3 kB USB task at the first request and panicked the board. * OTA rollback confirms a new image on a packet from a client over USB, BLE, local TCP or the hub, as well as on a WiFi address. * Once the Tool on the other end sends heartbeats, 20 s without a packet ends the hub session and the board goes back to waiting at the relay, so a phone that dropped off a mobile network does not leave the board unreachable for as long as the carrier holds the connection. * CONFIG_VESC_HUB_MTLS (default on) lets a board leave the hub out. It is off on VBMS32, VDisp 900 and Rmcore, which have no use for it, and that returns about 117 kB of flash. * Board support and sdkconfig overlays: * Waveshare ESP32-P4-WIFI6-Touch-LCD-4.3 (WS P4 Touch LCD 4.3): ST7701 over 2-lane MIPI-DSI, GT911 touch, CAN, SD card, and WiFi through the ESP32-C6 co-processor over SDIO (esp_hosted). It uses the full 32 MB flash with everything the firmware reads back below 16 MB, and a 23 MB internal filesystem (f-connect-storage). The first mount formats the partition and the board stops answering for several minutes while it does. The C6 runs a mismatched esp-hosted slave; WiFi works in the fallback mode, and doc/p4-coprocessor-ota.md describes the update. * Waveshare ESP32-S3-Touch-LCD-4 Rev4.0 (WS S3 Touch LCD 4): ST7701 over RGB, GT911 touch, and panel power, resets and backlight through the CH32V003 expander. The backlight duty is inverted (0 is full brightness), and the buzzer bit is never set. Code runs from PSRAM (CONFIG_SPIRAM_XIP_FROM_PSRAM) so that flash writes do not stop the panel refresh. At bring-up, colour levels on this panel were washed out, including the controller's own test pattern, and no fix has been recorded since. * A per-board overlay sdkconfig.board., named after the hardware header, is applied after the target's defaults, and EXTRA_SDKCONFIG overlays from the command line after that. The README describes the layers and the sdkconfig shadowing trap. * Overlays: sdkconfig.hub_mtls, sdkconfig.debug_console, sdkconfig.bringup_uart, sdkconfig.bringup_console and sdkconfig.bringup_coredump. * Under IDF 6.1 the target defaults are upstream's minimal configurations with the fork's core dump settings on top, and the two Waveshare boards are their base file plus a few lines rather than full dumped configurations. * VBMS-INF-MAS, added upstream, builds without core dumps (sdkconfig.board.vbms_inf_mas). With them it overflowed its application partition by 1,904 bytes. * A build directory regenerates its sdkconfig when the content of a defaults file or overlay changes, as well as when the board changes. An overlay edit used to be silently ignored by a build directory that already had a config. * The Bluetooth controller's memory is released when BLE is disabled. * comm_block's stack goes from 2,500 to 4,096 bytes on every target, and the UART receive task's from 3 kB to 5,120 bytes. Both overflowed in practice. * COMM_UART_BAUD is a build option for boards whose header defers to it, with 115200 as the default. * Cellular: * A board with an LTE modem reaches the hub over the mobile network, PPP over a CMUX channel through esp_modem, and uses WiFi when it has it. The bring-up is a state machine on standard 3GPP 27.007 commands (SIM, registration, signal, attach), so another modem needs a list of setup commands rather than new code; it is host-tested against a simulated modem with three modems' quirks. * A modem's GNSS fixes feed the same position the u-blox receiver does, so the logger and scripts see them; and CAN GNSS goes out from either. * Terminal: modem_status, and modem_apn to set the access point name. * Data over an IPv6-only network. Google Fi's data APN gives an IPv6 address and no IPv4 whatever is asked for, and PPP was torn down at IPCP. The Waveshare board now runs IPv6 over PPP with address autoconfiguration and DNS from router advertisements, and counts data as up on a global IPv6 address. modem_pdp IP, IPV6 or IPV4V6 sets the context type, kept in NVS. * The hub client dials the relay over IPv4, then IPv6, so a board with no IPv4 route reaches it through the relay's IPv6 address. hub_ipv6 first or last swaps the order until a reboot, to try the cellular path with WiFi still up. * Terminal: modem_at sends one AT command and prints its reply, and modem_status lists the last twelve PPP phase and error events and the IPv6 addresses PPP holds. * First board: Waveshare ESP32-S3-SIM7670G-4G (CONFIG_ESCARGOT_MODEM, sdkconfig.board.ws_s3_sim7670g): modem power and UART, CAN through an external transceiver, its TF card on the one-bit SD bus it is wired for, and its MAX17048 battery gauge, read with the gauge terminal command, (batt-gauge) and vesc.batt_gauge(). Not yet run on the board. * A WiFi hotspot over LTE on the Waveshare board: wifi_hotspot on (kept) keeps the configured access point up and routes its clients out through the house WiFi when the station has it, or else the modem. Its clients are IPv4, and an IPv6-only network such as Google Fi's carries them through a CLAT (the client side of 464XLAT, RFC 6877): IPv4 NAT'd to 192.0.0.2 leaves as IPv6 to the carrier's NAT64 at 64:ff9b::/96, sized for IPv6's 1280-byte minimum; the board's own IPv4 goes the same way. The modem's UART runs at 921600 rather than 115200, which carried about 10 kB/s each way and left a phone on the hotspot with no internet. modem_status shows the translator's counters; wifi_hotspot shows the clients and NAT. Only in builds with NAPT (sdkconfig.board.ws_s3_sim7670g). * CAN bridge (CONFIG_ESCARGOT_CAN_BRIDGE, on the Waveshare board): can_bridge on (kept) makes the board a node on a CAN bus it is not wired to, through an Express that is on it running pkg/can_bridge, over TCP 65110 on WiFi -- the Waveshare's hotspot or any shared network. Frames from the bus enter its receive path as if from a wire, and what it sends goes back over the bridge; the bus end lets only the node's own broadcasts and pings onto the bus, and commands to a controller only if allowed there. Telemetry only. The hotspot moves to 192.168.71.1/24, away from the 192.168.4.1 every Express gives its own access point. * BLE link to a motor controller (CONFIG_ESCARGOT_BLE_LINK, on the Waveshare board), for a vehicle with no Express: ble_link connect (kept) finds the controller's BLE serial module by scanning, connects as a central and speaks the VESC packet protocol over it, framed as on a UART, the way VESC Tool's mobile app does; reconnects after a drop. Nordic UART, HM-10 (FFE0), FFF0 and Microchip transparent UART modules; ble_link scan lists what is in range. The controller is reached as a CAN node would be: a buffer for its id goes as one packet and its answer comes back as over CAN, so forwarding from the Tool and the hub, scripts' can-cmd and the crash collector reach it unchanged; a ping for it is answered; its values are polled at 5 Hz and enter the CAN receive path as its status 1-5 frames, so the logger, ha_mqtt and canget-* read it. Reads, to the controller or as COMM_FORWARD_CAN through it to other ids; settings only with ble_link cmds on; setpoints, detection, code, shutdown, reboot and CAN baud never. Run on the bench through a VESC NRF51 module on a 75_100_V2. Experimental: with pkg/can_bridge_uart on the controller the rest of its bus crosses too, as the CAN bridge's records in app data; on an NRF51 module this hung the module within minutes, so it needs an NRF52-class module, or a controller with no script that evaluates app data. * With bldc firmware that knows COMM_QUIET (167), the link wraps its polls and the packets it passes on in it, so the controller's prints stay where they were instead of following the polls onto the radio. Found out on each connection: with older firmware it polls plainly. A link that hears nothing for 10 s while polling is dropped and redialled, for a module that hangs while its radio keeps the connection. * Camera (CONFIG_ESCARGOT_CAMERA, on the Waveshare ESP32-S3-SIM7670G): its DVP connector through Espressif's esp32-camera, pulled in for that board only. The sensor is found at run time (an OV5640 on the board here; the OV2640 and the others esp32-camera knows are untested), one JPEG at a time: the driver is started for each picture and stopped after it, the sensor put in its own standby (the board wires neither PWDN nor RESET to a GPIO), the frame buffer in PSRAM. Its SCCB is a second device on the battery gauge's I2C bus rather than a bus of its own. Sizes qqvga to 5mp as the sensor allows, quality 1-100; about 1.3 s a picture at VGA and 3.5 s at UXGA, 0.75 s of it starting the sensor; 12 kB at VGA, 40 kB at SXGA and 55 kB at UXGA, quality 80. XCLK is 10 MHz: at 20 the pixel clock outran the DMA into PSRAM and larger pictures came out garbled. * LispBM: (camera-snap "/sdcard/x.jpg" [size] [quality]) writes the file and gives its length; (camera-snap [nil size quality]) gives the JPEG as a byte array, refused as too-large over 96 kB or a third of the longest free block of LispBM memory; (camera-info) gives the sensor, its state and the last picture. Only the calling context waits for a picture. Errors are symbols: no-camera, timeout, no-memory, bad-size, file-error, too-large, busy, driver-error. * Lua: vesc.camera_snap(path|nil, size, quality) and vesc.camera_info(), the same, with nil and the error's name. * Terminal: camera_snap [path|auto] [size] [quality], auto being the next free /sdcard/cam/IMG_nnnn.jpg; camera_info. * The board's VSYNC is IO42, so CAN RX is on IO1 (header P2-9) instead, pulled up so it reads an idle bus with no transceiver wired; on IO42 a transceiver and the camera would both drive the pin. With no transceiver the CAN controller never sees its own frames and goes bus-off about once a second (64 recoveries in the first 74 s), so on this board recovery waits while nothing is heard: 1 s, doubling to 30 s, back to at once when a frame arrives. * A viewer's feed, COMM_CAMERA (168), for ESCargot Tool's camera widget: one request, one picture, read in chunks under the 512-byte packet limit with as many requests in flight as the viewer likes; nothing is ever sent unasked. While requests keep coming the sensor stays running, so a picture costs a sensor frame instead of its 0.75 s start; 5 s after the last request, or at once when the viewer says it is done, it goes back to standby. A frame the driver has sat on, older than a sensor frame and 150 ms more, is thrown away for a fresh one, and each reply says how old its picture is. The last two pictures are kept, so a second viewer shares the first one's when it is under 100 ms old. The stream stops by itself if internal DMA memory falls under the 6 kB the board keeps for WiFi, BLE and the modem. A script's camera-snap at the stream's size takes its picture from the running sensor; at another size the stream gives way and restarts on the viewer's next request. Through the hub only the owner may watch: a friend is refused, a camera showing more than a position does. * Several packages on one board: the script and QML partitions hold a table of packages, each loaded in its own LispBM context or Lua environment, with its own range of settings slots (512 each, 4096 in all), imports, assets and events, and installed, listed and removed with COMM_PKG (166) by ESCargot Tool; tool/docs/multi-package.md describes it. A board written by an older Tool reads as a one-package table without any rewrite, and the old commands serve the first package. The REPL runs in the first package's environment. The table code is shared byte for byte with ESCargot's controller firmware. tools/luapack.py --table and --list build and print a table. A hub friend may not send COMM_PKG. * Network status: COMM_NET_STATUS (165, private to ESCargot) reports how a board is connected: WiFi mode, station state and address, the hub session, and on a cellular board the modem's state, operator, access technology, signal, data link and its counters, GNSS fixes and their age, and the battery gauge. ESCargot Tool shows it on the phone's start page, on the desktop's Connection page and with --netStatus. * WiFi: a received frame is copied out of the WiFi driver's buffer at once (CONFIG_LWIP_L2_TO_L3_COPY, every board but the P4s, whose WiFi is a separate chip). Upstream leaves each frame in its buffer until the socket it is for is read, and there are six buffers for everything: a script socket left unread for six small segments, as when a script waits in tcp-send, left the board deaf -- no ping answered, no ACK heard -- until that socket was closed. A bike bridging its CAN bus to the Waveshare went deaf for 7 to 20 s every few minutes that way, and the Waveshare dropped it as stalled. * WiFi: besides the configured network, up to four more can be stored (wifi_net_add, wifi_net_del, wifi_nets, wifi_hop; owner only over the hub, keys never echoed), and the board hops to the strongest one it can see, every scanned network considered, so a bike that leaves the house's WiFi for a phone's hotspot follows without anyone touching it. They live in their own NVS entry, so adding them changed no stored settings. * An access-point fallback, off unless turned on with wifi_ap_fallback on (kept in its own NVS entry, so no stored settings change): after 30 s with no known network (30 to 35 s, on a 5 s check) the configured access point comes up, as in access-point mode, so a phone can still reach the board, and the station tries again every 30 s rather than scanning on every failure, which kept moving the access point's channel under a phone. With a network back and nobody on the access point, it closes. It needs an access-point name and a key of 8 characters or more. * In station mode the access point beside the station, which upstream leaves open under the chip's default name (ESP_ and six hex digits) for the FTM responder and ESP-NOW, is hidden and locked with WPA2 and a random key made at each boot. Nothing stood behind the open one, so joining it led nowhere, but every board in station mode advertised an open network. An upstream bug. * LispBM grows its heap into memory a disabled radio leaves only while WiFi keeps 48 kB of internal RAM. With WiFi on and bluetooth off, a VESC Express T was left 17 kB and stopped answering on the network within minutes, still associated, until power-cycled. An upstream bug. * CAN: the link's losses are counted -- packets dropped, cut short or with a bad CRC, per direction -- and printed by can_devs. * Sampled audio: COMM_AUDIO_STREAM (164) is forwarded to the controller like the other commands, and the hub treats it as a drive command, so a friend's session may send it. * LispBM extensions: * Added clay-layout, disp-load-st7701-rgb, disp-cmd, disp-bl, log-lines, log-dropped, log-add and touch-stats. The WS S3 Touch LCD 4 provides disp-init and touch-pins, so a package for it carries no pin numbers. * get-mac-addr on the ESP32-P4, which has no radio of its own: the chip's factory MAC (eFuse), stable and unique, rather than a co-processor's. Upstream registers it only with ESP-NOW, so on a P4 a script calling it (pkg/ha_mqtt, for its device id) failed at boot. vesc.get_mac_addr does the same; on a P4 it returned an unread buffer. * Merged from upstream (c085911d8..6d47e7c6e, 24 commits): * ESP-IDF 6.1. Partition tables are unchanged by the IDF move. Upstream dropped the custom bootloader component, so the bootloader is IDF's own. * Bluedroid replaced by NimBLE, with concurrent BLE client and server roles for scripts and a fix for re-pairing after iOS forgets the device. The BLE setting is split into the comm link mode and a separate scripting mode (disabled, server, client, or both). * CAN moved to the TWAI node API. * AXS5106L touch controller (touch-load-axs5106). Here it goes through the engine-neutral touch core, so Lua has touch_load_axs5106 as well. * VBMS-INF-MAS board. * pkt-enc, pkt-dec-alloc and pkt-dec: frame and unframe the VESC packet format from LispBM. uart-select for boards with more than one UART. * pkt-dec differs from upstream's in three ways, shared with the ESCargot controller firmware. The decoder state is an opaque value rather than a byte array a script could overwrite, including a function pointer the decoder calls. Each decoder is independent: upstream shared state between them, so after an out-of-memory error one decoder could skip its input and return another's bytes. And when one chunk completes several packets, each is returned in turn rather than only the last. * On ESP32-C3, lispif_vesc_extensions.c is built with -Os, which leaves VESC Express T 8 kB of its app partition free; IDF 6.1 had left it none. * HW_NO_WIFI and HW_NO_BLE in a hardware header take the radio out of the build, and switching boards in one build directory regenerates its sdkconfig. * TCP: a client that stops reading is disconnected after a second instead of holding the port, accept failures are retried, and the local socket is reset between connections. On the P4, WiFi power save is always off, for WiFi/BLE coexistence through the C6. * A stored configuration of a different size keeps its CAN ID and baud rate instead of being discarded entirely. GPIO internal resistors in sleep stay disabled, as under 5.5.4. * LispBM updated to c47652b6, with room for new array and buffer extensions. * Merged from upstream (6d47e7c6e..f0c204de9, 17 commits): * Classic ESP32 support, with the devkit hardware profiles reorganised. Not built or tested by this fork, and not in its release firmware. * BLE HID, long reads, and the RSSI of a connected BLE client from ble-client-connect. * LispBM images persist across reboots: the script partition is mapped at a fixed address, with the dynamic mapping as a fallback. The firmware maps it first thing after the boot log starts. * Reading LispBM statistics no longer restarts a script that was stopped. The ESCargot controller firmware has the same fix. * LispBM updated to 3428efd9. * The LispBM extension table fits what each board registers. WS S3 Touch LCD 4 (414 built-in extensions), S3 N16R8 (410) and P4 NRW32N16C6 (400) registered more than its 397 slots, and the registrations past the end failed, so scripts on those boards could find extensions missing. It now has 440, with 64 more reserved for packages and native libraries, and the build fails when the built-in ones outgrow it (upstream PR 136, which adds the check and the reserve). * LispBM: str-from-n prints 64-bit and unsigned integers whole. With no format it took every integer's low 32 bits as signed, so (str-from-n 123456789012i64) gave "-1097262572". An upstream LispBM bug. Upstream issue 53, printing a 64-bit number crashing the C3, does not happen on these builds, which use picolibc. * Merged from upstream (f0c204de9..cfbc684df, 4 commits): * CAN recovers from bus-off with its pending sends reclaimed. * On the S3 and other targets that map the script area at a fixed address, the cache is invalidated after the area is erased or written. Without it an uploaded script, LispBM or Lua, could run from the old bytes until a reboot. * Merged from upstream (cfbc684df..e68d1be8a, 9 commits): * CAN: after a bus-off the node is restarted 100 ms later, retried until it starts, instead of recovered in place, which could leave transmits stuck for good. The receive queue survives the restart and pending sends are reclaimed. On a board whose transceiver may be missing (HW_CAN_TRANSCEIVER_OPTIONAL, the Waveshare S3 SIM7670G) the restart still waits 1 s, doubling to 30 s, while nothing has been heard on the bus. A CAN baud rate of 75 kbit/s is now set as 75 kbit/s; it was 500. hw_status prints the second bus's recoveries on the C6. * wifi-scan-networks no longer hangs when the scan ends at once, for instance while the station is still disconnecting, and after a LispBM restart WiFi commands no longer fail with "Another thread is currently executing WIFI commands" until a reboot. * A REPL line that cannot pause the running script, or finds no memory, lets the script go on; the pause stayed pending and could stop it later. * The LispBM extension table keeps 50 slots for packages apart from the built-in ones (now 461) and from those a hardware header adds (USER_EXTENSION_STORAGE_SIZE, 0 by default); it had one reserve of 64 for both. The build check prints the two reserves. * A hardware header can set the LispBM heap and memory sizes (HW_LBM_HEAP_SIZE, HW_LBM_MEMORY_KB) whatever the radio modes. Here the size is still fitted to the internal RAM free, keeping 40 kB for the rest of the board; the WiFi reserve that undoes growth past the base sizes leaves the hardware's figure alone. No board here sets them. * ESP32-S31 N16R16V devkit support, with bank-aware direct GPIO writes in the display and SPI drivers. Not built or tested by this fork, and not in its release firmware. * Merged from upstream (e68d1be8a..9ed29f0f9, 8 commits): * A LispBM stats poll decides from the requested evaluator state whether to continue, so a continue not yet taken up no longer reads as paused and leaves the script paused (LispBM updated to cbb30151, lbm_get_eval_state_requested). * The WiFi and RGB LED extensions run their initialisation when a LispBM image with a main is found, too. * Dash35S hardware (ESP32-S31), a card mounted on an SDMMC slot by slot and width (HW_SDMMC_SLOT), and a 4096 x 64 PSRAM LispBM heap on the P4 and S31. The Dash35S and the S31 are not built or tested by this fork. * Merged from upstream (9ed29f0f9..8529f16c6, 5 commits): * ESP-IDF 6.1.1 instead of 6.1.0, which main/idf_component.yml now requires. The .#idf shell installs 6.1.1 (flake.nix idfVersion); docker/Dockerfile follows. IDF 6.1.1 is about 19 kB larger on the ESP32-C3: VESC Express T has 29,216 bytes of its app partition free with LispBM (48,416 before) and 199,296 with Lua (218,800), still over its 16 kB floor. * An SD card on an SDMMC slot can be powered from an on-chip LDO channel (HW_SDMMC_LDO_CHANNEL in a hardware header), released again on unmount; a mount that fails now releases what it took. No board here sets it. * Dash35S: the display renders from a queue on the second core instead of in the script's thread, the S31's PSRAM runs at 250 MHz and its flash in QIO, and the buttons are read as calibrated voltages with the pull-ups switched as pulls rather than driven: btn-read returns two voltages (floats) instead of two raw ADC readings. The S31's ADC calibration is found per channel (adc_cali_chan_raw_to_voltage, new in IDF 6.1.1), so its ADC voltage reads no longer return -1. adc_get_raw is gone. * Merged from upstream (8529f16c6..8d89cd7d2, 3 commits): * On a C6, CAN2 is decoded apart from CAN: its multi-frame packets have reassembly buffers of their own, a command or a ping from a node on CAN2 is answered on CAN2 rather than on CAN, and a pong or a baud rate change arriving on CAN2 is ignored. Two packets arriving at once, one on each bus, used to fill each other's buffers and both be lost. The second-bus code is built for the ESP32-S31 too (DovPear). * S31 TwinCAN hardware configuration and its test scripts (DovPear). Not built or tested by this fork, and not in its release firmware. * Porting the fork to IDF 6.1: * The crash seal, crash collector and hub credentials use PSA Crypto, because mbedTLS 4 no longer exposes the ECP, ECDH, HKDF and GCM modules. The sealed format is byte-for-byte unchanged: a report sealed by the new code opens with tools/sealcheck.py, which uses a separate crypto library. * The hub's self-signed certificate needs CONFIG_MBEDTLS_X509_CREATE_C, which IDF 6 turns off by default. CONFIG_VESC_HUB_MTLS now selects it. CONFIG_MBEDTLS_HKDF_C no longer exists, and HKDF comes from PSA. * Core dumps no longer test CONFIG_ESP_COREDUMP_DATA_FORMAT_ELF, an option IDF 6 removed because ELF is the only format left. Without that change the crash dump reader, ring and `crash` command compiled out silently on every board. * The touch core, the Lua I2C bindings and the Waveshare S3 CH32 expander moved to the I2C master driver, through upstream's hwi2c. The CH32 now shares a bus the touch controller already holds instead of failing to open it. * The ST7701 RGB driver uses IDF 6's split input and output colour formats. The Lua ADC binding and the Waveshare P4 header use the new ADC channel names, and the Lua WiFi binding the new bandwidth names. * A comm link send over TLS gets upstream's one-second stall limit as well as the plain socket. * BLE controller memory is released only when both BLE modes are disabled. It is not released on the P4, which has no controller of its own. * Bug fixes: * A half-cleared LispBM image is no longer booted as if it were whole. The image clear checks each write, and image writes preserve the rest of the flash sector. Previously this could fault in lbm_add_eval_symbols on an erased-flash pointer. * The print prefix set by set-print-prefix was passed to sprintf as a format string. It is now printed with snprintf and "%s". * The printf helpers in commands.c no longer dereference a failed 400-byte allocation. Script output passthrough uses esp_rom_printf, so it no longer overflows the eval task's stack. * Script output is mirrored to the console when no comm port is attached. * A terminal command's output goes to the port that sent the command. It went to whichever port had sent the latest packet, so a command that took a while (can_scan pings the bus for 2.5 s) printed nothing over the hub or WiFi when a controller's packets were arriving over CAN meanwhile. * A CAN ping waits for the pong from the id it pinged. Any pong ended the wait, so another ping in flight made a bus scan list ids that were not on the bus. * A WiFi connection sends one packet at a time, as BLE does. Its replies and the replies forwarded from a controller over CAN were built in one buffer by two tasks, so one could be rebuilt over the other mid-write. * CAN sends one multi-frame packet at a time. Each frame was sent under a lock but a packet's frames were not, so two senders at once -- a script polling the controller and a firmware upload, say -- interleaved their frames, the receiver joined the pieces by offset, and the packet failed its CRC and was sent again. An upstream bug. * CAN: a multi-frame packet no longer goes into the buffer of one abandoned mid-way. Frames carry only an offset, so a packet fills whichever buffer is already filled up to it, and the first such buffer was taken; a packet whose frames were lost stayed at its offset, and the next one to reach it was filled into that buffer and failed its CRC. Of the buffers at an offset the one filled most recently is taken, and a packet starting with every buffer busy takes the one untouched longest -- the same code as ESCargot's controller firmware. An upstream bug. * CAN: standard-id frames that no script or callback reads are no longer queued. The processing task sends each reply to VESC Tool over WiFi itself, and while a slow send held it, a node that broadcasts standard frames on its own (an Rmcore every 10 ms) filled the 160-frame queue; replies lost frames, and script reads and firmware updates through the Express failed. Extended frames, the VESC protocol, are queued as before. An upstream bug. * CAN: a received packet is acted on by its own task (can_pkt), not the one draining the receive queue. Forwarding a controller's reply to VESC Tool waits on the WiFi send -- up to a second when the client is slow to acknowledge, as a station in modem sleep is -- and meanwhile every frame on the bus was dropped: 748 on a board whose controller was logging over CAN, its terminal replies among them. Packets now wait in a 2 kB ring while the queue keeps draining and status frames keep being decoded; a packet that finds the ring full is dropped and counted ("not queued" in can_devs). Costs 4 kB of RAM. An upstream bug. * CAN: a reply is no longer relayed back over CAN to the node it came from. A reply goes on to whoever asked last, and when nothing had said who that was, it was the first interface a packet ever came in on -- after boot often CAN, the controller's answer to the crash collector, before VESC Tool connected. From then on a reply arriving over CAN (a script's print, a terminal line) went back to the controller, which relays the same way and sent it straight back: the two passed it to and fro for ever, one more with each print, in frames that outrank status and pong. On the bench, after 47 minutes, ~300 packets a second, no pong answered and an empty CAN scan until a reboot. CAN no longer becomes that default, a reply whose relay would send it back to its sender is dropped and counted ("bounced" in can_devs), and a controller's crash report answer no longer makes the controller where the Express's own prints and send-data go (they went to it for 5 s after each poll, instead of to VESC Tool). An upstream bug, apart from the crash report part. * WiFi sends retry when the network stack is out of buffers (ENOMEM, ENOBUFS), as they do on EAGAIN; that was taken as fatal and the packet dropped without a word, which on a busy board left a firmware upload chunk unanswered. A fatal error after part of a packet went out shuts the connection rather than leaving the stream torn mid-packet. A peer is given 4 s instead of 1 s to take a packet before the connection is shut, more than lwIP's first retransmission timeout (1.5 s), which one lost segment costs. An upstream bug. * LispBM's value printer always ends its buffer with a NUL. A value longer than the buffer left none, and the REPL echoed the bytes after it. * Development: * Host test suites, run under ASan and UBSan and compiled from the shipping sources: the Lua engine and container, ST7701 pixel conversion and rotation, the log ring, hub credentials against real mbedTLS, the crash archive, collector and seal (including a sealed vector for VESC® Tool's reader), OTA rollback, the packet framing, and the pkt-dec decoder with its frame queue and out-of-memory retry. The crypto suites link mbedTLS 4.1, the version IDF 6.1 ships. A libFuzzer target covers the container parser. * tests/check.sh is the single entry point for CI and local runs. A flake pins the host tools, and nix develop .#idf provides ESP-IDF v6.1 without Docker. * A virtual Express, tests/vexpress: the firmware's script and command layers built unchanged as a Linux program, over a platform layer that implements the ESP-IDF and FreeRTOS calls they make on POSIX. It runs real packages with either engine, on a chosen board (Dash16, VDisp 900, Express, P4 and S3 display boards); draws every panel driver into a framebuffer saved as PNG; puts simulated controllers, bldc's vescsim and other processes on a virtual CAN bus; keeps NVS and the code partitions in a state directory and the SD card in a directory; and serves the VESC protocol on a TCP port, so ESCargot Tool connects to it, installs packages and uses the REPL and terminal. Hardware the host does not have (UART, I2C, GPIO, PWM, LED strips, ESP-NOW, firmware upload) answers "not available". check.sh runs a smoke test; tests/vexpress/shots.sh renders dash16, dash35b and the Lua P4 dash through a simulated ride. * CI builds VESC Express T (ESP32-C3) with each engine and the cellular Waveshare board, and reports each build's free flash. * CI builds a board with both engines and checks that the right symbols ended up in each binary, guards LispBM references in the shared drivers, runs cppcheck and clang-tidy, and audits contribution provenance. * Host tools: tools/vesc_script.py (upload, run, REPL, custom app data, log tail, baud probing), main/script/test render_host plus tools/img_diff.py for rendering Lua views to images and comparing them against LispBM goldens, tools/script_ext_coverage.py and tools/sealcheck.py. * Copyright headers credit the fork's own work and the original authors of extracted code, and vendored third-party code is declared.