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

Implement fan control behind feature flag #29

Closed
wants to merge 3 commits into from
Closed

Conversation

PabloMansanet
Copy link

Going red because it depends on tonarino/panel-protocol#14

Adds a feature flag that allows controlling fans and completely disables controlling lights, so that conflict isn't possible. Commands parsed for the unavailable feature are just ignored.

Untested, would be good to test with actual fans :).

Note that this preserves previous behaviour: the PWM are initialized at 0, which is inverted into a max duty cycle and means the fans start at max speed until set otherwise.

@PabloMansanet
Copy link
Author

Updated dependency, this should be mergeable now. I also fixed two unrelated lints (just a double reference) to clear CI as they really didn't warrant another PR.

Comment on lines +8 to +10
[features]
default = ["fan_control"]
fan_control = []
Copy link
Member

Choose a reason for hiding this comment

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

How we'd use the feature flag? I guess we'll build one firmware variant with the flag on, one variant with the flag off, and then make sure we flash correct firmware to correct devices. That would work.

But it would be more practical to build all non-outdated variants at once, and name them appropriately right in Cargo.toml (rather adding some docs with conventions): instead of the feature flag, we could have multiple "binaries", each for a given hardware variant. They could/should share almost all the code - the main.rs files could be very thin shims.

CC @bschwind who has the most context.

Copy link
Member

Choose a reason for hiding this comment

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

Yes, if we have feature flags at all I'd prefer them to be based on board variants.

Currently our firmware only reports a short SHA1 hash for which commit it was built from, but no way to report what features it was built with.

We can do as you suggest and build multiple binaries, one for each hardware variant, or we could put more work into making the protocol flexible in handling boards of varying capabilities.

Either way, it's probably best to wait until we have the next hardware revision before deciding exactly what we do.

@PabloMansanet
Copy link
Author

Closing as we're deferring this until hardware revision.

I'll leave the release on the panel-protocol, since it's the direction we want to follow eventually, but nothing will use it as a dependency for now (neither panel-firmware nor tonari)

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

Successfully merging this pull request may close these issues.

3 participants