[output] Inline trivial FloatOutput accessors (#14786)

Co-authored-by: Jonathan Swoboda <154711427+swoboda1337@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
This commit is contained in:
J. Nick Koston
2026-03-14 08:31:50 -10:00
committed by GitHub
co-authored by Jonathan Swoboda Copilot Autofix powered by AI
parent f2968e0449
commit ca279110c9
2 changed files with 4 additions and 10 deletions
@@ -11,16 +11,10 @@ void FloatOutput::set_max_power(float max_power) {
this->max_power_ = clamp(max_power, this->min_power_, 1.0f); // Clamp to MIN>=MAX>=1.0
}
float FloatOutput::get_max_power() const { return this->max_power_; }
void FloatOutput::set_min_power(float min_power) {
this->min_power_ = clamp(min_power, 0.0f, this->max_power_); // Clamp to 0.0>=MIN>=MAX
}
void FloatOutput::set_zero_means_zero(bool zero_means_zero) { this->zero_means_zero_ = zero_means_zero; }
float FloatOutput::get_min_power() const { return this->min_power_; }
void FloatOutput::set_level(float state) {
state = clamp(state, 0.0f, 1.0f);
+4 -4
View File
@@ -48,9 +48,9 @@ class FloatOutput : public BinaryOutput {
/** Sets this output to ignore min_power for a 0 state
*
* @param zero True if a 0 state should mean 0 and not min_power.
* @param zero_means_zero True if a 0 state should mean 0 and not min_power.
*/
void set_zero_means_zero(bool zero_means_zero);
void set_zero_means_zero(bool zero_means_zero) { this->zero_means_zero_ = zero_means_zero; }
/** Set the level of this float output, this is called from the front-end.
*
@@ -70,10 +70,10 @@ class FloatOutput : public BinaryOutput {
// (In most use cases you won't need these)
/// Get the maximum power output.
float get_max_power() const;
float get_max_power() const { return this->max_power_; }
/// Get the minimum power output.
float get_min_power() const;
float get_min_power() const { return this->min_power_; }
protected:
/// Implement BinarySensor's write_enabled; this should never be called.