Editing Smart Terminal Parameter Examples
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: | ||
= What/Why/How the Parameter File = | = What/Why/How the Parameter File = | ||
− | A lot of the behavior of the terminal is controlled by the file '''parameters.py'''. Different projects of mine require different parameters. The first | + | A lot of the behavior of the terminal is controlled by the file '''parameters.py'''. Different projects of mine require different parameters. The first that might spring to mind are the port and baud rate for the terminal. But the parameter file can change so much more some are simple like adding a colored band to the terminal ( useful if you have more than one terminal running at a time ) to adding whole new modules that modify the graphical user interface ( GUI ) and add automatic processing. |
− | |||
− | |||
== Different Approaches == | == Different Approaches == | ||
− | * To start with you can just run with the parameter file as shipped. This gives a reasonable terminal that runs fine, but probably will not run with the baud rate and comm port that you desire | + | * To start with you can just run with the parameter file as shipped. This gives a reasonable terminal that runs fine, but probably will not run with the baud rate and comm port that you desire so almost for sure you will need to adjust these. There are lines near the top of the parameter file to do this. For more info see the section below. |
* Another method is to use different parameter files for different projects. These might be copied into the smart terminal directory when you want to use them. Works fine but is cumbersome. Start from my file and modify. I do not recommend this approach, but you may want to do it. | * Another method is to use different parameter files for different projects. These might be copied into the smart terminal directory when you want to use them. Works fine but is cumbersome. Start from my file and modify. I do not recommend this approach, but you may want to do it. | ||
Line 13: | Line 11: | ||
* You can also use a secondary parameter file that overrides the settings in the first file. This is great if you want to run 2 copies of the terminal. Which secondary parameter file is used is controlled from the command line. For more info see the section below. ( coming soon ) | * You can also use a secondary parameter file that overrides the settings in the first file. This is great if you want to run 2 copies of the terminal. Which secondary parameter file is used is controlled from the command line. For more info see the section below. ( coming soon ) | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | + | * The method But right now I am working with a somewhat different method that seems easier to manage. This is the method in the supplied parameter file and the one that I will explain here. The parameter file is heavily commented and these comments should be read if you have questions. You can also search other files for parameters.xxx where xxx is the name of the parameter you are investigating. | |
In the '''__init__''' method after a couple of required lines that help hold the application together there is a call to '''self.default_terminal_mode()'''. This subroutine sets a ton of parameters | In the '''__init__''' method after a couple of required lines that help hold the application together there is a call to '''self.default_terminal_mode()'''. This subroutine sets a ton of parameters | ||
and this is enough to make the terminal run nicely. See the comments in the subroutine for more info. | and this is enough to make the terminal run nicely. See the comments in the subroutine for more info. | ||
− | I then have a call to a short ( so far ) subroutine | + | I then have a call to a short ( so far ) subroutine '''self.computer_name_tweaks( )''' This subroutine uses the already/automatically set parameter '''computername''' to tweak a few settings depending on the computer's name. |
− | + | This makes it easy for me to change the default parameters setting based on the computer I am using to run the program. Thus I can move the program around without changing the parameter file. | |
− | |||
− | |||
− | |||
− | + | In a similar way there is a subroutine | |
− | |||
+ | Finally I make a call to a subroutine like: well_monitor_mode(). This is the file for an arduino project that monitors my water well pressure. This is a pretty complicated set up, because of the database access in the well monitor. For this documentation I will do a subroutine called tutorial_example_mode() which make the most basic changes from the default mode. | ||
− | + | = tutorial_example_mode() = | |
This mode just changes the default baudrate and the buttons/default data for the button. Read the comments ( here or better in the actual file ) , they are pretty clear: | This mode just changes the default baudrate and the buttons/default data for the button. Read the comments ( here or better in the actual file ) , they are pretty clear: | ||
Line 65: | Line 55: | ||
</pre> | </pre> | ||
+ | |||
= Another example mode = | = Another example mode = | ||
− | make it a bit more complicated | + | make it a bit more complicated. |
− | |||
− | |||
− | |||
− | |||
+ | = Reference = | ||
== Overview == | == Overview == | ||
Line 90: | Line 78: | ||
* '''serialAppend''': characters ( like cr and lf ) placed at the end of transmitted strings | * '''serialAppend''': characters ( like cr and lf ) placed at the end of transmitted strings | ||
* '''auto_open''' = False # true to open port on start up # !! *todo | * '''auto_open''' = False # true to open port on start up # !! *todo | ||
+ | |||
* '''prefix_send''': a prefix shown in the "receive area" to show that the data has been sent | * '''prefix_send''': a prefix shown in the "receive area" to show that the data has been sent | ||
Line 101: | Line 90: | ||
* '''arduino_connect_delay''' = 10 # may not be implemented yet | * '''arduino_connect_delay''' = 10 # may not be implemented yet | ||
+ | |||
* '''gui_sends''' = 15 # number of send frames in the gui beware if 0 | * '''gui_sends''' = 15 # number of send frames in the gui beware if 0 | ||
* '''max_send_rows''' = 3 # the send areas are added in columns this many rows long, then a new | * '''max_send_rows''' = 3 # the send areas are added in columns this many rows long, then a new | ||
− | * '''default_scroll''' = 1 # 1 auto scroll the | + | * '''default_scroll''' = 1 # 1 auto scroll the recieve area, else 0 |
== Extended Processing == | == Extended Processing == | ||
Line 112: | Line 102: | ||
*'''ext_processing_module''': module name | *'''ext_processing_module''': module name | ||
− | *'''ext_processing_class''': class name | + | *'''ext_processing_class''': class name |
+ | |||
== Automatically Set == | == Automatically Set == | ||
− | *'''our_os''': "win32" if your are running windows | + | *'''our_os''': "win32" if your are running windows |
− | |||
− | == For the Second | + | |
+ | == For the Second Thread == | ||
* '''queue_length''' = 20 | * '''queue_length''' = 20 | ||
* '''queue_sleep''' = .1 | * '''queue_sleep''' = .1 | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
# ---------- self.start_helper_function = gh_processing.GHProcessing.find_and_monitor_arduino | # ---------- self.start_helper_function = gh_processing.GHProcessing.find_and_monitor_arduino | ||
Line 146: | Line 131: | ||
block_port_closed = False # block sending if port is closed # *todo -- or some warning | block_port_closed = False # block sending if port is closed # *todo -- or some warning | ||
+ | == Appearance == | ||
− | |||
− | |||
− | |||
* '''id_color''': color for an "ID pane" just below the title bar of the window | * '''id_color''': color for an "ID pane" just below the title bar of the window | ||
Line 155: | Line 138: | ||
* '''bk_color''' = "blue" # color for the background, you can match the id color or use a neutral color like gray | * '''bk_color''' = "blue" # color for the background, you can match the id color or use a neutral color like gray | ||
* '''icon''': name of icon for the application | * '''icon''': name of icon for the application | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
= Using a Second Parameter File = | = Using a Second Parameter File = | ||
− | + | ...... coming soon? ..... | |
− | |||
− | |||
− | |||
− | |||
− | |||
+ | = Obsolete Doc, Remove soon = | ||
− | = | + | *Sets part of the title of the application. |
+ | *Sets the communications parameters. Sometimes a little confusing about port names. The arduino IDE sometimes is better at finding the name, check it. Also use the <Ports> button on the GUI. On the apple we have found from <Ports> ('/dev/tty.usbmodem1411', True) and in the parameter file using '''self.port = "/dev/tty.usbmodem1411"''' gave a good connection. Sometimes a reboot will result in a change of the port name. | ||
+ | *Specifies a program for file editing. | ||
+ | *Sets the size of the application. | ||
+ | *Defaults data to be sent. | ||
+ | *Change number of send areas. | ||
+ | *More see the file. | ||
+ | == An Intermediate Difficulty Parameter Example == | ||
+ | *This is based on the file ..../smart_terminal/example_parms/parameters_intermediate.py. | ||
+ | *The parameters include all the basic parameters plus ones to support a greenhouse arduino monitor. | ||
*You should also look at the arduino application and the SmartTerminal extension to support it [[GreenHouse Monitor Program]] as they are closely related. | *You should also look at the arduino application and the SmartTerminal extension to support it [[GreenHouse Monitor Program]] as they are closely related. | ||
*Well commented read the file! | *Well commented read the file! | ||
Line 209: | Line 176: | ||
*Another setting is required for the probe of communications ports. Here it is ( set up for automatic switching between operating systems ) | *Another setting is required for the probe of communications ports. Here it is ( set up for automatic switching between operating systems ) | ||
+ | |||
+ | |||
+ | |||
+ | # used to probe around for ports | ||
+ | if self.os_win: | ||
+ | |||
Line 218: | Line 191: | ||
</pre> | </pre> | ||
− | + | == even more == | |
− | [[Category:SmartTerminal]] [[Category:Arduino/RaspberryPi | + | [[Category:SmartTerminal]] [[Category:Arduino/RaspberryPi]] |