Skip to content

[ravedude] add output modes, newline after n bytes or after char #549

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

Open
wants to merge 7 commits into
base: main
Choose a base branch
from

Conversation

tippfehlr
Copy link
Contributor

@tippfehlr tippfehlr commented May 19, 2024

From --help:

    -o <output-mode>
            Output mode. Can be ascii, hex, dec or bin

        --newline-on <newline-on>
            Print a newline after this byte
            not used with output_mode ascii
            hex (0x) and bin (0b) notations are supported.
            matching chars/bytes are NOT removed
            to add newlines after \n (in non-ascii mode), use \n, 0x0a or 0b00001010
        --newline-after <newline-after>
            Print a newline after n bytes
            not used with output_mode ascii
            defaults to 16 for hex and dec and 8 for bin
            if dividable by 4, bytes will be grouped to 4

This helps when working with non-ascii output.

Other solutions:

  • use another serial console: too much context switching for me, having the serial console in watch mode is way better.
  • use ravedude and pipe into hexdump or xxd: they only handle streamed data line by line, meaning the data is not printed immediately. They also can’t add newlines.

@tippfehlr tippfehlr force-pushed the ravedude-output-modes branch from 464f52f to da3eeb9 Compare May 19, 2024 22:45
@tippfehlr tippfehlr marked this pull request as ready for review May 19, 2024 22:45
@Rahix
Copy link
Owner

Rahix commented Jun 8, 2024

Thanks a lot for your contribution! I like this change a lot.

Right now, we are doing a rather large rework of ravedude in #522. I'll get back to your PR once that work is finished, otherwise things will get a bit too messy. I don't expect a lot of conflicts with your changes, though.

@Rahix
Copy link
Owner

Rahix commented Apr 22, 2025

Hi, sorry for only getting back to this now. #522 has landed. If you are still interested in pursuing this work here, please rebase ontop of the new code. I think your new options should also be moved into Ravedude.toml now, rather than being CLI options.

@tippfehlr
Copy link
Contributor Author

I’ll do that. Should I keep output-mode as a cli override? That’s probably the option I’d switch the most.

@Rahix
Copy link
Owner

Rahix commented Apr 24, 2025

I keep output-mode as a cli override?

Yeah, I think adding a CLI override is a good idea.

@tippfehlr tippfehlr force-pushed the ravedude-output-modes branch from 94fc5d7 to 80801f5 Compare April 26, 2025 18:36
Copy link
Owner

@Rahix Rahix left a comment

Choose a reason for hiding this comment

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

Thanks a lot for picking this up again!

I have a few comments, see below :) Please also check the CI after updating, it currently seems to throw some error.

@tippfehlr
Copy link
Contributor Author

Thanks for the very thorough review, I’ll do that tomorrow. I was happy that my git rebase was successful and also still want to test this with an Arduino.

@tippfehlr
Copy link
Contributor Author

That should address all your comments, I didn’t test it yet though.

@Rahix
Copy link
Owner

Rahix commented Apr 27, 2025

Please run cargo fmt on the code, there seem to be a few formatting issues. Let me know once you have tested it :)

@tippfehlr
Copy link
Contributor Author

That should do it, sorry for not formatting it right away. I also tested it now, no problems (only that the console info was printed twice, fixed in the last commit. forgot to mention that in the commit message though)

@tippfehlr tippfehlr requested a review from Rahix May 2, 2025 21:48
@Rahix Rahix added the ravedude label May 3, 2025
@Rahix Rahix force-pushed the ravedude-output-modes branch from a571051 to 759b3c8 Compare May 5, 2025 15:15
tippfehlr added 7 commits May 5, 2025 17:51
sometimes printing ascii isn’t useful, and the raw hex, binary or
decimal data should be printed.

newline_after adds a newline after the n’th byte
newline_on adds a newline after the given byte
@Rahix Rahix force-pushed the ravedude-output-modes branch from 759b3c8 to 98a3395 Compare May 5, 2025 15:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants