Serial Monitor appears in one of the menu items of evive. It asks the user to select the serial and also allows users to set the baud rate at which they want to open the serial port. It, then, reads and displays the data coming from the selected serial at specified baud rate by the user. With the Serial Monitor, it is also possible to display the multiple serial data displaying simultaneously on the screen of evive. Different Serial data are displayed in different colours i.e. Serial 1 with White; Serial 2 with Magenta; Serial 3 with Blue. It is an essential tool for debugging.
There is a library serialMonitor in evive which is responsible for the implementation of Serial Monitor. Looking into the library there are a variety of functions which ease down the process of implementation.
Implementation has been broken down into two parts:
The first part is achieved by the function:
It sets the specified serial at the specified baud rate.
The specified serial and specified baud rate is determined by serialSelect = prevEncoderPosition; & baudrate[encoderPosition] based on encoderPosition in screen.cpp.
The second part is achieved by the function :
Each one responsible for displaying the data from their serials on evive screen. It first check if the specified serial is available or not by
It, then, counts the message length so as to appropriately displaying a message on screen & then there is an if ( ln + l > 16 ) which checks whether the screen has got filled if filled then it erases next line accordingly and displays it.
It also has SerialMonitor: lnCount(int ln) which counts the number of lines needed for the message to be printed. Since ln is globally defined hence if there are multiple data from various serials can be shown simultaneously using different colours.