mirror of
https://github.com/balena-os/balena-supervisor.git
synced 2024-12-23 15:32:24 +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) ->
|
api.post '/v1/blink', (req, res) ->
|
||||||
utils.mixpanelTrack('Device blink')
|
utils.mixpanelTrack('Device blink')
|
||||||
interval = setInterval(utils.blink, 400)
|
utils.blink.pattern.start()
|
||||||
setTimeout(->
|
setTimeout(utils.blink.pattern.stop, 15000)
|
||||||
clearInterval(interval)
|
|
||||||
, 15000)
|
|
||||||
res.send(200)
|
res.send(200)
|
||||||
|
|
||||||
api.post '/v1/update', (req, res) ->
|
api.post '/v1/update', (req, res) ->
|
||||||
|
@ -24,9 +24,14 @@ module.exports = exports = (ledFile) ->
|
|||||||
.then ->
|
.then ->
|
||||||
start(pattern)
|
start(pattern)
|
||||||
return {
|
return {
|
||||||
start: (pattern) ->
|
start: (pattern = {}) ->
|
||||||
return false if blinking?
|
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
|
return
|
||||||
stop: ->
|
stop: ->
|
||||||
return false if not blinking?
|
return false if not blinking?
|
||||||
|
@ -61,8 +61,6 @@ exports.findIpAddrs = ->
|
|||||||
.filter(Boolean)
|
.filter(Boolean)
|
||||||
|
|
||||||
networkPattern =
|
networkPattern =
|
||||||
onDuration: 200
|
|
||||||
offDuration: 200
|
|
||||||
blinks: 4
|
blinks: 4
|
||||||
pause: 1000
|
pause: 1000
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user