Welcome, Guest. Please Login or Register
Arduino IDE for Visual Studio
 
 
When Logging a Support Issue in the Forum, please ensure you have also:-
  • Enabled vMicro > Compiler > Show Build Properties and Verbose
  • Re-Compile your program with these settings enabled
 
Save the new Output to a Text File and....
Support requests without the output above may be impossible to answer, so please help us to help you
 
  HomeSearch Tutorials & Wiki visualmicro.com LoginHelpRegister  
 
Page Index Toggle Pages: 1
Send Topic Print
Serial port line break only at \r\n (Read 5215 times)
Bruno
Newbies
*
Offline



Posts: 3
Serial port line break only at \r\n
Oct 7th, 2011 at 11:53pm
 
Hi again =)

I've come to pester some more.

I noticed that the new shiny serial port monitor only breaks lines when it receives a \r\n (Windows).

All of my debug code uses only a trailing \n (*nix).

It would be very cool if there was an option in the settings that would auto replace the line endings when enabled.
Something like, ConvertSerialEOL ?

On receive -> if char = \n, append \r\n.

Cheesy

Congrats on the new 10.x extension btw, it's a lot more sexy.

-- bbf

Back to top
 
 
IP Logged
 
Visual Micro
Administrator
*****
Offline



Posts: 10464
United Kingdom
Re: Serial port line break only at \r\n
Reply #1 - Oct 8th, 2011 at 12:25am
 
Thanks:)

That makes sense

Should it be a system wide setting for all the serial windows or a setting per window?
Back to top
 
WWW  
IP Logged
 
Visual Micro
Administrator
*****
Offline



Posts: 10464
United Kingdom
Re: Serial port line break only at \r\n
Reply #2 - Oct 8th, 2011 at 12:28am
 
actually another question

how do arduino and other serial tools handle this. does \n wrap text lines? if so we should do this by default?
Back to top
 
WWW  
IP Logged
 
Bruno
Newbies
*
Offline



Posts: 3
Re: Serial port line break only at \r\n
Reply #3 - Oct 8th, 2011 at 8:50pm
 
You are right, it might make sense to have it per serial windows... maybe a little checkbox at the bottom.

In arduino, the serial monitor is just a wrapper for the RXTX library. And there, a simple \n will the cursor skip to the next line. I was mostly using that, and it was one of the reasons I saw the clutter when using your serial window.

But the arduino library has a Serial.println() which sends a \r\n. Since some people will be using that, it makes sense to have it configurable.

In my own serial parsing library, implemented in C for the arduino itself, I have an auto-magic way of handling these sequences. I convert all \r\n to \n by reading, and peeking the next char.
Back to top
« Last Edit: Oct 8th, 2011 at 8:52pm by Bruno »  
 
IP Logged
 
Visual Micro
Administrator
*****
Offline



Posts: 10464
United Kingdom
Re: Serial port line break only at \r\n
Reply #4 - Oct 8th, 2011 at 9:42pm
 
funny, in vs if the option is on, i was thinking of find the previous char to \n and if not \r then replacing \n with \r\n

we've been watching the cpu usage with serial windows open and ensured the serial stuff is quite efficient.

this option would slow things down a fraction because at the moment incoming serial data is not scanned or retained except in the viewer textbox. Let's see if it does slow things down, if not then maybe it could be a global option?

Would you mind adding it as a request to the issue tracker on codeplex. I think it's fair to say that it is an issue because we should be doing everything that arduino does

thanks

Back to top
 
WWW  
IP Logged
 
Page Index Toggle Pages: 1
Send Topic Print