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

Adding plotting functionality to the editor #2177

Merged
merged 2 commits into from Jun 29, 2015

Conversation

henningpohl
Copy link
Contributor

I found debugging Arduino projects with, e.g., time-varying capacitive sensor values rather tedious with the serial monitor. I added a graph view that makes it easier to observe such changes.

@matthijskooijman
Copy link
Collaborator

This sounds like an intriguing, if not very specific feature. Any chance you could add a screenshot and some examples of the corresponding strings sent through serial? I'm curious :-)

@henningpohl
Copy link
Contributor Author

Here's a screenshot:
plottingscreenshot

I went for the most simplistic option with this: everything coming in on the serial port is split with every new line, whitespace is trimmed and the left over string is parsed as a double. This assumes there's only one value being send and that it is send as a string. Of course this could be extended to, e.g., use the raw byte values, allow users to specify separators, show multiple graphs, etc. Again: I first tried to get the basic thing in there.

@mbrav
Copy link
Contributor

mbrav commented Jul 16, 2014

Please Merge this! This would be an awesome feature. Just like Processing has a Color Picker under the "Tools" bar, so should Arduino have this specific "Graph" feature.

P.S. Your proposed Graphing Icon is really awesome!

@q2dg
Copy link

q2dg commented Mar 31, 2015

+1 !!

@cmaglie cmaglie added feature request A request to make an enhancement (not a bug fix) Component: IDE user interface The Arduino IDE's user interface labels Apr 15, 2015
@ffissore ffissore self-assigned this May 12, 2015
@ffissore
Copy link
Contributor

@henningpohl can you please rebase/merge your PR with the current master? It doesn't merge any more

@ffissore ffissore added the Waiting for feedback More information must be provided before we can proceed label May 26, 2015
@henningpohl
Copy link
Contributor Author

So, my PR now is quite old and a lot of things seem to have changed in the codebase. Also around SerialMonitor. If I update my code, should the plotter also extend AbstractMonitor? Conceptually that would make sense. However, AbstractMonitor isn't really that abstract. There are already a whole bunch of UI components in there which would not be needed for plotting. That could be moved to an AbstractTextualMonitor or something like that. But that would be a larger change. Any thoughts?

@ffissore
Copy link
Contributor

Well it's abstract as far as serial and network monitors are concerned. Sure a plotter monitor requires more abstraction, or a totally independent code. I would do the minimum for making it viable and still be, if not proud, at least convinced of the quality of the code.

@henningpohl
Copy link
Contributor Author

Alright, I got everything to compile and work again. It would be great if somebody more familiar with the codebase could have a look. I mostly tried to go by what was in place in SerialMonitor and AbstractMonitor, but might have misunderstood some intentions here or there.

@ffissore
Copy link
Contributor

@ArduinoBot build this please

@ffissore ffissore removed the Waiting for feedback More information must be provided before we can proceed label May 27, 2015
@facchinm
Copy link
Member

👍 !!!
Only one problem: it doesn't close the serial port when closing the plot window, so the serial monitor can't open anymore (pretty annoying) -> saw on Linux x64 with a Leonardo

@henningpohl
Copy link
Contributor Author

Hmm... I tested this on Ubuntu 14.04 (64 bit) in a VM and on Windows 8 (64 bit) and the serial port closed on both. I think I did find the problem though: if one tries to open the serial monitor/plotter while the other window is open, that fails but puts the application in a state where opening will also fail in the future even if the other window is closed. I added a check for that and switching between both windows should now work.

The better solution would be to have the serial connection somewhere central in the editor and allow any number of subscriptions to incoming data elsewhere. But that probably would be a larger change on its own.

@henningpohl henningpohl force-pushed the master branch 2 times, most recently from 74028a8 to fc3e295 Compare May 28, 2015 15:31
@ffissore
Copy link
Contributor

@ArduinoBot build this please

@PedroLopes
Copy link

Awesome pull request, definitively a feature I want to have in the IDE!

(if possible in the future something in the lines of https://code.google.com/p/arduinoscope/ would be even better, but this is a fantastic start!)

@Chris--A
Copy link
Contributor

This is a really nice feature, and it works really well. I can see many ways it can be expanded into a super useful tool while keeping the interface as basic as possible.

@mbrav
Copy link
Contributor

mbrav commented Jun 1, 2015

Wish I had the opportunity to test this but I'm happy to see this feature come!! 👏👏👏

@ffissore
Copy link
Contributor

ffissore commented Jun 1, 2015

@mixania you still have it: code still needs to be merged

@ffissore
Copy link
Contributor

ffissore commented Jun 1, 2015

@ArduinoBot build this please

@ffissore
Copy link
Contributor

ffissore commented Jun 4, 2015

@ArduinoBot build this please

@q2dg
Copy link

q2dg commented Jun 15, 2015

Serial plotter is available in BUILD 317 but it is not in 1.6.5. Why?
Thanks

@ArduinoBot
Copy link
Contributor

ArduinoBot commented Jun 15, 2015 via email

@ffissore
Copy link
Contributor

@henningpohl after some consideration, we would like to merge this feature. However we are puzzled by the added button next serial monitor one: we think either it won't get noticed or it will confuse users. Is removing the button and leaving the menu entry under Tools ok for you?
Restoring previous versions of EditorToolbar.java and buttons.git should suffice

@ffissore ffissore added the Waiting for feedback More information must be provided before we can proceed label Jun 22, 2015
@ffissore ffissore added this to the Release 1.6.6 milestone Jun 22, 2015
@henningpohl
Copy link
Contributor Author

Great! I'd be fine with removing the button. Would it be an option to leave the image in buttons.gif though? While adding a button to the interface is an easy change, recreating an icon is a bit more work. There might be a button in the future, or the icon might be used in the window title. I could alternatively also make removal a dedicated commit, keeping the larger buttons.gif in the history.

I'm also out of office right now, so can't properly test changes. I will update this and get it ready early next week.

@ffissore
Copy link
Contributor

The changed image is already in the history. If you prefer, it's ok to edit buttons.gif in a dedicated commit

ffissore added a commit that referenced this pull request Jun 29, 2015
Adding plotting functionality to the editor
@ffissore ffissore merged commit 09b29b3 into arduino:master Jun 29, 2015
@ffissore
Copy link
Contributor

Thanks!

@ffissore ffissore removed the Waiting for feedback More information must be provided before we can proceed label Jun 29, 2015
@ffissore ffissore mentioned this pull request Jul 2, 2015
@q2dg
Copy link

q2dg commented Sep 28, 2015

Could it be possible to add to Serial Plotter the ability of recognize several serial streams to be able to paint several graphs accordingly?? I mean...I'd like to see on Serial Plotter the evolution of data got by two different analog sensors at the same time, in two different coloured graphs.
Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Component: IDE user interface The Arduino IDE's user interface feature request A request to make an enhancement (not a bug fix) SerialPlotter Tools > Serial Plotter
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet