Caught major oversight. 1 = open

Therefore frame event needs to be determined on open, after started
when closed
This commit is contained in:
mmcwilliams 2017-09-17 19:55:35 -04:00
parent 418d33c8f7
commit 4cb28c024d
1 changed files with 8 additions and 1 deletions

View File

@ -17,11 +17,18 @@ btn.watch((err, val) => {
return console.error(err) return console.error(err)
} }
console.log(`Release switch val: ${val}`) console.log(`Release switch val: ${val}`)
if (val === 1) {
console.log('open')
} else if (val === 0) {
console.log('closed')
}
if (val === 0) { if (val === 0) {
if (saveTime === 0) { if (saveTime === 0) {
saveTime = NOW saveTime = NOW
active = true //maybe unncecessary active = true //maybe unncecessary
} else if (active) { }
} else if (val === 1) {
if (active) {
if (NOW - saveTime > 100) { if (NOW - saveTime > 100) {
console.log('Started Frame') console.log('Started Frame')
} else if (NOW - saveTime > 1000) { } else if (NOW - saveTime > 1000) {