.. _changelog_v4_5_1: v4.5.1 ====== v4.5.1 adds image orientation/aspect drawing hints, loading images directly from a file path, a GC2145 wide field-of-view ioctl, and a new backlight controller API. It also reworks the ``Image()`` constructor, :mod:`display` APIs, and module argument parsing — read the breaking changes below. .. contents:: On this page :local: :depth: 1 Highlights ---------- - **Drawing hints** — ``draw_image()`` gained orientation (``HMIRROR``/``VFLIP``/``TRANSPOSE``, ``ROTATE_90/180/270``) and aspect-scaling (``SCALE_ASPECT_KEEP``/``EXPAND``/``IGNORE``) hints. - **Load images from disk** — ``draw_image()`` / ``display.write()`` accept a file-path string. - **Backlight control** — new ``DACBacklight`` / ``PWMBacklight`` classes and a display ``backlight=`` argument. - **Breaking:** the ``Image()`` constructor, :mod:`display` APIs, and module argument parsing changed — see the breaking changes. New features ------------ - ``draw_image()`` orientation hints — ``image.HMIRROR``, ``image.VFLIP``, ``image.TRANSPOSE``, plus convenience ``image.ROTATE_90`` / ``ROTATE_180`` / ``ROTATE_270``. - ``draw_image()`` aspect hints — ``image.SCALE_ASPECT_KEEP`` / ``SCALE_ASPECT_EXPAND`` / ``SCALE_ASPECT_IGNORE`` for fit / expand / stretch. - **Palette constants** — ``image.PALETTE_RAINBOW`` and ``image.PALETTE_IRONBOW`` (moved into the image module). - **Wide field of view** — new ``sensor.IOCTL_SET_FOV_WIDE`` / ``IOCTL_GET_FOV_WIDE`` ioctls (on the GC2145, up to 5x sensor scaling). - **Load from disk** — ``draw_image()`` and ``display.write()`` accept a source-image file-path string, loading it from storage directly. - **Backlight controllers** — new ``DACBacklight`` and ``PWMBacklight`` classes (importable from :mod:`display`), and a keyword-only ``backlight=`` argument on the SPI/parallel display constructors. Other changes and improvements ------------------------------ - The ST7701 DSI display driver moved into its own ``st7701.py`` module (still importable via ``from display import *``) and is frozen on Arduino Giga; the :mod:`lsm9ds1` IMU driver was frozen on the Arduino Nano 33 BLE Sense. - MT9V022 / MT9V034 (global-shutter) cameras now apply row-noise correction for better image quality. - The i.MX RT USB mass-storage volume is now labelled as an OpenMV disk. Bug fixes --------- Camera and sensors: - Fixed corner detection (``find_keypoints()`` FAST/AGAST) on images taller than 480 rows — the per-row buffer is now sized to the image height. - Added FSYNC-pin support for frame-synchronized ``snapshot()`` on i.MX RT (OpenMV RT1060), and fixed swapped SPI4 MOSI/MISO pins on the RT1060. Display and video: - Corrected the ``SPIDisplay`` constructor argument order (``bgr``, ``byte_swap``, ``triple_buffer`` were applied to the wrong parameters). - Fixed TV-shield image corruption when drawing an image with a specified rectangle, and incorrect MJPEG frame bounds when recording scaled frames. Networking: - WINC WiFi AP mode no longer enforces the obsolete WEP-only restriction — open and WPA AP modes work with proper PSK handling. Hardware and board support -------------------------- - **OpenMV RT1060** — FSYNC pin and corrected SPI4 pins. - **Arduino GIGA** — QSPI reliability workaround; ST7701 display frozen in. - **Arduino Nano 33 BLE Sense** — :mod:`lsm9ds1` IMU driver frozen in. Breaking API changes -------------------- User-visible API breaks between v4.5.0 and v4.5.1. Scope: Python C-modules in ``modules/`` and Python libraries in ``scripts/libraries/``. Each change is tagged with its impact: - *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_5_1_image: ``Image()`` constructor and :mod:`display` APIs *(minor)* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ The :class:`image.Image` constructor was reworked to keyword arguments (``height``, ``pixformat``, ``buffer=``, ``copy_to_fb=``); it can now build an image from an existing ``bytearray``/buffer, and a buffer is required for compressed formats. ``display.write()`` was reworked: ``x_scale``/``y_scale`` now take a float (scale ratio) or int (target size in pixels) and the separate ``x_size``/``y_size`` keywords were removed. The ``WINC.connect()`` first positional argument was renamed ``essid`` → ``ssid``, and WINC WiFi scan results changed to ``(ssid_bytes, bssid_bytes, channel, rssi, security, N)`` (SSID/BSSID are now bytes; BSSID is no longer a formatted MAC string). *Commits:* `6752c95ac `__, `161737092 `__, `8178c237c `__, `b6cdf8de1 `__ .. _v4_5_1_argparse: Backlight range, scaling, and keyword-only arguments *(behavior)* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ``Display.backlight()`` now takes a 0–100 intensity (0 = off, 100 = full) instead of 0–255, raising ``ValueError`` out of range. Integer ``x_scale``/``y_scale`` values are now treated as a multiplicative scale factor (the same as floats) rather than a target pixel dimension — this affects :func:`fir.snapshot`/``draw_ir()``, :func:`tof.snapshot`/ ``draw_depth()``, :mod:`display`, and ``tv`` scaling. Argument parsing across the :mod:`sensor`, :mod:`fir`, :mod:`tof`, ``tv``, :mod:`mjpeg`, :mod:`gif`, ``imageio``, ``tf``, and :mod:`audio` modules was unified, making several previously-positional options keyword-only (names, defaults, and behavior are otherwise unchanged). *Commits:* `391ec443f `__, `8bd25d6cd `__, `477312656 `__, `08bf62a32 `__, `a4c0f20bf `__, `9b411a66d `__, `3d679f5a6 `__, `d15fc6b8d `__, `555e67ecd `__ .. _v4_5_1_migration: Migration checklist ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ For a clean port to v4.5.1 the typical work is: #. Update ``Image()`` construction to the new keyword form, switch ``display.write()`` off ``x_size``/``y_size``, and rename ``WINC.connect()`` ``essid`` → ``ssid`` (handle the new bytes-based scan tuples) (:ref:`the constructor/display/WINC changes `). #. Rescale ``Display.backlight()`` calls to 0–100, re-check any integer ``x_scale``/``y_scale`` usage, and pass formerly-positional module options as keywords (:ref:`the behavior changes `).