software:firmware
MakAir Firmware
pc_ac_controller.cpp
Go to the documentation of this file.
1 
8 // INCLUDES ==================================================================
9 
10 // Associated header
11 #include "../includes/pc_ac_controller.h"
12 
13 // External
14 #include "Arduino.h"
15 #include <algorithm>
16 
17 // Internal
18 
19 #include "../includes/main_controller.h"
20 #include "../includes/pressure_valve.h"
21 
22 // INITIALISATION =============================================================
23 
25 
26 // FUNCTIONS ==================================================================
27 
30 
31  // Calculate max pressure for the last samples
33  for (uint8_t i = 0u; i < MAX_PRESSURE_SAMPLES; i++) {
36  }
37  }
38 
39  // In case the pressure trigger mode is enabled, check if inspiratory trigger is raised
40  if ((mainController.tick()
42  // m_peakPressure > CONST_MIN_PEAK_PRESSURE ensures that the patient is plugged on the
43  // machine
44  if (((mainController.pressure())
49  }
50  }
51 }
int16_t * lastPressureValues()
Get last pressure values.
uint32_t tick() const
Get the tick number of the current cycle.
int16_t pressure() const
Get the current measured pressure.
int16_t peakPressureMeasure() const
Get the measured peak pressure.
const int16_t pressureTriggerOffsetCommand() const
Get the value of the inspiratory trigger pressure command.
uint32_t ticksPerInhalation() const
Get the duration of an inhalation in ticks.
const void setTrigger(bool triggerValue)
Reset the trigger to false.
Controller for the AC mode.
void exhale() override
Control the exhalation.
void exhale() override
Control the exhalation.
int32_t maxPressureValue
MainController mainController
#define MAX_PRESSURE_SAMPLES
Number of values to aggregate when computing plateau pressure.
uint16_t i
#define MAIN_CONTROLLER_COMPUTE_PERIOD_MS
Definition: parameters.h:28
#define CONST_MIN_PEAK_PRESSURE
Definition: parameters.h:34
PC_AC_Controller pcAcController