Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove redundant flag checks #74

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Pressure.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
13 changes: 4 additions & 9 deletions e-vent.ino
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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();
Expand All @@ -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())
Expand Down