Set min and max PWM of fan
-
Hello, I want to control a proportionnal pneumatic valve that need a PWM signal between 45% and 70%. I have it configured as a fan using theses commands :
M950 F0 C"0.out2" Q1000 M106 P0 S0 C"T0" B0.1 L0.45 X0.7
In my understanding the value chose between 0% and 100% should be a proportionnal of the values between 45% and 70%. However when I try to plot the actual vs expected value I have the following curve :
Can you tel me why nothing change before S0.6 ? And how can I fix this ?
-
@e4d Just a guess but maybe your pneumatic valve doesn't play nicely with a high PWM frequency. I'd be tempted to try something like 10Hz (the "Q" value in M106).
-
@e4d The way it is working is as intended (at least it is how it is coded and documented). So I'm afraid that your understanding does not match the current implementation (though arguably the way you expect it to work would perhaps be better).
From the docs:
The requested PWM value (S parameter) is scaled to be between 0 and X parameter value, and rounded up to the minimum
and from the code:
reqVal = (val <= 0.0) ? 0.0 : max<float>(val * maxVal, minVal); // scale the requested PWM by the maximum, enforce the minimum
https://github.com/Duet3D/DuetWebControl/blob/master/src/components/panels/FanPanel.vue#L64
So basically it takes the requested value (0.0...1.0) and scales that by the maximum set value, it then compares that with the minimum set value and uses the larger of the two.
I'm not totally sure why the current implementation is the way it is, there may be a good reason. Perhaps @dc42 would like to comment.