Skip to content

Implement Multi device support#6

Merged
maj113 merged 5 commits intomasterfrom
Multi-Device-support
Apr 26, 2026
Merged

Implement Multi device support#6
maj113 merged 5 commits intomasterfrom
Multi-Device-support

Conversation

@maj113
Copy link
Copy Markdown
Owner

@maj113 maj113 commented Mar 23, 2026

Summary

Refactors the codebase from a single DM40-only app into a device-agnostic framework and adds an experimental EL15 electronic load handler.

Changes

Architecture refactor

  • shared/base_app.py — device-independent UI (BLE scanning, connection lifecycle, raw packet log, waveform, stats) extracted into a reusable App base class
  • shared/ble_worker.py — BLE transport decoupled from device logic; emits typed callbacks
  • shared/device_registry.py — maps device-type strings to handler classes, BLE name prefixes, and discovery family bytes; local imports inside load_handler() break the circular import while remaining statically traceable by Nuitka
  • dm40/app.py — existing logic moved into DM40Handler; no functional changes

EL15 handler (experimental)

  • 28-byte frame parser covering CC, CV, CR, CP, CAP, DCR, ADV, POW [A/DT/RPT], ADV [S]
  • Protection fault detection via byte 5 bits 1+2; decodes UVP/REV/generic codes from byte 6 upper nibble
  • _last_valid_mode prevents fault-bit collisions (CAP↔CC, DCR↔CV) from corrupting the mode display
  • UI: mode bar, voltage waveform with U/I/P tooltip, temperature (3 d.p.), runtime, fan speed, setpoint entry, warning/fault detection

Other

  • Waveform tooltip supports a custom value label and extra lines; timestamp always last
  • Raw packet log: auto-scroll only follows output when already at the bottom (terminal behaviour)

- 70% faster
- 4.3x smaller bytecode
Copilot AI review requested due to automatic review settings March 23, 2026 17:34
@maj113
Copy link
Copy Markdown
Owner Author

maj113 commented Mar 23, 2026

Who invited copilot dawg what

This comment was marked as resolved.

@maj113 maj113 self-assigned this Mar 23, 2026
@maj113 maj113 added this to the Multi-Device support milestone Mar 23, 2026
maj113 added 3 commits April 24, 2026 22:05
Move the WinRT BLE transport, mini_asyncio runtime, theme store, and shared types out of dm40/ and into shared/, leaving dm40/ as a device-specific handler package.

- shared/base_app: single-window Tk app with scan, connect, waveform, raw packet view, and dynamic handler dispatch.
- shared/ble_worker: transport worker with a device-family probe used before handler selection.
- shared/device_registry: central table mapping advertised names and probe replies to handler modules.
- dm40/app: convert to a handler driven by base_app instead of owning the Tk root.
Add an EL15 handler covering live voltage, current, power, and temperature telemetry, the waveform view, and on-device controls (load on/off, CC/CV/CR/CP/CAP/DCR mode switching, setpoint entry). Device-only modes (POW, ADV [L], ADV [S], DT) are reflected in the UI as a single disabled status button.
- waveform_view: draw the hover/pin tooltip directly on the canvas and remove the standalone Tooltip widget, reducing widget churn and binary size.
- build_release.cmd: small flag tweak for the size-optimized release build.
- README: restructure with a contents outline, consolidated features, device support with EL15 coverage, and cleaner protocol notes.
- utils/themes.md: minor wording pass.
@maj113 maj113 force-pushed the Multi-Device-support branch from 09e384f to 38e60d1 Compare April 24, 2026 20:20
Co-authored-by: Copilot <copilot@github.com>
@maj113 maj113 merged commit 7ae5e00 into master Apr 26, 2026
1 check passed
@TooDeepForSleep
Copy link
Copy Markdown

TooDeepForSleep commented May 7, 2026

28b for parsing cp? I'd do 25max

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants