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

View File

@@ -11,7 +11,7 @@
#ifndef CONTROLLER_CONFIG_H
#define CONTROLLER_CONFIG_H
#define FIRMWARE_VERSION "1.0.3"
#define FIRMWARE_VERSION "1.0.4"
#define ADC_TO_VOLT(adc) ((adc) * 3.3 ) / 4095)
#define ADC_TO_VOLT_WITH_MULTI(adc, multi) (((adc) * 3.3 * (multi)) / 4095)

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);
}