Editing Python Smart Terminal Technical Details
Jump to navigation
Jump to search
Warning: You are not logged in. Your IP address will be publicly visible if you make any edits. If you log in or create an account, your edits will be attributed to your username, along with other benefits.
The edit can be undone. Please check the comparison below to verify that this is what you want to do, and then save the changes below to finish undoing the edit.
Latest revision | Your text | ||
Line 1: | Line 1: | ||
This page is for some fairly fine scale detail on how things are implemented in the Smart Terminal, they may be useful as techniques in other applications. See also: [[Russ Python Tips and Techniques]] | This page is for some fairly fine scale detail on how things are implemented in the Smart Terminal, they may be useful as techniques in other applications. See also: [[Russ Python Tips and Techniques]] | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
= Finding the Arduino - Comm Port Details = | = Finding the Arduino - Comm Port Details = | ||
Line 19: | Line 7: | ||
== Comm Port Validation == | == Comm Port Validation == | ||
− | + | * So you open a comm port, the first level of validation is that the port opens. | |
+ | * The second level of validation is that the port can send and receive, this is checked by sending a text string and looking for a response. | ||
+ | * The third level is to look at the received string. If it contains the correct substring then the port is valid. | ||
− | + | For example the terminal may send "v<cr>", recieve "GreenHouse Monitor v3 2017 01 24.01<cr>", and look for "GreenHouse" in the recieved string. This would validate the port. | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | + | So what does the terminal send and what does it look for -- see the parameter file: | |
− | |||
− | So what does the terminal send and what does it look for -- see the parameter file | ||
<pre> | <pre> | ||
Line 36: | Line 19: | ||
# the arduino is supposed to respond to a version request with a string | # the arduino is supposed to respond to a version request with a string | ||
# containing this, they are part of the name of an Arduino application | # containing this, they are part of the name of an Arduino application | ||
+ | self.get_arduino_version = "v" | ||
− | + | self.arduino_version = "GreenHouse" | |
− | |||
− | self.arduino_version = "GreenHouse" | ||
</pre> | </pre> | ||
− | |||
− | |||
== What are the Possible Comm Ports == | == What are the Possible Comm Ports == | ||
Line 75: | Line 55: | ||
* Add the ports in the parameter port list ( no duplicates ). | * Add the ports in the parameter port list ( no duplicates ). | ||
− | If no ports are actually present you can test 20 ports in seconds. Sending and receiving strings takes longer. | + | If no ports are actually present you can test 20 ports in seconds. Sending and receiving strings takes longer. Not that all of this is done using the baud rate and other parameters in the parameter file. |
So with this list we loop through it trying to validate each port. | So with this list we loop through it trying to validate each port. | ||
− | |||
− | |||
− | |||
− | |||
== Code in SmartTerminal == | == Code in SmartTerminal == | ||
− | |||
− | |||
* Review this for the inner inner details. Send questions if not clear. | * Review this for the inner inner details. Send questions if not clear. | ||
Line 94: | Line 68: | ||
* first subroutine above is called from ( same object ) find_arduino( ) which constructs the port list and get parameters as needed from parameters. | * first subroutine above is called from ( same object ) find_arduino( ) which constructs the port list and get parameters as needed from parameters. | ||
− | + | ||
− | |||
[[Category:SmartTerminal]] [[Category:Python]] | [[Category:SmartTerminal]] [[Category:Python]] |