Multi pages lcd and pbs freaz for delay time

Hi guys
Iam new in arduino
My project is open source ventilator based arduino control blower dc motor at mapping speed with pressure
And ins - exsp valve with lcd and three pb to move between multi pages and subpages
The mian as code bleow are to adjust max and min pressure and respr rate up to 30 times per minute and
Tv
So the code will run and stop motor at specific speed for rr rate time iassuming the ins to exp time is 0,66
I did equation to calculate the rr time
As said the motor will run for insp delay time and stop for 0,66 of ins delay time
The code working well but !!! When mot running the pb donot respone to oress untill the running time finish so the are delay to move between the pages how can solve the issue
Thanks advance

VENTILATOR-USING-millis.ino (29.6 KB)

Guys really need help for fighting covid19
The issue is the pbs and moving between pages and sensor reads freaz wait until the insp time finish
I need to moving smothly
The issue happend only when choose the mode , before choosing the pb and pages working fine

Your code is long and poorly commented.
If "TV" is meant to represent tidal volume, say so, don't put a space wasting comment like

//**********************************FLOW ****************
  float TV_sense = analogRead(A1);
  TV_sense = TV_sense / 50;

Exactly
Tv mean tidal volume
Sone flow sensor not available at home so didtont use yet

The issue is the pbs and moving between pages and sensor reads freaz wait until the insp time finish
I need to moving smothly
The issue happend only when choose the mode , before choosing the pb and pages working fine

Junk like this const int buzzer = 4; //buzzer to arduino pin 3 is really off-putting.

You look to have a bunch of globally-defined variables that should really be local to loop ().

if (P_calb < 1030) {
          //To avoid "0" of number 10
          P_calb = P_calb;
        }

Is a waste of time and space. The comment is worse than useless.

if (last_up == LOW && current_up == HIGH) { //Up bright +
            P_calb ++ ;

I don't know what "bright" means in this context.

P_calb = P_calb; //If led_lum higher than 10, return to 0 Again, a waste of space.

event.pressure; What's that?

It looks like your code could be factored into to something a lot shorter and more legible, but that's just a guess, due mostly to the lack of comments.

Code: [Select]
event.pressure;
Iused the bmp180 baromatric pressure to read the cmh2o by little bit trick , becauase the barimitrc value vary from mornig to nignt according to the temp and othe parmaters and acording to place
So ihad to calbrite it to make cmh2o zerro before measure the pressure come from blower
And use the orginal code use for other project , so some comment still as it is

event.pressure;I meant "what does that do?".
It isn't a function call, so it can't assign global or class variables.

So what is it?

And use the orginal code use for other project , so some comment still as it is

I'm sure your patients victims will be delighted to see your attention detail.

Ha thanks
The event pressure to display the baromatric press
Instead of lcd .print( event, press) ,i used p_ sense to measure the pressure
Ithink the problem here

  if (mod == 0) {
    mode = "";
    mode = "STOP_mode";
    analogWrite(BLOWER_pin, 0);

  }

  //*****************************
  else if (mod == 1) {

    mode = "";
    mode = "Pmap_mode";
    duty_cycle1 = map(P_max, 3, 20, 120, 255); //maping at 24v powersupply
    duty_cycle2 = map(P_min, 0, 20,0  , 255);

    analogWrite(BLOWER_pin, duty_cycle1);
    delay(DELAY);
    analogWrite(BLOWER_pin, duty_cycle2);
    delay(DELAY * 0.78);




  }

When sekect mode 1 then the blower start running for Delay time
Every thing will stop at this time
I aware the delay stop arduino to do any things but need the delay expressed as ins time
So is there other way to expressing the insp time

Get rid of the delays, if they're what is causing you your problem.
Rewrite the sketch as a state machine.

Thanks for reply
Could u pls Give example to my sketch
Thanks advance

Thanks a lot off
Intially the issue solved
I appreciate u guys effort
Ilove u guys