-
Notifications
You must be signed in to change notification settings - Fork 130
Core and Startup
Here are the basic steps of the MisterHouse program:
-
Read config files and initialise things
-
Setup the OLE Text To Speech (TTS) item or Festival socket port
Setup the OLE Voice Recognition item or socket to the viavoice_server on linux
Setup the serial items
Setup the tcp socket ports -
Read and evaluate/compile the user event code into the mh_temp.user_code file:
Optional .mht files are processed by mh/lib/read_table_.pl, creating *.mhp files.
Objects are evaluated and created.
Everything else is put into a &user_loop function (at the end of mh_temp.user_code file).\ -
Loop until exit, each pass executing:
Set global time/date variables
Check for voice commands
Read/write socket data
Read/write serial data
Check for timers actions
Check for external command files
Evaluate the &user_loop function
Sleep for a while (default is 50 milliseconds), so mh does not hog the CPU.\
Here are some examples of the MisterHouse command line options;
Command Line | Meaning |
---|---|
mh |
Normal startup |
mh -h or mh -htlp
|
Display help text |
mh items.pl test1.pl test2.pl |
Only run the 3 specified members |
mh -tk 0 -code_dir c:\mh\code\Bruce |
Disable the tk interface and change the code dir to the Bruce directory |
mh -debug serial > test1.log |
Log all 'print' statements to test1.log and turn on all serial related debug messages |
The complete list of valid startup options is in the mh.ini file. This file can be overriden by your own mh.ini file and specified at startup.
Here are a few of the more important ones and their defaults:
code_dir=\mh\code\test
Points to the directory that has the user code files in it. This can be a comma delimited set of paths if you want to keep your code files in multiple directories.
html_root=$Pgm_Root/web
and html_file=mh_default/index.html
Point to where the web interface html files are.
http_port=8080
The built in web server port. Use 80 if you want to use the normal web port (i.e. http://localhost ). If using something other than 80 (because you already have a web server running), add :port to URL (e.g. http://localhost:8080 ).
server_telnet_port=23
Use 23 to enable access via telnet localhost
, if you are running the mh/code/common/telnet.pl member. If you use a different port, you can still get to the port with telnet localhost port_number
.
diagnostics=1
Set this (or w=1) to enable perl -w warning messages on potential code errors. MisterHouse runs about 10% slower with this option on.
debug=
and log=
use the -debug and -log and options to turn on debug and/or log the console errata to a file. For example: mh -debug http -log http_socket.log
will turn on socket related debug messages and log all errata to the file http_socket.log
. You can also stack debug flags, using ; as a separator. for example: mh -debug serial;x10
time_start=
, time_stop=
, and time_increment=
are used to run MisterHouse in 'fast test mode', useful for debugging events. The time_increment parameter sets how many simulated seconds to increment per pass. Default is 60. If only time_start
is specified, normal mode will resume when the current time is reached. If time_stop
is specified, MisterHouse will exit when reached. These parameters can be any time/date string, as recognised by the time_now function
Here are some examples:
mh -time_start 0 -time_stop 24 -tk 0 -voice_text 0
mh -time_start "6 AM" -time_stop "11 PM" -time_increment 1
mh -time_start "5/14 7:10" -time_stop "5/15 10 PM" -time_increment 300
\