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

AC Indicator #29

Open
wants to merge 33 commits into
base: develop
Choose a base branch
from
Open

AC Indicator #29

wants to merge 33 commits into from

Conversation

abukhalaf
Copy link
Member

@abukhalaf abukhalaf commented Apr 8, 2020

Utilizing ASSIST_CONTROL flag in the main code. It can be utilized in the display code as well, but not attempting this in this push.

Added visual indicators (icons) to distinguish Patient-triggered vs. Time-triggered inhale cycles. They are added to the last row to avoid conflicts with the first row. This can be made prettier if cm H2O units are moved to the knobs instead of cluttering the display.

Tested on the Ambu Bag and all is running as expected.

Display.cpp Outdated Show resolved Hide resolved
LICENSE Outdated Show resolved Hide resolved
e-vent.ino Outdated Show resolved Hide resolved
Display.cpp Outdated Show resolved Hide resolved
Display.cpp Outdated Show resolved Hide resolved
@abukhalaf abukhalaf changed the title AC Flag and AC Indicators AC Indicator May 8, 2020
Copy link
Collaborator

@amadoantonini amadoantonini left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great initiative getting started with the icons!
Let's address #50 though at the same time.

Display.cpp Outdated Show resolved Hide resolved
Display.h Outdated Show resolved Hide resolved
Display.h Outdated Show resolved Hide resolved
e-vent.ino Outdated Show resolved Hide resolved
e-vent.ino Outdated Show resolved Hide resolved
@abukhalaf abukhalaf marked this pull request as draft May 14, 2020 13:38
@abukhalaf abukhalaf marked this pull request as ready for review June 13, 2020 02:10
Copy link
Collaborator

@amadoantonini amadoantonini left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In general I find that by extending what was already somewhat complicated code to do a more complex behavior it became unnecessarily confusing.
In particular, we need to simplify the Display class perhaps by using a display manager library.

Display.h Outdated Show resolved Hide resolved
e-vent.ino Outdated Show resolved Hide resolved
e-vent.ino Outdated Show resolved Hide resolved
e-vent.ino Outdated Show resolved Hide resolved
Indicators.h Outdated Show resolved Hide resolved
Display.h Show resolved Hide resolved
Display.h Outdated Show resolved Hide resolved
Display.cpp Outdated Show resolved Hide resolved
Alarms.h Outdated Show resolved Hide resolved
Alarms.h Outdated Show resolved Hide resolved
@abukhalaf
Copy link
Member Author

abukhalaf commented Jul 2, 2020

The following commit 152e899 simplifies further the code.

This has been tested on ventilator 3.1-002 and box 1.0-002.

@abukhalaf abukhalaf requested a review from amadoantonini July 2, 2020 15:29
Copy link
Contributor

@teddyort teddyort left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great start! There's a number of minor details I pointed out that need fixing.

The only big issue is confusing way the alarms are now structured with mixing between confirm alarms, and regular alarms, and lots of redundant and hardcoding to treat them differently.

To clean it up, we should abstract the alarm concept so that it applies equally well to all types of alarms. Perhaps two separt alarms instances (one for the safety conditions and one for the knobs) would be appropriate.

B00100,
B00000};

#endif
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should be left indented

displ.showPatientIcon();
} else {
displ.showTimeIcon();
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We shouldn't have separate if blocks that both check patientTriggered state next to each other

@@ -246,7 +247,7 @@ void loop() {

if (now() - tCycleTimer > tEx + MIN_PEEP_PAUSE) {
pressureReader.set_peep();

displ.writePEEP(round(pressureReader.peep()));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why write PEEP here when it will get written along with all the other pressures on line 268?

@@ -232,6 +232,7 @@ void loop() {
if (enteringState) {
enteringState = false;
goToPositionByDur(roboclaw, BAG_CLEAR_POS, motorPosition, tEx - (now() - tCycleTimer));
displ.hideTimePatientIcon();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why hide the icon here? Seems it should stay on until the next trigger...

@@ -121,27 +127,41 @@ class Display {
Display(LiquidCrystal* lcd, const float& trigger_threshold):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment on this class needs updating

if (alarms_[i].isON()) {
aConfirmAlarm = (i==NOT_CONFIRM_TV || i==NOT_CONFIRM_RR ||
i==NOT_CONFIRM_IE || i==NOT_CONFIRM_AC);
if (aConfirmAlarm && alarms_[i].isON()) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is confusing and brittle. Now that the confirm knobs and alarms are being written to different places, they should be treated differently. But hardcoding the list of which alarms are confirm alarms, and writing these almost duplicate functions is bad practice. We should abstract the logic of which alarms are in which cycle, so we don't need to hardcode checks and write code multiple times

@@ -177,7 +182,7 @@ class Alarm {
// for at least `min_good_to_clear_` consecutive calls with different `seq`.
void setCondition(const bool& bad, const unsigned long& seq);

// Set the alarm text (trim or pad to display width)
// Set the alarm text (trim or pad to footer width)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why to footer width when some alarms are in the header?

NOT_CONFIRM_TV,
NOT_CONFIRM_RR,
NOT_CONFIRM_IE,
NOT_CONFIRM_AC,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we need separate alarms for each not_confirm? The old way was better since it's really the same alarm

alarms_[NOT_CONFIRM_TV] = Alarm("CONFIRM? ", 1, 1, NOTIFY);
alarms_[NOT_CONFIRM_RR] = Alarm("CONFIRM? ", 1, 1, NOTIFY);
alarms_[NOT_CONFIRM_IE] = Alarm("CONFIRM? ", 1, 1, NOTIFY);
alarms_[NOT_CONFIRM_AC] = Alarm("CONFIRM? ", 1, 1, NOTIFY);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is all this duplicating of NOT_CONFIRM really needed?

if (key == display::DisplayKey::VOLUME) { NOT_CONFIRM = NOT_CONFIRM_TV;}
if (key == display::DisplayKey::BPM) { NOT_CONFIRM = NOT_CONFIRM_RR;}
if (key == display::DisplayKey::IE_RATIO) { NOT_CONFIRM = NOT_CONFIRM_IE;}
if (key == display::DisplayKey::AC_TRIGGER) { NOT_CONFIRM = NOT_CONFIRM_AC;}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And here again... this will be very hard to maintain

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants