Skip to content

fix(core): publish MsgCnt once per cycle to prevent partial reads#1176

Merged
PTKu merged 1 commit into
devfrom
fix-msg-count-flickering-prevention
Jun 10, 2026
Merged

fix(core): publish MsgCnt once per cycle to prevent partial reads#1176
PTKu merged 1 commit into
devfrom
fix-msg-count-flickering-prevention

Conversation

@PTKu

@PTKu PTKu commented Jun 10, 2026

Copy link
Copy Markdown
Contributor

S7-1500 WebAPI samples variables at an arbitrary point of the PLC
cycle. MsgCnt was reset and re-accumulated live within each cycle, so
readers could observe 0 or a partial sum, causing message counts to
flicker in the UI.

Aggregate into protected _msgCntAcc during the cycle and publish the
completed total into MsgCnt at the next cycle's Run/Initialize call.
MsgCnt holds the total of the last completed cycle and is written once
per cycle, at the cost of one cycle of latency.

S7-1500 WebAPI samples variables at an arbitrary point of the PLC
cycle. MsgCnt was reset and re-accumulated live within each cycle, so
readers could observe 0 or a partial sum, causing message counts to
flicker in the UI.

Aggregate into protected _msgCntAcc during the cycle and publish the
completed total into MsgCnt at the next cycle's Run/Initialize call.
MsgCnt holds the total of the last completed cycle and is written once
per cycle, at the cost of one cycle of latency.
@PTKu PTKu merged commit 86951c9 into dev Jun 10, 2026
1 check passed
@PTKu PTKu deleted the fix-msg-count-flickering-prevention branch June 10, 2026 19:34
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