.. _changelog_v4_0_0: v4.0.0 ====== v4.0.0 is the major **v3 → v4** release. It introduces the modern multi-frame :mod:`sensor` buffering API (double / triple buffering and a video FIFO), a frame complete callback, a **Bluetooth** module (NimBLE stack) with Portenta support, the initial **MT9M114** camera driver, MDMA-offloaded camera capture, Bayer/JPEG support in ``image.draw_image()``, and a jump to **MicroPython 1.15**. The legacy streaming mode was removed and :func:`sensor.set_windowing` was reworked — read the breaking changes below. .. contents:: On this page :local: :depth: 1 Highlights ---------- - **Multi-frame buffering** — :mod:`sensor` gains double buffering, triple buffering, and a video-FIFO mode for higher, smoother frame rates. - **Frame complete callback** — register a callback that fires when a new frame is ready, for non-blocking capture pipelines. - **Bluetooth** — a :mod:`bluetooth` module built on the NimBLE stack, enabled on the Arduino Portenta H7 (with a BLE example). - **MT9M114** — initial camera sensor driver. - **Faster capture** — MDMA offload for camera data capture; ``draw_image()`` now accepts Bayer and JPEG sources/destinations. - **MicroPython 1.15** — the bundled MicroPython was updated from 1.13 to 1.15. - **Breaking:** the legacy streaming mode was removed and :func:`sensor.set_windowing` was reworked — see the breaking changes. New features ------------ - **Sensor multi-buffering** — added :func:`sensor.set_framebuffers` / :func:`sensor.get_framebuffers` and the ``SINGLE_BUFFER`` / ``DOUBLE_BUFFER`` / ``TRIPLE_BUFFER`` / ``VIDEO_FIFO`` modes, plus :func:`sensor.get_frame_available` for double, triple, and video-FIFO capture. - **Frame complete callback** — added :func:`sensor.set_frame_callback` so a Python callback runs when each new frame finishes. - **Bluetooth** — added a :mod:`bluetooth` module backed by the NimBLE stack (NimBLE submodule, CYW-BT driver), enabled on the Arduino Portenta H7 with a BLE example. - **MT9M114** — added the initial MT9M114 camera sensor driver. - **draw_image** — added debayering support and JPEG copy support so ``image.draw_image()`` accepts Bayer and JPEG source/destination images. - **MDMA capture offload** — camera data capture is offloaded to MDMA for higher throughput. - A color-palette argument can now be disabled by passing ``-1`` (since ``None`` is reserved as a valid argument). Other changes and improvements ------------------------------ - Switched to the new software I2C implementation; aligned with MicroPython upstream; per-board ulab configuration; basic built-in modules enabled for OpenMV 2; fairer frame-buffer readout locking; mutex support extended to Cortex-M0/M0+ with a lock timeout. Bug fixes --------- Camera and imaging: - Fixed FLIR Lepton init reliability on the Pure Thermal board, ImageIO JPEG buffer / pause handling, HM01B0 vflip/hmirror settings, the JPEG buffer flush when an image is invalidated, and a ``cropped`` flag that was set when the framesize was invalid. System and connectivity: - Fixed the USB command draining and the reset-to-bootloader command, mutex init, the UART clock source, the FatFS code-page define, WINC1500 out-of-band ACK handling, WiFi debugging, and the Nano33 USB PID; isolated dedicated analog pads. Hardware and board support -------------------------- - **MT9M114** camera sensor (initial driver). - **Arduino Portenta H7** — Bluetooth enabled (NimBLE) with a BLE example. - **Arduino Nano RP2040 Connect / Nano 33 BLE Sense** — WiFi-debug flag disabled where unsupported; blinky example added; USB PID fix. Breaking API changes -------------------- User-visible API breaks between v3.9.4 and v4.0.0. Scope: Python C-modules in ``modules/`` and Python libraries in ``scripts/libraries/``. Each change is tagged with its impact: - *major* — affects most scripts; you will almost certainly need to port code. - *minor* — narrow API; only affects scripts that used it. - *behavior* — same API, different results; re-check tuned scripts. Changes are grouped by impact in that order. If you just want to port your code, jump to the :ref:`migration checklist ` at the end. Each commit hash links to its diff on GitHub. .. _v4_0_0_streaming: Streaming mode removed *(major)* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ The legacy sensor streaming mode was removed in favor of the new multi-frame buffering API. Code that enabled streaming mode must switch to :func:`sensor.set_framebuffers` with ``DOUBLE_BUFFER`` / ``TRIPLE_BUFFER`` / ``VIDEO_FIFO`` and drive capture with :func:`sensor.snapshot` / :func:`sensor.get_frame_available` instead. *Commits:* `a42f3a647 `__ .. _v4_0_0_windowing: :func:`sensor.set_windowing` reworked *(behavior)* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ :func:`sensor.set_windowing` was made much more flexible: it now accepts multiple argument forms (a region tuple, or width/height centered, or ``x, y, w, h``) and resolves the window relative to the current resolution. Scripts that passed windowing arguments in the old fixed form may select a different region and should be re-checked. *Commits:* `3e9c43554 `__ .. _v4_0_0_micropython: MicroPython 1.13 → 1.15 *(behavior)* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ The bundled MicroPython core was updated from 1.13 to 1.15 (via 1.14). Standard-library and language behavior follows upstream MicroPython 1.15; re-check scripts that depend on version-specific :mod:`micropython` / standard module behavior. *Commits:* `364eea6c7 `__, `26c5376b0 `__ .. _v4_0_0_imageio: ImageIO ``update_jpeg_buffer`` argument removed *(minor)* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ The ImageIO JPEG-buffer update was reworked to derive the buffer from the image source argument, and the explicit ``update_jpeg_buffer`` argument was removed. Scripts that passed ``update_jpeg_buffer`` to ImageIO must drop that argument. *Commits:* `5c6937bd1 `__ .. _v4_0_0_migration: Migration checklist ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ For a clean port to v4.0.0 the typical work is: #. Replace any use of the removed streaming mode with the new :func:`sensor.set_framebuffers` multi-buffering API (:ref:`streaming mode removed `). #. Re-check :func:`sensor.set_windowing` calls against the reworked, more flexible argument handling (:ref:`the windowing change `). #. Re-validate scripts that depend on version-specific MicroPython behavior against MicroPython 1.15 (:ref:`the MicroPython bump `). #. Drop the ``update_jpeg_buffer`` argument from ImageIO calls (:ref:`the ImageIO change `). All other scripts run unchanged.