Actually, I think the problem lies in your flashLEDs function. Yes, the delays are a problem, but I suspect your code is getting stuck in your "for" loop in that function.
If we think of the flow of the program:
1) program recieves flash command and parameters
2) call flashLEDs(val1,val2,val3)
3) calculate flashtime, print to serial
4) loop from 0-flashtime, delaying 40ms (20+20) each loop
5) continue with the rest of the code
So, while the program is in the for loop, it is doing nothing more than turning the LEDs on and off - and encountering a 40*flashtime millisecond delay. What you could do to get around this is store flashtime as a global variable, which by default is set to 0. Then, modify the flow of the code from above so that step 3 becomes:
3) calculate flashtime, store in global variable, print to serial
Then, in your main loop (maybe in a function called updateLEDs, or something similar), you do this:
if (global_flashtime > 0)
{
analogWrite(pwmOne, c);
analogWrite(pwmTwo, c);
delay(20);
analogWrite(pwmOne, 0);
analogWrite(pwmTwo, 0);
delay(20);
global_flashtime--;
}
This way, instead of you encountering a 40*flashtime ms delay while flashing your LEDs, you encounter a 40ms delay but the program keeps looping through the whole thing - including the reading of inputs and serial i/o.
If a 40ms delay is too much, you could also store a toggle and cycle from 0-flashtime*2. Then, if the toggle is a 1, you turn on the LEDs, if it's a 0, you turn them off, and then you do your 20ms delay.
So, yes, the delay was sort of the problem - but the real problem was where the delays were.
Edit: The way I have written the code above, the LEDs will spend more time off than on. They will be on for 20ms, then off for 20ms + the time it takes to reach the code again. Not sure if that is a problem or not, but the second method i described (using a toggle) would go some way to eliminating this.