Push dev work to master #2
|
@ -58,9 +58,11 @@ intval.init = function () {
|
||||||
primed : false //is ready to stop frame
|
primed : false //is ready to stop frame
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
intval._frame = {}
|
||||||
intval._releaseMin = 50
|
intval._release = {
|
||||||
intval._releaseSequence = 1000
|
min : 20,
|
||||||
|
seq : 1000
|
||||||
|
}
|
||||||
intval._microDelay = 10 // delay after stop signal before stopping motors
|
intval._microDelay = 10 // delay after stop signal before stopping motors
|
||||||
|
|
||||||
intval._declarePins()
|
intval._declarePins()
|
||||||
|
@ -184,8 +186,8 @@ intval._watchMicro = function (err, val) {
|
||||||
*
|
*
|
||||||
* 1) If closed, start timer.
|
* 1) If closed, start timer.
|
||||||
* 2) If opened, check timer AND
|
* 2) If opened, check timer AND
|
||||||
* 3) If `press` (`now - intval._state.release.time`) greater than minimum and less than `intval._releaseSequence`, start frame
|
* 3) If `press` (`now - intval._state.release.time`) greater than minimum and less than `intval._release.seq`, start frame
|
||||||
* 4) If `press` greater than `intval._releaseSequence`, start sequence
|
* 4) If `press` greater than `intval._release.seq`, start sequence
|
||||||
*
|
*
|
||||||
* Button + 10K ohm resistor
|
* Button + 10K ohm resistor
|
||||||
* * 1 === open
|
* * 1 === open
|
||||||
|
@ -212,9 +214,9 @@ intval._watchRelease = function (err, val) {
|
||||||
//opened
|
//opened
|
||||||
if (intval._state.release.active) {
|
if (intval._state.release.active) {
|
||||||
press = now - intval._state.release.time
|
press = now - intval._state.release.time
|
||||||
if (press > intval._releaseMin && press < intval._releaseSequence) {
|
if (press > intval._release.min && press < intval._release.seq) {
|
||||||
intval.frame()
|
intval.frame()
|
||||||
} else if (press >= intval._releaseSequence) {
|
} else if (press >= intval._release.seq) {
|
||||||
intval.sequence()
|
intval.sequence()
|
||||||
}
|
}
|
||||||
log.info(`Release closed for ${press}ms`)
|
log.info(`Release closed for ${press}ms`)
|
||||||
|
@ -228,7 +230,7 @@ intval._releaseClosedState = function (now) {
|
||||||
if (!intval._state.release.active && intval._state.release.time === 0) {
|
if (!intval._state.release.active && intval._state.release.time === 0) {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
if (intval._state.release.active && (now - intval._state.release.time) > (intval._releaseSequence * 10)) {
|
if (intval._state.release.active && (now - intval._state.release.time) > (intval._release.seq * 10)) {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
return false
|
return false
|
||||||
|
|
Loading…
Reference in New Issue