add --set XXX to directly control fan speed
This commit is contained in:
parent
b1eb93e575
commit
06e6069b53
1 changed files with 10 additions and 0 deletions
10
fand.py
10
fand.py
|
@ -118,6 +118,16 @@ if __name__ == "__main__":
|
||||||
s = Sensor(cfg.sensor.source, cfg.sensor.weight)
|
s = Sensor(cfg.sensor.source, cfg.sensor.weight)
|
||||||
p = PWM(cfg.pwm.chip, cfg.pwm.channel, cfg.pwm.period)
|
p = PWM(cfg.pwm.chip, cfg.pwm.channel, cfg.pwm.period)
|
||||||
|
|
||||||
|
if len(sys.argv) == 3 and sys.argv[1] == "--set":
|
||||||
|
try:
|
||||||
|
percentage = int(sys.argv[2])
|
||||||
|
except:
|
||||||
|
print("--set must be followed by a number")
|
||||||
|
sys.exit(1)
|
||||||
|
|
||||||
|
p.set_percent(percentage)
|
||||||
|
sys.exit(0)
|
||||||
|
|
||||||
while True:
|
while True:
|
||||||
temperature = s.measure()
|
temperature = s.measure()
|
||||||
percentage = linlut(temperature, cfg.map)
|
percentage = linlut(temperature, cfg.map)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue