这是indexloc提供的服务,不要输入任何密码
Skip to content

Add flag to disable CYCLE_ERROR in log #542

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jul 1, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions internal/args/init.go
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,7 @@ Example: "-pick err:wrn -pick default" results in suppressing all messages despi
fsScLog.BoolVar(&emitter.TagStatistics, "tagStat", false, `Print Trices occurrences count on exit.`)
fsScLog.BoolVar(&decoder.TriceStatistics, "triceStat", false, `Print Trices occurrences count on exit.`)
fsScLog.BoolVar(&emitter.AllStatistics, "stat", false, `Print complete statistics on exit.`)
fsScLog.BoolVar(&trexDecoder.DisableCycleErrors, "noCycleCheck", false, `Disables reporting of cycle errors.`)
}

func addInit() {
Expand Down
2 changes: 2 additions & 0 deletions internal/args/tricehelpall_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,8 @@ sub-command 'l|log': For displaying trice logs coming from port. With "trice log
(default "off")
-newlineIndent int
Force newline offset for trice format strings with line breaks before end. -1=auto sense (default -1)
-noCycleCheck
Disables reporting of cycle errors.
-p string
short for -port (default "J-LINK")
-packageFraming string
Expand Down
3 changes: 2 additions & 1 deletion internal/trexDecoder/trexDecoder.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ var (
Doubled16BitID bool
AddNewlineToEachTriceMessage bool
SingleFraming bool // SingleFraming demands, that each received package contains not more than a singe Trice message.
DisableCycleErrors bool
)

// trexDec is the Decoding instance for trex encoded trices.
Expand Down Expand Up @@ -397,7 +398,7 @@ func (p *trexDec) Read(b []byte) (n int, err error) {
if cycle == 0xc0 && p.cycle == 0xc0 && !decoder.InitialCycle { // with or without cycle counter and seems to be a normal case
p.cycle = cycle + 1 // adjust cycle
}
if cycle != 0xc0 { // with cycle counter and s.th. lost
if cycle != 0xc0 && !DisableCycleErrors { // with cycle counter and s.th. lost
if cycle != p.cycle { // no cycle check for 0xc0 to avoid messages on every target reset and when no cycle counter is active
n += copy(b[n:], fmt.Sprintln("CYCLE_ERROR:\a", cycle, "!=", p.cycle, " (count=", emitter.TagEvents("CYCLE_ERROR")+1, ")"))
n += copy(b[n:], " ") // len of location information plus stamp: 41 spaces - see NewlineIndent below - todo: make it generic
Expand Down