mirror of
https://github.com/balena-os/balena-supervisor.git
synced 2024-12-23 23:42:29 +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)
|
||||
|
||||
blink.pattern = do ->
|
||||
pattern =
|
||||
onDuration: 200
|
||||
offDuration: 200
|
||||
blinks: 4
|
||||
pause: 1000
|
||||
blinking = null
|
||||
start = ->
|
||||
start = (pattern) ->
|
||||
Promise.resolve([0...pattern.blinks]).cancellable()
|
||||
.each ->
|
||||
blink(pattern.onDuration)
|
||||
.delay(pattern.offDuration)
|
||||
.delay(pattern.pause)
|
||||
.then ->
|
||||
start()
|
||||
start(pattern)
|
||||
return {
|
||||
start: ->
|
||||
start: (pattern) ->
|
||||
return false if blinking?
|
||||
blinking = start()
|
||||
blinking = start(pattern)
|
||||
return
|
||||
stop: ->
|
||||
return false if not blinking?
|
||||
|
@ -60,8 +60,13 @@ exports.findIpAddrs = ->
|
||||
return ipAddr
|
||||
.filter(Boolean)
|
||||
|
||||
exports.blink = blink
|
||||
networkPattern =
|
||||
onDuration: 200
|
||||
offDuration: 200
|
||||
blinks: 4
|
||||
pause: 1000
|
||||
|
||||
exports.blink = blink
|
||||
exports.connectivityCheck = _.once ->
|
||||
networkCheck.monitorURL
|
||||
url: config.heartbeatEndpoint
|
||||
@ -72,4 +77,4 @@ exports.connectivityCheck = _.once ->
|
||||
blink.pattern.stop()
|
||||
else
|
||||
console.log('Waiting for connectivity...')
|
||||
blink.pattern.start()
|
||||
blink.pattern.start(networkPattern)
|
||||
|
Loading…
Reference in New Issue
Block a user