From bd7acdd55833c086db1b6456787743fbba9610db Mon Sep 17 00:00:00 2001 From: Shanavas M Date: Tue, 23 Jun 2020 13:46:55 +0530 Subject: [PATCH 1/2] Remove redundant flag checks --- e-vent.ino | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/e-vent.ino b/e-vent.ino index b868684..065b562 100644 --- a/e-vent.ino +++ b/e-vent.ino @@ -219,9 +219,8 @@ void loop() { break; case HOLD_IN_STATE: - if (enteringState) { - enteringState = false; - } + enteringState = false; + if (now() - tCycleTimer > tHoldIn) { pressureReader.set_plateau(); setState(EX_STATE); @@ -240,9 +239,7 @@ void loop() { break; case PEEP_PAUSE_STATE: - if (enteringState) { - enteringState = false; - } + enteringState = false; if (now() - tCycleTimer > tEx + MIN_PEEP_PAUSE) { pressureReader.set_peep(); @@ -252,9 +249,7 @@ void loop() { break; case HOLD_EX_STATE: - if (enteringState) { - enteringState = false; - } + enteringState = false; // Check if patient triggers inhale patientTriggered = pressureReader.get() < (pressureReader.peep() - knobs.ac()) From 3e3a18a6b2654ea8045fa49369e3f2d488cde94d Mon Sep 17 00:00:00 2001 From: Shanavas M Date: Tue, 23 Jun 2020 16:07:17 +0530 Subject: [PATCH 2/2] Fix typo --- Pressure.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Pressure.h b/Pressure.h index 7e9595b..64322ac 100644 --- a/Pressure.h +++ b/Pressure.h @@ -49,8 +49,8 @@ class Pressure { // read the voltage int V = analogRead(sense_pin_); - float Pmin = -100.0; // pressure max in mbar - float Pmax = 100.0; // pressure min in mbar + float Pmin = -100.0; // pressure min in mbar + float Pmax = 100.0; // pressure max in mbar float Vmax = 1024; // max voltage in range from analogRead // convert to pressure float pres = (10 * V/Vmax - 1) * (Pmax-Pmin)/8. + Pmin; //mmHg