mirror of
https://github.com/balena-os/balena-supervisor.git
synced 2024-12-24 15:56:40 +00:00
Accept the pattern as an argument for the blink module.
This commit is contained in:
parent
cd2603f228
commit
b63e7fd595
@ -14,24 +14,19 @@ module.exports = exports = (ledFile) ->
|
|||||||
.then(ledOff)
|
.then(ledOff)
|
||||||
|
|
||||||
blink.pattern = do ->
|
blink.pattern = do ->
|
||||||
pattern =
|
|
||||||
onDuration: 200
|
|
||||||
offDuration: 200
|
|
||||||
blinks: 4
|
|
||||||
pause: 1000
|
|
||||||
blinking = null
|
blinking = null
|
||||||
start = ->
|
start = (pattern) ->
|
||||||
Promise.resolve([0...pattern.blinks]).cancellable()
|
Promise.resolve([0...pattern.blinks]).cancellable()
|
||||||
.each ->
|
.each ->
|
||||||
blink(pattern.onDuration)
|
blink(pattern.onDuration)
|
||||||
.delay(pattern.offDuration)
|
.delay(pattern.offDuration)
|
||||||
.delay(pattern.pause)
|
.delay(pattern.pause)
|
||||||
.then ->
|
.then ->
|
||||||
start()
|
start(pattern)
|
||||||
return {
|
return {
|
||||||
start: ->
|
start: (pattern) ->
|
||||||
return false if blinking?
|
return false if blinking?
|
||||||
blinking = start()
|
blinking = start(pattern)
|
||||||
return
|
return
|
||||||
stop: ->
|
stop: ->
|
||||||
return false if not blinking?
|
return false if not blinking?
|
||||||
|
@ -60,8 +60,13 @@ exports.findIpAddrs = ->
|
|||||||
return ipAddr
|
return ipAddr
|
||||||
.filter(Boolean)
|
.filter(Boolean)
|
||||||
|
|
||||||
exports.blink = blink
|
networkPattern =
|
||||||
|
onDuration: 200
|
||||||
|
offDuration: 200
|
||||||
|
blinks: 4
|
||||||
|
pause: 1000
|
||||||
|
|
||||||
|
exports.blink = blink
|
||||||
exports.connectivityCheck = _.once ->
|
exports.connectivityCheck = _.once ->
|
||||||
networkCheck.monitorURL
|
networkCheck.monitorURL
|
||||||
url: config.heartbeatEndpoint
|
url: config.heartbeatEndpoint
|
||||||
@ -72,4 +77,4 @@ exports.connectivityCheck = _.once ->
|
|||||||
blink.pattern.stop()
|
blink.pattern.stop()
|
||||||
else
|
else
|
||||||
console.log('Waiting for connectivity...')
|
console.log('Waiting for connectivity...')
|
||||||
blink.pattern.start()
|
blink.pattern.start(networkPattern)
|
||||||
|
Loading…
Reference in New Issue
Block a user