- KickAss HAL Programming -

  

 

 

 

 

KickAss Macro Essentials

 

Trigger Macros

Trigger Macros are simple macros that primarily serve to recognize a speech phrase or DTMF command, and perform a minimum number of actions. It is best to keep Trigger Macros short and simple. In fact many of the Trigger Macros used in the Pool program are more complex than I would make them if I were re-writing it today. For example, I would move the TTS Actions out of the Trigger Macro and put them in a Rule. The ideal Trigger Macro would have one Action, to set a Trigger Flag. This Trigger flag would then cause a Rule to evaluate conditions and decide what actions, if any, to take. Macro Pool Pump Enable is close to that ideal, except for the TTS Action.

Despite defining this ideal, we must recognize that sometimes a TTS response in the Trigger Macro can be a good idea so as to provide immediate acknowledgement to the user that the phrase has been recognized. The Macro Pool Status Request demonstrates this.

The reason to keep these simple is that when HAL recognizes a phrase, executing that Macro becomes the focus of attention, and HAL may be unresponsive to other tasks until it is done. Hence, keeping the Trigger Macros short results in faster response overall on the part of HAL.

Action Macros

Action Macros are macros that hold a list of actions to be executed, intended to be called from other Macros, or even rules. These serve the purpose of keeping the database smaller by not duplicating actions in multiple places, and to keep logic blocks in a single location for easy maintenance. Think of them as a primitive subroutines.

In their pure sense, Action Macros are not triggered by Voice or DTMF, but only called from other Macros and Rules. Our sample program does not use any pure Action Macros, but Macro Pool Pump ON and Macro Pool Pump OFF are macros that centralize the on and off functions and may be called from other Macros or Rules, as well as triggered by voice command.

Macro Structure

Let’s discuss the format of our Documentation Macros in general before going forward. Some of these comments will apply to Rules as well. Notice the first word. That word is Macro and serves to differentiate macros, scenes, modes, and rules. This helps eliminate any ambiguity as to the nature of the entry.