kopia lustrzana https://github.com/cyoung/stratux
Undo a few non-webui related changes. #531.
rodzic
8bf9347878
commit
ff7a7a2781
|
@ -676,6 +676,7 @@ func isCPUTempValid() bool {
|
||||||
func cpuTempMonitor() {
|
func cpuTempMonitor() {
|
||||||
timer := time.NewTicker(1 * time.Second)
|
timer := time.NewTicker(1 * time.Second)
|
||||||
for {
|
for {
|
||||||
|
<-timer.C
|
||||||
|
|
||||||
// Update CPUTemp.
|
// Update CPUTemp.
|
||||||
temp, err := ioutil.ReadFile("/sys/class/thermal/thermal_zone0/temp")
|
temp, err := ioutil.ReadFile("/sys/class/thermal/thermal_zone0/temp")
|
||||||
|
@ -694,7 +695,6 @@ func cpuTempMonitor() {
|
||||||
if t >= -99.0 { // Only update if valid value was obtained.
|
if t >= -99.0 { // Only update if valid value was obtained.
|
||||||
globalStatus.CPUTemp = t
|
globalStatus.CPUTemp = t
|
||||||
}
|
}
|
||||||
<-timer.C
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -536,6 +536,7 @@ func networkStatsCounter() {
|
||||||
var previousNetworkMessagesSent, previousNetworkBytesSent, previousNetworkMessagesSentNonqueueable, previousNetworkBytesSentNonqueueable uint64
|
var previousNetworkMessagesSent, previousNetworkBytesSent, previousNetworkMessagesSentNonqueueable, previousNetworkBytesSentNonqueueable uint64
|
||||||
|
|
||||||
for {
|
for {
|
||||||
|
<-timer.C
|
||||||
globalStatus.NetworkDataMessagesSentLastSec = globalStatus.NetworkDataMessagesSent - previousNetworkMessagesSent
|
globalStatus.NetworkDataMessagesSentLastSec = globalStatus.NetworkDataMessagesSent - previousNetworkMessagesSent
|
||||||
globalStatus.NetworkDataBytesSentLastSec = globalStatus.NetworkDataBytesSent - previousNetworkBytesSent
|
globalStatus.NetworkDataBytesSentLastSec = globalStatus.NetworkDataBytesSent - previousNetworkBytesSent
|
||||||
globalStatus.NetworkDataMessagesSentNonqueueableLastSec = globalStatus.NetworkDataMessagesSentNonqueueable - previousNetworkMessagesSentNonqueueable
|
globalStatus.NetworkDataMessagesSentNonqueueableLastSec = globalStatus.NetworkDataMessagesSentNonqueueable - previousNetworkMessagesSentNonqueueable
|
||||||
|
@ -548,7 +549,6 @@ func networkStatsCounter() {
|
||||||
previousNetworkBytesSent = globalStatus.NetworkDataBytesSent
|
previousNetworkBytesSent = globalStatus.NetworkDataBytesSent
|
||||||
previousNetworkMessagesSentNonqueueable = globalStatus.NetworkDataMessagesSentNonqueueable
|
previousNetworkMessagesSentNonqueueable = globalStatus.NetworkDataMessagesSentNonqueueable
|
||||||
previousNetworkBytesSentNonqueueable = globalStatus.NetworkDataBytesSentNonqueueable
|
previousNetworkBytesSentNonqueueable = globalStatus.NetworkDataBytesSentNonqueueable
|
||||||
<-timer.C
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1398,6 +1398,7 @@ func initI2C() error {
|
||||||
func tempAndPressureReader() {
|
func tempAndPressureReader() {
|
||||||
timer := time.NewTicker(5 * time.Second)
|
timer := time.NewTicker(5 * time.Second)
|
||||||
for globalStatus.RY835AI_connected && globalSettings.AHRS_Enabled {
|
for globalStatus.RY835AI_connected && globalSettings.AHRS_Enabled {
|
||||||
|
<-timer.C
|
||||||
// Read temperature and pressure altitude.
|
// Read temperature and pressure altitude.
|
||||||
temp, alt, err_bmp180 := readBMP180()
|
temp, alt, err_bmp180 := readBMP180()
|
||||||
// Process.
|
// Process.
|
||||||
|
@ -1409,7 +1410,6 @@ func tempAndPressureReader() {
|
||||||
mySituation.Pressure_alt = alt
|
mySituation.Pressure_alt = alt
|
||||||
mySituation.LastTempPressTime = stratuxClock.Time
|
mySituation.LastTempPressTime = stratuxClock.Time
|
||||||
}
|
}
|
||||||
<-timer.C
|
|
||||||
}
|
}
|
||||||
globalStatus.RY835AI_connected = false
|
globalStatus.RY835AI_connected = false
|
||||||
}
|
}
|
||||||
|
@ -1464,6 +1464,7 @@ func makeAHRSGDL90Report() {
|
||||||
func attitudeReaderSender() {
|
func attitudeReaderSender() {
|
||||||
timer := time.NewTicker(100 * time.Millisecond) // ~10Hz update.
|
timer := time.NewTicker(100 * time.Millisecond) // ~10Hz update.
|
||||||
for globalStatus.RY835AI_connected && globalSettings.AHRS_Enabled {
|
for globalStatus.RY835AI_connected && globalSettings.AHRS_Enabled {
|
||||||
|
<-timer.C
|
||||||
// Read pitch and roll.
|
// Read pitch and roll.
|
||||||
pitch, roll, err_mpu6050 := readMPU6050()
|
pitch, roll, err_mpu6050 := readMPU6050()
|
||||||
|
|
||||||
|
@ -1487,7 +1488,6 @@ func attitudeReaderSender() {
|
||||||
makeAHRSGDL90Report()
|
makeAHRSGDL90Report()
|
||||||
|
|
||||||
mySituation.mu_Attitude.Unlock()
|
mySituation.mu_Attitude.Unlock()
|
||||||
<-timer.C
|
|
||||||
}
|
}
|
||||||
globalStatus.RY835AI_connected = false
|
globalStatus.RY835AI_connected = false
|
||||||
}
|
}
|
||||||
|
@ -1587,6 +1587,7 @@ func pollRY835AI() {
|
||||||
readyToInitGPS = true //TO-DO: Implement more robust method (channel control) to kill zombie serial readers
|
readyToInitGPS = true //TO-DO: Implement more robust method (channel control) to kill zombie serial readers
|
||||||
timer := time.NewTicker(4 * time.Second)
|
timer := time.NewTicker(4 * time.Second)
|
||||||
for {
|
for {
|
||||||
|
<-timer.C
|
||||||
// GPS enabled, was not connected previously?
|
// GPS enabled, was not connected previously?
|
||||||
if globalSettings.GPS_Enabled && !globalStatus.GPS_connected && readyToInitGPS { //TO-DO: Implement more robust method (channel control) to kill zombie serial readers
|
if globalSettings.GPS_Enabled && !globalStatus.GPS_connected && readyToInitGPS { //TO-DO: Implement more robust method (channel control) to kill zombie serial readers
|
||||||
globalStatus.GPS_connected = initGPSSerial()
|
globalStatus.GPS_connected = initGPSSerial()
|
||||||
|
@ -1602,7 +1603,6 @@ func pollRY835AI() {
|
||||||
globalStatus.RY835AI_connected = false
|
globalStatus.RY835AI_connected = false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
<-timer.C
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Ładowanie…
Reference in New Issue