mirror of https://bitbucket.org/ausocean/av.git
Merge branch 'RevidCLI' of https://bitbucket.org/ausocean/av into RevidCLI
This commit is contained in:
commit
ac0588ec98
23
RevidCLI.go
23
RevidCLI.go
|
@ -28,12 +28,16 @@ LICENSE
|
||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"errors"
|
||||||
|
"os/exec"
|
||||||
"flag"
|
"flag"
|
||||||
"strconv"
|
"strconv"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"bitbucket.org/ausocean/av/revid"
|
"bitbucket.org/ausocean/av/revid"
|
||||||
"bitbucket.org/ausocean/IoT/pi/netsender"
|
"bitbucket.org/ausocean/IoT/pi/netsender"
|
||||||
|
|
||||||
|
linuxproc "github.com/c9s/goprocinfo/linux"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Indexes for configFlags
|
// Indexes for configFlags
|
||||||
|
@ -67,6 +71,19 @@ const (
|
||||||
revidStopTime = 5
|
revidStopTime = 5
|
||||||
)
|
)
|
||||||
|
|
||||||
|
const (
|
||||||
|
lightRelayPin = 19
|
||||||
|
ds18b20Temp = 60
|
||||||
|
dht11Temp = 40
|
||||||
|
dht11Hum = 41
|
||||||
|
dht22Temp = 50
|
||||||
|
dht22Hum = 51
|
||||||
|
dhtPin = 22
|
||||||
|
cpuTemp = 21
|
||||||
|
cpuUsage = 20
|
||||||
|
priority = 25
|
||||||
|
)
|
||||||
|
|
||||||
// Globals
|
// Globals
|
||||||
var (
|
var (
|
||||||
configReceived bool = true
|
configReceived bool = true
|
||||||
|
@ -215,8 +232,8 @@ func periodicNetsenderReport(){
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inputs := {"X20", "X21"}
|
||||||
if _, reconfig, err := netsender.Send(netsender.RequestPoll, criticalInputs); err != nil {
|
if _, reconfig, err := netsender.Send(netsender.RequestPoll, inputs); err != nil {
|
||||||
config.Logger.Log("Error", err.Error())
|
config.Logger.Log("Error", err.Error())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -366,7 +383,7 @@ func revidReportActions(pin int) (int, error) {
|
||||||
|
|
||||||
stat, err = linuxproc.ReadStat("/proc/stat")
|
stat, err = linuxproc.ReadStat("/proc/stat")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return -1, errors.New("CPU Uage Read Err: " + err.Error())
|
return -1, errors.New("CPU Usage Read Err: " + err.Error())
|
||||||
}
|
}
|
||||||
total2 := stat.CPUStatAll.User + stat.CPUStatAll.Nice + stat.CPUStatAll.System +
|
total2 := stat.CPUStatAll.User + stat.CPUStatAll.Nice + stat.CPUStatAll.System +
|
||||||
stat.CPUStatAll.Idle + stat.CPUStatAll.IOWait + stat.CPUStatAll.IRQ +
|
stat.CPUStatAll.Idle + stat.CPUStatAll.IOWait + stat.CPUStatAll.IRQ +
|
||||||
|
|
Loading…
Reference in New Issue