12 #include "../includes/parameters.h"
15 #include "../includes/battery.h"
16 #include "../includes/buzzer_control.h"
17 #include "../includes/end_of_line_test.h"
18 #include "../includes/main_controller.h"
19 #include "../includes/mass_flow_meter.h"
20 #include "../includes/pressure.h"
21 #include "../includes/screen.h"
22 #include "../includes/serial_control.h"
23 #include "../includes/telemetry.h"
64 screen.print(
"EOL TEST #");
81 if (message[
i] ==
'\n') {
86 if ((message[
i] == 0) || (line > 3)) {
99 #define EOLTRACESIZE 60
100 #define EOLSCREENSIZE 100
103 #define EOL_TOTALBUTTONS 11
107 #if (STM32_CORE_VERSION < 0x01090000)
116 static int batlevel = 0;
164 "Check power cable\nto the motherboard,\n and run the test again");
169 "Check fans\nthen press\nbutton START");
184 batlevel / 100, batlevel % 100);
190 }
else if (batlevel < 2200) {
203 "Test Vbat Failure\nBATTERY IS TO LOW\n V=%02d.%d", batlevel / 100,
212 "Test Vbat\nUnplug AC...\n V=%02d.%02d", batlevel / 100,
225 batlevel / 100, batlevel % 100);
238 "Check Buzzer\nthen press\nbutton PAUSE");
243 #ifndef DISABLE_BUTTONS
253 buttonsPushed[0] = 1;
259 buttonsPushed[1] = 1;
262 buttonsPushed[2] = 1;
265 buttonsPushed[3] = 1;
269 buttonsPushed[4] = 1;
272 buttonsPushed[5] = 1;
275 buttonsPushed[6] = 1;
279 buttonsPushed[7] = 1;
282 buttonsPushed[8] = 1;
298 buttonsPushed[9] = 1;
301 buttonsPushed[10] = 1;
305 totalPushed += buttonsPushed[
i];
308 "Please press each\nbutton... \n %d / %d OK", totalPushed,
EOL_TOTALBUTTONS);
322 "Press continue\nbutton on\ntouchscreen");
332 "Plug testing\npipes then press\nSTART");
430 "Open oxygen\nthen press\nbutton START");
470 "Close oxygen\nthen press\nbutton START");
487 #ifdef MASS_FLOW_METER_ENABLED
557 "********************\n**** SUCCESS !! ****\n********************");
631 ::eolTimer->setMode(1, TIMER_OUTPUT_COMPARE, NC);
uint32_t getBatteryLevelX100()
Returns battery level x100 for better accuracy.
bool isMainsAvailable()
Check if the cable between power supply and expander input is connected.
bool isMainsConnected()
Check if mains are connected.
void batteryLoop(uint32_t p_cycleNumber)
Handle battery events.
void BuzzerControl_On(void)
Switch buzzer ON.
void BuzzerControl_Off(void)
Switch buzzer OFF.
void stop()
Stops the blower.
void runSpeed(uint16_t p_runSpeed)
Run the blower to a given speed.
Controls the running of the embedded auto tests.
void onConfirm()
Handle EOL confirm control setting from telemetry.
void setupAndStart()
Run test mode.
uint32_t testActive
Test mode activation state.
void activate()
Enable test mode.
bool isRunning()
Check if test mode is enabled.
EolTest()
Default constructor.
void setup()
Initialize actuators.
int32_t read()
Read the current pressure for the feedback control.
uint16_t minAperture() const
Minimum valve aperture angle in degrees.
void execute()
Command the valve to go to the requested aperture.
void open()
Request opening of the Pressure Valve.
uint16_t maxAperture() const
Maximum valve aperture angle in degrees.
void close()
Request closing of the Pressure Valve.
char eolScreenBuffer[EOLSCREENSIZE+1]
void eolScreenMessage(char *message, bool isFailed)
char eolTrace[EOLTRACESIZE]
int16_t eolMatrixCurrentColumn
void millisecondTimerEOL(HardwareTimer *)
@ USER_CONFIRMATION_BEFORE_O2_TEST
@ MAX_PRESSURE_REACHED_OK
@ SUPPLY_TO_EXPANDER_NOT_CONNECTED
@ MAX_PRESSURE_NOT_REACHED
@ WAIT_USER_BEFORE_LONG_RUN
@ MIN_PRESSURE_NOT_REACHED
#define EOL_TEST_ACTIVE
This an arbitrary value allowing to check if test mode is active.
MainController mainController
int32_t MFM_read_airflow(void)
Read instant air flow.
#define PIN_BTN_ALARM_OFF
PressureSensor inspiratoryPressureSensor
PressureValve inspiratoryValve
PressureValve expiratoryValve
LiquidCrystal screen
Instance of the screen controller.
void serialControlLoop()
Parse input and handle changes of settings.
void sendEolTestSnapshot(TestStep step, TestState state, char message[])
Send an "end-of-line test" snapshot.