Skip to content

AC Indicator#29

Open
abukhalaf wants to merge 33 commits into
developfrom
AssistControl_cleanup
Open

AC Indicator#29
abukhalaf wants to merge 33 commits into
developfrom
AssistControl_cleanup

Conversation

@abukhalaf

@abukhalaf abukhalaf commented Apr 8, 2020

Copy link
Copy Markdown
Member

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.

Comment thread Display.cpp Outdated
Comment thread LICENSE Outdated
Comment thread e-vent.ino Outdated
Comment thread Display.cpp Outdated
Comment thread Display.cpp Outdated
@abukhalaf abukhalaf changed the title AC Flag and AC Indicators AC Indicator May 8, 2020

@amadoantonini amadoantonini left a comment

Copy link
Copy Markdown
Collaborator

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.

Comment thread Display.cpp Outdated
Comment thread Display.h Outdated
Comment thread Display.h Outdated
Comment thread e-vent.ino Outdated
Comment thread e-vent.ino Outdated
@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

@amadoantonini amadoantonini left a comment

Copy link
Copy Markdown
Collaborator

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.

Comment thread Display.h Outdated
Comment thread e-vent.ino Outdated
Comment thread e-vent.ino Outdated
Comment thread e-vent.ino Outdated
Comment thread Indicators.h Outdated
Comment thread Display.h
Comment thread Display.h
Comment thread Display.cpp Outdated
Comment thread Alarms.h Outdated
Comment thread Alarms.h Outdated
@abukhalaf

abukhalaf commented Jul 2, 2020

Copy link
Copy Markdown
Member Author

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

@teddyort teddyort left a comment

Copy link
Copy Markdown
Contributor

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.

Comment thread Indicators.h
B00100,
B00000};

#endif

Copy link
Copy Markdown
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

Comment thread e-vent.ino
displ.showPatientIcon();
} else {
displ.showTimeIcon();
}

Copy link
Copy Markdown
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

Comment thread e-vent.ino
if (now() - tCycleTimer > tEx + MIN_PEEP_PAUSE) {
pressureReader.set_peep();

displ.writePEEP(round(pressureReader.peep()));

Copy link
Copy Markdown
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?

Comment thread e-vent.ino
if (enteringState) {
enteringState = false;
goToPositionByDur(roboclaw, BAG_CLEAR_POS, motorPosition, tEx - (now() - tCycleTimer));
displ.hideTimePatientIcon();

Copy link
Copy Markdown
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...

Comment thread Display.h
@@ -121,27 +127,41 @@ class Display {
Display(LiquidCrystal* lcd, const float& trigger_threshold):

Copy link
Copy Markdown
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

Comment thread Alarms.cpp
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
Copy Markdown
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

Comment thread Alarms.h
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
Copy Markdown
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?

Comment thread Alarms.h
NOT_CONFIRM_TV,
NOT_CONFIRM_RR,
NOT_CONFIRM_IE,
NOT_CONFIRM_AC,

Copy link
Copy Markdown
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

Comment thread Alarms.h
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
Copy Markdown
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?

Comment thread Alarms.h
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
Copy Markdown
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