Skip to content

Commit

Permalink
Small fixes around adding rf learn
Browse files Browse the repository at this point in the history
  • Loading branch information
ralfonso-directnic committed May 28, 2021
1 parent cd3a85f commit 5aa8a35
Show file tree
Hide file tree
Showing 5 changed files with 45 additions and 8 deletions.
10 changes: 10 additions & 0 deletions broadlink.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,18 @@ import (
"strings"
"time"
"sort"
"os"
)

var Logger *log.Logger



func init() {
Logger = log.New(os.Stderr, "xxx: ", log.Ldate | log.Ltime | log.Lshortfile)
}


const defaultTimeout = 5 // seconds

// Broadlink keeps a track of all the devices and sockets.
Expand Down
7 changes: 5 additions & 2 deletions cmd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -304,9 +304,9 @@ func learnChildHandler(w http.ResponseWriter, r *http.Request) {
rf := strings.Contains(path, "/rf/")

if (rf) {
fmt.Fprintln(w, "Waiting for RF remote long press<blink>....</blink>")
fmt.Fprintln(w, "Waiting for RF remote. IMPORTANT - press on for 1 second and release until learning is finished <blink>....</blink>")
}else{
fmt.Fprintln(w, "Waiting for remote presses<blink>....</blink>")
fmt.Fprintln(w, "Waiting for ir remote presses<blink>....</blink>")
}

fmt.Fprintln(w, "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br>")
Expand All @@ -323,6 +323,7 @@ func learnChildHandler(w http.ResponseWriter, r *http.Request) {
var err error

if (rf) {

data, err = broadlink.LearnRF(device)
}else{
data, err = broadlink.Learn(device)
Expand Down Expand Up @@ -765,6 +766,8 @@ type JsonResp struct {
}

func main() {

broadlinkgo.Logger.SetFlags(0)//disable logging

var cpath=""

Expand Down
Loading

0 comments on commit 5aa8a35

Please sign in to comment.