arduino-audio-tools icon indicating copy to clipboard operation
arduino-audio-tools copied to clipboard

Csv auto range for Arduino Serial Plotter

Open mgesteiro opened this issue 1 year ago • 3 comments

Added an auto range feature to the CsvOutput class so data could be visualized easier in the Arduino Serial Plotter, specially in the 2.x IDE version: audio data is better observed when the range doesn't continually change.

Also fixed some errors in the code (including a down-casting from Tto int).

By the way, this feature is transparent: previous code would world exactly as it was doing before.

Best regards!

Screenshot 2023-05-30 at 21 29 00

mgesteiro avatar May 30 '23 19:05 mgesteiro

I don't like this idea: If you think that if you need a clipping functionality, it would be better to implement a ClippingStream (similar to VolumeStream). Or maybe using the VolumeStream actually give more correct result.

pschatzmann avatar May 31 '23 08:05 pschatzmann

It's not -by any means- a clipping feature: it's just a visual aid for the Serial Plotter. Did you at least try it? Did you see the screen capture?

In Arduino IDE 2.x the Serial Plotter is practically unusable for me as the visualization jumps constantly with the vertical axis changing its range continuously, specially when debugging a problem with an ADC. I'm aware this is a Serial Plotter thing, but so it is the CsvOutputclass (it's basically intended for the Serial Plotter, right?).

Of course is up to you: it's your project.

Do you want a separate PR for the fixes in the first commit of this PR? (The hardcoded Serial writes and the downcasting error...)

Best regards

mgesteiro avatar May 31 '23 09:05 mgesteiro

No, I just tried to review your code and the only functionality that I could find was some clipping. What did I miss ? Maybe it would help if you explain your logic... If you prefer to freeze the output you could just limit your output e.g. with copier.copyN(10);

pschatzmann avatar May 31 '23 09:05 pschatzmann