Skip to content

Commit

Permalink
Bling bling
Browse files Browse the repository at this point in the history
  • Loading branch information
forki committed Mar 22, 2019
1 parent 7a476c6 commit b169f96
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
2 changes: 1 addition & 1 deletion RELEASE_NOTES.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Release Notes

## 1.3.0 - 2019-03-21
## 1.3.1 - 2019-03-22
* Show light

## 1.2.1 - 2019-03-19
Expand Down
7 changes: 5 additions & 2 deletions src/PiServer/PiServer.fs
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,8 @@ let rfidLoop (dispatch,nodeServices:INodeServices) = task {
let yellowLight = GeneralIO.LED(Unosquare.RaspberryIO.Pi.Gpio.[BcmPin.Gpio21])
let allLights = [| blueLight; yellowLight|]

let! _ = allLights |> Array.map (fun l -> l.Blink(10)) |> Task.WhenAll
let! _ = allLights |> Array.map (fun l -> l.Blink(2)) |> Task.WhenAll

log.InfoFormat("Waiting for RFID cards or NFC tags...")
while true do
let! token = nodeServices.InvokeExportAsync<string>("./read-tag", "read", "tag")
Expand All @@ -90,6 +91,7 @@ let rfidLoop (dispatch,nodeServices:INodeServices) = task {
let! _ = Task.Delay(TimeSpan.FromSeconds 0.5)
()
else
let! _ = allLights |> Array.map (fun l -> l.Blink(2)) |> Task.WhenAll
dispatch (NewRFID token)
let mutable waiting = true
while waiting do
Expand All @@ -101,6 +103,7 @@ let rfidLoop (dispatch,nodeServices:INodeServices) = task {
let! _ = Task.Delay(TimeSpan.FromSeconds 2.)
let! newToken = nodeServices.InvokeExportAsync<string>("./read-tag", "read", "tag")
if newToken <> token then
let! _ = allLights |> Array.map (fun l -> l.Blink(2)) |> Task.WhenAll
dispatch RFIDRemoved
waiting <- false
}
Expand Down Expand Up @@ -229,7 +232,7 @@ let update (msg:Msg) (model:Model) =
let mediaFile : MediaFile = {
FileName = url
}
model, Cmd.batch [Cmd.ofMsg (Play mediaFile) ]
model, Cmd.batch [Cmd.ofMsg (Play mediaFile) ]
| Err exn ->
log.ErrorFormat("Error: {0}", exn.Message)
model, Cmd.none
Expand Down

0 comments on commit b169f96

Please sign in to comment.