Repository navigation
fix(SV/PTP): fast real AUTO synchronization to own PTP GM without 10-epoch delay - #284
Open
masarray wants to merge 22 commits into
Conversation
…e; retain conservative RECEIVER policy
…ternal PTP retains full conservative gate
…nd fail closed on source, gap, TX, fault
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
…hase handoff failure
… AUTO timing changes
Accept 80 samples/period at 50/60Hz with 4000/4800 fps and epoch wrap; retain per-second and legacy optional omission. Validate SCL binary before commit, emit exact BER fields in firmware, show effective fields in Studio, exercise encoded PDU and malformed metadata in C++ regression. Preserve PTP SOURCE fast measured lock and older ASCII PROFILE compatibility.
…st-source contract Keep conservative LOCAL REF 10-epoch and WARM test gates while explicitly checking SOURCE_FAST measured MAC/phase qualification and acquisition reset. Assert exact 16-bit BER sample fields without MSVC narrowing warning under /WX.
…xposing opt-in AUTO switch console Only non-self matching-domain/transport/VLAN Announce qualifies as discovery, never a timing-LOCK. Pdelay response path unchanged. Introduce AUTOSWITCH 1/0/SHOW without forcing external clocks on users.
…own only after handoff
…op/config/start and rollback Opt-in SOURCE actual external Announce triggers receiver admission after stable evidence. Serialized EMAC break-before-make revokes SV synchronization, never forges receiver lock; measured receiver LOCK controls traceability and SV lease. Lost/unlocked receiver returns to captured local SOURCE with anti-flap cooldown. Manual STOP disables supervisor. Expose status/counters.
…onal IDF build Test qualified consecutive Announce, duplicate/change/expiry, no dual EMAC ownership, missing receiver LOCK, post-LOCK loss, reacquisition, revert cooldown and explicit disable. Compile AUTO command only where PTP firmware is enabled.
…acked status and guardrails Expose real board AUTOSWITCH capability, candidate Announce evidence, handover/return/error counters. Route button through SmartSessionController authority (no QML direct device mutation), prevent optimistic LOCK status, obey START/profile/firmware update gates, refresh asynchronously over existing serial telemetry. No UX bulk or extra build workflow.
…asserting receiver LOCK
… failed hardware rollback When no PTP worker remains after a failed receiver→source recovery, attempt break-before-make local startup every 10s rather than silently losing all timing forever. Preserve STOP cancellation and exclusive EMAC. Studio correctly notes disabling AUTO while RECEIVER stays in control.
…sole/Studio before switch Display physical Ethernet candidate provenance, freshness, stable Announce count and measured receiver authority separately. Stale candidate count falls to zero without discarding observation history. No optimistic GM/LOCK or source recoding.
…VLAN/transport/self admission Move Ethernet qualification into shared portable production predicate. Cover malformed/non-Announce, double-tagged QinQ, mismatched/untagged VLAN, wrong domain/transport, self clock, absent source port and clock-class 255 in CTest. Preserve source hardware timestamp Pdelay responder unmodified.
This was referenced Oct 22, 2026
This was referenced Oct 22, 2026
Closed
Closed
Closed
Closed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Root cause
In the 2026-10-22 capture of PR#282 the ESP32-P4 SOURCE PTP Announce, Sync/Follow_Up and the SV 4kfps/gmIdentity stream were already structurally valid, but AUTO held smpSynch=0 for 85,001 frames (~21.25s). The hard-coded
SvLocalRefAcquisition::kRequiredCleanEpochs=10is a conservative multi-second probation appropriate for an external GM receiver but unnecessarily slow for the ESP32's own EMAC 1588 hardware GM. Manual FORCE_2 immediately sets the flag but bypasses timing evidence.Changes
Hardware gate
CI compilation and portable tests do not certify relay. Run on isolated SIPROTEC bench, measure phase lock acquisition after START, Pdelay exchange and relay accepted SV/current/voltage with no sync alarm. Expected faster lock is not a claimed physical result until measured. Never merge to main or stable without review.
2026-10-22 SCL-derived SV metadata and SOURCE_FAST checkpoint
smpRate=80/smpMod=0at 4000 fps, 60Hz 80 samples/period produces 4800 fps; per-second mode remainssmpMod=1; legacy optional omission remains backward-compatible. Code commit017d9a8db9c4ab7f2598577446c5827f82654ec5; integrated binary 4I4V validation and BER roundtrip regression./WXoptional narrowing warning in sample-rate regression; updated Qt Studio PTP SOURCE_FAST structural contract to require real measured MAC/phase evidence and conservative 10-epoch COLD/WARM tests (25accab5eb45a2036e507f0759ffde0fda9c9b92). Corrected inspector modeSmpPerSecmatching the SCL model (3ebe7299c3bc8c777567dba36ffbdb1f505da457).017d9a8. Windows C++ and Qt contracts initially failed on test-only issues, fixed in subsequent commits above; final exact-HEAD CI still pending at checkpoint. Do not imply ESP32 physical retest.smpSynch=2qualification, alter main/stable, or merge stacked PRs without verifying exact parent graph/CI and explicit user permission.P1 external-GM AUTO failover — implementation checkpoint
056c7bf0c27f1856bcfe779447f4c7d890912e84(branchfix/ptp-source-fast-auto-lock-20261022). Base remains original PR#283; no main/stable merge and no PR history deleted.PTP AUTOSWITCH 1|0|SHOWCLI, only allow ON after active verified SOURCE; Studio invokes only via SmartSessionController, readback from firmware, exposes candidate GM identity/port/class, valid count, switch/return/fail counters. No optimistic LOCK/SV claimed.ariec61850_ptp_external_failover_testsregistered in root CMake for real stable 3-Announce, duplicate/reorder, wrong GM/clock class, mutual-exclusion, lock timeout, post-lock loss, recovery, cooldown and disabled policy. No new workflow created.9f3067a43e9722aaa5ea36dcbb61682bc1687998passed PTP Core GCC/Clang/MSVC, C++ CI GCC/Clang/MSVC and ESP32 PTP SOURCE+RECEIVER IDF builds. Current exact056c7bf0CI status must be checked again before merge; changes after 9f include bounded rollback retry and metadata UI.c0f3b4e3c22dff62f011a9cf88af6fbdf42a50c0: shared productionptp_external_candidate_from_framevalidates PTP Announce, domain, transport, VLAN/untagged/QinQ, not-self, source port and clock class; portable CTest now exercises the exact predicate used by the ESP32 source RX, not a duplicate test-only network filter. Final exact-HEAD CI and physical tests remain unverified until results.