-
Notifications
You must be signed in to change notification settings - Fork 7
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
Reorganization, making better use of variable substitution, and fix multiple (potential) issues #9
Conversation
Include a message() function to output messages to users instead of calling echo for the same purpose. This makes a more clear distinction between echo that is meant to change values in the sysfs vs. those that are meant to be display messages to users.
Fix for incorrect regex and spacing. Change the acceptable values for MIN/MAX DC_PERCENT and other various thresholds.
Reorganization of the order of the functions according to what they do, instead of purely on alphabetical order. Simplification of the main logic by removing the config function, which was just called once (no need for it to be a function).
Replace tabs for two spaces. Standardize the indentation across the entire script. Fix minor typos elsewhere.
Add key global variables to the top of the script. The addition of DEFAULT_ makes allows changin default variables right at the top for all variables that can be customized via CLI. Defaults are now implemented via variable substitution.
Hello @cgomesu, I looked at the code and have no comments on the revised coding style. |
thanks again, @araynard . it looks like the new implementation is ready for prime time but I will wait until the end of the week to merge, just in case something new comes up or another user wants to chime in. |
This is a comprehensive PR that addresses the following (as also noted in the commit history):
DEFAULT_
variables, which are used in substitutions when the corresponding non-default variable is missing (null
). The later and other key variables were moved to the top of the code, which lets users change default behavior and other aspects of the code without going into the details of the implementation and its functions.message
function was created to avoid usingecho
in multiple contexts (to push values to sysfs and output messages to users) and also facilitate editing the structure of the messages that users see (or logged into syslog).pwm-fan.service
to its ownsystemd/
dir to better organize the repo..gitignore
to prevent pushing unwanted files and dirs to the remote.As usual, the new script was tested with the hardware and software described in the
README.md
. Other users are welcomed to test and review the code before Jan 28. Otherwise, this PR will be merged into master then.