September 2019 Update

New! We're moving to the new forum!

ALL new Blog posts will be on the forum.

Please join us there.

This Blog will no longer be updated...

Tuesday, June 18, 2019

GBW Serial Terminal - First Look

I took the terminal and turned it into a WinForm program, meaning it has a window to run in, not just the DOS window... It also allowed me to add buttons and checkboxes to control it rather than having to use a command line.

The first thing you will probably notice is the color... Yeah!

I used a Rich Text Box to display the data from the serial port, and as I read the data, I process it before writing it to the display. This processing looks for specific TAGS in the stream of data. At the moment, it supports three...

{{HIGHLIGHT}}

{{WARNING}}

{{ERROR}}

Pretty simple, when it sees a tag, it adds the rest of the line (up to a CR) and then SELECTs that text, changes the color, and then continues...

This is written in C# using Visual Studio 2017 Community edition (FREE)



This shows the output from the Maintenance Module, I added the three sample lines just for this screen shot. The colors will be configurable... including the terminal background and text color...

Within the Maintenance Module Code, it's simple to add the color to a line...

Anywhere I want to highlight something...

Serial.print(logDateTime());
if (colorSerialOutput) Serial.print("{{HIGHLIGHT}}");
Serial.println("This is a Highlight");

The boolean colorSerialOutput is set during a handshake between the terminal and the module. Whenever the terminal connects, and it receives data, it will send a command sequence to the module identifying itself, thus enabling any custom features I end up implementing.

I will also try adding the ability to connect to the RPC Server and interact with the serial ports on the laptop in the grow room.Basically right now the RPC server runs the commands to upload firmware to the arduino modules, and takes the output and sends it back to the main program here on my workstation. Having the RPC server open a com port and send/receive data will be exactly the same as I'm doing it here, except instead of sending the data to the rich text box on the form, it will send it back to the workstation via the RPC network pipe...

Since the modules remain plugged in all the time, they are always on the same com ports, even after rebooting everything. It CAN change, but usually only when you plug into a different port... So, that means I can create a database table to hold the com port connection info for each module, and then rather than selecting a com port t the bottom, you will select a module to connect to...

THAT will be cool :)


No comments:

Post a Comment

Any comments deemed off topic or offensive will be removed