Handle default value of cooldown

This commit is contained in:
c3ma
2020-10-23 16:47:40 +02:00
parent 80ce95d5d6
commit 8f21f58950
3 changed files with 15 additions and 4 deletions
+9
View File
@@ -70,7 +70,16 @@ public:
void init(void);
/** @fn bool isInCooldown(long sinceLastActivation)
* @brief determine, if the plant was recently casted
* @param sinceLastActivation timestamp of last time
*/
bool isInCooldown(long sinceLastActivation) {
/* if the time difference is greater than one month, we know these are initial values */
if (sinceLastActivation > (60 * 60 * 24 * 30)) {
return false;
}
return (this->mSetting->pPumpCooldownInHours->get() > sinceLastActivation / 3600);
}