Skip to content

Conversation

@SvenHaedrich
Copy link
Collaborator

Display the essential data to support inspection of a DaliFrame object.

Display the essential data to support inspection of a frame object.
@github-actions
Copy link

🦙 MegaLinter status: ✅ SUCCESS

Descriptor Linter Files Fixed Errors Elapsed time
✅ COPYPASTE jscpd yes no 1.38s
✅ MARKDOWN markdownlint 1 0 0.34s
✅ MARKDOWN markdown-link-check 1 0 1.97s
✅ MARKDOWN markdown-table-formatter 1 0 0.23s
✅ PYTHON black 5 0 2.69s
✅ PYTHON isort 5 0 0.2s
✅ PYTHON pylint 5 0 5.27s
✅ PYTHON pyright 5 0 7.93s
✅ PYTHON ruff 5 0 0.01s
✅ REPOSITORY gitleaks yes no 0.07s
✅ REPOSITORY grype yes no 17.84s
✅ REPOSITORY secretlint yes no 0.89s
✅ REPOSITORY trivy yes no 6.73s
✅ REPOSITORY trufflehog yes no 2.67s
✅ SPELL cspell 42 0 3.87s
✅ SPELL lychee 1 0 1.38s

See detailed report in MegaLinter reports

You could have the same capabilities but better runtime performances if you use a MegaLinter flavor:

MegaLinter is graciously provided by OX Security

Comment on lines +57 to +59
if self.priority != 0:
data = data + f" priority: {self.priority}>"
return data
Copy link
Contributor

Choose a reason for hiding this comment

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

(cleanup)

Suggested change
if self.priority != 0:
data = data + f" priority: {self.priority}>"
return data
if self.priority != 0:
data = data + f" priority: {self.priority}"
return data + ">"

However:

(personal preference) If I saw a repr without the priority, I'd assume it having the default priority. This is not the case, because default priority is 2. But I can also see why people may assume unstated = zero. I would nib this ambiguity in the bud by always stating the priority.

Copy link
Collaborator Author

@SvenHaedrich SvenHaedrich Dec 22, 2025

Choose a reason for hiding this comment

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

Actually another rabbit hole opens up. priority makes only sense when a frame is send. At the moment, for received frames the priority is untouched and it will be the default value for sending frames.
I would only print out legal priorities, within [2,5] that is. And, in a second step make another PR where I ensure that priority is None for received frames.


def __repr__(self):
if self.status != DaliStatus.OK:
return f"<DaliFrame {self.status}>"
Copy link
Contributor

Choose a reason for hiding this comment

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

(FWIW) Maybe this should also include the message. But I'm unsure what the "message" is used for.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

The serial interface provides additional information about erroneous frames. This is put into the message string. Such a message can be: "ERROR TIMING: START - BIT: 4 - TIME: 1356 USEC". I agree it makes sense to print this information here.
For error-free frames there should be no useful message-contents.

elif self.length == 32:
data = data + f"0x{self.data:08X}"
else:
data = data + f"0x{self.data:08X} (unknown length)"
Copy link
Contributor

Choose a reason for hiding this comment

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

(personal preference)

Suggested change
data = data + f"0x{self.data:08X} (unknown length)"
data = data + f"0x{self.data:X} (unknown length)"

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.

3 participants