Repository navigation
Show selected fans' speed and PWM in the Unraid footer #46
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
Merged
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
7f8380c
Show selected fans' speed and PWM in the Unraid footer
andrebrait fbb2063
Report the Footer switch in diagnostics and stop polling once it is o…
andrebrait f2f7a11
List footer fans in the saved order and test the Footer switch wiring
andrebrait 3f7b3a6
Hold the configuration lock while saving the Footer switch
andrebrait f1970c8
Keep the footer entry in place instead of moving it on every update
andrebrait 89ad40f
Reword the footer README entry
andrebrait 50b2318
Remove the footer entry when no fan is shown or the reading fails
andrebrait 59e23b8
Test that the footer entry updates in place
andrebrait File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
46 changes: 46 additions & 0 deletions
46
src/usr/local/emhttp/plugins/fanctrlplus2/FanctrlPlus2Footer.page
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,46 @@ | ||
| Menu="Buttons" | ||
| Link="nav-user" | ||
| --- | ||
| <?php | ||
| // Show the speed and PWM of each fan whose Footer switch is on in the status | ||
| // bar at the bottom of every page, like Dynamix System Temperature does (#45). | ||
| // Pages load the script only while at least one fan has the switch on. | ||
| $fcp_footer = false; | ||
| foreach (glob('/boot/config/plugins/fanctrlplus2/fanctrlplus2_*.cfg') ?: [] as $fcp_footer_cfg) { | ||
| if (((@parse_ini_file($fcp_footer_cfg) ?: [])['footer'] ?? '0') !== '0') { | ||
| $fcp_footer = true; | ||
| break; | ||
| } | ||
| } | ||
| ?> | ||
| <?if ($fcp_footer):?> | ||
| <script> | ||
| $(function fcpFooter() { | ||
| var shown = true; | ||
| $.getJSON('/plugins/fanctrlplus2/Fanctrl2Dashboard.php', function(data) { | ||
| var $footer = $("<span id='fcp-footer' style='margin-right:24px'></span>"); | ||
| var fans = (data.fans || []).filter(function(f) { return f.footer; }); | ||
| shown = fans.length > 0; | ||
| fans.forEach(function(f) { | ||
| var rpm = /^\d+$/.test(f.rpm_val) ? f.rpm_val : '⋅⋅⋅'; | ||
| var pct = typeof f.percent === 'number' ? ' (' + f.percent + '%)' : ''; | ||
| $('<span>').attr('title', f.label) | ||
| .append("<i class='fa fa-flag-o' style='margin:0 6px 0 24px'></i>", document.createTextNode(rpm + ' rpm' + pct)) | ||
| .appendTo($footer); | ||
| }); | ||
| // showFooter() removes and prepends, so entries that other plugins also | ||
| // refresh with it would keep swapping places. Prepend once, then update in place. | ||
| var $old = $('#fcp-footer'); | ||
| if (!shown) $old.remove(); | ||
| else if ($old.length) $old.replaceWith($footer); | ||
| else showFooter($footer, 'fcp-footer'); | ||
| }).fail(function() { | ||
| // No reading: show nothing rather than old values as if they were live. | ||
| $('#fcp-footer').remove(); | ||
| }).always(function() { | ||
| // Every Footer switch turned off: stop polling until the next page load. | ||
| if (shown) setTimeout(fcpFooter, 5000); | ||
| }); | ||
| }); | ||
| </script> | ||
| <?endif;?> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.