diff --git a/Makefile b/Makefile new file mode 100644 index 00000000..2f75d520 --- /dev/null +++ b/Makefile @@ -0,0 +1,2 @@ +all: + go build RevidCLI.go diff --git a/RevidCLI b/RevidCLI index cb2f666c..e6d08aa4 100755 Binary files a/RevidCLI and b/RevidCLI differ diff --git a/RevidCLI.go b/RevidCLI.go index 10058e3e..8330df3f 100644 --- a/RevidCLI.go +++ b/RevidCLI.go @@ -79,16 +79,9 @@ const ( ) const ( - lightRelayPin = 19 - ds18b20Temp = 60 - dht11Temp = 40 - dht11Hum = 41 - dht22Temp = 50 - dht22Hum = 51 - dhtPin = 22 - cpuTemp = 21 - cpuUsage = 20 - priority = 25 + cpuUsage = 20 + cpuTemp = 21 + revidBitrate = 23 ) // Globals @@ -365,8 +358,11 @@ func updateRevid(stop bool) { case "RtmpUrl": config.RtmpUrl = value case "Bitrate": + revidInst.Log(revid.Debug, fmt.Sprintf("The value: %v", value)) asInt, err := strconv.Atoi(value) + revidInst.Log(revid.Debug, fmt.Sprintf("Bitrate as integer: %v", asInt)) if asInt > 0 && err == nil { + revidInst.Log(revid.Debug, "Updating bitrate") config.Bitrate = value } case "OutputFileName": @@ -427,47 +423,6 @@ func updateRevid(stop bool) { func revidReportActions(pin int) (int, error) { switch { - // case pin == ds18b20Temp: - // sensors, err := ds18b20.Sensors() - // if err != nil { - // processManager.Logger.Log("Error", "Error retrieving connected sensors: "+err.Error()) - // return -1, errors.New("No sensors connected") - // } - - // t, err := ds18b20.Temperature(sensors[0]) - // if err == nil { - // return int(t), nil - // } - - // return -1, errors.New("Unable to read temperature") - - // case pin == dht11Temp: - // if val, _, _, err := dht.ReadDHTxxWithRetry(dht.DHT11, dhtPin, false, 5); err != nil { - // return -1, errors.New("DHT Read Err: " + err.Error()) - // } else { - // return int(val), nil - // } - - // case pin == dht11Hum: - // if _, val, _, err := dht.ReadDHTxxWithRetry(dht.DHT11, dhtPin, false, 5); err != nil { - // return -1, errors.New("DHT Read Err: " + err.Error()) - // } else { - // return int(val), nil - // } - - // case pin == dht22Temp: - // if val, _, _, err := dht.ReadDHTxxWithRetry(dht.DHT22, dhtPin, false, 5); err != nil { - // return -1, errors.New("DHT Read Err: " + err.Error()) - // } else { - // return int(val), nil - // } - - // case pin == dht22Hum: - // if _, val, _, err := dht.ReadDHTxxWithRetry(dht.DHT22, dhtPin, false, 5); err != nil { - // return -1, errors.New("DHT Read Err: " + err.Error()) - // } else { - // return int(val), nil - // } //function to measure temp of cpu case pin == cpuTemp: @@ -507,8 +462,8 @@ func revidReportActions(pin int) (int, error) { return int((1.0 - (float64(idle2-idle1) / float64(total2-total1))) * 100), nil - // case pin == priority: - // return int(processManager.PriorityLevel), nil + case pin == revidBitrate: + return int(revidInst.GetBitrate()), nil default: return -1, errors.New("External pin" + strconv.Itoa(pin) + " not defined") diff --git a/revid/Config.go b/revid/Config.go index e7254708..f9945ff4 100644 --- a/revid/Config.go +++ b/revid/Config.go @@ -168,7 +168,6 @@ func (config *Config) Validate(r *revid) error { r.Log(Warning, "No input codec defined, defaulting to h264!") config.InputCodec = H264 r.Log(Warning, "Defaulting bitrate to 0 and quantization to 35!") - config.Bitrate = defaultBitrate config.Quantization = defaultQuantization default: return errors.New("Bad input codec defined in config!") diff --git a/revid/Revid.go b/revid/Revid.go index 29ca2e9c..46600e88 100644 --- a/revid/Revid.go +++ b/revid/Revid.go @@ -91,6 +91,7 @@ type Revid interface { GetConfigRef() *Config Log(logType, m string) IsRunning() bool + GetBitrate() int64 } // The revid struct provides fields to describe the state of a Revid. @@ -411,7 +412,7 @@ func (r *revid) outputClips() { r.Log(Detail, "About to send") err2 := r.sendClip(clip) if err2 == nil { - r.Log(Debug, "Sent clip") + r.Log(Detail, "Sent clip") } if r.isRunning && err2 != nil && len(clip) > 11 {