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

feat(gui): fans can have multiple rpm values and add "fan_multi" #2016

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

xPatrikTwitch
Copy link

@xPatrikTwitch xPatrikTwitch commented Sep 16, 2024

Description

Changes how the fan rpm is displayed so it can be an array of multiple rpm values and also adds support "fan_multi" a fan that can have multiple tachometer_pins defined (https://github.com/xPatrikTwitch/klipper/blob/master/klippy/extras/fan_multi.py) (This does not break normal fans with one rpm value)

Related Tickets & Documents

none

Mobile & Desktop Screenshots/Recordings

image

[optional] Are there any post-deployment tasks we need to perform?

none

Summary by Sourcery

Add support for fans with multiple RPM values and introduce the 'fan_multi' type, enhancing the GUI to display these values appropriately.

New Features:

  • Introduce support for fans with multiple RPM values, allowing for an array of RPMs to be displayed.
  • Add support for 'fan_multi', a fan type that can have multiple tachometer pins defined.

Enhancements:

  • Update the GUI to handle and display multiple RPM values for fans, ensuring compatibility with both single and multi-RPM fans.

@dosubot dosubot bot added the size:S This PR changes 10-29 lines, ignoring generated files. label Sep 16, 2024
Copy link
Contributor

sourcery-ai bot commented Sep 16, 2024

Reviewer's Guide by Sourcery

This pull request implements support for fans with multiple RPM values and adds the "fan_multi" type. The changes primarily affect the display of fan RPM in the UI and the handling of different fan types in the store.

File-Level Changes

Change Details Files
Implement support for multiple RPM values in fan display
  • Add conditional rendering for single and multiple RPM values
  • Update styling for multiple RPM display
  • Handle edge cases such as zero RPM when fan is running
src/components/inputs/MiscellaneousSlider.vue
Add support for 'fan_multi' type
  • Include 'fan_multi' in supported and controllable fan types
  • Implement gcode command for 'fan_multi' type
src/components/inputs/MiscellaneousSlider.vue
src/store/printer/getters.ts
Update fan-related getters in the store
  • Add 'fan_multi' to supported and controllable fan arrays
src/store/printer/getters.ts

Tips
  • Trigger a new Sourcery review by commenting @sourcery-ai review on the pull request.
  • Continue your discussion with Sourcery by replying directly to review comments.
  • You can change your review settings at any time by accessing your dashboard:
    • Enable or disable the Sourcery-generated pull request summary or reviewer's guide;
    • Change the review language;
  • You can always contact us if you have any questions or feedback.

Copy link
Contributor

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @xPatrikTwitch - I've reviewed your changes - here's some feedback:

Overall Comments:

  • Could you provide more documentation on the 'fan_multi' type and its relationship to the Klipper firmware? This would help clarify the use case and benefits of this feature.
  • Please add some tests to ensure that existing fan configurations are not affected by these changes and that the new multi-RPM functionality works as expected.
Here's what I looked at during the review
  • 🟡 General issues: 2 issues found
  • 🟢 Security: all looks good
  • 🟢 Testing: all looks good
  • 🟢 Complexity: all looks good
  • 🟢 Documentation: all looks good

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment to tell me if it was helpful.

<small v-if="rpm !== null && !Array.isArray(rpm)" :class="rpmClasses">
{{ Math.round(rpm ?? 0) }} RPM
</small>
<template v-if="Array.isArray(rpm)">
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion: Consider extracting RPM display logic to improve readability

The new logic for displaying multiple RPM values adds complexity to the template. Consider extracting this into a separate component or computed property to improve readability and maintainability.

<template v-if="isRpmArray">

@@ -186,10 +186,10 @@ export const getters: GetterTree<PrinterState, RootState> = {

getFans: (state, getters) => {
const fans: PrinterStateFan[] = []
const supportedFans = ['temperature_fan', 'controller_fan', 'heater_fan', 'fan_generic', 'fan']
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

question: Clarify the distinction between 'fan_multi' and 'fan_generic'

Can you provide more information about the 'fan_multi' type and how it differs from 'fan_generic'? Understanding the distinction would help clarify the purpose of this addition.

@meteyou
Copy link
Member

meteyou commented Sep 16, 2024

@xPatrikTwitch pls ignore the bot. we are testing it right now...

will the module fan_multi be merged in upstream Klipper?

@xPatrikTwitch
Copy link
Author

@xPatrikTwitch pls ignore the bot. we are testing it right now...

will the module fan_multi be merged in upstream Klipper?

There is a pull request open Klipper3d/klipper#6691

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
size:S This PR changes 10-29 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants