fix: added condition to the CPU temperature: must be less than 110C (#280)

This commit is contained in:
Serhiy Mytrovtsiy
2021-01-09 21:08:30 +01:00
parent fcf41ac635
commit 151ac1ceca

View File

@@ -244,12 +244,19 @@ public class TemperatureReader: Reader<Double> {
}
public override func read() {
let temperature =
self.smc?.pointee.getValue("TC0D") ??
self.smc?.pointee.getValue("TC0E") ??
self.smc?.pointee.getValue("TC0F") ??
self.smc?.pointee.getValue("TC0P") ??
self.smc?.pointee.getValue("TC0H")
var temperature: Double? = nil
if let value = self.smc?.pointee.getValue("TC0D"), value < 110 {
temperature = value
} else if let value = self.smc?.pointee.getValue("TC0E"), value < 110 {
temperature = value
} else if let value = self.smc?.pointee.getValue("TC0F"), value < 110 {
temperature = value
} else if let value = self.smc?.pointee.getValue("TC0P"), value < 110 {
temperature = value
} else if let value = self.smc?.pointee.getValue("TC0H"), value < 110 {
temperature = value
}
self.callback(temperature)
}