Skip to content

Commit

Permalink
Merge pull request #10 from mit-drl/bugfix/slow_display
Browse files Browse the repository at this point in the history
Bugfix/slow display
  • Loading branch information
teddyort authored Mar 26, 2020
2 parents a6e10c7 + 3d97f4b commit f55481f
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 13 deletions.
20 changes: 8 additions & 12 deletions Display.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,53 +9,49 @@ void Display::begin() {
}

void Display::writeHeader(){
write(0, 0, "Set: P(cmH2O):", 20);
write(0, 0, "Set: P(cmH2O):");
}

void Display::writeVolume(const int& vol){
char buff[12];
sprintf(buff, " V=%2d%% max ", vol);
write(1, 0, buff, 11);
write(1, 0, buff);
}

void Display::writeBPM(const int& bpm){
char buff[12];
sprintf(buff, " RR=%2d/min ", bpm);
write(2, 0, buff, 11);
write(2, 0, buff);
}

void Display::writeIEratio(const float& ie){
char ie_buff[4];
dtostrf(ie, 3, 1, ie_buff);
char buff[12];
sprintf(buff, " I:E=1:%s ", ie_buff);
write(3, 0, buff, 11);
write(3, 0, buff);
}

void Display::writePeakP(const int& peak){
char buff[10];
sprintf(buff, " peak=%2d", peak);
write(1, 11, buff, 9);
write(1, 11, buff);
}

void Display::writePlateauP(const int& plat){
char buff[10];
sprintf(buff, " plat=%2d", plat);
write(2, 11, buff, 9);
write(2, 11, buff);
}

void Display::writePEEP(const int& peep){
char buff[10];
sprintf(buff, " PEEP=%2d", peep);
write(3, 11, buff, 9);
write(3, 11, buff);
}

template <typename T>
void Display::write(const int& row, const int& col, const T& printable, const int& width){
for(int i=0; i<width; i++){
lcd_->setCursor(col + i, row);
lcd_->write(' ');
}
void Display::write(const int& row, const int& col, const T& printable){
lcd_->setCursor(col, row);
lcd_->print(printable);
}
2 changes: 1 addition & 1 deletion Display.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ class Display {
LiquidCrystal* lcd_;

template <typename T>
void write(const int& row, const int& col, const T& printable, const int& width);
void write(const int& row, const int& col, const T& printable);
};


Expand Down
1 change: 1 addition & 0 deletions e-vent.ino
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,7 @@ void loop() {

if(millis()-stateTimer > Tex*1000){
pressure.set_peak_and_reset();
pressure.set_peep();
displ.writePeakP(pressure.peak());
displ.writePEEP(pressure.peep());
displ.writePlateauP(pressure.plateau());
Expand Down

0 comments on commit f55481f

Please sign in to comment.