Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

temperature_fan: Add self-logging #6732

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions klippy/extras/temperature_fan.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
# Copyright (C) 2016-2020 Kevin O'Connor <kevin@koconnor.net>
#
# This file may be distributed under the terms of the GNU GPLv3 license.
import threading
from . import fan

KELVIN_TO_CELSIUS = -273.15
Expand All @@ -29,6 +30,7 @@ def __init__(self, config):
self.min_speed_conf = config.getfloat(
'min_speed', 0.3, minval=0., maxval=1.)
self.min_speed = self.min_speed_conf
self.lock = threading.Lock()
self.last_temp = 0.
self.last_temp_time = 0.
self.target_temp_conf = config.getfloat(
Expand Down Expand Up @@ -70,6 +72,13 @@ def get_min_speed(self):
return self.min_speed
def get_max_speed(self):
return self.max_speed
def stats(self, eventtime):
with self.lock:
target_temp = self.target_temp
last_temp = self.last_temp
last_speed_value = self.last_speed_value
return False, '%s: target=%.0f temp=%.1f pwm=%.3f' % (
self.name, target_temp, last_temp, last_speed_value)
def get_status(self, eventtime):
status = self.fan.get_status(eventtime)
status["temperature"] = round(self.last_temp, 2)
Expand Down
Loading