Skip to content

Add input buffer clear feature and refactor TVLCOM interface - #32

Merged
UF4OVER merged 3 commits into
F4CP_releasefrom
F4CP_debug
Jun 7, 2026
Merged

UF4OVER merged 3 commits into
F4CP_releasefrom
F4CP_debug

Conversation

@UF4OVER

@UF4OVER UF4OVER commented Jun 7, 2026

Copy link
Copy Markdown
Owner

No description provided.

Copilot AI review requested due to automatic review settings June 7, 2026 23:12
@UF4OVER
UF4OVER merged commit 7eb8fed into F4CP_release Jun 7, 2026
2 of 3 checks passed

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates the TVLCOM v2 implementation by consolidating frame/TLV encoding/decoding into a shared module and refactoring the power client + device debug page to use it. It also adds an input-buffer clearing capability to improve robustness around stream stop / backlog handling, alongside related protocol/UI/test updates and a version bump to 0.6.0.rc1.

Changes:

  • Introduce app/protocol/tvlcom.py as the shared TVLCOM frame/TLV codec and refactor session_power.py and page_device.py to use it (removing legacy codec modules).
  • Add serial input backlog clearing (SerialSession.clear_input_buffer() and F4CPPowerClient._clear_receive_backlog()) and improve stream stop parsing resilience.
  • Extend power protocol/status handling (e.g., TEMP2 temperature, explicit REPORT_STATUS_TYPES) and update/expand tests; bump package/app versions to 0.6.0.rc1.

Reviewed changes

Copilot reviewed 23 out of 24 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
uv.lock Bumps locked f4cp version to 0.6.0rc1.
pyproject.toml Bumps project version to 0.6.0.rc1.
Resources/Config/config.json Updates app version and changes some default UI/config settings (theme/DPI/update version fields).
app/protocol/tvlcom.py New shared TVLCOM frame/TLV helpers + stream utilities.
app/protocol/init.py Re-exports TVLCOM helpers instead of legacy protocol modules.
app/protocol/unitls.py Removes legacy CRC/SOF helper module.
app/protocol/payLoad.py Removes legacy TLV payload/dispatcher implementation.
app/protocol/frameParser.py Removes legacy frame parser implementation.
app/protocol/frameBuilder.py Removes legacy frame builder implementation.
app/protocol/dataType.py Removes legacy type registry (u8/u16/u32/float/string) implementation.
app/session/session_serial.py Adds clear_input_buffer() to discard unread driver-buffered bytes.
app/session/session_power.py Refactors to shared TVLCOM codec; adds stream-stop handling/backlog clearing; extends PowerStatus; adds write-transaction completion signal.
app/session/session_power_host.py New synchronous TVLCOM host helper extracted from session_power.py.
app/core/const.py Adds TEMP2 temperature, adjusts signedness/meta, expands REPORT_STATUS_TYPES and defaults/stream type lists.
app/widgets/pages/page_power.py Adds editor “dirty” tracking + pending write readback sync + UI write watchdog to prevent stale disabled controls.
app/controllers/controller_power_page.py Wires new writeTransactionFinished signal to the Power page.
app/widgets/pages/page_device.py Refactors TVLCOM V2 payload build + parsing/log formatting to use shared TVLCOM codec and power metadata.
script/sim_power_device.py Updates simulator protocol constants/types to include TEMP2 and new status/report fields.
script/generate_soft_copyright_source_pdf.py Updates file list to include app/protocol/tvlcom.py (and remove old protocol files).
tests/test_power_protocol_constants.py Updates firmware protocol parsing paths/logic; adds checks for report-type ordering and signedness metadata.
tests/session_test/test_session_powert_polling.py Expands polling/stream-stop/parser tests and adds stream-stop error handling coverage.
tests/page_test/test_page_power_output_staging.py Updates PowerPage staging tests for new parameter editor behaviors/pending write sync.
tests/page_test/test_page_power_initial_status.py Updates initial status test wiring to use a fake session and disconnect protocol slots.
tests/page_test/test_page_device_connection_modes.py Adds tests validating DevicePage uses shared codec + correct “empty read TLV” behavior.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +225 to +228
try:
editor.lineEdit().textEdited.connect(lambda _text, item=editor: self._markEditorDirty(item))
except Exception:
pass
Comment thread app/protocol/tvlcom.py
Comment on lines +148 to +152
if body_len > MAX_PROTOCOL_BODY_LEN:
if stream_frame_search:
buffer.pop(0)
return extract_frame_from_buffer(buffer, stream_frame_search=True)
raise PowerClientProtocolError(f"Body length is too large: {body_len}")
],
"ThemeColor": "#ff34ff29",
"ThemeMode": "Light"
"ThemeMode": "Dark"
},
"MainWindow": {
"HighDpiScaling": false,
"HighDpiScaling": true,
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.

2 participants