Skip to content

Commit

Permalink
Convert AC exchanger temperatures
Browse files Browse the repository at this point in the history
Turns out these are always in celcius, so convert them based on selected units
  • Loading branch information
hufman committed Jul 24, 2024
1 parent 33aed07 commit 2c37f34
Showing 1 changed file with 4 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -161,9 +161,13 @@ class CDSMetrics(val carInfo: CarInformation) {
}
val tempExchanger = carInfo.cdsData.flow[CDS.CLIMATE.ACSYSTEMTEMPERATURES].mapNotNull {
it.tryAsJsonObject("ACSystemTemperatures")?.tryAsJsonPrimitive("heatExchanger")?.tryAsDouble
}.combine(units) { value, units ->
units.temperatureUnits.fromCarUnit(value)
}
val tempEvaporator = carInfo.cdsData.flow[CDS.CLIMATE.ACSYSTEMTEMPERATURES].mapNotNull {
it.tryAsJsonObject("ACSystemTemperatures")?.tryAsJsonPrimitive("evaporator")?.tryAsDouble
}.combine(units) { value, units ->
units.temperatureUnits.fromCarUnit(value)
}
val ACCompressorActualPower = carInfo.cdsData.flow[CDS.CLIMATE.AIRCONDITIONERCOMPRESSOR].mapNotNull {
it.tryAsJsonObject("airConditionerCompressor")?.tryAsJsonPrimitive("actualPower")?.tryAsDouble?.takeIf { it < 255 }
Expand Down

0 comments on commit 2c37f34

Please sign in to comment.