Skip to content

Commit 1eddb05

Browse files
committed
Fix ramped duty by factoring in maxDuty
1 parent c2f264f commit 1eddb05

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

src/heater.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,7 @@ void APB::Heater::Private::loop()
234234
Log.traceln("%s current temperature=`%F`", log_scope, currentTemperature);
235235
if(currentTemperature < dynamicTargetTemperature) {
236236
float rampFactor = rampOffset > 0 ? (dynamicTargetTemperature - currentTemperature)/rampOffset : 1;
237-
float targetPWM = std::max(0.f, std::min(1.f, rampFactor));
237+
float targetPWM = std::max(0.f, std::min(1.f, rampFactor * maxDuty));
238238
Log.infoln("%s - temperature `%F` lower than target temperature `%F`, ramp=`%F` and max PWM is `%F`, ramp factor=`%F`, setting PWM to `%F`",
239239
log_scope,
240240
currentTemperature,

0 commit comments

Comments
 (0)