From 9a72f3e01d9912ef0c22dc31c42823ea0abed02e Mon Sep 17 00:00:00 2001 From: Serhiy Mytrovtsiy Date: Mon, 19 Aug 2024 18:36:53 +0200 Subject: [PATCH] feat: added temperature unit update on each read in the Sensors popup (#2078) --- Modules/Sensors/popup.swift | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/Modules/Sensors/popup.swift b/Modules/Sensors/popup.swift index 697cc8e2..91e4ba98 100644 --- a/Modules/Sensors/popup.swift +++ b/Modules/Sensors/popup.swift @@ -318,7 +318,7 @@ internal class SensorView: NSStackView { } public func addHistoryPoint(_ sensor: Sensor_p) { - self.chartView.update(sensor.localValue) + self.chartView.update(sensor.localValue, sensor.unit) } private func open() { @@ -435,7 +435,10 @@ internal class ChartSensorView: NSStackView { fatalError("init(coder:) has not been implemented") } - public func update(_ value: Double) { + public func update(_ value: Double, _ suffix: String) { + if self.chart?.suffix != suffix { + self.chart?.suffix = suffix + } self.chart?.addValue(value/100) } }