avr-hal icon indicating copy to clipboard operation
avr-hal copied to clipboard

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

Open tippfehlr opened this issue 1 year ago • 12 comments

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 avatar May 19 '24 22:05 tippfehlr

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 avatar Jun 08 '24 11:06 Rahix

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.

Rahix avatar Apr 22 '25 13:04 Rahix

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

tippfehlr avatar Apr 23 '25 17:04 tippfehlr

I keep output-mode as a cli override?

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

Rahix avatar Apr 24 '25 00:04 Rahix

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 avatar Apr 26 '25 21:04 tippfehlr

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

tippfehlr avatar Apr 27 '25 14:04 tippfehlr

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

Rahix avatar Apr 27 '25 17:04 Rahix

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 avatar May 02 '25 21:05 tippfehlr