16 #include "../includes/screen.h"
19 #include "../includes/parameters.h"
45 screen.print(
"Initialization ");
77 uint16_t plateauPressureMax,
97 if (plateauPressure == UINT16_MAX) {
115 bool hasChanged =
false;
126 for (uint8_t
i = 0;
i < nbAlarmToPrint; ++
i) {
136 for (uint8_t
i = 0;
i < nbAlarmToPrint; ++
i) {
150 if (p_nbTriggeredAlarms == 0u) {
164 for (uint8_t
i = 0;
i < nbAlarmToPrint;
i++) {
167 int n = snprintf(&buf[pos], spaceLeft + 1,
" %u", p_alarmCodes[
i]);
168 if ((n < 0) || (n > spaceLeft)) {
190 p_inspiratoryPressureSensorOffset);
199 p_flowMeterFlowAtStarting / 1000);
204 p_flowMeterFlowWithBlowerOn / 1000);
207 screen.print(
"Flow meter fail");
209 screen.print(
"Press start to retry");
215 (void)snprintf(message,
SCREEN_LINE_LENGTH + 1,
"Flow offset: %3d SLM", p_flowMeterFlowOffset);
228 p_maxOffsetValue - p_minOffsetValue);
231 screen.print(
"Unplug patient and");
233 screen.print(
"press start");
238 screen.print(
"Calibration");
240 screen.print(
"Patient must be");
242 screen.print(
"unplugged");
247 screen.print(
"EOL Test Mode");
253 screen.print(
"An error has occured");
255 screen.print(
"Check the machine");
257 screen.print(
"before re-using");
263 screen.print(
"Battery very low");
265 screen.print(
"Please charge");
267 screen.print(
"before running.");
272 screen.print(
"Press start to begin");
277 uint16_t lastDigit = pressure % 10u;
279 if (lastDigit < 5u) {
280 result = (pressure / 10u);
282 result = (pressure / 10u) + 1u;
#define VERSION
Current version of the software.
#define SCREEN_LINE_LENGTH
Number of characters per line.
#define SCREEN_LINE_NUMBER
Number of lines.
void displayAlarmInformation(uint8_t p_alarmCodes[], uint8_t p_nbTriggeredAlarms)
Display triggered alarm codes.
void displayBatteryDeepDischarge()
Display error when battery level is too discharged.
void displayMachineStopped()
Display a message when the machine is stopped.
void displayWatchdogError()
Display error when machine was restarted by watchdog.
static const int ALARMS_CODE_POS
Position of the first alarm code in the third line of the screen.
uint16_t convertAndRound(uint16_t pressure)
Convert and round a pressure value.
void displayPressureOffsetUnstable(uint32_t p_minOffsetValue, uint32_t p_maxOffsetValue)
Display error when pressure offset is unstable.
void displayCurrentSettings(uint16_t peakPressureMax, uint16_t plateauPressureMax, uint16_t peepMin)
Display the current settings.
void displayFlowMeterOffset(int32_t p_flowMeterFlowOffset)
Display flow meter offset.
static uint8_t prevAlarmCodes[MAX_ALARMS_DISPLAYED]
static const char * ALARM_LINE
Static label to display at the begining of the third line of the screen when at least one alarm is tr...
void clearAlarmDisplayCache()
Force clear the alarm display cache.
void displayEndOfLineTestMode()
Show that EOL mode was triggered.
LiquidCrystal screen(PIN_LCD_RS, PIN_LCD_RW, PIN_LCD_EN, PIN_LCD_D4, PIN_LCD_D5, PIN_LCD_D6, PIN_LCD_D7)
Instance of the screen controller.
static const char * NO_ALARM_LINE
Text to display at the third line of the screen when no alarm is triggered.
static const uint8_t MAX_ALARMS_DISPLAYED
Number of alarm codes to display on screen at most.
void displayPressureOffset(int32_t p_inspiratoryPressureSensorOffset)
Display pressure offset.
void displayPatientMustBeUnplugged()
Display the "calibration in progress" message.
static uint8_t prevNbAlarmToPrint
void displayCurrentPressure(uint16_t pressure, uint16_t cyclesPerMinute)
Display the current step of the breathing.
static bool hasAlarmInformationChanged(uint8_t p_alarmCodes[], uint8_t p_nbTriggeredAlarms)
Check whether triggered alarms are already displayed on screen or not.
void displayCurrentVolume(int32_t volumeMassFlow, uint16_t cyclesPerMinute)
Display the current injected air volume.
void resetScreen()
Erase everything that is on the screen.
void startScreen()
Start the screen.
void displayFlowMeterFail(int32_t p_flowMeterFlowAtStarting, int32_t p_flowMeterFlowWithBlowerOn)
Display error when flow meter fails.
void displayCurrentInformation(uint16_t peakPressure, uint16_t plateauPressure, uint16_t peep)
Display relevant values from the ongoing cycle.