Skip to content

P0: fix AUTO=0 admission bug, PTP switch state loss and Studio UI stutter - #235

Merged
masarray merged 9 commits into
feature/studio-matched-ptp-sv-auto-20261017from
fix/studio-ptp-intent-ui-batch-20261017
Oct 17, 2026
Merged

masarray merged 9 commits into
feature/studio-matched-ptp-sv-auto-20261017from
fix/studio-ptp-intent-ui-batch-20261017

Conversation

@masarray

Copy link
Copy Markdown
Owner

Reproduction from operator

On exact-bundle build 65f3f0cdf751dc4a in COM15 diagnostics, flashed board started PTP STOPPED; no new PTP START after reboot, while Studio shows SV running and PTP OFF. Operator observes AUTO=0 but manual 1 shows LOCAL on analyzer, and UI responsiveness regressed. Do not misrepresent manual metadata as real synchronization.

Core root cause (IEC 61850 sample time != SV MAC TX time)

The prior experimental SOURCE gate demanded MAC-transmitted smpCnt=0 frame land within ±4µs of the PTP whole second, conflating packet egress with sample acquisition instant. IEC 61850 smpCnt indexes the sample instant; MU packet preparation/queuing occurs afterward. This requirement can permanently prevent AUTO from reaching 1 even when GPTimer sample epoch is aligned. Preserve the strict software-observed sample phase + clock-read uncertainty <=4µs, and use independently timestamped canonical MAC egress only to confirm plausible publication latency of [-4µs, +250µs] (4kHz one-slot policy), not zero-delay coincidence. Still require coherent 16-second descriptor evidence and matching session/source/fault generation. Negative regressions cover 300us late, premature TX, stale evidence and bad phase.

PTP switch regression

  • DeviceController was overwriting authoritative PTP RUNNING and PTP2 discipline whenever an older PROFILE PTPROLE readback arrived. Now role readback updates the role only; PTP STATUS owns running state, PTP2 owns lock fields.
  • Keep explicit operator PTP ON only within the current Studio session and restore it at most once after verified firmware reflash. OFF cancels immediately; no saved global auto-run setting or new dialogs. Restoration timed out at 36s without infinite retry.
  • Do not auto-claim lock on firmware boot or smpSynch=1 just because PTP packets exist.

UI responsive

Coalesce high-volume incoming serial-log QML notification to 10Hz instead of emitting a full 48–60k-char binding every log row. ACK parsing and raw log buffer remain immediate and lossless up to bounded preexisting retention.

Verification

PTP Core GCC/Clang/MSVC, ESP32-P4 firmware (SOURCE+RECEIVER), Studio Qt, Windows Lifecycle and exact-head native Preview. Bench remains mandatory for actual sample-epoch accuracy and SIPROTEC subscription; manual smpSynch=1 is a metadata test, not lock proof.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 17, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-17T14:00:59.980893Z b6bcc6f PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: b6bcc6f7b3

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +211 to +214
if (success && root.ptpDesiredForSession) {
root.ptpRestoreChecks = 0
root.ptpRestoreAfterFirmware = true
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Route all PTP actions through the intent owner

This restoration condition is stale whenever the Advanced timing controls are used: PtpExpertPanel.qml:136-137,281,290 calls the session's start/stop methods directly, bypassing the new wrappers that update ptpDesiredForSession. For example, starting from the main tray and then explicitly stopping from Advanced leaves this flag true, so a successful later firmware reflash reaches this branch and unexpectedly restarts the PTP publisher; starting from Advanced has the inverse problem and is never restored. Centralize the intent alongside the session state or route every PTP start/stop control through the same owner.

AGENTS.md reference: AGENTS.md:L26-L31

Useful? React with 👍 / 👎.

@masarray
masarray merged commit fb4329e into feature/studio-matched-ptp-sv-auto-20261017 Oct 17, 2026
20 checks passed
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.

1 participant