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

Give fine control of fan by constantly switching between states #24

Open
DonFlymoor opened this issue Feb 20, 2022 · 2 comments
Open

Give fine control of fan by constantly switching between states #24

DonFlymoor opened this issue Feb 20, 2022 · 2 comments

Comments

@DonFlymoor
Copy link

It would be possible to have five control of the fan by constantly switching between states. For instance, %75 could be achieved by turning the fan to state 2 until it reaches %75, then switch between state 1 and state 2 constantly, with a short delay. This would allow the fan to start to slow a bit, then does it back up. If done fast enough, it could keep the fan turing at the desired speed without slowing. Then you could create a fan curve in speedfan or hwinfo to get optimal temperatures and volume.

@DonFlymoor
Copy link
Author

I've tried it, and with a bit of fine-tuning it works.
Here's the python code I used:

import subprocess
import time

def fancmd(command):
    si = subprocess.STARTUPINFO()
    si.dwFlags |= subprocess.STARTF_USESHOWWINDOW
    cmd = '"<pathtocommand>\\DellFanCmd.exe"'+" "+command
    subprocess.call(cmd, startupinfo=si)
    print(command)

def disable_ec():
    fancmd("ec-disable")

def enable_ec():
    fancmd("ec-enable")

def set_10():
    fancmd("fan1-level0")

def set_11():
    fancmd("fan1-level1")

def set_12():
    fancmd("fan1-level2")

def set_20():
    fancmd("fan2-level0")

def set_21():
    fancmd("fan2-level1")

def set_22():
    fancmd("fan2-level2")

def set_0():
    set_10()
    set_20()

def set_50():
    set_11()
    set_21()

def set_100():
    set_12()
    set_22()

def set_level(percentage):
    #60, 70, 80, or 90
    if percentage == 60:
        delay = 1.5
    elif percentage == 70:
        delay = 3
    elif percentage == 80:
        delay = 4.5
    elif percentage == 90:
        delay = 6
    set_50()
    time.sleep(10)
    set_100()
    time.sleep(delay)
    for i in range(0,10):
        set_50()
        time.sleep(0.1)
        set_100()
        time.sleep(0.1)
        
def main():
    disable_ec()
    set_level(70)
    set_50()
    #enable_ec()

if __name__ == "__main__":
    main()
    

@shadowzlh
Copy link

I want to know if there will be some bad effects from such frequent switching states

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants