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() {
|
||||
timer := time.NewTicker(1 * time.Second)
|
||||
for {
|
||||
<-timer.C
|
||||
|
||||
// Update CPUTemp.
|
||||
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.
|
||||
globalStatus.CPUTemp = t
|
||||
}
|
||||
<-timer.C
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -536,6 +536,7 @@ func networkStatsCounter() {
|
|||
var previousNetworkMessagesSent, previousNetworkBytesSent, previousNetworkMessagesSentNonqueueable, previousNetworkBytesSentNonqueueable uint64
|
||||
|
||||
for {
|
||||
<-timer.C
|
||||
globalStatus.NetworkDataMessagesSentLastSec = globalStatus.NetworkDataMessagesSent - previousNetworkMessagesSent
|
||||
globalStatus.NetworkDataBytesSentLastSec = globalStatus.NetworkDataBytesSent - previousNetworkBytesSent
|
||||
globalStatus.NetworkDataMessagesSentNonqueueableLastSec = globalStatus.NetworkDataMessagesSentNonqueueable - previousNetworkMessagesSentNonqueueable
|
||||
|
@ -548,7 +549,6 @@ func networkStatsCounter() {
|
|||
previousNetworkBytesSent = globalStatus.NetworkDataBytesSent
|
||||
previousNetworkMessagesSentNonqueueable = globalStatus.NetworkDataMessagesSentNonqueueable
|
||||
previousNetworkBytesSentNonqueueable = globalStatus.NetworkDataBytesSentNonqueueable
|
||||
<-timer.C
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -1398,6 +1398,7 @@ func initI2C() error {
|
|||
func tempAndPressureReader() {
|
||||
timer := time.NewTicker(5 * time.Second)
|
||||
for globalStatus.RY835AI_connected && globalSettings.AHRS_Enabled {
|
||||
<-timer.C
|
||||
// Read temperature and pressure altitude.
|
||||
temp, alt, err_bmp180 := readBMP180()
|
||||
// Process.
|
||||
|
@ -1409,7 +1410,6 @@ func tempAndPressureReader() {
|
|||
mySituation.Pressure_alt = alt
|
||||
mySituation.LastTempPressTime = stratuxClock.Time
|
||||
}
|
||||
<-timer.C
|
||||
}
|
||||
globalStatus.RY835AI_connected = false
|
||||
}
|
||||
|
@ -1464,6 +1464,7 @@ func makeAHRSGDL90Report() {
|
|||
func attitudeReaderSender() {
|
||||
timer := time.NewTicker(100 * time.Millisecond) // ~10Hz update.
|
||||
for globalStatus.RY835AI_connected && globalSettings.AHRS_Enabled {
|
||||
<-timer.C
|
||||
// Read pitch and roll.
|
||||
pitch, roll, err_mpu6050 := readMPU6050()
|
||||
|
||||
|
@ -1487,7 +1488,6 @@ func attitudeReaderSender() {
|
|||
makeAHRSGDL90Report()
|
||||
|
||||
mySituation.mu_Attitude.Unlock()
|
||||
<-timer.C
|
||||
}
|
||||
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
|
||||
timer := time.NewTicker(4 * time.Second)
|
||||
for {
|
||||
<-timer.C
|
||||
// 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
|
||||
globalStatus.GPS_connected = initGPSSerial()
|
||||
|
@ -1602,7 +1603,6 @@ func pollRY835AI() {
|
|||
globalStatus.RY835AI_connected = false
|
||||
}
|
||||
}
|
||||
<-timer.C
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Ładowanie…
Reference in New Issue