Creating a function

OK, I can use array to store values for times but it is generated at runtime, so that is why I pass it into the function.

I will try to explain:

In void loop() if condition is met, I call function waitTime
then in each pass I check if given time is passed and just return false if time not passed, else return true and reset timer for that battery to 0.

Next pass into void loop() I do noting with this function since condition is not met.

Again, when condition (that might be after long time few hours or days) is met, I repeat the process, but this time waitTime might not be the same as last run. I store battery settings in array, so if needed I can add more parameters to it.

Hopefully this explains it a bit more.
Thanks and best regards.