Added X23 pin to report revid's bitrate.

This commit is contained in:
Alan Noble 2018-05-14 15:42:46 +09:30
parent 4aa0fed8b8
commit e30ec5d49d
1 changed files with 5 additions and 53 deletions

View File

@ -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
@ -427,47 +420,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 +459,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")