Aquarium Cooling Controller
ESP32 firmware for aquarium cooling fan control, monitoring, telemetry, and fault handling.
Loading...
Searching...
No Matches
Functions | Variables
FanCurve Namespace Reference

Fan characterization table and interpolation helpers. More...

Functions

size_t pointCount ()
 Returns the number of measured fan-curve points.
 
const FanCurvePointpoints ()
 Returns the measured fan-curve table.
 
uint16_t expectedRpmForPwm (uint8_t pwmPercent)
 Interpolates the expected RPM for a PWM command.
 
uint16_t rpmToleranceForExpected (uint16_t expectedRpm)
 Calculates the tolerated RPM deviation for an expected speed.
 
bool isPlausibilityRegion (uint8_t pwmPercent)
 Checks whether a PWM command is high enough for RPM plausibility checks.
 

Variables

constexpr uint8_t kStartPwmPercent = 12
 PWM where the fan reliably starts.
 
constexpr uint8_t kMinimumHoldPwmPercent = 10
 Lowest PWM used after the fan is spinning.
 
constexpr uint8_t kMinimumPlausibilityPwmPercent = 18
 Minimum PWM where RPM plausibility is checked.
 
constexpr uint8_t kPlausibilityTolerancePercent = 12
 RPM tolerance around the expected curve.
 

Detailed Description

Fan characterization table and interpolation helpers.

The namespace exposes read-only access to measured curve points and helper functions for converting PWM commands into expected RPM and allowed tolerance.

Function Documentation

◆ expectedRpmForPwm()

uint16_t FanCurve::expectedRpmForPwm ( uint8_t  pwmPercent)

Interpolates the expected RPM for a PWM command.

Values between measured points are linearly interpolated and rounded to the nearest integer RPM. Values outside the curve range are clamped to the nearest measured endpoint.

Parameters
pwmPercentFan PWM command in percent.
Returns
Expected fan speed in RPM.

◆ isPlausibilityRegion()

bool FanCurve::isPlausibilityRegion ( uint8_t  pwmPercent)

Checks whether a PWM command is high enough for RPM plausibility checks.

Parameters
pwmPercentFan PWM command in percent.
Returns
True when RPM plausibility should be evaluated.

◆ pointCount()

size_t FanCurve::pointCount ( )

Returns the number of measured fan-curve points.

Returns
Number of entries available from points().

◆ points()

const FanCurvePoint * FanCurve::points ( )

Returns the measured fan-curve table.

Returns
Pointer to the first measured curve point.

◆ rpmToleranceForExpected()

uint16_t FanCurve::rpmToleranceForExpected ( uint16_t  expectedRpm)

Calculates the tolerated RPM deviation for an expected speed.

Parameters
expectedRpmExpected fan speed in RPM.
Returns
Absolute RPM tolerance.