|
20 | 20 | #include "../includes/pressure.h"
|
21 | 21 | #include "../includes/pressure_valve.h"
|
22 | 22 | #include "../includes/screen.h"
|
| 23 | +#include "../includes/telemetry.h" |
23 | 24 |
|
24 | 25 | // External
|
25 | 26 | #include "Arduino.h"
|
@@ -71,6 +72,7 @@ void Calibration_Init() {
|
71 | 72 | // Invalid calibration
|
72 | 73 | calibrationValid = false;
|
73 | 74 | displayPressureOffsetUnstable(minOffsetValue, maxOffsetValue);
|
| 75 | + sendInconsistentPressureFatalError(inspiratoryPressureSensorOffset); |
74 | 76 | Buzzer_High_Prio_Start();
|
75 | 77 | Calibration_Read_Keyboard();
|
76 | 78 | } else {
|
@@ -101,11 +103,26 @@ void Calibration_Init() {
|
101 | 103 | blower.stop();
|
102 | 104 |
|
103 | 105 | // Happens when flow meter fails
|
104 |
| - if (((flowMeterFlowAtStarting < -1000) || (flowMeterFlowAtStarting > 1000) |
105 |
| - || (flowMeterFlowWithBlowerOn < 20000) || (flowMeterFlowWithBlowerOn > 100000))) { |
| 106 | + bool isMassFlowMeterOutOfRange = ((flowMeterFlowAtStarting < -1000) |
| 107 | + || (flowMeterFlowAtStarting > 1000)); |
| 108 | + |
| 109 | + if ((isMassFlowMeterOutOfRange == true) |
| 110 | + || ((flowMeterFlowWithBlowerOn < 20000) || (flowMeterFlowWithBlowerOn > 100000))) { |
106 | 111 | // Invalid calibration
|
107 | 112 | calibrationValid = false;
|
108 | 113 | displayFlowMeterFail(flowMeterFlowAtStarting, flowMeterFlowWithBlowerOn);
|
| 114 | + |
| 115 | + // MFM reports an out-of-range value, it might not be connected |
| 116 | + if (isMassFlowMeterOutOfRange == true) { |
| 117 | + // MFM failure (eg. not connected) |
| 118 | + sendMassFlowMeterFatalError(); |
| 119 | + } else { |
| 120 | + // Other calibration errors |
| 121 | + sendCalibrationFatalError(inspiratoryPressureSensorOffset, minOffsetValue, |
| 122 | + maxOffsetValue, flowMeterFlowAtStarting, |
| 123 | + flowMeterFlowWithBlowerOn); |
| 124 | + } |
| 125 | + |
109 | 126 | Buzzer_High_Prio_Start();
|
110 | 127 | Calibration_Read_Keyboard();
|
111 | 128 | } else {
|
|
0 commit comments