Could you make the text of the code look better ?
For example this does not look good:
if ((unsigned long)(currentMillis - psiStopTime) >= solenoidInterval){digitalWrite (ValveRelay4 , LOW);} //cuts power to solenoid after solenoidInterval time
this is better:
if (currentMillis - psiStopTime >= solenoidInterval)
{
// cuts power to solenoid after solenoidInterval time
digitalWrite (ValveRelay4, LOW);
}
And this is confusing:
if ((unsigned long)(currentMillis - psiStartTime) >= warmInterval){ // allows concentrators to warm up prior to starting compressor, O2 purged through valve
{digitalWrite (ValveRelay4 , LOW);} //cuts power to solenoid after warmInterval time
{digitalWrite (CompRelay3 , HIGH);} // if psi is less than start setpoint turn on compressor after warmInterval
}
without confusion:
if (currentMillis - psiStartTime >= warmInterval)
{
// allows concentrators to warm up prior to starting compressor,
// O2 purged through valve
digitalWrite (ValveRelay4, LOW); //cuts power to solenoid after warmInterval time
digitalWrite (CompRelay3 , HIGH); // if psi is less than start setpoint turn on compressor after warmInterval
}
You don't have to copy my style, you can have your own style.
Start by pressing Ctrl+T in the Arduino IDE. That is also in the menu: Tools / Autoformat.
To create a single delay, I use a 'bool' variable to tell if that delay is active at the moment. See my millis_single_delay.ino