13 #include "../includes/blower.h"
16 #include "../includes/parameters.h"
26 Blower::Blower(HardwareTimer* p_hardwareTimer, uint16_t p_timerChannel, uint16_t p_blowerPin) {
58 uint32_t currentDate = micros();
75 MICROSEC_COMPARE_FORMAT);
80 DBG_DO(Serial.print(
"Blower value is wrong: "));
81 DBG_DO(Serial.println(p_runSpeed));
91 703 - (281 * (p_flow / 100000)) - 832 * (p_flow / 200) * (p_flow / 500) / 100000;
95 - (281 * (p_flow / 100000)) - 832 * (p_flow / 200) * (p_flow / 500) / 100000;
98 return min(int32_t(703), max(returnValue, int32_t(0)));
#define BlowerSpeed2MicroSeconds(value)
Convert a speed to a value in microseconds for the blower controller.
HardwareTimer * actuator
Hardware timer used to control the blower.
uint16_t getSpeed() const
Get speed value.
bool m_stopped
Current state.
uint16_t getTargetSpeed() const
Get target speed value.
void setup()
Initialize the hardware timer used to control the blower.
uint16_t m_targetSpeed
target speed
uint16_t timerChannel
Channel of the hardware timer used to control the blower.
int32_t getBlowerPressure(int32_t p_flow)
Given a flow in mL/min, return an estimated pressure just at the output of the blower.
void stop()
Stops the blower.
void runSpeedWithRampUp(uint16_t p_targetSpeed)
Run the blower to a given speed applying a ramp-up to prevent high current drain.
uint16_t blowerPin
Pin of the blower.
void runSpeed(uint16_t p_runSpeed)
Run the blower to a given speed.
uint16_t m_speed
Current speed.
Blower()
Default constructor.
#define DBG_DO(statement)
Expand arbitrary code only when in debug mode.