mirror of
https://github.com/balena-os/balena-supervisor.git
synced 2024-12-19 13:47:54 +00:00
Use sensible defaults for the blink patterns, and make use of it for the API blink.
This commit is contained in:
parent
b63e7fd595
commit
e054b36d58
@ -11,10 +11,8 @@ api.use(express.bodyParser())
|
||||
|
||||
api.post '/v1/blink', (req, res) ->
|
||||
utils.mixpanelTrack('Device blink')
|
||||
interval = setInterval(utils.blink, 400)
|
||||
setTimeout(->
|
||||
clearInterval(interval)
|
||||
, 15000)
|
||||
utils.blink.pattern.start()
|
||||
setTimeout(utils.blink.pattern.stop, 15000)
|
||||
res.send(200)
|
||||
|
||||
api.post '/v1/update', (req, res) ->
|
||||
|
@ -24,9 +24,14 @@ module.exports = exports = (ledFile) ->
|
||||
.then ->
|
||||
start(pattern)
|
||||
return {
|
||||
start: (pattern) ->
|
||||
start: (pattern = {}) ->
|
||||
return false if blinking?
|
||||
blinking = start(pattern)
|
||||
fullPattern =
|
||||
blinks: pattern.blinks ? 1
|
||||
onDuration: pattern.onDuration ? 200
|
||||
offDuration: pattern.offDuration ? 200
|
||||
pause: pattern.pause ? 0
|
||||
blinking = start(fullPattern)
|
||||
return
|
||||
stop: ->
|
||||
return false if not blinking?
|
||||
|
@ -61,8 +61,6 @@ exports.findIpAddrs = ->
|
||||
.filter(Boolean)
|
||||
|
||||
networkPattern =
|
||||
onDuration: 200
|
||||
offDuration: 200
|
||||
blinks: 4
|
||||
pause: 1000
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user