feat: wireview firmware check + DFU flash (bundled image, dfu-util)
Port of the wireview-linux firmware update feature: - nvcurve/wireview_firmware.py: Intel-HEX parser (checksum-verified), BuildStruct identity extraction (vendor/product/version/build string at image base + 192), compatibility verdicts (version then build date, Noctua Edition product alias + 2026-09-02 floor), and a dfu-util flasher (progress parsing, exit-74-after-:leave quirk, timeouts). - Bundle TG-WV-PRO2-FW.hex (v05, build 20260902_0741, base 0x08000000) in nvcurve/firmware/. - WireViewSerialDevice.enter_bootloader() sends the top-level 0xF1 command; vendor/product ids are exposed in info(). - GET /api/wireview/firmware (device vs. bundled verdict, dfu-util availability, flash state) and POST /api/wireview/firmware/flash (gates: serial transport, product match, Noctua floor, downgrade/ same require override). The flash runs as a background task (bootloader -> wait for 0483:df11 -> dfu-util) with progress streamed over /ws/wireview. - WireView tab: Firmware card with device vs. bundled firmware, verdict, dfu-util/hwmon warnings, confirm dialog, live progress bar; re-checks after the device reboots. - tests/test_wireview_firmware.py: 66 tests (HEX parser, checksum rejection, identity, all verdict paths, mocked flasher, bootloader command via pty); added to the Makefile test target. - Docs: firmware section in docs/WireView.md, README note.
This commit is contained in:
1 parent
bf00e1149a
commit
1e11a2c18b
13 files changed
+9702
-7
No files matched your search
@@ -74,6 +74,32 @@ ls -l /dev/wireview-pro2 # -> /dev/ttyACM0
|
||||
|
||||
With the device plugged in, start (or restart) the NVCurve server. The **WireView** tab appears in the web UI and `GET /api/wireview` returns the device info and live samples. The tab disappears when the device is unplugged and reappears on re-plug — no restart needed.
|
||||
|
||||
## Firmware check and update
|
||||
|
||||
The WireView tab has a **Firmware** card that compares the device's firmware (version + build date, read from the device) against the image bundled with NVCurve (`nvcurve/firmware/TG-WV-PRO2-FW.hex`, v05, build `20260902_0741`) and can flash it over USB DFU.
|
||||
|
||||
Comparison rules (same as the official client and wireview-linux):
|
||||
|
||||
- the image must match the device's product — the Noctua Edition (product `06`) runs the Pro II (`05`) firmware, so a Pro II image is accepted for it;
|
||||
- an image without a build date of 2026-09-02 or later is refused for a Noctua Edition (that build added Noctua support);
|
||||
- version first, then build date: a **downgrade** or an **identical** build is refused unless you explicitly confirm it ("Flash anyway"); a newer image offers a normal "Update firmware" button.
|
||||
|
||||
Flashing requires:
|
||||
|
||||
- the **serial transport** (in hwmon mode the `wireviewd` daemon owns the port, so the card shows a hint instead of a button);
|
||||
- the `dfu-util` package (`sudo apt install dfu-util` / `sudo dnf install dfu-util` / …) — the card shows a warning when it is missing;
|
||||
- the udev rule above, which already covers the DFU bootloader (`0483:df11`).
|
||||
|
||||
The flash procedure: NVCurve sends the bootloader command over the serial port, the device reboots into its STM32 DFU bootloader (`0483:df11`), the bundled Intel-HEX image is flattened to a raw binary (gaps padded with `0xFF`) and downloaded with `dfu-util -d 0483:df11 -a 0 -s 0x08000000:leave -D <image>`. The device reboots on its own and the watchdog reconnects it; the card then re-checks and shows the new firmware. Progress is streamed live over the WebSocket.
|
||||
|
||||
> [!WARNING]
|
||||
> Flashing restarts the device into its bootloader and rewrites its flash. A power loss or unplug mid-flash can leave the device unbootable until it is reflashed manually. This is unofficial software, not affiliated with Thermal Grizzly — flash at your own risk.
|
||||
|
||||
API:
|
||||
|
||||
- `GET /api/wireview/firmware` — device vs. bundled firmware, the verdict (`newer` | `same` | `unknown` | `downgrade` | `product_mismatch` | `too_old_for_noctua`), `dfu-util` availability, and the flash state;
|
||||
- `POST /api/wireview/firmware/flash` — `{"override": false}`; `override=true` is required for a downgrade or identical build. Returns `409` when the flash is refused or already running.
|
||||
|
||||
## Pin current imbalance warning
|
||||
|
||||
The 12 VHPWR connector is the most fragile part of a PC's power delivery: if one power pin has a bad contact (worn cable, faulty adapter, loose plug), the remaining pins are forced to carry the missing current. Under heavy load this can overheat and melt the connector — in rare cases even start a fire.
|
||||
|
||||
Reference in new issue
Block a user