Add config limits.heater_grace_time_secs
This commit is contained in:
parent
a30879ca3f
commit
9576f8e664
3 changed files with 12 additions and 4 deletions
|
@ -28,6 +28,7 @@ func loadConfiguration() *controllers.ControllerConfig {
|
||||||
viper.SetDefault("limits.min_cooler_runtime_secs", 300)
|
viper.SetDefault("limits.min_cooler_runtime_secs", 300)
|
||||||
viper.SetDefault("limits.max_cooler_runtime_secs", 86400)
|
viper.SetDefault("limits.max_cooler_runtime_secs", 86400)
|
||||||
viper.SetDefault("limits.min_cooler_cooldown_secs", 300)
|
viper.SetDefault("limits.min_cooler_cooldown_secs", 300)
|
||||||
|
viper.SetDefault("liimts.heater_grace_time_secs", 1800)
|
||||||
|
|
||||||
viper.AddConfigPath("/etc")
|
viper.AddConfigPath("/etc")
|
||||||
viper.AddConfigPath("/usr/local/etc")
|
viper.AddConfigPath("/usr/local/etc")
|
||||||
|
|
|
@ -168,7 +168,13 @@ func (p *ChamberController) computeChamberState() ChamberState {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Ensure compressor cooldown
|
// Ensure compressor cooldown
|
||||||
if p.chamberState != ChamberStateCooling && next == ChamberStateCooling && time.Since(p.lastCoolerStateChange).Seconds() < p.config.Limits.MinCoolerCooldownSecs {
|
if p.chamberState != ChamberStateCooling && next == ChamberStateCooling &&
|
||||||
|
time.Since(p.lastCoolerStateChange).Seconds() < p.config.Limits.MinCoolerCooldownSecs {
|
||||||
|
return ChamberStateIdle
|
||||||
|
}
|
||||||
|
|
||||||
|
// Ensure that heater wont run just after cooling cycle
|
||||||
|
if p.chamberState != ChamberStateHeating && next == ChamberStateHeating && time.Since(p.lastCoolerStateChange).Seconds() < p.config.Limits.HeaterGraceTimeSecs {
|
||||||
return ChamberStateIdle
|
return ChamberStateIdle
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -29,9 +29,10 @@ type ControllerConfig struct {
|
||||||
Limits struct {
|
Limits struct {
|
||||||
MinChamberTemperature float64 `mapstructure:"min_chamber_temp"`
|
MinChamberTemperature float64 `mapstructure:"min_chamber_temp"`
|
||||||
MaxChamberTemperature float64 `mapstructure:"max_chamber_temp"`
|
MaxChamberTemperature float64 `mapstructure:"max_chamber_temp"`
|
||||||
MinCoolerRuntimeSecs float64 `mapstructure:"min_cooler_runtime_secs"` // 900
|
MinCoolerRuntimeSecs float64 `mapstructure:"min_cooler_runtime_secs"`
|
||||||
MaxCoolerRuntimeSecs float64 `mapstructure:"max_cooler_runtime_secs"` // 86400
|
MaxCoolerRuntimeSecs float64 `mapstructure:"max_cooler_runtime_secs"`
|
||||||
MinCoolerCooldownSecs float64 `mapstructure:"min_cooler_cooldown_secs"` // 900
|
MinCoolerCooldownSecs float64 `mapstructure:"min_cooler_cooldown_secs"`
|
||||||
|
HeaterGraceTimeSecs float64 `mapstructure:"heater_grace_time_secs"`
|
||||||
} `mapstructure:"limits"`
|
} `mapstructure:"limits"`
|
||||||
|
|
||||||
PID struct {
|
PID struct {
|
||||||
|
|
Loading…
Reference in a new issue