Compare commits

...

1 Commits
1.1 ... master

Author SHA1 Message Date
Cole Deck e09d3637ea Actually fix formatting again 1 year ago

@ -22,8 +22,8 @@ args = parser.parse_args()
fanChanged = False fanChanged = False
def iterateFans(info): def iterateFans(info):
for fanopt in info: for fanopt in info:
if str(fanopt.split(":"))[2:-2] == fanopt or int(fanopt.split(":")[0]) < 1 or int(fanopt.split(":")[0]) > MAXFAN: if str(fanopt.split(":"))[2:-2] == fanopt or int(fanopt.split(":")[0]) < 1 or int(fanopt.split(":")[0]) > MAXFAN:
print("Improper format!") print("Improper format!")
continue continue
fan, speed = fanopt.split(":") fan, speed = fanopt.split(":")
@ -33,35 +33,35 @@ def iterateFans(info):
if int(speed) == 0: if int(speed) == 0:
print("Set speed of FAN" + fan + " to Auto.") print("Set speed of FAN" + fan + " to Auto.")
else: else:
print("Set speed of FAN" + fan + " to " + speed + "%.") print("Set speed of FAN" + fan + " to " + speed + "%.")
while args.auto is True: while args.auto is True:
temp = run_cmd.getTemp() temp = run_cmd.getTemp()
speeds = [] speeds = []
if temp < MINTEMP: if temp < MINTEMP:
for i in range(2, 7): for i in range(2, 7):
speeds.append(str(i) + ":1") speeds.append(str(i) + ":1")
elif temp > MAXTEMP: elif temp > MAXTEMP:
for i in range(2, 7): for i in range(2, 7):
speeds.append(str(i) + ":100") speeds.append(str(i) + ":100")
else: else:
base = temp - MINTEMP base = temp - MINTEMP
max = MAXTEMP - MINTEMP max = MAXTEMP - MINTEMP
scaled = base / max scaled = base / max
speed = int(scaled * (MAXSPEED - MINSPEED) + MINSPEED) speed = int(scaled * (MAXSPEED - MINSPEED) + MINSPEED)
for i in range(2, 7): for i in range(2, 7):
speeds.append(str(i) + ":" + str(speed)) speeds.append(str(i) + ":" + str(speed))
iterateFans(speeds) iterateFans(speeds)
if args.info is False and len(args.fanplusspeed) == 0: if args.info is False and len(args.fanplusspeed) == 0:
print("Nothing to do! See --help for usage.") print("Nothing to do! See --help for usage.")
quit quit
if len(args.fanplusspeed) != 0: if len(args.fanplusspeed) != 0:
iterateFans(args.fanplusspeed) iterateFans(args.fanplusspeed)
if args.info is True: if args.info is True:
if fanChanged is True: if fanChanged is True:
print("\nWaiting for fans to adjust...") print("\nWaiting for fans to adjust...")
time.sleep(5) time.sleep(5)
print("\nRetrieving fan speeds...\n") print("\nRetrieving fan speeds...\n")
for line in run_cmd.getFanInfo(): for line in run_cmd.getFanInfo():
print(line) print(line)

Loading…
Cancel
Save