"Stalling" execution is generally a bad idea. I would make a "loopcounter" variable, and increase the counter every time the function runs. After a certain number of loops, make it do the next thing.
For example, here's our pump code:
Code:
void pump_routine(void) {
static unsigned int loops = 0; <--- Loop Counter
if(BTN_PUMP_DISABLE) {
if(DIGIN_PUMP_PRESSURE_SWITCH && loops>10) { <-- If more than ten loops have passed
RLY_PUMP_ON = 0;
}
else if(DIGIN_PUMP_PRESSURE_SWITCH) {
loops++; <-- Increase loop counter
RLY_PUMP_ON = 1;
}
else {
loops = 0;
RLY_PUMP_ON = 1;
}
}
else {
RLY_PUMP_ON = 0;
loops = 0;
}
RLY_PUMP_NUL = 0;
}