Difference between revisions of "SHIP:Node:timer"

From Serious Documentation
Jump to: navigation, search
(Properties)
(Properties)
Line 41: Line 41:
 
|}
 
|}
 
{{SHIP:RuntimePropertyNote}}
 
{{SHIP:RuntimePropertyNote}}
 +
 
{{SHIP:TidetimePropertyNote}}
 
{{SHIP:TidetimePropertyNote}}
  

Revision as of 07:55, 29 November 2012

Node Home

Animations and delayed events or pauses require periodic or one-shot timers. The timer node fills this need in Template:SHIP.

The timer node is a 0.1s resolution event timer which can be set up to be free running or one-shot, with an auto-reload capability.

Parent Nodes

The following nodes are permitted to hold this node:

Child Nodes

The following nodes are permitted to exist within this node:

Properties

Property Data Type Description
SHIP:Property:timer:name
enabled Boolean If true (default if unset) this timer is enabled.
alarm* Boolean Set to true at run-time when a timer's count value transitions from 1 to 0.
autoreload Boolean Determines whether or not period will be loaded into value automatically after it expires.
oneshot Boolean If set, the timer will stop when the count value is zero and self-set the enabled property to false
period Integer Value used by a timer to reload the countdown value after the timer has expired.
value Integer Remaining count-down value, in 10ths of a second, of the timer

*available at SHIPEngine run time only and cannot be set in SHIPTide. Use a Sail script at shiplaunch time if this property needs to be set when the GUI starts to run.

Template:SHIP:TidetimePropertyNote

Operation

The timer is a 0.1s resolution event timer which can be set up to be free-running or one-shot, with an auto-reload capability. The timer's value property represents the current remaining time on the given timer, in tenths of a seconds. For example, if the timer.value is 34, there are 3.4 seconds left on the timer before it hits 0.

When enabled is set to true and the timer.value property is non-zero, the timer begins to count down, with the value property decrementing ever 0.1Hz. On a value transition from 1 to 0, the alarm property is set to true. The alarm must be manually reset (set to false) by a Sail script.

In the vast majority of use cases, a listener is attached to the alarm, and in the associated script some action is taken and the timer is often restarted.

The oneshot and autoreload Properties

A "one shot" timer is a timer that stops when it has completed its count. The opposite of a "one shot" timer is a "free running" timer which, when it competes its count, automatically restarts counting in a "free running" mode. The timer node supports both types of operation based on the oneshot value.

When a timer transitions its count from 1 to 0 (in value), the alarm property is set to true. If the oneshot property is true, the timer.enabled property is set to false also, stopping the timer. Hence the term "one shot", since the timer is now halted and must be re-configured and re-started manually from a Sail script.

However when a timer transitions its count from 1 to 0 (in value)and the oneshot property is false, the timer.enabled property is kept unchanged (true) and the timer attempts to be a free-running timer. The attempt will succeed only if

  1. the autoreload is set to true
  2. the period is set to a value greater than 0

If either of these conditions are not met, the timer will halt (the timer.enabled property is set to false) at timer.value 0 exactly like a one-shot timer would.

However if both of these conditions are true, the timer.enabled will remain true, the value will be automatically reloaded from period, and the timer will restart counting down. This is the free-running mode of the timer.

In both one-shot and free-running (i.e. oneshot set to false) modes, the alarm property is set to true on the 1 to 0 count transition. In both cases, care must be taken to clear the alarm property in a Sail script before the next alarm or the next alarm event may be missed.

listeners and timers

also, stopping the timer.  Hence the term "one shot", since the timer is now halted and must be re-configured and re-started manually from a Sail script.


The oneshot property determines the behavior of the timer when the timer is timer is enabled and the timer.value is 0.

The autoreload property governs the behavior of the timer when the timer is timer is enabled and the timer.value is 0. If autoreload is true in this situation, the value will be automatically reloaded from the period property.


If

The oneshot property governs the behavior of the timer when the timer is timer is enabled and the timer.value is 0.


If the oneshot property is true, the timer cannot be enabled. Attempts to set enabled to true will have no effect. To re-enable a one-shot mode timer, the value property must first be set to some new count that is >0, then the timer can be re-enabled.


If the oneshot property is true, the timer cannot be enabled. Attempts to set enabled to true will have no effect. To re-enable a one-shot mode timer, the value property must first be set to some new count that is >0, then the timer can be re-enabled.



When the timer.value is 0 and the timer is enabled, the


On a value transition from 1 to 0, the alarm property is set to true

The operation of the timer when the the value is 0 and the

When the alarm goes true, the timer looks a its oneshot and autoreload properties to determine what to do next.

One Shot, Auto Reload

This mode is set when oneshot is true and autoreload is true.

When the alarm goes true (on a 1 to 0 transition on value), the timer:

The timer then stops (i.e. a "one shot"), and must be restarted in a Sail script, generally from a listener listeningto the alarm to go true.

If the enabled is subsequently set in a Sail script true, the act of re-enabling the timer with value 0 causes an auto reload of the value from period and the timer commences the count-down cycle again.

One Shot, No Auto Reload

This mode is set when oneshot is true and autoreload is false.

When the alarm goes true (on a 1 to 0 transition on value), the timer:

The timer then stops (i.e. a "one shot"), and must be restarted in a Sail script, generally from a listener listeningto the alarm to go true.

If the enabled is subsequently set in a Sail script true, the act of re-enabling the timer with value 0 causes an auto reload of the value from period and the timer commences the count-down cycle again.



  • reloads value from {{Prop|

f true, leaves enabled true, reloads value from period and restarts counting down

property and:

In the vast majority of use cases, a listener is attached to the alarm, and in the associated script the alarm is reset.



When enabled is set to true and the value is non-zero, the timer begins to count down, with the value property decrementing ever 0.1Hz. When the {{Prop|timer|

in that it counts down from the programmed value until it hits 0 which then sets the alarm. If auto A GUI is generally composed of numerous graphically designed layout screens. Touch buttons navigate within an interactive GUI page and also cause screens to change from one to another. Since the word "screen" can easily be confused with the physical glass screen (vs. the GUI pixel content on the screen), SHIP uses the term "page" instead. The page in the GUI contains the visual layout for a specific GUI page. You can, and probably will, have many pages in a given GUI.

Examples