722 views
in System Integration by

Dear Sir,

In the process of embedded device development, it is difficult to obtain the serial debugging messgages of prototype device without fixture. Is there any way to redirect the serial port information to the UI and scroll the serial port information like the serial port assistant of the computer?
It will be the best if time stamp can be added into the head of each serial message.smiley

From my view, if only one message is displayed, it is easy to implement. But If want to display several messages whatever scrolling or not, I have no idea on that.

So is there any good way to achieve this display requirement?

Thanks.

 

1 Answer

0 votes
by

Hello,

typically the serial interface is used to print debug and error messages from the GUI application to a connected terminal application on the PC.

In principle it would be possible to show these messages as a list within the GUI application (e.g, you can make a list of messages by using the VerticalList) - but then the list of debug messages is part of your GUI application. This means, in some cases (e.g. your application is out-of-memory or there happens a fatal error) it is not possible to create and show the list of error messages.

In case there is no possibility to spend a serial interface for the debug messages, let me recommend to print the messages in a reserved memory area and download it with your debugger.

Best regards,

Manfred.

by

Thanks Manfred,

I will follow your suggestion to use vertical list to implement that.

Another issue aoubt WrapText:

What my expectation that the string will be displayed like:   

But actually, the string is displayed like:

Is there any method to make "Log" and "66666666688889999" in the same line? They are not split to 2 lines. 

Thanks.

 

by
The length of debugging information is variable, so each Item height  is different.

But the ItemHeight of vertical list must be a fixed value.

So I use the outline method.
by
I do not know the format of your debug messages - maybe there is some text processing necessary.

Let me recommend to use a fixed layout of the debug messages and to use a vertical list instead of an outline. The vertical list is ideal to handle a growing list or a list with hundreds or thousands of entries.
by

1. For example, the debug message string like: 

"Serial Debug Log 696666666666666666666666666666666666666666666666666666666669"

only characters and space in messages. No wrap or othters special symbols in it. There is only one "SPACE" between "Log" and "6666", Why does it display with a "Wrap" in text view which was snapshot in my last comment? Can text view display the raw string without any line break?

You can try this on your EW, Text view display a long string ( includes space) with WrapText Enabled.

2. In general, Vertical List includes many items, Is it right? These items must have the same height. Is it right?

I know, vertical list is a better choice for a variable number of items.

In my vertical list design, one item (text view) is for one debug message. Total 20 items as the message buffer.  For each message, the length of messages is different than others. So if WrapText is enabled, the height of text view are different. How these different item height are used for vertical list ?

Base on the reason above, I have to chooce Outline method for message display. In EW simulator, outline method looks work well. It can include items with different height.

by
Hi Manfred,

Could you help to have any comments or suggestion for my question?

Thanks.
by

Hi,

the automatic text wrap applies primarily to space characters (blanks). The algorithm parses the string and inserts a line break as soon as the next word does not fit into the current line. This means, that a string "Debug Log 1234567891234556789123456789123456789" will be get a line break after the "Log" when the entire string does not fit into the first line. If the remaining string does not fit into the second line, it will be split.

If you want to control the line break by yourself, you can insert soft-hyphens into your strings to indicate potential line break positions.

See section Wrap the text in multiple rows automatically for more details.

Concerning the vertical list - yes the items must have the same height. In case of an endless list of debug messages, you can create a list of debug message items, each with a fixed number of lines (depending on the content that you want to show). For longer messages, you can truncate the text with ellipsis and and show the full message within an overlay window when the user taps on the item. Just an idea... But this depends on the content that you want to present and on the UI design that you want to achieve.

I hope this helps.

Best regards,

Manfred.

by

Hi Manfred,

Thanks for your reply.

I have read the Wrap text section before and knew the ~ and ^ characters.

What I expect is that EW LCD can display the original text which copied from serial port. Remove these automatically added line breaks instead of adding them.

These debug messages are output to the serial port and also displayed on the LCD, only for the purpose of seeing these information under special circumstances, which is an auxiliary way.

For these messages, I don't know the content ( no any special format ) of these messages, also can't specify what the content should be.

 Any way, if there is no better way, it will have to stay the way it is.That's ok for debug log.

In addition, for the display of long text, I implemented in this way below. Just a reference to other questioners.

As you can see from the position of the scroll bar, the example text content is very long (29,724 charactors).

var int32 height = 0;
Outline.ScrollOffset.y = 50;

height = Text_log.GetContentArea().y2; // in my example, the Text content y2 is 13845, 550 lines.

if(height > 430)
{
  Text_log.Bounds.y2 = height; // Expand the text view boundary to 
                               // fit the longer text than one page.
}
else
{
  Text_log.Bounds.y2 = 480;
}

Outline.ScrollOffset.y = 500 - Text_log.Bounds.y2; // scroll display to last line

Thank you very much.

by

Thank you for sharing the results and for thinking of other questioners too! smiley

Maybe I did not fully understand the use-case - I assumed more a sequence of single debug messages rather than an endless stream of characters...

by

Yes,it is only a example to verify whether my design can display long text string.

As your mentioned, for the string "Debug Log 1234567891234556789123456789123456789", EW will add a line break after the "Log" when the entire string does not fit into the first line.  This "line bradk"  is not my expection.

My purpose is that a string "Debug Log 1234567891234556789123456789123456789" will be displayed as :

 

should not be displayed as: ( line break after "Log" is not my expected)

Thanks.

by

In this case you can implement your own line-break algorithm. The method GetTextExtent() of the class Resources::Font can be used to calculate the size of a given string. As soon as a certain part of the string exceeds the desired width, you can insert a line-break and calculate the next chunk of text.

Of course, this requires some text processing but should be possible within a few lines of code...

by
Thanks.

I will try your idea.

Jerry

Embedded Wizard Website | Privacy Policy | Imprint

...