Skip to content
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

AP_Scripting: add a simple serial dump script #28912

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

peterbarker
Copy link
Contributor

the existing example seems to do way too much work so has trouble capturing at higher baud rates.

the existing example seems to do *way* too much work so has trouble capturing at higher baud rates.
@peterbarker peterbarker force-pushed the pr/simple-serial-dump branch from cdd49b8 to c949077 Compare December 20, 2024 06:13
@tpwrules
Copy link
Contributor

Ports have readstring as of 4.6 which would make things massively more efficient.

if c == nil then
break
end
file:write(string.char())
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
file:write(string.char())
file:write(string.char(c))

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Question.

How was this working with this problem in here?!

The data coming out looked valid to me (it's in my LD06 PR).

Copy link
Contributor

@tpwrules tpwrules Dec 21, 2024

Choose a reason for hiding this comment

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

I don't know, that would imply a really interesting bug in the Lua interpreter. I couldn't find the PR you mentioned, but I assume you fixed it and forgot to update the code in Git.

Also read returns -1 on error, not nil.

And it's strange to open and close the file every loop. Probably better to simply flush it every n loops.

And c should be local...

@peterbarker
Copy link
Contributor Author

Ports have readstring as of 4.6 which would make things massively more efficient.

I'm guessing we're not running that....

@peterbarker
Copy link
Contributor Author

We could potentially look to see if we have the readstring binding and use it if available, 'though.

I'll need to remove "Simple" from the script name then....

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.

2 participants