diff --git a/Modules/Fans/main.swift b/Modules/Fans/main.swift index 4b43cb2d..a549c4e9 100644 --- a/Modules/Fans/main.swift +++ b/Modules/Fans/main.swift @@ -16,8 +16,8 @@ import ModuleKit public struct Fan { public let id: Int public let name: String - public let minSpeed: Int - public let maxSpeed: Int + public let minSpeed: Double + public let maxSpeed: Double public var value: Double? var state: Bool { diff --git a/Modules/Fans/popup.swift b/Modules/Fans/popup.swift index 404926b9..332eecf4 100644 --- a/Modules/Fans/popup.swift +++ b/Modules/Fans/popup.swift @@ -144,7 +144,7 @@ internal class FanView: NSView { let row: NSView = NSView(frame: NSRect(x: 0, y: 0, width: self.mainView.frame.width, height: 14)) let value = (self.fan.value ?? 0) - let percentage = "\((100*Int(value)) / self.fan.maxSpeed)%" + let percentage = "\((100*Int(value)) / Int(self.fan.maxSpeed))%" let percentageWidth: CGFloat = 40 let percentageField: NSTextField = TextView(frame: NSRect( @@ -172,7 +172,7 @@ internal class FanView: NSView { } if let view = self.percentageField, let value = value.value { - view.stringValue = "\((100*Int(value)) / self.fan.maxSpeed)%" + view.stringValue = "\((100*Int(value)) / Int(self.fan.maxSpeed))%" } self.ready = true diff --git a/Modules/Fans/readers.swift b/Modules/Fans/readers.swift index f3eb54f7..42813cab 100644 --- a/Modules/Fans/readers.swift +++ b/Modules/Fans/readers.swift @@ -28,23 +28,13 @@ internal class FansReader: Reader<[Fan]> { os_log(.debug, log: self.log, "Found %.0f fans", count) for i in 0..