Add default optional values to documentation

This commit is contained in:
mmcwilliams 2017-09-19 15:20:58 -04:00
parent bfb28a0448
commit 52c0c6f352
2 changed files with 47 additions and 30 deletions

View File

@ -13,7 +13,7 @@ Class representing the intval3 features
* [._stop()](#Intval+_stop) * [._stop()](#Intval+_stop)
* [._watchMicro(err, val)](#Intval+_watchMicro) * [._watchMicro(err, val)](#Intval+_watchMicro)
* [._watchRelease(err, val)](#Intval+_watchRelease) * [._watchRelease(err, val)](#Intval+_watchRelease)
* [.frame(dir, time, delay)](#Intval+frame) * [.frame([dir], [time], [delay])](#Intval+frame)
<a name="Intval+_declarePins"></a> <a name="Intval+_declarePins"></a>
@ -55,8 +55,14 @@ Stop motor by setting both motor pins to 0 (LOW)
### intval._watchMicro(err, val) ### intval._watchMicro(err, val)
Intval._watchMicro() - Intval._watchMicro() -
Callback for watching microswitch state changes Callback for watching relese switch state changes.
Using GPIO 06 on raspberry pi zero w Using GPIO 06 on Raspberry Pi Zero W.
* If closed, start timer.
* If opened, check timer AND
Microswitch + 10K ohm resistor
* 1 === open
* 0 === closed
**Kind**: instance method of [<code>Intval</code>](#Intval) **Kind**: instance method of [<code>Intval</code>](#Intval)
@ -69,12 +75,17 @@ Using GPIO 06 on raspberry pi zero w
### intval._watchRelease(err, val) ### intval._watchRelease(err, val)
Intval._watchRelease() - Intval._watchRelease() -
Callback for watching relese switch state changes Callback for watching relese switch state changes.
Using GPIO 05 on raspberry pi zero w Using GPIO 05 on Raspberry Pi Zero W.
* If closed, start timer.
* If opened, check timer AND 1) If closed, start timer.
* If time closed longer than minimum and less than `this._releaseSequence`, start frame 2) If opened, check timer AND
* If time closed longer than `this._releaseSequence`, start sequence 3) If `press` (`NOW - this._state.release.time`) greater than minimum and less than `this._releaseSequence`, start frame
4) If `press` greater than `this._releaseSequence`, start sequence
Button + 10K ohm resistor
* 1 === open
* 0 === closed
**Kind**: instance method of [<code>Intval</code>](#Intval) **Kind**: instance method of [<code>Intval</code>](#Intval)
@ -85,7 +96,7 @@ Using GPIO 05 on raspberry pi zero w
<a name="Intval+frame"></a> <a name="Intval+frame"></a>
### intval.frame(dir, time, delay) ### intval.frame([dir], [time], [delay])
Intval.frame() - Intval.frame() -
Begin a single frame with set variables or defaults Begin a single frame with set variables or defaults
@ -93,7 +104,7 @@ Begin a single frame with set variables or defaults
| Param | Type | Default | Description | | Param | Type | Default | Description |
| --- | --- | --- | --- | | --- | --- | --- | --- |
| dir | <code>boolean</code> | <code></code> | (optional) Direction of the frame | | [dir] | <code>boolean</code> | <code>&quot;null&quot;</code> | (optional) Direction of the frame |
| time | <code>integer</code> | <code></code> | (optional) Exposure time, 0 = minimum | | [time] | <code>integer</code> | <code>&quot;null&quot;</code> | (optional) Exposure time, 0 = minimum |
| delay | <code>delay</code> | <code></code> | (optional) Delay after frame before another can be started | | [delay] | <code>integer</code> | <code>&quot;null&quot;</code> | (optional) Delay after frame before another can be started |

View File

@ -118,17 +118,21 @@ class Intval {
} }
/** /**
* Intval._watchMicro() - * Intval._watchMicro() -
* Callback for watching microswitch state changes * Callback for watching relese switch state changes.
* Using GPIO 06 on raspberry pi zero w * Using GPIO 06 on Raspberry Pi Zero W.
* * If closed, start timer.
* * If opened, check timer AND
*
* Microswitch + 10K ohm resistor
* * 1 === open
* * 0 === closed
*
* *
* @param {object} err Error object present if problem reading pin * @param {object} err Error object present if problem reading pin
* @param {integer} val Current value of the pin * @param {integer} val Current value of the pin
* *
*/ */
_watchMicro (err, val) { _watchMicro (err, val) {
/* Microswitch + 10K ohm resistor */
/* 1 = open */
/* 0 = closed */
if (err) { if (err) {
console.error(err) console.error(err)
} }
@ -137,12 +141,17 @@ class Intval {
} }
/** /**
* Intval._watchRelease() - * Intval._watchRelease() -
* Callback for watching relese switch state changes * Callback for watching relese switch state changes.
* Using GPIO 05 on raspberry pi zero w * Using GPIO 05 on Raspberry Pi Zero W.
* * If closed, start timer. *
* * If opened, check timer AND * 1) If closed, start timer.
* * If time closed longer than minimum and less than `this._releaseSequence`, start frame * 2) If opened, check timer AND
* * If time closed longer than `this._releaseSequence`, start sequence * 3) If `press` (`NOW - this._state.release.time`) greater than minimum and less than `this._releaseSequence`, start frame
* 4) If `press` greater than `this._releaseSequence`, start sequence
*
* Button + 10K ohm resistor
* * 1 === open
* * 0 === closed
* *
* @param {object} err Error object present if problem reading pin * @param {object} err Error object present if problem reading pin
* @param {integer} val Current value of the pin * @param {integer} val Current value of the pin
@ -151,9 +160,6 @@ class Intval {
_watchRelease (err, val) { _watchRelease (err, val) {
const NOW = +new Date() const NOW = +new Date()
let press = 0 let press = 0
/* Button + 10K ohm resistor */
/* 1 = open */
/* 0 = closed */
if (err) { if (err) {
return console.error(err) return console.error(err)
} }
@ -188,9 +194,9 @@ class Intval {
* Intval.frame() - * Intval.frame() -
* Begin a single frame with set variables or defaults * Begin a single frame with set variables or defaults
* *
* @param {boolean} dir (optional) Direction of the frame * @param {?boolean} [dir="null"] (optional) Direction of the frame
* @param {integer} time (optional) Exposure time, 0 = minimum * @param {?integer} [time="null"] (optional) Exposure time, 0 = minimum
* @param {delay} delay (optional) Delay after frame before another can be started * @param {?integer} [delay="null"] (optional) Delay after frame before another can be started
* *
*/ */
frame (dir = null, time = null, delay = null) { //may be overloaded, delay is suspect frame (dir = null, time = null, delay = null) { //may be overloaded, delay is suspect