IoT liquid Auto sampler- bringing it all together

I haven't read all your inbetween messages, but what jumped into my eyes is that you do not have a "break;" statement at each possible way to leave a "case".

example

//    manualMode();
      if (digitalRead(primeBtnPin) == pressed) {

        pumpOff();
       // here should be a break;-statement too
      }
      else {
        manualMode();
        break;
      }
      
      if(purgeBtnPinHasBeenPressed = true) {
        state = PurgeState;
      }

And as a second thing
your code still has while-loops which are blocking

you should organise your whole code to be non-blocking
you can control everything by a state-machine

Making a variable global is simply done by declaring it outside all
functions above all functions.

If you did not yet know what global scope is:
how many hours did you spend trying this / trying that?
I guess many hours. You should invest a few hours into learning ,ore basics

and investing a few hours to re-organise your code to work consequently with statemachines where each and every detail works in a quickly jump_in / jump_out-manner

I started writing a tutorial about that but it is not yet finished

best regards Stefan